]> git.codecow.com Git - nano25519.git/commitdiff
Deprecate additional async references.
authorChris Duncan <chris@codecow.com>
Tue, 25 Aug 2026 13:13:51 +0000 (06:13 -0700)
committerChris Duncan <chris@codecow.com>
Tue, 25 Aug 2026 13:13:51 +0000 (06:13 -0700)
README.md
package.json
test/index.html

index 4c6baac876a86ff8443d57151e3dabe5982d3388..7589b02f58a773dca03ea29b1dd392f0edbc731d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -45,27 +45,21 @@ nano25519 can be used directly on a webpage with a script module:
 nano25519 can be imported into NodeJS projects:
 
 ```javascript
-import * as nano25519 from "nano25519";
+import { derive, sign, verify } from "nano25519";
 ```
 
-Sync and async modules can be imported separately depending on requirements.
+or
 
 ```javascript
-import { derive, sign, verify } from "nano25519/sync";
-import { deriveAsync, signAsync, verifyAsync } from "nano25519/async";
+import * as nano25519 from "nano25519";
 ```
 
 ## Usage
 
-Each function has a synchronous implementation which is preferable for speed.
-
-If a non-blocking solution is required, asynchronous implementations are
-provided which use Web Workers in the browser or Worker threads in NodeJS.
-
-Inputs can be passed as Uint8Array byte arrays (preferable) or strings. The
+Each primitive implementation is synchronous. Inputs can be passed as Uint8Array byte arrays (preferable) or strings. The
 output will return the same type as the input. A preallocated output buffer can
-be passed as an additional optional argument to the sync versions of `derive()`
-and `sign()` into which the result bytes will be written.
+be passed as an additional optional argument for `derive()`
+and `sign()`, and the result bytes will be written into it.
 
 ### Derive
 
@@ -93,14 +87,14 @@ nano25519.derive(prv, pub);
 prv.fill(0);
 ```
 
-### Derive (async)
+### Derive (strings)
 
 ```javascript
 // `prv` is a 64-character hex string private key
 const prv = "0000000000000000000000000000000000000000000000000000000000000000";
 
 // `pub` is a 64-character hex string public key for a Nano account
-const pub = await nano25519.deriveAsync(prv);
+const pub = nano25519.derive(prv);
 ```
 
 ### Sign
@@ -108,11 +102,13 @@ const pub = await nano25519.deriveAsync(prv);
 ```javascript
 // `msg` is a 32-byte hash of a valid Nano transaction block
 const msg = new Uint8Array(blockHashBuffer);
-// `sk` is a 64-byte secret key joining private and public keys
-const sk = new Uint8Array(joinPrivateKeyPublicKeyBuffer);
+// `prv` is a 32-byte private key
+const prv = new Uint8Array(privateKeyBuffer);
+// `pub` is a 32-byte public key derived from `prv`
+const pub = new Uint8Array(publicKeyBuffer);
 
 // `sig` is a 64-byte Uint8Array signature for the block hash
-const sig = nano25519.sign(msg, sk);
+const sig = nano25519.sign(msg, prv, pub);
 // clean up
 sk.fill(0);
 ```
@@ -122,18 +118,20 @@ sk.fill(0);
 ```javascript
 // `msg` is a 32-byte hash of a valid Nano transaction block
 const msg = new Uint8Array(blockHashBuffer);
-// `sk` is a 64-byte secret key joining private and public keys
-const sk = new Uint8Array(joinPrivateKeyPublicKeyBuffer);
+// `prv` is a 32-byte private key
+const prv = new Uint8Array(privateKeyBuffer);
+// `pub` is a 32-byte public key derived from `prv`
+const pub = new Uint8Array(publicKeyBuffer);
 // `sig` is an empty 64-byte Uint8Array
 const sig = new Uint8Array(64);
 
-// return discarded, 64-byte signature is written to `sig`
-nano25519.sign(msg, sk);
+// return value is discarded, 64-byte signature is written to `sig`
+nano25519.sign(msg, prv, pub);
 // clean up
 sk.fill(0);
 ```
 
-### Sign (async)
+### Sign (strings)
 
 ```javascript
 // `msg` is a 64-char hex string hash of a valid Nano transaction block
@@ -142,11 +140,9 @@ const msg = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
 const prv = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
 // `pub` is a 64-char hex string public key derived from `prv`
 const pub = await nano25519.deriveAsync(prv);
-// `sk` is a 128-char hex string secret key joining private and public keys
-const sk = prv + pub;
 
 // `sig` is a 128-char hex string signature for the block hash
-const sig = await nano25519.signAsync(msg, sk);
+const sig = await nano25519.signAsync(msg, prv, pub);
 ```
 
 ### Verify
@@ -163,7 +159,7 @@ const pub = new Uint8Array(usersPublicKeyBuffer);
 const v = nano25519.verify(sig, msg, pub);
 ```
 
-### Verify (async)
+### Verify (strings)
 
 ```javascript
 // `sig` is a 128-char hex string signature
index 44f7292da5c91ad77ccd5307af5a04393cd27e0d..befa68cda53087326b6adc6cbadb457ad7cdef4f 100644 (file)
                        "types": "./dist/index.d.ts",
                        "node": "./dist/index.js",
                        "import": "./dist/browser.js"
-               },
-               "./sync": {
-                       "types": "./dist/sync.d.ts",
-                       "node": "./dist/sync.js",
-                       "import": "./dist/sync.js"
-               },
-               "./async": {
-                       "types": "./dist/async.d.ts",
-                       "node": "./dist/async.js",
-                       "import": "./dist/async.js"
                }
        },
        "browser": {
index 37bfd2f264fbd9bc9639c35245e35b9755197def..9e5c5136441af5815543fd876c763492bda79db0 100644 (file)
@@ -133,9 +133,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                        const pk8 = nano25519.derive(sk8)
                                        return [...pk8].map(b => b.toString(16).padStart(2, '0')).join('')
                                }
-                               case 'nano25519 (async)': {
-                                       return nano25519.deriveAsync(sk)
-                               }
                                case 'NanocurrencyWeb': {
                                        return NanocurrencyWeb.wallet.legacyAccounts(sk)[0].publicKey
                                }
@@ -160,9 +157,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                        const s8 = nano25519.sign(h8, sk8)
                                        return [...s8].map(b => b.toString(16).padStart(2, '0')).join('')
                                }
-                               case 'nano25519 (async)': {
-                                       return nano25519.signAsync(h, sk + pk)
-                               }
                                case 'NanocurrencyWeb': {
                                        const { privateKey } = NanocurrencyWeb.wallet.legacyAccounts(sk)[0]
                                        return NanocurrencyWeb.tools.sign(privateKey, h)
@@ -188,9 +182,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                case 'nano25519': {
                                        return nano25519.verify(s8, h8, pk8)
                                }
-                               case 'nano25519 (async)': {
-                                       return nano25519.verifyAsync(s, h, pk)
-                               }
                                case 'NanocurrencyWeb': {
                                        return NanocurrencyWeb.tools.verify(pk, s, h)
                                }
@@ -206,7 +197,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        }
                }
 
-               async function sequenceDeriveSignVerify(api, blockHash, privateKey) {
+               function sequenceDeriveSignVerify(api, blockHash, privateKey) {
                        let start = 0, end = 0, publicKey = null, signature = null, isValid = false
 
                        start = performance.now()
@@ -224,7 +215,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        return end - start
                }
 
-               export async function test(api, size, runs) {
+               export function test(api, size, runs) {
                        if (typeof size !== 'number' || size < 1) {
                                size = 1
                        }