import { bytes, utf8 } from '#src/lib/convert.js'\r
import { Entropy } from '#src/lib/entropy.js'\r
import { Rpc } from '#src/lib/rpc.js'\r
-import { SafeWorker } from '#workers'\r
+import { Data, SafeWorker } from '#workers'\r
\r
export type KeyPair = {\r
publicKey?: string,\r
method: 'set',\r
name: this.id\r
}\r
- const data = {\r
+ const data: Data = {\r
password: new Uint8Array(password).buffer,\r
id: new Uint8Array(this.#id.bytes).buffer,\r
- mnemonic: utf8.toBytes(this.#m?.phrase ?? '').buffer,\r
seed: this.#s.buffer\r
}\r
+ if (this.#m != null) {\r
+ data.mnemonic = utf8.toBytes(this.#m?.phrase ?? '').buffer\r
+ }\r
const response = await SafeWorker.add(headers, data)\r
const success = response[0].result\r
if (!success) {\r