@smartledger/bsv 9.9.0 → 9.10.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/CHANGELOG.md CHANGED
@@ -7,6 +7,73 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [9.10.1] - 2026-09-16
11
+
12
+ **A patch: evaluating a script no longer rewrites it or the interpreter's shared boolean values.** No API change; consensus results are unchanged.
13
+
14
+ ### Fixed — evaluating a script could rewrite it, and corrupt `true` for every later script
15
+
16
+ `OP_AND`, `OP_OR`, `OP_XOR` and `OP_INVERT` wrote their result into their operand, and
17
+ `OP_NUM2BIN`/`OP_BIN2NUM` went through `_minimallyEncode`, which rewrote the last byte of
18
+ its argument. An operand is not necessarily the interpreter's own memory: a push places the
19
+ script chunk's buffer on the stack, `OP_SPLIT` returns views into its input, and boolean
20
+ results are the shared `Interpreter.true` and `Interpreter.false`. So evaluation could:
21
+
22
+ - **rewrite the script being evaluated**, including a buffer a caller passed to
23
+ `Script.fromBuffer`, and with it the script code a later signature covers;
24
+ - **corrupt `Interpreter.true` for the rest of the process.** After
25
+ `OP_2 OP_2 OP_3 OP_WITHIN OP_INVERT`, every later `OP_EQUAL`, `OP_WITHIN` and
26
+ `OP_CHECKSIG` pushed `0xfe` instead of `0x01`; `OP_XOR` of two boolean results zeroed it.
27
+
28
+ Each opcode now writes a new buffer. `test/script/in_place_mutation.js` fails 12 of 18 on
29
+ the previous code. A fuzz of 20,000 random scripts found 58 that altered the script or the
30
+ shared booleans before the fix, and none after. Consensus results are unchanged:
31
+ conformance 452/452, SV vectors 1483/1483.
32
+
33
+ ### Docs
34
+
35
+ - `docs/BRC220_CERTIFICATE_FIELDS_AMENDMENT.md` follows bsv-blockchain/BRCs#247 after review.
36
+ The first wording said DER "is not 64 bytes long", which is false: DER can be 64 bytes when
37
+ `r` and `s` are unusually short. The text now states the rule the reference implementation
38
+ and this library both apply: exactly 64 bytes is `r ‖ s`, and anything else must parse as
39
+ DER. The matching comment in `lib/notaryhash/suites.js` is corrected the same way; the
40
+ code already applied that rule.
41
+
42
+ ## [9.10.0] - 2026-09-11
43
+
44
+ **NotaryHash refuses base64 that is not base64, can check a header's height, and its
45
+ certificate fields are proposed for BRC-220.** Everything here is additive or refuses only
46
+ malformed input: nothing that verified in 9.9.0 stops verifying.
47
+
48
+ ### Fixed — NotaryHash reads base64 strictly, and can check a header's height
49
+
50
+ `Certificate.decodeBytes` refuses a base64 length that no byte string encodes, and padding
51
+ anywhere but the end. `Buffer.from` drops a trailing character that cannot complete a byte,
52
+ so `"AAAAA"` decoded to three bytes instead of failing — the same corruption-as-decoding
53
+ that 9.9.0 already refused for characters outside the alphabet. Everything a writer
54
+ produces, in either alphabet and with or without padding, is still accepted.
55
+
56
+ `verify()` and `verifyAnchorSPV()` take an optional `height`. BRC-220 anchors a certificate
57
+ in "the block header for `spv.blockHash` at `spv.blockHeight`", and an 80-byte header does
58
+ not carry its height, so until now the height could not be checked at all. A caller that
59
+ obtained the header at a known height passes it, and a mismatch fails the anchor. It is
60
+ optional because requiring it would break every caller that holds only the header.
61
+
62
+ ### Docs
63
+
64
+ - `docs/BRC220_CERTIFICATE_FIELDS_AMENDMENT.md`: a BRC-220 amendment defining the
65
+ certificate's field values as the reference implementation writes them, and two rules
66
+ for reading them. BRC-220 names the twelve required fields and defines none of their
67
+ values, which is how 8.3.0–9.8.0 and the reference came to be unable to read each
68
+ other's certificates. Filed as
69
+ [bsv-blockchain/BRCs#247](https://github.com/bsv-blockchain/BRCs/pull/247).
70
+ `test/notaryhash/fields_amendment.js` checks its examples against certificates the
71
+ reference produced, and checks that this library does what each reader rule says.
72
+ - `docs/BRC220_BATCH_LEAF_AMENDMENT.md` says that `leafIndex` counts from 0, and how `i`
73
+ is written in the batch vector's preimages. Review of
74
+ [bsv-blockchain/BRCs#246](https://github.com/bsv-blockchain/BRCs/pull/246) asked for
75
+ both, and #246 now carries them too. The vector's values are unchanged.
76
+
10
77
  ## [9.9.0] - 2026-09-11
11
78
 
12
79
  **NotaryHash interoperates with the BRC-220 reference implementation, without breaking
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Bitcoin SV library with an interpreter-verified script engine.
4
4
 
5
- [![Version](https://img.shields.io/badge/version-9.9.0-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
5
+ [![Version](https://img.shields.io/badge/version-9.10.1-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
  [![Stability](https://img.shields.io/badge/9.x%20stable%20until-2027--09--01-brightgreen.svg)](STABILITY.md)
8
8
 
@@ -155,44 +155,44 @@ const bsv = require('@smartledger/bsv') // 128 modules
155
155
  ### **Core Modules**
156
156
  | Module | Size | Use Case | CDN |
157
157
  |--------|------|----------|-----|
158
- | **bsv.min.js** | 1056KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.9.0/bsv.min.js` |
159
- | **bsv.bundle.js** | 1056KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.9.0/bsv.bundle.js` |
158
+ | **bsv.min.js** | 1056KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.10.1/bsv.min.js` |
159
+ | **bsv.bundle.js** | 1056KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.10.1/bsv.bundle.js` |
160
160
 
161
161
  ### **W3C Verifiable Credentials**
162
162
  | Module | Size | Use Case | CDN |
163
163
  |--------|------|----------|-----|
164
- | **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-didweb.min.js` |
165
- | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-vcjwt.min.js` |
166
- | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-statuslist.min.js` |
167
- | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.9.0/bsv-anchor.min.js` |
164
+ | **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-didweb.min.js` |
165
+ | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-vcjwt.min.js` |
166
+ | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-statuslist.min.js` |
167
+ | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.10.1/bsv-anchor.min.js` |
168
168
 
169
169
  ### **Smart Contract & Development**
170
170
  | Module | Size | Use Case | CDN |
171
171
  |--------|------|----------|-----|
172
- | **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.9.0/bsv-smartcontract.min.js` |
173
- | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.9.0/bsv-covenant.min.js` |
174
- | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.9.0/bsv-script-helper.min.js` |
175
- | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.9.0/bsv-security.min.js` |
172
+ | **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.10.1/bsv-smartcontract.min.js` |
173
+ | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.10.1/bsv-covenant.min.js` |
174
+ | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.10.1/bsv-script-helper.min.js` |
175
+ | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.10.1/bsv-security.min.js` |
176
176
 
177
177
  ### **Legal & Compliance**
178
178
  | Module | Size | Use Case | CDN |
179
179
  |--------|------|----------|-----|
180
- | **bsv-ltp.min.js** | 540KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.9.0/bsv-ltp.min.js` |
181
- | **bsv-gdaf.min.js** | 1056KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.9.0/bsv-gdaf.min.js` |
180
+ | **bsv-ltp.min.js** | 540KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.10.1/bsv-ltp.min.js` |
181
+ | **bsv-gdaf.min.js** | 1056KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.10.1/bsv-gdaf.min.js` |
182
182
 
183
183
  ### **Advanced Cryptography**
184
184
  | Module | Size | Use Case | CDN |
185
185
  |--------|------|----------|-----|
186
- | **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.9.0/bsv-shamir.min.js` |
186
+ | **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.10.1/bsv-shamir.min.js` |
187
187
 
188
188
  ### **Utilities**
189
189
  | Module | Size | Use Case | CDN |
190
190
  |--------|------|----------|-----|
191
- | **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.9.0/bsv-ecies.min.js` |
192
- | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.9.0/bsv-message.min.js` |
193
- | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.9.0/bsv-mnemonic.min.js` |
191
+ | **bsv-ecies.min.js** | 137KB | Encryption | `unpkg.com/@smartledger/bsv@9.10.1/bsv-ecies.min.js` |
192
+ | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.10.1/bsv-message.min.js` |
193
+ | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.10.1/bsv-mnemonic.min.js` |
194
194
  ```html
195
- <script src="https://unpkg.com/@smartledger/bsv@9.9.0/bsv.min.js"></script>
195
+ <script src="https://unpkg.com/@smartledger/bsv@9.10.1/bsv.min.js"></script>
196
196
  <script>
197
197
  const key = bsv.PrivateKey.fromRandom()
198
198
  </script>
@@ -240,4 +240,4 @@ MIT
240
240
 
241
241
  ---
242
242
 
243
- **SmartLedger-BSV v9.9.0**
243
+ **SmartLedger-BSV v9.10.1**