@smartledger/bsv 5.5.2 → 6.0.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +118 -2
  2. package/README.md +38 -38
  3. package/bin/cli.js +35 -5
  4. package/bsv-covenant.min.js +6 -6
  5. package/bsv-gdaf.min.js +2 -2
  6. package/bsv-ltp.min.js +2 -2
  7. package/bsv-shamir.min.js +1 -1
  8. package/bsv-smartcontract.min.js +6 -6
  9. package/bsv-statuslist.min.js +5 -5
  10. package/bsv-vcjwt.min.js +1 -1
  11. package/bsv.bundle.js +2 -2
  12. package/bsv.d.ts +283 -10
  13. package/bsv.min.js +2 -2
  14. package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
  15. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  16. package/docs/getting-started/INSTALLATION.md +23 -23
  17. package/docs/getting-started/QUICK_START.md +7 -7
  18. package/docs/migration/FROM_BSV_1_5_6.md +5 -5
  19. package/index.js +4 -0
  20. package/lib/crypto/ecdsa.js +13 -0
  21. package/lib/crypto/shamir.js +30 -11
  22. package/lib/gdaf/did-resolver.js +3 -1
  23. package/lib/gdaf/smartledger-anchor.js +154 -12
  24. package/lib/ltp/anchor.js +16 -3
  25. package/lib/ltp/obligation.js +56 -8
  26. package/lib/ltp/proof.js +4 -2
  27. package/lib/ltp/right.js +86 -11
  28. package/lib/ordinals/README.md +170 -0
  29. package/lib/ordinals/bsv20.js +183 -0
  30. package/lib/ordinals/index.js +49 -0
  31. package/lib/ordinals/inscription.js +159 -0
  32. package/lib/ordinals/ordlock.js +535 -0
  33. package/lib/smart_contract/builder.js +27 -3
  34. package/lib/smart_contract/covenant.js +37 -10
  35. package/lib/smart_contract/covenant_builder.js +7 -5
  36. package/lib/smart_contract/index.js +28 -15
  37. package/lib/smart_contract/preimage.js +7 -7
  38. package/lib/smart_contract/pushtx.js +47 -7
  39. package/lib/smart_contract/token.js +69 -1
  40. package/lib/spv/headerchain.js +77 -0
  41. package/lib/spv/index.js +16 -0
  42. package/lib/spv/merkleproof.js +108 -0
  43. package/lib/statuslist/index.js +65 -24
  44. package/lib/vcjwt/index.js +6 -0
  45. package/package.json +1 -1
  46. package/test/credentials-test.js +22 -19
  47. package/test/crypto/shamir.js +9 -1
  48. package/test/crypto/shamir_rngcap.js +29 -0
  49. package/test/gdaf/anchor_spv.js +163 -0
  50. package/test/ltp/verify_failclosed.js +134 -0
  51. package/test/ordinals/bsv20.js +116 -0
  52. package/test/ordinals/inscription.js +71 -0
  53. package/test/ordinals/ordlock.js +482 -0
  54. package/test/smart_contract/extract_field.js +61 -0
  55. package/test/smart_contract/nonenforcing_guard.js +44 -0
  56. package/test/smart_contract/ordinal_transfer.js +83 -0
  57. package/test/smart_contract/sighash_marketplace.js +110 -0
  58. package/test/spv/headerchain.js +86 -0
  59. package/test/spv/merkleproof.js +133 -0
  60. package/test/statuslist/failclosed.js +78 -0
