@smartledger/bsv 7.5.1 → 7.5.3

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,116 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [7.5.3] - 2026-08-07
11
+
12
+ ### Fixed (security)
13
+
14
+ - **The anchor key-material guard added in 7.5.1 detected by field name only, which
15
+ was wrong in both directions.** It refused `{ d: '2026-01-01' }` — telling the
16
+ caller their date looked like a private key — while publishing a real WIF stored
17
+ under `note`, an `xprv` under `ref`, or a BIP39 mnemonic under `memo`, because
18
+ those field names were not on the list. Naming a secret innocuously is exactly
19
+ what an accidental leak looks like, so name-matching alone could not close the
20
+ hole it was written for.
21
+
22
+ Detection is now by value as well as name, on three independent signals:
23
+
24
+ 1. **The anchor's own signing key**, in any representation (WIF, hex scalar, the
25
+ `bn`), is refused wherever it appears. This is the defect the guard exists for,
26
+ and knowing our own key makes a bare hex scalar catchable at all.
27
+ 2. **Self-identifying secrets** — a WIF that decodes, an `xprv`/`tprv` that parses,
28
+ a BIP39 phrase that passes wordlist *and* checksum — are refused under **any**
29
+ field name, at any depth, including inside arrays.
30
+ 3. **Field names**: always for `bn`/`wif`/`privateKey`/`xprv`/`mnemonic`/…, and for
31
+ ambiguous names (`d`, `seed`, `secret`, `key`) only when the value also decodes
32
+ as a private key.
33
+
34
+ A bare 64-character hex string that is *not* our own key is deliberately still
35
+ accepted: it cannot be distinguished from a SHA-256 digest, and anchoring a
36
+ document hash is what this module is for. Public material — addresses, public
37
+ keys, `xpub` — is accepted, since an anchor legitimately references it.
38
+
39
+ 15 regression tests pin both directions, including the four leaks the previous
40
+ guard allowed and the two false positives it produced.
41
+
42
+ Suite 4579 → 4594.
43
+
44
+ ## [7.5.2] - 2026-08-06
45
+
46
+ The rest of the field review that produced 7.5.1: declarations that disagreed with
47
+ the code. Most are declaration-only, but four cases needed the **runtime** to change,
48
+ because a declaration matching the old behaviour would have been documenting a bug.
49
+
50
+ ### Fixed (security)
51
+
52
+ - **`StatusList.getCredentialStatusEntry` was declared synchronous but is `async`.** So
53
+ `if (getCredentialStatusEntry(...) === 'revoked')` type-checked cleanly and compared a
54
+ `Promise` to a string — always false. **Every revoked credential passed as valid**, and
55
+ the type checker was what hid it. It now declares `Promise<CredentialStatus>`, which
56
+ turns that comparison into a compile error (`'Promise<string>' and '"revoked"' have no
57
+ overlap`).
58
+
59
+ - **`updateStatusList` no longer records a suspension as a revocation.** `'suspended'`
60
+ set the *same bit* as `'revoked'` and read back as `'revoked'`, so a temporary
61
+ suspension was silently written — and later reported — as a permanent revocation. This
62
+ implementation hardcodes `statusPurpose: 'revocation'` and uses one bit, so there is
63
+ nowhere for suspension to go; it now throws, naming the limitation, instead of writing
64
+ the wrong state.
65
+
66
+ - **`SmartContract.ownershipToken` dropped its authorizer.** The top-level alias was
67
+ `function (fee, ownerPubKeyHash)` and called through with only those two arguments, so
68
+ a **co-signed token built via this path came out single-key** — the authorizer was
69
+ accepted and discarded. Same silent-argument family as 7.0.1, 7.0.2, 7.2.0, 7.3.0 and
70
+ 7.4.0.
71
+
72
+ ### Fixed
73
+
74
+ - **`Authorizers.multisig(m, nKeys)` rejects an array.** `nKeys` is a count, but passing
75
+ keys made `m > nKeys` compare a number to an array — which coerces to `NaN`, so the
76
+ guard passed and an authorizer was built with the array spliced into its name. It now
77
+ throws and names the fix. (`Locks.multisig` genuinely does take keys, which is what
78
+ made this easy to walk into.)
79
+
80
+ - **Sub-path imports resolve.** `@smartledger/bsv/didweb` and ten siblings were
81
+ `MODULE_NOT_FOUND`: the `exports` map had no aliases for the `*-entry.js` files, so
82
+ documented deep imports could not be loaded at all. Eleven aliases added.
83
+
84
+ - **`securityFeatures` no longer claims `'elliptic-patches'`**, which it advertised long
85
+ after `elliptic` stopped being a dependency. It is the string a compliance reviewer
86
+ reads, so it now lists what is actually shipped.
87
+
88
+ ### Changed
89
+
90
+ Declarations corrected to match the runtime: `Authorizers.multisig(m, nKeys: number)`;
91
+ `AnchorKind` and `CredentialStatus` closed (both were `| string` while the runtime
92
+ enforces a fixed set); `Script.buildSafeDataOut` declared (it was missing while
93
+ `isSafeDataOut` was present, steering TypeScript users to `buildDataOut`, whose bare
94
+ `OP_RETURN` is not provably unspendable); `Message` typed as callable without `new`, the
95
+ form the examples use; `canonicalizeClaim` returns `string`, not `object`;
96
+ `Networks.get`'s `keys` optional; both `ownershipToken` overloads take the authorizer;
97
+ `StatusListReadParams` added so the mandatory `expectedIssuerDid` and key source are
98
+ visible rather than surfacing as a runtime throw.
99
+
100
+ ### Added
101
+
102
+ - **The type-drift gate now catches async-declared-as-sync.** `test/types/dts_drift.js`
103
+ compares each declared return type against the runtime function's
104
+ `constructor.name === 'AsyncFunction'`, so a declaration can no longer hide a Promise.
105
+ Verified adversarially: reverting the `getCredentialStatusEntry` declaration makes the
106
+ gate fail. This is the class that produced the revocation bypass above, so it is now
107
+ mechanically impossible to reintroduce.
108
+
109
+ - `test/types/surface_honesty.js` covers the runtime-side fixes, including all eleven
110
+ sub-path entry points.
111
+
112
+ ### Breaking
113
+
114
+ `updateStatusList` throws on `status: 'suspended'` instead of writing the revocation bit.
115
+ `Authorizers.multisig` throws when handed an array. `AnchorKind` and `CredentialStatus`
116
+ no longer accept arbitrary strings in TypeScript.
117
+
118
+ Suite 4559 → 4579.
119
+
10
120
  ## [7.5.1] - 2026-08-06
