@bsv/wallet-toolbox 2.1.6 → 2.1.8

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 (80) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +111 -28
  3. package/docs/client.md +146 -224
  4. package/docs/services.md +64 -28
  5. package/docs/storage.md +2 -22
  6. package/docs/wallet.md +146 -224
  7. package/out/src/Wallet.js +3 -3
  8. package/out/src/Wallet.js.map +1 -1
  9. package/out/src/WalletPermissionsManager.d.ts.map +1 -1
  10. package/out/src/WalletPermissionsManager.js +35 -36
  11. package/out/src/WalletPermissionsManager.js.map +1 -1
  12. package/out/src/__tests/ShamirWalletManager.test.js +4 -4
  13. package/out/src/__tests/ShamirWalletManager.test.js.map +1 -1
  14. package/out/src/mockchain/MockMiner.d.ts.map +1 -1
  15. package/out/src/mockchain/MockMiner.js +2 -1
  16. package/out/src/mockchain/MockMiner.js.map +1 -1
  17. package/out/src/mockchain/MockServices.d.ts.map +1 -1
  18. package/out/src/mockchain/MockServices.js +2 -1
  19. package/out/src/mockchain/MockServices.js.map +1 -1
  20. package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
  21. package/out/src/sdk/PrivilegedKeyManager.js +3 -1
  22. package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
  23. package/out/src/services/chaintracker/chaintracks/ChaintracksService.d.ts.map +1 -1
  24. package/out/src/services/chaintracker/chaintracks/ChaintracksService.js +1 -0
  25. package/out/src/services/chaintracker/chaintracks/ChaintracksService.js.map +1 -1
  26. package/out/src/services/chaintracker/chaintracks/Ingest/__tests/WhatsOnChainServices.man.test.js +1 -1
  27. package/out/src/services/chaintracker/chaintracks/Ingest/__tests/WhatsOnChainServices.man.test.js.map +1 -1
  28. package/out/src/services/chaintracker/chaintracks/__tests/createIdbChaintracks.test.js +3 -8
  29. package/out/src/services/chaintracker/chaintracks/__tests/createIdbChaintracks.test.js.map +1 -1
  30. package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.d.ts +22 -0
  31. package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.d.ts.map +1 -0
  32. package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.js +54 -0
  33. package/out/src/services/chaintracker/chaintracks/configureChaintracksIngestors.js.map +1 -0
  34. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts.map +1 -1
  35. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js +3 -42
  36. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js.map +1 -1
  37. package/out/src/services/chaintracker/chaintracks/createDefaultKnexChaintracksOptions.d.ts.map +1 -1
  38. package/out/src/services/chaintracker/chaintracks/createDefaultKnexChaintracksOptions.js +2 -41
  39. package/out/src/services/chaintracker/chaintracks/createDefaultKnexChaintracksOptions.js.map +1 -1
  40. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts.map +1 -1
  41. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js +3 -42
  42. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js.map +1 -1
  43. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts +2 -20
  44. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +1 -1
  45. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +5 -55
  46. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +1 -1
  47. package/out/src/storage/StorageIdb.js +2 -2
  48. package/out/src/storage/StorageIdb.js.map +1 -1
  49. package/out/src/storage/WalletStorageManager.d.ts +1 -15
  50. package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
  51. package/out/src/storage/WalletStorageManager.js +0 -53
  52. package/out/src/storage/WalletStorageManager.js.map +1 -1
  53. package/out/src/storage/__test/getBeefForTransaction.test.js +49 -2
  54. package/out/src/storage/__test/getBeefForTransaction.test.js.map +1 -1
  55. package/out/src/storage/methods/__test/offsetKey.test.js +133 -286
  56. package/out/src/storage/methods/__test/offsetKey.test.js.map +1 -1
  57. package/out/src/storage/methods/createAction.js +4 -2
  58. package/out/src/storage/methods/createAction.js.map +1 -1
  59. package/out/src/storage/methods/generateChange.d.ts.map +1 -1
  60. package/out/src/storage/methods/generateChange.js +15 -14
  61. package/out/src/storage/methods/generateChange.js.map +1 -1
  62. package/out/src/storage/remoting/__test/StorageClient.man.test.js +0 -1
  63. package/out/src/storage/remoting/__test/StorageClient.man.test.js.map +1 -1
  64. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +10 -3
  65. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -1
  66. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +34 -1
  67. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -1
  68. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.d.ts +1 -19
  69. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.d.ts.map +1 -1
  70. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.js +0 -52
  71. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.js.map +1 -1
  72. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts +1 -3
  73. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts.map +1 -1
  74. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js +0 -24
  75. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js.map +1 -1
  76. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts +1 -19
  77. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts.map +1 -1
  78. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js +0 -52
  79. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js.map +1 -1
  80. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,19 @@ This document captures the history of significant changes to the wallet-toolbox
