From 96df232191057cbc5f9655fab6ec5eb060a58baa Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Sat, 1 Aug 2026 20:15:48 +0200 Subject: [PATCH] Update RustCore.ts (#2159) --- apps/browser-extension/src/utils/RustCore.ts | 31 ++++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/apps/browser-extension/src/utils/RustCore.ts b/apps/browser-extension/src/utils/RustCore.ts index edefb4754..8a1b66ed5 100644 --- a/apps/browser-extension/src/utils/RustCore.ts +++ b/apps/browser-extension/src/utils/RustCore.ts @@ -263,14 +263,14 @@ export type CodecManifest = { migrationId: string; userSalt: string; canonicalizedAt: string; - /** Set on a shared-folder manifest: the Folders.Id this manifest carries. Absent on a root manifest. */ + manifestId: string; sharedFolderId?: string | null; tables: Record>>; [key: string]: unknown; }; -/** One shared folder to split out during canonicalize: the folder id + that manifest's own blob salt. */ -export type CodecSharedFolderSpec = { folderId: string; userSalt: string }; +/** One shared folder to split out during canonicalize: its manifest id, folder id, and that manifest's own blob salt. */ +export type CodecSharedFolderSpec = { manifestId: string; folderId: string; userSalt: string }; /** One shared-folder manifest produced by the canonicalize split, with its own blob map. */ export type CodecSharedVault = { folderId: string; manifest: CodecManifest; blobs: Record }; @@ -315,6 +315,7 @@ export type CodecCanonicalizeInput = { tables: CodecTableData[]; userSalt: string; migrationId: string; + rootManifestId: string; sharedFolders?: CodecSharedFolderSpec[]; canonicalizedAt: string; }; @@ -348,12 +349,11 @@ export async function vaultCodecMaterializeAsSqlite(manifest: CodecManifest, dat } /** - * Extract the encryption-key row whose `PublicKey` matches `publicKey` from the decrypted `EncryptionKeys` - * data bucket. Returns null when no live row carries that key. + * Extract the encryption-key row whose `PublicKey` matches `publicKey` from a decrypted manifest. */ -export async function vaultCodecExtractEncryptionKeyForPublicKeyFromBucket(bucket: CodecDataBucket, publicKey: string): Promise | null> { +export async function vaultCodecExtractEncryptionKeyForPublicKey(manifest: CodecManifest, publicKey: string): Promise | null> { await initRustCore(); - return (core.vaultCodecExtractEncryptionKeyForPublicKeyFromBucket(bucket, publicKey) ?? null) as Record | null; + return (core.vaultCodecExtractEncryptionKeyForPublicKey(manifest, publicKey) ?? null) as Record | null; } /** @@ -383,30 +383,29 @@ export async function vaultCodecBucketLayout(): Promise { +export async function vaultCodecLogoIdForSource(manifestId: string, source: string): Promise { await initRustCore(); - return core.vaultCodecLogoIdForSource(sharedFolderId ?? undefined, source); + return core.vaultCodecLogoIdForSource(manifestId, source); } /** - * The `Logos.Id` to use for the logo `(kind, source)` inside a given manifest scope (`null` = the - * user's own personal vault, otherwise the shared folder's id). + * The `Logos.Id` to use for the logo `(kind, source)` inside the manifest with id `manifestId`. */ -export async function vaultCodecLogoIdFor(sharedFolderId: string | null, kind: string, source: string): Promise { +export async function vaultCodecLogoIdFor(manifestId: string, kind: string, source: string): Promise { await initRustCore(); - return core.vaultCodecLogoIdFor(sharedFolderId ?? undefined, kind, source); + return core.vaultCodecLogoIdFor(manifestId, kind, source); } /** - * The sha256 (lowercase hex) of an uploaded logo's bytes: the `Source` a `custom` logo row is stored + * The SHA-256 (lowercase hex) of an uploaded logo's bytes: the `Source` a `custom` logo row is stored * under, which is what makes picking the same image again reuse the row that already holds it. */ export async function vaultCodecLogoContentHash(bytes: Uint8Array): Promise {