@smartledger/bsv 3.4.3 → 3.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +367 -0
  2. package/README.md +72 -72
  3. package/SECURITY.md +88 -0
  4. package/bin/cli.js +13 -8
  5. package/bsv-covenant.min.js +4 -4
  6. package/bsv-gdaf.min.js +5 -5
  7. package/bsv-ltp.min.js +7 -7
  8. package/bsv-smartcontract.min.js +5 -5
  9. package/bsv.bundle.js +5 -5
  10. package/bsv.d.ts +486 -9
  11. package/bsv.min.js +5 -5
  12. package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
  13. package/docs/MODULE_REFERENCE_COMPLETE.md +60 -57
  14. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  15. package/docs/getting-started/INSTALLATION.md +30 -30
  16. package/docs/getting-started/QUICK_START.md +14 -14
  17. package/docs/migration/FROM_BSV_1_5_6.md +5 -5
  18. package/gdaf-entry.js +1 -2
  19. package/index.js +20 -7
  20. package/lib/script/script.js +19 -0
  21. package/lib/smart_contract/covenant.js +10 -1
  22. package/lib/smartutxo.js +20 -12
  23. package/lib/transaction/input/publickeyhash.js +6 -1
  24. package/lib/transaction/transaction.js +12 -1
  25. package/ltp-entry.js +1 -2
  26. package/package.json +3 -3
  27. package/utilities/blockchain-state.js +32 -23
  28. package/demos/README.md +0 -188
  29. package/demos/architecture_demo.js +0 -247
  30. package/demos/browser-test.html +0 -1208
  31. package/demos/bsv_wallet_demo.js +0 -242
  32. package/demos/complete_ltp_demo.js +0 -511
  33. package/demos/debug_tools_demo.js +0 -87
  34. package/demos/demo_features.js +0 -123
  35. package/demos/easy_interface_demo.js +0 -109
  36. package/demos/ecies_demo.js +0 -182
  37. package/demos/gdaf_demo.js +0 -237
  38. package/demos/ltp_demo.js +0 -361
  39. package/demos/ltp_primitives_demo.js +0 -403
  40. package/demos/message_demo.js +0 -209
  41. package/demos/preimage_separation_demo.js +0 -383
  42. package/demos/script_helper_demo.js +0 -289
  43. package/demos/security_demo.js +0 -287
  44. package/demos/shamir_demo.js +0 -121
  45. package/demos/simple_demo.js +0 -204
  46. package/demos/simple_p2pkh_demo.js +0 -169
  47. package/demos/simple_utxo_preimage_demo.js +0 -196
  48. package/demos/smart_contract_demo.html +0 -1347
  49. package/demos/smart_contract_demo.js +0 -910
  50. package/demos/utxo_generator_demo.js +0 -244
  51. package/demos/validation_pipeline_demo.js +0 -155
  52. package/demos/web3keys.html +0 -740
  53. package/examples/README.md +0 -200
  54. package/examples/basic/transaction-creation.js +0 -534
  55. package/examples/basic/transaction_signature_api_gap.js +0 -178
  56. package/examples/complete_workflow_demo.js +0 -783
  57. package/examples/covenants/advanced_covenant_demo.js +0 -219
  58. package/examples/covenants/covenant_interface_demo.js +0 -270
  59. package/examples/covenants/covenant_manual_signature_resolved.js +0 -212
  60. package/examples/covenants/covenant_signature_template.js +0 -117
  61. package/examples/covenants2/covenant_bidirectional_example.js +0 -262
  62. package/examples/covenants2/covenant_utils_demo.js +0 -120
  63. package/examples/covenants2/preimage_covenant_utils.js +0 -287
  64. package/examples/covenants2/production_integration.js +0 -256
  65. package/examples/data/covenant_utxos.json +0 -28
  66. package/examples/data/utxos.json +0 -26
  67. package/examples/definitive_working_demo.js +0 -261
  68. package/examples/final_working_contracts.js +0 -338
  69. package/examples/legacy/README.md +0 -11
  70. package/examples/legacy/smart_contract_test_integration.js +0 -269
  71. package/examples/legacy/test_builtin_verify.js +0 -117
  72. package/examples/legacy/test_debug_integration.js +0 -71
  73. package/examples/legacy/test_ecdsa_little.js +0 -70
  74. package/examples/legacy/test_shamir.js +0 -221
  75. package/examples/legacy/test_smartverify_der.js +0 -110
  76. package/examples/preimage/README.md +0 -178
  77. package/examples/preimage/extract_preimage_bidirectional.js +0 -421
  78. package/examples/preimage/generate_sample_preimage.js +0 -208
  79. package/examples/preimage/generate_sighash_examples.js +0 -152
  80. package/examples/preimage/parse_preimage.js +0 -117
  81. package/examples/preimage/test_preimage_extractor.js +0 -53
  82. package/examples/preimage/test_varint_extraction.js +0 -95
  83. package/examples/scripts/custom_script_helper_example.js +0 -273
  84. package/examples/scripts/script_interpreter.js +0 -193
  85. package/examples/smart_contract/complete_workflow_demo.js +0 -343
  86. package/examples/smart_contract/covenant_builder_demo.js +0 -176
  87. package/examples/smart_contract/script_testing_integration.js +0 -198
  88. package/examples/smart_contract_templates.js +0 -718
  89. package/examples/working_smart_contracts.js +0 -348
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **🚀 Complete Bitcoin SV Development Framework with W3C Verifiable Credentials, DID:web, Legal Compliance, and 16 Flexible Loading Options**
4
4
 
