@neuraiproject/neurai-sign-esp32 0.6.1 → 0.7.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
@@ -11,9 +11,16 @@ Uses [bitcoinjs-lib](https://www.npmjs.com/package/bitcoinjs-lib) v7 for
11
11
  PSBT construction and the Web Serial API for device communication.
12
12
 
13
13
  It also supports **Post-Quantum (ML-DSA-44 / AuthScript) addresses**: sending to
14
- PQ addresses (`nq1…`/`tnq1…`) and spending from them. The library auto-detects
15
- the device mode from `info` and routes accordingly — see
16
- [Post-Quantum support](#post-quantum-pq--ml-dsa-44-support).
14
+ them and spending from the device's PQ address (`nc1p…`/`tnc1p…`). The library
15
+ auto-detects the device mode from `info` and routes accordingly — see
16
+ [Post-Quantum support](#post-quantum-pq--ml-dsa-44-support). Outputs can pay to
17
+ every Neurai address type — see [Address types](#address-types).
18
+
19
+ > **0.7.0 follows the new Neurai address types** (node Neurai-DePIN,
20
+ > `@neuraiproject/neurai-key` 5): the device's PQ address is now encoded as
21
+ > `nc1p…`/`tnc1p…` (it used to be `nq1p…`/`tnq1p…`, which the node rejects) and
22
+ > `nq1…`/`tnq1…` now means strict ECDSA witness v3. See
23
+ > [Upgrading to 0.7.0](#upgrading-to-070).
17
24
 
18
25
  ##
19
26
 
@@ -24,13 +31,25 @@ This library supports:
24
31
  - Asset transfers
25
32
  - BIP32 account discovery via `get_bip32_pubkey`
26
33
  - Message signing (prove address ownership)
27
- - **Post-Quantum addresses (ML-DSA-44 / AuthScript)** — send to and spend from `nq1…`/`tnq1…`
34
+ - **Post-Quantum addresses (ML-DSA-44 / AuthScript)** — send to and spend from `nc1p…`/`tnc1p…`
35
+ - Sending to every Neurai address type: Legacy P2PKH, `nc1p…`, `pq1z…`, `nq1r…`
36
+ - Strict ECDSA witness v3 (`nq1r…`) inputs through `sign_psbt` (firmware built with uNeurai >= 0.2.0)
28
37
 
29
38
  Asset transfers use the same PSBT signing flow as XNA transfers. The transaction
30
39
  outputs are still signed from the raw unsigned transaction, while optional
31
40
  display metadata can be provided to the device so the firmware can show the
32
41
  asset name, transferred amount, destination address, and fee more clearly.
33
42
 
43
+ ## Reset testnet
44
+
45
+ Before supplying UTXOs or PSBT inputs to this signing library, the host
46
+ application must verify `getblockhash(0)` against
47
+ `0000008b384aeffecdab182575dc4e86c9f07f90318c65088532660ed9a8a021`.
48
+ The device does not query the chain. Discard UTXOs and PSBTs assembled from
49
+ the previous testnet. All three AuthScript address families activate on the
50
+ reset testnet at block 10; outputs included earlier have no AuthScript spend
51
+ protection.
52
+
34
53
  ## Install
35
54
 
36
55
  ```
@@ -345,9 +364,9 @@ await identity.session.ensure({ minRemainingSeconds: 60 });
345
364
  > `depin_sign_auth` and session permissions are **not implemented in current
346
365
  > firmware yet** — the contract they must satisfy is specified, and exercised
347
366
  > by a cryptographically faithful device mock, in this package's tests.
348
- > `@neuraiproject/neurai-depin-msg@3.1.0` must be published before installing
349
- > this repository from scratch or publishing `neurai-sign-esp32@0.6.0`. The
350
- > package has no runtime dependency on `neurai-depin-msg`; it is a `^3.1.0`
367
+ > `@neuraiproject/neurai-depin-msg@3.1.3` is published and required for
368
+ > installing this repository from scratch or publishing `neurai-sign-esp32@0.7.1`.
369
+ > The package has no runtime dependency on `neurai-depin-msg`; it is a `^3.1.3`
351
370
  > development dependency used only by the integration tests. The package gate
352
371
  > validates the adapter from a clean `neurai-sign-esp32` tarball.
353
372
 
@@ -407,12 +426,22 @@ orthogonal axes:
407
426
 
408
427
  The library reads `info.key_type` and routes automatically — the same
409
428
  `getAddress()` / `signTransaction()` calls work in both modes. PQ uses the
410
- AuthScript witness-v1 format (`nq1…` mainnet / `tnq1…` testnet), which cannot be
411
- represented in a PSBT, so spending from PQ uses a raw-transaction transport
412
- (`sign_tx`) under the hood. See [`docs/pq-protocol-design.md`](./docs/pq-protocol-design.md).
429
+ generic AuthScript witness-v1 format (`nc1p…` mainnet / `tnc1p…` testnet;
430
+ authType `0x01`, witnessScript `OP_TRUE`), which cannot be represented in a
431
+ PSBT, so spending from PQ uses a raw-transaction transport (`sign_tx`) under the
432
+ hood. See [`docs/pq-protocol-design.md`](./docs/pq-protocol-design.md).
413
433
 
414
434
  > The device exposes **only the public key** of its single address; the library
415
- > derives the `nq1…`/`tnq1…` address from that pubkey + mode.
435
+ > derives the `nc1p…`/`tnc1p…` address from that pubkey + mode. The firmware
436
+ > sends `auth_type` / `witness_script` in snake_case; `getAddress()` returns them
437
+ > as `authType` / `witnessScript`.
438
+
439
+ > Firmware built against uNeurai < 0.2.0 still reports its address as
440
+ > `nq1p…`/`tnq1p…` in `info`; `getInfo()` / `getAddress()` re-encode it to the
441
+ > valid `nc1p…`/`tnc1p…` form (same scriptPubKey), so it keeps working as a
442
+ > change address. The strict PQ family (witness v2, `pq1z…`) is not produced by
443
+ > the current firmware; `sign_tx` refuses v2/v3 prevouts before contacting the
444
+ > device.
416
445
 
417
446
  ### Read a PQ address
418
447
 
@@ -427,20 +456,22 @@ console.log(info.network); // "NeuraiTest"
427
456
  // In PQ mode the device returns only the pubkey; the library derives the address.
428
457
  const addr = await device.getAddress(); // requires confirmation on device
429
458
  console.log(addr.type); // "pq"
430
- console.log(addr.address); // "tnq1..."
459
+ console.log(addr.address); // "tnc1p..."
431
460
  console.log(addr.commitment); // 32-byte AuthScript commitment (hex)
432
461
  ```
433
462
 
434
463
  ### Send to a PQ address (from a legacy ECDSA wallet)
435
464
 
436
- No special handling is needed: pass a `nq1…`/`tnq1…` destination to
437
- `signTransaction`/`buildPSBT`. The library encodes the AuthScript output script
438
- automatically; the ECDSA inputs are still signed via `sign_psbt`.
465
+ No special handling is needed: pass any AuthScript destination (`tnc1p…`,
466
+ `tpq1z…`, `tnq1r…`, or the mainnet forms) to `signTransaction`/`buildPSBT`. The
467
+ library encodes the output script (`OP_1`/`OP_2`/`OP_3` `0x20 <commitment>`)
468
+ automatically and checks that the address belongs to the PSBT's chain; the
469
+ ECDSA inputs are still signed via `sign_psbt`.
439
470
 
440
471
  ```javascript
441
472
  const result = await device.signTransaction({
442
473
  utxos: [/* legacy P2PKH UTXOs with rawTxHex */],
443
- outputs: [{ address: "tnq1...", value: 100000000 }], // PQ destination
474
+ outputs: [{ address: "tnc1p...", value: 100000000 }], // PQ destination
444
475
  changeAddress: address,
445
476
  });
446
477
  ```
@@ -459,12 +490,12 @@ const result = await device.signTransaction({
459
490
  txid: "abcd1234....",
460
491
  vout: 0,
461
492
  satoshis: 100000000,
462
- scriptPubKey: "5120<32-byte commitment>", // the PQ address script
493
+ scriptPubKey: "5120<32-byte commitment>", // the PQ address script (witness v1)
463
494
  type: "pq",
464
495
  // sighashAmount: 0, // use 0 for asset-wrapped inputs
465
496
  },
466
497
  ],
467
- outputs: [{ address: "tnq1...", value: 50000000 }],
498
+ outputs: [{ address: "tnc1p...", value: 50000000 }],
468
499
  // changeAddress defaults to the device's PQ address
469
500
  });
470
501
 
@@ -496,6 +527,24 @@ const sighash = pqAuthScriptSighash({
496
527
  const ok = ml_dsa44.verify(w.signature, sighash, w.pubkey); // verify(sig, msg, pub)
497
528
  ```
498
529
 
530
+ `pqAuthScriptSighash` computes the generic witness-v1 sighash by default. The
531
+ strict families use a different preimage (the witness version byte is written
532
+ before `authType`, and the scriptCode is always `OP_TRUE`); a v1-style
533
+ signature is **not** valid for them:
534
+
535
+ ```javascript
536
+ import { strictAuthScriptSighash } from "@neuraiproject/neurai-sign-esp32";
537
+
538
+ // Strict PQ v2 (pq1z…) or strict ECDSA v3 (nq1r…) input
539
+ const h = strictAuthScriptSighash({ tx, inputIndex: 0, amount, witnessVersion: 2 });
540
+ // witness: [authType, sig||hashType, pubkey, 0x51] (v2: authType 0x01 + 0x05||pq_pubkey,
541
+ // v3: authType 0x02 + compressed secp256k1 pubkey)
542
+ ```
543
+
544
+ The current firmware signs witness v1 only (`sign_tx`) and, with uNeurai >=
545
+ 0.2.0, strict ECDSA v3 inputs through `sign_psbt`; the strict sighash is here so
546
+ hosts can verify or build strict spends (and for future firmware).
547
+
499
548
  [`examples/browser-test.html`](./examples/browser-test.html) demonstrates this
500
549
  full flow end-to-end (read PQ address → sign a test transaction → verify the
501
550
  ML-DSA-44 signature).
@@ -525,7 +574,7 @@ Suggested flow:
525
574
  `npx serve .` or `python3 -m http.server 8000`.
526
575
  3. Open `http://localhost:8000/examples/browser-test.html` in Chrome or Edge.
527
576
  4. Click `Conectar`, pick the port, and confirm on the device. The page shows the
528
- derived `tnq1…` address.
577
+ derived `tnc1p…` address.
529
578
  5. Click `Firmar transacción de prueba` and confirm on the device. The page signs
530
579
  a fictitious transaction and shows `✓ Firma ML-DSA-44 VÁLIDA`.
531
580
 
@@ -615,7 +664,14 @@ After `npm run build`, the package publishes:
615
664
  - `dist/browser.js`: explicit browser ESM entry
616
665
  - `dist/react-native.js`: React Native entry (no Web Serial; adds the USB transport)
617
666
  - `dist/NeuraiSignESP32.global.js`: IIFE bundle exposing `globalThis.NeuraiSignESP32`
618
- - `dist/index.d.ts` / `dist/react-native.d.ts`: public types
667
+ - `dist/index.d.ts` / `dist/react-native.d.ts`: public types (ESM)
668
+ - `dist/index.d.cts`: the same types for `require` (CommonJS)
669
+
670
+ `npm run test:types` compiles the consumers in `types-test/` (ESM, CommonJS,
671
+ browser and React Native) against the built declarations in NodeNext, Node16
672
+ and Bundler. `npm run test:package` packs the tarball, installs it in a clean
673
+ project and checks runtime and types there, with TypeScript 5.3 too (the
674
+ oldest release the declarations support).
619
675
 
620
676
  ## UTXO requirements
621
677
 
@@ -633,17 +689,67 @@ The public model has two orthogonal axes: **network** (`mainnet`/`testnet`) and
633
689
  **key_type** (`legacy`/`pq`). The device declares both via `info`. Internally
634
690
  these resolve to a `NetworkType` identifier:
635
691
 
636
- | network | key_type | Internal `NetworkType` | Coin type | Address prefix |
637
- |---|---|---|---|---|
638
- | mainnet | legacy | `xna` | 1900 | `N…` (P2PKH) |
639
- | testnet | legacy | `xna-test` | 1 | testnet P2PKH |
640
- | mainnet | pq | `xna-pq` | 1900 | `nq1…` (AuthScript) |
641
- | testnet | pq | `xna-pq-test` | 1 | `tnq1…` (AuthScript) |
692
+ | network | key_type | Internal `NetworkType` | Coin type | Address prefix | neurai-key 5 name |
693
+ |---|---|---|---|---|---|
694
+ | mainnet | legacy | `xna` | 1900 | `N…` (P2PKH) | `xna-legacy` |
695
+ | testnet | legacy | `xna-test` | 1 | `t…` (P2PKH) | `xna-legacy-test` |
696
+ | mainnet | pq | `xna-pq` | 1900 | `nc1p…` (AuthScript v1) | `xna-authscript` |
697
+ | testnet | pq | `xna-pq-test` | 1 | `tnc1p…` (AuthScript v1) | `xna-authscript-test` |
642
698
 
643
699
  `xna-legacy` / `xna-legacy-test` (coin type 0) remain available for the legacy
644
- coin-type-0 derivation and are unrelated to `key_type: "legacy"`. Use
700
+ coin-type-0 derivation and are unrelated to `key_type: "legacy"` (neurai-key 5
701
+ calls the mainnet one `xna-old-legacy`). Use
645
702
  `resolveNetwork(network, keyType)` to map the two axes to a `NetworkType`.
646
703
 
704
+ ### Naming differences with `@neuraiproject/neurai-key` 5
705
+
706
+ This package's `NetworkType` names predate neurai-key 5 and keep their meaning.
707
+ Three of them are spelled like key-5 networks that mean something else:
708
+
709
+ | name | here | in neurai-key 5 |
710
+ |---|---|---|
711
+ | `xna` | Legacy P2PKH, coin type 1900 | strict ECDSA witness v3 (`nq1r…`) |
712
+ | `xna-legacy` | Legacy P2PKH, coin type 0 | Legacy P2PKH, coin type 1900 |
713
+ | `xna-pq` | AuthScript v1 with a PQ key (`nc1p…`) | strict PQ witness v2 (`pq1z…`) |
714
+
715
+ - `getNetwork()` also accepts the key-5 names that are unambiguous here:
716
+ `xna-old-legacy` (= `xna-legacy`), `xna-authscript` / `xna-authscript-test`
717
+ (= `xna-pq` / `xna-pq-test`).
718
+ - `fromNeuraiKeyNetwork(name)` translates a key-5 name with key-5 semantics
719
+ (`"xna-legacy"` → `"xna"`, …) and throws a descriptive error for the key-5
720
+ families the device flows do not produce (`xna`/`xna-test`: strict ECDSA,
721
+ `xna-pq`/`xna-pq-test`: strict PQ).
722
+ - The DePIN identity is always Legacy P2PKH (`m/44'/1900'/100'/0/0`, or
723
+ `m/44'/1'/100'/0/0` on testnet), i.e. neurai-key 5 `xna-legacy` /
724
+ `xna-legacy-test`; the node's DePIN messaging does not accept witness
725
+ addresses.
726
+
727
+ ## Address types
728
+
729
+ | Family | Witness | HRP (main / test) | scriptPubKey | authType | witnessScript | neurai-key 5 |
730
+ |---|---|---|---|---|---|---|
731
+ | Legacy P2PKH | — | Base58 `N…` / `t…` | `76a914…88ac` | — | — | `xna-legacy`, `xna-old-legacy` |
732
+ | Generic AuthScript | v1 | `nc` / `tnc` → `nc1p…` | `51 20 <C>` | any | any | `xna-authscript` |
733
+ | Strict PQ (ML-DSA-44) | v2 | `pq` / `tpq` → `pq1z…` | `52 20 <C>` | `0x01` | `0x51` (fixed) | `xna-pq` |
734
+ | Strict ECDSA (secp256k1) | v3 | `nq` / `tnq` → `nq1r…` | `53 20 <C>` | `0x02` | `0x51` (fixed) | `xna` |
735
+
736
+ `C = taggedHash("NeuraiAuthScript", witnessVersion || auth_descriptor || SHA256(witnessScript))`.
737
+
738
+ - `decodeAddress()` follows the node: Bech32m first (any case, only these
739
+ HRP/version pairs), Base58 otherwise. `nq1p…`/`tnq1p…` (the old witness-v1
740
+ encoding) is rejected with a hint to use `nc1p…`/`tnc1p…`. The result keeps
741
+ `type: "pq"` for every Bech32m address (as before) and adds `family`
742
+ (`"authscript"` | `"pq"` | `"ecdsa"`), `witnessVersion` and `network`.
743
+ - `encodeDestinationScript()` emits `OP_1`/`OP_2`/`OP_3 0x20 <C>`.
744
+ - **Activation:** all three AuthScript families activate on the reset testnet
745
+ at block 10 and on regtest at block 1. Before activation the node refuses `pq1…`/`nq1…` addresses because an
746
+ `OP_2`/`OP_3` output is anyone-can-spend there. The library cannot know the
747
+ activation state of the target chain: do not pay to v2/v3 addresses where
748
+ they are not active.
749
+ - PSBT inputs: P2PKH, or strict ECDSA v3 prevouts (the finalizer builds the
750
+ witness `[0x02, sig, pubkey, 0x51]`; needs firmware with uNeurai >= 0.2.0).
751
+ Generic v1 and strict v2 inputs cannot go through a PSBT.
752
+
647
753
  ## Chunked serial writes (important)
648
754
 
649
755
  The ESP32 CDC serial buffer can lose data when the host sends a large payload
@@ -685,8 +791,9 @@ using JSON messages. Supported commands:
685
791
  | `depin_session_end` | None (session-key gated) | 10s |
686
792
 
687
793
  `info` reports `key_type` (`"legacy"` | `"pq"`). In PQ mode, `get_address`
688
- returns only the public key (the library derives the address) and signing uses
689
- `sign_tx` (raw transaction) instead of `sign_psbt`.
794
+ returns only the public key plus `auth_type` / `witness_script` (the library
795
+ derives the address) and signing uses `sign_tx` (raw transaction) instead of
796
+ `sign_psbt`. `sign_tx` signs generic AuthScript v1 inputs only.
690
797
 
691
798
  While the device is **locked** (encrypted seed stored, PIN pending) or
692
799
  **unconfigured** (no seed), the firmware rejects every command except
@@ -730,18 +837,27 @@ Main class for device interaction.
730
837
 
731
838
  | Function | Description |
732
839
  |---|---|
733
- | `isPQAddress(addr)` | True for `nq1…`/`tnq1…` AuthScript addresses |
734
- | `decodeAddress(addr)` | Decode a legacy or PQ address (`{ type, commitment \| hash, … }`) |
840
+ | `isWitnessAddress(addr)` | True for valid `nc1p…`/`pq1z…`/`nq1r…` (and testnet) AuthScript addresses |
841
+ | `isPQAddress(addr)` | Deprecated alias of `isWitnessAddress` (true for every AuthScript family, not only ML-DSA keys) |
842
+ | `getAddressFamily(addr)` | `"legacy"` \| `"authscript"` \| `"pq"` \| `"ecdsa"` |
843
+ | `decodeAddress(addr)` | Decode any address (`{ type, family, witnessVersion, network, commitment \| hash, … }`) |
735
844
  | `encodeDestinationScript(addr)` | Output scriptPubKey for any supported address |
736
- | `publicKeyToAddress(pubkeyHex, { network, keyType })` | Derive an address from a public key + mode |
845
+ | `publicKeyToAddress(pubkeyHex, { network, keyType, witnessVersion? })` | Derive an address from a public key + mode (`pq`: v1 `nc1p…` by default, `witnessVersion: 2` for `pq1z…`) |
846
+ | `pqAddressFromPublicKey(pubkey, params)` | PQ address in the family of `params` (`getPQNetworkParams(network, 1 \| 2)`) |
847
+ | `ecdsaAddressFromPublicKey(pubkey33, network)` | Strict ECDSA v3 address (`nq1r…`/`tnq1r…`) |
848
+ | `authScriptCommitment(opts)` / `pqCommitment` / `ecdsaCommitment` | Versioned AuthScript commitments |
849
+ | `normalizeDeviceAuthScriptAddress(addr)` | Re-encode a pre-0.2.0 firmware `nq1p…`/`tnq1p…` address as `nc1p…`/`tnc1p…` |
737
850
  | `resolveNetwork(network, keyType)` | Map the two axes to a `NetworkType` |
738
- | `buildUnsignedPQTransaction(opts)` | Build the unsigned raw tx + per-input metadata for `sign_tx` |
851
+ | `fromNeuraiKeyNetwork(name)` | Translate a neurai-key 5 network name to a `NetworkType` |
852
+ | `buildUnsignedPQTransaction(opts)` | Build the unsigned raw tx + per-input metadata for `sign_tx` (witness v1 prevouts only) |
739
853
  | `extractPQWitness(signedTxHex, index?)` | Decode the AuthScript witness (`authType`, `signature`, `pubkey`, `witnessScript`) |
740
- | `pqAuthScriptSighash(opts)` | Recompute the AuthScript sighash (to verify device signatures) |
854
+ | `pqAuthScriptSighash(opts)` | Recompute the AuthScript sighash (to verify device signatures); witness v1 by default, `witnessVersion: 2 \| 3` for strict |
855
+ | `strictAuthScriptSighash(opts)` | Strict v2 / v3 sighash (`… locktime \|\| witnessVersion \|\| authType \|\| hashType`) |
741
856
 
742
857
  ### `buildPSBT(options)`
743
858
 
744
- Build an unsigned PSBT for P2PKH. Returns base64 string.
859
+ Build an unsigned PSBT for P2PKH (and strict ECDSA v3) inputs. Outputs may pay
860
+ to any Neurai address type. Returns base64 string.
745
861
 
746
862
  ### `buildPSBTFromRawTransaction(options)`
747
863
 
@@ -824,3 +940,64 @@ those strings. The reviewed firmware reads `amount` using ArduinoJson
824
940
  ArduinoJson parser was checked on the host up to MAX_MONEY; this does not replace
825
941
  an on-device signing and display check of the firmware installed on your ESP32.
826
942
  No global bigint JSON serializer is required.
943
+
944
+ ## Upgrading to 0.7.1
945
+
946
+ 0.7.1 requires the published `neurai-depin-msg@3.1.3` for development and
947
+ integration tests. The runtime API is unchanged. The reset testnet guide now
948
+ records the new genesis, and Web Serial tests run on Node 20. Hardware and
949
+ firmware validation is still required before using the adapter on a device.
950
+
951
+ ## Upgrading to 0.7.0
952
+
953
+ 0.7.0 follows the address types of the Neurai node (Neurai-DePIN) and
954
+ `@neuraiproject/neurai-key` 5.
955
+
956
+ Breaking changes:
957
+
958
+ - **PQ addresses are encoded as `nc1p…` / `tnc1p…`.** `neuraiPQMainnet` /
959
+ `neuraiPQTestnet` (and `getPQNetworkParams`) use the HRPs `nc` / `tnc`, so
960
+ `publicKeyToAddress(…, { keyType: "pq" })`, `pqAddressFromPublicKey` and
961
+ `getAddress()` return `nc1p…` / `tnc1p…`. The scriptPubKey (`5120<C>`) and the
962
+ commitment did not change: funds on an old `nq1p…` / `tnq1p…` address are
963
+ reachable through the re-encoded address.
964
+ - **`nq1…` / `tnq1…` is the strict ECDSA family now.** `decodeAddress` rejects
965
+ the old witness-v1 `nq1p…` / `tnq1p…` form (with a hint), like the node, and
966
+ so do `encodeDestinationScript`, `buildPSBT` and `buildUnsignedPQTransaction`.
967
+ - `isPQAddress` validates the address (Bech32m checksum, canonical HRP/version
968
+ pair) instead of matching the `nq1` / `tnq1` prefix, and is true for every
969
+ AuthScript family. It is deprecated in favour of `isWitnessAddress` /
970
+ `getAddressFamily`. Base58 addresses that start with `NQ1…` are no longer
971
+ misclassified.
972
+ - `buildPSBT` checks that an AuthScript destination belongs to the PSBT's chain
973
+ (a testnet address in an `xna` PSBT throws) and estimates AuthScript outputs
974
+ at 43 bytes.
975
+ - `pqAuthScriptSighash` throws for a sighash type other than `SIGHASH_ALL` and
976
+ for version-3 transactions (it used to return a hash the device and node would
977
+ not agree with); `buildUnsignedPQTransaction` and `signPqRawTransaction`
978
+ reject strict v2/v3 prevouts and version-3 transactions.
979
+
980
+ Type declarations: `require` now gets CommonJS declarations
981
+ (`dist/index.d.cts`). Up to 0.6.1 it got the ESM `dist/index.d.ts`, and a
982
+ CommonJS project compiled with `moduleResolution` `node16` failed with TS1471.
983
+ bitcoinjs-lib only ships ESM declarations, so `dist/index.d.cts` imports its
984
+ types with a `resolution-mode` attribute: the declarations need TypeScript 5.3
985
+ or later.
986
+
987
+ Additions: `strictAuthScriptSighash` and `pqAuthScriptSighash({ witnessVersion })`,
988
+ `AUTHSCRIPT_FAMILIES`, `isWitnessAddress`, `getAddressFamily`,
989
+ `ecdsaAddressFromPublicKey`, `authScriptCommitment`, `ecdsaCommitment`,
990
+ `normalizeDeviceAuthScriptAddress`, `fromNeuraiKeyNetwork`, the strict PQ
991
+ params `neuraiPQStrictMainnet` / `neuraiPQStrictTestnet`, v3 PSBT finalization,
992
+ and the snake_case `auth_type` / `witness_script` fields of `get_address`, which
993
+ are now read (they used to be ignored).
994
+
995
+ ### Testing against a node
996
+
997
+ `npm test` runs the unit tests (vectors from a Neurai-DePIN regtest node are in
998
+ `src/pq-address.fixtures.ts`). `src/node-regtest.integration.test.ts` is an
999
+ opt-in end-to-end check: set `NEURAI_REGTEST_CLI` to the `neurai-cli` command of
1000
+ a regtest node that knows the `nc` / `pq` / `nq` families and it funds v1, v2
1001
+ and v3 addresses derived by the library, signs spends with software keys
1002
+ standing in for the device, and checks them with `testmempoolaccept`.
1003
+