@smartledger/bsv 5.5.3 → 6.0.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +142 -0
  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 +289 -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 +16 -4
  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 +185 -0
  30. package/lib/ordinals/index.js +49 -0
  31. package/lib/ordinals/inscription.js +159 -0
  32. package/lib/ordinals/ordlock.js +560 -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 +126 -0
  52. package/test/ordinals/inscription.js +71 -0
  53. package/test/ordinals/ordlock.js +552 -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,6 +5,148 @@ 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.1] - 2026-07-12
11
+
12
+ Patch release — fixes from a code review of the v6.0.0 ordinals module. No API
13
+ removals; all additive/validation changes.
14
+
15
+ ### Fixed
16
+
17
+ - **`Ordinals.buildListingTx` signed the ordinal input with the wrong amount.** It resolved
18
+ the input value (defaulting `ordinal.satoshis` to 1) but signed with the raw, possibly-
19
+ undefined `ordinal.satoshis`, so omitting the documented-optional field produced a
20
+ signature over amount 0 that fails on-chain. It now signs with the resolved value.
21
+ - **`Ordinals.parseOrdLock` / `isOrdLock` always returned livenet addresses.** They now
22
+ accept `{ network }` so `seller.address` and `payOutputs[].address` can be formatted for
23
+ testnet (the pubKeyHash / scripts were always exact; only the display strings were wrong).
24
+ - **`Ordinals.BSV20` builders emitted non-canonical amounts.** Integer strings with leading
25
+ zeros (`"007"`) are now canonicalized (`"7"`) so indexers expecting canonical decimals
26
+ accept them; arbitrary precision is preserved.
27
+
28
+ ### Changed
29
+
30
+ - `Ordinals.payOutputFor` no longer silently ignores `price` when handed a `Transaction.Output`
31
+ (it now requires an address/pubkey/key + integer price); pass a pre-built output via the
32
+ `payOutputs`/`payTo` specs instead.
33
+ - Satoshi amounts are validated (non-negative integers) in `buildListingTx` / `buildPurchaseTx`
34
+ and at signing time, so a missing/NaN `satoshis` fails fast instead of yielding an invalid
35
+ signature. `purchase()` accepts a pre-computed `parsed` to avoid re-parsing the listing.
36
+
37
+ ## [6.0.0] - 2026-07-12
38
+
39
+ Major release. Combines a security-hardening pass (four CRITICAL forgery-enabling
40
+ verification bugs, a revocation bypass, and several covenant defects — all fixed) with
41
+ two large new capabilities: a complete **1Sat Ordinals** stack (inscriptions, the
42
+ OrdLock marketplace, and BSV-20 / BSV-21 fungible tokens) and **trustless SPV**
43
+ (Merkle-inclusion + header-chain confirmations). **Contains breaking changes** (see
44
+ below). The suite grew to 4365 tests; each security fix ships an adversarial regression
45
+ that asserts the *bad* input is rejected, and every emitted covenant/inscription script
46
+ is interpreter-verified. A CI gate enforces that shipped bundles are a reproducible
47
+ build of `lib/`.
48
+
49
+ ### Security — Fixed
50
+
51
+ - **CRITICAL: forgeable signatures via the `ECDSA.verify()` trap.** `ECDSA.prototype.verify()`
52
+ returns the ECDSA *instance* (always truthy) with the real result on `.verified`.
53
+ Three call sites treated the truthy return as a boolean and one skipped the check
54
+ entirely, so a forged signature verified as valid:
55
+ - `lib/ltp/proof.js` and `lib/gdaf/did-resolver.js` (`verifyOwnership`) now read `.verified`.
56
+ - `lib/ltp/right.js` / `lib/ltp/obligation.js` `_verifyTokenSignature` (was a `// TODO`)
57
+ now verifies the JWS, **bound to the issuer DID's key** (not the attacker-controlled
58
+ `proof.verificationMethod`), and fails closed.
59
+ - Added `ECDSA.prototype.verifyBool()` and a warning on `verify()`.
60
+ - **CRITICAL: `SmartLedgerAnchor.verifyAnchor` was a stub** returning `{verified:true}`
61
+ for any txid. Now fails closed (throws) unless an injected `chainProvider` performs a
62
+ real inclusion + OP_RETURN-commitment check.
63
+ - **HIGH: StatusList2021 revocation bypass.** `getCredentialStatusEntry` / `updateStatusList`
64
+ read the revocation bitstring from an **unverified** JWT — a substituted/forged list could
65
+ un-revoke a credential. They now verify the list-JWT signature against a **pinned issuer**
66
+ before reading any bit, and cap gzip inflation (gzip-bomb DoS).
67
+ - **HIGH: `prepareRightTokenTransfer` did not bind the signer to the current owner** — anyone
68
+ could mint a "valid" transfer of a token they don't own. Now bound to `credentialSubject.id`.
69
+ - **MEDIUM: Shamir checksum leaked a hash of the secret** in every share (offline brute-force of
70
+ low-entropy secrets by a single, sub-threshold holder). The per-share checksum is now **off by
71
+ default** (opt-in via `{checksum:true}`).
72
+ - **MEDIUM: `vcjwt.verifyVcJwt`** — tokens without an `exp` never expired; added opt-in
73
+ `requireExpiration`.
74
+ - **MEDIUM: `LTP.Anchor.verifyTokenAnchor`** trusted caller-supplied `txData` with no chain
75
+ proof; result now carries `chainVerified:false` and the doc states it is commitment-match only.
76
+
77
+ ### Fixed — Covenants (consensus-relevant)
78
+
79
+ - **Inverted `OP_SPLIT`/`OP_DROP` field extraction** in `covenant_builder.js` and the
80
+ reference ASM in `preimage.js`. After `OP_SPLIT` the right part is on top, so keeping it
81
+ needs `OP_NIP`; the code used `OP_DROP`, extracting the wrong bytes for RIGHT-strategy fields
82
+ (`value`, `nSequence`, `hashOutputs`, `nLocktime`, `sighashType`). Proven at the interpreter
83
+ level and fixed; added `nip()`.
84
+ - **`SmartContract.Covenant` built a non-enforcing "covenant"** (reduces to P2PK; bound nothing
85
+ about the spend) while claiming "production-ready … BIP-143 validation." `createFromP2PKH`
86
+ now throws unless constructed with `{allowNonEnforcing:true}`, and the docs redirect to the
87
+ real OP_PUSH_TX primitives.
88
+ - **Shamir RNG could hang forever** on a degenerate/stubbed CSPRNG (all-zero draws); the re-draw
89
+ loop is now bounded and throws instead.
90
+
91
+ ### Added
92
+
93
+ - **Ordinal-safe transfers.** `SmartContract.Token.transferOrdinal` / `SmartContract.ordinalLock`
94
+ recreate a 1-sat ordinal among funding outputs (fee paid from funding, satoshi preserved), with
95
+ an anti-burn guard; the single-output `unlockTransfer` now refuses a 1-sat UTXO.
96
+ - **Configurable SIGHASH covenant core.** `PushTx.pushTxCore(script, {sighashType})`,
97
+ `assertSighashType`, and `grind({sighashType})` enable `SIGHASH_SINGLE|ANYONECANPAY` marketplace
98
+ covenants (seller signs its own input+output; buyer adds funding). Default remains SIGHASH_ALL.
99
+ - **CI bundle-parity gate** (`.github/workflows/ci.yml`): fails if the shipped `*.min.js`/
100
+ `*.bundle.js` are not a reproducible build of `lib/`. Added `.nvmrc` (Node 18) for reproducibility.
101
+ - **1Sat Ordinals module** (`bsv.Ordinals`). `buildInscription`/`parseInscription`/`isInscription`
102
+ build and round-trip the `OP_FALSE OP_IF "ord" … OP_ENDIF` inscription envelope on a P2PKH (or
103
+ custom) base lock; `createInscriptionOutput`/`batchInscriptionOutputs` mint the 1-sat output(s).
104
+ - **OrdLock marketplace covenant** (`bsv.Ordinals.buildOrdLock`/`listInscriptionOutput`/
105
+ `purchaseOrdLock`/`cancelOrdLock`). A trustless "pay the seller or cancel" listing built on the
106
+ configurable-SIGHASH OP_PUSH_TX core (`SIGHASH_ALL|ANYONECANPAY|FORKID`, new
107
+ `PushTx.SIGHASH_ALL_ANYONECANPAY_FORKID`): the buyer supplies the surrounding outputs and the
108
+ covenant binds the required payment output(s) byte-for-byte into the committed `hashOutputs`,
109
+ while the seller keeps an ECDSA cancel path.
110
+ - **Multi-output payments**: a listing can pin a seller payment plus royalty and marketplace-fee
111
+ outputs (`payOutputs` / `royalties`), so a purchase atomically pays every party or fails.
112
+ - **Self-describing listings**: `parseOrdLock(script)` / `isOrdLock(script)` recover the seller,
113
+ the pinned payment(s), the total price, and any inline inscription — an indexer/wallet/UI can
114
+ read a listing straight off-chain.
115
+ - **End-to-end assembly** covers the whole lifecycle: `buildListingTx({ordinal, seller, price,
116
+ royalties, funding, fee})` moves a P2PKH ordinal into a listing (sat preserved into output 0),
117
+ and `buildPurchaseTx({listing, ordinalDestination, funding, fee})` reads the required payment(s)
118
+ off the listing script and returns a complete, signed purchase — the covenant input grinds the
119
+ OP_PUSH_TX signature and the P2PKH funding inputs are signed over the finalized tx.
120
+ Every emitted script (covenant + funding + ordinal inputs) is interpreter-verified across the
121
+ full list → buy / cancel lifecycle, including adversarial spends (underpay seller/royalty,
122
+ redirect fee, wrong-key cancel, tamper-after-build) asserted to be rejected. Typed in `bsv.d.ts`
123
+ (`namespace Ordinals`); documented in `lib/ordinals/README.md`.
124
+ - **BSV-20 / BSV-21 fungible-token inscriptions** (`bsv.Ordinals.BSV20`). Build and parse the
125
+ `application/bsv-20` JSON payloads carried on 1-sat outputs: v1 ticker tokens
126
+ (`buildDeploy`/`buildMint`/`buildTransfer`), v2 / BSV-21 id-based supplies
127
+ (`buildDeployMint`, transfer by `id`), `create*Output` 1-sat outputs, and
128
+ `parseBsv20`/`isBsv20` (accepting a script, JSON string, or object). Amounts are integer
129
+ strings — never coerced to JS numbers, so supplies beyond 2^53 stay exact. Builders validate
130
+ their inputs (ticker ≤ 4 UTF-8 bytes, non-negative integer `amt`/`max`/`lim`, `dec` 0–18,
131
+ well-formed BSV-21 `id`). Typed in `bsv.d.ts` (`namespace Ordinals.BSV20`).
132
+ - **Trustless SPV** (`bsv.SPV`). `verifyMerkleProof` / `merkleRootFromBranch` / `verifyTxInclusion`
133
+ verify a transaction's inclusion in a proof-of-work-backed block from a Merkle branch
134
+ (double-SHA256, internal-LE byte order, TSC `*` odd-node duplication), and `verifyHeaderChain`
135
+ checks header linkage + per-header proof-of-work against an optional trusted checkpoint. Wired
136
+ into GDAF's `SmartLedgerAnchor.verifyAnchor`: a new trustless path
137
+ (`{ spvProof:{index,nodes}, header|headerChain, rawTx }`) proves inclusion + PoW, binds the raw
138
+ tx to the txid, and checks an OP_RETURN commits to the expected hash — replacing the
139
+ trust-the-provider stub. Typed in `bsv.d.ts`.
140
+
141
+ ### Changed — BREAKING
142
+
143
+ - `statuslist.getCredentialStatusEntry` is now **async** and both status functions **require**
144
+ `expectedIssuerDid` plus a key source (`didResolver` / `issuerJwks` / `issuerPublicJwk`). The CLI
145
+ `status set`/`check` resolve the issuer key from the key file automatically.
146
+ - `SmartContract.Covenant.createFromP2PKH` **throws** unless the instance is constructed with
147
+ `{allowNonEnforcing:true}`.
148
+ - Shamir `split()` no longer embeds a secret checksum by default (pass `{checksum:true}` to restore).
149
+
8
150
  ## [5.5.2] - 2026-06-28