5
- [![Version](https://img.shields.io/badge/version-3.4.1-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
5
+ [![Version](https://img.shields.io/badge/version-3.4.5-blue.svg)](https://www.npmjs.com/package/@smartledger/bsv)
6
6
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
  [![BSV](https://img.shields.io/badge/BSV-Compatible-orange.svg)](https://bitcoinsv.com/)
8
8
  [![Modular](https://img.shields.io/badge/Loading-Modular-purple.svg)](#loading-options)
@@ -25,8 +25,8 @@ The most comprehensive and flexible Bitcoin SV library available. **In v3.4.x**:
25
25
  ### **Quick Start - Issue Your First Verifiable Credential**
26
26
 
27
27
  ```bash
28
- # Install SmartLedger BSV v3.4.1
29
- npm install @smartledger/bsv@3.4.1
28
+ # Install SmartLedger BSV v3.4.5
29
+ npm install @smartledger/bsv@3.4.5
30
30
 
31
31
  # Initialize DID:web issuer (generates ES256 keys)
32
32
  npx smartledger-bsv didweb init --domain example.com --alg ES256
@@ -135,42 +135,42 @@ console.log('Status:', status) // 'revoked'
135
135
  ### **Core Modules**
136
136
  | Module | Size | Use Case | CDN |
137
137
  |--------|------|----------|-----|
138
- | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.4.1/bsv.min.js` |
139
- | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.4.1/bsv.bundle.js` |
138
+ | **bsv.min.js** | 937KB | Core BSV + SmartContract | `unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js` |
139
+ | **bsv.bundle.js** | 937KB | Everything in one file | `unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js` |
140
140
 
141
141
  ### **🆕 W3C Verifiable Credentials (v3.4.x)**
142
142
  | Module | Size | Use Case | CDN |
143
143
  |--------|------|----------|-----|
144
- | **🟢 bsv-didweb.min.js** | 419KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@3.4.1/bsv-didweb.min.js` |
145
- | **🟢 bsv-vcjwt.min.js** | 419KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@3.4.1/bsv-vcjwt.min.js` |
146
- | **🟢 bsv-statuslist.min.js** | 487KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@3.4.1/bsv-statuslist.min.js` |
147
- | **🟢 bsv-anchor.min.js** | 418KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@3.4.1/bsv-anchor.min.js` |
144
+ | **🟢 bsv-didweb.min.js** | 419KB | **DID:web generation** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-didweb.min.js` |
145
+ | **🟢 bsv-vcjwt.min.js** | 419KB | **VC-JWT issue/verify** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-vcjwt.min.js` |
146
+ | **🟢 bsv-statuslist.min.js** | 487KB | **StatusList2021 revocation** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-statuslist.min.js` |
147
+ | **🟢 bsv-anchor.min.js** | 418KB | **BSV anchoring (hash-only)** | `unpkg.com/@smartledger/bsv@3.4.5/bsv-anchor.min.js` |
148
148
 
149
149
  ### **Smart Contract & Development**
150
150
  | Module | Size | Use Case | CDN |
151
151
  |--------|------|----------|-----|
152
- | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@3.4.1/bsv-smartcontract.min.js` |
153
- | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.4.1/bsv-covenant.min.js` |
154
- | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.4.1/bsv-script-helper.min.js` |
155
- | **bsv-security.min.js** | 26KB | Security enhancements | `unpkg.com/@smartledger/bsv@3.4.1/bsv-security.min.js` |
152
+ | **bsv-smartcontract.min.js** | 937KB | Complete covenant framework | `unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js` |
153
+ | **bsv-covenant.min.js** | 913KB | Covenant operations | `unpkg.com/@smartledger/bsv@3.4.5/bsv-covenant.min.js` |
154
+ | **bsv-script-helper.min.js** | 26KB | Custom script tools | `unpkg.com/@smartledger/bsv@3.4.5/bsv-script-helper.min.js` |
155
+ | **bsv-security.min.js** | 26KB | Security enhancements | `unpkg.com/@smartledger/bsv@3.4.5/bsv-security.min.js` |
156
156
 
157
157
  ### **Legal & Compliance**
158
158
  | Module | Size | Use Case | CDN |
159
159
  |--------|------|----------|-----|
160
- | **bsv-ltp.min.js** | 1184KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@3.4.1/bsv-ltp.min.js` |
161
- | **bsv-gdaf.min.js** | 1184KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@3.4.1/bsv-gdaf.min.js` |
160
+ | **bsv-ltp.min.js** | 1184KB | Legal Token Protocol | `unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js` |
161
+ | **bsv-gdaf.min.js** | 1184KB | Digital Identity & Attestation | `unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js` |
162
162
 
163
163
  ### **Advanced Cryptography**
164
164
  | Module | Size | Use Case | CDN |
165
165
  |--------|------|----------|-----|
166
- | **bsv-shamir.min.js** | 432KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@3.4.1/bsv-shamir.min.js` |
166
+ | **bsv-shamir.min.js** | 432KB | Threshold Cryptography | `unpkg.com/@smartledger/bsv@3.4.5/bsv-shamir.min.js` |
167
167
 
168
168
  ### **Utilities**
169
169
  | Module | Size | Use Case | CDN |
170
170
  |--------|------|----------|-----|
171
- | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.4.1/bsv-ecies.min.js` |
172
- | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.4.1/bsv-message.min.js` |
173
- | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@3.4.1/bsv-mnemonic.min.js` |
171
+ | **bsv-ecies.min.js** | 71KB | Encryption | `unpkg.com/@smartledger/bsv@3.4.5/bsv-ecies.min.js` |
172
+ | **bsv-message.min.js** | 26KB | Message signing | `unpkg.com/@smartledger/bsv@3.4.5/bsv-message.min.js` |
173
+ | **bsv-mnemonic.min.js** | 681KB | HD wallets | `unpkg.com/@smartledger/bsv@3.4.5/bsv-mnemonic.min.js` |
174
174
 
175
175
  ## ⚡ **2-Minute Quick Start**
176
176
 
@@ -181,7 +181,7 @@ Get started with Bitcoin SV development in under 2 minutes:
181
181
  npm install @smartledger/bsv
182
182
 
183
183
  # Or include in HTML
184
- <script src="https://unpkg.com/@smartledger/bsv@3.4.1/bsv.min.js"></script>
184
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
185
185
  ```
186
186
 
187
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.
@@ -249,7 +249,7 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
249
249
  - 🌐 [Digital Identity Guide](docs/GDAF_DIGITAL_ATTESTATION_GUIDE.md)
250
250
  - � [Threshold Cryptography Guide](docs/SHAMIR_SECRET_SHARING_GUIDE.md)
251
251
  - �️ [UTXO Manager Guide](docs/UTXO_MANAGER_GUIDE.md)
252
- - 💡 [Examples Directory](examples/)
252
+ - 💡 [Examples Directory](https://github.com/codenlighten/smartledger-bsv/tree/main/examples)
253
253
 
254
254
  ## 🔧 **API Reference**
255
255
 
@@ -274,21 +274,21 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
274
274
 
275
275
  ## 📚 **Quick Start Examples**
276
276
 
277
- ### 🔧 **Basic Development** (476KB total)
277
+ ### 🔧 **Basic Development** (~963KB total)
278
278
  ```html
279
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
280
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-script-helper.min.js"></script>
279
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
280
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-script-helper.min.js"></script>
281
281
  <script>
282
282
  const privateKey = new bsv.PrivateKey();
283
283
  const utxos = new bsv.SmartContract.UTXOGenerator().createRealUTXOs(2, 100000);
284
284
  </script>
285
285
  ```
286
286
 
287
- ### 🔒 **Smart Contract Development** (932KB total)
287
+ ### 🔒 **Smart Contract Development** (~2.7MB total — each bundle re-embeds core BSV)
288
288
  ```html
289
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
290
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-covenant.min.js"></script>
291
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js"></script>
289
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
290
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-covenant.min.js"></script>
291
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js"></script>
292
292
  <script>
293
293
  const covenant = bsv.SmartContract.createCovenantBuilder()
294
294
  .extractField('amount').push(50000).greaterThanOrEqual().verify().build();
@@ -296,11 +296,11 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
296
296
  </script>
297
297
  ```
298
298
 
299
- ### 🆕 **Legal & Identity Development** (1.87MB total)
299
+ ### 🆕 **Legal & Identity Development** (~3.2MB total — each bundle re-embeds core BSV)
300
300
  ```html
301
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
302
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-ltp.min.js"></script>
303
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-gdaf.min.js"></script>
301
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
302
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-ltp.min.js"></script>
303
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-gdaf.min.js"></script>
304
304
  <script>
305
305
  // Legal Token Protocol
306
306
  const propertyToken = bsv.createPropertyToken({
@@ -312,11 +312,11 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
312
312
  </script>
313
313
  ```
314
314
 
315
- ### 🆕 **Security & Cryptography** (1.17MB total)
315
+ ### 🆕 **Security & Cryptography** (~1.4MB total)
316
316
  ```html
317
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
318
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-security.min.js"></script>
319
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-shamir.min.js"></script>
317
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
318
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-security.min.js"></script>
319
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-shamir.min.js"></script>
320
320
  <script>
321
321
  // Threshold Cryptography
322
322
  const shares = bsv.splitSecret('my_secret_key', 5, 3); // 5 shares, 3 needed
@@ -326,9 +326,9 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
326
326
  </script>
327
327
  ```
328
328
 
329
- ### 🎯 **Everything Bundle** (885KB)
329
+ ### 🎯 **Everything Bundle** (937KB)
330
330
  ```html
331
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js"></script>
331
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js"></script>
332
332
  <script>
333
333
  // Everything available immediately
334
334
  const shares = bsv.splitSecret('secret', 5, 3); // Shamir Secret Sharing
@@ -356,14 +356,14 @@ const covenant = bsv.SmartContract.createCovenantBuilder()
356
356
  ### 🛠️ **Advanced Development Tools**
357
357
  - 🔧 **JavaScript-to-Script**: High-level covenant development with 121 opcode mapping → [Covenant Guide](docs/ADVANCED_COVENANT_DEVELOPMENT.md)
358
358
  - 🔧 **UTXO Generator**: Create authentic test UTXOs for development → [UTXO Guide](docs/UTXO_MANAGER_GUIDE.md)
359
- - 🔧 **Preimage Parser**: Complete BIP-143 field extraction and manipulation → [Preimage Tools](examples/preimage/)
360
- - � **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)
361
361
  - � **PUSHTX Integration**: nChain techniques for advanced covenant patterns → [PUSHTX Insights](docs/pushtx-key-insights.md)
362
362
 
363
363
  ### 📦 **Flexible Architecture**
364
- - 📦 **12 Modular Options**: Load only what you need (27KB to 885KB) → [Loading Strategy](#loading-strategy-examples)
365
- - 📦 **Standalone Modules**: Independent legal, identity, and crypto modules → [Standalone Test](tests/standalone-modules-test.html)
366
- - 📦 **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)
367
367
  - 📦 **CDN Ready**: All modules available via unpkg and jsDelivr
368
368
  - 📦 **Webpack Optimized**: Tree-shakeable and build-tool friendly
369
369
 
@@ -406,21 +406,21 @@ const contractTx = covenant.createCovenantTransaction({
406
406
 
407
407
  ### Browser CDN (Choose Your Loading Strategy)
408
408
 
409
- #### 1. **Minimal Setup** - Core + Script Helper (476KB)
409
+ #### 1. **Minimal Setup** - Core + Script Helper (~963KB)
410
410
  ```html
411
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
412
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-script-helper.min.js"></script>
411
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
412
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-script-helper.min.js"></script>
413
413
  <script>
414
414
  const tx = new bsv.Transaction();
415
415
  const sig = bsvScriptHelper.createSignature(tx, privateKey, 0, script, satoshis);
416
416
  </script>
417
417
  ```
418
418
 
419
- #### 2. **DeFi Development** - Core + Covenants + Debug (932KB)
419
+ #### 2. **DeFi Development** - Core + Covenants + Debug (~2.7MB — each bundle re-embeds core BSV)
420
420
  ```html
421
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
422
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-covenant.min.js"></script>
423
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-smartcontract.min.js"></script>
421
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
422
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-covenant.min.js"></script>
423
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-smartcontract.min.js"></script>
424
424
  <script>
425
425
  const covenant = new bsvCovenant.CovenantInterface();
426
426
  const debugInfo = SmartContract.interpretScript(script);
@@ -428,19 +428,19 @@ const contractTx = covenant.createCovenantTransaction({
428
428
  </script>
429
429
  ```
430
430
 
431
- #### 3. **Security First** - Core + Enhanced Security (739KB)
431
+ #### 3. **Security First** - Core + Enhanced Security (~963KB)
432
432
  ```html
433
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.min.js"></script>
434
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv-security.min.js"></script>
433
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.min.js"></script>
434
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv-security.min.js"></script>
435
435
  <script>
436
436
  const verified = bsvSecurity.SmartVerify.verify(signature, hash, publicKey);
437
437
  const enhanced = bsvSecurity.EllipticFixed.createSignature(privateKey, hash);
438
438
  </script>
439
439
  ```
440
440
 
441
- #### 4. **Everything Bundle** - One File Solution (764KB)
441
+ #### 4. **Everything Bundle** - One File Solution (937KB)
442
442
  ```html
443
- <script src="https://unpkg.com/@smartledger/bsv@3.3.4/bsv.bundle.js"></script>
443
+ <script src="https://unpkg.com/@smartledger/bsv@3.4.5/bsv.bundle.js"></script>
444
444
  <script>
445
445
  // Everything available under bsv namespace
446
446
  const keys = bsv.SmartLedgerBundle.generateKeys();
@@ -777,18 +777,18 @@ A planned 3.5.0 will offer an opt-in flag to route the default verify path throu
777
777
 
778
778
  ### 🔧 **Technical Resources**
779
779
  - **[SmartContract Integration](SMARTCONTRACT_INTEGRATION.md)** - Debug tools and analysis
780
- - **[Examples Directory](examples/)** - Working code samples
781
- - **[Test Suite](tests/)** - Comprehensive testing examples
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
782
782
  - **[Build System](build/)** - Webpack configurations
783
783
 
784
784
  ### 🌐 **Loading Strategy Examples**
785
785
 
786
786
  | **Use Case** | **Recommended Load** | **Size** | **Features** |
787
787
  |--------------|---------------------|----------|--------------|
788
- | **Simple Transactions** | `bsv.min.js` | 449KB | Core BSV + SmartContract |
789
- | **DeFi Development** | Core + Covenant + Debug | 932KB | Advanced contracts + tools |
790
- | **Enterprise Apps** | `bsv.bundle.js` | 764KB | Everything included |
791
- | **Mobile/Lightweight** | Core + Script Helper | 476KB | Essential tools only |
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 |
792
792
  | **Research/Analysis** | Core + SmartContract | 900KB | Full debug capabilities |
793
793
 
794
794
  ### 🔗 **Cross-References**
@@ -799,19 +799,19 @@ A planned 3.5.0 will offer an opt-in flag to route the default verify path throu
799
799
  - [API Reference](#api-reference) → [Method Documentation](docs/)
800
800
 
801
801
  **From Examples → Implementation:**
802
- - [Covenant Examples](examples/covenants/) → [Production Guide](docs/ADVANCED_COVENANT_DEVELOPMENT.md#production-guidelines)
803
- - [Script Examples](examples/scripts/) → [Custom Script Guide](docs/CUSTOM_SCRIPT_DEVELOPMENT.md)
804
- - [Test Files](tests/) → [Integration Examples](examples/)
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)
805
805
 
806
806
  **From Concepts → Code:**
807
- - [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)
808
808
  - [Security Features](#smart-security) → [Implementation](lib/crypto/smartledger_verify.js)
809
- - [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)
810
810
 
811
811
  ### 🎓 **Learning Path**
812
812
 
813
813
  1. **Start**: [2-Minute Quick Start](#2-minute-quick-start)
814
- 2. **Practice**: [Examples Directory](examples/)
814
+ 2. **Practice**: [Examples Directory](https://github.com/codenlighten/smartledger-bsv/tree/main/examples)
815
815
  3. **Build**: [Custom Script Guide](docs/CUSTOM_SCRIPT_DEVELOPMENT.md)
816
816
  4. **Advanced**: [Covenant Development](docs/ADVANCED_COVENANT_DEVELOPMENT.md)
817
817
  5. **Deploy**: [Production Guidelines](docs/ADVANCED_COVENANT_DEVELOPMENT.md#production-guidelines)
@@ -839,11 +839,11 @@ A planned 3.5.0 will offer an opt-in flag to route the default verify path throu
839
839
  - [🔧 **Integration Guide**](SMARTCONTRACT_INTEGRATION.md) - Smart contract integration
840
840
 
841
841
  ### 📋 **Examples & Demos**
842
- - [� **Interactive Demos**](demos/) - **NEW!** HTML & Node.js smart contract demos
843
- - [�📁 **Examples Directory**](examples/) - Working code examples
844
- - [🎯 **Basic Examples**](examples/basic/) - Simple transactions & addresses
845
- - [🔒 **Covenant Examples**](examples/covenants/) - Smart contract patterns
846
- - [📊 **Advanced Examples**](examples/covenants2/) - Production patterns
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
847
847
 
848
848
  **🎮 Try the Interactive Demos:**
849
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/bin/cli.js CHANGED
@@ -8,6 +8,7 @@
8
8
 
9
9
  var fs = require('fs')
10
10
  var path = require('path')
11
+ var pkg = require('../package.json')
11
12
  var didweb = require('../lib/didweb')
12
13
  var vcjwt = require('../lib/vcjwt')
13
14
  var statuslist = require('../lib/statuslist')
@@ -43,8 +44,13 @@ function writeJsonFile(filepath, data) {
43
44
  }
44
45
 
45
46
  async function main() {
46
- if (!command) {
47
- console.log('SmartLedger BSV CLI v3.4.0')
47
+ if (command === '--version' || command === '-v') {
48
+ console.log(pkg.version)
49
+ process.exit(0)
50
+ }
51
+
52
+ if (!command || command === '--help' || command === '-h' || command === 'help') {
53
+ console.log('SmartLedger BSV CLI v' + pkg.version)
48
54
  console.log('')
49
55
  console.log('Usage:')
50
56
  console.log(' smartledger-bsv didweb <subcommand> [options]')
@@ -205,15 +211,14 @@ async function handleVc(subcommand, opts) {
205
211
 
206
212
  console.error('Verifying credential...')
207
213
 
208
- // Simple resolver that reads from .well-known
209
- var didResolver = async function(did) {
210
- var domain = did.replace('did:web:', '').replace(/%3A/g, ':')
214
+ // Simple resolver that reads from .well-known. lib/vcjwt expects
215
+ // `{ jwks: { keys: [...] } }`; jwks.json on disk is the raw JWKS,
216
+ // so wrap it.
217
+ var didResolver = async function (did) {
211
218
  var jwksPath = path.join(process.cwd(), '.well-known', 'jwks.json')
212
-
213
219
  if (fs.existsSync(jwksPath)) {
214
- return readJsonFile(jwksPath)
220
+ return { jwks: readJsonFile(jwksPath) }
215
221
  }
216
-
217
222
  throw new Error('Cannot resolve DID: ' + did)
218
223
  }
219
224