@smartledger/bsv 7.5.1 → 7.5.2
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 +76 -0
- package/README.md +38 -38
- package/bsv-gdaf.min.js +4 -4
- package/bsv-ltp.min.js +5 -5
- package/bsv-smartcontract.min.js +2 -2
- package/bsv-statuslist.min.js +1 -1
- package/bsv.bundle.js +5 -5
- package/bsv.d.ts +56 -11
- package/bsv.min.js +5 -5
- 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 +4 -1
- package/lib/smart_contract/authorizers.js +8 -0
- package/lib/smart_contract/index.js +4 -2
- package/lib/statuslist/index.js +11 -3
- package/package.json +12 -1
- package/test/types/dts_drift.js +23 -1
- package/test/types/surface_honesty.js +102 -0
- package/version.js +1 -1
|
@@ -55,19 +55,19 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
55
55
|
- **Purpose**: Threshold cryptography for secure secret distribution
|
|
56
56
|
- **Use Cases**: Backup keys, multi-party security, key recovery
|
|
57
57
|
- **Features**: Split secrets into N shares, require M to reconstruct
|
|
58
|
-
- **CDN**: `unpkg.com/@smartledger/bsv@7.5.
|
|
58
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.5.2/bsv-shamir.min.js`
|
|
59
59
|
|
|
60
60
|
#### **🌐 Global Digital Attestation Framework - GDAF (1184KB)**
|
|
61
61
|
- **Purpose**: W3C Verifiable Credentials and decentralized identity
|
|
62
62
|
- **Use Cases**: Identity verification, attestations, zero-knowledge proofs
|
|
63
63
|
- **Features**: DID creation, credential issuance, selective disclosure
|
|
64
|
-
- **CDN**: `unpkg.com/@smartledger/bsv@7.5.
|
|
64
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.5.2/bsv-gdaf.min.js`
|
|
65
65
|
|
|
66
66
|
#### **⚖️ Legal Token Protocol - LTP (1184KB)**
|
|
67
67
|
- **Purpose**: Legal compliance framework for tokenized assets
|
|
68
68
|
- **Use Cases**: Property rights, obligations, compliant tokenization
|
|
69
69
|
- **Features**: Legal primitives, compliance checking, attestation anchoring
|
|
70
|
-
- **CDN**: `unpkg.com/@smartledger/bsv@7.5.
|
|
70
|
+
- **CDN**: `unpkg.com/@smartledger/bsv@7.5.2/bsv-ltp.min.js`
|
|
71
71
|
|
|
72
72
|
### **2. Incorrect File Sizes in Documentation**
|
|
73
73
|
|
|
@@ -81,18 +81,18 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
81
81
|
|
|
82
82
|
| Module | Size | Use Case | CDN Link |
|
|
83
83
|
|--------|------|----------|----------|
|
|
84
|
-
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.
|
|
85
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.
|
|
86
|
-
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.5.
|
|
87
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.
|
|
88
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.
|
|
89
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.
|
|
90
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.
|
|
91
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.
|
|
92
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.
|
|
93
|
-
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.5.
|
|
94
|
-
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.5.
|
|
95
|
-
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.5.
|
|
84
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js` |
|
|
85
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.2/bsv.bundle.js` |
|
|
86
|
+
| **bsv-smartcontract.min.js** | 937KB | Covenant development | `unpkg.com/@smartledger/bsv@7.5.2/bsv-smartcontract.min.js` |
|
|
87
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.2/bsv-covenant.min.js` |
|
|
88
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.2/bsv-script-helper.min.js` |
|
|
89
|
+
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.2/bsv-security.min.js` |
|
|
90
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.2/bsv-ecies.min.js` |
|
|
91
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.2/bsv-message.min.js` |
|
|
92
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.2/bsv-mnemonic.min.js` |
|
|
93
|
+
| **🆕 bsv-shamir.min.js** | 432KB | **Secret sharing** | `unpkg.com/@smartledger/bsv@7.5.2/bsv-shamir.min.js` |
|
|
94
|
+
| **🆕 bsv-gdaf.min.js** | 1184KB | **Digital attestation** | `unpkg.com/@smartledger/bsv@7.5.2/bsv-gdaf.min.js` |
|
|
95
|
+
| **🆕 bsv-ltp.min.js** | 1184KB | **Legal tokens** | `unpkg.com/@smartledger/bsv@7.5.2/bsv-ltp.min.js` |
|
|
96
96
|
|
|
97
97
|
## 🎯 **Updated Usage Examples**
|
|
98
98
|
|
|
@@ -100,22 +100,22 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
100
100
|
|
|
101
101
|
#### **1. Basic Development (~963KB)**
|
|
102
102
|
```html
|
|
103
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
104
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
104
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-script-helper.min.js"></script>
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
#### **2. Smart Contract Development (~2.7MB — each bundle re-embeds core BSV)**
|
|
108
108
|
```html
|
|
109
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
110
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
111
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
109
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
110
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-covenant.min.js"></script>
|
|
111
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-smartcontract.min.js"></script>
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
#### **3. 🆕 Legal & Compliance Development (~3.2MB — each bundle re-embeds core BSV)**
|
|
115
115
|
```html
|
|
116
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
117
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
118
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
116
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
117
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-ltp.min.js"></script>
|
|
118
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-gdaf.min.js"></script>
|
|
119
119
|
<script>
|
|
120
120
|
// Legal Token Protocol
|
|
121
121
|
const legalToken = bsv.createLegalToken({
|
|
@@ -132,9 +132,9 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
132
132
|
|
|
133
133
|
#### **4. 🆕 Security & Cryptography (~1.4MB)**
|
|
134
134
|
```html
|
|
135
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
137
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
135
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-security.min.js"></script>
|
|
137
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-shamir.min.js"></script>
|
|
138
138
|
<script>
|
|
139
139
|
// Shamir Secret Sharing
|
|
140
140
|
const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
|
|
@@ -146,7 +146,7 @@ Three advanced modules totaling **~2.7MB** of functionality:
|
|
|
146
146
|
|
|
147
147
|
#### **5. Everything Bundle (937KB)**
|
|
148
148
|
```html
|
|
149
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
149
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.bundle.js"></script>
|
|
150
150
|
<script>
|
|
151
151
|
// Everything available immediately
|
|
152
152
|
const shares = bsv.splitSecret('secret', 5, 3);
|
|
@@ -722,7 +722,7 @@ interface UTXO {
|
|
|
722
722
|
<html>
|
|
723
723
|
<head>
|
|
724
724
|
<title>UTXO Manager Demo</title>
|
|
725
|
-
<script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.5.
|
|
725
|
+
<script src="https://cdn.jsdelivr.net/npm/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
726
726
|
</head>
|
|
727
727
|
<body>
|
|
728
728
|
<script>
|
|
@@ -48,7 +48,7 @@ const tx: Transaction = new Transaction();
|
|
|
48
48
|
#### **Core Library Only (937KB)**
|
|
49
49
|
For basic Bitcoin SV operations:
|
|
50
50
|
```html
|
|
51
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
51
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
52
52
|
<script>
|
|
53
53
|
const privateKey = new bsv.PrivateKey();
|
|
54
54
|
const address = privateKey.toAddress();
|
|
@@ -58,7 +58,7 @@ For basic Bitcoin SV operations:
|
|
|
58
58
|
#### **Complete Bundle (937KB)**
|
|
59
59
|
Everything in one file:
|
|
60
60
|
```html
|
|
61
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
61
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.bundle.js"></script>
|
|
62
62
|
<script>
|
|
63
63
|
// All features available immediately
|
|
64
64
|
const shares = bsv.splitSecret('secret', 5, 3);
|
|
@@ -71,9 +71,9 @@ Everything in one file:
|
|
|
71
71
|
|
|
72
72
|
#### **Smart Contract Development (~2.7MB total — each bundle is self-contained and re-embeds core BSV)**
|
|
73
73
|
```html
|
|
74
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
75
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
76
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
74
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
75
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-covenant.min.js"></script>
|
|
76
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-smartcontract.min.js"></script>
|
|
77
77
|
<script>
|
|
78
78
|
const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
79
79
|
.extractField('amount').push(50000).greaterThanOrEqual().build();
|
|
@@ -82,9 +82,9 @@ Everything in one file:
|
|
|
82
82
|
|
|
83
83
|
#### **Legal & Identity Development (~3.2MB total — each bundle is self-contained and re-embeds core BSV)**
|
|
84
84
|
```html
|
|
85
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
86
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
87
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
85
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
86
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-ltp.min.js"></script>
|
|
87
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-gdaf.min.js"></script>
|
|
88
88
|
<script>
|
|
89
89
|
// Legal Token Protocol
|
|
90
90
|
const propertyToken = bsv.createPropertyToken({
|
|
@@ -98,9 +98,9 @@ Everything in one file:
|
|
|
98
98
|
|
|
99
99
|
#### **Security & Cryptography (~1.4MB total — each bundle is self-contained and re-embeds core BSV)**
|
|
100
100
|
```html
|
|
101
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
102
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
103
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
101
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
102
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-security.min.js"></script>
|
|
103
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-shamir.min.js"></script>
|
|
104
104
|
<script>
|
|
105
105
|
// Threshold Cryptography
|
|
106
106
|
const shares = bsv.splitSecret('my_secret_key', 5, 3);
|
|
@@ -114,18 +114,18 @@ Everything in one file:
|
|
|
114
114
|
|
|
115
115
|
| Module | Size | Purpose | CDN Link |
|
|
116
116
|
|--------|------|---------|----------|
|
|
117
|
-
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.
|
|
118
|
-
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.
|
|
119
|
-
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.
|
|
120
|
-
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.5.
|
|
121
|
-
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.5.
|
|
122
|
-
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.5.
|
|
123
|
-
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.
|
|
124
|
-
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.
|
|
125
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.
|
|
126
|
-
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.
|
|
127
|
-
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.
|
|
128
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.
|
|
117
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js` |
|
|
118
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@7.5.2/bsv.bundle.js` |
|
|
119
|
+
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@7.5.2/bsv-smartcontract.min.js` |
|
|
120
|
+
| **bsv-ltp.min.js** | 1184KB | **Legal Token Protocol** | `unpkg.com/@smartledger/bsv@7.5.2/bsv-ltp.min.js` |
|
|
121
|
+
| **bsv-gdaf.min.js** | 1184KB | **Digital Identity & Attestation** | `unpkg.com/@smartledger/bsv@7.5.2/bsv-gdaf.min.js` |
|
|
122
|
+
| **bsv-shamir.min.js** | 432KB | **Threshold Cryptography** | `unpkg.com/@smartledger/bsv@7.5.2/bsv-shamir.min.js` |
|
|
123
|
+
| **bsv-security.min.js** | 26KB | Security enhancements (opt-in helpers — see README › Security) | `unpkg.com/@smartledger/bsv@7.5.2/bsv-security.min.js` |
|
|
124
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@7.5.2/bsv-mnemonic.min.js` |
|
|
125
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@7.5.2/bsv-ecies.min.js` |
|
|
126
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@7.5.2/bsv-covenant.min.js` |
|
|
127
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@7.5.2/bsv-script-helper.min.js` |
|
|
128
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@7.5.2/bsv-message.min.js` |
|
|
129
129
|
|
|
130
130
|
## ⚙️ **Development Environment Setup**
|
|
131
131
|
|
|
@@ -14,10 +14,10 @@ npm install @smartledger/bsv
|
|
|
14
14
|
### Browser CDN (Instant)
|
|
15
15
|
```html
|
|
16
16
|
<!-- Core library (937KB) -->
|
|
17
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
17
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
18
18
|
|
|
19
19
|
<!-- Everything included (937KB) -->
|
|
20
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
20
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.bundle.js"></script>
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 💰 **Your First Transaction (60 seconds)**
|
|
@@ -127,19 +127,19 @@ SmartLedger-BSV offers 12 different loading options - use only what you need:
|
|
|
127
127
|
|
|
128
128
|
```html
|
|
129
129
|
<!-- Core BSV only (937KB) -->
|
|
130
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
130
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
131
131
|
|
|
132
132
|
<!-- Smart contracts (937KB) -->
|
|
133
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
133
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-smartcontract.min.js"></script>
|
|
134
134
|
|
|
135
135
|
<!-- Legal tokens (1.16MB) -->
|
|
136
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
136
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-ltp.min.js"></script>
|
|
137
137
|
|
|
138
138
|
<!-- Digital identity (1.16MB) -->
|
|
139
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
139
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-gdaf.min.js"></script>
|
|
140
140
|
|
|
141
141
|
<!-- Everything (937KB) -->
|
|
142
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
142
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.bundle.js"></script>
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
## ⚡ **Key Advantages**
|
|
@@ -159,17 +159,17 @@ const recovered = bsv.reconstructSecret([shares[0], shares[2], shares[4]]);
|
|
|
159
159
|
### **New Modular Options**
|
|
160
160
|
```html
|
|
161
161
|
<!-- Core compatibility (same size as bsv@1.5.6) -->
|
|
162
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
162
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.min.js"></script>
|
|
163
163
|
|
|
164
164
|
<!-- Add smart contracts when ready -->
|
|
165
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
165
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-smartcontract.min.js"></script>
|
|
166
166
|
|
|
167
167
|
<!-- Add advanced features as needed -->
|
|
168
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
169
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
168
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-ltp.min.js"></script>
|
|
169
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv-gdaf.min.js"></script>
|
|
170
170
|
|
|
171
171
|
<!-- Everything in one file -->
|
|
172
|
-
<script src="https://unpkg.com/@smartledger/bsv@7.5.
|
|
172
|
+
<script src="https://unpkg.com/@smartledger/bsv@7.5.2/bsv.bundle.js"></script>
|
|
173
173
|
```
|
|
174
174
|
|
|
175
175
|
## 🔍 **Testing Your Migration**
|
package/index.js
CHANGED
|
@@ -57,7 +57,10 @@ bsv.securityFeatures = [
|
|
|
57
57
|
'canonical-signatures',
|
|
58
58
|
'malleability-protection',
|
|
59
59
|
'enhanced-validation',
|
|
60
|
-
'elliptic-patches'
|
|
60
|
+
// 'elliptic-patches' was listed here long after `elliptic` stopped being a dependency.
|
|
61
|
+
// This array is what a compliance reviewer reads, so it states what is actually true.
|
|
62
|
+
'audited-noble-curves',
|
|
63
|
+
'fail-closed-verification'
|
|
61
64
|
]
|
|
62
65
|
|
|
63
66
|
// crypto
|
|
@@ -78,6 +78,14 @@ function redeemScript (m, pubkeys) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
function multisig (m, nKeys) {
|
|
81
|
+
// `nKeys` is a COUNT, not the keys. Passing an array made `m > nKeys` compare a number
|
|
82
|
+
// to an array, which coerces to NaN, so the guard passed and an authorizer was built
|
|
83
|
+
// with the array spliced into its name — broken, but silently.
|
|
84
|
+
if (typeof nKeys !== 'number' || !Number.isInteger(nKeys)) {
|
|
85
|
+
throw new Error('multisig(m, nKeys): nKeys is the NUMBER of keys, not the keys themselves' +
|
|
86
|
+
(Array.isArray(nKeys) ? ' — pass ' + nKeys.length + ' instead of the array' : ''))
|
|
87
|
+
}
|
|
88
|
+
if (typeof m !== 'number' || !Number.isInteger(m)) throw new Error('multisig(m, nKeys): m must be an integer')
|
|
81
89
|
if (m < 1 || m > nKeys || nKeys < 1 || nKeys > 16) throw new Error('multisig requires 1 <= m <= n <= 16')
|
|
82
90
|
return {
|
|
83
91
|
name: m + '-of-' + nKeys + '-multisig',
|
|
@@ -80,8 +80,10 @@ SmartContract.perpetualCovenant = function (fee) {
|
|
|
80
80
|
}
|
|
81
81
|
// Stateful ownership token (NFT) locking script. ownerPubKeyHash = HASH160 of the
|
|
82
82
|
// owner's public key (SmartContract.Token.ownerId); transfers are ECDSA-authorized.
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
// `auth` was NOT forwarded here, so a co-signed token built through this alias silently
|
|
84
|
+
// came out single-key — the authorizer was accepted and dropped.
|
|
85
|
+
SmartContract.ownershipToken = function (fee, ownerPubKeyHash, auth) {
|
|
86
|
+
return SmartContract.Token.ownershipToken(fee, ownerPubKeyHash, auth)
|
|
85
87
|
}
|
|
86
88
|
// OP_PUSH_TX value/output covenant: coins can only go where the covenant says.
|
|
87
89
|
SmartContract.valueCovenant = function (expectedHashOutputs) {
|
package/lib/statuslist/index.js
CHANGED
|
@@ -115,6 +115,11 @@ async function updateStatusList(params) {
|
|
|
115
115
|
if (!params.listVcJwt || params.index === undefined || !params.status || !params.privateJwk) {
|
|
116
116
|
throw new Error('listVcJwt, index, status, and privateJwk are required')
|
|
117
117
|
}
|
|
118
|
+
if (params.status === 'suspended') {
|
|
119
|
+
throw new Error("status 'suspended' is not supported by this list: its statusPurpose " +
|
|
120
|
+
"is 'revocation', and suspension would be written to the same bit and read back as " +
|
|
121
|
+
"'revoked'. Maintain a separate list for suspension until statusPurpose is configurable.")
|
|
122
|
+
}
|
|
118
123
|
|
|
119
124
|
// Verify the existing list's signature+issuer before building on top of it —
|
|
120
125
|
// an unverified base list lets an attacker seed forged revocation state.
|
|
@@ -132,9 +137,12 @@ async function updateStatusList(params) {
|
|
|
132
137
|
throw new Error('Index out of range')
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
// StatusList2021 uses 2 bits per credential for 4 states
|
|
136
|
-
//
|
|
137
|
-
|
|
140
|
+
// StatusList2021 uses 2 bits per credential for 4 states; this implementation uses a
|
|
141
|
+
// single bit (0 = valid, 1 = revoked) and hardcodes statusPurpose: 'revocation'.
|
|
142
|
+
// 'suspended' therefore has nowhere to go: it used to set the SAME bit as 'revoked' and
|
|
143
|
+
// read back as 'revoked', so a suspension was silently recorded — and reported — as a
|
|
144
|
+
// permanent revocation. Fail closed rather than lie about which state was written.
|
|
145
|
+
var statusBit = params.status === 'revoked' ? 1 : 0
|
|
138
146
|
|
|
139
147
|
if (statusBit === 1) {
|
|
140
148
|
bitstring[byteIndex] |= (1 << bitIndex)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartledger/bsv",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.2",
|
|
4
4
|
"description": "🚀 Complete Bitcoin SV development framework with legally-recognizable DID:web + W3C VC-JWT toolkit, Legal Token Protocol (LTP), Global Digital Attestation Framework (GDAF), StatusList2021 revocation, and 16 flexible loading options. Standards-based credentials with ES256/ES256K support, on-chain BSV anchoring, and comprehensive Bitcoin SV API. Perfect for legal tokens, verifiable credentials, DeFi, smart contracts, and secure Bitcoin applications.",
|
|
5
5
|
"author": "SmartLedger Technology <hello@smartledger.technology> (https://smartledger.technology)",
|
|
6
6
|
"homepage": "https://github.com/codenlighten/smartledger-bsv#readme",
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
},
|
|
19
19
|
"./package.json": "./package.json",
|
|
20
20
|
"./version": "./version.js",
|
|
21
|
+
"./anchor": "./anchor-entry.js",
|
|
22
|
+
"./covenant": "./covenant-entry.js",
|
|
23
|
+
"./didweb": "./didweb-entry.js",
|
|
24
|
+
"./gdaf": "./gdaf-entry.js",
|
|
25
|
+
"./ltp": "./ltp-entry.js",
|
|
26
|
+
"./script-helper": "./script-helper-entry.js",
|
|
27
|
+
"./security": "./security-entry.js",
|
|
28
|
+
"./shamir": "./shamir-entry.js",
|
|
29
|
+
"./smartcontract": "./smartcontract-entry.js",
|
|
30
|
+
"./statuslist": "./statuslist-entry.js",
|
|
31
|
+
"./vcjwt": "./vcjwt-entry.js",
|
|
21
32
|
"./lib/*.js": "./lib/*.js",
|
|
22
33
|
"./lib/*": "./lib/*.js",
|
|
23
34
|
"./*": "./*"
|
package/test/types/dts_drift.js
CHANGED
|
@@ -45,7 +45,9 @@ function collectDeclaredPaths (source) {
|
|
|
45
45
|
} else if (ts.isClassDeclaration(node) && node.name) {
|
|
46
46
|
paths.push(prefix.concat(node.name.text))
|
|
47
47
|
} else if (ts.isFunctionDeclaration(node) && node.name) {
|
|
48
|
-
|
|
48
|
+
var p = prefix.concat(node.name.text)
|
|
49
|
+
p.returnType = node.type ? node.type.getText() : null
|
|
50
|
+
paths.push(p)
|
|
49
51
|
} else if (ts.isVariableStatement(node)) {
|
|
50
52
|
node.declarationList.declarations.forEach(function (d) {
|
|
51
53
|
if (ts.isIdentifier(d.name)) paths.push(prefix.concat(d.name.text))
|
|
@@ -89,6 +91,26 @@ describe('types: bsv.d.ts does not drift from runtime', function () {
|
|
|
89
91
|
{ label: 'SPV', obj: bsv.SPV, decl: 'SPV' }
|
|
90
92
|
]
|
|
91
93
|
|
|
94
|
+
// An `async` runtime function declared with a non-Promise return type is the most
|
|
95
|
+
// dangerous kind of drift, because the type checker actively hides the bug rather than
|
|
96
|
+
// merely failing to catch it: `StatusList.getCredentialStatusEntry` was declared
|
|
97
|
+
// `: CredentialStatus` while being async, so `if (fn(...) === 'revoked')` compiled clean
|
|
98
|
+
// and was ALWAYS false — every revoked credential passed as valid.
|
|
99
|
+
it('no async runtime function is declared with a synchronous return type', function () {
|
|
100
|
+
var lies = []
|
|
101
|
+
declaredPaths.forEach(function (segs) {
|
|
102
|
+
if (!segs.returnType) return
|
|
103
|
+
var fn = resolve(bsv, segs)
|
|
104
|
+
if (typeof fn !== 'function') return
|
|
105
|
+
var isAsync = fn.constructor && fn.constructor.name === 'AsyncFunction'
|
|
106
|
+
var declaresPromise = /\bPromise\s*</.test(segs.returnType)
|
|
107
|
+
if (isAsync && !declaresPromise) {
|
|
108
|
+
lies.push(segs.join('.') + ' is async but is declared `: ' + segs.returnType + '`')
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
lies.should.deep.equal([], 'these declarations hide a Promise:\n ' + lies.join('\n '))
|
|
112
|
+
})
|
|
113
|
+
|
|
92
114
|
AUDITED.forEach(function (ns) {
|
|
93
115
|
it('every runtime function on ' + ns.label + ' is declared in bsv.d.ts', function () {
|
|
94
116
|
ns.obj.should.be.an('object')
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
/* global describe, it */
|
|
4
|
+
|
|
5
|
+
// Runtime half of a field review that found declarations disagreeing with the code.
|
|
6
|
+
// The declarations themselves are gated by dts_drift.js and by the tsc check in CI; the
|
|
7
|
+
// cases below are the ones where the RUNTIME also had to change, because a declaration
|
|
8
|
+
// that merely matched the old behaviour would have been documenting a bug.
|
|
9
|
+
|
|
10
|
+
var should = require('chai').should()
|
|
11
|
+
var bsv = require('../..')
|
|
12
|
+
var SC = bsv.SmartContract
|
|
13
|
+
|
|
14
|
+
describe('public surface tells the truth about itself', function () {
|
|
15
|
+
describe('SmartContract.ownershipToken forwards its authorizer', function () {
|
|
16
|
+
it('is not a two-argument alias that drops the third', function () {
|
|
17
|
+
// The top-level alias took (fee, ownerPubKeyHash) and called through with only
|
|
18
|
+
// those two, so a co-signed token built via this path came out single-key — the
|
|
19
|
+
// authorizer was accepted and silently discarded.
|
|
20
|
+
var auth = SC.Authorizers.multisig(2, 3)
|
|
21
|
+
var withAuth = SC.ownershipToken(1, Buffer.alloc(20), auth).toHex()
|
|
22
|
+
var without = SC.ownershipToken(1, Buffer.alloc(20)).toHex()
|
|
23
|
+
withAuth.should.not.equal(without)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it('agrees with SmartContract.Token.ownershipToken', function () {
|
|
27
|
+
var auth = SC.Authorizers.multisig(2, 3)
|
|
28
|
+
SC.ownershipToken(1, Buffer.alloc(20), auth).toHex()
|
|
29
|
+
.should.equal(SC.Token.ownershipToken(1, Buffer.alloc(20), auth).toHex())
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe('Authorizers.multisig takes a key COUNT', function () {
|
|
34
|
+
it('rejects an array of keys instead of silently building a broken authorizer', function () {
|
|
35
|
+
// `m > nKeys` compared a number to an array, which coerces to NaN, so the guard
|
|
36
|
+
// passed and the array was interpolated into the authorizer's name.
|
|
37
|
+
var keys = [1, 2, 3].map(function () {
|
|
38
|
+
return bsv.PrivateKey.fromRandom().toPublicKey().toBuffer()
|
|
39
|
+
})
|
|
40
|
+
;(function () { SC.Authorizers.multisig(2, keys) }).should.throw(/NUMBER of keys/)
|
|
41
|
+
// The message names the fix.
|
|
42
|
+
;(function () { SC.Authorizers.multisig(2, keys) }).should.throw(/pass 3 instead/)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it('still accepts the documented count form', function () {
|
|
46
|
+
SC.Authorizers.multisig(2, 3).n.should.equal(3)
|
|
47
|
+
SC.Authorizers.multisig(2, 3).m.should.equal(2)
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it('rejects non-integer m', function () {
|
|
51
|
+
(function () { SC.Authorizers.multisig('2', 3) }).should.throw(/m must be an integer/)
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
describe('StatusList refuses to record a suspension as a revocation', function () {
|
|
56
|
+
it('throws on status: suspended rather than setting the revocation bit', function () {
|
|
57
|
+
// Both statuses set the SAME bit and read back as 'revoked', so a suspension was
|
|
58
|
+
// silently recorded — and later reported — as a permanent revocation.
|
|
59
|
+
return bsv.StatusList.updateStatusList({
|
|
60
|
+
listVcJwt: 'x', index: 1, status: 'suspended', privateJwk: {}
|
|
61
|
+
}).then(
|
|
62
|
+
function () { throw new Error('should not have accepted suspended') },
|
|
63
|
+
function (err) { err.message.should.match(/'suspended' is not supported/) }
|
|
64
|
+
)
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
describe('securityFeatures describes what is actually shipped', function () {
|
|
69
|
+
it('no longer claims elliptic patches, since elliptic is not a dependency', function () {
|
|
70
|
+
var pkg = require('../../package.json')
|
|
71
|
+
var deps = Object.keys(pkg.dependencies || {})
|
|
72
|
+
deps.indexOf('elliptic').should.equal(-1)
|
|
73
|
+
bsv.securityFeatures.indexOf('elliptic-patches').should.equal(-1)
|
|
74
|
+
bsv.securityFeatures.should.be.an('array')
|
|
75
|
+
bsv.securityFeatures.length.should.be.above(0)
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
describe('documented sub-path entry points resolve', function () {
|
|
80
|
+
// Every one of these was MODULE_NOT_FOUND: the package `exports` map had no aliases
|
|
81
|
+
// for the *-entry.js files, so a documented deep import could not be loaded at all.
|
|
82
|
+
var SUBPATHS = ['didweb', 'vcjwt', 'gdaf', 'ltp', 'statuslist', 'shamir',
|
|
83
|
+
'anchor', 'covenant', 'security', 'smartcontract', 'script-helper']
|
|
84
|
+
|
|
85
|
+
SUBPATHS.forEach(function (name) {
|
|
86
|
+
it('@smartledger/bsv/' + name, function () {
|
|
87
|
+
var mod = require('@smartledger/bsv/' + name)
|
|
88
|
+
// Some entry points export a class (a function), others a namespace object.
|
|
89
|
+
var t = typeof mod
|
|
90
|
+
t.should.be.oneOf(['object', 'function'])
|
|
91
|
+
should.exist(mod)
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('still resolves the package root and lib deep imports', function () {
|
|
96
|
+
require('@smartledger/bsv').should.be.an('object')
|
|
97
|
+
require('@smartledger/bsv/version').should.be.a('string')
|
|
98
|
+
// Directory deep-imports need the explicit file — a documented 7.0 exports break.
|
|
99
|
+
require('@smartledger/bsv/lib/ordinals/index.js').should.be.an('object')
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
})
|
package/version.js
CHANGED