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.
Files changed (126) hide show
  1. package/CHANGELOG.md +400 -0
  2. package/README.md +235 -80
  3. package/SECURITY.md +88 -0
  4. package/anchor-entry.js +1 -0
  5. package/bin/cli.js +354 -0
  6. package/bsv-anchor.min.js +12 -0
  7. package/bsv-covenant.min.js +8 -8
  8. package/bsv-didweb.min.js +12 -0
  9. package/bsv-gdaf.min.js +9 -9
  10. package/bsv-ltp.min.js +9 -9
  11. package/bsv-mnemonic.min.js +2 -2
  12. package/bsv-shamir.min.js +3 -3
  13. package/bsv-smartcontract.min.js +9 -9
  14. package/bsv-statuslist.min.js +18 -0
  15. package/bsv-vcjwt.min.js +12 -0
  16. package/bsv.bundle.js +9 -9
  17. package/bsv.d.ts +486 -9
  18. package/bsv.min.js +8 -8
  19. package/build/webpack.anchor.config.js +17 -0
  20. package/build/webpack.didweb.config.js +17 -0
  21. package/build/webpack.statuslist.config.js +17 -0
  22. package/build/webpack.vcjwt.config.js +17 -0
  23. package/didweb-entry.js +1 -0
  24. package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
  25. package/docs/MODULE_REFERENCE_COMPLETE.md +61 -58
  26. package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +3 -3
  27. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  28. package/docs/getting-started/INSTALLATION.md +30 -30
  29. package/docs/getting-started/QUICK_START.md +18 -18
  30. package/docs/migration/FROM_BSV_1_5_6.md +16 -10
  31. package/docs/technical/roadmap.md +3 -3
  32. package/gdaf-entry.js +1 -2
  33. package/index.js +68 -9
  34. package/lib/anchor/index.js +102 -0
  35. package/lib/browser-utxo-manager-es5.js +11 -4
  36. package/lib/browser-utxo-manager.js +15 -8
  37. package/lib/didweb/index.js +177 -0
  38. package/lib/ltp/claim.js +1 -0
  39. package/lib/ltp/obligation.js +1 -0
  40. package/lib/ltp/registry.js +2 -0
  41. package/lib/ltp/right.js +1 -0
  42. package/lib/smart_contract/covenant.js +10 -1
  43. package/lib/smartutxo.js +20 -12
  44. package/lib/statuslist/index.js +164 -0
  45. package/lib/transaction/transaction.js +8 -1
  46. package/lib/util/_.js +7 -1
  47. package/lib/vcjwt/index.js +189 -0
  48. package/ltp-entry.js +1 -2
  49. package/package.json +21 -15
  50. package/statuslist-entry.js +1 -0
  51. package/utilities/blockchain-state.js +32 -23
  52. package/vcjwt-entry.js +1 -0
  53. package/demos/README.md +0 -188
  54. package/demos/architecture_demo.js +0 -247
  55. package/demos/browser-test.html +0 -1208
  56. package/demos/bsv_wallet_demo.js +0 -242
  57. package/demos/complete_ltp_demo.js +0 -511
  58. package/demos/debug_tools_demo.js +0 -87
  59. package/demos/demo_features.js +0 -123
  60. package/demos/easy_interface_demo.js +0 -109
  61. package/demos/ecies_demo.js +0 -182
  62. package/demos/gdaf_core_test.js +0 -131
  63. package/demos/gdaf_demo.js +0 -237
  64. package/demos/ltp_demo.js +0 -361
  65. package/demos/ltp_primitives_demo.js +0 -403
  66. package/demos/message_demo.js +0 -209
  67. package/demos/preimage_separation_demo.js +0 -383
  68. package/demos/script_helper_demo.js +0 -289
  69. package/demos/security_demo.js +0 -287
  70. package/demos/shamir_demo.js +0 -121
  71. package/demos/simple_demo.js +0 -204
  72. package/demos/simple_p2pkh_demo.js +0 -169
  73. package/demos/simple_utxo_preimage_demo.js +0 -196
  74. package/demos/smart_contract_demo.html +0 -1347
  75. package/demos/smart_contract_demo.js +0 -910
  76. package/demos/utxo_generator_demo.js +0 -244
  77. package/demos/validation_pipeline_demo.js +0 -155
  78. package/demos/web3keys.html +0 -740
  79. package/examples/README.md +0 -200
  80. package/examples/basic/transaction-creation.js +0 -534
  81. package/examples/basic/transaction_signature_api_gap.js +0 -178
  82. package/examples/complete_workflow_demo.js +0 -783
  83. package/examples/covenants/advanced_covenant_demo.js +0 -219
  84. package/examples/covenants/covenant_interface_demo.js +0 -270
  85. package/examples/covenants/covenant_manual_signature_resolved.js +0 -212
  86. package/examples/covenants/covenant_signature_template.js +0 -117
  87. package/examples/covenants2/covenant_bidirectional_example.js +0 -262
  88. package/examples/covenants2/covenant_utils_demo.js +0 -120
  89. package/examples/covenants2/preimage_covenant_utils.js +0 -287
  90. package/examples/covenants2/production_integration.js +0 -256
  91. package/examples/data/covenant_utxos.json +0 -28
  92. package/examples/data/utxos.json +0 -26
  93. package/examples/definitive_working_demo.js +0 -261
  94. package/examples/final_working_contracts.js +0 -338
  95. package/examples/preimage/README.md +0 -178
  96. package/examples/preimage/extract_preimage_bidirectional.js +0 -421
  97. package/examples/preimage/generate_sample_preimage.js +0 -208
  98. package/examples/preimage/generate_sighash_examples.js +0 -152
  99. package/examples/preimage/parse_preimage.js +0 -117
  100. package/examples/preimage/test_preimage_extractor.js +0 -53
  101. package/examples/preimage/test_varint_extraction.js +0 -95
  102. package/examples/scripts/custom_script_helper_example.js +0 -273
  103. package/examples/scripts/custom_script_signature_test.js +0 -344
  104. package/examples/scripts/script_interpreter.js +0 -193
  105. package/examples/smart_contract/complete_workflow_demo.js +0 -343
  106. package/examples/smart_contract/covenant_builder_demo.js +0 -176
  107. package/examples/smart_contract/script_testing_integration.js +0 -198
  108. package/examples/smart_contract_templates.js +0 -718
  109. package/examples/working_smart_contracts.js +0 -348
  110. package/lib/smart_contract/test_integration.js +0 -269
  111. package/tests/browser-compatibility/README.md +0 -35
  112. package/tests/browser-compatibility/test-cdn-vs-local.html +0 -186
  113. package/tests/browser-compatibility/test-pbkdf2.html +0 -51
  114. package/tests/bundle-completeness-test.html +0 -131
  115. package/tests/bundle-demo.html +0 -476
  116. package/tests/smartcontract-test.html +0 -239
  117. package/tests/standalone-modules-test.html +0 -260
  118. package/tests/test.html +0 -612
  119. package/tests/test_builtin_verify.js +0 -117
  120. package/tests/test_debug_integration.js +0 -71
  121. package/tests/test_ecdsa_little.js +0 -70
  122. package/tests/test_shamir.js +0 -221
  123. package/tests/test_smartverify_der.js +0 -110
  124. package/tests/test_standalone_shamir.html +0 -83
  125. package/tests/unpkg-demo.html +0 -194
  126. package/utilities/blockchain-state.json +0 -118565