package/CHANGELOG.md CHANGED
@@ -5,10 +5,126 @@ All notable changes to SmartLedger-BSV will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [6.0.0] - 2026-07-12
11
+
12
+ Major release. Combines a security-hardening pass (four CRITICAL forgery-enabling
13
+ verification bugs, a revocation bypass, and several covenant defects — all fixed) with
14
+ two large new capabilities: a complete **1Sat Ordinals** stack (inscriptions, the
15
+ OrdLock marketplace, and BSV-20 / BSV-21 fungible tokens) and **trustless SPV**
16
+ (Merkle-inclusion + header-chain confirmations). **Contains breaking changes** (see
17
+ below). The suite grew to 4365 tests; each security fix ships an adversarial regression
18
+ that asserts the *bad* input is rejected, and every emitted covenant/inscription script
19
+ is interpreter-verified. A CI gate enforces that shipped bundles are a reproducible
20
+ build of `lib/`.
21
+
22
+ ### Security — Fixed
23
+
24
+ - **CRITICAL: forgeable signatures via the `ECDSA.verify()` trap.** `ECDSA.prototype.verify()`
25
+ returns the ECDSA *instance* (always truthy) with the real result on `.verified`.
26
+ Three call sites treated the truthy return as a boolean and one skipped the check
27
+ entirely, so a forged signature verified as valid:
28
+ - `lib/ltp/proof.js` and `lib/gdaf/did-resolver.js` (`verifyOwnership`) now read `.verified`.
29
+ - `lib/ltp/right.js` / `lib/ltp/obligation.js` `_verifyTokenSignature` (was a `// TODO`)
30
+ now verifies the JWS, **bound to the issuer DID's key** (not the attacker-controlled
31
+ `proof.verificationMethod`), and fails closed.
32
+ - Added `ECDSA.prototype.verifyBool()` and a warning on `verify()`.
33
+ - **CRITICAL: `SmartLedgerAnchor.verifyAnchor` was a stub** returning `{verified:true}`
34
+ for any txid. Now fails closed (throws) unless an injected `chainProvider` performs a
35
+ real inclusion + OP_RETURN-commitment check.
36
+ - **HIGH: StatusList2021 revocation bypass.** `getCredentialStatusEntry` / `updateStatusList`
37
+ read the revocation bitstring from an **unverified** JWT — a substituted/forged list could
38
+ un-revoke a credential. They now verify the list-JWT signature against a **pinned issuer**
39
+ before reading any bit, and cap gzip inflation (gzip-bomb DoS).
40
+ - **HIGH: `prepareRightTokenTransfer` did not bind the signer to the current owner** — anyone
41
+ could mint a "valid" transfer of a token they don't own. Now bound to `credentialSubject.id`.
42
+ - **MEDIUM: Shamir checksum leaked a hash of the secret** in every share (offline brute-force of
43
+ low-entropy secrets by a single, sub-threshold holder). The per-share checksum is now **off by
44
+ default** (opt-in via `{checksum:true}`).
45
+ - **MEDIUM: `vcjwt.verifyVcJwt`** — tokens without an `exp` never expired; added opt-in
46
+ `requireExpiration`.
47
+ - **MEDIUM: `LTP.Anchor.verifyTokenAnchor`** trusted caller-supplied `txData` with no chain
48
+ proof; result now carries `chainVerified:false` and the doc states it is commitment-match only.
49
+
50
+ ### Fixed — Covenants (consensus-relevant)
51
+
52
+ - **Inverted `OP_SPLIT`/`OP_DROP` field extraction** in `covenant_builder.js` and the
53
+ reference ASM in `preimage.js`. After `OP_SPLIT` the right part is on top, so keeping it
54
+ needs `OP_NIP`; the code used `OP_DROP`, extracting the wrong bytes for RIGHT-strategy fields
55
+ (`value`, `nSequence`, `hashOutputs`, `nLocktime`, `sighashType`). Proven at the interpreter
56
+ level and fixed; added `nip()`.
57
+ - **`SmartContract.Covenant` built a non-enforcing "covenant"** (reduces to P2PK; bound nothing
58
+ about the spend) while claiming "production-ready … BIP-143 validation." `createFromP2PKH`
59
+ now throws unless constructed with `{allowNonEnforcing:true}`, and the docs redirect to the
60
+ real OP_PUSH_TX primitives.
61
+ - **Shamir RNG could hang forever** on a degenerate/stubbed CSPRNG (all-zero draws); the re-draw
62
+ loop is now bounded and throws instead.
63
+
64
+ ### Added
65
+
66
+ - **Ordinal-safe transfers.** `SmartContract.Token.transferOrdinal` / `SmartContract.ordinalLock`
67
+ recreate a 1-sat ordinal among funding outputs (fee paid from funding, satoshi preserved), with
68
+ an anti-burn guard; the single-output `unlockTransfer` now refuses a 1-sat UTXO.
69
+ - **Configurable SIGHASH covenant core.** `PushTx.pushTxCore(script, {sighashType})`,
70
+ `assertSighashType`, and `grind({sighashType})` enable `SIGHASH_SINGLE|ANYONECANPAY` marketplace
71
+ covenants (seller signs its own input+output; buyer adds funding). Default remains SIGHASH_ALL.
72
+ - **CI bundle-parity gate** (`.github/workflows/ci.yml`): fails if the shipped `*.min.js`/
73
+ `*.bundle.js` are not a reproducible build of `lib/`. Added `.nvmrc` (Node 18) for reproducibility.
74
+ - **1Sat Ordinals module** (`bsv.Ordinals`). `buildInscription`/`parseInscription`/`isInscription`
75
+ build and round-trip the `OP_FALSE OP_IF "ord" … OP_ENDIF` inscription envelope on a P2PKH (or
76
+ custom) base lock; `createInscriptionOutput`/`batchInscriptionOutputs` mint the 1-sat output(s).
77
+ - **OrdLock marketplace covenant** (`bsv.Ordinals.buildOrdLock`/`listInscriptionOutput`/
78
+ `purchaseOrdLock`/`cancelOrdLock`). A trustless "pay the seller or cancel" listing built on the
79
+ configurable-SIGHASH OP_PUSH_TX core (`SIGHASH_ALL|ANYONECANPAY|FORKID`, new
80
+ `PushTx.SIGHASH_ALL_ANYONECANPAY_FORKID`): the buyer supplies the surrounding outputs and the
81
+ covenant binds the required payment output(s) byte-for-byte into the committed `hashOutputs`,
82
+ while the seller keeps an ECDSA cancel path.
83
+ - **Multi-output payments**: a listing can pin a seller payment plus royalty and marketplace-fee
84
+ outputs (`payOutputs` / `royalties`), so a purchase atomically pays every party or fails.
85
+ - **Self-describing listings**: `parseOrdLock(script)` / `isOrdLock(script)` recover the seller,
86
+ the pinned payment(s), the total price, and any inline inscription — an indexer/wallet/UI can
87
+ read a listing straight off-chain.
88
+ - **End-to-end assembly** covers the whole lifecycle: `buildListingTx({ordinal, seller, price,
89
+ royalties, funding, fee})` moves a P2PKH ordinal into a listing (sat preserved into output 0),
90
+ and `buildPurchaseTx({listing, ordinalDestination, funding, fee})` reads the required payment(s)
91
+ off the listing script and returns a complete, signed purchase — the covenant input grinds the
92
+ OP_PUSH_TX signature and the P2PKH funding inputs are signed over the finalized tx.
93
+ Every emitted script (covenant + funding + ordinal inputs) is interpreter-verified across the
94
+ full list → buy / cancel lifecycle, including adversarial spends (underpay seller/royalty,
95
+ redirect fee, wrong-key cancel, tamper-after-build) asserted to be rejected. Typed in `bsv.d.ts`
96
+ (`namespace Ordinals`); documented in `lib/ordinals/README.md`.
97
+ - **BSV-20 / BSV-21 fungible-token inscriptions** (`bsv.Ordinals.BSV20`). Build and parse the
98
+ `application/bsv-20` JSON payloads carried on 1-sat outputs: v1 ticker tokens
99
+ (`buildDeploy`/`buildMint`/`buildTransfer`), v2 / BSV-21 id-based supplies
100
+ (`buildDeployMint`, transfer by `id`), `create*Output` 1-sat outputs, and
101
+ `parseBsv20`/`isBsv20` (accepting a script, JSON string, or object). Amounts are integer
102
+ strings — never coerced to JS numbers, so supplies beyond 2^53 stay exact. Builders validate
103
+ their inputs (ticker ≤ 4 UTF-8 bytes, non-negative integer `amt`/`max`/`lim`, `dec` 0–18,
104
+ well-formed BSV-21 `id`). Typed in `bsv.d.ts` (`namespace Ordinals.BSV20`).
105
+ - **Trustless SPV** (`bsv.SPV`). `verifyMerkleProof` / `merkleRootFromBranch` / `verifyTxInclusion`
106
+ verify a transaction's inclusion in a proof-of-work-backed block from a Merkle branch
107
+ (double-SHA256, internal-LE byte order, TSC `*` odd-node duplication), and `verifyHeaderChain`
108
+ checks header linkage + per-header proof-of-work against an optional trusted checkpoint. Wired
109
+ into GDAF's `SmartLedgerAnchor.verifyAnchor`: a new trustless path
110
+ (`{ spvProof:{index,nodes}, header|headerChain, rawTx }`) proves inclusion + PoW, binds the raw
111
+ tx to the txid, and checks an OP_RETURN commits to the expected hash — replacing the
112
+ trust-the-provider stub. Typed in `bsv.d.ts`.
113
+
114
+ ### Changed — BREAKING
115
+
116
+ - `statuslist.getCredentialStatusEntry` is now **async** and both status functions **require**
117
+ `expectedIssuerDid` plus a key source (`didResolver` / `issuerJwks` / `issuerPublicJwk`). The CLI
118
+ `status set`/`check` resolve the issuer key from the key file automatically.
119
+ - `SmartContract.Covenant.createFromP2PKH` **throws** unless the instance is constructed with
120
+ `{allowNonEnforcing:true}`.
121
+ - Shamir `split()` no longer embeds a secret checksum by default (pass `{checksum:true}` to restore).
122
+
8
123
  ## [5.5.2] - 2026-06-28
