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