From 4ab464bcaa8eb59bed757afcc4ad3fb290485638 Mon Sep 17 00:00:00 2001 From: Christopher Date: Wed, 28 Jan 2026 06:16:35 -0800 Subject: [PATCH] Fix crypto_generichash usage in useUserIdentity Adds the missing third argument (null) to sodium.crypto_generichash to ensure correct hashing behavior when generating the salt for storage key derivation. --- src/lib/hooks/useUserIdentity.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/hooks/useUserIdentity.ts b/src/lib/hooks/useUserIdentity.ts index 73dd475..79a5f8e 100644 --- a/src/lib/hooks/useUserIdentity.ts +++ b/src/lib/hooks/useUserIdentity.ts @@ -144,7 +144,7 @@ export function useUserIdentity() { const saltString = `synapsis-chat-storage-${identity.did}`; // Generate a fixed-length salt from the DID // Hash to 32 bytes, then take first 16 bytes for salt - const fullHash = sodium.crypto_generichash(32, saltString); + const fullHash = sodium.crypto_generichash(32, saltString, null); const salt = fullHash.slice(0, sodium.crypto_pwhash_SALTBYTES); console.log('[Identity] Deriving storage key...');