This commit is contained in:
EthanShoeDev
2025-10-04 16:53:08 -04:00
parent d3f492facb
commit cabc3bb55d
4 changed files with 48 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
import { logger, consoleTransport } from "react-native-logs";
import { logger, consoleTransport } from 'react-native-logs';
export const rootLogger = logger.createLogger({
levels: {
@@ -7,17 +7,17 @@ export const rootLogger = logger.createLogger({
warn: 2,
error: 3,
},
severity: "debug",
severity: 'debug',
transport: consoleTransport,
transportOptions: {
colors: {
info: "blueBright",
warn: "yellowBright",
error: "redBright",
info: 'blueBright',
warn: 'yellowBright',
error: 'redBright',
},
},
async: true,
dateFormat: "time",
dateFormat: 'time',
printLevel: true,
printDate: true,
fixedExtLvlLength: false,

View File

@@ -202,7 +202,10 @@ function makeBetterSecureStore<
(mChunk) => mChunk.manifestChunk.entries.length === 0,
);
if (emptyManifestChunks.length > 0) {
logger.debug('removing empty manifest chunks', emptyManifestChunks.length);
logger.debug(
'removing empty manifest chunks',
emptyManifestChunks.length,
);
manifest.rootManifest.manifestChunksIds =
manifest.rootManifest.manifestChunksIds.filter(
(mChunkId) =>
@@ -247,7 +250,10 @@ function makeBetterSecureStore<
const existingManifestChunkWithRoom = manifest.manifestChunks.find(
(mChunk) => sizeLimit > mChunk.manifestChunkSize + newManifestEntrySize,
);
logger.debug('existingManifestChunkWithRoom', existingManifestChunkWithRoom);
logger.debug(
'existingManifestChunkWithRoom',
existingManifestChunkWithRoom,
);
const manifestChunkWithRoom =
existingManifestChunkWithRoom ??
(await (async () => {
@@ -259,7 +265,9 @@ function makeBetterSecureStore<
manifestChunkId: Crypto.randomUUID(),
manifestChunkSize: 0,
} satisfies NonNullable<(typeof manifest.manifestChunks)[number]>;
logger.info(`Adding new manifest chunk ${newManifestChunk.manifestChunkId}`);
logger.info(
`Adding new manifest chunk ${newManifestChunk.manifestChunkId}`,
);
manifest.rootManifest.manifestChunksIds.push(
newManifestChunk.manifestChunkId,
);
@@ -336,7 +344,9 @@ async function upsertPrivateKey(params: {
throw new Error('Invalid private key', { cause: validateKeyResult.error });
}
const keyId = params.keyId ?? `key_${Crypto.randomUUID()}`;
logger.info(`${params.keyId ? 'Upserting' : 'Creating'} private key ${keyId}`);
logger.info(
`${params.keyId ? 'Upserting' : 'Creating'} private key ${keyId}`,
);
// Preserve createdAtMs if the entry already exists
const existing = await betterKeyStorage
.getEntry(keyId)

View File

@@ -15,7 +15,6 @@ export const AbortSignalTimeout = (timeout: number) => {
return controller.signal;
};
export const useContextSafe = <T>(context: Context<T>) => {
const contextValue = use(context);
if (!contextValue) {