Skip to content

Commit

Permalink
fix incorrect hkdf output size
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Jan 17, 2025
1 parent 3cc7d27 commit f684a58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/src/common/universalVaultFormat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export class UniversalVaultFormat implements AccessTokenProducing, VaultTemplate
public async computeRootDirIdHash(rootDirId: Uint8Array): Promise<string> {
const textencoder = new TextEncoder();
const initialSeed = await crypto.subtle.importKey('raw', this.metadata.initialSeed, { name: 'HKDF' }, false, ['deriveKey']);
const hmacKey = await crypto.subtle.deriveKey({ name: 'HKDF', hash: 'SHA-512', salt: this.metadata.kdfSalt, info: textencoder.encode('hmac') }, initialSeed, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
const hmacKey = await crypto.subtle.deriveKey({ name: 'HKDF', hash: 'SHA-512', salt: this.metadata.kdfSalt, info: textencoder.encode('hmac') }, initialSeed, { name: 'HMAC', hash: 'SHA-256', length: 256 }, false, ['sign']);
const rootDirHash = await crypto.subtle.sign('HMAC', hmacKey, rootDirId);
return base32.stringify(new Uint8Array(rootDirHash).slice(0, 20));
}
Expand Down

0 comments on commit f684a58

Please sign in to comment.