9
151
 
10
152
  Docs-only patch. No API or behavior changes — the only difference in any
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.3/bsv.min.js` |
190
- | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.5.3/bsv.bundle.js` |
189
+ | **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js` |
190
+ | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv-didweb.min.js` |
196
- | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.5.3/bsv-vcjwt.min.js` |
197
- | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.5.3/bsv-statuslist.min.js` |
198
- | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.5.3/bsv-anchor.min.js` |
195
+ | **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@6.0.1/bsv-didweb.min.js` |
196
+ | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@6.0.1/bsv-vcjwt.min.js` |
197
+ | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@6.0.1/bsv-statuslist.min.js` |
198
+ | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv-smartcontract.min.js` |
204
- | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.5.3/bsv-covenant.min.js` |
205
- | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.5.3/bsv-script-helper.min.js` |
206
- | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.5.3/bsv-security.min.js` |
203
+ | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@6.0.1/bsv-smartcontract.min.js` |
204
+ | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@6.0.1/bsv-covenant.min.js` |
205
+ | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@6.0.1/bsv-script-helper.min.js` |
206
+ | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv-ltp.min.js` |
212
- | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.5.3/bsv-gdaf.min.js` |
211
+ | **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@6.0.1/bsv-ltp.min.js` |
212
+ | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv-shamir.min.js` |
217
+ | **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv-ecies.min.js` |
223
- | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@5.5.3/bsv-message.min.js` |
224
- | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@5.5.3/bsv-mnemonic.min.js` |
222
+ | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@6.0.1/bsv-ecies.min.js` |
223
+ | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@6.0.1/bsv-message.min.js` |
224
+ | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
235
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
336
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-script-helper.min.js"></script>
335
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js"></script>
336
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
346
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-covenant.min.js"></script>
347
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-smartcontract.min.js"></script>
345
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js"></script>
346
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv-covenant.min.js"></script>
347
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
358
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-ltp.min.js"></script>
359
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-gdaf.min.js"></script>
357
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js"></script>
358
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv-ltp.min.js"></script>
359
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
374
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-security.min.js"></script>
375
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-shamir.min.js"></script>
373
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js"></script>
374
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv-security.min.js"></script>
375
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.bundle.js"></script>
387
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
498
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-script-helper.min.js"></script>
497
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js"></script>
498
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
508
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-covenant.min.js"></script>
509
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-smartcontract.min.js"></script>
507
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js"></script>
508
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv-covenant.min.js"></script>
509
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.min.js"></script>
520
- <script src="https://unpkg.com/@smartledger/bsv@5.5.3/bsv-security.min.js"></script>
519
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/bsv.min.js"></script>
520
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/bsv.bundle.js"></script>
529
+ <script src="https://unpkg.com/@smartledger/bsv@6.0.1/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.3/...` URLs.
837
+ canonical `unpkg.com/@smartledger/bsv@6.0.1/...` 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)