seed: bytes.toHex(new Uint8Array(this.#seed))
}
if (this.#mnemonic != null) data.mnemonic = this.#mnemonic
- const iv = crypto.getRandomValues(new Uint8Array(32)).buffer
+
+ // restrict iv to 96 bits per GCM best practice
+ const iv = crypto.getRandomValues(new Uint8Array(12)).buffer
const encoded = utf8.toBytes(JSON.stringify(data))
const encrypted = await crypto.subtle.encrypt({ name: 'AES-GCM', iv }, key, encoded)
return { iv, encrypted }