@smartledger/bsv 4.6.0 → 5.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.
- package/CHANGELOG.md +75 -0
- package/README.md +38 -38
- package/bsv-covenant.min.js +8 -5
- package/bsv-ecies.min.js +1 -1
- package/bsv-gdaf.min.js +9 -6
- package/bsv-ltp.min.js +9 -6
- package/bsv-shamir.min.js +5 -2
- package/bsv-smartcontract.min.js +9 -6
- package/bsv-statuslist.min.js +1 -1
- package/bsv-vcjwt.min.js +3 -3
- package/bsv.bundle.js +13 -10
- package/bsv.min.js +13 -10
- package/build/webpack.bundle.config.js +3 -2
- package/build/webpack.config.js +3 -1
- package/build/webpack.security.config.js +2 -1
- package/docs/MODULE_REFERENCE_COMPLETE.md +27 -27
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +23 -23
- package/docs/getting-started/QUICK_START.md +7 -7
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/index.js +1 -1
- package/lib/crypto/elliptic-fixed.js +30 -37
- package/lib/crypto/shamir.js +239 -238
- package/lib/ecies/bitcore-ecies.js +16 -5
- package/lib/vcjwt/index.js +83 -22
- package/package.json +3 -9
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,81 @@ 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
|
+
## [5.0.0] - 2026-06-13
|
|
9
|
+
|
|
10
|
+
### BREAKING — Shamir Secret Sharing now uses a vetted GF(2⁸) engine
|
|
11
|
+
|
|
12
|
+
`crypto.Shamir` previously used a hand-rolled finite-field implementation over a
|
|
13
|
+
31-bit prime, with no authentication of shares. It is now backed by
|
|
14
|
+
`secrets.js-grempe` (a vetted GF(2⁸) implementation), with two safety additions:
|
|
15
|
+
a per-split nonce (`splitId`) so shares from different splits can't be silently
|
|
16
|
+
mixed, and an integrity `checksum` so a tampered/mismatched share set is rejected
|
|
17
|
+
at combine time instead of returning garbage.
|
|
18
|
+
|
|
19
|
+
- **New share format (v2).** `split()` returns objects shaped
|
|
20
|
+
`{ v, id, threshold, shares, length, splitId, share, checksum }` instead of the
|
|
21
|
+
old `{ id, threshold, shares, length, bytes:[{x,y}] }`.
|
|
22
|
+
- **Old shares remain recoverable.** `combine()` and `verifyShare()` detect and
|
|
23
|
+
accept legacy (≤ 4.x) shares for recovery; you do not need the old version to
|
|
24
|
+
reconstruct previously-split secrets.
|
|
25
|
+
- Randomness is sourced from the library's own `crypto.Random` (Node CSPRNG /
|
|
26
|
+
`window.crypto`) via `secrets.setRNG`, and `secrets` is loaded lazily so simply
|
|
27
|
+
importing the library never triggers its init.
|
|
28
|
+
- New coverage in `test/crypto/shamir.js` (round-trips, threshold subsets,
|
|
29
|
+
leading-zero/Buffer secrets, tamper detection, split isolation, legacy
|
|
30
|
+
recovery).
|
|
31
|
+
|
|
32
|
+
Browser bundles that bundle the full library no longer mock node `crypto` as
|
|
33
|
+
empty (`bsv.min.js`, `bsv.bundle.js`, `bsv-security.min.js`); webpack's default
|
|
34
|
+
`crypto` polyfill is used so Shamir can obtain a CSPRNG. This increases the size
|
|
35
|
+
of the full bundles (e.g. `bsv.min.js` ~951 KB → ~1.2 MB); the dedicated
|
|
36
|
+
non-Shamir module bundles are unaffected.
|
|
37
|
+
|
|
38
|
+
### BREAKING — VC-JWT signatures are now JOSE-compliant (IEEE P1363)
|
|
39
|
+
|
|
40
|
+
Up to and including 4.6.0, `VcJwt.issueVcJwt` signed with Node's default
|
|
41
|
+
ECDSA output, which is **DER-encoded**. The JOSE specs (RFC 7515/7518, and
|
|
42
|
+
RFC 8812 for ES256K) require ECDSA JWS signatures to be the raw `r||s`
|
|
43
|
+
concatenation (**IEEE P1363**). As a result, tokens issued by older versions
|
|
44
|
+
**did not verify in any standards-compliant library** (`jose`, `jsonwebtoken`,
|
|
45
|
+
etc.), and this library could not verify standard tokens from other issuers.
|
|
46
|
+
This also affected `StatusList`, which issues its lists via `VcJwt`.
|
|
47
|
+
|
|
48
|
+
- **`VcJwt.issueVcJwt`** now emits P1363 signatures and is verifiable by `jose`.
|
|
49
|
+
- **`VcJwt.verifyVcJwt`** now decodes P1363 signatures.
|
|
50
|
+
- **Migration:** tokens issued by ≤ 4.6.0 carry DER signatures and will fail
|
|
51
|
+
verification by default. Pass `{ allowLegacyDER: true }` to `verifyVcJwt` to
|
|
52
|
+
accept them while you re-issue. New tokens require no flag.
|
|
53
|
+
- Round-trip interoperability with `jose` (both directions, ES256 + ES256K) is
|
|
54
|
+
now covered by `test/vcjwt/interop.js`.
|
|
55
|
+
|
|
56
|
+
### Security
|
|
57
|
+
|
|
58
|
+
- **VC-JWT algorithm pinning.** `verifyVcJwt` now rejects any token whose
|
|
59
|
+
`alg` is not in the allowed set (default `['ES256','ES256K']`, overridable via
|
|
60
|
+
`opts.allowedAlgs`) **before** verifying — closing the classic JWT algorithm
|
|
61
|
+
substitution hole. It also binds the resolved key's curve to the algorithm
|
|
62
|
+
(an ES256K signature can no longer be checked against a P-256 key), and
|
|
63
|
+
`issueVcJwt` refuses to sign when the key curve and `alg` disagree.
|
|
64
|
+
- **`crypto/elliptic-fixed` low-S now preserves `recoveryParam`.** The previous
|
|
65
|
+
manual `s → n-s` flip did not update the recovery id, so public-key recovery
|
|
66
|
+
returned the wrong key for ~50% of signatures. Canonicalization now uses
|
|
67
|
+
elliptic's own `{ canonical: true }`, which keeps `recoveryParam` consistent.
|
|
68
|
+
- **ECIES MAC check is now constant-time** (portable comparison; no early-out
|
|
69
|
+
on the first differing byte).
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
|
|
73
|
+
- **Removed the self-referential dependency.** `package.json` listed
|
|
74
|
+
`@smartledger/bsv` as one of its own `dependencies`, causing npm to install a
|
|
75
|
+
nested older copy of the package and triggering the "More than one instance of
|
|
76
|
+
bsv" guard. Removed.
|
|
77
|
+
|
|
78
|
+
### Changed
|
|
79
|
+
|
|
80
|
+
- Deduplicated `package.json` keywords (86 → 79).
|
|
81
|
+
- `bsv.SmartUTXO` removal pushed from v5.0.0 to v6.0.0 (still soft-deprecated).
|
|
82
|
+
|
|
8
83
|
## [4.6.0] - 2026-06-09
|
|
9
84
|
|
|
10
85
|
### Fixed — covenants are now mainnet-relayable (MINIMALDATA)
|
package/README.md
CHANGED
|
@@ -181,42 +181,42 @@ console.log('Status:', status) // 'revoked'
|
|
|
181
181
|
### **Core Modules**
|
|
182
182
|
| Module | Size | Use Case | CDN |
|
|
183
183
|
|--------|------|----------|-----|
|
|
184
|
-
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@
|
|
185
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@
|
|
184
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js` |
|
|
185
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@5.0.0/bsv.bundle.js` |
|
|
186
186
|
|
|
187
187
|
### **W3C Verifiable Credentials**
|
|
188
188
|
| Module | Size | Use Case | CDN |
|
|
189
189
|
|--------|------|----------|-----|
|
|
190
|
-
| **🟢 bsv-didweb.min.js** | 419KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@
|
|
191
|
-
| **🟢 bsv-vcjwt.min.js** | 419KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@
|
|
192
|
-
| **🟢 bsv-statuslist.min.js** | 487KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@
|
|
193
|
-
| **🟢 bsv-anchor.min.js** | 418KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@
|
|
190
|
+
| **🟢 bsv-didweb.min.js** | 419KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@5.0.0/bsv-didweb.min.js` |
|
|
191
|
+
| **🟢 bsv-vcjwt.min.js** | 419KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@5.0.0/bsv-vcjwt.min.js` |
|
|
192
|
+
| **🟢 bsv-statuslist.min.js** | 487KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@5.0.0/bsv-statuslist.min.js` |
|
|
193
|
+
| **🟢 bsv-anchor.min.js** | 418KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@5.0.0/bsv-anchor.min.js` |
|
|
194
194
|
|
|
195
195
|
### **Smart Contract & Development**
|
|
196
196
|
| Module | Size | Use Case | CDN |
|
|
197
197
|
|--------|------|----------|-----|
|
|
198
|
-
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@
|
|
199
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@
|
|
200
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@
|
|
201
|
-
| **bsv-security.min.js** | 26KB | Security enhancements | `unpkg.com/@smartledger/bsv@
|
|
198
|
+
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@5.0.0/bsv-smartcontract.min.js` |
|
|
199
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@5.0.0/bsv-covenant.min.js` |
|
|
200
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@5.0.0/bsv-script-helper.min.js` |
|
|
201
|
+
| **bsv-security.min.js** | 26KB | Security enhancements | `unpkg.com/@smartledger/bsv@5.0.0/bsv-security.min.js` |
|
|
202
202
|
|
|
203
203
|
### **Legal & Compliance**
|
|
204
204
|
| Module | Size | Use Case | CDN |
|
|
205
205
|
|--------|------|----------|-----|
|
|
206
|
-
| **bsv-ltp.min.js** | 1184KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@
|
|
207
|
-
| **bsv-gdaf.min.js** | 1184KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@
|
|
206
|
+
| **bsv-ltp.min.js** | 1184KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@5.0.0/bsv-ltp.min.js` |
|
|
207
|
+
| **bsv-gdaf.min.js** | 1184KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@5.0.0/bsv-gdaf.min.js` |
|
|
208
208
|
|
|
209
209
|
### **Advanced Cryptography**
|
|
210
210
|
| Module | Size | Use Case | CDN |
|
|
211
211
|
|--------|------|----------|-----|
|
|
212
|
-
| **bsv-shamir.min.js** | 432KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@
|
|
212
|
+
| **bsv-shamir.min.js** | 432KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@5.0.0/bsv-shamir.min.js` |
|
|
213
213
|
|
|
214
214
|
### **Utilities**
|
|
215
215
|
| Module | Size | Use Case | CDN |
|
|
216
216
|
|--------|------|----------|-----|
|
|
217
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@
|
|
218
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@
|
|
219
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@
|
|
217
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@5.0.0/bsv-ecies.min.js` |
|
|
218
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@5.0.0/bsv-message.min.js` |
|
|
219
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@5.0.0/bsv-mnemonic.min.js` |
|
|
220
220
|
|
|
221
221
|
## ⚡ **2-Minute Quick Start**
|
|
222
222
|
|
|
@@ -227,7 +227,7 @@ Get started with Bitcoin SV development in under 2 minutes:
|
|
|
227
227
|
npm install @smartledger/bsv
|
|
228
228
|
|
|
229
229
|
# Or include in HTML
|
|
230
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
230
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
231
231
|
```
|
|
232
232
|
|
|
233
233
|
> **🔧 v4.x:** First-class interpreter-verified covenants (4.2.0), post-Genesis
|
|
@@ -325,8 +325,8 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
325
325
|
|
|
326
326
|
### 🔧 **Basic Development** (~963KB total)
|
|
327
327
|
```html
|
|
328
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
329
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
328
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
329
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-script-helper.min.js"></script>
|
|
330
330
|
<script>
|
|
331
331
|
const privateKey = new bsv.PrivateKey();
|
|
332
332
|
const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
|
|
@@ -335,9 +335,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
335
335
|
|
|
336
336
|
### 🔒 **Smart Contract Development** (~2.7MB total — each bundle re-embeds core BSV)
|
|
337
337
|
```html
|
|
338
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
339
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
340
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
338
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
339
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-covenant.min.js"></script>
|
|
340
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-smartcontract.min.js"></script>
|
|
341
341
|
<script>
|
|
342
342
|
const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
343
343
|
.extractField('amount').push(50000).greaterThanOrEqual().verify().build();
|
|
@@ -347,9 +347,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
347
347
|
|
|
348
348
|
### 🆕 **Legal & Identity Development** (~3.2MB total — each bundle re-embeds core BSV)
|
|
349
349
|
```html
|
|
350
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
351
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
352
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
350
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
351
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-ltp.min.js"></script>
|
|
352
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-gdaf.min.js"></script>
|
|
353
353
|
<script>
|
|
354
354
|
// Legal Token Protocol
|
|
355
355
|
const propertyToken = bsv.createPropertyToken({
|
|
@@ -363,9 +363,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
363
363
|
|
|
364
364
|
### 🆕 **Security & Cryptography** (~1.4MB total)
|
|
365
365
|
```html
|
|
366
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
367
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
368
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
366
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
367
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-security.min.js"></script>
|
|
368
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-shamir.min.js"></script>
|
|
369
369
|
<script>
|
|
370
370
|
// Threshold Cryptography
|
|
371
371
|
const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
|
|
@@ -377,7 +377,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
377
377
|
|
|
378
378
|
### 🎯 **Everything Bundle** (937KB)
|
|
379
379
|
```html
|
|
380
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
380
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.bundle.js"></script>
|
|
381
381
|
<script>
|
|
382
382
|
// Everything available immediately
|
|
383
383
|
const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
|
|
@@ -457,8 +457,8 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
457
457
|
|
|
458
458
|
#### 1. **Minimal Setup** - Core + Script Helper (~963KB)
|
|
459
459
|
```html
|
|
460
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
461
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
460
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
461
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-script-helper.min.js"></script>
|
|
462
462
|
<script>
|
|
463
463
|
const tx = new bsv.Transaction();
|
|
464
464
|
const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
|
|
@@ -467,9 +467,9 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
467
467
|
|
|
468
468
|
#### 2. **DeFi Development** - Core + Covenants + Debug (~2.7MB — each bundle re-embeds core BSV)
|
|
469
469
|
```html
|
|
470
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
471
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
472
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
470
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
471
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-covenant.min.js"></script>
|
|
472
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-smartcontract.min.js"></script>
|
|
473
473
|
<script>
|
|
474
474
|
const covenant = new bsvCovenant.CovenantInterface();
|
|
475
475
|
const debugInfo = SmartContract.interpretScript(script);
|
|
@@ -479,8 +479,8 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
479
479
|
|
|
480
480
|
#### 3. **Security First** - Core + Enhanced Security (~963KB)
|
|
481
481
|
```html
|
|
482
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
483
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
482
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.min.js"></script>
|
|
483
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv-security.min.js"></script>
|
|
484
484
|
<script>
|
|
485
485
|
const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
|
|
486
486
|
const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
|
|
@@ -489,7 +489,7 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
489
489
|
|
|
490
490
|
#### 4. **Everything Bundle** - One File Solution (937KB)
|
|
491
491
|
```html
|
|
492
|
-
<script src="https://unpkg.com/@smartledger/bsv@
|
|
492
|
+
<script src="https://unpkg.com/@smartledger/bsv@5.0.0/bsv.bundle.js"></script>
|
|
493
493
|
<script>
|
|
494
494
|
// Everything available under bsv namespace
|
|
495
495
|
const keys = bsv.SmartLedgerBundle.generateKeys();
|
|
@@ -789,7 +789,7 @@ const timelockScript = helper.createTimelockScript(
|
|
|
789
789
|
|
|
790
790
|
See the **[16 Loading Options](#-16-loading-options---choose-your-approach)**
|
|
791
791
|
table near the top for the full list of bundles with current sizes and
|
|
792
|
-
canonical `unpkg.com/@smartledger/bsv@
|
|
792
|
+
canonical `unpkg.com/@smartledger/bsv@5.0.0/...` URLs.
|
|
793
793
|
|
|
794
794
|
## 🔐 Security
|
|
795
795
|
|