-
-
//! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
//! SPDX-License-Identifier: GPL-3.0-or-later
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)
/**
* @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 })
}
}