]> git.codecow.com Git - nano25519.git/commitdiff
v2.0.0 v2.0.0
authorChris Duncan <chris@codecow.com>
Sun, 18 Oct 2026 10:43:53 +0000 (03:43 -0700)
committerChris Duncan <chris@codecow.com>
Sun, 18 Oct 2026 10:43:53 +0000 (03:43 -0700)
CHANGELOG.md
README.md
package-lock.json
package.json
test/index.html

index 5741418ae7efc6f02dd32defedf9c5e80327efaa..083baba1a86febcb39ce4964d76a1d81213733aa 100644 (file)
@@ -5,6 +5,33 @@ SPDX-License-Identifier: GPL-3.0-or-later
 
 # Changelog
 
+## v2.0.0
+
+- Add `verify_blocks()` which uses ed25519-donna policy to align with nano-node.
+  It can verify up to 64 signatures for a given public key which speeds up
+  verification by ~9%. `verify()` still uses a stricter cofactored policy which
+  offers SUF-CMA and SBS for tamper-proof unambiguous signatures.
+- Remove async API; all primitives are synchronous functions only.
+- Improve memory sanitization by exporting setters instead of the raw WASM
+  buffer, zeroing bytes as soon as they are no longer needed, and decoding with
+  character code arithmetic instead of variable-time intrinsic functions.
+- Update `derive()` to always return a hex string by default. Passing an
+  optional preallocated output buffer will write bytes to it directly and return
+  `undefined` instead of a string: `derive(prv[, out]);`
+- Update `sign()` to take private and public keys as separate parameters instead
+  of a concatenated 64-byte secret key: `sign(msg, prv, pub)`
+- Update `sign()` to always return a hex string by default. Passing an
+  optional preallocated output buffer will write bytes to it directly and return
+  `undefined` instead of a string: `sign(msg, prv, pub[, out]);`
+- Update `sign()` to always rederive the public key and throw if it does not
+  match the relevant user input.
+- Update `verify()` to reject non-canonical R.
+- Fix `verify()` to properly expand integer types prior to shifting.
+- Reject `ArrayBuffer` arguments and only accept bytes as `Uint8Array`.
+- Increase maximum message size for signing and verification to 64 KiB.
+- Export important constants for ease of integration.
+- Improve error logging and greatly expanded unit testing.
+
 ## v1.0.8
 
 - Remove extraneous error logging and fix relevant tests.
index fa2ed2dd74689be2265d6dbd8f51154a1349816f..9637624d30aa351c9c28135f0b5badb2506c2b93 100644 (file)
--- a/README.md
+++ b/README.md
@@ -39,12 +39,12 @@ CDN URL works, and modern browsers make it even simpler with import maps:
       "nano25519": "https://unpkg.com/nano25519@2.0.0/dist/browser.js"
     },
     "integrity": {
-      "https://unpkg.com/nano25519@2.0.0/dist/browser.js": "sha512-123Abc..."
+      "https://unpkg.com/nano25519@2.0.0/dist/browser.js": "sha512-bJnXSxESvcTNkzXTtqJThciGM7+TbjpSWzGN5bsVQk6CylYm1PO6lCNb/Nh7xvO2VwP4BNqRaHCOVF/m+oKOSA=="
     }
   }
 </script>
 <script type="module">
-  import { derive, sign, verify } from "nano25519";
+  import { derive, sign, verify, verify_blocks } from "nano25519";
 </script>
 ```
 
@@ -77,10 +77,11 @@ To be able to clear a private key after use, pass it as bytes viewed over an
 `ArrayBuffer`, and clear it with `fill(0)`, as the examples below do:
 
 ```javascript
-// `usersPrivateKeyBuffer` is an ArrayBuffer holding the 32-byte private key, so
-// `prv` is a view of it, not a copy
+// `usersPrivateKeyBuffer` is an ArrayBuffer holding the 32-byte private key
+// `prv` is a Uint8Array view over the private key buffer
 const prv = new Uint8Array(usersPrivateKeyBuffer);
 
+// `pub` is public key for a Nano account as a 64-character hexadecimal string
 const pub = nano25519.derive(prv);
 // clean up
 prv.fill(0);
@@ -126,7 +127,7 @@ const prv = new Uint8Array(usersPrivateKeyBuffer);
 // `pub` is an empty 32-byte Uint8Array
 const pub = new Uint8Array(32);
 
-// return discarded, 32-byte public key is written to `pub`
+// 32-byte public key is written to `pub`, return value is `undefined`
 nano25519.derive(prv, pub);
 // clean up
 prv.fill(0);
@@ -174,7 +175,7 @@ const pub = new Uint8Array(publicKeyBuffer);
 // `sig` is an empty 64-byte Uint8Array
 const sig = new Uint8Array(64);
 
-// return value is discarded, 64-byte signature is written to `sig`
+// 64-byte signature is written to `sig`, return value is `undefined`
 nano25519.sign(msg, prv, pub, sig);
 // clean up
 prv.fill(0);
@@ -350,12 +351,12 @@ See AUTHORS.md
 
 GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
 
-libsodium is distributed under the ISC license and was referenced from the
-following commit hash:
+libsodium is distributed under the ISC license and was originally referenced
+from the following commit hash:
 <https://github.com/jedisct1/libsodium/tree/d24faf56214469b354b01c8ba36257e04737101e>
 
-tweetnacl-js is public domain under the Unlicense and was referenced from the
-following commit hash:
+tweetnacl-js is public domain under the Unlicense and was originally referenced
+from the following commit hash:
 <https://github.com/dchest/tweetnacl-js/tree/e6141a20553498697e9e7d92fbc4517994caff52>
 
 ## Donations