package/CHANGELOG.md CHANGED
@@ -5,6 +5,406 @@ All notable changes to SmartLedger-BSV will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.4.4] - 2026-05-25
9
+
10
+ ### Fixed
11
+
12
+ - **TypeScript types now actually load for `@smartledger/bsv` consumers.**
13
+ Two pre-existing bugs combined to silently leave TS users with `any`:
14
+ `package.json` had no `"types"` field, and `bsv.d.ts` declared
15
+ `module 'bsv'` instead of `module '@smartledger/bsv'`. Added the `types:`
16
+ field and renamed the ambient module declaration. Existing TS consumers
17
+ who were previously seeing `any` for every `bsv.*` will now get real
18
+ autocomplete and type errors — surface API unchanged, but any code that
19
+ was implicitly relying on `any` to silence a real type error will need
20
+ to be fixed.
21
+
22
+ - **`smartledger-bsv vc verify` actually works now.** The CLI's DID resolver
23
+ returned the raw JWKS file content (`{ keys: [...] }`), but
24
+ `lib/vcjwt/verifyVcJwt` expects the documented resolver shape
25
+ `{ jwks: { keys: [...] } }`. So every `npx smartledger-bsv vc verify`
26
+ call advertised in the README's quickstart would fail with "Failed to
27
+ resolve issuer DID" — including the one in the very first `Quick Start`
28
+ block at `README.md:25-53`. `bin/cli.js` now wraps the result correctly.
29
+ Caught by the new `test/cli/smoke.js` (Task #9 below).
30
+
31
+ - **CLI version string is no longer hardcoded.** `bin/cli.js` used to
32
+ print `SmartLedger BSV CLI v3.4.0` regardless of the actual package
33
+ version (and had no `--version` flag at all). It now reads from
34
+ `package.json` and supports `--version` / `-v` / `--help` / `-h`.
35
+
36
+ - **Library is now silent by default.** Two long-standing modules printed
37
+ on every consumer-side `require`/bundle-load: `lib/smartutxo.js` emitted
38
+ `SmartUTXO: Running in browser mode - some features may be limited`
39
+ plus 11 informational `console.log` calls (`📖 Loaded existing
40
+ blockchain state`, `💾 Saved blockchain state with N UTXOs`, etc.), and
41
+ `utilities/blockchain-state.js` added another `BlockchainState: Running
42
+ in browser mode` warn plus ~15 narration logs that fired on every
43
+ `SmartUTXO` method call. All of these are now gated behind the same
44
+ `BSV_DEBUG` flag the rest of the codebase has used since 3.4.1:
45
+ set `BSV_DEBUG=1` (Node) or `window.BSV_DEBUG = true` (browser) to
46
+ surface the diagnostics. `console.error` calls for genuine
47
+ storage/IO failures are unchanged — errors stay loud. A small fix to
48
+ `lib/smart_contract/covenant.js` does the same for the
49
+ `File system operations not available in browser environment` warn
50
+ that `.save()` emitted at call time. Verified: `require('./index.js')`
51
+ in Node is now completely silent; `require('./bsv-ltp.min.js')` /
52
+ `bsv-gdaf.min.js` / `bsv-anchor.min.js` are silent after rebuild
53
+ (will rebuild for the rest at release time via `prepublishOnly`).
54
+
55
+ - **Broken installs now fail loudly in Node instead of silently degrading.**
56
+ `index.js` previously wrapped the eager `require('bn.js')` /
57
+ `require('bs58')` / `require('elliptic')` calls in a single try/catch that
58
+ emitted `console.warn('Some dependencies may not be available in browser
59
+ environment')` and continued — so a missing runtime dep in Node (broken
60
+ `npm install`, deleted `node_modules`, container-build mistake) would let
61
+ the library load partially and then explode with a confusing
62
+ `TypeError: Cannot read properties of undefined` deep in `lib/crypto/bn.js`.
63
+ The block now hard-requires those three deps in Node (declared in
64
+ `package.json` `dependencies`, so they MUST be installed) and only
65
+ tolerates absence in browser context where the bundler is expected to
66
+ inline or polyfill them. `Buffer` and the internal `lib/util/_` continue
67
+ to be loaded the same way they always were.
68
+
69
+ - **`Transaction._clearSignatures()` no longer throws on custom-script inputs.**
70
+ When a transaction contained an input whose locking script wasn't one of the
71
+ four auto-recognized standard types (P2PKH, P2PK, bare-multisig, P2SH-multisig),
72
+ `_fromNonP2SH` falls through to the base `Input` class. Any subsequent
73
+ `Transaction` mutation that triggers `_clearSignatures` — `.fee()`, `.change()`,
74
+ adding another input, etc. — then threw `AbstractMethodInvoked: Input#clearSignatures`.
75
+ This bug existed in the upstream bsv@1.5.6 lineage and impacted users of
76
+ covenant and custom-script flows specifically. `transaction.js:_clearSignatures`
77
+ now skips inputs that haven't overridden the base method, matching the
78
+ guard-by-method-identity pattern already used for `isFullySigned` and
79
+ `isValidSignature`. The base `Input.prototype.clearSignatures` still throws
80
+ when called directly, so the original abstract-method contract is preserved.
81
+ Regression tests added in `test/transaction/transaction.js`.
82
+
83
+ ### Added
84
+
85
+ - **`test/cli/smoke.js` — end-to-end smoke test for `bin/cli.js`.** Exercises
86
+ every subcommand the README markets as the on-ramp (`didweb init`,
87
+ `vc issue`, `vc verify`, `status create` / `set` / `check`,
88
+ `anchor hash` / `build`) inside an isolated temp dir per test (13
89
+ tests, ~580ms total). Surfaced two pre-existing CLI bugs in the
90
+ process (resolver shape, hardcoded version — both fixed above). Also
91
+ available as `npm run test:cli`, and wired into the hygiene job of
92
+ `ci.yml`.
93
+
94
+ - **`.github/workflows/ci.yml` — minimal CI** that runs on push/PR to main
95
+ and is designed to catch the exact bug classes shipped in v3.4.0–v3.4.3.
96
+ Three jobs:
97
+ 1. **hygiene** (strict) — fails the build if README/docs contain stale
98
+ `unpkg.com/@smartledger/bsv@X.Y.Z/...` URLs that don't match
99
+ `package.json` version; if any `files:` array entry doesn't resolve
100
+ to a path on disk (globs expanded); if `bsv.d.ts` fails to compile
101
+ against a TS smoke file under `--strict`; or if `npm pack --dry-run`
102
+ output is missing any of `SECURITY.md` / `CHANGELOG.md` / `LICENSE`
103
+ / `README.md` / `bsv.d.ts` / `bsv.min.js`.
104
+ 2. **build** (strict) — runs `npm run build-all` and verifies all 16
105
+ advertised bundles land on disk; checks that `bsv-ltp.min.js` and
106
+ `bsv-gdaf.min.js` are not byte-identical (regression guard for the
107
+ v3.4.4 entry-placeholder fix); UMD-loads each credential bundle and
108
+ verifies its expected exports are accessible.
109
+ 3. **tests** (advisory) — runs `npm test` and `npm run lint` on Node
110
+ 18/20/22, but with `continue-on-error: true`. Will be gated strictly
111
+ after the 25 pre-existing mocha failures and standard@12 lint
112
+ baseline are cleaned up in 3.5.0 (see "Planned for 3.5.0" below).
113
+
114
+ - **`bsv.d.ts` now covers the v3.3+ surface.** The legacy type defs (forked
115
+ from the original moneybutton/bsv types) only described the bitcore-lineage
116
+ core: Transaction, Address, Script, PrivateKey, etc. Everything added in
117
+ v3.3.x and v3.4.x — `DIDWeb`, `VcJwt`, `StatusList`, `Anchor`, `GDAF`, `LTP`
118
+ (class + 60+ top-level `prepare*` and `create*` convenience wrappers),
119
+ `SmartContract` (Covenant, Preimage, SIGHASH, Builder, UTXOGenerator,
120
+ ScriptTester, CovenantBuilder, StackExaminer, ScriptInterpreter, plus
121
+ `scriptToASM`/`asmToScript`/etc.), `SmartVerify`, `EllipticFixed`, `Shamir`
122
+ (with `splitSecret`/`reconstructSecret`/`validateShare` convenience
123
+ wrappers), `BrowserUTXOManager`, and the `SmartLedger` metadata namespace
124
+ — was missing. Added with pragmatic signatures (JWK-typed where shapes are
125
+ stable; `object` / `any` where the runtime takes opaque W3C/JSON
126
+ payloads). Verified by compiling a smoke-test file that exercises every
127
+ new module against `tsc --noEmit` and `tsc --noEmit --strict` (both pass).
128
+
129
+ ### Changed (tarball hygiene)
130
+
131
+ - **`demos/` and `examples/` no longer ship in the npm tarball.** Removed
132
+ from `package.json` `files:` (they're still in the GitHub repo). Reduces
133
+ unpacked size from 11.8 MB → 11.1 MB and file count from 268 → 206
134
+ (≈23% fewer files in every consumer's `node_modules`). Rationale: Node
135
+ consumers `require('@smartledger/bsv')` and never browse those
136
+ directories; CDN consumers fetch `.min.js` files directly and never see
137
+ the tarball. `docs/` is still included — it's actively maintained,
138
+ small (0.39 MB), and useful for users grepping `node_modules` for
139
+ reference material.
140
+ - **13 relative README links to `examples/`, `demos/`, and `tests/`
141
+ rewritten to absolute GitHub URLs** so they keep resolving for anyone
142
+ reading the post-install README from inside `node_modules`. Same final
143
+ destination, just doesn't depend on the directory shipping locally.
144
+ - **CI now enforces an anti-bloat ceiling**: the hygiene job fails if the
145
+ tarball exceeds 250 files or 14 MB unpacked. Baseline after this
146
+ release: 206 files / 11.1 MB — gives ~25% headroom for normal growth.
147
+
148
+ ### Changed (documentation honesty, continued)
149
+
150
+ Further sweep of the same stale-URL bug class fixed in 3.4.2/3.4.3, plus a
151
+ companion `SECURITY.md` and a fix to two long-standing entry-file placeholders.
152
+
153
+ - **README.md**: bumped 20 stale `unpkg.com/@smartledger/bsv@3.4.1/...` and
154
+ `@3.3.4/...` CDN URLs (plus the version badge and install commands) to
155
+ `@3.4.3`. The two historical "v3.4.1 (bugfix)" prose references at the top
156
+ of the file were left intact — they accurately describe what that specific
157
+ release shipped.
158
+ - **`docs/`**: bumped 67 more stale CDN/install URLs that the 3.4.3 sweep
159
+ missed (`@3.4.2`, `@3.3.4`, `@3.1.1`) across `MODULE_REFERENCE_COMPLETE.md`,
160
+ `getting-started/INSTALLATION.md`, `getting-started/QUICK_START.md`,
161
+ `migration/FROM_BSV_1_5_6.md`, `advanced/UTXO_MANAGER_GUIDE.md`, and
162
+ `COVENANT_DEVELOPMENT_RESOLVED.md`.
163
+ - **Bundle sizes corrected** in `README.md` (loading-strategy section and
164
+ use-case table at lines 277–791), `docs/getting-started/INSTALLATION.md`,
165
+ `docs/getting-started/QUICK_START.md`, and `docs/MODULE_REFERENCE_COMPLETE.md`.
166
+ The largest drifts (silent for several releases): `bsv-covenant.min.js`
167
+ shown as 32KB in `docs/` was actually 913KB (28× off); `bsv-ltp.min.js` /
168
+ `bsv-gdaf.min.js` shown as 817KB / 604KB were both 1184KB after the
169
+ 3.4.x rebuilds. README's main loading-options table (lines 138–173) was
170
+ already accurate and was not touched. Subtotals for "load multiple
171
+ bundles together" rows now reflect that each standalone bundle re-embeds
172
+ core BSV — the previous subtotals undercounted by ignoring that overlap.
173
+ - **`SECURITY.md`** added. `package.json` `files:` had listed it since 3.4.0
174
+ but the file did not exist, so npm was silently skipping the entry (same
175
+ class of bug 3.4.1 cleaned up for the other seven dead `files:` entries).
176
+ Uses the GitHub-recognized `## Supported Versions` / `## Reporting a
177
+ Vulnerability` format, points at GitHub Security Advisories +
178
+ `hello@smartledger.technology`, and restates the same opt-in vs.
179
+ default-path posture as README §Security so it can't drift.
180
+ - **`ltp-entry.js` and `gdaf-entry.js`** were placeholders that re-exported
181
+ `lib/smart_contract`. The webpack configs built `bsv-ltp.min.js` and
182
+ `bsv-gdaf.min.js` (1.2 MB each) from these placeholders, so the UMD
183
+ `window.bsvLTP` and `window.bsvGDAF` globals advertised in the README as
184
+ "Legal Token Protocol" and "Digital Identity & Attestation" actually
185
+ exposed the smart-contract module — and the two bundles were byte-identical.
186
+ The entries now point at `./lib/ltp` and `./lib/gdaf` respectively, so the
187
+ bundles expose the `LTP` and `GDAF` classes the README documents. CDN
188
+ consumers who were calling `window.bsvLTP.<smart_contract_method>` will need
189
+ to switch to `bsv-smartcontract.min.js` or use the unbundled `@smartledger/bsv`
190
+ package — the previous behavior was not what was advertised.
191
+
192
+ ### Notes
193
+
194
+ - No public API changes beyond the LTP/GDAF UMD bundle export shape correction
195
+ noted above. All Node.js `require('@smartledger/bsv').LTP` /
196
+ `require('@smartledger/bsv').GDAF` call sites continue to resolve to the
197
+ same `lib/ltp` / `lib/gdaf` modules they always did.
198
+
199
+ ---
200
+
201
+ ## Planned for 3.5.0 — toolchain upgrade
202
+
203
+ Originally promised in 3.4.1's "Notes":
204
+
205
+ > Dev-only vulnerabilities remain in `webpack 4` / `standard 12` / `mocha 8`;
206
+ > a toolchain upgrade is planned for 3.5.0 to address them without breaking
207
+ > downstream bundler integrations.
208
+
209
+ This is the fleshed-out plan for that release. **It does not affect 3.4.x
210
+ runtime behavior; it's a build/test/lint stack migration.** Tracking it here
211
+ in `[Unreleased]` keeps the commitment auditable from the changelog rather
212
+ than a side document.
213
+
214
+ ### Audit baseline (as of v3.4.3)
215
+
216
+ `npm audit` reports **15 high / 9 moderate / 10 low**. All but two are
217
+ strictly dev-chain (webpack 4 / mocha 8 / nyc 14 / standard 12 transitives):
218
+
219
+ - The lone direct runtime entry is **`bn.js` (moderate)** — pinned at
220
+ `=4.11.9` because `elliptic@6.6.1` requires bn.js 4.x. A direct bump to
221
+ `bn.js@5.x` is not safe in isolation; see "Runtime dependency decisions"
222
+ below.
223
+ - **`elliptic` appears in the low list** but is already at upstream's latest
224
+ (6.6.1). The advisory comes via webpack 4's obsolete
225
+ `node-libs-browser → crypto-browserify → browserify-sign → elliptic`
226
+ polyfill chain, which webpack 5 deletes entirely. So bumping webpack to 5
227
+ drops this advisory automatically, no code change required.
228
+
229
+ ### Tooling target versions
230
+
231
+ | Tool | Current | Target | Why |
232
+ | --- | --- | --- | --- |
233
+ | `webpack` | `4.29.3` | `^5.100` | Eliminates the entire `node-libs-browser` polyfill chain (= source of most HIGH vulns), supports modern asset modules, fixes `terser-webpack-plugin` advisory |
234
+ | `webpack-cli` | `^3.3.12` | `^5` or `^6` | Matched to webpack 5; webpack-cli 7 also works but tightens validation |
235
+ | `mocha` | `^8.4.0` | `^10.x` | Mocha 11 requires Node 18+; 10 supports Node 14+. Picking 10 keeps a wider engines window |
236
+ | `nyc` | `^14.1.1` | `^17` or migrate to `c8` | nyc 17 is Node 14+ compatible. Alternative: drop nyc for `c8` (lighter, uses native V8 coverage) |
237
+ | `sinon` | `7.2.3` | `^17.x` | sinon 18+ requires Node 18+. 17 covers Node 14+ |
238
+ | `chai` | `4.2.0` | `4.5.x` (LTS) | **Stay on chai 4.x.** chai 5+ went ESM-only — switching means rewriting `require('chai')` everywhere or migrating the test suite to ESM. Not worth bundling into a toolchain release. |
239
+ | `standard` | `12.0.1` | `^17` or replace | standard 17 uses ESLint 8 (now stale itself); standard 18+ requires Node 18. Open question: stay on `standard`, or move to `eslint@9` + flat config + a smaller rule set. See "Linter decision" below. |
240
+ | `brfs` | `2.0.1` | `2.0.2` | Trivial patch bump |
241
+
242
+ ### Runtime dependency decisions (keep / bump / shim)
243
+
244
+ | Dep | Pin | Latest | Decision |
245
+ | --- | --- | --- | --- |
246
+ | `elliptic` | `6.6.1` | `6.6.1` | **Keep.** Already current. |
247
+ | `bn.js` | `=4.11.9` | `5.2.3` | **Keep at 4.x.** Bumping breaks elliptic; the moderate vuln (constant-time concern in some older 4.x) is mitigated by callers in `lib/crypto/`. Add a comment in `package.json` pinning rationale. |
248
+ | `bs58` | `=4.0.1` | `6.0.0` | **Keep at 4.x.** `bs58@5+` is ESM-only and would force a CJS→ESM migration of `lib/encoding/base58.js`. Out of scope for 3.5.0. |
249
+ | `inherits` | `2.0.3` | `2.0.4` | **Bump to 2.0.4.** Trivial. |
250
+ | `unorm` | `1.4.1` | `1.6.0` | **Bump to 1.6.0.** Non-breaking. |
251
+ | `aes-js` | `^3.1.2` | `3.1.2` | **No change.** |
252
+ | `clone-deep` | `^4.0.1` | `4.0.1` | **No change.** |
253
+ | `hash.js` | `^1.1.7` | `1.1.7` | **No change.** |
254
+
255
+ ### Required code / config changes
256
+
257
+ 1. **`build/webpack.*.config.js` (12 files).** webpack 5 removes the
258
+ automatic Node polyfills that webpack 4 silently injects. Concrete
259
+ touches needed:
260
+ - Add `resolve.fallback` entries for `buffer`, `crypto`, `stream`,
261
+ `process` (or use `node-polyfill-webpack-plugin`).
262
+ - Add `buffer`, `process`, `stream-browserify`, `crypto-browserify`
263
+ (or modern equivalents) as **dev**-deps so the fallbacks resolve.
264
+ - `output.library` ideally migrates from string to object form
265
+ (`{ name: 'bsvFoo', type: 'umd' }`) — webpack 5 still accepts the
266
+ string form but warns.
267
+ - `globalObject: 'this'` should become `globalObject: 'globalThis'`
268
+ (cleaner; matches modern targets).
269
+ - Drop `NODE_OPTIONS="--openssl-legacy-provider"` from all 16 `npm run
270
+ build-*` scripts — that workaround exists *because* webpack 4 pins
271
+ legacy OpenSSL APIs. webpack 5 doesn't need it.
272
+
273
+ 2. **`test/mocha.opts` → `.mocharc.cjs` (or `mocha` field in package.json).**
274
+ Mocha 8 already emits a deprecation warning for `mocha.opts`; mocha 10
275
+ removes support entirely. Migrate the existing two flags
276
+ (`--recursive`, `--timeout 5000`) and add `--reporter spec`.
277
+
278
+ 3. **`engines` field in `package.json`.** No engines is declared today.
279
+ For 3.5.0 add `"engines": { "node": ">=14" }` (or `>=18` if we also
280
+ adopt mocha 11 / sinon 18 / standard 18). Current consumer test
281
+ environments span Node 14–22, so `>=14` is the safer choice.
282
+
283
+ 4. **`@types/node` peer dep or dev-dep.** With the typing fix in 3.4.4,
284
+ `bsv.d.ts` formally depends on Node types (`/// <reference types="node" />`).
285
+ Add `"peerDependencies": { "@types/node": "*" }` (optional) or document
286
+ in README that TS consumers need `@types/node` installed.
287
+
288
+ 5. **Linter decision (open question).**
289
+ Option A — Stay on `standard@17`: 1-line bump, ~1 day to fix new lint
290
+ errors. Risk: standard's own toolchain is aging.
291
+ Option B — Migrate to ESLint flat config (`eslint.config.js`) with a
292
+ custom rule set. More work, but unblocks long-term flexibility and the
293
+ newer rule engine.
294
+ **Recommendation:** A for 3.5.0, defer B to 3.6.0.
295
+
296
+ ### Risk ranking and rollout order
297
+
298
+ Each step should be its own PR, validated against the full `test/` suite
299
+ (120+ mocha tests passed in 3.4.4) and a `npm pack --dry-run` size diff.
300
+
301
+ 1. **Low risk:** `inherits` / `unorm` patch bumps, `brfs 2.0.1 → 2.0.2`,
302
+ add `engines` field, migrate `mocha.opts → .mocharc.cjs`.
303
+ 2. **Medium risk:** mocha 8 → 10, nyc 14 → 17, sinon 7 → 17, standard
304
+ 12 → 17. Test suite may have lint/test syntax regressions.
305
+ 3. **Higher risk:** webpack 4 → 5. This is the bundle-shape change;
306
+ downstream CDN consumers will see different file bytes. Plan a beta
307
+ release (`3.5.0-beta.1`) on npm before the GA bump so integrators can
308
+ validate.
309
+ 4. **Out of scope, deferred:** `bn.js 4 → 5`, `bs58 4 → 6`, `chai 4 → 5`,
310
+ linter overhaul. These all imply CJS→ESM or coordinated upstream
311
+ changes and warrant a separate 3.6.0 effort.
312
+
313
+ ### Pre-release validation checklist
314
+
315
+ Before publishing `3.5.0`:
316
+
317
+ - `npm test` passes (Node 18, 20, 22).
318
+ - `npm run build-all` succeeds without `NODE_OPTIONS` workaround.
319
+ - All 16 bundles built and:
320
+ - sized within 5% of 3.4.x equivalents (or sizes updated in README/docs);
321
+ - smoke-tested in a browser via `tests/*.html` against the unpkg URL;
322
+ - UMD globals (`window.bsv`, `bsvLTP`, `bsvGDAF`, etc.) resolve correctly.
323
+ - `npm audit` shows zero high/critical, ≤ 5 moderate (any remaining moderates
324
+ documented in CHANGELOG with mitigation).
325
+ - `tsc --noEmit --strict` against `bsv.d.ts` + smoke file still passes.
326
+ - Tag `3.5.0-beta.1` on npm for at least 7 days to let integrators report
327
+ bundle regressions before GA.
328
+
329
+ ## [3.4.3] - 2026-05-18
330
+
331
+ ### Changed (documentation honesty, continued)
332
+
333
+ Companion to 3.4.2. The README was corrected in 3.4.2 but several shipped docs in `docs/` still contained the same overclaims and stale `@3.3.4` CDN URLs that would 404 for users upgrading from 3.4.0+.
334
+
335
+ - **`docs/migration/FROM_BSV_1_5_6.md`**: replaced "Now with hardened elliptic curves" comment on `new bsv.PrivateKey()` and the "Enhanced Security under the hood" framing with accurate "standard API behaves identically; opt-in hardening helpers available — call `bsv.SmartVerify.smartVerify()` explicitly" wording.
336
+ - **`docs/getting-started/QUICK_START.md`**: replaced "Elliptic curve hardening - Enhanced cryptographic security" bullet with accurate description of the opt-in helpers + pinned-dependency facts.
337
+ - **`docs/advanced/LEGAL_TOKEN_PROTOCOL.md`**: corrected three places that claimed LTP tokens are "signed with hardened crypto" / "enhanced elliptic curves". Token signing uses BSV's standard ECDSA path; `SmartVerify` is opt-in for verification.
338
+ - **`docs/MODULE_REFERENCE_COMPLETE.md`** and **`docs/getting-started/INSTALLATION.md`**: bumped 15+ stale `unpkg.com/@smartledger/bsv@3.3.4/...` URLs to `@3.4.2` (those URLs were 404'ing for anyone copy-pasting from these guides); corrected `bsv-security.min.js` size from `290KB` to `26KB` (10× off); labeled "opt-in helpers" with link to the canonical Security section in README.
339
+
340
+ ### Notes
341
+
342
+ - No code or bundle behavior changes. This is a docs-only correction; bundles are rebuilt purely because the version string is embedded.
343
+
344
+ ## [3.4.2] - 2026-05-18
345
+
346
+ ### Changed (documentation honesty)
347
+
348
+ - **README Security section rewritten** to accurately describe what hardening ships and what is opt-in vs. on by default.
349
+ - `bsv.SmartVerify` and `bsv.EllipticFixed` are **opt-in helpers**; the default `transaction.verify()` / `signature.verify()` / `Message().verify()` paths do **not** route through them.
350
+ - `lib/crypto/ecdsa.js` (the default verify path) uses BSV's own pure-JS ECDSA and does not import the elliptic library at all.
351
+ - `elliptic@6.6.1` is the upstream-patched current release; SmartLedger does not patch elliptic's source. The patches in `lib/crypto/elliptic-fixed.js` add input validation on top of an already-patched elliptic.
352
+ - Added a usage example showing how to call `SmartVerify.smartVerify(...)` explicitly.
353
+ - **`index.js`**: added a doc comment above `bsv.isHardened` / `bsv.securityFeatures` clarifying these advertise that hardening helpers ship — not that they are wired into the default path. API surface unchanged.
354
+
355
+ ### Notes
356
+
357
+ - No code behavior changes. All `bsv.*` properties and methods continue to work exactly as before.
358
+ - 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.
359
+
360
+ ## [3.4.1] - 2026-05-18
361
+
362
+ ### Fixed
363
+
364
+ - **Credential bundles now actually ship.** `bsv-didweb.min.js`, `bsv-vcjwt.min.js`, `bsv-statuslist.min.js`, and `bsv-anchor.min.js` were missing from the `files:` allowlist in 3.4.0, so they were never included in the published npm tarball even though the README advertised them.
365
+ - **`prepublishOnly` now builds every advertised bundle.** Previously it ran `npm run build`, which only produced 6 of the ~16 bundles. It now runs `npm run build-all`, so credential, covenant, ltp, gdaf, and other specialized bundles can't go out of sync with source at publish time.
366
+ - **CSPRNG-backed `Transaction.shuffleOutputs()`.** `lib/util/_.js` `_.shuffle` now draws entropy from `bsv.crypto.Random` (Node `crypto.randomBytes` / `window.crypto.getRandomValues`) instead of `Math.random`. Output ordering is a privacy primitive; a predictable PRNG defeated the purpose.
367
+ - **`Transaction._fromMultisigUtxo` returns a real error.** A reachable `throw new Error('@TODO')` for unsupported script types now throws `errors.Transaction.Input.UnsupportedScript` with the offending script in the message.
368
+ - **Module load failures surface in Node.** The `try/catch` blocks around optional modules (`DIDWeb`, `VcJwt`, `StatusList`, `Anchor`, `BrowserUTXOManager`) in `index.js` previously swallowed all errors. They now `console.warn` in Node and stay silent in the browser, so upgrade breakage is visible.
369
+
370
+ ### Changed
371
+
372
+ - **`tests/` no longer ships to npm consumers.** The directory of HTML demo pages and 5 orphan standalone scripts is removed from `package.json` `files:` and added to `.npmignore`.
373
+ - **`utilities/blockchain-state.json` (3.2MB) no longer ships.** Mock blockchain data added to `.npmignore`; not needed at install time.
374
+ - **Browser UTXO manager logs are gated.** `lib/browser-utxo-manager.js` and `lib/browser-utxo-manager-es5.js` info-level `console.log` calls now require `BSV_DEBUG=1` (Node) or `window.BSV_DEBUG = true` (browser). `console.warn`/`console.error` unchanged.
375
+ - **Orphan scripts moved out of `lib/` and `tests/`.** `lib/smart_contract/test_integration.js` (an integration script that called `process.exit`) plus 5 pre-mocha scripts from `tests/` moved to `examples/legacy/`.
376
+ - **`package-lock.json` is now committed.** Removed from `.gitignore` so `npm audit` and reproducible installs work.
377
+ - **Dead `files:` entries removed.** Seven file references in `package.json` `files:` pointed to files that don't exist; npm silently skipped them. Removed.
378
+
379
+ ### Notes
380
+
381
+ - No public API changes. All call sites continue to work.
382
+ - Dev-only vulnerabilities remain in `webpack 4` / `standard 12` / `mocha 8`; a toolchain upgrade is planned for 3.5.0 to address them without breaking downstream bundler integrations.
383
+
384
+ ## [3.4.0] - 2025-11-09
385
+
386
+ ### Added
387
+
388
+ - **DID:web module** (`bsv.DIDWeb`, `bsv-didweb.min.js`): W3C DID Core `did:web` method generation with both ES256 (NIST P-256) and ES256K (Bitcoin secp256k1) key types.
389
+ - **VC-JWT module** (`bsv.VcJwt`, `bsv-vcjwt.min.js`): W3C Verifiable Credentials issuance and verification as JWT (RFC 7515 / RFC 7519 compliant).
390
+ - **StatusList2021 module** (`bsv.StatusList`, `bsv-statuslist.min.js`): credential revocation supporting 100k credentials per list.
391
+ - **Anchor module** (`bsv.Anchor`, `bsv-anchor.min.js`): privacy-preserving SHA-256 hash-only anchoring helpers for BSV.
392
+ - **CLI tooling** (`bin/cli.js`): `didweb`, `vc`, `status`, `anchor` subcommands.
393
+ - Quickstart examples and updated module tables in the README.
394
+
395
+ ### Standards Compliance
396
+
397
+ - W3C Verifiable Credentials Data Model
398
+ - W3C DID Core (`did:web` method)
399
+ - RFC 7515 (JWS), RFC 7519 (JWT)
400
+ - StatusList2021 specification
401
+ - NIST P-256 and Bitcoin secp256k1 curves
402
+
403
+ ### Known Issues (fixed in 3.4.1)
404
+
405
+ - The four new credential bundles were not listed in `package.json` `files:`, so they did not ship to npm consumers despite being advertised in the README.
406
+ - `prepublishOnly` only built the core 6 bundles, not the credential set.
407
+
8
408
  ## [3.3.4] - 2025-10-31
9
409
 
10
410
  ### Fixed