From: Chris Duncan Date: Tue, 15 Jul 2025 18:43:14 +0000 (-0700) Subject: Do not store mnemonic if it does not exist. X-Git-Tag: v0.10.5~57^2~13 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=15ebb4feb167b11357b4cb26a9db1fbc092eb42b;p=libnemo.git Do not store mnemonic if it does not exist. --- diff --git a/src/lib/wallets/wallet.ts b/src/lib/wallets/wallet.ts index 5a1574d..4834b5a 100644 --- a/src/lib/wallets/wallet.ts +++ b/src/lib/wallets/wallet.ts @@ -7,7 +7,7 @@ import { ADDRESS_GAP } from '#src/lib/constants.js' import { bytes, utf8 } from '#src/lib/convert.js' import { Entropy } from '#src/lib/entropy.js' import { Rpc } from '#src/lib/rpc.js' -import { SafeWorker } from '#workers' +import { Data, SafeWorker } from '#workers' export type KeyPair = { publicKey?: string, @@ -161,12 +161,14 @@ export abstract class Wallet { method: 'set', name: this.id } - const data = { + const data: Data = { password: new Uint8Array(password).buffer, id: new Uint8Array(this.#id.bytes).buffer, - mnemonic: utf8.toBytes(this.#m?.phrase ?? '').buffer, seed: this.#s.buffer } + if (this.#m != null) { + data.mnemonic = utf8.toBytes(this.#m?.phrase ?? '').buffer + } const response = await SafeWorker.add(headers, data) const success = response[0].result if (!success) {