11
121
 
12
122
  Three defects reported from the field against 7.4.0, each reproduced here before
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@7.5.1/bsv.min.js` |
190
- | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.1/bsv.bundle.js` |
189
+ | **bsv.min.js** | 1149KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js` |
190
+ | **bsv.bundle.js** | 1149KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv-didweb.min.js` |
196
- | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.5.1/bsv-vcjwt.min.js` |
197
- | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.5.1/bsv-statuslist.min.js` |
198
- | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.5.1/bsv-anchor.min.js` |
195
+ | **🟢 bsv-didweb.min.js** | 315KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@7.5.3/bsv-didweb.min.js` |
196
+ | **🟢 bsv-vcjwt.min.js** | 315KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@7.5.3/bsv-vcjwt.min.js` |
197
+ | **🟢 bsv-statuslist.min.js** | 415KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@7.5.3/bsv-statuslist.min.js` |
198
+ | **🟢 bsv-anchor.min.js** | 314KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv-smartcontract.min.js` |
204
- | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.1/bsv-covenant.min.js` |
205
- | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.1/bsv-script-helper.min.js` |
206
- | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.5.1/bsv-security.min.js` |
203
+ | **bsv-smartcontract.min.js** | 873KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.3/bsv-smartcontract.min.js` |
204
+ | **bsv-covenant.min.js** | 873KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.3/bsv-covenant.min.js` |
205
+ | **bsv-script-helper.min.js** | 30KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.3/bsv-script-helper.min.js` |
206
+ | **bsv-security.min.js** | 30KB | Security enhancements | `unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv-ltp.min.js` |
212
- | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.5.1/bsv-gdaf.min.js` |
211
+ | **bsv-ltp.min.js** | 1149KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@7.5.3/bsv-ltp.min.js` |
212
+ | **bsv-gdaf.min.js** | 1149KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv-shamir.min.js` |
217
+ | **bsv-shamir.min.js** | 353KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv-ecies.min.js` |
223
- | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.1/bsv-message.min.js` |
224
- | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.1/bsv-mnemonic.min.js` |
222
+ | **bsv-ecies.min.js** | 79KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.3/bsv-ecies.min.js` |
223
+ | **bsv-message.min.js** | 30KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.3/bsv-message.min.js` |
224
+ | **bsv-mnemonic.min.js** | 592KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
235
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
336
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-script-helper.min.js"></script>
335
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js"></script>
336
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
346
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-covenant.min.js"></script>
347
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-smartcontract.min.js"></script>
345
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js"></script>
346
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv-covenant.min.js"></script>
347
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
358
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-ltp.min.js"></script>
359
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-gdaf.min.js"></script>
357
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js"></script>
358
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv-ltp.min.js"></script>
359
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
374
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-security.min.js"></script>
375
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-shamir.min.js"></script>
373
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js"></script>
374
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv-security.min.js"></script>
375
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.bundle.js"></script>
387
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
498
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-script-helper.min.js"></script>
497
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js"></script>
498
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
508
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-covenant.min.js"></script>
509
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-smartcontract.min.js"></script>
507
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js"></script>
508
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv-covenant.min.js"></script>
509
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.min.js"></script>
520
- <script src="https://unpkg.com/@smartledger/bsv@7.5.1/bsv-security.min.js"></script>
519
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/bsv.min.js"></script>
520
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/bsv.bundle.js"></script>
529
+ <script src="https://unpkg.com/@smartledger/bsv@7.5.3/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@7.5.1/...` URLs.
837
+ canonical `unpkg.com/@smartledger/bsv@7.5.3/...` URLs.
838
838
 
839
839
  ## 🔐 Security
840
840