index 8859b0f2c67889cb35a6d9b277d4feca403614a1..71fe1e2cb68adc3de7dba77db74e29cd2c47d033 100644 (file)
@@ -1,13 +1,13 @@
 {
        "name": "nano25519",
-       "version": "1.0.8",
+       "version": "2.0.0",
        "lockfileVersion": 3,
        "requires": true,
        "packages": {
                "": {
                        "name": "nano25519",
-                       "version": "1.0.8",
-                       "license": "(GPL-3.0-or-later AND MIT)",
+                       "version": "2.0.0",
+                       "license": "(GPL-3.0-or-later AND ISC)",
                        "devDependencies": {
                                "@types/node": "26.2.0",
                                "assemblyscript": "0.28.20",
index 4b212cf19cae16caa327a49989cc00b0fdc761d5..fb9de86beb8d490a68de092b4995aab414e9584b 100644 (file)
@@ -1,6 +1,6 @@
 {
        "name": "nano25519",
-       "version": "1.0.8",
+       "version": "2.0.0",
        "description": "Public key derivation, transaction signing, and signature verification for Nano cryptocurrency using AssemblyScript.",
        "keywords": [
                "nemo",
index aa5e4ea22675bd4841f7570016c86d2e302d62c3..569dca96cb85b6053ebc099f2488e805a4ca21a9 100644 (file)
@@ -18,7 +18,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                "libsodium-wrappers": "https://unpkg.com/libsodium-wrappers@0.8.4/dist/modules-esm/libsodium-wrappers.mjs",
                                "nano25519": "https://unpkg.com/nano25519@2.0.0/dist/browser.js",
                                "tweetnacl": "https://unpkg.com/tweetnacl@1.0.3/nacl-fast.js",
-                               "#vectors": "https://git.codecow.com/?p=nano25519.git;a=blob_plain;f=test/vectors.mjs;hb=refs/heads/main"
+                               "#vectors": "https://git.codecow.com/?p=nano25519.git;a=blob_plain;f=test/vectors.mjs;hb=refs/tags/v2.0.0"
                        },
                        "scopes": {
                                "/test/": {
@@ -28,10 +28,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        },
                        "integrity": {
                                "https://unpkg.com/@noble/hashes@2.4.0/sha2.js": "sha256-RxdGu6bsTGI4ykE1jR07QLb/Mc8zY/C01VDGScGo6Ds=",
+                               "https://unpkg.com/@noble/hashes@2.4.0/_md.js": "sha256-YM8wEP2onj5NPw5/8c4knpxGfzS0/UG2/WEB2fab52M=",
+                               "https://unpkg.com/@noble/hashes@2.4.0/_u64.js": "sha256-sJ2owH/oGHwHZJSUzbfNC88T35C1BqlHPRnk1fjC4QI=",
+                               "https://unpkg.com/@noble/hashes@2.4.0/utils.js": "sha256-A3rUmtt4FotraZWY/TP4X3h3RWsdKLTQMuKhoWgHlHw=",
                                "https://unpkg.com/@noble/ed25519@3.2.0/index.js": "sha256-pPYx0YdrXZ5DqGzXEZTKJ7XhRR7fS6TbmkGPQKR1Vpo=",
                                "https://unpkg.com/libsodium@0.8.4/dist/modules-esm/libsodium.mjs": "sha512-8NozLMgdpZ2aM7BpDlekMIWsfF9pVq8fy1Gela2kBuP6DZmOd51NBxBZSbncxiDknW1EJYmu7Th3WYWhjgUygw==",
                                "https://unpkg.com/libsodium-wrappers@0.8.4/dist/modules-esm/libsodium-wrappers.mjs": "sha512-8lc4H4LWq+iFFPBBVIxpwTbOVJxeF0V4GgEDQIrlTOUzBEl7FT6zKQPoFi7prCeUVHnunjOyHrXgAFX7mWPupw==",
-                               "https://unpkg.com/tweetnacl@1.0.3/nacl-fast.js": "sha512-vtXgmExiD+YrImVtOeCfoGiVKgouA3SgPHZbLQKcC972FeFo5i881KTOMxtK7dsZa2z5vjpyCpDSd1lGvJY3bg=="
+                               "https://unpkg.com/nano25519@2.0.0/dist/browser.js": "sha512-bJnXSxESvcTNkzXTtqJThciGM7+TbjpSWzGN5bsVQk6CylYm1PO6lCNb/Nh7xvO2VwP4BNqRaHCOVF/m+oKOSA==",
+                               "https://unpkg.com/tweetnacl@1.0.3/nacl-fast.js": "sha512-vtXgmExiD+YrImVtOeCfoGiVKgouA3SgPHZbLQKcC972FeFo5i881KTOMxtK7dsZa2z5vjpyCpDSd1lGvJY3bg==",
+                               "https://git.codecow.com/?p=nano25519.git;a=blob_plain;f=test/vectors.mjs;hb=refs/tags/v2.0.0": "sha512-8da7GVIhpvrVoF7TE9RWpNoPIh2SC0Co+QoBCn0scO3FeQbV1e4yfuijFahSMTHaUx2/wlNm0b5yNRyiqsMehQ==",
+                               "./vectors/mjs": "sha512-8da7GVIhpvrVoF7TE9RWpNoPIh2SC0Co+QoBCn0scO3FeQbV1e4yfuijFahSMTHaUx2/wlNm0b5yNRyiqsMehQ==",
+                               "../dist/browser.js": "sha512-bJnXSxESvcTNkzXTtqJThciGM7+TbjpSWzGN5bsVQk6CylYm1PO6lCNb/Nh7xvO2VwP4BNqRaHCOVF/m+oKOSA=="
                        }
                }
        </script>