]> git.codecow.com Git - libnemo.git/commitdiff
Clear entropy after using it to create new wallet.
authorChris Duncan <chris@zoso.dev>
Tue, 2 Sep 2025 20:41:50 +0000 (13:41 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 2 Sep 2025 20:41:50 +0000 (13:41 -0700)
src/lib/vault/vault-worker.ts

index 170d7c94bcf5aad551678ac2bacc148c63f44691..d0554af335a833f927cc349b652960b4b7a5fde7 100644 (file)
@@ -123,6 +123,7 @@ export class VaultWorker {
                        return Bip39.fromEntropy(entropy)
                                .then(bip39 => this.#load(type, key, keySalt, bip39.phrase, mnemonicSalt))
                                .then(({ iv, salt, encrypted }) => {
+                                       entropy.fill(0)
                                        if (this.#seed == null || this.#mnemonic == null) {
                                                throw new Error('Failed to generate seed and mnemonic')
                                        }
@@ -359,7 +360,6 @@ export class VaultWorker {
                                }
                                return crypto.subtle
                                        .deriveKey(derivationAlgorithm, derivationKey, derivedKeyType, false, [purpose])
-                                       .then(derivedKey => derivedKey)
                        })
                        .catch(err => {
                                throw new Error(err)