@neuraiproject/neurai-sign-esp32 0.7.2 → 0.8.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 +59 -4
- package/dist/NeuraiSignESP32.global.js +1961 -5298
- package/dist/browser.js +1961 -5299
- package/dist/index.cjs +1961 -5298
- package/dist/index.d.cts +47 -13
- package/dist/index.d.ts +47 -13
- package/dist/index.js +1961 -5299
- package/dist/react-native.d.ts +47 -13
- package/dist/react-native.js +1961 -5299
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -866,6 +866,10 @@ to any Neurai address type. Returns base64 string.
|
|
|
866
866
|
Build an unsigned PSBT from an already-created raw unsigned transaction plus
|
|
867
867
|
input metadata. This is the preferred path when the wallet already handles coin
|
|
868
868
|
selection, fee calculation, asset outputs, and change outputs externally.
|
|
869
|
+
`inputs[i]` must describe input `i` (`txid:vout`); unlocking data in the raw
|
|
870
|
+
transaction is not carried. Any Neurai transaction version is accepted, and
|
|
871
|
+
`witnessScript` puts the script behind an AuthScript input (a covenant) in the
|
|
872
|
+
PSBT for signers that handle it (Neurai Connect); the device does not.
|
|
869
873
|
|
|
870
874
|
### `finalizePSBT(base64, network)`
|
|
871
875
|
|
|
@@ -873,13 +877,24 @@ Finalize a signed PSBT. Returns `{ txHex, txId }`.
|
|
|
873
877
|
|
|
874
878
|
### `finalizeSignedPSBT(originalPsbtBase64, signedPsbtBase64, network)`
|
|
875
879
|
|
|
876
|
-
Merge a signed PSBT
|
|
877
|
-
|
|
878
|
-
|
|
880
|
+
Merge a signed PSBT (from the device or another signer) with the original PSBT,
|
|
881
|
+
finalize the inputs it signed and extract the transaction; unsigned inputs are
|
|
882
|
+
left empty. A standard PSBT is combined: a field the two disagree on, or a
|
|
883
|
+
different transaction, is an error. Only an answer that is not a readable PSBT
|
|
884
|
+
is read as the minimal form `uNeurai` writes, and only if its transaction is
|
|
885
|
+
byte for byte the original one. A signature whose sighash byte differs from the
|
|
886
|
+
input's `sighashType` is rejected (it is no longer adjusted).
|
|
887
|
+
|
|
888
|
+
### `assertDeviceCanSignPSBT(base64)`
|
|
889
|
+
|
|
890
|
+
Throws for what the NeuraiHW firmware cannot sign: a version-3 transaction, a
|
|
891
|
+
version-3 previous transaction, an input with a `witnessScript`.
|
|
892
|
+
`NeuraiESP32.signPsbt` calls it before sending anything to the device.
|
|
879
893
|
|
|
880
894
|
### `validatePSBT(base64, network)`
|
|
881
895
|
|
|
882
|
-
Check if a PSBT base64 string is
|
|
896
|
+
Check if a PSBT base64 string is readable under the Neurai PSBT profile
|
|
897
|
+
(previous transactions matching their outpoints). Returns boolean.
|
|
883
898
|
|
|
884
899
|
[Check the TypeScript definitions](./dist/index.d.ts) for all the details.
|
|
885
900
|
|
|
@@ -943,6 +958,46 @@ ArduinoJson parser was checked on the host up to MAX_MONEY; this does not replac
|
|
|
943
958
|
an on-device signing and display check of the firmware installed on your ESP32.
|
|
944
959
|
No global bigint JSON serializer is required.
|
|
945
960
|
|
|
961
|
+
## Upgrading to 0.8.1
|
|
962
|
+
|
|
963
|
+
React Native (Hermes): Buffer methods are no longer called on `subarray()`
|
|
964
|
+
results. Under Hermes a subarray of the bundled Buffer is a plain `Uint8Array`,
|
|
965
|
+
whose `toString("hex")` is not hex:
|
|
966
|
+
|
|
967
|
+
- reading the firmware's minimal PSBT refused a valid device answer as "a PSBT
|
|
968
|
+
for a different transaction";
|
|
969
|
+
- the DePIN device identity could not read the `s` value of a device signature
|
|
970
|
+
(`derSignatureToRecoverable`, message signatures), and failed.
|
|
971
|
+
|
|
972
|
+
`src/psbt-device.test.ts` and `src/depin-identity.test.ts` run those paths with
|
|
973
|
+
Hermes' `subarray`.
|
|
974
|
+
|
|
975
|
+
## Upgrading to 0.8.0
|
|
976
|
+
|
|
977
|
+
The PSBT helpers no longer use bitcoinjs-lib's `Psbt`: they are built on the
|
|
978
|
+
PSBT module of `@neuraiproject/neurai-create-transaction` `^0.9.3` (BIP-174
|
|
979
|
+
version 0 whose transactions use the Neurai serialization). Same functions and
|
|
980
|
+
signatures; for the cases 0.7.2 supported (P2PKH and strict ECDSA v3 inputs,
|
|
981
|
+
transactions version 1/2) the PSBTs and transactions are byte for byte the
|
|
982
|
+
same.
|
|
983
|
+
|
|
984
|
+
- `buildPSBTFromRawTransaction` accepts version-3 transactions and the new
|
|
985
|
+
`IPSBTInputMetadata.witnessScript`, for Neurai Connect signers. It now checks
|
|
986
|
+
that each metadata entry describes its input (`txid:vout`).
|
|
987
|
+
- `NeuraiESP32.signPsbt` rejects, before the device is involved, what the
|
|
988
|
+
firmware cannot sign: version-3 transactions or previous transactions, and
|
|
989
|
+
inputs with a `witnessScript` (`assertDeviceCanSignPSBT`, exported).
|
|
990
|
+
- `finalizeSignedPSBT` no longer changes an input's `sighashType` to match the
|
|
991
|
+
returned signature: a mismatch is an error. uNeurai's `PSBT::sign` signs with
|
|
992
|
+
the input's `PSBT_IN_SIGHASH_TYPE` (`SIGHASH_ALL` when absent), so firmware
|
|
993
|
+
answers match the PSBT they were given.
|
|
994
|
+
- `finalizeSignedPSBT` no longer falls back to the minimal-PSBT reader when a
|
|
995
|
+
readable answer conflicts with the original or is for another transaction;
|
|
996
|
+
the minimal reader itself checks the transaction against the original.
|
|
997
|
+
- Error messages of invalid PSBTs come from neurai-create-transaction.
|
|
998
|
+
- `npm run test:package` accepts dependencies not yet on npm as tarballs:
|
|
999
|
+
`NEURAI_PACKAGE_CHECK_TARBALLS=/path/a.tgz,/path/b.tgz`.
|
|
1000
|
+
|
|
946
1001
|
## Upgrading to 0.7.2
|
|
947
1002
|
|
|
948
1003
|
Previous transactions may be Neurai version-3 transactions (privacy pools and
|