@smartledger/bsv 9.18.0 → 9.19.0

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,48 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [9.19.0] - 2026-10-03
11
+
12
+ ### Security — `merkle.leafIndex` was not validated against the path beside it
13
+
14
+ A batch certificate's `merkle.leafIndex` could be changed to any other value in range and the
15
+ inclusion proof still verified. On a 25-leaf batch, a proof for leaf 3 verified while claiming to
16
+ be leaf 0, leaf 7 or leaf 24.
17
+
18
+ The cause is a seam between the two certificate formats. A sided audit path folds by its **own**
19
+ sides, and `Certificate.normalize` returns a non-legacy certificate untouched — so for a
20
+ **reference** certificate `leafIndex` was read and never used. A **legacy** certificate was fine,
21
+ because normalising it derives the sides from `leafIndex`, so a wrong index produced a wrong fold
22
+ and failed. Moving a certificate from the legacy format to the reference one therefore silently
23
+ lost a check.
24
+
25
+ **This was never a false accept of an invalid proof.** A corrupted path hash and a flipped side
26
+ were both refused before this release and are refused now; inclusion itself was sound. What was
27
+ wrong is that `leafIndex` was an **unvalidated assertion sitting beside validated ones**, and a
28
+ reader shown "leaf 3 of 25" had no way to tell which of those fields was load-bearing. For a
29
+ numbered edition — "card 3 of 25" — that field is the claim the holder cares about.
30
+
31
+ `NotaryHash.verifyBatchInclusion` now recomputes the side sequence the stated index implies and
32
+ refuses a mismatch, naming it:
33
+
34
+ ```
35
+ merkle.leafIndex 7 disagrees with the path: node 2 is marked "right" but leaf 7 of 25 requires "left"
36
+ merkle.leafIndex 24 in a tree of 25 leaves needs 2 path nodes; the path has 5
37
+ ```
38
+
39
+ No hashing is added: RFC 6962 already determines the sides from the index and the tree size, so
40
+ the check is one pass over the path. Verified across a 25-leaf tree that every leaf verifies at its
41
+ own index and **every leaf is refused at any other index**, 25 of 25.
42
+
43
+ `leafCount` is deliberately not treated the same way. A mis-stated count that implies the same side
44
+ sequence is indistinguishable here by construction, which is exactly what the on-chain
45
+ `u32be(leafCount)` in the batch record is for — `recordMatchesCertificate` compares it, and that
46
+ comparison is the authority.
47
+
48
+ Found by the ordinals mint that anchors BRC-220 proofs: its own tamper test caught the difference
49
+ when it moved from the legacy format to the reference one, and it reported the seam rather than
50
+ the symptom.
51
+
10
52
  ## [9.18.0] - 2026-10-03
11
53
 
12
54
  9.17.0 was committed but never published to npm; its contents are included here. The version
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.18.0-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
5
+ [![Version](https://img.shields.io/badge/version-9.19.0-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** | 1065KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.18.0/bsv.min.js` |
159
- | **bsv.bundle.js** | 1065KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.18.0/bsv.bundle.js` |
158
+ | **bsv.min.js** | 1067KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@9.19.0/bsv.min.js` |
159
+ | **bsv.bundle.js** | 1067KB | Everything in one file | `unpkg.com/@smartledger/bsv@9.19.0/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.18.0/bsv-didweb.min.js` |
165
- | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.18.0/bsv-vcjwt.min.js` |
166
- | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.18.0/bsv-statuslist.min.js` |
167
- | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.18.0/bsv-anchor.min.js` |
164
+ | **🟢 bsv-didweb.min.js** | 166KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@9.19.0/bsv-didweb.min.js` |
165
+ | **🟢 bsv-vcjwt.min.js** | 166KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@9.19.0/bsv-vcjwt.min.js` |
166
+ | **🟢 bsv-statuslist.min.js** | 256KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@9.19.0/bsv-statuslist.min.js` |
167
+ | **🟢 bsv-anchor.min.js** | 164KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@9.19.0/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.18.0/bsv-smartcontract.min.js` |
173
- | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.18.0/bsv-covenant.min.js` |
174
- | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.18.0/bsv-script-helper.min.js` |
175
- | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.18.0/bsv-security.min.js` |
172
+ | **bsv-smartcontract.min.js** | 141KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@9.19.0/bsv-smartcontract.min.js` |
173
+ | **bsv-covenant.min.js** | 35KB | Covenant operations | `unpkg.com/@smartledger/bsv@9.19.0/bsv-covenant.min.js` |
174
+ | **bsv-script-helper.min.js** | 33KB | Custom script tools | `unpkg.com/@smartledger/bsv@9.19.0/bsv-script-helper.min.js` |
175
+ | **bsv-security.min.js** | 32KB | Security enhancements | `unpkg.com/@smartledger/bsv@9.19.0/bsv-security.min.js` |
176
176
 
177
177
  ### **Legal & Compliance**
178
178
  | Module | Size | Use Case | CDN |
179
179
  |--------|------|----------|-----|
180
- | **bsv-ltp.min.js** | 544KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.18.0/bsv-ltp.min.js` |
181
- | **bsv-gdaf.min.js** | 1065KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.18.0/bsv-gdaf.min.js` |
180
+ | **bsv-ltp.min.js** | 544KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@9.19.0/bsv-ltp.min.js` |
181
+ | **bsv-gdaf.min.js** | 1067KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@9.19.0/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.18.0/bsv-shamir.min.js` |
186
+ | **bsv-shamir.min.js** | 177KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@9.19.0/bsv-shamir.min.js` |
187
187
 
188
188
  ### **Utilities**
189
189
  | Module | Size | Use Case | CDN |
190
190
  |--------|------|----------|-----|
191
- | **bsv-ecies.min.js** | 139KB | Encryption | `unpkg.com/@smartledger/bsv@9.18.0/bsv-ecies.min.js` |
192
- | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.18.0/bsv-message.min.js` |
193
- | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.18.0/bsv-mnemonic.min.js` |
191
+ | **bsv-ecies.min.js** | 139KB | Encryption | `unpkg.com/@smartledger/bsv@9.19.0/bsv-ecies.min.js` |
192
+ | **bsv-message.min.js** | 34KB | Message signing | `unpkg.com/@smartledger/bsv@9.19.0/bsv-message.min.js` |
193
+ | **bsv-mnemonic.min.js** | 320KB | HD wallets | `unpkg.com/@smartledger/bsv@9.19.0/bsv-mnemonic.min.js` |
194
194
  ```html
195
- <script src="https://unpkg.com/@smartledger/bsv@9.18.0/bsv.min.js"></script>
195
+ <script src="https://unpkg.com/@smartledger/bsv@9.19.0/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.18.0**
243
+ **SmartLedger-BSV v9.19.0**