]> git.codecow.com Git - libnemo.git/commitdiff
Slice new wallet secrets for user backup before they are erased in finally.
authorChris Duncan <chris@codecow.com>
Wed, 5 Aug 2026 17:44:37 +0000 (10:44 -0700)
committerChris Duncan <chris@codecow.com>
Wed, 5 Aug 2026 17:44:37 +0000 (10:44 -0700)
src/lib/crypto/wallet-aes-gcm.ts
src/lib/vault/vault-worker.ts
test/GLOBALS.mjs

index 27ad449db77fbe8431b3249c78c67dd6a4bb76f7..ce47c5b27ced8946b94729ec2533f6e259b38d6a 100644 (file)
@@ -1,5 +1,3 @@
-
-
 //! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
 //! SPDX-License-Identifier: GPL-3.0-or-later
 
index 9e891790ee262fab5c45e534fc09a65dba9cd767..ec4b40ad44722a6b25fd95a2296d89de14749909 100644 (file)
@@ -154,7 +154,9 @@ function create (type?: WalletType, id?: UUID, key?: CryptoKey, keySalt?: ArrayB
                        if (_seed == null || _mnemonic == null) {
                                throw new Error('Failed to generate seed and mnemonic')
                        }
-                       return { iv, salt, encrypted, seed: _seed.slice(), mnemonic: _mnemonic.slice() }
+                       const seed = _seed.slice()
+                       const mnemonic = _mnemonic.slice()
+                       return { iv, salt, encrypted, seed, mnemonic }
                })
                .catch(err => {
                        console.error(err)
index 1b4c065f462fb31a1ac57546756ef205b132079a..fbc1992a9d4c8da7472338057e68863d4cfc3dc2 100644 (file)
@@ -283,14 +283,15 @@ export class assert {
 
        /**
         * @param {unknown} bool
+        * @param {string} message
         * @returns {asserts bool}
         */
-       static ok (bool) {
+       static ok (bool, message) {
                if (typeof bool !== 'boolean') {
                        throw new Error('Invalid assertion')
                }
                if (!bool) {
-                       throw new Error(`test result falsy`, { cause: bool })
+                       throw new Error(`test result falsy`, { cause: message })
                }
        }