smartledger-bsv 3.3.5 → 3.4.4
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 +400 -0
- package/README.md +235 -80
- package/SECURITY.md +88 -0
- package/anchor-entry.js +1 -0
- package/bin/cli.js +354 -0
- package/bsv-anchor.min.js +12 -0
- package/bsv-covenant.min.js +8 -8
- package/bsv-didweb.min.js +12 -0
- package/bsv-gdaf.min.js +9 -9
- package/bsv-ltp.min.js +9 -9
- package/bsv-mnemonic.min.js +2 -2
- package/bsv-shamir.min.js +3 -3
- package/bsv-smartcontract.min.js +9 -9
- package/bsv-statuslist.min.js +18 -0
- package/bsv-vcjwt.min.js +12 -0
- package/bsv.bundle.js +9 -9
- package/bsv.d.ts +486 -9
- package/bsv.min.js +8 -8
- package/build/webpack.anchor.config.js +17 -0
- package/build/webpack.didweb.config.js +17 -0
- package/build/webpack.statuslist.config.js +17 -0
- package/build/webpack.vcjwt.config.js +17 -0
- package/didweb-entry.js +1 -0
- package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
- package/docs/MODULE_REFERENCE_COMPLETE.md +61 -58
- package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +3 -3
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +30 -30
- package/docs/getting-started/QUICK_START.md +18 -18
- package/docs/migration/FROM_BSV_1_5_6.md +16 -10
- package/docs/technical/roadmap.md +3 -3
- package/gdaf-entry.js +1 -2
- package/index.js +68 -9
- package/lib/anchor/index.js +102 -0
- package/lib/browser-utxo-manager-es5.js +11 -4
- package/lib/browser-utxo-manager.js +15 -8
- package/lib/didweb/index.js +177 -0
- package/lib/ltp/claim.js +1 -0
- package/lib/ltp/obligation.js +1 -0
- package/lib/ltp/registry.js +2 -0
- package/lib/ltp/right.js +1 -0
- package/lib/smart_contract/covenant.js +10 -1
- package/lib/smartutxo.js +20 -12
- package/lib/statuslist/index.js +164 -0
- package/lib/transaction/transaction.js +8 -1
- package/lib/util/_.js +7 -1
- package/lib/vcjwt/index.js +189 -0
- package/ltp-entry.js +1 -2
- package/package.json +21 -15
- package/statuslist-entry.js +1 -0
- package/utilities/blockchain-state.js +32 -23
- package/vcjwt-entry.js +1 -0
- package/demos/README.md +0 -188
- package/demos/architecture_demo.js +0 -247
- package/demos/browser-test.html +0 -1208
- package/demos/bsv_wallet_demo.js +0 -242
- package/demos/complete_ltp_demo.js +0 -511
- package/demos/debug_tools_demo.js +0 -87
- package/demos/demo_features.js +0 -123
- package/demos/easy_interface_demo.js +0 -109
- package/demos/ecies_demo.js +0 -182
- package/demos/gdaf_core_test.js +0 -131
- package/demos/gdaf_demo.js +0 -237
- package/demos/ltp_demo.js +0 -361
- package/demos/ltp_primitives_demo.js +0 -403
- package/demos/message_demo.js +0 -209
- package/demos/preimage_separation_demo.js +0 -383
- package/demos/script_helper_demo.js +0 -289
- package/demos/security_demo.js +0 -287
- package/demos/shamir_demo.js +0 -121
- package/demos/simple_demo.js +0 -204
- package/demos/simple_p2pkh_demo.js +0 -169
- package/demos/simple_utxo_preimage_demo.js +0 -196
- package/demos/smart_contract_demo.html +0 -1347
- package/demos/smart_contract_demo.js +0 -910
- package/demos/utxo_generator_demo.js +0 -244
- package/demos/validation_pipeline_demo.js +0 -155
- package/demos/web3keys.html +0 -740
- package/examples/README.md +0 -200
- package/examples/basic/transaction-creation.js +0 -534
- package/examples/basic/transaction_signature_api_gap.js +0 -178
- package/examples/complete_workflow_demo.js +0 -783
- package/examples/covenants/advanced_covenant_demo.js +0 -219
- package/examples/covenants/covenant_interface_demo.js +0 -270
- package/examples/covenants/covenant_manual_signature_resolved.js +0 -212
- package/examples/covenants/covenant_signature_template.js +0 -117
- package/examples/covenants2/covenant_bidirectional_example.js +0 -262
- package/examples/covenants2/covenant_utils_demo.js +0 -120
- package/examples/covenants2/preimage_covenant_utils.js +0 -287
- package/examples/covenants2/production_integration.js +0 -256
- package/examples/data/covenant_utxos.json +0 -28
- package/examples/data/utxos.json +0 -26
- package/examples/definitive_working_demo.js +0 -261
- package/examples/final_working_contracts.js +0 -338
- package/examples/preimage/README.md +0 -178
- package/examples/preimage/extract_preimage_bidirectional.js +0 -421
- package/examples/preimage/generate_sample_preimage.js +0 -208
- package/examples/preimage/generate_sighash_examples.js +0 -152
- package/examples/preimage/parse_preimage.js +0 -117
- package/examples/preimage/test_preimage_extractor.js +0 -53
- package/examples/preimage/test_varint_extraction.js +0 -95
- package/examples/scripts/custom_script_helper_example.js +0 -273
- package/examples/scripts/custom_script_signature_test.js +0 -344
- package/examples/scripts/script_interpreter.js +0 -193
- package/examples/smart_contract/complete_workflow_demo.js +0 -343
- package/examples/smart_contract/covenant_builder_demo.js +0 -176
- package/examples/smart_contract/script_testing_integration.js +0 -198
- package/examples/smart_contract_templates.js +0 -718
- package/examples/working_smart_contracts.js +0 -348
- package/lib/smart_contract/test_integration.js +0 -269
- package/tests/browser-compatibility/README.md +0 -35
- package/tests/browser-compatibility/test-cdn-vs-local.html +0 -186
- package/tests/browser-compatibility/test-pbkdf2.html +0 -51
- package/tests/bundle-completeness-test.html +0 -131
- package/tests/bundle-demo.html +0 -476
- package/tests/smartcontract-test.html +0 -239
- package/tests/standalone-modules-test.html +0 -260
- package/tests/test.html +0 -612
- package/tests/test_builtin_verify.js +0 -117
- package/tests/test_debug_integration.js +0 -71
- package/tests/test_ecdsa_little.js +0 -70
- package/tests/test_shamir.js +0 -221
- package/tests/test_smartverify_der.js +0 -110
- package/tests/test_standalone_shamir.html +0 -83
- package/tests/unpkg-demo.html +0 -194
- package/utilities/blockchain-state.json +0 -118565
package/README.md
CHANGED
|
@@ -1,47 +1,176 @@
|
|
|
1
1
|
# SmartLedger-BSV
|
|
2
2
|
|
|
3
|
-
**🚀 Complete Bitcoin SV Development Framework with
|
|
3
|
+
**🚀 Complete Bitcoin SV Development Framework with W3C Verifiable Credentials, DID:web, Legal Compliance, and 16 Flexible Loading Options**
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@smartledger/bsv)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://bitcoinsv.com/)
|
|
8
8
|
[](#loading-options)
|
|
9
|
+
[](#verifiable-credentials)
|
|
9
10
|
|
|
10
|
-
The most comprehensive and flexible Bitcoin SV library available.
|
|
11
|
+
The most comprehensive and flexible Bitcoin SV library available. **In v3.4.x**: Legally-recognizable DID:web + VC-JWT toolkit with ES256/ES256K support, StatusList2021 revocation, and BSV anchoring. Choose from 16 different distribution methods: standalone modules, complete bundle, or mix-and-match approach.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
> **v3.4.1 (bugfix)**: credential bundles now actually ship to npm consumers, `prepublishOnly` builds the full set, and `Transaction.shuffleOutputs()` uses a CSPRNG. See [CHANGELOG](./CHANGELOG.md#341---2026-05-18).
|
|
14
|
+
|
|
15
|
+
## 🆕 **v3.4.x - Legally-Recognizable Credentials**
|
|
16
|
+
|
|
17
|
+
### **Why This Matters**
|
|
18
|
+
- ✅ **W3C Standards**: Full VC-JWT and DID:web compliance for legal recognition
|
|
19
|
+
- ✅ **Enterprise Ready**: ES256 (P-256 NIST curve) for regulated industries
|
|
20
|
+
- ✅ **Blockchain Native**: ES256K (secp256k1) for BSV integration
|
|
21
|
+
- ✅ **Revocation Built-in**: StatusList2021 standard for credential management
|
|
22
|
+
- ✅ **Privacy Preserving**: Hash-only BSV anchoring (no PII on-chain)
|
|
23
|
+
- ✅ **CLI Tools**: Complete command-line interface for credential operations
|
|
24
|
+
|
|
25
|
+
### **Quick Start - Issue Your First Verifiable Credential**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Install SmartLedger BSV v3.4.4
|
|
29
|
+
npm install @smartledger/bsv@3.4.4
|
|
30
|
+
|
|
31
|
+
# Initialize DID:web issuer (generates ES256 keys)
|
|
32
|
+
npx smartledger-bsv didweb init --domain example.com --alg ES256
|
|
33
|
+
|
|
34
|
+
# Issue a credential
|
|
35
|
+
npx smartledger-bsv vc issue \
|
|
36
|
+
--issuer did:web:example.com \
|
|
37
|
+
--subject did:example:alice \
|
|
38
|
+
--types "VerifiableCredential,DriversLicense" \
|
|
39
|
+
--claims '{"licenseNumber":"DL123456","class":"C"}' \
|
|
40
|
+
> credential.jwt
|
|
41
|
+
|
|
42
|
+
# Verify the credential
|
|
43
|
+
npx smartledger-bsv vc verify credential.jwt
|
|
44
|
+
|
|
45
|
+
# Anchor hash to BSV (privacy-preserving)
|
|
46
|
+
npx smartledger-bsv anchor hash credential.jwt
|
|
47
|
+
|
|
48
|
+
# Create revocation list
|
|
49
|
+
npx smartledger-bsv status create --issuer did:web:example.com > status-list.jwt
|
|
50
|
+
|
|
51
|
+
# Revoke a credential
|
|
52
|
+
npx smartledger-bsv status set --list status-list.jwt --index 42 --status revoked
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### **Programmatic Usage**
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
const bsv = require('@smartledger/bsv')
|
|
59
|
+
|
|
60
|
+
// Generate DID:web issuer keys
|
|
61
|
+
const keys = await bsv.DIDWeb.generateIssuerKeys({ alg: 'ES256' })
|
|
62
|
+
|
|
63
|
+
// Build DID documents (.well-known/did.json and jwks.json)
|
|
64
|
+
const docs = bsv.DIDWeb.buildDidWebDocuments({
|
|
65
|
+
domain: 'example.com',
|
|
66
|
+
p256: { jwk: keys.publicJwk, kid: keys.kid },
|
|
67
|
+
controllerName: 'Example Corp'
|
|
68
|
+
})
|
|
69
|
+
// Deploy docs.didDocument to https://example.com/.well-known/did.json
|
|
70
|
+
// Deploy docs.jwks to https://example.com/.well-known/jwks.json
|
|
71
|
+
|
|
72
|
+
// Issue a Verifiable Credential as JWT
|
|
73
|
+
const result = await bsv.VcJwt.issueVcJwt({
|
|
74
|
+
issuerDid: docs.did,
|
|
75
|
+
subjectId: 'did:example:alice',
|
|
76
|
+
types: ['VerifiableCredential', 'AgeCredential'],
|
|
77
|
+
credentialSubject: {
|
|
78
|
+
ageOver: 18,
|
|
79
|
+
country: 'US'
|
|
80
|
+
},
|
|
81
|
+
privateJwk: keys.privateJwk,
|
|
82
|
+
alg: 'ES256',
|
|
83
|
+
kid: keys.kid
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
console.log('VC-JWT:', result.jwt)
|
|
87
|
+
|
|
88
|
+
// Verify the credential
|
|
89
|
+
const verification = await bsv.VcJwt.verifyVcJwt(result.jwt, {
|
|
90
|
+
didResolver: async (did) => {
|
|
91
|
+
// In production, fetch https://example.com/.well-known/jwks.json
|
|
92
|
+
return { jwks: docs.jwks }
|
|
93
|
+
},
|
|
94
|
+
expectedIssuerDid: docs.did
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
console.log('Valid:', verification.valid)
|
|
98
|
+
|
|
99
|
+
// Anchor hash to BSV (no PII on-chain)
|
|
100
|
+
const hash = bsv.Anchor.sha256Hex(result.jwt)
|
|
101
|
+
const anchorPayload = bsv.Anchor.buildAnchorPayload({
|
|
102
|
+
kind: 'VC_ANCHOR_SHA256',
|
|
103
|
+
hash: hash,
|
|
104
|
+
issuerDid: docs.did
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
// Include anchorPayload.json in OP_RETURN
|
|
108
|
+
// Later: verify with bsv.Anchor.verifyAnchorHash(originalData, anchorHash)
|
|
109
|
+
|
|
110
|
+
// Create revocation list (100k credentials)
|
|
111
|
+
const statusList = await bsv.StatusList.createStatusList({
|
|
112
|
+
issuerDid: docs.did,
|
|
113
|
+
privateJwk: keys.privateJwk
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// Revoke a credential
|
|
117
|
+
const updated = await bsv.StatusList.updateStatusList({
|
|
118
|
+
listVcJwt: statusList.listVcJwt,
|
|
119
|
+
index: 42,
|
|
120
|
+
status: 'revoked',
|
|
121
|
+
privateJwk: keys.privateJwk
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
// Check revocation status
|
|
125
|
+
const status = bsv.StatusList.getCredentialStatusEntry({
|
|
126
|
+
listVcJwt: updated.listVcJwt,
|
|
127
|
+
index: 42
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
console.log('Status:', status) // 'revoked'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 🎯 **16 Loading Options - Choose Your Approach**
|
|
13
134
|
|
|
14
135
|
### **Core Modules**
|
|
15
136
|
| Module | Size | Use Case | CDN |
|
|
16
137
|
|--------|------|----------|-----|
|
|
17
|
-
| **bsv.min.js** |
|
|
18
|
-
| **bsv.bundle.js** |
|
|
138
|
+
| **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js` |
|
|
139
|
+
| **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js` |
|
|
140
|
+
|
|
141
|
+
### **🆕 W3C Verifiable Credentials (v3.4.x)**
|
|
142
|
+
| Module | Size | Use Case | CDN |
|
|
143
|
+
|--------|------|----------|-----|
|
|
144
|
+
| **🟢 bsv-didweb.min.js** | 419KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-didweb.min.js` |
|
|
145
|
+
| **🟢 bsv-vcjwt.min.js** | 419KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-vcjwt.min.js` |
|
|
146
|
+
| **🟢 bsv-statuslist.min.js** | 487KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-statuslist.min.js` |
|
|
147
|
+
| **🟢 bsv-anchor.min.js** | 418KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@3.4.4/bsv-anchor.min.js` |
|
|
19
148
|
|
|
20
149
|
### **Smart Contract & Development**
|
|
21
150
|
| Module | Size | Use Case | CDN |
|
|
22
151
|
|--------|------|----------|-----|
|
|
23
|
-
| **bsv-smartcontract.min.js** |
|
|
24
|
-
| **bsv-covenant.min.js** |
|
|
25
|
-
| **bsv-script-helper.min.js** |
|
|
26
|
-
| **bsv-security.min.js** |
|
|
152
|
+
| **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js` |
|
|
153
|
+
| **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.4.4/bsv-covenant.min.js` |
|
|
154
|
+
| **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.4.4/bsv-script-helper.min.js` |
|
|
155
|
+
| **bsv-security.min.js** | 26KB | Security enhancements | `unpkg.com/@smartledger/bsv@3.4.4/bsv-security.min.js` |
|
|
27
156
|
|
|
28
|
-
###
|
|
157
|
+
### **Legal & Compliance**
|
|
29
158
|
| Module | Size | Use Case | CDN |
|
|
30
159
|
|--------|------|----------|-----|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
160
|
+
| **bsv-ltp.min.js** | 1184KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js` |
|
|
161
|
+
| **bsv-gdaf.min.js** | 1184KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js` |
|
|
33
162
|
|
|
34
|
-
###
|
|
163
|
+
### **Advanced Cryptography**
|
|
35
164
|
| Module | Size | Use Case | CDN |
|
|
36
165
|
|--------|------|----------|-----|
|
|
37
|
-
|
|
|
166
|
+
| **bsv-shamir.min.js** | 432KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@3.4.4/bsv-shamir.min.js` |
|
|
38
167
|
|
|
39
168
|
### **Utilities**
|
|
40
169
|
| Module | Size | Use Case | CDN |
|
|
41
170
|
|--------|------|----------|-----|
|
|
42
|
-
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.
|
|
43
|
-
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.
|
|
44
|
-
| **bsv-mnemonic.min.js** |
|
|
171
|
+
| **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.4.4/bsv-ecies.min.js` |
|
|
172
|
+
| **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.4.4/bsv-message.min.js` |
|
|
173
|
+
| **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@3.4.4/bsv-mnemonic.min.js` |
|
|
45
174
|
|
|
46
175
|
## ⚡ **2-Minute Quick Start**
|
|
47
176
|
|
|
@@ -52,10 +181,10 @@ Get started with Bitcoin SV development in under 2 minutes:
|
|
|
52
181
|
npm install @smartledger/bsv
|
|
53
182
|
|
|
54
183
|
# Or include in HTML
|
|
55
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
184
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
56
185
|
```
|
|
57
186
|
|
|
58
|
-
> **🔧 v3.
|
|
187
|
+
> **🔧 v3.4.x:** Legally-recognizable W3C Verifiable Credentials with DID:web + VC-JWT toolkit. ES256/ES256K support, StatusList2021 revocation, and privacy-preserving BSV anchoring. Complete CLI tooling included! v3.4.1 ensures these bundles ship to npm consumers; see CHANGELOG.
|
|
59
188
|
|
|
60
189
|
**Basic Transaction (30 seconds):**
|
|
61
190
|
```javascript
|
|
@@ -120,7 +249,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
120
249
|
- 🌐 [Digital Identity Guide](docs/GDAF_DIGITAL_ATTESTATION_GUIDE.md)
|
|
121
250
|
- � [Threshold Cryptography Guide](docs/SHAMIR_SECRET_SHARING_GUIDE.md)
|
|
122
251
|
- �️ [UTXO Manager Guide](docs/UTXO_MANAGER_GUIDE.md)
|
|
123
|
-
- 💡 [Examples Directory](examples
|
|
252
|
+
- 💡 [Examples Directory](https://github.com/codenlighten/smartledger-bsv/tree/main/examples)
|
|
124
253
|
|
|
125
254
|
## 🔧 **API Reference**
|
|
126
255
|
|
|
@@ -138,28 +267,28 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
138
267
|
| **Debug Tools** | `SmartContract.examineStack()` | Analyze script | `SmartContract.examineStack(script)` |
|
|
139
268
|
| | `interpretScript()` | Execute script | `SmartContract.interpretScript(script)` |
|
|
140
269
|
| | `getScriptMetrics()` | Performance data | `SmartContract.getScriptMetrics(script)` |
|
|
141
|
-
| **Security** | `SmartVerify.verify()` |
|
|
142
|
-
| | `EllipticFixed.sign()` |
|
|
270
|
+
| **Security (opt-in)** | `SmartVerify.verify()` | Hardened verify with strict input validation — call explicitly; default `signature.verify()` does NOT route through this | `SmartVerify.verify(sig, hash, pubkey)` |
|
|
271
|
+
| | `EllipticFixed.sign()` | Canonicalized signing wrapper around elliptic | `EllipticFixed.sign(hash, privateKey)` |
|
|
143
272
|
|
|
144
273
|
> 💡 **Tip:** All methods include comprehensive error handling and validation. See [documentation links](#documentation) for detailed guides.
|
|
145
274
|
|
|
146
275
|
## 📚 **Quick Start Examples**
|
|
147
276
|
|
|
148
|
-
### 🔧 **Basic Development** (
|
|
277
|
+
### 🔧 **Basic Development** (~963KB total)
|
|
149
278
|
```html
|
|
150
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
151
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
279
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
280
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-script-helper.min.js"></script>
|
|
152
281
|
<script>
|
|
153
282
|
const privateKey = new bsv.PrivateKey();
|
|
154
283
|
const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
|
|
155
284
|
</script>
|
|
156
285
|
```
|
|
157
286
|
|
|
158
|
-
### 🔒 **Smart Contract Development** (
|
|
287
|
+
### 🔒 **Smart Contract Development** (~2.7MB total — each bundle re-embeds core BSV)
|
|
159
288
|
```html
|
|
160
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
161
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
162
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
289
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
290
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-covenant.min.js"></script>
|
|
291
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js"></script>
|
|
163
292
|
<script>
|
|
164
293
|
const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
165
294
|
.extractField('amount').push(50000).greaterThanOrEqual().verify().build();
|
|
@@ -167,11 +296,11 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
167
296
|
</script>
|
|
168
297
|
```
|
|
169
298
|
|
|
170
|
-
### 🆕 **Legal & Identity Development** (
|
|
299
|
+
### 🆕 **Legal & Identity Development** (~3.2MB total — each bundle re-embeds core BSV)
|
|
171
300
|
```html
|
|
172
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
173
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
174
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
301
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
302
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-ltp.min.js"></script>
|
|
303
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-gdaf.min.js"></script>
|
|
175
304
|
<script>
|
|
176
305
|
// Legal Token Protocol
|
|
177
306
|
const propertyToken = bsv.createPropertyToken({
|
|
@@ -183,11 +312,11 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
183
312
|
</script>
|
|
184
313
|
```
|
|
185
314
|
|
|
186
|
-
### 🆕 **Security & Cryptography** (1.
|
|
315
|
+
### 🆕 **Security & Cryptography** (~1.4MB total)
|
|
187
316
|
```html
|
|
188
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
189
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
190
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
317
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
318
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-security.min.js"></script>
|
|
319
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-shamir.min.js"></script>
|
|
191
320
|
<script>
|
|
192
321
|
// Threshold Cryptography
|
|
193
322
|
const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
|
|
@@ -197,9 +326,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
197
326
|
</script>
|
|
198
327
|
```
|
|
199
328
|
|
|
200
|
-
### 🎯 **Everything Bundle** (
|
|
329
|
+
### 🎯 **Everything Bundle** (937KB)
|
|
201
330
|
```html
|
|
202
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
331
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js"></script>
|
|
203
332
|
<script>
|
|
204
333
|
// Everything available immediately
|
|
205
334
|
const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
|
|
@@ -219,7 +348,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
219
348
|
|
|
220
349
|
### 💼 **Core Library Excellence**
|
|
221
350
|
- ✅ **Complete BSV API**: Full Bitcoin SV blockchain operations → [API Reference](#api-reference)
|
|
222
|
-
- ✅ **
|
|
351
|
+
- ✅ **Opt-in security helpers**: `bsv.SmartVerify` and `bsv.EllipticFixed` add input validation and low-`s` canonicalization on top of standard verification — **not on the default verify path**, see [Security](#-security)
|
|
223
352
|
- ✅ **Browser + Node.js**: Universal compatibility with proper polyfills → [Loading Options](#12-loading-options--choose-your-approach)
|
|
224
353
|
- ✅ **TypeScript Ready**: Complete type definitions included
|
|
225
354
|
- ✅ **Ultra-Low Fees**: 0.01 sats/byte configuration (91% fee reduction)
|
|
@@ -227,14 +356,14 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
|
|
|
227
356
|
### 🛠️ **Advanced Development Tools**
|
|
228
357
|
- 🔧 **JavaScript-to-Script**: High-level covenant development with 121 opcode mapping → [Covenant Guide](docs/ADVANCED_COVENANT_DEVELOPMENT.md)
|
|
229
358
|
- 🔧 **UTXO Generator**: Create authentic test UTXOs for development → [UTXO Guide](docs/UTXO_MANAGER_GUIDE.md)
|
|
230
|
-
- 🔧 **Preimage Parser**: Complete BIP-143 field extraction and manipulation → [Preimage Tools](examples/preimage
|
|
231
|
-
- � **Debug Framework**: Script interpreter, stack examiner, and optimizer → [Debug Examples](tests/smartcontract-test.html)
|
|
359
|
+
- 🔧 **Preimage Parser**: Complete BIP-143 field extraction and manipulation → [Preimage Tools](https://github.com/codenlighten/smartledger-bsv/tree/main/examples/preimage)
|
|
360
|
+
- � **Debug Framework**: Script interpreter, stack examiner, and optimizer → [Debug Examples](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/smartcontract-test.html)
|
|
232
361
|
- � **PUSHTX Integration**: nChain techniques for advanced covenant patterns → [PUSHTX Insights](docs/pushtx-key-insights.md)
|
|
233
362
|
|
|
234
363
|
### 📦 **Flexible Architecture**
|
|
235
|
-
- 📦 **
|
|
236
|
-
- 📦 **Standalone Modules**: Independent legal, identity, and crypto modules → [Standalone Test](tests/standalone-modules-test.html)
|
|
237
|
-
- 📦 **Complete Bundle**: Everything in one file for convenience → [Bundle Demo](tests/bundle-demo.html)
|
|
364
|
+
- 📦 **16 Modular Options**: Load only what you need (26KB to 1184KB) → [Loading Strategy](#loading-strategy-examples)
|
|
365
|
+
- 📦 **Standalone Modules**: Independent legal, identity, and crypto modules → [Standalone Test](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/standalone-modules-test.html)
|
|
366
|
+
- 📦 **Complete Bundle**: Everything in one file for convenience → [Bundle Demo](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/bundle-demo.html)
|
|
238
367
|
- 📦 **CDN Ready**: All modules available via unpkg and jsDelivr
|
|
239
368
|
- 📦 **Webpack Optimized**: Tree-shakeable and build-tool friendly
|
|
240
369
|
|
|
@@ -277,21 +406,21 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
277
406
|
|
|
278
407
|
### Browser CDN (Choose Your Loading Strategy)
|
|
279
408
|
|
|
280
|
-
#### 1. **Minimal Setup** - Core + Script Helper (
|
|
409
|
+
#### 1. **Minimal Setup** - Core + Script Helper (~963KB)
|
|
281
410
|
```html
|
|
282
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
283
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
411
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
412
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-script-helper.min.js"></script>
|
|
284
413
|
<script>
|
|
285
414
|
const tx = new bsv.Transaction();
|
|
286
415
|
const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
|
|
287
416
|
</script>
|
|
288
417
|
```
|
|
289
418
|
|
|
290
|
-
#### 2. **DeFi Development** - Core + Covenants + Debug (
|
|
419
|
+
#### 2. **DeFi Development** - Core + Covenants + Debug (~2.7MB — each bundle re-embeds core BSV)
|
|
291
420
|
```html
|
|
292
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
293
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
294
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
421
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
422
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-covenant.min.js"></script>
|
|
423
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-smartcontract.min.js"></script>
|
|
295
424
|
<script>
|
|
296
425
|
const covenant = new bsvCovenant.CovenantInterface();
|
|
297
426
|
const debugInfo = SmartContract.interpretScript(script);
|
|
@@ -299,19 +428,19 @@ const contractTx = covenant.createCovenantTransaction({
|
|
|
299
428
|
</script>
|
|
300
429
|
```
|
|
301
430
|
|
|
302
|
-
#### 3. **Security First** - Core + Enhanced Security (
|
|
431
|
+
#### 3. **Security First** - Core + Enhanced Security (~963KB)
|
|
303
432
|
```html
|
|
304
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
305
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
433
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.min.js"></script>
|
|
434
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv-security.min.js"></script>
|
|
306
435
|
<script>
|
|
307
436
|
const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
|
|
308
437
|
const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
|
|
309
438
|
</script>
|
|
310
439
|
```
|
|
311
440
|
|
|
312
|
-
#### 4. **Everything Bundle** - One File Solution (
|
|
441
|
+
#### 4. **Everything Bundle** - One File Solution (937KB)
|
|
313
442
|
```html
|
|
314
|
-
<script src="https://unpkg.com/@smartledger/bsv@3.
|
|
443
|
+
<script src="https://unpkg.com/@smartledger/bsv@3.4.4/bsv.bundle.js"></script>
|
|
315
444
|
<script>
|
|
316
445
|
// Everything available under bsv namespace
|
|
317
446
|
const keys = bsv.SmartLedgerBundle.generateKeys();
|
|
@@ -569,11 +698,37 @@ const timelockScript = helper.createTimelockScript(
|
|
|
569
698
|
|
|
570
699
|
## 🔐 Security
|
|
571
700
|
|
|
572
|
-
###
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
-
|
|
701
|
+
### What's actually in the box
|
|
702
|
+
|
|
703
|
+
| Surface | Status | Notes |
|
|
704
|
+
|---------|--------|-------|
|
|
705
|
+
| `elliptic@6.6.1` (pinned) | upstream-patched | All known CVEs through 6.6.1 are fixed by elliptic itself. SmartLedger does not patch elliptic's source. |
|
|
706
|
+
| Default `transaction.verify()` / `signature.verify()` / `Message().verify()` | uses BSV's own `lib/crypto/ecdsa.js` | This path does **not** import elliptic and is **not** routed through `SmartVerify` or `EllipticFixed`. |
|
|
707
|
+
| `bsv.SmartVerify` (opt-in helper) | available | Hardened standalone verify: rejects `r=0`, `s=0`, `r≥n`, `s≥n`; canonicalizes `s` to low half. Built on BSV's own `BN`/`ECDSA`. You must call it explicitly. |
|
|
708
|
+
| `bsv.EllipticFixed` (opt-in helper) | available | Wraps the elliptic `secp256k1` instance with the same input checks + low-`s` on sign. Only matters if you use elliptic directly. |
|
|
709
|
+
| `signature.validate()` / `isCanonical()` / `toCanonical()` | available | Real methods on `bsv.Signature`. |
|
|
710
|
+
| DER canonicalization on TX signing | available | BSV's signature path produces low-`s` DER by default. |
|
|
711
|
+
| BIP143 preimage utilities | available | `lib/smart_contract/preimage.js` and `examples/preimage/`. |
|
|
712
|
+
|
|
713
|
+
### Using the opt-in helpers
|
|
714
|
+
|
|
715
|
+
```js
|
|
716
|
+
const bsv = require('@smartledger/bsv')
|
|
717
|
+
|
|
718
|
+
// Hardened verify (recommended if you accept signatures from untrusted sources):
|
|
719
|
+
const ok = bsv.SmartVerify.smartVerify(msgHashBuffer, derSigBuffer, publicKey)
|
|
720
|
+
|
|
721
|
+
// Or call BSV's own ECDSA via the standard API (no SmartVerify hardening):
|
|
722
|
+
const okDefault = bsv.crypto.ECDSA.verify(msgHashBuffer, signature, publicKey)
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
### What this library does **not** claim
|
|
726
|
+
|
|
727
|
+
- It does not silently route every `verify()` call through `SmartVerify`. If you want the strict input validation on every verification, call `SmartVerify` explicitly or wrap `bsv.Signature.prototype.verify`.
|
|
728
|
+
- It does not patch the elliptic library's source — the patches in `lib/crypto/elliptic-fixed.js` add input validation on top of an already-upstream-patched `elliptic@6.6.1`.
|
|
729
|
+
- It does not turn `bsv.isHardened = true` into an automatic guarantee. That property indicates the hardening helpers ship; whether they're used is up to your code.
|
|
730
|
+
|
|
731
|
+
A planned 3.5.0 will offer an opt-in flag to route the default verify path through `SmartVerify` so the protection is on by default for new users.
|
|
577
732
|
|
|
578
733
|
## 📝 Changelog
|
|
579
734
|
|
|
@@ -622,18 +777,18 @@ const timelockScript = helper.createTimelockScript(
|
|
|
622
777
|
|
|
623
778
|
### 🔧 **Technical Resources**
|
|
624
779
|
- **[SmartContract Integration](SMARTCONTRACT_INTEGRATION.md)** - Debug tools and analysis
|
|
625
|
-
- **[Examples Directory](examples
|
|
626
|
-
- **[Test Suite](tests
|
|
780
|
+
- **[Examples Directory](https://github.com/codenlighten/smartledger-bsv/tree/main/examples)** - Working code samples
|
|
781
|
+
- **[Test Suite](https://github.com/codenlighten/smartledger-bsv/tree/main/tests)** - Comprehensive testing examples
|
|
627
782
|
- **[Build System](build/)** - Webpack configurations
|
|
628
783
|
|
|
629
784
|
### 🌐 **Loading Strategy Examples**
|
|
630
785
|
|
|
631
786
|
| **Use Case** | **Recommended Load** | **Size** | **Features** |
|
|
632
787
|
|--------------|---------------------|----------|--------------|
|
|
633
|
-
| **Simple Transactions** | `bsv.min.js` |
|
|
634
|
-
| **DeFi Development** | Core + Covenant + Debug |
|
|
635
|
-
| **Enterprise Apps** | `bsv.bundle.js` |
|
|
636
|
-
| **Mobile/Lightweight** | Core + Script Helper |
|
|
788
|
+
| **Simple Transactions** | `bsv.min.js` | 937KB | Core BSV + SmartContract |
|
|
789
|
+
| **DeFi Development** | Core + Covenant + Debug | ~2.7MB | Advanced contracts + tools (bundles re-embed core BSV) |
|
|
790
|
+
| **Enterprise Apps** | `bsv.bundle.js` | 937KB | Everything included |
|
|
791
|
+
| **Mobile/Lightweight** | Core + Script Helper | ~963KB | Essential tools only |
|
|
637
792
|
| **Research/Analysis** | Core + SmartContract | 900KB | Full debug capabilities |
|
|
638
793
|
|
|
639
794
|
### 🔗 **Cross-References**
|
|
@@ -644,19 +799,19 @@ const timelockScript = helper.createTimelockScript(
|
|
|
644
799
|
- [API Reference](#api-reference) → [Method Documentation](docs/)
|
|
645
800
|
|
|
646
801
|
**From Examples → Implementation:**
|
|
647
|
-
- [Covenant Examples](examples/covenants
|
|
648
|
-
- [Script Examples](examples/scripts
|
|
649
|
-
- [Test Files](tests
|
|
802
|
+
- [Covenant Examples](https://github.com/codenlighten/smartledger-bsv/tree/main/examples/covenants) → [Production Guide](docs/ADVANCED_COVENANT_DEVELOPMENT.md#production-guidelines)
|
|
803
|
+
- [Script Examples](https://github.com/codenlighten/smartledger-bsv/tree/main/examples/scripts) → [Custom Script Guide](docs/CUSTOM_SCRIPT_DEVELOPMENT.md)
|
|
804
|
+
- [Test Files](https://github.com/codenlighten/smartledger-bsv/tree/main/tests) → [Integration Examples](https://github.com/codenlighten/smartledger-bsv/tree/main/examples)
|
|
650
805
|
|
|
651
806
|
**From Concepts → Code:**
|
|
652
|
-
- [PUSHTX Theory](docs/pushtx-key-insights.md) → [Covenant Implementation](examples/covenants/advanced_covenant_demo.js)
|
|
807
|
+
- [PUSHTX Theory](docs/pushtx-key-insights.md) → [Covenant Implementation](https://github.com/codenlighten/smartledger-bsv/blob/main/examples/covenants/advanced_covenant_demo.js)
|
|
653
808
|
- [Security Features](#smart-security) → [Implementation](lib/crypto/smartledger_verify.js)
|
|
654
|
-
- [Debug Tools](#debug-tools) → [Usage Examples](tests/smartcontract-test.html)
|
|
809
|
+
- [Debug Tools](#debug-tools) → [Usage Examples](https://github.com/codenlighten/smartledger-bsv/blob/main/tests/smartcontract-test.html)
|
|
655
810
|
|
|
656
811
|
### 🎓 **Learning Path**
|
|
657
812
|
|
|
658
813
|
1. **Start**: [2-Minute Quick Start](#2-minute-quick-start)
|
|
659
|
-
2. **Practice**: [Examples Directory](examples
|
|
814
|
+
2. **Practice**: [Examples Directory](https://github.com/codenlighten/smartledger-bsv/tree/main/examples)
|
|
660
815
|
3. **Build**: [Custom Script Guide](docs/CUSTOM_SCRIPT_DEVELOPMENT.md)
|
|
661
816
|
4. **Advanced**: [Covenant Development](docs/ADVANCED_COVENANT_DEVELOPMENT.md)
|
|
662
817
|
5. **Deploy**: [Production Guidelines](docs/ADVANCED_COVENANT_DEVELOPMENT.md#production-guidelines)
|
|
@@ -684,11 +839,11 @@ const timelockScript = helper.createTimelockScript(
|
|
|
684
839
|
- [🔧 **Integration Guide**](SMARTCONTRACT_INTEGRATION.md) - Smart contract integration
|
|
685
840
|
|
|
686
841
|
### 📋 **Examples & Demos**
|
|
687
|
-
- [� **Interactive Demos**](demos
|
|
688
|
-
- [�📁 **Examples Directory**](examples
|
|
689
|
-
- [🎯 **Basic Examples**](examples/basic
|
|
690
|
-
- [🔒 **Covenant Examples**](examples/covenants
|
|
691
|
-
- [📊 **Advanced Examples**](examples/covenants2
|
|
842
|
+
- [� **Interactive Demos**](https://github.com/codenlighten/smartledger-bsv/tree/main/demos) - **NEW!** HTML & Node.js smart contract demos
|
|
843
|
+
- [�📁 **Examples Directory**](https://github.com/codenlighten/smartledger-bsv/tree/main/examples) - Working code examples
|
|
844
|
+
- [🎯 **Basic Examples**](https://github.com/codenlighten/smartledger-bsv/tree/main/examples/basic) - Simple transactions & addresses
|
|
845
|
+
- [🔒 **Covenant Examples**](https://github.com/codenlighten/smartledger-bsv/tree/main/examples/covenants) - Smart contract patterns
|
|
846
|
+
- [📊 **Advanced Examples**](https://github.com/codenlighten/smartledger-bsv/tree/main/examples/covenants2) - Production patterns
|
|
692
847
|
|
|
693
848
|
**🎮 Try the Interactive Demos:**
|
|
694
849
|
```bash
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
Thank you for helping keep `@smartledger/bsv` and its users safe.
|
|
4
|
+
|
|
5
|
+
## Supported Versions
|
|
6
|
+
|
|
7
|
+
Security fixes are applied to the latest minor release line. Earlier releases
|
|
8
|
+
are not patched; please upgrade.
|
|
9
|
+
|
|
10
|
+
| Version | Supported |
|
|
11
|
+
| ------- | ------------------ |
|
|
12
|
+
| 3.4.x | :white_check_mark: |
|
|
13
|
+
| < 3.4 | :x: |
|
|
14
|
+
|
|
15
|
+
## Reporting a Vulnerability
|
|
16
|
+
|
|
17
|
+
**Please do not report security vulnerabilities through public GitHub issues,
|
|
18
|
+
discussions, or pull requests.**
|
|
19
|
+
|
|
20
|
+
Report privately via either of:
|
|
21
|
+
|
|
22
|
+
- **GitHub Security Advisories** (preferred):
|
|
23
|
+
<https://github.com/codenlighten/smartledger-bsv/security/advisories/new>
|
|
24
|
+
- **Email:** `hello@smartledger.technology`
|
|
25
|
+
|
|
26
|
+
When reporting, please include as much of the following as you can:
|
|
27
|
+
|
|
28
|
+
- Affected version(s) and platform (Node.js version, browser, CDN vs. npm)
|
|
29
|
+
- A minimal reproduction (code snippet, transaction hex, or test vector)
|
|
30
|
+
- Impact assessment — what an attacker can do with the bug
|
|
31
|
+
- Any suggested mitigation
|
|
32
|
+
|
|
33
|
+
We aim to acknowledge new reports within **3 business days** and to provide a
|
|
34
|
+
remediation timeline within **10 business days**. Coordinated disclosure is
|
|
35
|
+
appreciated; we will credit reporters in the release notes unless you prefer
|
|
36
|
+
to remain anonymous.
|
|
37
|
+
|
|
38
|
+
## In Scope
|
|
39
|
+
|
|
40
|
+
- Cryptographic correctness bugs in `lib/crypto/` (ECDSA, BN, Hash, Random,
|
|
41
|
+
Point, Signature, Shamir).
|
|
42
|
+
- Signature/transaction malleability or forgery affecting the default verify
|
|
43
|
+
path (`lib/crypto/ecdsa.js`) or the opt-in helpers (`SmartVerify`,
|
|
44
|
+
`EllipticFixed`).
|
|
45
|
+
- Key-generation, HD-derivation (BIP-32), or mnemonic (BIP-39) flaws that
|
|
46
|
+
weaken entropy or leak material.
|
|
47
|
+
- Issues in DID:web, VC-JWT, StatusList2021, or Anchor modules that allow
|
|
48
|
+
forgery, replay, or unauthorized revocation.
|
|
49
|
+
- Bugs in BIP-143 preimage handling, covenant construction, or LTP/GDAF
|
|
50
|
+
signing paths.
|
|
51
|
+
- Supply-chain concerns about pinned runtime dependencies
|
|
52
|
+
(`elliptic@6.6.1`, `bn.js@4.11.9`, `bs58@4.0.1`, etc.).
|
|
53
|
+
|
|
54
|
+
## Out of Scope
|
|
55
|
+
|
|
56
|
+
- Vulnerabilities in development-only dependencies (`webpack 4`, `standard 12`,
|
|
57
|
+
`mocha 8`, etc.). These are tracked separately and addressed in the planned
|
|
58
|
+
3.5.0 toolchain upgrade.
|
|
59
|
+
- Issues that require a malicious local environment (compromised Node, browser
|
|
60
|
+
extension, or filesystem) to exploit.
|
|
61
|
+
- Denial-of-service from intentionally malformed inputs that do **not** cross
|
|
62
|
+
a trust boundary (e.g., feeding garbage to a library function in your own
|
|
63
|
+
process and observing it throw).
|
|
64
|
+
- Stylistic, naming, or documentation issues unrelated to security claims —
|
|
65
|
+
please open a regular issue or PR for those.
|
|
66
|
+
|
|
67
|
+
## Security Posture
|
|
68
|
+
|
|
69
|
+
`@smartledger/bsv` ships **opt-in** hardening helpers — `bsv.SmartVerify`,
|
|
70
|
+
`bsv.EllipticFixed`, and `signature.toCanonical()` — that you must call
|
|
71
|
+
explicitly. The default `transaction.verify()` / `signature.verify()` /
|
|
72
|
+
`Message().verify()` paths use BSV's own pure-JS ECDSA in
|
|
73
|
+
`lib/crypto/ecdsa.js` and are **not** routed through `SmartVerify`.
|
|
74
|
+
|
|
75
|
+
See the [Security section of the README](./README.md#-security) for the full
|
|
76
|
+
"what's in the box" table and usage examples for the opt-in helpers. A
|
|
77
|
+
planned 3.5.0 will offer an opt-in flag to route the default verify path
|
|
78
|
+
through `SmartVerify` so the protection is on by default for new users.
|
|
79
|
+
|
|
80
|
+
## Disclosure History
|
|
81
|
+
|
|
82
|
+
Significant security-relevant changes are documented in
|
|
83
|
+
[`CHANGELOG.md`](./CHANGELOG.md). Recent entries of note:
|
|
84
|
+
|
|
85
|
+
- **3.4.2 / 3.4.3** — corrected documentation overclaims about which
|
|
86
|
+
hardening is on by default vs. opt-in.
|
|
87
|
+
- **3.4.1** — `Transaction.shuffleOutputs()` now draws entropy from
|
|
88
|
+
`bsv.crypto.Random` (CSPRNG) instead of `Math.random`.
|
package/anchor-entry.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./lib/anchor')
|