Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(crypto): use mnemonicToSeedSync for BIP39 seed derivation

Steven Enamakel55aa78eaafaf
diff --git a/app/src/utils/cryptoKeys.ts b/app/src/utils/cryptoKeys.ts
index a2e371b2ff..991ecfee76 100644
--- a/app/src/utils/cryptoKeys.ts
+++ b/app/src/utils/cryptoKeys.ts
@@ -42,14 +42,8 @@ export function validateMnemonicPhrase(mnemonic: string): boolean {
* Returns the key as a hex string.
*/
export function deriveAesKeyFromMnemonic(mnemonic: string): string {
- // Keep the application-owned encryption-key derivation independent of the
- // wallet module. BIP39 seed derivation is PBKDF2-HMAC-SHA512 over the NFKD
- // mnemonic with the standard empty-passphrase salt.
- const password = new TextEncoder().encode(mnemonic.normalize('NFKD'));
- const seed = pbkdf2(sha512, password, new TextEncoder().encode('mnemonic'), {
- c: 2048,
- dkLen: 64,
- });
+ // Get the BIP39 seed (512-bit) from the mnemonic
+ const seed = mnemonicToSeedSync(mnemonic);
// Derive a 256-bit AES key using PBKDF2 with the seed
const salt = new TextEncoder().encode('openhuman-aes-key-v1');