From: Chris Duncan Date: Sat, 13 Sep 2025 06:11:26 +0000 (-0700) Subject: Merge branch 'releases/v0.3' X-Git-Tag: v0.10.5~20 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=97f90982d5b8881dad0ef99c9b30f0b3536b07da;p=libnemo.git Merge branch 'releases/v0.3' --- 97f90982d5b8881dad0ef99c9b30f0b3536b07da diff --cc CHANGELOG.md index e9c6fae,407e5b8..2ac2512 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@@ -3,179 -3,12 +3,185 @@@ SPDX-FileCopyrightText: 2025 Chris Dunc SPDX-License-Identifier: GPL-3.0-or-later --> +## v0.8.0 + +### Notable Changes + +#### Configure wallet timeout + +Previously, the default timeout period before a wallet autolocked itself was set +to two minutes. Now, a new method `wallet.config()` accepts a configuration +object consisting of currently one property `timeout` indicating the timeout +period in seconds between 10 and 600 (10 minutes). If left unconfigured, the +default is still two minutes. + +#### Check for lock status + +A new property `wallet.isLocked` indicates if the wallet's Vault is in a locked +state. + +### Other Changes + +Vault timer includes a simple interval ticker to keep the worker from sleeping. + +Developer build now includes sourcemaps for easier debugging. + +Some new tests have been added and some existing ones fixed. + + + +## v0.7.0 + +### Notable Changes + +#### Wallet accounts use Map + +Since `libnemo` allows any arbitrary account index within the valid index range +to be derived from a wallet, iterating arrays can be catastrophically slow. A +custom class with a custom iterator implementation was used previously, but to +take advantage of engine performance optimizations geared towards built-ins, it +now uses the Map class instead. + +### Other Changes + +Accounts implement toJSON() method to stringify all relevant properties. + +Tests are type checked, and the custom assert implementation in tests uses type +guards to inform subsequent code. + +README and package description updated. + + + +## v0.6.0 + +### Notable Changes + +#### Minification support + +Due to how the `Vault` worker was constructed, the build system could not take +advantage of all minification features without breaking how variable names and +class names are resolved in the worker itself. This version refactors how the +worker code is constructed in such a way that enables the build system to apply +name mangling and minification while bundling. This also enables other +frameworks like Angular to bundle `libnemo` without further breakage. + + + +## v0.5.3 + +### Notable Changes + +Fix type comparison to undefined when restoring Wallets from database. + + + +## v0.5.2 + +### Notable Changes + +Remove async-await from new Vault functionality in favor of Promise chaining +(see [v0.4.0](#v040) for details). + + + +## v0.5.1 + +### Notable Changes + +Fix type definitions for unit denomination `convert()` function overloads. + + + +## v0.5.0 + +### Notable Changes + +#### Sign arbitrary data with Wallet + +The ability to "log in with Nano" is gaining traction, and while the `sign()` +function from `Tools` allows signing arbitrary string data using a private key, +there was no way to sign with a `libnemo` wallet which does not expose private +keys. Now, the `sign()` instance method of the `Wallet` class has been updated +to accept one or more strings of data, hash them to a 32-byte value using +BLAKE2b, sign with a given account index, and return the signature. Note that +the data is first hashed only to maintain compatibility with other Nano tools; a +future update could enable signing full-length messages without hashing them. +Also note that the Nano app for Ledger wallets still have a bug which prevents +them from signing nonces. + +#### Implement missing password update method + +The `Vault` class for wallet secrets supports an `update` action to re-encrypt +them using a new password if the wallet is unlocked. However, the `Wallet` class +itself did not have a method to make this request to its vault. This has now +been implemented. + +### Other Changes + +The `convert()` tool now supports denomination output as a float in addition to +string and bigint. + +Some functions extracted to separate files to improve organization. + +Type definitions updated. + +Tests added or updated to accomodate new features. + + + +## v0.4.2 + +### Notable Changes + +Fix type comparison to undefined when restoring Wallets from database. + + + +## v0.4.1 + +### Notable Changes + +Redefine Vault worker class members as instance properties instead of static +properties and initialize the worker with `new` instead of an `init()` method +which allows it to privatize its properties again. + + + +## v0.4.0 + +### Notable Changes + +#### Vault abandons async-await + +Bundlers try to optimize code based on features supported by the target browser +environment as well as work around shortcomings or bugs. Sometimes this results +in mangling code that would otherwise be acceptable. Private class fields and +async-await are two such features that bundlers are eager to refactor. This is +particularly problematic for the Vault worker in `libnemo` due to how it loads +as a stringified data blog. To avoid this situation, async-await statements have +been replaced by traditional promise chaining in Vault-related classes, and +private members that were being hoisted outside the class scope (and thus being +lost when loading the worker) are now initialized in a static method so that +they keep their place in the class as designed. + +#### BLAKE2b outputs bytes only + +This change is intended purely to simplify the structure of the BLAKE2b hashing +implementation. The `digest()` method no longer accepts any parameters and will +always output bytes; hex string is no longer an output option, and the bytes +should be converted if necessary. + +### Other Changes + +Fixed some erroneous JSdoc comment documentation. + + ## v0.3.3 + + ### Notable Changes + + Fix restored wallets with undefined type. + ## v0.3.2 diff --cc test/test.lock-unlock.mjs index 736fba8,eabbfcb..195bb09 --- a/test/test.lock-unlock.mjs +++ b/test/test.lock-unlock.mjs @@@ -128,9 -104,10 +128,9 @@@ await Promise.all( await assert.resolves(wallet.destroy()) }) - await test('fail to unlock a Blake2bWallet with no input', async () => { + await test('fail to unlock a BLAKE2b wallet with no input', async () => { const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1) - //@ts-expect-error await assert.rejects(wallet.unlock(), { message: 'Failed to unlock wallet' }) //@ts-expect-error await assert.rejects(wallet.unlock(1), { message: 'Failed to unlock wallet' })