From: Chris Duncan Date: Sat, 25 Apr 2026 07:31:53 +0000 (-0700) Subject: v0.12.0 X-Git-Tag: v0.12.0 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=c68e0b1f30ddbc671eb76cc8dad7a047914a3ba8;p=libnemo.git v0.12.0 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index e65c08c..086fe9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,67 @@ SPDX-License-Identifier: GPL-3.0-or-later # Changelog +## v0.12.0 + +### Notable Changes + +#### Sign arbitrary data directly + +Previously, the process that `libnemo` followed in order to sign arbitrary data, +represented as one or more strings, was to first hash them all using BLAKE2b and +outputting a 32-byte digest. However, `nano25519` interally already hashes the +message input using BLAKE2b anyway, and it seemed inconsistent to claim the API +support signing arbitrary data when it is in fact signing a hash of the data. + +Now, the input data is treated as UTF-8 strings and encoded to bytes using the +browser built-in `TextEncoder` class, and then it is passed directly to +`nano25519` for signing without hashing. + +#### Refactored Account class + +Now that public keys can be derived extremely quickly using `nano25519`, there +is no need to require async loading to Account objects. The constructor is now +accessible and accepts a Nano address string for instantiation; it also accepts +either a public key or private key, the type of which is determined by an +additional optional parameter (default is public), as a hex string or a byte +array. + +```javascript +// string inputs, hex strings are assumed to be public keys by default +let acc = new Account('nano_123...890'); +acc = new Account('90af...ec65'); // defaults to public +acc = new Account('1274...cc99', 'public'); +acc = new Account('7adf...b78a', 'private'); + +// byte inputs, assumed to be public key by default +acc = new Account(new Uint8Array([0x12, 0xab, ...])); // defaults to public +acc = new Account(new Uint8Array([0x34, 0xcd, ...]), 'public') +acc = new Account(new Uint8Array([0x78, 0xbb, ...]), 'private') +``` + +The `index` property has been removed from the `Account` class because it is +intrinsic to wallets, not accounts. `Wallet` objects still keep track of their +accounts by index as before. + +#### Generate PoW when transmitting Block + +The transmission of a block to the Nano network implies that the block is fully +populated with the necessary data to be processed. One common stumbling block +(pun intended) is generating proof-of-work; numerous comments from the Nano dev +community have indicated that this step is a challenge. + +Now, when calling `process()` on a Block, if the `work` property is missing, +`libnemo` will automatically generate a value using `NanoPow`. The Block's +`pow()` method can still be called manually as before, but since processing is +already a step that is subject to lag from network conditions, ensuring that the +block is not rejected for missing `work` should hopefully improve the dev +experience. + +### Other Changes + +Fixed key byte argument being zeroed by `Tools.sign()`, leaving the key handling +to the responsibility of the consumer. + ## v0.11.0 ### Notable Changes diff --git a/package-lock.json b/package-lock.json index 2c7f2d2..d2b4c74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "libnemo", - "version": "0.11.0", + "version": "0.12.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "libnemo", - "version": "0.11.0", + "version": "0.12.0", "license": "(GPL-3.0-or-later AND MIT AND ISC)", "dependencies": { "@ledgerhq/hw-transport-web-ble": "^6.33.1", @@ -853,9 +853,9 @@ "license": "MIT" }, "node_modules/basic-ftp": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.2.2.tgz", - "integrity": "sha512-1tDrzKsdCg70WGvbFss/ulVAxupNauGnOlgpyjKzeQxzyllBLS0CGLV7tjIXTK3ZQA9/FBEm9qyFFN1bciA6pw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.3.0.tgz", + "integrity": "sha512-5K9eNNn7ywHPsYnFwjKgYH8Hf8B5emh7JKcPaVjjrMJFQQwGpwowEnZNEtHs7DfR7hCZsmaK3VA4HUK0YarT+w==", "license": "MIT", "optional": true, "engines": { diff --git a/package.json b/package.json index 43ba7f5..6a4ba6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "libnemo", - "version": "0.11.0", + "version": "0.12.0", "description": "Nano cryptocurrency wallet library.", "keywords": [ "nemo",