9
124
 
10
- Docs-only patch. No API, behavior, or bundle changes — every shipped `.js`
11
- bundle is byte-identical to 5.5.1.
125
+ Docs-only patch. No API or behavior changes — the only difference in any
126
+ shipped `.js` bundle is the embedded version string (`5.5.1` → `5.5.2`,
127
+ read from `package.json`); the executable code is identical to 5.5.1.
12
128
 
13
129
  ### Fixed
14
130
 
package/README.md CHANGED
@@ -186,42 +186,42 @@ console.log('Status:', status) // 'revoked'
186
186
  ### **Core Modules**
187
187
  | Module | Size | Use Case | CDN |
188
188
  |--------|------|----------|-----|
189
- | **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js` |
190
- | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.5.2/bsv.bundle.js` |
189
+ | **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js` |
190
+ | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@6.0.0/bsv.bundle.js` |
191
191
 
192
192
  ### **W3C Verifiable Credentials**
193
193
  | Module | Size | Use Case | CDN |
194
194
  |--------|------|----------|-----|
195
- | **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.5.2/bsv-didweb.min.js` |
196
- | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.5.2/bsv-vcjwt.min.js` |
197
- | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.5.2/bsv-statuslist.min.js` |
198
- | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.5.2/bsv-anchor.min.js` |
195
+ | **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@6.0.0/bsv-didweb.min.js` |
196
+ | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@6.0.0/bsv-vcjwt.min.js` |
197
+ | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@6.0.0/bsv-statuslist.min.js` |
198
+ | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@6.0.0/bsv-anchor.min.js` |
199
199
 
