@neuraiproject/neurai-key 2.8.8 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,7 +5,7 @@ Generate Neurai addresses from a mnemonic phrase following the standards BIP32,
5
5
  That is, use your 12 words to get addresses for Neurai mainnet and testnet.
6
6
 
7
7
  **NPM**: https://www.npmjs.com/package/@neuraiproject/neurai-key
8
- **CDN**: https://cdn.jsdelivr.net/npm/@neuraiproject/neurai-key@2.8.8/dist/NeuraiKey.js
8
+ **CDN**: https://cdn.jsdelivr.net/npm/@neuraiproject/neurai-key@3.0.0/dist/NeuraiKey.global.js
9
9
 
10
10
  ## Features
11
11
 
@@ -27,9 +27,9 @@ This library supports three Neurai network configurations:
27
27
  - **`xna-pq` / `xna-pq-test`**: PostQuantum ML-DSA-44 addresses (Bech32m, witness v1)
28
28
 
29
29
  The main difference is the derivation path and address encoding:
30
- - **XNA**: `m/44'/1900'/0'/0/0` — Base58Check, prefix `N` (recommended for new wallets)
31
- - **XNA Legacy**: `m/44'/0'/0'/0/0` — Base58Check, prefix `N` (for compatibility with older wallets)
32
- - **XNA PostQuantum**: `m/100'/1900'/0'/0/0` — Bech32m, prefix `nq1` (for future quantum-resistant fork)
30
+ - **XNA**: mainnet `m/44'/1900'/0'/0/0`, testnet `m/44'/1'/0'/0/0` — Base58Check (recommended for new wallets)
31
+ - **XNA Legacy**: mainnet `m/44'/0'/0'/0/0`, testnet `m/44'/1'/0'/0/0` — Base58Check (for compatibility with older wallets)
32
+ - **XNA PostQuantum**: mainnet `m/100'/1900'/0'/0/0`, testnet default/external `m/100'/1'/0'/0/0` — Bech32m (`nq1` / `tnq1`)
33
33
 
34
34
  **Note**: Using different network types will generate completely different addresses from the same mnemonic.
35
35
 
@@ -40,10 +40,8 @@ A simple and "spot on" way to generate/derive addresses.
40
40
 
41
41
  If you need brutal performance check out getAddressByPath example below.
42
42
 
43
- ```
43
+ ```javascript
44
44
  import NeuraiKey from "@neuraiproject/neurai-key";
45
- //Or import as CommonsJS module
46
- //const NeuraiKey = require("@neuraiproject/neurai-key");
47
45
 
48
46
  const mnemonic = NeuraiKey.generateMnemonic();
49
47
  const ACCOUNT = 0; //default is zero
@@ -201,6 +199,8 @@ const pqAddress = NeuraiKey.getPQAddress(network, mnemonic, ACCOUNT, INDEX);
201
199
  console.log(pqAddress);
202
200
  ```
203
201
 
202
+ `getPQAddress()` returns the external branch by default.
203
+
204
204
  Outputs
205
205
 
206
206
  ```
@@ -247,7 +247,7 @@ const addr1 = NeuraiKey.getPQAddressByPath("xna-pq", hdKey, "m/100'/1900'/0'/0/1
247
247
  | Testnet HRP / prefix | `tnq` / `tnq1...` |
248
248
  | Public key size | 1312 bytes |
249
249
  | Derivation path (mainnet) | `m/100'/1900'/0'/0/index` |
250
- | Derivation path (testnet) | `m/100'/1900'/0'/1/index` |
250
+ | Derivation path (testnet default/external) | `m/100'/1'/account'/0/index` |
251
251
  | Address hash | HASH160(0x05 \|\| pubkey) |
252
252
 
253
253
  **Note**: PQ addresses do not have a WIF (Wallet Import Format) field since WIF is specific to secp256k1 keys. The `seedKey` field contains the 32-byte BIP32-derived seed used for deterministic ML-DSA-44 key generation, useful for cross-implementation verification.
@@ -268,47 +268,58 @@ console.log(pubkeyHex);
268
268
 
269
269
  ## How to import into your project
270
270
 
271
- ### ES6 module
271
+ ### ESM default
272
272
 
273
- ```
274
- //As ES6 module
273
+ ```javascript
275
274
  import NeuraiKey from "@neuraiproject/neurai-key";
276
275
  ```
277
276
 
278
- ### CommonsJS module
277
+ ### ESM browser explicit
279
278
 
279
+ ```javascript
280
+ import NeuraiKey from "@neuraiproject/neurai-key/browser";
280
281
  ```
281
- //As CommonsJS module
282
+
283
+ ### CommonJS
284
+
285
+ ```javascript
282
286
  const NeuraiKey = require("@neuraiproject/neurai-key");
283
287
  ```
284
288
 
285
- ### Browserify
289
+ ### Global build for HTML
286
290
 
287
- ```
288
- //A browseriy:d version, with all the dependencies bundled for the web
291
+ ```html
289
292
  <html>
290
293
  <body>
291
- <script src="./node_modules/@neuraiproject/neurai-key/dist/NeuraiKey.js"></script>
294
+ <script src="./node_modules/@neuraiproject/neurai-key/dist/NeuraiKey.global.js"></script>
292
295
  <script>
293
- alert(NeuraiKey.generateMnemonic());
296
+ alert(globalThis.NeuraiKey.generateMnemonic());
294
297
  </script>
295
298
  </body>
296
299
  </html>
297
300
  ```
298
301
 
302
+ ## Package layout in `3.0.0`
303
+
304
+ - `dist/index.js`: ESM main entry
305
+ - `dist/index.cjs`: CommonJS entry
306
+ - `dist/browser.js`: explicit browser ESM bundle
307
+ - `dist/NeuraiKey.global.js`: global build for `<script>`
308
+ - `dist/index.d.ts`: TypeScript declarations
309
+
299
310
  ## install
300
311
 
301
- ` npm install @neuraiproject/neurai-key`
312
+ `npm install @neuraiproject/neurai-key`
302
313
 
303
314
  ## build
304
315
 
305
- ` npm run build`
316
+ `npm run build`
306
317
 
307
318
  ## test
308
319
 
309
320
  `npm test`
310
321
 
311
- Note, the tests run on the built version, so you need to build before you run the tests
322
+ The test script already builds the package before running Jest.
312
323
 
313
324
  ## BIP32
314
325