4
4
  The git commit history contains the details but is unable to draw
5
5
  attention to changes that materially alter behavior or extend functionality.
6
6
 
7
+ ## wallet-toolbox 2.1.8
8
+
9
+ - Drop no longer required verifyAndRepairBeef method
10
+ - Simplify collectCommission tests in offsetKey.test.ts
11
+ - Remove duplicate BulkFileDataReader class.
12
+ - Reorg createDefault*ChaintracksOptions to reduce duplicated code.
13
+ - Reorg auth-method-interactors
14
+ - Flip waitForAuthentication grouped permission request event (now first) and activation (now second)
15
+
16
+ ## wallet-toolbox 2.1.7
17
+
18
+ - Sonarqube recommended changes...
19
+
7
20
  ## wallet-toolbox 2.1.6
8
21
 
9
22
  - Improve change-making algorithm: cap change outputs per transaction to 8 (gradual UTXO pool build-up, smaller BEEFs). Enforce dynamic dust floor so no change output is worth less than 2× the fee to spend it.
package/README.md CHANGED
@@ -1,43 +1,126 @@
1
- # BSV WALLET TOOLBOX
1
+ # BSV Wallet Toolbox
2
+
3
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/bsv-blockchain/wallet-toolbox/push.yaml?branch=master&label=build)](https://github.com/bsv-blockchain/wallet-toolbox/actions)
4
+ [![npm version](https://img.shields.io/npm/v/@bsv/wallet-toolbox)](https://www.npmjs.com/package/@bsv/wallet-toolbox)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@bsv/wallet-toolbox)](https://www.npmjs.com/package/@bsv/wallet-toolbox)
6
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bsv-blockchain_wallet-toolbox&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=bsv-blockchain_wallet-toolbox)
7
+ [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=bsv-blockchain_wallet-toolbox&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=bsv-blockchain_wallet-toolbox)
8
+ [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=bsv-blockchain_wallet-toolbox&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=bsv-blockchain_wallet-toolbox)
9
+ [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=bsv-blockchain_wallet-toolbox&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=bsv-blockchain_wallet-toolbox)
10
+ [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=bsv-blockchain_wallet-toolbox&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=bsv-blockchain_wallet-toolbox)
11
+ [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=bsv-blockchain_wallet-toolbox&metric=bugs)](https://sonarcloud.io/summary/new_code?id=bsv-blockchain_wallet-toolbox)
12
+ [![CodeQL](https://github.com/bsv-blockchain/wallet-toolbox/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/bsv-blockchain/wallet-toolbox/actions/workflows/github-code-scanning/codeql)
13
+ [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=bsv-blockchain_wallet-toolbox&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=bsv-blockchain_wallet-toolbox)
14
+ [![License](https://img.shields.io/github/license/bsv-blockchain/wallet-toolbox)](./LICENSE.txt)
15
+
16
+ A [BRC-100](https://github.com/bitcoin-sv/BRCs/blob/master/wallet/0100.md) conforming wallet implementation for the BSV blockchain, built on the [BSV SDK](https://bsv-blockchain.github.io/ts-sdk). Provides persistent storage, protocol-based key derivation, transaction monitoring, chain tracking, and signing — everything needed to build wallet-powered applications on BSV.
17
+
18
+ ## Overview
19
+
20
+ The Wallet Toolbox is the reference implementation of the BRC-100 wallet interface. It connects the BSV SDK's cryptographic primitives to real storage backends, network services, and signing flows so that application developers don't have to wire these layers together themselves.
21
+
22
+ ### What's Inside
23
+
24
+ | Module | Description |
25
+ |--------|-------------|
26
+ | **Wallet** | Full BRC-100 wallet — action creation, signing, certificate management, identity discovery, output tracking |
27
+ | **Storage** | Pluggable persistence with three backends: **SQLite/MySQL** (via Knex), **IndexedDB** (browser/mobile), and **remote** (client/server over HTTP) |
28
+ | **Services** | Network layer — ARC transaction broadcasting, chain tracking (Chaintracks), merkle proof verification, UTXO lookups via WhatsOnChain |
29
+ | **Monitor** | Background daemon that watches pending transactions, rebroadcasts failures, handles chain reorganizations, and manages proof acquisition |
30
+ | **Signer** | `WalletSigner` bridges any BRC-100 wallet to the SDK's `Transaction` signing interface |
31
+ | **Key Management** | `PrivilegedKeyManager` for secure key storage with Shamir secret sharing and obfuscation; protocol-based key derivation per BRC-42/43 |
32
+ | **Permissions** | `WalletPermissionsManager` for fine-grained per-app, per-protocol permission control with grouped approval flows |
33
+ | **MockChain** | In-memory blockchain for testing — mock mining, UTXO tracking, and merkle proof generation without a network |
34
+ | **Entropy** | `EntropyCollector` gathers mouse/touch entropy for high-quality randomness in browser environments |
35
+
36
+ ### Packages
37
+
38
+ The toolbox publishes three npm packages from this repo:
39
+
40
+ - **[`@bsv/wallet-toolbox`](https://www.npmjs.com/package/@bsv/wallet-toolbox)** — Full package with all storage backends (SQLite, MySQL, IndexedDB, remote)
41
+ - **[`@bsv/wallet-toolbox-client`](https://www.npmjs.com/package/@bsv/wallet-toolbox-client)** — Browser build; excludes Node-only backends (Knex/SQLite/MySQL)
42
+ - **[`@bsv/wallet-toolbox-mobile`](https://www.npmjs.com/package/@bsv/wallet-toolbox-mobile)** — Mobile build; IndexedDB and remote storage only
43
+
44
+ ## Getting Started
45
+
46
+ ### Installation
47
+
48
+ ```bash
49
+ # Full (Node.js servers, CLIs)
50
+ npm install @bsv/wallet-toolbox
51
+
52
+ # Browser apps
53
+ npm install @bsv/wallet-toolbox-client
54
+
55
+ # React Native / mobile
56
+ npm install @bsv/wallet-toolbox-mobile
57
+ ```
58
+
59
+ ### Quick Example
60
+
61
+ ```typescript
62
+ import { SetupWallet } from '@bsv/wallet-toolbox'
63
+
64
+ // Create a wallet with SQLite storage and default mainnet services
65
+ const wallet = await SetupWallet({
66
+ env: 'main',
67
+ endpointUrl: 'https://your-storage-server.example.com'
68
+ })
69
+
70
+ // Create a transaction
71
+ const result = await wallet.createAction({
72
+ description: 'Send payment',
73
+ outputs: [{
74
+ lockingScript: '76a914...88ac',
75
+ satoshis: 1000,
76
+ outputDescription: 'payment'
77
+ }]
78
+ })
79
+ ```
2
80
 
3
- BSV BLOCKCHAIN | BRC100 Conforming Wallet, Wallet Storage and Wallet Signer Components
4
-
5
- ## Objective
6
-
7
- The BSV Wallet Toolbox builds on the [SDK](https://bsv-blockchain.github.io/ts-sdk).
8
-
9
- It aims to support building sophisticated applications and services on the BSV Blockchain technology stack.
81
+ ## Documentation
10
82
 
11
- By providing interlocking building blocks for persistent storage and protocol based key derivation, it serves as an essential toolbox for developers looking to build on the BSV Blockchain.
83
+ [Full API documentation](https://bsv-blockchain.github.io/wallet-toolbox) is available on GitHub Pages.
12
84
 
13
- ## Documentation
85
+ The codebase has detailed JSDoc annotations throughout — these will surface inline in editors like VS Code.
14
86
 
15
- [The Docs](https://bsv-blockchain.github.io/wallet-toolbox) are available here on Github pages.
87
+ ## Development
16
88
 
17
- The Toolbox is richly documented with code-level annotations. This should show up well within editors like VSCode.
89
+ ```bash
90
+ git clone https://github.com/bsv-blockchain/wallet-toolbox.git
91
+ cd wallet-toolbox
92
+ npm install
93
+ npm run build
94
+ npm test
95
+ ```
18
96
 
19
- ## Contribution Guidelines
97
+ Tests use Jest. Files named `*.man.test.ts` are manual/integration tests excluded from CI — they require network access or long runtimes and are run locally by developers.
20
98
 
21
- We're always looking for contributors to help us improve the SDK. Whether it's bug reports, feature requests, or pull requests - all contributions are welcome.
99
+ ## Contributing
22
100
 
23
- 1. **Fork & Clone**: Fork this repository and clone it to your local machine.
24
- 2. **Set Up**: Run `npm install` to install all dependencies.
25
- 3. **Make Changes**: Create a new branch and make your changes.
26
- 4. **Test**: Ensure all tests pass by running `npm test`.
27
- 5. **Commit**: Commit your changes and push to your fork.
28
- 6. **Pull Request**: Open a pull request from your fork to this repository.
29
- For more details, check the [contribution guidelines](./CONTRIBUTING.md).
101
+ We welcome bug reports, feature requests, and pull requests.
30
102
 
31
- ## Support & Contacts
103
+ 1. Fork and clone the repository
104
+ 2. `npm install`
105
+ 3. Create a feature branch
106
+ 4. Make your changes and ensure `npm test` passes
107
+ 5. Open a pull request
32
108
 
33
- Project Owners: Thomas Giacomo and Darren Kellenschwiler
109
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for full guidelines.
34
110
 
35
- Development Team Lead: Ty Everett
111
+ ## Contributors
36
112
 
37
- For questions, bug reports, or feature requests, please open an issue on GitHub or contact us directly.
113
+ | | Name | GitHub | Role |
114
+ |---|------|--------|------|
115
+ | | Tone Engel | [@tonesnotes](https://github.com/tonesnotes) | Lead developer, maintainer |
116
+ | | Darren Kellenschwiler | [@sirdeggen](https://github.com/sirdeggen) | Core contributor |
117
+ | | Brayden Langley | [@BraydenLangley](https://github.com/BraydenLangley) | Core contributor |
118
+ | | Ty Everett | [@ty-everett](https://github.com/ty-everett) | Core contributor, reviewer |
119
+ | | Jackie Lu | [@jackielu3](https://github.com/jackielu3) | Contributor |
120
+ | | David Case | [@shruggr](https://github.com/shruggr) | Contributor |
121
+ | | Stephen Thomson | [@Stephen-Thomson](https://github.com/Stephen-Thomson) | Contributor |
122
+ | | Chance Barimbao | [@ChanceBarimbao](https://github.com/ChanceBarimbao) | Contributor |
38
123
 
39
124
  ## License
40
125
 
41
- The license for the code in this repository is the Open BSV License. Refer to [LICENSE.txt](./LICENSE.txt) for the license text.
42
-
43
- Thank you for being a part of the BSV Blockchain Libraries Project. Let's build the future of BSV Blockchain together!
126
+ Released under the [Open BSV License](./LICENSE.txt).