200
200
  ### **Smart Contract & Development**
201
201
  | Module | Size | Use Case | CDN |
202
202
  |--------|------|----------|-----|
203
- | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.5.2/bsv-smartcontract.min.js` |
204
- | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.5.2/bsv-covenant.min.js` |
205
- | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.5.2/bsv-script-helper.min.js` |
206
- | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.5.2/bsv-security.min.js` |
203
+ | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@6.0.0/bsv-smartcontract.min.js` |
204
+ | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@6.0.0/bsv-covenant.min.js` |
205
+ | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@6.0.0/bsv-script-helper.min.js` |
206
+ | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@6.0.0/bsv-security.min.js` |
207
207
 
208
208
  ### **Legal & Compliance**
209
209
  | Module | Size | Use Case | CDN |
210
210
  |--------|------|----------|-----|
211
- | **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.5.2/bsv-ltp.min.js` |
212
- | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.5.2/bsv-gdaf.min.js` |
211
+ | **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@6.0.0/bsv-ltp.min.js` |
212
+ | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@6.0.0/bsv-gdaf.min.js` |
213
213
 
214
214
  ### **Advanced Cryptography**
215
215
  | Module | Size | Use Case | CDN |
216
216
  |--------|------|----------|-----|
217
- | **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.5.2/bsv-shamir.min.js` |
217
+ | **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@6.0.0/bsv-shamir.min.js` |
218
218
 
219
219
  ### **Utilities**
220
220
  | Module | Size | Use Case | CDN |
221
221
  |--------|------|----------|-----|
