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.
This commit is contained in:
@@ -144,7 +144,7 @@ export function useUserIdentity() {
|
|||||||
const saltString = `synapsis-chat-storage-${identity.did}`;
|
const saltString = `synapsis-chat-storage-${identity.did}`;
|
||||||
// Generate a fixed-length salt from the DID
|
// Generate a fixed-length salt from the DID
|
||||||
// Hash to 32 bytes, then take first 16 bytes for salt
|
// 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);
|
const salt = fullHash.slice(0, sodium.crypto_pwhash_SALTBYTES);
|
||||||
|
|
||||||
console.log('[Identity] Deriving storage key...');
|
console.log('[Identity] Deriving storage key...');
|
||||||
|
|||||||
Reference in New Issue
Block a user