@bsv/wallet-toolbox 1.1.0
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/.env.template +22 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- package/.github/ISSUE_TEMPLATE/discussion.md +24 -0
- package/.github/pull_request_template.md +24 -0
- package/.github/workflows/push.yaml +66 -0
- package/.prettierrc +10 -0
- package/CONTRIBUTING.md +89 -0
- package/LICENSE.txt +28 -0
- package/README.md +124 -0
- package/dev.sqlite3 +0 -0
- package/docs/README.md +15 -0
- package/docs/client.md +6812 -0
- package/docs/monitor.md +648 -0
- package/docs/services.md +496 -0
- package/docs/storage.md +1884 -0
- package/docs/wallet.md +6812 -0
- package/jest.config.ts +29 -0
- package/knexfile.js +9 -0
- package/license.md +1 -0
- package/out/src/Wallet.d.ts +83 -0
- package/out/src/Wallet.d.ts.map +1 -0
- package/out/src/Wallet.js +415 -0
- package/out/src/Wallet.js.map +1 -0
- package/out/src/index.all.d.ts +9 -0
- package/out/src/index.all.d.ts.map +1 -0
- package/out/src/index.all.js +48 -0
- package/out/src/index.all.js.map +1 -0
- package/out/src/index.client.d.ts +8 -0
- package/out/src/index.client.d.ts.map +1 -0
- package/out/src/index.client.js +47 -0
- package/out/src/index.client.js.map +1 -0
- package/out/src/index.d.ts +3 -0
- package/out/src/index.d.ts.map +1 -0
- package/out/src/index.js +42 -0
- package/out/src/index.js.map +1 -0
- package/out/src/monitor/Monitor.d.ts +89 -0
- package/out/src/monitor/Monitor.d.ts.map +1 -0
- package/out/src/monitor/Monitor.js +253 -0
- package/out/src/monitor/Monitor.js.map +1 -0
- package/out/src/monitor/MonitorDaemon.d.ts +30 -0
- package/out/src/monitor/MonitorDaemon.d.ts.map +1 -0
- package/out/src/monitor/MonitorDaemon.js +135 -0
- package/out/src/monitor/MonitorDaemon.js.map +1 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.d.ts +2 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.d.ts.map +1 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.js +50 -0
- package/out/src/monitor/__test/MonitorDaemon.man.test.js.map +1 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +53 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.js +197 -0
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -0
- package/out/src/monitor/tasks/TaskClock.d.ts +14 -0
- package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskClock.js +27 -0
- package/out/src/monitor/tasks/TaskClock.js.map +1 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +20 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.js +52 -0
- package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -0
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +15 -0
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskNewHeader.js +45 -0
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -0
- package/out/src/monitor/tasks/TaskPurge.d.ts +45 -0
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskPurge.js +35 -0
- package/out/src/monitor/tasks/TaskPurge.js.map +1 -0
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts +26 -0
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskReviewStatus.js +44 -0
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -0
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +32 -0
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskSendWaiting.js +99 -0
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts +12 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts.map +1 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js +22 -0
- package/out/src/monitor/tasks/TaskSyncWhenIdle.js.map +1 -0
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts +40 -0
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -0
- package/out/src/monitor/tasks/WalletMonitorTask.js +37 -0
- package/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -0
- package/out/src/sdk/CertOps.d.ts +66 -0
- package/out/src/sdk/CertOps.d.ts.map +1 -0
- package/out/src/sdk/CertOps.js +198 -0
- package/out/src/sdk/CertOps.js.map +1 -0
- package/out/src/sdk/PrivilegedKeyManager.d.ts +125 -0
- package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -0
- package/out/src/sdk/PrivilegedKeyManager.js +293 -0
- package/out/src/sdk/PrivilegedKeyManager.js.map +1 -0
- package/out/src/sdk/StorageSyncReader.d.ts +121 -0
- package/out/src/sdk/StorageSyncReader.d.ts.map +1 -0
- package/out/src/sdk/StorageSyncReader.js +3 -0
- package/out/src/sdk/StorageSyncReader.js.map +1 -0
- package/out/src/sdk/StorageSyncReaderWriter.d.ts +89 -0
- package/out/src/sdk/StorageSyncReaderWriter.d.ts.map +1 -0
- package/out/src/sdk/StorageSyncReaderWriter.js +3 -0
- package/out/src/sdk/StorageSyncReaderWriter.js.map +1 -0
- package/out/src/sdk/WERR_errors.d.ts +90 -0
- package/out/src/sdk/WERR_errors.d.ts.map +1 -0
- package/out/src/sdk/WERR_errors.js +128 -0
- package/out/src/sdk/WERR_errors.js.map +1 -0
- package/out/src/sdk/WalletError.d.ts +45 -0
- package/out/src/sdk/WalletError.d.ts.map +1 -0
- package/out/src/sdk/WalletError.js +122 -0
- package/out/src/sdk/WalletError.js.map +1 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts +325 -0
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletServices.interfaces.js +3 -0
- package/out/src/sdk/WalletServices.interfaces.js.map +1 -0
- package/out/src/sdk/WalletSigner.interfaces.d.ts +10 -0
- package/out/src/sdk/WalletSigner.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletSigner.interfaces.js +3 -0
- package/out/src/sdk/WalletSigner.interfaces.js.map +1 -0
- package/out/src/sdk/WalletStorage.interfaces.d.ts +299 -0
- package/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -0
- package/out/src/sdk/WalletStorage.interfaces.js +3 -0
- package/out/src/sdk/WalletStorage.interfaces.js.map +1 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.d.ts +2 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.d.ts.map +1 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.js +125 -0
- package/out/src/sdk/__test/CertificateLifeCycle.test.js.map +1 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.d.ts +2 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.d.ts.map +1 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js +660 -0
- package/out/src/sdk/__test/PrivilegedKeyManager.test.js.map +1 -0
- package/out/src/sdk/index.d.ts +12 -0
- package/out/src/sdk/index.d.ts.map +1 -0
- package/out/src/sdk/index.js +28 -0
- package/out/src/sdk/index.js.map +1 -0
- package/out/src/sdk/types.d.ts +74 -0
- package/out/src/sdk/types.d.ts.map +1 -0
- package/out/src/sdk/types.js +20 -0
- package/out/src/sdk/types.js.map +1 -0
- package/out/src/sdk/validationHelpers.d.ts +288 -0
- package/out/src/sdk/validationHelpers.d.ts.map +1 -0
- package/out/src/sdk/validationHelpers.js +630 -0
- package/out/src/sdk/validationHelpers.js.map +1 -0
- package/out/src/services/ServiceCollection.d.ts +25 -0
- package/out/src/services/ServiceCollection.d.ts.map +1 -0
- package/out/src/services/ServiceCollection.js +43 -0
- package/out/src/services/ServiceCollection.js.map +1 -0
- package/out/src/services/Services.d.ts +60 -0
- package/out/src/services/Services.d.ts.map +1 -0
- package/out/src/services/Services.js +342 -0
- package/out/src/services/Services.js.map +1 -0
- package/out/src/services/__tests/getMerklePath.test.d.ts +2 -0
- package/out/src/services/__tests/getMerklePath.test.d.ts.map +1 -0
- package/out/src/services/__tests/getMerklePath.test.js +16 -0
- package/out/src/services/__tests/getMerklePath.test.js.map +1 -0
- package/out/src/services/__tests/getRawTx.test.d.ts +2 -0
- package/out/src/services/__tests/getRawTx.test.d.ts.map +1 -0
- package/out/src/services/__tests/getRawTx.test.js +13 -0
- package/out/src/services/__tests/getRawTx.test.js.map +1 -0
- package/out/src/services/__tests/postBeef.test.d.ts +2 -0
- package/out/src/services/__tests/postBeef.test.d.ts.map +1 -0
- package/out/src/services/__tests/postBeef.test.js +18 -0
- package/out/src/services/__tests/postBeef.test.js.map +1 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.d.ts +2 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.d.ts.map +1 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.js +479 -0
- package/out/src/services/__tests/postBeefToArcTaal.test.js.map +1 -0
- package/out/src/services/__tests/postTxs.test.d.ts +2 -0
- package/out/src/services/__tests/postTxs.test.d.ts.map +1 -0
- package/out/src/services/__tests/postTxs.test.js +19 -0
- package/out/src/services/__tests/postTxs.test.js.map +1 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +15 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.js +51 -0
- package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.d.ts +2 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.d.ts.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js +19 -0
- package/out/src/services/chaintracker/__tests/ChaintracksChainTracker.test.js.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.d.ts +2 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.d.ts.map +1 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js +29 -0
- package/out/src/services/chaintracker/__tests/ChaintracksServiceClient.test.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts +98 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js +38 -0
- package/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts +36 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +130 -0
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -0
- package/out/src/services/chaintracker/chaintracks/index.d.ts +3 -0
- package/out/src/services/chaintracker/chaintracks/index.d.ts.map +1 -0
- package/out/src/services/chaintracker/chaintracks/index.js +19 -0
- package/out/src/services/chaintracker/chaintracks/index.js.map +1 -0
- package/out/src/services/chaintracker/index.d.ts +3 -0
- package/out/src/services/chaintracker/index.d.ts.map +1 -0
- package/out/src/services/chaintracker/index.js +19 -0
- package/out/src/services/chaintracker/index.js.map +1 -0
- package/out/src/services/createDefaultWalletServicesOptions.d.ts +3 -0
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -0
- package/out/src/services/createDefaultWalletServicesOptions.js +34 -0
- package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -0
- package/out/src/services/index.d.ts +2 -0
- package/out/src/services/index.d.ts.map +1 -0
- package/out/src/services/index.js +18 -0
- package/out/src/services/index.js.map +1 -0
- package/out/src/services/providers/arcServices.d.ts +62 -0
- package/out/src/services/providers/arcServices.d.ts.map +1 -0
- package/out/src/services/providers/arcServices.js +368 -0
- package/out/src/services/providers/arcServices.js.map +1 -0
- package/out/src/services/providers/echangeRates.d.ts +12 -0
- package/out/src/services/providers/echangeRates.d.ts.map +1 -0
- package/out/src/services/providers/echangeRates.js +237 -0
- package/out/src/services/providers/echangeRates.js.map +1 -0
- package/out/src/services/providers/whatsonchain.d.ts +17 -0
- package/out/src/services/providers/whatsonchain.d.ts.map +1 -0
- package/out/src/services/providers/whatsonchain.js +130 -0
- package/out/src/services/providers/whatsonchain.js.map +1 -0
- package/out/src/signer/WalletSigner.d.ts +11 -0
- package/out/src/signer/WalletSigner.d.ts.map +1 -0
- package/out/src/signer/WalletSigner.js +13 -0
- package/out/src/signer/WalletSigner.js.map +1 -0
- package/out/src/signer/methods/acquireDirectCertificate.d.ts +4 -0
- package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -0
- package/out/src/signer/methods/acquireDirectCertificate.js +47 -0
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -0
- package/out/src/signer/methods/createAction.d.ts +7 -0
- package/out/src/signer/methods/createAction.d.ts.map +1 -0
- package/out/src/signer/methods/createAction.js +250 -0
- package/out/src/signer/methods/createAction.js.map +1 -0
- package/out/src/signer/methods/internalizeAction.d.ts +31 -0
- package/out/src/signer/methods/internalizeAction.d.ts.map +1 -0
- package/out/src/signer/methods/internalizeAction.js +95 -0
- package/out/src/signer/methods/internalizeAction.js.map +1 -0
- package/out/src/signer/methods/proveCertificate.d.ts +4 -0
- package/out/src/signer/methods/proveCertificate.d.ts.map +1 -0
- package/out/src/signer/methods/proveCertificate.js +45 -0
- package/out/src/signer/methods/proveCertificate.js.map +1 -0
- package/out/src/signer/methods/signAction.d.ts +6 -0
- package/out/src/signer/methods/signAction.d.ts.map +1 -0
- package/out/src/signer/methods/signAction.js +79 -0
- package/out/src/signer/methods/signAction.js.map +1 -0
- package/out/src/storage/StorageKnex.d.ts +176 -0
- package/out/src/storage/StorageKnex.d.ts.map +1 -0
- package/out/src/storage/StorageKnex.js +1035 -0
- package/out/src/storage/StorageKnex.js.map +1 -0
- package/out/src/storage/StorageProvider.d.ts +140 -0
- package/out/src/storage/StorageProvider.d.ts.map +1 -0
- package/out/src/storage/StorageProvider.js +539 -0
- package/out/src/storage/StorageProvider.js.map +1 -0
- package/out/src/storage/StorageReader.d.ts +76 -0
- package/out/src/storage/StorageReader.d.ts.map +1 -0
- package/out/src/storage/StorageReader.js +124 -0
- package/out/src/storage/StorageReader.js.map +1 -0
- package/out/src/storage/StorageReaderWriter.d.ts +87 -0
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -0
- package/out/src/storage/StorageReaderWriter.js +337 -0
- package/out/src/storage/StorageReaderWriter.js.map +1 -0
- package/out/src/storage/StorageSyncReader.d.ts +33 -0
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -0
- package/out/src/storage/StorageSyncReader.js +142 -0
- package/out/src/storage/StorageSyncReader.js.map +1 -0
- package/out/src/storage/WalletStorageManager.d.ts +103 -0
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -0
- package/out/src/storage/WalletStorageManager.js +408 -0
- package/out/src/storage/WalletStorageManager.js.map +1 -0
- package/out/src/storage/__test/WalletStorageManager.test.d.ts +2 -0
- package/out/src/storage/__test/WalletStorageManager.test.d.ts.map +1 -0
- package/out/src/storage/__test/WalletStorageManager.test.js +260 -0
- package/out/src/storage/__test/WalletStorageManager.test.js.map +1 -0
- package/out/src/storage/index.all.d.ts +11 -0
- package/out/src/storage/index.all.d.ts.map +1 -0
- package/out/src/storage/index.all.js +50 -0
- package/out/src/storage/index.all.js.map +1 -0
- package/out/src/storage/index.client.d.ts +7 -0
- package/out/src/storage/index.client.d.ts.map +1 -0
- package/out/src/storage/index.client.js +46 -0
- package/out/src/storage/index.client.js.map +1 -0
- package/out/src/storage/index.db.d.ts +1 -0
- package/out/src/storage/index.db.d.ts.map +1 -0
- package/out/src/storage/index.db.js +2 -0
- package/out/src/storage/index.db.js.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.d.ts +2 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.d.ts.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js +948 -0
- package/out/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.js.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts +2 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.d.ts.map +1 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js +35 -0
- package/out/src/storage/methods/__test/GenerateChange/randomValsUsed1.js.map +1 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +27 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +148 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -0
- package/out/src/storage/methods/createAction.d.ts +23 -0
- package/out/src/storage/methods/createAction.d.ts.map +1 -0
- package/out/src/storage/methods/createAction.js +663 -0
- package/out/src/storage/methods/createAction.js.map +1 -0
- package/out/src/storage/methods/generateChange.d.ts +108 -0
- package/out/src/storage/methods/generateChange.d.ts.map +1 -0
- package/out/src/storage/methods/generateChange.js +422 -0
- package/out/src/storage/methods/generateChange.js.map +1 -0
- package/out/src/storage/methods/getBeefForTransaction.d.ts +22 -0
- package/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -0
- package/out/src/storage/methods/getBeefForTransaction.js +94 -0
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -0
- package/out/src/storage/methods/getSyncChunk.d.ts +10 -0
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -0
- package/out/src/storage/methods/getSyncChunk.js +271 -0
- package/out/src/storage/methods/getSyncChunk.js.map +1 -0
- package/out/src/storage/methods/internalizeAction.d.ts +38 -0
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -0
- package/out/src/storage/methods/internalizeAction.js +378 -0
- package/out/src/storage/methods/internalizeAction.js.map +1 -0
- package/out/src/storage/methods/listActions.d.ts +5 -0
- package/out/src/storage/methods/listActions.d.ts.map +1 -0
- package/out/src/storage/methods/listActions.js +174 -0
- package/out/src/storage/methods/listActions.js.map +1 -0
- package/out/src/storage/methods/listCertificates.d.ts +5 -0
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -0
- package/out/src/storage/methods/listCertificates.js +68 -0
- package/out/src/storage/methods/listCertificates.js.map +1 -0
- package/out/src/storage/methods/listOutputs.d.ts +5 -0
- package/out/src/storage/methods/listOutputs.d.ts.map +1 -0
- package/out/src/storage/methods/listOutputs.js +189 -0
- package/out/src/storage/methods/listOutputs.js.map +1 -0
- package/out/src/storage/methods/processAction.d.ts +35 -0
- package/out/src/storage/methods/processAction.d.ts.map +1 -0
- package/out/src/storage/methods/processAction.js +271 -0
- package/out/src/storage/methods/processAction.js.map +1 -0
- package/out/src/storage/methods/purgeData.d.ts +4 -0
- package/out/src/storage/methods/purgeData.d.ts.map +1 -0
- package/out/src/storage/methods/purgeData.js +229 -0
- package/out/src/storage/methods/purgeData.js.map +1 -0
- package/out/src/storage/methods/reviewStatus.d.ts +9 -0
- package/out/src/storage/methods/reviewStatus.d.ts.map +1 -0
- package/out/src/storage/methods/reviewStatus.js +75 -0
- package/out/src/storage/methods/reviewStatus.js.map +1 -0
- package/out/src/storage/remoting/StorageClient.d.ts +56 -0
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageClient.js +181 -0
- package/out/src/storage/remoting/StorageClient.js.map +1 -0
- package/out/src/storage/remoting/StorageServer.d.ts +26 -0
- package/out/src/storage/remoting/StorageServer.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageServer.js +144 -0
- package/out/src/storage/remoting/StorageServer.js.map +1 -0
- package/out/src/storage/schema/KnexMigrations.d.ts +39 -0
- package/out/src/storage/schema/KnexMigrations.d.ts.map +1 -0
- package/out/src/storage/schema/KnexMigrations.js +442 -0
- package/out/src/storage/schema/KnexMigrations.js.map +1 -0
- package/out/src/storage/schema/entities/Certificate.d.ts +43 -0
- package/out/src/storage/schema/entities/Certificate.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Certificate.js +162 -0
- package/out/src/storage/schema/entities/Certificate.js.map +1 -0
- package/out/src/storage/schema/entities/CertificateField.d.ts +32 -0
- package/out/src/storage/schema/entities/CertificateField.d.ts.map +1 -0
- package/out/src/storage/schema/entities/CertificateField.js +114 -0
- package/out/src/storage/schema/entities/CertificateField.js.map +1 -0
- package/out/src/storage/schema/entities/Commission.d.ts +37 -0
- package/out/src/storage/schema/entities/Commission.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Commission.js +130 -0
- package/out/src/storage/schema/entities/Commission.js.map +1 -0
- package/out/src/storage/schema/entities/EntityBase.d.ts +105 -0
- package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -0
- package/out/src/storage/schema/entities/EntityBase.js +100 -0
- package/out/src/storage/schema/entities/EntityBase.js.map +1 -0
- package/out/src/storage/schema/entities/MergeEntity.d.ts +34 -0
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -0
- package/out/src/storage/schema/entities/MergeEntity.js +57 -0
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -0
- package/out/src/storage/schema/entities/Output.d.ts +67 -0
- package/out/src/storage/schema/entities/Output.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Output.js +281 -0
- package/out/src/storage/schema/entities/Output.js.map +1 -0
- package/out/src/storage/schema/entities/OutputBasket.d.ts +35 -0
- package/out/src/storage/schema/entities/OutputBasket.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputBasket.js +133 -0
- package/out/src/storage/schema/entities/OutputBasket.js.map +1 -0
- package/out/src/storage/schema/entities/OutputTag.d.ts +31 -0
- package/out/src/storage/schema/entities/OutputTag.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputTag.js +104 -0
- package/out/src/storage/schema/entities/OutputTag.js.map +1 -0
- package/out/src/storage/schema/entities/OutputTagMap.d.ts +28 -0
- package/out/src/storage/schema/entities/OutputTagMap.d.ts.map +1 -0
- package/out/src/storage/schema/entities/OutputTagMap.js +101 -0
- package/out/src/storage/schema/entities/OutputTagMap.js.map +1 -0
- package/out/src/storage/schema/entities/ProvenTx.d.ts +84 -0
- package/out/src/storage/schema/entities/ProvenTx.d.ts.map +1 -0
- package/out/src/storage/schema/entities/ProvenTx.js +283 -0
- package/out/src/storage/schema/entities/ProvenTx.js.map +1 -0
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts +130 -0
- package/out/src/storage/schema/entities/ProvenTxReq.d.ts.map +1 -0
- package/out/src/storage/schema/entities/ProvenTxReq.js +521 -0
- package/out/src/storage/schema/entities/ProvenTxReq.js.map +1 -0
- package/out/src/storage/schema/entities/SyncState.d.ts +66 -0
- package/out/src/storage/schema/entities/SyncState.d.ts.map +1 -0
- package/out/src/storage/schema/entities/SyncState.js +284 -0
- package/out/src/storage/schema/entities/SyncState.js.map +1 -0
- package/out/src/storage/schema/entities/Transaction.d.ts +67 -0
- package/out/src/storage/schema/entities/Transaction.d.ts.map +1 -0
- package/out/src/storage/schema/entities/Transaction.js +264 -0
- package/out/src/storage/schema/entities/Transaction.js.map +1 -0
- package/out/src/storage/schema/entities/TxLabel.d.ts +31 -0
- package/out/src/storage/schema/entities/TxLabel.d.ts.map +1 -0
- package/out/src/storage/schema/entities/TxLabel.js +104 -0
- package/out/src/storage/schema/entities/TxLabel.js.map +1 -0
- package/out/src/storage/schema/entities/TxLabelMap.d.ts +28 -0
- package/out/src/storage/schema/entities/TxLabelMap.d.ts.map +1 -0
- package/out/src/storage/schema/entities/TxLabelMap.js +103 -0
- package/out/src/storage/schema/entities/TxLabelMap.js.map +1 -0
- package/out/src/storage/schema/entities/User.d.ts +29 -0
- package/out/src/storage/schema/entities/User.d.ts.map +1 -0
- package/out/src/storage/schema/entities/User.js +100 -0
- package/out/src/storage/schema/entities/User.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js +588 -0
- package/out/src/storage/schema/entities/__tests/CertificateFieldTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js +449 -0
- package/out/src/storage/schema/entities/__tests/CertificateTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js +602 -0
- package/out/src/storage/schema/entities/__tests/CommissionTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js +515 -0
- package/out/src/storage/schema/entities/__tests/OutputBasketTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js +478 -0
- package/out/src/storage/schema/entities/__tests/OutputTagMapTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js +440 -0
- package/out/src/storage/schema/entities/__tests/OutputTagTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js +626 -0
- package/out/src/storage/schema/entities/__tests/OutputTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js +585 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxReqTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js +628 -0
- package/out/src/storage/schema/entities/__tests/ProvenTxTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js +307 -0
- package/out/src/storage/schema/entities/__tests/SyncStateTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js +823 -0
- package/out/src/storage/schema/entities/__tests/TransactionTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js +442 -0
- package/out/src/storage/schema/entities/__tests/TxLabelMapTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js +313 -0
- package/out/src/storage/schema/entities/__tests/TxLabelTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js +81 -0
- package/out/src/storage/schema/entities/__tests/stampLogTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.d.ts +2 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.d.ts.map +1 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.js +418 -0
- package/out/src/storage/schema/entities/__tests/usersTests.test.js.map +1 -0
- package/out/src/storage/schema/entities/index.d.ts +17 -0
- package/out/src/storage/schema/entities/index.d.ts.map +1 -0
- package/out/src/storage/schema/entities/index.js +33 -0
- package/out/src/storage/schema/entities/index.js.map +1 -0
- package/out/src/storage/schema/tables/Certificate.d.ts +20 -0
- package/out/src/storage/schema/tables/Certificate.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Certificate.js +3 -0
- package/out/src/storage/schema/tables/Certificate.js.map +1 -0
- package/out/src/storage/schema/tables/CertificateField.d.ts +12 -0
- package/out/src/storage/schema/tables/CertificateField.d.ts.map +1 -0
- package/out/src/storage/schema/tables/CertificateField.js +3 -0
- package/out/src/storage/schema/tables/CertificateField.js.map +1 -0
- package/out/src/storage/schema/tables/Commission.d.ts +13 -0
- package/out/src/storage/schema/tables/Commission.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Commission.js +3 -0
- package/out/src/storage/schema/tables/Commission.js.map +1 -0
- package/out/src/storage/schema/tables/MonitorEvent.d.ts +9 -0
- package/out/src/storage/schema/tables/MonitorEvent.d.ts.map +1 -0
- package/out/src/storage/schema/tables/MonitorEvent.js +3 -0
- package/out/src/storage/schema/tables/MonitorEvent.js.map +1 -0
- package/out/src/storage/schema/tables/Output.d.ts +36 -0
- package/out/src/storage/schema/tables/Output.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Output.js +31 -0
- package/out/src/storage/schema/tables/Output.js.map +1 -0
- package/out/src/storage/schema/tables/OutputBasket.d.ts +12 -0
- package/out/src/storage/schema/tables/OutputBasket.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputBasket.js +3 -0
- package/out/src/storage/schema/tables/OutputBasket.js.map +1 -0
- package/out/src/storage/schema/tables/OutputTag.d.ts +10 -0
- package/out/src/storage/schema/tables/OutputTag.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputTag.js +3 -0
- package/out/src/storage/schema/tables/OutputTag.js.map +1 -0
- package/out/src/storage/schema/tables/OutputTagMap.d.ts +9 -0
- package/out/src/storage/schema/tables/OutputTagMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/OutputTagMap.js +3 -0
- package/out/src/storage/schema/tables/OutputTagMap.js.map +1 -0
- package/out/src/storage/schema/tables/ProvenTx.d.ts +14 -0
- package/out/src/storage/schema/tables/ProvenTx.d.ts.map +1 -0
- package/out/src/storage/schema/tables/ProvenTx.js +3 -0
- package/out/src/storage/schema/tables/ProvenTx.js.map +1 -0
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts +64 -0
- package/out/src/storage/schema/tables/ProvenTxReq.d.ts.map +1 -0
- package/out/src/storage/schema/tables/ProvenTxReq.js +3 -0
- package/out/src/storage/schema/tables/ProvenTxReq.js.map +1 -0
- package/out/src/storage/schema/tables/Settings.d.ts +17 -0
- package/out/src/storage/schema/tables/Settings.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Settings.js +3 -0
- package/out/src/storage/schema/tables/Settings.js.map +1 -0
- package/out/src/storage/schema/tables/SyncState.d.ts +18 -0
- package/out/src/storage/schema/tables/SyncState.d.ts.map +1 -0
- package/out/src/storage/schema/tables/SyncState.js +3 -0
- package/out/src/storage/schema/tables/SyncState.js.map +1 -0
- package/out/src/storage/schema/tables/Transaction.d.ts +37 -0
- package/out/src/storage/schema/tables/Transaction.d.ts.map +1 -0
- package/out/src/storage/schema/tables/Transaction.js +21 -0
- package/out/src/storage/schema/tables/Transaction.js.map +1 -0
- package/out/src/storage/schema/tables/TxLabel.d.ts +10 -0
- package/out/src/storage/schema/tables/TxLabel.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TxLabel.js +3 -0
- package/out/src/storage/schema/tables/TxLabel.js.map +1 -0
- package/out/src/storage/schema/tables/TxLabelMap.d.ts +9 -0
- package/out/src/storage/schema/tables/TxLabelMap.d.ts.map +1 -0
- package/out/src/storage/schema/tables/TxLabelMap.js +3 -0
- package/out/src/storage/schema/tables/TxLabelMap.js.map +1 -0
- package/out/src/storage/schema/tables/User.d.ts +16 -0
- package/out/src/storage/schema/tables/User.d.ts.map +1 -0
- package/out/src/storage/schema/tables/User.js +3 -0
- package/out/src/storage/schema/tables/User.js.map +1 -0
- package/out/src/storage/schema/tables/index.d.ts +17 -0
- package/out/src/storage/schema/tables/index.d.ts.map +1 -0
- package/out/src/storage/schema/tables/index.js +33 -0
- package/out/src/storage/schema/tables/index.js.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts +71 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.d.ts.map +1 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.js +612 -0
- package/out/src/storage/sync/StorageMySQLDojoReader.js.map +1 -0
- package/out/src/storage/sync/index.d.ts +2 -0
- package/out/src/storage/sync/index.d.ts.map +1 -0
- package/out/src/storage/sync/index.js +18 -0
- package/out/src/storage/sync/index.js.map +1 -0
- package/out/src/utility/ScriptTemplateSABPPP.d.ts +25 -0
- package/out/src/utility/ScriptTemplateSABPPP.d.ts.map +1 -0
- package/out/src/utility/ScriptTemplateSABPPP.js +46 -0
- package/out/src/utility/ScriptTemplateSABPPP.js.map +1 -0
- package/out/src/utility/index.all.d.ts +7 -0
- package/out/src/utility/index.all.d.ts.map +1 -0
- package/out/src/utility/index.all.js +23 -0
- package/out/src/utility/index.all.js.map +1 -0
- package/out/src/utility/index.client.d.ts +7 -0
- package/out/src/utility/index.client.d.ts.map +1 -0
- package/out/src/utility/index.client.js +23 -0
- package/out/src/utility/index.client.js.map +1 -0
- package/out/src/utility/parseTxScriptOffsets.d.ts +14 -0
- package/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -0
- package/out/src/utility/parseTxScriptOffsets.js +26 -0
- package/out/src/utility/parseTxScriptOffsets.js.map +1 -0
- package/out/src/utility/stampLog.d.ts +18 -0
- package/out/src/utility/stampLog.d.ts.map +1 -0
- package/out/src/utility/stampLog.js +72 -0
- package/out/src/utility/stampLog.js.map +1 -0
- package/out/src/utility/tscProofToMerklePath.d.ts +8 -0
- package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -0
- package/out/src/utility/tscProofToMerklePath.js +41 -0
- package/out/src/utility/tscProofToMerklePath.js.map +1 -0
- package/out/src/utility/utilityHelpers.buffer.d.ts +18 -0
- package/out/src/utility/utilityHelpers.buffer.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.buffer.js +45 -0
- package/out/src/utility/utilityHelpers.buffer.js.map +1 -0
- package/out/src/utility/utilityHelpers.d.ts +129 -0
- package/out/src/utility/utilityHelpers.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.js +268 -0
- package/out/src/utility/utilityHelpers.js.map +1 -0
- package/out/src/utility/utilityHelpers.noBuffer.d.ts +9 -0
- package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -0
- package/out/src/utility/utilityHelpers.noBuffer.js +23 -0
- package/out/src/utility/utilityHelpers.noBuffer.js.map +1 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts +2 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.d.ts.map +1 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.js +45 -0
- package/out/test/Wallet/StorageClient/storageClient.man.test.js.map +1 -0
- package/out/test/Wallet/action/internalizeAction.a.test.d.ts +2 -0
- package/out/test/Wallet/action/internalizeAction.a.test.d.ts.map +1 -0
- package/out/test/Wallet/action/internalizeAction.a.test.js +243 -0
- package/out/test/Wallet/action/internalizeAction.a.test.js.map +1 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.d.ts +2 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.d.ts.map +1 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.js +213 -0
- package/out/test/Wallet/certificate/acquireCertificate.test.js.map +1 -0
- package/out/test/Wallet/certificate/listCertificates.test.d.ts +2 -0
- package/out/test/Wallet/certificate/listCertificates.test.d.ts.map +1 -0
- package/out/test/Wallet/certificate/listCertificates.test.js +305 -0
- package/out/test/Wallet/certificate/listCertificates.test.js.map +1 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.d.ts +2 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.js +68 -0
- package/out/test/Wallet/get/getHeaderForHeight.test.js.map +1 -0
- package/out/test/Wallet/get/getHeight.test.d.ts +2 -0
- package/out/test/Wallet/get/getHeight.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getHeight.test.js +45 -0
- package/out/test/Wallet/get/getHeight.test.js.map +1 -0
- package/out/test/Wallet/get/getKnownTxids.test.d.ts +2 -0
- package/out/test/Wallet/get/getKnownTxids.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getKnownTxids.test.js +73 -0
- package/out/test/Wallet/get/getKnownTxids.test.js.map +1 -0
- package/out/test/Wallet/get/getNetwork.test.d.ts +2 -0
- package/out/test/Wallet/get/getNetwork.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getNetwork.test.js +26 -0
- package/out/test/Wallet/get/getNetwork.test.js.map +1 -0
- package/out/test/Wallet/get/getVersion.test.d.ts +2 -0
- package/out/test/Wallet/get/getVersion.test.d.ts.map +1 -0
- package/out/test/Wallet/get/getVersion.test.js +25 -0
- package/out/test/Wallet/get/getVersion.test.js.map +1 -0
- package/out/test/Wallet/live/walletLive.man.test.d.ts +26 -0
- package/out/test/Wallet/live/walletLive.man.test.d.ts.map +1 -0
- package/out/test/Wallet/live/walletLive.man.test.js +389 -0
- package/out/test/Wallet/live/walletLive.man.test.js.map +1 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts +2 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.d.ts.map +1 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js +153 -0
- package/out/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.js.map +1 -0
- package/out/test/checkDB.d.ts +4 -0
- package/out/test/checkDB.d.ts.map +1 -0
- package/out/test/checkDB.js +55 -0
- package/out/test/checkDB.js.map +1 -0
- package/out/test/examples/README.man.test.d.ts +2 -0
- package/out/test/examples/README.man.test.d.ts.map +1 -0
- package/out/test/examples/README.man.test.js +46 -0
- package/out/test/examples/README.man.test.js.map +1 -0
- package/out/test/monitor/Monitor.test.d.ts +2 -0
- package/out/test/monitor/Monitor.test.d.ts.map +1 -0
- package/out/test/monitor/Monitor.test.js +446 -0
- package/out/test/monitor/Monitor.test.js.map +1 -0
- package/out/test/services/Services.test.d.ts +2 -0
- package/out/test/services/Services.test.d.ts.map +1 -0
- package/out/test/services/Services.test.js +128 -0
- package/out/test/services/Services.test.js.map +1 -0
- package/out/test/storage/KnexMigrations.test.d.ts +2 -0
- package/out/test/storage/KnexMigrations.test.d.ts.map +1 -0
- package/out/test/storage/KnexMigrations.test.js +81 -0
- package/out/test/storage/KnexMigrations.test.js.map +1 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts +2 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.d.ts.map +1 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.js +88 -0
- package/out/test/storage/StorageMySQLDojoReader.man.test.js.map +1 -0
- package/out/test/storage/count.test.d.ts +2 -0
- package/out/test/storage/count.test.d.ts.map +1 -0
- package/out/test/storage/count.test.js +141 -0
- package/out/test/storage/count.test.js.map +1 -0
- package/out/test/storage/find.test.d.ts +2 -0
- package/out/test/storage/find.test.d.ts.map +1 -0
- package/out/test/storage/find.test.js +148 -0
- package/out/test/storage/find.test.js.map +1 -0
- package/out/test/storage/findLegacy.test.d.ts +2 -0
- package/out/test/storage/findLegacy.test.d.ts.map +1 -0
- package/out/test/storage/findLegacy.test.js +52 -0
- package/out/test/storage/findLegacy.test.js.map +1 -0
- package/out/test/storage/insert.test.d.ts +2 -0
- package/out/test/storage/insert.test.d.ts.map +1 -0
- package/out/test/storage/insert.test.js +256 -0
- package/out/test/storage/insert.test.js.map +1 -0
- package/out/test/storage/update.test.d.ts +2 -0
- package/out/test/storage/update.test.d.ts.map +1 -0
- package/out/test/storage/update.test.js +926 -0
- package/out/test/storage/update.test.js.map +1 -0
- package/out/test/storage/update2.test.d.ts +2 -0
- package/out/test/storage/update2.test.d.ts.map +1 -0
- package/out/test/storage/update2.test.js +766 -0
- package/out/test/storage/update2.test.js.map +1 -0
- package/out/test/utils/TestUtilsWalletStorage.d.ts +399 -0
- package/out/test/utils/TestUtilsWalletStorage.d.ts.map +1 -0
- package/out/test/utils/TestUtilsWalletStorage.js +1337 -0
- package/out/test/utils/TestUtilsWalletStorage.js.map +1 -0
- package/out/test/wallet/action/abortAction.test.d.ts +2 -0
- package/out/test/wallet/action/abortAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/abortAction.test.js +44 -0
- package/out/test/wallet/action/abortAction.test.js.map +1 -0
- package/out/test/wallet/action/createAction.test.d.ts +2 -0
- package/out/test/wallet/action/createAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/createAction.test.js +230 -0
- package/out/test/wallet/action/createAction.test.js.map +1 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts +2 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts.map +1 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js +273 -0
- package/out/test/wallet/action/createActionToGenerateBeefs.man.test.js.map +1 -0
- package/out/test/wallet/action/internalizeAction.test.d.ts +2 -0
- package/out/test/wallet/action/internalizeAction.test.d.ts.map +1 -0
- package/out/test/wallet/action/internalizeAction.test.js +603 -0
- package/out/test/wallet/action/internalizeAction.test.js.map +1 -0
- package/out/test/wallet/action/relinquishOutput.test.d.ts +2 -0
- package/out/test/wallet/action/relinquishOutput.test.d.ts.map +1 -0
- package/out/test/wallet/action/relinquishOutput.test.js +31 -0
- package/out/test/wallet/action/relinquishOutput.test.js.map +1 -0
- package/out/test/wallet/construct/Wallet.constructor.test.d.ts +2 -0
- package/out/test/wallet/construct/Wallet.constructor.test.d.ts.map +1 -0
- package/out/test/wallet/construct/Wallet.constructor.test.js +49 -0
- package/out/test/wallet/construct/Wallet.constructor.test.js.map +1 -0
- package/out/test/wallet/list/listActions.test.d.ts +2 -0
- package/out/test/wallet/list/listActions.test.d.ts.map +1 -0
- package/out/test/wallet/list/listActions.test.js +265 -0
- package/out/test/wallet/list/listActions.test.js.map +1 -0
- package/out/test/wallet/list/listActions2.test.d.ts +2 -0
- package/out/test/wallet/list/listActions2.test.d.ts.map +1 -0
- package/out/test/wallet/list/listActions2.test.js +423 -0
- package/out/test/wallet/list/listActions2.test.js.map +1 -0
- package/out/test/wallet/list/listCertificates.test.d.ts +2 -0
- package/out/test/wallet/list/listCertificates.test.d.ts.map +1 -0
- package/out/test/wallet/list/listCertificates.test.js +115 -0
- package/out/test/wallet/list/listCertificates.test.js.map +1 -0
- package/out/test/wallet/list/listOutputs.test.d.ts +2 -0
- package/out/test/wallet/list/listOutputs.test.d.ts.map +1 -0
- package/out/test/wallet/list/listOutputs.test.js +521 -0
- package/out/test/wallet/list/listOutputs.test.js.map +1 -0
- package/out/test/wallet/sync/Wallet.sync.test.d.ts +2 -0
- package/out/test/wallet/sync/Wallet.sync.test.d.ts.map +1 -0
- package/out/test/wallet/sync/Wallet.sync.test.js +142 -0
- package/out/test/wallet/sync/Wallet.sync.test.js.map +1 -0
- package/out/tsconfig.all.tsbuildinfo +1 -0
- package/package.json +63 -0
- package/src/Wallet.ts +771 -0
- package/src/index.all.ts +8 -0
- package/src/index.client.ts +7 -0
- package/src/index.ts +2 -0
- package/src/monitor/Monitor.ts +317 -0
- package/src/monitor/MonitorDaemon.ts +197 -0
- package/src/monitor/README.md +3 -0
- package/src/monitor/__test/MonitorDaemon.man.test.ts +17 -0
- package/src/monitor/tasks/TaskCheckForProofs.ts +235 -0
- package/src/monitor/tasks/TaskClock.ts +35 -0
- package/src/monitor/tasks/TaskFailAbandoned.ts +56 -0
- package/src/monitor/tasks/TaskNewHeader.ts +48 -0
- package/src/monitor/tasks/TaskPurge.ts +69 -0
- package/src/monitor/tasks/TaskReviewStatus.ts +51 -0
- package/src/monitor/tasks/TaskSendWaiting.ts +107 -0
- package/src/monitor/tasks/TaskSyncWhenIdle.ts +26 -0
- package/src/monitor/tasks/WalletMonitorTask.ts +47 -0
- package/src/sdk/CertOps.ts +346 -0
- package/src/sdk/PrivilegedKeyManager.ts +402 -0
- package/src/sdk/README.md +13 -0
- package/src/sdk/StorageSyncReader.ts +155 -0
- package/src/sdk/StorageSyncReaderWriter.ts +263 -0
- package/src/sdk/WERR_errors.ts +152 -0
- package/src/sdk/WalletError.ts +136 -0
- package/src/sdk/WalletServices.interfaces.ts +399 -0
- package/src/sdk/WalletSigner.interfaces.ts +38 -0
- package/src/sdk/WalletStorage.interfaces.ts +416 -0
- package/src/sdk/__test/CertificateLifeCycle.test.ts +194 -0
- package/src/sdk/__test/PrivilegedKeyManager.test.ts +775 -0
- package/src/sdk/index.ts +11 -0
- package/src/sdk/types.ts +115 -0
- package/src/sdk/validationHelpers.ts +1248 -0
- package/src/services/README.md +11 -0
- package/src/services/ServiceCollection.ts +50 -0
- package/src/services/Services.ts +461 -0
- package/src/services/__tests/getMerklePath.test.ts +16 -0
- package/src/services/__tests/getRawTx.test.ts +15 -0
- package/src/services/__tests/postBeef.test.ts +19 -0
- package/src/services/__tests/postBeefToArcTaal.test.ts +487 -0
- package/src/services/__tests/postTxs.test.ts +20 -0
- package/src/services/chaintracker/ChaintracksChainTracker.ts +78 -0
- package/src/services/chaintracker/__tests/ChaintracksChainTracker.test.ts +25 -0
- package/src/services/chaintracker/__tests/ChaintracksServiceClient.test.ts +32 -0
- package/src/services/chaintracker/chaintracks/BlockHeaderApi.ts +123 -0
- package/src/services/chaintracker/chaintracks/ChaintracksServiceClient.ts +160 -0
- package/src/services/chaintracker/chaintracks/index.ts +2 -0
- package/src/services/chaintracker/index.ts +2 -0
- package/src/services/createDefaultWalletServicesOptions.ts +38 -0
- package/src/services/index.ts +1 -0
- package/src/services/providers/arcServices.ts +570 -0
- package/src/services/providers/echangeRates.ts +276 -0
- package/src/services/providers/whatsonchain.ts +170 -0
- package/src/signer/README.md +5 -0
- package/src/signer/WalletSigner.ts +21 -0
- package/src/signer/methods/acquireDirectCertificate.ts +53 -0
- package/src/signer/methods/createAction.ts +364 -0
- package/src/signer/methods/internalizeAction.ts +142 -0
- package/src/signer/methods/proveCertificate.ts +51 -0
- package/src/signer/methods/signAction.ts +121 -0
- package/src/storage/README.md +14 -0
- package/src/storage/StorageKnex.ts +1449 -0
- package/src/storage/StorageProvider.ts +853 -0
- package/src/storage/StorageReader.ts +222 -0
- package/src/storage/StorageReaderWriter.ts +623 -0
- package/src/storage/StorageSyncReader.ts +143 -0
- package/src/storage/WalletStorageManager.ts +532 -0
- package/src/storage/__test/WalletStorageManager.test.ts +292 -0
- package/src/storage/index.all.ts +10 -0
- package/src/storage/index.client.ts +6 -0
- package/src/storage/index.db.ts +0 -0
- package/src/storage/methods/__test/GenerateChange/generateChangeSdk.test.ts +1143 -0
- package/src/storage/methods/__test/GenerateChange/randomValsUsed1.ts +31 -0
- package/src/storage/methods/attemptToPostReqsToNetwork.ts +185 -0
- package/src/storage/methods/createAction.ts +997 -0
- package/src/storage/methods/generateChange.ts +629 -0
- package/src/storage/methods/getBeefForTransaction.ts +143 -0
- package/src/storage/methods/getSyncChunk.ts +330 -0
- package/src/storage/methods/internalizeAction.ts +538 -0
- package/src/storage/methods/listActions.ts +203 -0
- package/src/storage/methods/listCertificates.ts +81 -0
- package/src/storage/methods/listOutputs.ts +219 -0
- package/src/storage/methods/processAction.ts +477 -0
- package/src/storage/methods/purgeData.ts +276 -0
- package/src/storage/methods/reviewStatus.ts +95 -0
- package/src/storage/remoting/StorageClient.ts +306 -0
- package/src/storage/remoting/StorageServer.ts +179 -0
- package/src/storage/schema/KnexMigrations.ts +488 -0
- package/src/storage/schema/entities/Certificate.ts +199 -0
- package/src/storage/schema/entities/CertificateField.ts +157 -0
- package/src/storage/schema/entities/Commission.ts +169 -0
- package/src/storage/schema/entities/EntityBase.ts +214 -0
- package/src/storage/schema/entities/MergeEntity.ts +79 -0
- package/src/storage/schema/entities/Output.ts +323 -0
- package/src/storage/schema/entities/OutputBasket.ts +165 -0
- package/src/storage/schema/entities/OutputTag.ts +138 -0
- package/src/storage/schema/entities/OutputTagMap.ts +146 -0
- package/src/storage/schema/entities/ProvenTx.ts +349 -0
- package/src/storage/schema/entities/ProvenTxReq.ts +646 -0
- package/src/storage/schema/entities/SyncState.ts +429 -0
- package/src/storage/schema/entities/Transaction.ts +334 -0
- package/src/storage/schema/entities/TxLabel.ts +135 -0
- package/src/storage/schema/entities/TxLabelMap.ts +148 -0
- package/src/storage/schema/entities/User.ts +138 -0
- package/src/storage/schema/entities/__tests/CertificateFieldTests.test.ts +663 -0
- package/src/storage/schema/entities/__tests/CertificateTests.test.ts +527 -0
- package/src/storage/schema/entities/__tests/CommissionTests.test.ts +658 -0
- package/src/storage/schema/entities/__tests/OutputBasketTests.test.ts +567 -0
- package/src/storage/schema/entities/__tests/OutputTagMapTests.test.ts +530 -0
- package/src/storage/schema/entities/__tests/OutputTagTests.test.ts +504 -0
- package/src/storage/schema/entities/__tests/OutputTests.test.ts +689 -0
- package/src/storage/schema/entities/__tests/ProvenTxReqTests.test.ts +669 -0
- package/src/storage/schema/entities/__tests/ProvenTxTests.test.ts +700 -0
- package/src/storage/schema/entities/__tests/SyncStateTests.test.ts +376 -0
- package/src/storage/schema/entities/__tests/TransactionTests.test.ts +920 -0
- package/src/storage/schema/entities/__tests/TxLabelMapTests.test.ts +512 -0
- package/src/storage/schema/entities/__tests/TxLabelTests.test.ts +350 -0
- package/src/storage/schema/entities/__tests/stampLogTests.test.ts +97 -0
- package/src/storage/schema/entities/__tests/usersTests.test.ts +485 -0
- package/src/storage/schema/entities/index.ts +16 -0
- package/src/storage/schema/tables/Certificate.ts +21 -0
- package/src/storage/schema/tables/CertificateField.ts +12 -0
- package/src/storage/schema/tables/Commission.ts +13 -0
- package/src/storage/schema/tables/MonitorEvent.ts +9 -0
- package/src/storage/schema/tables/Output.ts +64 -0
- package/src/storage/schema/tables/OutputBasket.ts +12 -0
- package/src/storage/schema/tables/OutputTag.ts +10 -0
- package/src/storage/schema/tables/OutputTagMap.ts +9 -0
- package/src/storage/schema/tables/ProvenTx.ts +14 -0
- package/src/storage/schema/tables/ProvenTxReq.ts +65 -0
- package/src/storage/schema/tables/Settings.ts +17 -0
- package/src/storage/schema/tables/SyncState.ts +18 -0
- package/src/storage/schema/tables/Transaction.ts +54 -0
- package/src/storage/schema/tables/TxLabel.ts +10 -0
- package/src/storage/schema/tables/TxLabelMap.ts +9 -0
- package/src/storage/schema/tables/User.ts +16 -0
- package/src/storage/schema/tables/index.ts +16 -0
- package/src/storage/sync/StorageMySQLDojoReader.ts +771 -0
- package/src/storage/sync/index.ts +1 -0
- package/src/utility/README.md +3 -0
- package/src/utility/ScriptTemplateSABPPP.ts +79 -0
- package/src/utility/index.all.ts +7 -0
- package/src/utility/index.client.ts +7 -0
- package/src/utility/parseTxScriptOffsets.ts +29 -0
- package/src/utility/stampLog.ts +73 -0
- package/src/utility/tscProofToMerklePath.ts +51 -0
- package/src/utility/utilityHelpers.buffer.ts +43 -0
- package/src/utility/utilityHelpers.noBuffer.ts +18 -0
- package/src/utility/utilityHelpers.ts +283 -0
- package/test/Wallet/StorageClient/storageClient.man.test.ts +55 -0
- package/test/Wallet/action/internalizeAction.a.test.ts +301 -0
- package/test/Wallet/certificate/acquireCertificate.test.ts +253 -0
- package/test/Wallet/certificate/listCertificates.test.ts +352 -0
- package/test/Wallet/get/getHeaderForHeight.test.ts +79 -0
- package/test/Wallet/get/getHeight.test.ts +52 -0
- package/test/Wallet/get/getKnownTxids.test.ts +90 -0
- package/test/Wallet/get/getNetwork.test.ts +28 -0
- package/test/Wallet/get/getVersion.test.ts +28 -0
- package/test/Wallet/live/walletLive.man.test.ts +510 -0
- package/test/Wallet/sync/Wallet.updateWalletLegacyTestData.man.test.ts +155 -0
- package/test/checkDB.ts +63 -0
- package/test/checkdb +0 -0
- package/test/examples/README.man.test.ts +53 -0
- package/test/monitor/Monitor.test.ts +536 -0
- package/test/services/Services.test.ts +149 -0
- package/test/storage/KnexMigrations.test.ts +100 -0
- package/test/storage/StorageMySQLDojoReader.man.test.ts +71 -0
- package/test/storage/count.test.ts +193 -0
- package/test/storage/find.test.ts +216 -0
- package/test/storage/findLegacy.test.ts +70 -0
- package/test/storage/insert.test.ts +294 -0
- package/test/storage/update.test.ts +1146 -0
- package/test/storage/update2.test.ts +1017 -0
- package/test/utils/TestUtilsWalletStorage.ts +1923 -0
- package/test/utils/removeFailedFromDatabase.sql +17 -0
- package/test/wallet/action/abortAction.test.ts +55 -0
- package/test/wallet/action/createAction.test.ts +266 -0
- package/test/wallet/action/createActionToGenerateBeefs.man.test.ts +297 -0
- package/test/wallet/action/internalizeAction.test.ts +729 -0
- package/test/wallet/action/relinquishOutput.test.ts +43 -0
- package/test/wallet/construct/Wallet.constructor.test.ts +57 -0
- package/test/wallet/list/listActions.test.ts +282 -0
- package/test/wallet/list/listActions2.test.ts +570 -0
- package/test/wallet/list/listCertificates.test.ts +129 -0
- package/test/wallet/list/listOutputs.test.ts +573 -0
- package/test/wallet/sync/Wallet.sync.test.ts +226 -0
- package/ts2md.json +32 -0
- package/tsconfig.all.json +29 -0
- package/tsconfig.client.json +22 -0
- package/tsconfig.json +14 -0
- package/unlock-migrations.sh +41 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Random,
|
|
3
|
+
Utils,
|
|
4
|
+
PrivateKey,
|
|
5
|
+
CreateHmacArgs,
|
|
6
|
+
CreateHmacResult,
|
|
7
|
+
CreateSignatureArgs,
|
|
8
|
+
CreateSignatureResult,
|
|
9
|
+
GetPublicKeyArgs,
|
|
10
|
+
ProtoWallet,
|
|
11
|
+
PubKeyHex,
|
|
12
|
+
RevealCounterpartyKeyLinkageArgs,
|
|
13
|
+
RevealCounterpartyKeyLinkageResult,
|
|
14
|
+
RevealSpecificKeyLinkageArgs,
|
|
15
|
+
RevealSpecificKeyLinkageResult,
|
|
16
|
+
VerifyHmacArgs,
|
|
17
|
+
VerifyHmacResult,
|
|
18
|
+
VerifySignatureArgs,
|
|
19
|
+
VerifySignatureResult,
|
|
20
|
+
WalletDecryptArgs,
|
|
21
|
+
WalletDecryptResult,
|
|
22
|
+
WalletEncryptArgs,
|
|
23
|
+
WalletEncryptResult
|
|
24
|
+
} from '@bsv/sdk'
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* PrivilegedKeyManager
|
|
28
|
+
*
|
|
29
|
+
* This class manages a privileged (i.e., very sensitive) private key, obtained from
|
|
30
|
+
* an external function (`keyGetter`), which might be backed by HSMs, secure enclaves,
|
|
31
|
+
* or other secure storage. The manager retains the key in memory only for a limited
|
|
32
|
+
* duration (`retentionPeriod`), uses XOR-based chunk-splitting obfuscation, and
|
|
33
|
+
* includes decoy data to raise the difficulty of discovering the real key in memory.
|
|
34
|
+
*
|
|
35
|
+
* IMPORTANT: While these measures raise the bar for attackers, JavaScript environments
|
|
36
|
+
* do not provide perfect in-memory secrecy.
|
|
37
|
+
*/
|
|
38
|
+
export class PrivilegedKeyManager {
|
|
39
|
+
/**
|
|
40
|
+
* Function that will retrieve the PrivateKey from a secure environment,
|
|
41
|
+
* e.g., an HSM or secure enclave. The reason for key usage is passed in
|
|
42
|
+
* to help with user consent, auditing, and access policy checks.
|
|
43
|
+
*/
|
|
44
|
+
private keyGetter: (reason: string) => Promise<PrivateKey>
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Time (in ms) for which the obfuscated key remains in memory
|
|
48
|
+
* before being automatically destroyed.
|
|
49
|
+
*/
|
|
50
|
+
private retentionPeriod: number
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A list of dynamically generated property names used to store
|
|
54
|
+
* real key chunks (XORed with random pads).
|
|
55
|
+
*/
|
|
56
|
+
private chunkPropNames: string[] = []
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A list of dynamically generated property names used to store
|
|
60
|
+
* the random pads that correspond to the real key chunks.
|
|
61
|
+
*/
|
|
62
|
+
private chunkPadPropNames: string[] = []
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A list of decoy property names that will be removed
|
|
66
|
+
* when the real key is destroyed.
|
|
67
|
+
*/
|
|
68
|
+
private decoyPropNamesDestroy: string[] = []
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A list of decoy property names that remain in memory
|
|
72
|
+
* even after the real key is destroyed (just to cause confusion).
|
|
73
|
+
*/
|
|
74
|
+
private decoyPropNamesRemain: string[] = []
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Handle to the timer that will remove the key from memory
|
|
78
|
+
* after the retention period. If the key is refreshed again
|
|
79
|
+
* within that period, the timer is cleared and re-set.
|
|
80
|
+
*/
|
|
81
|
+
private destroyTimer: any | undefined
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Number of chunks to split the 32-byte key into.
|
|
85
|
+
* Adjust to increase or decrease obfuscation complexity.
|
|
86
|
+
*/
|
|
87
|
+
private readonly CHUNK_COUNT = 4
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param keyGetter - Asynchronous function that retrieves the PrivateKey from a secure environment.
|
|
91
|
+
* @param retentionPeriod - Time in milliseconds to retain the obfuscated key in memory before zeroizing.
|
|
92
|
+
*/
|
|
93
|
+
constructor(
|
|
94
|
+
keyGetter: (reason: string) => Promise<PrivateKey>,
|
|
95
|
+
retentionPeriod = 120_000
|
|
96
|
+
) {
|
|
97
|
+
this.keyGetter = keyGetter
|
|
98
|
+
this.retentionPeriod = retentionPeriod
|
|
99
|
+
|
|
100
|
+
// Initialize some random decoy properties that always remain:
|
|
101
|
+
for (let i = 0; i < 2; i++) {
|
|
102
|
+
const propName = this.generateRandomPropName()
|
|
103
|
+
// Store random garbage to cause confusion
|
|
104
|
+
;(this as any)[propName] = Uint8Array.from(Random(16))
|
|
105
|
+
this.decoyPropNamesRemain.push(propName)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Safely destroys the in-memory obfuscated key material by zeroizing
|
|
111
|
+
* and deleting related fields. Also destroys some (but not all) decoy
|
|
112
|
+
* properties to further confuse an attacker.
|
|
113
|
+
*/
|
|
114
|
+
destroyKey(): void {
|
|
115
|
+
try {
|
|
116
|
+
// Zero out real chunk data
|
|
117
|
+
for (const name of this.chunkPropNames) {
|
|
118
|
+
const data: Uint8Array | undefined = (this as any)[name]
|
|
119
|
+
if (data) {
|
|
120
|
+
data.fill(0)
|
|
121
|
+
}
|
|
122
|
+
delete (this as any)[name]
|
|
123
|
+
}
|
|
124
|
+
for (const name of this.chunkPadPropNames) {
|
|
125
|
+
const data: Uint8Array | undefined = (this as any)[name]
|
|
126
|
+
if (data) {
|
|
127
|
+
data.fill(0)
|
|
128
|
+
}
|
|
129
|
+
delete (this as any)[name]
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Destroy some decoys
|
|
133
|
+
for (const name of this.decoyPropNamesDestroy) {
|
|
134
|
+
const data: Uint8Array | undefined = (this as any)[name]
|
|
135
|
+
if (data) {
|
|
136
|
+
data.fill(0)
|
|
137
|
+
}
|
|
138
|
+
delete (this as any)[name]
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Clear arrays of property names
|
|
142
|
+
this.chunkPropNames = []
|
|
143
|
+
this.chunkPadPropNames = []
|
|
144
|
+
this.decoyPropNamesDestroy = []
|
|
145
|
+
} catch (_) {
|
|
146
|
+
// Swallow any errors in the destruction process
|
|
147
|
+
} finally {
|
|
148
|
+
if (this.destroyTimer) {
|
|
149
|
+
clearTimeout(this.destroyTimer)
|
|
150
|
+
this.destroyTimer = undefined
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Re/sets the destruction timer that removes the key from memory
|
|
157
|
+
* after `retentionPeriod` ms. If a timer is already running, it
|
|
158
|
+
* is cleared and re-set. This ensures the key remains in memory
|
|
159
|
+
* for exactly the desired window after its most recent acquisition.
|
|
160
|
+
*/
|
|
161
|
+
private scheduleKeyDestruction(): void {
|
|
162
|
+
if (this.destroyTimer) {
|
|
163
|
+
// TODO: Consider a constructor flag to avoid clearing timers for higher security
|
|
164
|
+
clearTimeout(this.destroyTimer)
|
|
165
|
+
}
|
|
166
|
+
this.destroyTimer = setTimeout(() => {
|
|
167
|
+
this.destroyKey()
|
|
168
|
+
}, this.retentionPeriod)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* XOR-based obfuscation on a per-chunk basis.
|
|
173
|
+
* This function takes two equal-length byte arrays
|
|
174
|
+
* and returns the XOR combination.
|
|
175
|
+
*/
|
|
176
|
+
private xorBytes(a: Uint8Array, b: Uint8Array): Uint8Array {
|
|
177
|
+
const out = new Uint8Array(a.length)
|
|
178
|
+
for (let i = 0; i < a.length; i++) {
|
|
179
|
+
out[i] = a[i] ^ b[i]
|
|
180
|
+
}
|
|
181
|
+
return out
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Splits the 32-byte key into `this.CHUNK_COUNT` smaller chunks
|
|
186
|
+
* (mostly equal length; the last chunk picks up leftover bytes
|
|
187
|
+
* if 32 is not evenly divisible).
|
|
188
|
+
*/
|
|
189
|
+
private splitKeyIntoChunks(keyBytes: Uint8Array): Uint8Array[] {
|
|
190
|
+
const chunkSize = Math.floor(keyBytes.length / this.CHUNK_COUNT)
|
|
191
|
+
const chunks: Uint8Array[] = []
|
|
192
|
+
let offset = 0
|
|
193
|
+
|
|
194
|
+
for (let i = 0; i < this.CHUNK_COUNT; i++) {
|
|
195
|
+
const size =
|
|
196
|
+
i === this.CHUNK_COUNT - 1 ? keyBytes.length - offset : chunkSize
|
|
197
|
+
chunks.push(keyBytes.slice(offset, offset + size))
|
|
198
|
+
offset += size
|
|
199
|
+
}
|
|
200
|
+
return chunks
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Reassembles the chunks from the dynamic properties, XORs them
|
|
205
|
+
* with their corresponding pads, and returns a single 32-byte
|
|
206
|
+
* Uint8Array representing the raw key.
|
|
207
|
+
*/
|
|
208
|
+
private reassembleKeyFromChunks(): Uint8Array | null {
|
|
209
|
+
try {
|
|
210
|
+
const chunkArrays: Uint8Array[] = []
|
|
211
|
+
for (let i = 0; i < this.chunkPropNames.length; i++) {
|
|
212
|
+
const chunkEnc = (this as any)[this.chunkPropNames[i]] as Uint8Array
|
|
213
|
+
const chunkPad = (this as any)[this.chunkPadPropNames[i]] as Uint8Array
|
|
214
|
+
if (!chunkEnc || !chunkPad || chunkEnc.length !== chunkPad.length) {
|
|
215
|
+
return null
|
|
216
|
+
}
|
|
217
|
+
const rawChunk = this.xorBytes(chunkEnc, chunkPad)
|
|
218
|
+
chunkArrays.push(rawChunk)
|
|
219
|
+
}
|
|
220
|
+
// Concat them back to a single 32-byte array:
|
|
221
|
+
const totalLength = chunkArrays.reduce((sum, c) => sum + c.length, 0)
|
|
222
|
+
if (totalLength !== 32) {
|
|
223
|
+
// We only handle 32-byte keys
|
|
224
|
+
return null
|
|
225
|
+
}
|
|
226
|
+
const rawKey = new Uint8Array(totalLength)
|
|
227
|
+
let offset = 0
|
|
228
|
+
for (const chunk of chunkArrays) {
|
|
229
|
+
rawKey.set(chunk, offset)
|
|
230
|
+
offset += chunk.length
|
|
231
|
+
// Attempt to zero the ephemeral chunk
|
|
232
|
+
chunk.fill(0)
|
|
233
|
+
}
|
|
234
|
+
return rawKey
|
|
235
|
+
} catch (_) {
|
|
236
|
+
// If any property is missing or type mismatch, we return null
|
|
237
|
+
return null
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Generates a random property name to store key chunks or decoy data.
|
|
243
|
+
*/
|
|
244
|
+
private generateRandomPropName(): string {
|
|
245
|
+
// E.g., 8 random hex characters for the property name
|
|
246
|
+
const randomHex = Utils.toHex(Random(4))
|
|
247
|
+
return `_${randomHex}_${Math.floor(Math.random() * 1e6)}`
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Forces a PrivateKey to be represented as exactly 32 bytes, left-padding
|
|
252
|
+
* with zeros if its numeric value has fewer than 32 bytes.
|
|
253
|
+
*/
|
|
254
|
+
private get32ByteRepresentation(privKey: PrivateKey): Uint8Array {
|
|
255
|
+
// The internal "toArray()" can be up to 32 bytes, but sometimes fewer
|
|
256
|
+
// if the numeric value has leading zeros.
|
|
257
|
+
const buf = privKey.toArray()
|
|
258
|
+
if (buf.length > 32) {
|
|
259
|
+
throw new Error(
|
|
260
|
+
'PrivilegedKeyManager: Expected a 32-byte key, but got more.'
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
// Left-pad with zeros if needed
|
|
264
|
+
const keyBytes = new Uint8Array(32)
|
|
265
|
+
keyBytes.set(buf, 32 - buf.length)
|
|
266
|
+
return keyBytes
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Returns the privileged key needed to perform cryptographic operations.
|
|
271
|
+
* Uses in-memory chunk-based obfuscation if the key was already fetched.
|
|
272
|
+
* Otherwise, it calls out to `keyGetter`, splits the 32-byte representation
|
|
273
|
+
* of the key, XORs each chunk with a random pad, and stores them under
|
|
274
|
+
* dynamic property names. Also populates new decoy properties.
|
|
275
|
+
*
|
|
276
|
+
* @param reason - The reason for why the key is needed, passed to keyGetter.
|
|
277
|
+
* @returns The PrivateKey object needed for cryptographic operations.
|
|
278
|
+
*/
|
|
279
|
+
private async getPrivilegedKey(reason: string): Promise<PrivateKey> {
|
|
280
|
+
// If we already have chunk properties, try reassemble
|
|
281
|
+
if (this.chunkPropNames.length > 0 && this.chunkPadPropNames.length > 0) {
|
|
282
|
+
const rawKeyBytes = this.reassembleKeyFromChunks()
|
|
283
|
+
if (rawKeyBytes && rawKeyBytes.length === 32) {
|
|
284
|
+
// Convert 32 raw bytes back to a PrivateKey
|
|
285
|
+
// (Leading zeros are preserved, but PrivateKey() will parse it as a big integer.)
|
|
286
|
+
const hexKey = Utils.toHex([...rawKeyBytes]) // 64 hex chars
|
|
287
|
+
rawKeyBytes.fill(0) // Zero ephemeral copy
|
|
288
|
+
this.scheduleKeyDestruction()
|
|
289
|
+
return new PrivateKey(hexKey, 'hex')
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Otherwise, fetch a fresh key from the secure environment
|
|
294
|
+
const fetchedKey = await this.keyGetter(reason)
|
|
295
|
+
|
|
296
|
+
// Force 32‑byte representation (left-pad if necessary)
|
|
297
|
+
const keyBytes = this.get32ByteRepresentation(fetchedKey)
|
|
298
|
+
|
|
299
|
+
// Clean up any old data first (in case we had something stale)
|
|
300
|
+
this.destroyKey()
|
|
301
|
+
|
|
302
|
+
// Split the key
|
|
303
|
+
const chunks = this.splitKeyIntoChunks(keyBytes)
|
|
304
|
+
|
|
305
|
+
// Store new chunk data under random property names
|
|
306
|
+
for (let i = 0; i < chunks.length; i++) {
|
|
307
|
+
const chunkProp = this.generateRandomPropName()
|
|
308
|
+
const padProp = this.generateRandomPropName()
|
|
309
|
+
this.chunkPropNames.push(chunkProp)
|
|
310
|
+
this.chunkPadPropNames.push(padProp)
|
|
311
|
+
|
|
312
|
+
// Generate random pad of the same length as the chunk
|
|
313
|
+
const pad = Uint8Array.from(Random(chunks[i].length))
|
|
314
|
+
// XOR the chunk to obfuscate
|
|
315
|
+
const obf = this.xorBytes(chunks[i], pad)
|
|
316
|
+
|
|
317
|
+
// Store them in dynamic properties
|
|
318
|
+
;(this as any)[chunkProp] = obf
|
|
319
|
+
;(this as any)[padProp] = pad
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Generate some decoy properties that will be destroyed with the key
|
|
323
|
+
for (let i = 0; i < 2; i++) {
|
|
324
|
+
const decoyProp = this.generateRandomPropName()
|
|
325
|
+
;(this as any)[decoyProp] = Uint8Array.from(Random(32))
|
|
326
|
+
this.decoyPropNamesDestroy.push(decoyProp)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Zero out ephemeral original
|
|
330
|
+
keyBytes.fill(0)
|
|
331
|
+
|
|
332
|
+
// Schedule destruction
|
|
333
|
+
this.scheduleKeyDestruction()
|
|
334
|
+
|
|
335
|
+
// Return the newly fetched key as a normal PrivateKey
|
|
336
|
+
return fetchedKey
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
async getPublicKey(
|
|
340
|
+
args: GetPublicKeyArgs
|
|
341
|
+
): Promise<{ publicKey: PubKeyHex }> {
|
|
342
|
+
return new ProtoWallet(
|
|
343
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
344
|
+
).getPublicKey(args)
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
async revealCounterpartyKeyLinkage(
|
|
348
|
+
args: RevealCounterpartyKeyLinkageArgs
|
|
349
|
+
): Promise<RevealCounterpartyKeyLinkageResult> {
|
|
350
|
+
return new ProtoWallet(
|
|
351
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
352
|
+
).revealCounterpartyKeyLinkage(args)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
async revealSpecificKeyLinkage(
|
|
356
|
+
args: RevealSpecificKeyLinkageArgs
|
|
357
|
+
): Promise<RevealSpecificKeyLinkageResult> {
|
|
358
|
+
return new ProtoWallet(
|
|
359
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
360
|
+
).revealSpecificKeyLinkage(args)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
async encrypt(args: WalletEncryptArgs): Promise<WalletEncryptResult> {
|
|
364
|
+
return new ProtoWallet(
|
|
365
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
366
|
+
).encrypt(args)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
async decrypt(args: WalletDecryptArgs): Promise<WalletDecryptResult> {
|
|
370
|
+
return new ProtoWallet(
|
|
371
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
372
|
+
).decrypt(args)
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
async createHmac(args: CreateHmacArgs): Promise<CreateHmacResult> {
|
|
376
|
+
return new ProtoWallet(
|
|
377
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
378
|
+
).createHmac(args)
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
async verifyHmac(args: VerifyHmacArgs): Promise<VerifyHmacResult> {
|
|
382
|
+
return new ProtoWallet(
|
|
383
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
384
|
+
).verifyHmac(args)
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
async createSignature(
|
|
388
|
+
args: CreateSignatureArgs
|
|
389
|
+
): Promise<CreateSignatureResult> {
|
|
390
|
+
return new ProtoWallet(
|
|
391
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
392
|
+
).createSignature(args)
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
async verifySignature(
|
|
396
|
+
args: VerifySignatureArgs
|
|
397
|
+
): Promise<VerifySignatureResult> {
|
|
398
|
+
return new ProtoWallet(
|
|
399
|
+
await this.getPrivilegedKey(args.privilegedReason as string)
|
|
400
|
+
).verifySignature(args)
|
|
401
|
+
}
|
|
402
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Wallet SDK
|
|
2
|
+
|
|
3
|
+
Primarily `interface` declarations of most abstract Wallet.interfaces related APIs.
|
|
4
|
+
|
|
5
|
+
This includes:
|
|
6
|
+
|
|
7
|
+
- Local copy of Wallet.interfaces, WalletCrypto, WalletSigner, ProtoWallet, CachedKeyDeriver to be merged back to `@bsv/ts-sdk`
|
|
8
|
+
- Certificate and CertOps for standardized certificate handling.
|
|
9
|
+
- WERR_errors.ts standard error classes.
|
|
10
|
+
- WalletError standard error base class.
|
|
11
|
+
- StorageSyncReadyer: a standard subset of WalletStorage for legacy import services.
|
|
12
|
+
- validationHelpers non-asynchronous Wallet.interfaces args object validation methods and interfaces. For interface details standardization and enforcement.
|
|
13
|
+
- `types` generic types for standardization.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { sdk, table } from '../index.client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is the minimal interface required for a WalletStorageProvider to export data to another provider.
|
|
5
|
+
*/
|
|
6
|
+
export interface StorageSyncReader {
|
|
7
|
+
isAvailable(): boolean
|
|
8
|
+
makeAvailable(): Promise<table.Settings>
|
|
9
|
+
|
|
10
|
+
destroy(): Promise<void>
|
|
11
|
+
|
|
12
|
+
/////////////////
|
|
13
|
+
//
|
|
14
|
+
// READ OPERATIONS (state preserving methods)
|
|
15
|
+
//
|
|
16
|
+
/////////////////
|
|
17
|
+
|
|
18
|
+
getSettings(): table.Settings
|
|
19
|
+
|
|
20
|
+
findUserByIdentityKey(key: string): Promise<table.User | undefined>
|
|
21
|
+
|
|
22
|
+
findSyncStates(args: sdk.FindSyncStatesArgs): Promise<table.SyncState[]>
|
|
23
|
+
|
|
24
|
+
findCertificateFields(
|
|
25
|
+
args: sdk.FindCertificateFieldsArgs
|
|
26
|
+
): Promise<table.CertificateField[]>
|
|
27
|
+
findCertificates(args: sdk.FindCertificatesArgs): Promise<table.Certificate[]>
|
|
28
|
+
findCommissions(args: sdk.FindCommissionsArgs): Promise<table.Commission[]>
|
|
29
|
+
findOutputBaskets(
|
|
30
|
+
args: sdk.FindOutputBasketsArgs
|
|
31
|
+
): Promise<table.OutputBasket[]>
|
|
32
|
+
findOutputs(args: sdk.FindOutputsArgs): Promise<table.Output[]>
|
|
33
|
+
findOutputTags(args: sdk.FindOutputTagsArgs): Promise<table.OutputTag[]>
|
|
34
|
+
findTransactions(args: sdk.FindTransactionsArgs): Promise<table.Transaction[]>
|
|
35
|
+
findTxLabels(args: sdk.FindTxLabelsArgs): Promise<table.TxLabel[]>
|
|
36
|
+
|
|
37
|
+
getProvenTxsForUser(
|
|
38
|
+
args: sdk.FindForUserSincePagedArgs
|
|
39
|
+
): Promise<table.ProvenTx[]>
|
|
40
|
+
getProvenTxReqsForUser(
|
|
41
|
+
args: sdk.FindForUserSincePagedArgs
|
|
42
|
+
): Promise<table.ProvenTxReq[]>
|
|
43
|
+
getTxLabelMapsForUser(
|
|
44
|
+
args: sdk.FindForUserSincePagedArgs
|
|
45
|
+
): Promise<table.TxLabelMap[]>
|
|
46
|
+
getOutputTagMapsForUser(
|
|
47
|
+
args: sdk.FindForUserSincePagedArgs
|
|
48
|
+
): Promise<table.OutputTagMap[]>
|
|
49
|
+
|
|
50
|
+
getSyncChunk(args: RequestSyncChunkArgs): Promise<SyncChunk>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* success: Last sync of this user from this storage was successful.
|
|
55
|
+
*
|
|
56
|
+
* error: Last sync protocol operation for this user to this storage threw and error.
|
|
57
|
+
*
|
|
58
|
+
* identified: Configured sync storage has been identified but not sync'ed.
|
|
59
|
+
*
|
|
60
|
+
* unknown: Sync protocol state is unknown.
|
|
61
|
+
*/
|
|
62
|
+
export type SyncStatus =
|
|
63
|
+
| 'success'
|
|
64
|
+
| 'error'
|
|
65
|
+
| 'identified'
|
|
66
|
+
| 'updated'
|
|
67
|
+
| 'unknown'
|
|
68
|
+
|
|
69
|
+
export type SyncProtocolVersion = '0.1.0'
|
|
70
|
+
|
|
71
|
+
export interface RequestSyncChunkArgs {
|
|
72
|
+
/**
|
|
73
|
+
* The storageIdentityKey of the storage supplying the update SyncChunk data.
|
|
74
|
+
*/
|
|
75
|
+
fromStorageIdentityKey: string
|
|
76
|
+
/**
|
|
77
|
+
* The storageIdentityKey of the storage consuming the update SyncChunk data.
|
|
78
|
+
*/
|
|
79
|
+
toStorageIdentityKey: string
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The identity of whose data is being requested
|
|
83
|
+
*/
|
|
84
|
+
identityKey: string
|
|
85
|
+
/**
|
|
86
|
+
* The max updated_at time received from the storage service receiving the request.
|
|
87
|
+
* Will be undefiend if this is the first request or if no data was previously sync'ed.
|
|
88
|
+
*
|
|
89
|
+
* `since` must include items if 'updated_at' is greater or equal. Thus, when not undefined, a sync request should always return at least one item already seen.
|
|
90
|
+
*/
|
|
91
|
+
since?: Date
|
|
92
|
+
/**
|
|
93
|
+
* A rough limit on how large the response should be.
|
|
94
|
+
* The item that exceeds the limit is included and ends adding more items.
|
|
95
|
+
*/
|
|
96
|
+
maxRoughSize: number
|
|
97
|
+
/**
|
|
98
|
+
* The maximum number of items (records) to be returned.
|
|
99
|
+
*/
|
|
100
|
+
maxItems: number
|
|
101
|
+
/**
|
|
102
|
+
* For each entity in dependency order, the offset at which to start returning items
|
|
103
|
+
* from `since`.
|
|
104
|
+
*
|
|
105
|
+
* The entity order is:
|
|
106
|
+
* 0 ProvenTxs
|
|
107
|
+
* 1 ProvenTxReqs
|
|
108
|
+
* 2 OutputBaskets
|
|
109
|
+
* 3 TxLabels
|
|
110
|
+
* 4 OutputTags
|
|
111
|
+
* 5 Transactions
|
|
112
|
+
* 6 TxLabelMaps
|
|
113
|
+
* 7 Commissions
|
|
114
|
+
* 8 Outputs
|
|
115
|
+
* 9 OutputTagMaps
|
|
116
|
+
* 10 Certificates
|
|
117
|
+
* 11 CertificateFields
|
|
118
|
+
*/
|
|
119
|
+
offsets: { name: string; offset: number }[]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Result received from remote `WalletStorage` in response to a `RequestSyncChunkArgs` request.
|
|
124
|
+
*
|
|
125
|
+
* Each property is undefined if there was no attempt to update it. Typically this is caused by size and count limits on this result.
|
|
126
|
+
*
|
|
127
|
+
* If all properties are empty arrays the sync process has received all available new and updated items.
|
|
128
|
+
*/
|
|
129
|
+
export interface SyncChunk {
|
|
130
|
+
fromStorageIdentityKey: string
|
|
131
|
+
toStorageIdentityKey: string
|
|
132
|
+
userIdentityKey: string
|
|
133
|
+
|
|
134
|
+
user?: table.User
|
|
135
|
+
provenTxs?: table.ProvenTx[]
|
|
136
|
+
provenTxReqs?: table.ProvenTxReq[]
|
|
137
|
+
outputBaskets?: table.OutputBasket[]
|
|
138
|
+
txLabels?: table.TxLabel[]
|
|
139
|
+
outputTags?: table.OutputTag[]
|
|
140
|
+
transactions?: table.Transaction[]
|
|
141
|
+
txLabelMaps?: table.TxLabelMap[]
|
|
142
|
+
commissions?: table.Commission[]
|
|
143
|
+
outputs?: table.Output[]
|
|
144
|
+
outputTagMaps?: table.OutputTagMap[]
|
|
145
|
+
certificates?: table.Certificate[]
|
|
146
|
+
certificateFields?: table.CertificateField[]
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ProcessSyncChunkResult {
|
|
150
|
+
done: boolean
|
|
151
|
+
maxUpdated_at: Date | undefined
|
|
152
|
+
updates: number
|
|
153
|
+
inserts: number
|
|
154
|
+
error?: sdk.WalletError
|
|
155
|
+
}
|