222
- | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@5.5.2/bsv-ecies.min.js` |
223
- | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.5.2/bsv-message.min.js` |
224
- | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@5.5.2/bsv-mnemonic.min.js` |
222
+ | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@6.0.0/bsv-ecies.min.js` |
223
+ | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@6.0.0/bsv-message.min.js` |
224
+ | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@6.0.0/bsv-mnemonic.min.js` |
225
225
 
226
226
  ## ⚡ **2-Minute Quick Start**
227
227
 
@@ -232,7 +232,7 @@ Get started with Bitcoin SV development in under 2 minutes:
232
232
  npm install @smartledger/bsv
233
233
 
234
234
  # Or include in HTML
235
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
235
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
236
236
  ```
237
237
 
238
238
  > **🔒 v5.0.0 (production hardening — has breaking changes):** Shamir secret
@@ -332,8 +332,8 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
332
332
 
333
333
  ### 🔧 **Basic Development** (~1.2MB total)
334
334
  ```html
335
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
336
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-script-helper.min.js"></script>
335
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
336
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-script-helper.min.js"></script>
337
337
  <script>
338
338
  const privateKey = new bsv.PrivateKey();
339
339
  const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
@@ -342,9 +342,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
342
342
 
343
343
  ### 🔒 **Smart Contract Development** (~2.8MB total — each bundle re-embeds core BSV)
344
344
  ```html
345
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
346
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-covenant.min.js"></script>
347
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-smartcontract.min.js"></script>
345
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
346
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-covenant.min.js"></script>
347
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-smartcontract.min.js"></script>
348
348
  <script>
349
349
  const covenant = bsv.SmartContract.createCovenantBuilder()
350
350
  .extractField('amount').push(50000).greaterThanOrEqual().verify().build();
@@ -354,9 +354,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
354
354
 
355
355
  ### 🆕 **Legal & Identity Development** (~3.4MB total — each bundle re-embeds core BSV)
356
356
  ```html
357
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
358
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-ltp.min.js"></script>
359
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-gdaf.min.js"></script>
357
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
358
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-ltp.min.js"></script>
359
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-gdaf.min.js"></script>
360
360
  <script>
361
361
  // Legal Token Protocol
