From: Chris Duncan Date: Thu, 3 Jul 2025 19:51:54 +0000 (-0700) Subject: Destroy wallet safe asynchronously. X-Git-Tag: v0.10.5~136^2~11 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=7e2b270d2ad078d6eba65ff4c12dbbbcc9f54b8f;p=libnemo.git Destroy wallet safe asynchronously. --- diff --git a/src/lib/wallets/bip44-wallet.ts b/src/lib/wallets/bip44-wallet.ts index 2f5d9aa..dcbf72b 100644 --- a/src/lib/wallets/bip44-wallet.ts +++ b/src/lib/wallets/bip44-wallet.ts @@ -47,8 +47,8 @@ export class Bip44Wallet extends Wallet { * Removes encrypted secrets in storage and releases variable references to * allow garbage collection. */ - destroy () { - super.destroy() + async destroy (): Promise { + await super.destroy() this.#poolBip44Ckd.terminate() } diff --git a/src/lib/wallets/wallet.ts b/src/lib/wallets/wallet.ts index 4113fd4..726d20a 100644 --- a/src/lib/wallets/wallet.ts +++ b/src/lib/wallets/wallet.ts @@ -65,7 +65,7 @@ export abstract class Wallet { * Removes encrypted secrets in storage and releases variable references to * allow garbage collection. */ - destroy (): void { + async destroy (): Promise { let i = 0 for (const a in this.#accounts) { this.#accounts[a].destroy() @@ -75,10 +75,11 @@ export abstract class Wallet { this.#mnemonic = null this.#seed = null this.#poolNanoNacl.terminate() - this.#poolSafe.assign({ + await this.#poolSafe.assign({ method: 'destroy', name: this.id - }).finally(this.#poolSafe.terminate) + }) + this.#poolSafe.terminate() } /** @@ -276,11 +277,13 @@ export abstract class Wallet { password = utf8.toBytes(password) } try { - const { id, mnemonic, seed } = await this.#poolSafe.assign({ + const data = await this.#poolSafe.assign({ method: 'get', name: this.id, password }) + console.log(data[0].result) + const { id, mnemonic, seed } = data[0].result if (id !== this.id) { throw null }