@smartledger/bsv 3.4.3 → 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 +321 -0
- package/README.md +72 -72
- package/SECURITY.md +88 -0
- package/bin/cli.js +13 -8
- package/bsv-covenant.min.js +4 -4
- package/bsv-gdaf.min.js +5 -5
- package/bsv-ltp.min.js +7 -7
- package/bsv-smartcontract.min.js +5 -5
- package/bsv.bundle.js +5 -5
- package/bsv.d.ts +486 -9
- package/bsv.min.js +5 -5
- package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
- package/docs/MODULE_REFERENCE_COMPLETE.md +60 -57
- package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
- package/docs/getting-started/INSTALLATION.md +30 -30
- package/docs/getting-started/QUICK_START.md +14 -14
- package/docs/migration/FROM_BSV_1_5_6.md +5 -5
- package/gdaf-entry.js +1 -2
- package/index.js +20 -7
- package/lib/smart_contract/covenant.js +10 -1
- package/lib/smartutxo.js +20 -12
- package/lib/transaction/transaction.js +7 -0
- package/ltp-entry.js +1 -2
- package/package.json +3 -3
- package/utilities/blockchain-state.js +32 -23
- 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_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/legacy/README.md +0 -11
- package/examples/legacy/smart_contract_test_integration.js +0 -269
- package/examples/legacy/test_builtin_verify.js +0 -117
- package/examples/legacy/test_debug_integration.js +0 -71
- package/examples/legacy/test_ecdsa_little.js +0 -70
- package/examples/legacy/test_shamir.js +0 -221
- package/examples/legacy/test_smartverify_der.js +0 -110
- 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/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/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 (
|
|
47
|
-
console.log(
|
|
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
|
-
|
|
210
|
-
|
|
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
|
|