362
362
  const propertyToken = bsv.createPropertyToken({
@@ -370,9 +370,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
370
370
 
371
371
  ### 🆕 **Security & Cryptography** (~1.5MB total)
372
372
  ```html
373
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
374
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-security.min.js"></script>
375
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-shamir.min.js"></script>
373
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
374
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-security.min.js"></script>
375
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-shamir.min.js"></script>
376
376
  <script>
377
377
  // Threshold Cryptography
378
378
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -384,7 +384,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
384
384
 
385
385
  ### 🎯 **Everything Bundle** (~1.1MB)
386
386
  ```html
387
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.bundle.js"></script>
387
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.bundle.js"></script>
388
388
  <script>
389
389
  // Everything available immediately
390
390
  const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
@@ -494,8 +494,8 @@ const contractTx = covenant.createCovenantTransaction({
494
494
 
495
495
  #### 1. **Minimal Setup** - Core + Script Helper (~1.2MB)
496
496
  ```html
497
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
498
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-script-helper.min.js"></script>
497
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
498
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-script-helper.min.js"></script>
499
499
  <script>
500
500
  const tx = new bsv.Transaction();
501
501
  const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
@@ -504,9 +504,9 @@ const contractTx = covenant.createCovenantTransaction({
504
504
 
505
505
  #### 2. **DeFi Development** - Core + Covenants + Debug (~2.8MB — each bundle re-embeds core BSV)
506
506
  ```html
507
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
508
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-covenant.min.js"></script>
509
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-smartcontract.min.js"></script>
507
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
508
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-covenant.min.js"></script>
509
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-smartcontract.min.js"></script>
510
510
  <script>
511
511
  const covenant = new bsvCovenant.CovenantInterface();
512
512
  const debugInfo = SmartContract.interpretScript(script);
@@ -516,8 +516,8 @@ const contractTx = covenant.createCovenantTransaction({
516
516
 
517
517
  #### 3. **Security First** - Core + Enhanced Security (~1.2MB)
518
518
  ```html
519
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.min.js"></script>
520
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv-security.min.js"></script>
519
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.min.js"></script>
520
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv-security.min.js"></script>
521
521
  <script>
522
522
  const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
523
523
  const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
@@ -526,7 +526,7 @@ const contractTx = covenant.createCovenantTransaction({
526
526
 
527
527
  #### 4. **Everything Bundle** - One File Solution (~1.1MB)
528
528
  ```html
529
- <script src="https://unpkg.com/@smartledger/bsv@5.5.2/bsv.bundle.js"></script>
529
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.0/bsv.bundle.js"></script>
530
530
  <script>
531
531
  // Everything available under bsv namespace
532
532
  const keys = bsv.SmartLedgerBundle.generateKeys();
@@ -834,7 +834,7 @@ const timelockScript = helper.createTimelockScript(
834
834
 
835
835
  See the **[16 Loading Options](#-16-loading-options---choose-your-approach)**
836
836
  table near the top for the full list of bundles with current sizes and
837
- canonical `unpkg.com/@smartledger/bsv@5.5.2/...` URLs.
837
+ canonical `unpkg.com/@smartledger/bsv@6.0.0/...` URLs.
838
838
 
839
839
  ## 🔐 Security
840
840
 
package/bin/cli.js CHANGED
@@ -43,6 +43,34 @@ function writeJsonFile(filepath, data) {
43
43
  fs.writeFileSync(filepath, JSON.stringify(data, null, 2))
44
44
  }
45
45
 
46
+ // Build the issuer-pinned verification options a status-list read/update needs.
47
+ // Status-list reads MUST verify the list JWT signature against the issuer's key
48
+ // (else revocation is bypassable), so we resolve that key from --jwks <file>, or
49
+ // the issuer key file (--key, default issuer-key.json), plus the issuer DID.
50
+ function loadStatusVerifyOpts(opts, keyData) {
51
+ var expectedIssuerDid = opts.issuer
52
+ var issuerJwks = null
53
+ if (opts.jwks && fs.existsSync(opts.jwks)) {
54
+ issuerJwks = readJsonFile(opts.jwks)
55
+ } else {
56
+ var kd = keyData
57
+ if (!kd) {
58
+ var kf = opts.key || 'issuer-key.json'
59
+ if (fs.existsSync(kf)) kd = readJsonFile(kf)
60
+ }
61
+ if (kd && kd.publicJwk) {
62
+ expectedIssuerDid = expectedIssuerDid || kd.did
63
+ issuerJwks = { keys: [Object.assign({}, kd.publicJwk, { kid: kd.kid })] }
64
+ }
65
+ }
66
+ if (!expectedIssuerDid || !issuerJwks) {
67
+ console.error('status verification requires the issuer key (--key issuer-key.json) ' +
68
+ 'or --jwks <file>, plus --issuer <did>')
69
+ process.exit(1)
70
+ }
71
+ return { expectedIssuerDid: expectedIssuerDid, issuerJwks: issuerJwks }
72
+ }
73
+
46
74
  async function main() {
47
75
  if (command === '--version' || command === '-v') {
48
76
  console.log(pkg.version)
@@ -279,12 +307,13 @@ async function handleStatus(subcommand, opts) {
279
307
  console.error(' Index:', opts.index)
280
308
  console.error(' Status:', opts.status)
281
309
 
282
- var result = await statuslist.updateStatusList({
310
+ var setVerifyOpts = loadStatusVerifyOpts(opts, keyData)
311
+ var result = await statuslist.updateStatusList(Object.assign({
283
312
  listVcJwt: listJwt,
284
313
  index: parseInt(opts.index),
285
314
  status: opts.status,
286
315
  privateJwk: keyData.privateJwk
287
- })
316
+ }, setVerifyOpts))
288
317
 
289
318
  console.log(result.listVcJwt)
290
319
  console.error('✅ Status list updated')
@@ -296,11 +325,12 @@ async function handleStatus(subcommand, opts) {
296
325
  }
297
326
 
298
327
  var listJwt = fs.readFileSync(opts.list, 'utf8').trim()
299
-
300
- var status = statuslist.getCredentialStatusEntry({
328
+
329
+ var checkVerifyOpts = loadStatusVerifyOpts(opts, null)
330
+ var status = await statuslist.getCredentialStatusEntry(Object.assign({
301
331
  listVcJwt: listJwt,
302
332
  index: parseInt(opts.index)
303
- })
333
+ }, checkVerifyOpts))
304
334
 
305
335
  console.log(status)
306
336
  console.error('Status at index', opts.index + ':', status)