@bsv/wallet-toolbox-client 2.1.24 → 2.1.25
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/out/src/CWIStyleWalletManager.d.ts +33 -7
- package/out/src/CWIStyleWalletManager.d.ts.map +1 -1
- package/out/src/CWIStyleWalletManager.js +281 -313
- package/out/src/CWIStyleWalletManager.js.map +1 -1
- package/out/src/SetupClient.d.ts +6 -6
- package/out/src/SetupClient.d.ts.map +1 -1
- package/out/src/SetupClient.js +5 -5
- package/out/src/SetupClient.js.map +1 -1
- package/out/src/SetupWallet.d.ts.map +1 -1
- package/out/src/SimpleWalletManager.d.ts +12 -2
- package/out/src/SimpleWalletManager.d.ts.map +1 -1
- package/out/src/SimpleWalletManager.js +46 -30
- package/out/src/SimpleWalletManager.js.map +1 -1
- package/out/src/Wallet.d.ts +1 -1
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js +102 -100
- package/out/src/Wallet.js.map +1 -1
- package/out/src/WalletAuthenticationManager.d.ts +1 -1
- package/out/src/WalletAuthenticationManager.d.ts.map +1 -1
- package/out/src/WalletAuthenticationManager.js +3 -3
- package/out/src/WalletAuthenticationManager.js.map +1 -1
- package/out/src/WalletLogger.d.ts.map +1 -1
- package/out/src/WalletLogger.js +16 -8
- package/out/src/WalletLogger.js.map +1 -1
- package/out/src/WalletPermissionsManager.d.ts +89 -18
- package/out/src/WalletPermissionsManager.d.ts.map +1 -1
- package/out/src/WalletPermissionsManager.js +656 -870
- package/out/src/WalletPermissionsManager.js.map +1 -1
- package/out/src/WalletSettingsManager.d.ts +2 -2
- package/out/src/WalletSettingsManager.d.ts.map +1 -1
- package/out/src/WalletSettingsManager.js.map +1 -1
- package/out/src/fundWalletP2PKH.d.ts +2 -2
- package/out/src/fundWalletP2PKH.d.ts.map +1 -1
- package/out/src/fundWalletP2PKH.js +11 -10
- package/out/src/fundWalletP2PKH.js.map +1 -1
- package/out/src/mockchain/MockChainMigrations.d.ts +3 -3
- package/out/src/mockchain/MockChainMigrations.d.ts.map +1 -1
- package/out/src/mockchain/MockChainMigrations.js.map +1 -1
- package/out/src/mockchain/MockChainStorage.d.ts.map +1 -1
- package/out/src/mockchain/MockChainStorage.js +5 -5
- package/out/src/mockchain/MockChainStorage.js.map +1 -1
- package/out/src/mockchain/MockChainTracker.d.ts.map +1 -1
- package/out/src/mockchain/MockChainTracker.js +10 -10
- package/out/src/mockchain/MockChainTracker.js.map +1 -1
- package/out/src/mockchain/MockMiner.d.ts.map +1 -1
- package/out/src/mockchain/MockMiner.js +3 -3
- package/out/src/mockchain/MockMiner.js.map +1 -1
- package/out/src/mockchain/MockServices.d.ts +9 -0
- package/out/src/mockchain/MockServices.d.ts.map +1 -1
- package/out/src/mockchain/MockServices.js +195 -238
- package/out/src/mockchain/MockServices.js.map +1 -1
- package/out/src/mockchain/merkleTree.d.ts.map +1 -1
- package/out/src/mockchain/merkleTree.js +21 -12
- package/out/src/mockchain/merkleTree.js.map +1 -1
- package/out/src/monitor/Monitor.d.ts +17 -0
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js +56 -75
- package/out/src/monitor/Monitor.js.map +1 -1
- package/out/src/monitor/tasks/TaskArcSSE.d.ts +2 -2
- package/out/src/monitor/tasks/TaskArcSSE.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskArcSSE.js +10 -23
- package/out/src/monitor/tasks/TaskArcSSE.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +2 -2
- package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckForProofs.js +28 -16
- package/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.js +1 -2
- package/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -1
- package/out/src/monitor/tasks/TaskClock.d.ts +1 -1
- package/out/src/monitor/tasks/TaskClock.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskClock.js +0 -1
- package/out/src/monitor/tasks/TaskClock.js.map +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -1
- package/out/src/monitor/tasks/TaskMineBlock.d.ts +1 -1
- package/out/src/monitor/tasks/TaskMineBlock.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskMineBlock.js.map +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.js +1 -1
- package/out/src/monitor/tasks/TaskMonitorCallHistory.js.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.d.ts +2 -2
- package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskNewHeader.js +7 -5
- package/out/src/monitor/tasks/TaskNewHeader.js.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts +1 -1
- package/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskPurge.js.map +1 -1
- package/out/src/monitor/tasks/TaskReorg.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReorg.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReorg.js +2 -2
- package/out/src/monitor/tasks/TaskReorg.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.js +10 -10
- package/out/src/monitor/tasks/TaskReviewDoubleSpends.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewProvenTxs.js +2 -2
- package/out/src/monitor/tasks/TaskReviewProvenTxs.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.d.ts +1 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskReviewUtxos.js.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskSendWaiting.js +4 -5
- package/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts +1 -1
- package/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskUnFail.js +13 -15
- package/out/src/monitor/tasks/TaskUnFail.js.map +1 -1
- package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -1
- package/out/src/monitor/tasks/WalletMonitorTask.js +3 -1
- package/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -1
- package/out/src/sdk/CertOpsWallet.d.ts +3 -3
- package/out/src/sdk/CertOpsWallet.d.ts.map +1 -1
- package/out/src/sdk/PrivilegedKeyManager.d.ts +3 -3
- package/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -1
- package/out/src/sdk/PrivilegedKeyManager.js +26 -21
- package/out/src/sdk/PrivilegedKeyManager.js.map +1 -1
- package/out/src/sdk/WERR_errors.d.ts.map +1 -1
- package/out/src/sdk/WERR_errors.js +5 -5
- package/out/src/sdk/WERR_errors.js.map +1 -1
- package/out/src/sdk/WalletError.d.ts +1 -1
- package/out/src/sdk/WalletError.d.ts.map +1 -1
- package/out/src/sdk/WalletError.js +10 -3
- package/out/src/sdk/WalletError.js.map +1 -1
- package/out/src/sdk/WalletErrorFromJson.d.ts.map +1 -1
- package/out/src/sdk/WalletErrorFromJson.js +1 -3
- package/out/src/sdk/WalletErrorFromJson.js.map +1 -1
- package/out/src/sdk/WalletServices.interfaces.d.ts +19 -19
- package/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -1
- package/out/src/sdk/types.d.ts +4 -4
- package/out/src/sdk/types.d.ts.map +1 -1
- package/out/src/sdk/types.js +3 -3
- package/out/src/sdk/types.js.map +1 -1
- package/out/src/services/ServiceCollection.d.ts +6 -6
- package/out/src/services/ServiceCollection.d.ts.map +1 -1
- package/out/src/services/ServiceCollection.js +3 -4
- package/out/src/services/ServiceCollection.js.map +1 -1
- package/out/src/services/Services.d.ts +5 -0
- package/out/src/services/Services.d.ts.map +1 -1
- package/out/src/services/Services.js +174 -182
- package/out/src/services/Services.js.map +1 -1
- package/out/src/services/chaintracker/BHServiceClient.d.ts.map +1 -1
- package/out/src/services/chaintracker/BHServiceClient.js +7 -7
- package/out/src/services/chaintracker/BHServiceClient.js.map +1 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -1
- package/out/src/services/chaintracker/ChaintracksChainTracker.js +5 -5
- package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts +5 -3
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts +20 -10
- package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Chaintracks.js +228 -221
- package/out/src/services/chaintracker/chaintracks/Chaintracks.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +9 -10
- package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts +1 -2
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js +3 -3
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js +3 -3
- package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js +2 -2
- package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts +2 -2
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js +6 -39
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts +3 -3
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js +8 -6
- package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js +9 -16
- package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js +34 -22
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js +31 -30
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts +2 -2
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js +11 -10
- package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts +6 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +247 -227
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js +8 -7
- package/out/src/services/chaintracker/chaintracks/util/BulkFileDataReader.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js +35 -25
- package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts +5 -5
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js +13 -11
- package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +0 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js +21 -13
- package/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts +2 -2
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts +1 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js +28 -24
- package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +1 -1
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +9 -10
- package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -1
- package/out/src/services/createDefaultWalletServicesOptions.js +3 -3
- package/out/src/services/createDefaultWalletServicesOptions.js.map +1 -1
- package/out/src/services/providers/ARC.d.ts.map +1 -1
- package/out/src/services/providers/ARC.js +7 -14
- package/out/src/services/providers/ARC.js.map +1 -1
- package/out/src/services/providers/ArcSSEClient.d.ts.map +1 -1
- package/out/src/services/providers/ArcSSEClient.js +1 -1
- package/out/src/services/providers/ArcSSEClient.js.map +1 -1
- package/out/src/services/providers/Bitails.d.ts.map +1 -1
- package/out/src/services/providers/Bitails.js +17 -17
- package/out/src/services/providers/Bitails.js.map +1 -1
- package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -1
- package/out/src/services/providers/SdkWhatsOnChain.js.map +1 -1
- package/out/src/services/providers/WhatsOnChain.d.ts +2 -0
- package/out/src/services/providers/WhatsOnChain.d.ts.map +1 -1
- package/out/src/services/providers/WhatsOnChain.js +109 -233
- package/out/src/services/providers/WhatsOnChain.js.map +1 -1
- package/out/src/services/providers/exchangeRates.d.ts.map +1 -1
- package/out/src/services/providers/exchangeRates.js +3 -3
- package/out/src/services/providers/exchangeRates.js.map +1 -1
- package/out/src/services/providers/getBeefForTxid.d.ts +1 -1
- package/out/src/services/providers/getBeefForTxid.d.ts.map +1 -1
- package/out/src/services/providers/getBeefForTxid.js.map +1 -1
- package/out/src/services/providers/whatsOnChainHelpers.d.ts +68 -0
- package/out/src/services/providers/whatsOnChainHelpers.d.ts.map +1 -0
- package/out/src/services/providers/whatsOnChainHelpers.js +147 -0
- package/out/src/services/providers/whatsOnChainHelpers.js.map +1 -0
- package/out/src/signer/WalletSigner.d.ts.map +1 -1
- package/out/src/signer/WalletSigner.js.map +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js +1 -1
- package/out/src/signer/methods/acquireDirectCertificate.js.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -1
- package/out/src/signer/methods/buildSignableTransaction.js +21 -13
- package/out/src/signer/methods/buildSignableTransaction.js.map +1 -1
- package/out/src/signer/methods/completeSignedTransaction.d.ts.map +1 -1
- package/out/src/signer/methods/completeSignedTransaction.js +20 -21
- package/out/src/signer/methods/completeSignedTransaction.js.map +1 -1
- package/out/src/signer/methods/createAction.d.ts.map +1 -1
- package/out/src/signer/methods/createAction.js +8 -7
- package/out/src/signer/methods/createAction.js.map +1 -1
- package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/signer/methods/internalizeAction.js +8 -6
- package/out/src/signer/methods/internalizeAction.js.map +1 -1
- package/out/src/signer/methods/proveCertificate.js +1 -1
- package/out/src/signer/methods/signAction.d.ts.map +1 -1
- package/out/src/signer/methods/signAction.js +8 -10
- package/out/src/signer/methods/signAction.js.map +1 -1
- package/out/src/storage/StorageIdb.d.ts +16 -1
- package/out/src/storage/StorageIdb.d.ts.map +1 -1
- package/out/src/storage/StorageIdb.js +536 -1221
- package/out/src/storage/StorageIdb.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts +10 -0
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +152 -182
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/StorageReader.d.ts.map +1 -1
- package/out/src/storage/StorageReader.js +8 -7
- package/out/src/storage/StorageReader.js.map +1 -1
- package/out/src/storage/StorageReaderWriter.d.ts.map +1 -1
- package/out/src/storage/StorageReaderWriter.js +32 -32
- package/out/src/storage/StorageReaderWriter.js.map +1 -1
- package/out/src/storage/StorageSyncReader.d.ts.map +1 -1
- package/out/src/storage/StorageSyncReader.js +3 -3
- package/out/src/storage/StorageSyncReader.js.map +1 -1
- package/out/src/storage/WalletStorageManager.d.ts +3 -0
- package/out/src/storage/WalletStorageManager.d.ts.map +1 -1
- package/out/src/storage/WalletStorageManager.js +83 -73
- package/out/src/storage/WalletStorageManager.js.map +1 -1
- package/out/src/storage/idbHelpers.d.ts +42 -0
- package/out/src/storage/idbHelpers.d.ts.map +1 -0
- package/out/src/storage/idbHelpers.js +375 -0
- package/out/src/storage/idbHelpers.js.map +1 -0
- package/out/src/storage/methods/ListActionsSpecOp.d.ts +6 -1
- package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -1
- package/out/src/storage/methods/ListActionsSpecOp.js +28 -2
- package/out/src/storage/methods/ListActionsSpecOp.js.map +1 -1
- package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -1
- package/out/src/storage/methods/ListOutputsSpecOp.js +8 -11
- package/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +83 -0
- package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -1
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js +224 -61
- package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -1
- package/out/src/storage/methods/createAction.d.ts.map +1 -1
- package/out/src/storage/methods/createAction.js +230 -270
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/generateChange.d.ts.map +1 -1
- package/out/src/storage/methods/generateChange.js +99 -80
- package/out/src/storage/methods/generateChange.js.map +1 -1
- package/out/src/storage/methods/getBeefForTransaction.js +15 -13
- package/out/src/storage/methods/getBeefForTransaction.js.map +1 -1
- package/out/src/storage/methods/getSyncChunk.d.ts.map +1 -1
- package/out/src/storage/methods/getSyncChunk.js +4 -3
- package/out/src/storage/methods/getSyncChunk.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +41 -51
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/methods/listActionsIdb.d.ts.map +1 -1
- package/out/src/storage/methods/listActionsIdb.js +85 -110
- package/out/src/storage/methods/listActionsIdb.js.map +1 -1
- package/out/src/storage/methods/listCertificates.d.ts +1 -1
- package/out/src/storage/methods/listCertificates.d.ts.map +1 -1
- package/out/src/storage/methods/listCertificates.js +7 -7
- package/out/src/storage/methods/listCertificates.js.map +1 -1
- package/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -1
- package/out/src/storage/methods/listOutputsIdb.js +24 -27
- package/out/src/storage/methods/listOutputsIdb.js.map +1 -1
- package/out/src/storage/methods/offsetKey.d.ts +1 -1
- package/out/src/storage/methods/offsetKey.d.ts.map +1 -1
- package/out/src/storage/methods/offsetKey.js +3 -5
- package/out/src/storage/methods/offsetKey.js.map +1 -1
- package/out/src/storage/methods/processAction.d.ts +0 -11
- package/out/src/storage/methods/processAction.d.ts.map +1 -1
- package/out/src/storage/methods/processAction.js +90 -83
- package/out/src/storage/methods/processAction.js.map +1 -1
- package/out/src/storage/methods/purgeDataIdb.d.ts.map +1 -1
- package/out/src/storage/methods/purgeDataIdb.js +1 -1
- package/out/src/storage/methods/purgeDataIdb.js.map +1 -1
- package/out/src/storage/methods/reviewStatusIdb.d.ts +1 -1
- package/out/src/storage/methods/reviewStatusIdb.d.ts.map +1 -1
- package/out/src/storage/methods/reviewStatusIdb.js.map +1 -1
- package/out/src/storage/methods/utils.d.ts.map +1 -1
- package/out/src/storage/methods/utils.js +7 -1
- package/out/src/storage/methods/utils.js.map +1 -1
- package/out/src/storage/remoting/StorageClient.d.ts +4 -270
- package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
- package/out/src/storage/remoting/StorageClient.js +16 -423
- package/out/src/storage/remoting/StorageClient.js.map +1 -1
- package/out/src/storage/remoting/StorageClientBase.d.ts +289 -0
- package/out/src/storage/remoting/StorageClientBase.d.ts.map +1 -0
- package/out/src/storage/remoting/StorageClientBase.js +375 -0
- package/out/src/storage/remoting/StorageClientBase.js.map +1 -0
- package/out/src/storage/remoting/entityValidationHelpers.d.ts +29 -0
- package/out/src/storage/remoting/entityValidationHelpers.d.ts.map +1 -0
- package/out/src/storage/remoting/entityValidationHelpers.js +91 -0
- package/out/src/storage/remoting/entityValidationHelpers.js.map +1 -0
- package/out/src/storage/schema/StorageIdbSchema.d.ts +1 -1
- package/out/src/storage/schema/StorageIdbSchema.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityBase.js.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificate.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificate.js +5 -4
- package/out/src/storage/schema/entities/EntityCertificate.js.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityCertificateField.js +5 -7
- package/out/src/storage/schema/entities/EntityCertificateField.js.map +1 -1
- package/out/src/storage/schema/entities/EntityCommission.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityCommission.js +6 -8
- package/out/src/storage/schema/entities/EntityCommission.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutput.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutput.js +21 -24
- package/out/src/storage/schema/entities/EntityOutput.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputBasket.js +6 -6
- package/out/src/storage/schema/entities/EntityOutputBasket.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTag.js +2 -2
- package/out/src/storage/schema/entities/EntityOutputTag.js.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityOutputTagMap.js +4 -6
- package/out/src/storage/schema/entities/EntityOutputTagMap.js.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTx.d.ts +3 -3
- package/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTx.js +22 -23
- package/out/src/storage/schema/entities/EntityProvenTx.js.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +9 -0
- package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityProvenTxReq.js +116 -68
- package/out/src/storage/schema/entities/EntityProvenTxReq.js.map +1 -1
- package/out/src/storage/schema/entities/EntitySyncState.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntitySyncState.js +19 -18
- package/out/src/storage/schema/entities/EntitySyncState.js.map +1 -1
- package/out/src/storage/schema/entities/EntityTransaction.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityTransaction.js +25 -26
- package/out/src/storage/schema/entities/EntityTransaction.js.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabel.js +2 -2
- package/out/src/storage/schema/entities/EntityTxLabel.js.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityTxLabelMap.js +4 -6
- package/out/src/storage/schema/entities/EntityTxLabelMap.js.map +1 -1
- package/out/src/storage/schema/entities/EntityUser.d.ts.map +1 -1
- package/out/src/storage/schema/entities/EntityUser.js +3 -3
- package/out/src/storage/schema/entities/EntityUser.js.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -1
- package/out/src/storage/schema/entities/MergeEntity.js +6 -6
- package/out/src/storage/schema/entities/MergeEntity.js.map +1 -1
- package/out/src/storage/schema/tables/TableCertificate.d.ts +2 -1
- package/out/src/storage/schema/tables/TableCertificate.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableCertificateField.d.ts +1 -1
- package/out/src/storage/schema/tables/TableCertificateField.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableCommission.d.ts +1 -1
- package/out/src/storage/schema/tables/TableCommission.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableMonitorEvent.d.ts +1 -1
- package/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutput.d.ts +3 -2
- package/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutput.js +1 -1
- package/out/src/storage/schema/tables/TableOutput.js.map +1 -1
- package/out/src/storage/schema/tables/TableOutputBasket.d.ts +1 -1
- package/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutputTag.d.ts +1 -1
- package/out/src/storage/schema/tables/TableOutputTag.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableOutputTagMap.d.ts +1 -1
- package/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableProvenTx.d.ts +1 -1
- package/out/src/storage/schema/tables/TableProvenTx.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableProvenTxReq.d.ts +24 -1
- package/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableSettings.d.ts +1 -1
- package/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableSyncState.d.ts +1 -1
- package/out/src/storage/schema/tables/TableSyncState.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableTransaction.d.ts +1 -1
- package/out/src/storage/schema/tables/TableTransaction.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableTxLabel.d.ts +1 -1
- package/out/src/storage/schema/tables/TableTxLabel.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableTxLabelMap.d.ts +1 -1
- package/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +1 -1
- package/out/src/storage/schema/tables/TableUser.d.ts +1 -1
- package/out/src/storage/schema/tables/TableUser.d.ts.map +1 -1
- package/out/src/storage/storageProviderHelpers.d.ts +34 -0
- package/out/src/storage/storageProviderHelpers.d.ts.map +1 -0
- package/out/src/storage/storageProviderHelpers.js +100 -0
- package/out/src/storage/storageProviderHelpers.js.map +1 -0
- package/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -1
- package/out/src/utility/ScriptTemplateBRC29.js +2 -1
- package/out/src/utility/ScriptTemplateBRC29.js.map +1 -1
- package/out/src/utility/aggregateResults.d.ts +1 -1
- package/out/src/utility/aggregateResults.d.ts.map +1 -1
- package/out/src/utility/aggregateResults.js +2 -2
- package/out/src/utility/aggregateResults.js.map +1 -1
- package/out/src/utility/brc114ActionTimeLabels.d.ts +2 -2
- package/out/src/utility/brc114ActionTimeLabels.d.ts.map +1 -1
- package/out/src/utility/brc114ActionTimeLabels.js +16 -9
- package/out/src/utility/brc114ActionTimeLabels.js.map +1 -1
- package/out/src/utility/identityUtils.js +1 -1
- package/out/src/utility/identityUtils.js.map +1 -1
- package/out/src/utility/parseTxScriptOffsets.d.ts +4 -4
- package/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -1
- package/out/src/utility/parseTxScriptOffsets.js.map +1 -1
- package/out/src/utility/stampLog.d.ts.map +1 -1
- package/out/src/utility/stampLog.js +7 -5
- package/out/src/utility/stampLog.js.map +1 -1
- package/out/src/utility/tscProofToMerklePath.d.ts.map +1 -1
- package/out/src/utility/tscProofToMerklePath.js +1 -1
- package/out/src/utility/tscProofToMerklePath.js.map +1 -1
- package/out/src/utility/utilityHelpers.d.ts +1 -2
- package/out/src/utility/utilityHelpers.d.ts.map +1 -1
- package/out/src/utility/utilityHelpers.js +10 -10
- package/out/src/utility/utilityHelpers.js.map +1 -1
- package/out/src/utility/utilityHelpers.noBuffer.d.ts +7 -3
- package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -1
- package/out/src/utility/utilityHelpers.noBuffer.js +3 -3
- package/out/src/utility/utilityHelpers.noBuffer.js.map +1 -1
- package/out/src/wab-client/WABClient.d.ts +1 -1
- package/out/src/wab-client/WABClient.d.ts.map +1 -1
- package/out/src/wab-client/WABClient.js +12 -12
- package/out/src/wab-client/WABClient.js.map +1 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -1
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +3 -3
- package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -1
- package/out/tsconfig.client.tsbuildinfo +1 -1
- package/package.json +7 -6
|
@@ -43,8 +43,8 @@ function stripVerifiedPushDropSignature(fields, lockingPublicKey) {
|
|
|
43
43
|
let writeOffset = 0;
|
|
44
44
|
for (let i = 0; i < protocolFieldCount; i++) {
|
|
45
45
|
const field = fields[i];
|
|
46
|
-
for (
|
|
47
|
-
dataToVerify[writeOffset++] =
|
|
46
|
+
for (const byte of field) {
|
|
47
|
+
dataToVerify[writeOffset++] = byte;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
const signature = sdk_1.Signature.fromDER(trailingField);
|
|
@@ -71,10 +71,10 @@ async function pbkdf2NativeOrWasm(passwordBytes, salt, iterations, keyLen, hash
|
|
|
71
71
|
var _a;
|
|
72
72
|
// ----- fast-path: WebCrypto (both browser & recent Node expose globalThis.crypto.subtle)
|
|
73
73
|
const subtle = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.subtle;
|
|
74
|
-
if (subtle) {
|
|
74
|
+
if (subtle != null) {
|
|
75
75
|
try {
|
|
76
76
|
const baseKey = await subtle.importKey('raw', new Uint8Array(passwordBytes), { name: 'PBKDF2' },
|
|
77
|
-
/*extractable*/ false, ['deriveBits']);
|
|
77
|
+
/* extractable */ false, ['deriveBits']);
|
|
78
78
|
const bits = await subtle.deriveBits({
|
|
79
79
|
name: 'PBKDF2',
|
|
80
80
|
salt: new Uint8Array(salt),
|
|
@@ -83,9 +83,10 @@ async function pbkdf2NativeOrWasm(passwordBytes, salt, iterations, keyLen, hash
|
|
|
83
83
|
}, baseKey, keyLen * 8);
|
|
84
84
|
return Array.from(new Uint8Array(bits));
|
|
85
85
|
}
|
|
86
|
-
catch (
|
|
87
|
-
//
|
|
88
|
-
|
|
86
|
+
catch (webCryptoErr) {
|
|
87
|
+
// WebCrypto is unavailable or refused the algorithm (e.g. non-secure context, old
|
|
88
|
+
// Safari). Fall through to the pure-JS hash-wasm implementation below.
|
|
89
|
+
console.debug('[pbkdf2] WebCrypto path failed, falling back to JS implementation', webCryptoErr);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
const hashFunction = hash === 'sha256' ? (0, hash_wasm_1.createSHA256)() : (0, hash_wasm_1.createSHA512)();
|
|
@@ -113,8 +114,8 @@ async function derivePasswordKey(token, passwordBytes, overrideKdf) {
|
|
|
113
114
|
var _a, _b, _c, _d, _e;
|
|
114
115
|
const kdf = overrideKdf || token.passwordKdf;
|
|
115
116
|
// Legacy token or explicit PBKDF2 request
|
|
116
|
-
if (
|
|
117
|
-
return pbkdf2NativeOrWasm(passwordBytes, token.passwordSalt, (_a = kdf === null || kdf === void 0 ? void 0 : kdf.iterations) !== null && _a !== void 0 ? _a : exports.PBKDF2_NUM_ROUNDS, 32, 'sha512');
|
|
117
|
+
if ((kdf == null) || kdf.algorithm === 'pbkdf2-sha512') {
|
|
118
|
+
return await pbkdf2NativeOrWasm(passwordBytes, token.passwordSalt, (_a = kdf === null || kdf === void 0 ? void 0 : kdf.iterations) !== null && _a !== void 0 ? _a : exports.PBKDF2_NUM_ROUNDS, 32, 'sha512');
|
|
118
119
|
}
|
|
119
120
|
// Argon2id path (UMP v3)
|
|
120
121
|
if (kdf.algorithm === 'argon2id') {
|
|
@@ -207,7 +208,32 @@ class OverlayUMPTokenInteractor {
|
|
|
207
208
|
*/
|
|
208
209
|
async buildAndSend(wallet, // This wallet MUST be the one built for the default profile
|
|
209
210
|
adminOriginator, token, oldTokenToConsume) {
|
|
210
|
-
// 1) Construct the data fields for the new UMP token.
|
|
211
|
+
// 1) Construct the data fields and PushDrop locking script for the new UMP token.
|
|
212
|
+
const fields = this.buildUMPTokenFields(token);
|
|
213
|
+
const script = await new sdk_1.PushDrop(wallet, adminOriginator).lock(fields, [2, 'admin user management token'], '1', 'self',
|
|
214
|
+
/* forSelf= */ true,
|
|
215
|
+
/* includeSignature= */ true);
|
|
216
|
+
const tokenOutput = [{ lockingScript: script.toHex(), satoshis: 1, outputDescription: 'New UMP token output' }];
|
|
217
|
+
// 2) Resolve the old-token input (if provided) and create the action.
|
|
218
|
+
const { resolvedOldToken, inputToken } = await this.resolveOldTokenInput(oldTokenToConsume);
|
|
219
|
+
const inputs = (resolvedOldToken === null || resolvedOldToken === void 0 ? void 0 : resolvedOldToken.currentOutpoint)
|
|
220
|
+
? [{ outpoint: resolvedOldToken.currentOutpoint, unlockingScriptLength: 73, inputDescription: 'Consume old UMP token' }]
|
|
221
|
+
: [];
|
|
222
|
+
const createResult = await this.createUMPAction(wallet, adminOriginator, inputs, tokenOutput, inputToken, resolvedOldToken);
|
|
223
|
+
// 3) If the wallet fully processed it (no signable tx), broadcast and return.
|
|
224
|
+
if (!createResult.signableTransaction) {
|
|
225
|
+
return await this.broadcastFinishedUMPAction(createResult);
|
|
226
|
+
}
|
|
227
|
+
// 4) Sign and broadcast: with old token input or without.
|
|
228
|
+
const reference = createResult.signableTransaction.reference;
|
|
229
|
+
const partialTx = sdk_1.Transaction.fromBEEF(createResult.signableTransaction.tx);
|
|
230
|
+
if (resolvedOldToken === null || resolvedOldToken === void 0 ? void 0 : resolvedOldToken.currentOutpoint) {
|
|
231
|
+
return await this.signAndBroadcastWithOldToken(wallet, adminOriginator, reference, partialTx);
|
|
232
|
+
}
|
|
233
|
+
return await this.signAndBroadcastNewToken(wallet, adminOriginator, reference);
|
|
234
|
+
}
|
|
235
|
+
/** Assembles the ordered number[][] fields array from a UMPToken. */
|
|
236
|
+
buildUMPTokenFields(token) {
|
|
211
237
|
const fields = [];
|
|
212
238
|
fields[0] = token.passwordSalt;
|
|
213
239
|
fields[1] = token.passwordPresentationPrimary;
|
|
@@ -220,148 +246,90 @@ class OverlayUMPTokenInteractor {
|
|
|
220
246
|
fields[8] = token.presentationKeyEncrypted;
|
|
221
247
|
fields[9] = token.passwordKeyEncrypted;
|
|
222
248
|
fields[10] = token.recoveryKeyEncrypted;
|
|
223
|
-
|
|
224
|
-
if (token.profilesEncrypted) {
|
|
249
|
+
if (token.profilesEncrypted != null)
|
|
225
250
|
fields[11] = token.profilesEncrypted;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
// Construct kdfParams JSON
|
|
233
|
-
const kdfParams = {
|
|
234
|
-
iterations: token.passwordKdf.iterations
|
|
235
|
-
};
|
|
236
|
-
if (token.passwordKdf.memoryKiB !== undefined) {
|
|
251
|
+
if (token.umpVersion === 3 && token.passwordKdf != null) {
|
|
252
|
+
const vi = (token.profilesEncrypted == null) ? 11 : 12;
|
|
253
|
+
fields[vi] = [token.umpVersion];
|
|
254
|
+
fields[vi + 1] = sdk_1.Utils.toArray(token.passwordKdf.algorithm, 'utf8');
|
|
255
|
+
const kdfParams = { iterations: token.passwordKdf.iterations };
|
|
256
|
+
if (token.passwordKdf.memoryKiB !== undefined)
|
|
237
257
|
kdfParams.memoryKiB = token.passwordKdf.memoryKiB;
|
|
238
|
-
|
|
239
|
-
if (token.passwordKdf.parallelism !== undefined) {
|
|
258
|
+
if (token.passwordKdf.parallelism !== undefined)
|
|
240
259
|
kdfParams.parallelism = token.passwordKdf.parallelism;
|
|
241
|
-
|
|
242
|
-
if (token.passwordKdf.hashLength !== undefined) {
|
|
260
|
+
if (token.passwordKdf.hashLength !== undefined)
|
|
243
261
|
kdfParams.hashLength = token.passwordKdf.hashLength;
|
|
244
|
-
|
|
245
|
-
fields[versionFieldIndex + 2] = sdk_1.Utils.toArray(JSON.stringify(kdfParams), 'utf8');
|
|
246
|
-
}
|
|
247
|
-
// 2) Create a PushDrop script referencing these fields, locked with the admin key.
|
|
248
|
-
// The signature will be added as trailing metadata by PushDrop (not part of protocol fields).
|
|
249
|
-
const script = await new sdk_1.PushDrop(wallet, adminOriginator).lock(fields, [2, 'admin user management token'], // protocolID
|
|
250
|
-
'1', // keyID
|
|
251
|
-
'self', // counterparty
|
|
252
|
-
/*forSelf=*/ true,
|
|
253
|
-
/*includeSignature=*/ true);
|
|
254
|
-
// 3) Prepare the createAction call. If oldTokenToConsume is provided, gather the outpoint.
|
|
255
|
-
const inputs = [];
|
|
256
|
-
let inputToken;
|
|
257
|
-
if (oldTokenToConsume === null || oldTokenToConsume === void 0 ? void 0 : oldTokenToConsume.currentOutpoint) {
|
|
258
|
-
inputToken = await this.findByOutpoint(oldTokenToConsume.currentOutpoint);
|
|
259
|
-
// If there is no token on the overlay, we can't consume it. Just start over with a new token.
|
|
260
|
-
if (!inputToken) {
|
|
261
|
-
oldTokenToConsume = undefined;
|
|
262
|
-
// Otherwise, add the input
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
inputs.push({
|
|
266
|
-
outpoint: oldTokenToConsume.currentOutpoint,
|
|
267
|
-
unlockingScriptLength: 73, // typical signature length
|
|
268
|
-
inputDescription: 'Consume old UMP token'
|
|
269
|
-
});
|
|
270
|
-
}
|
|
262
|
+
fields[vi + 2] = sdk_1.Utils.toArray(JSON.stringify(kdfParams), 'utf8');
|
|
271
263
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
264
|
+
return fields;
|
|
265
|
+
}
|
|
266
|
+
/** Looks up the old token on the overlay; returns undefined resolved token if not found. */
|
|
267
|
+
async resolveOldTokenInput(oldTokenToConsume) {
|
|
268
|
+
if (!(oldTokenToConsume === null || oldTokenToConsume === void 0 ? void 0 : oldTokenToConsume.currentOutpoint))
|
|
269
|
+
return { resolvedOldToken: undefined, inputToken: undefined };
|
|
270
|
+
const inputToken = await this.findByOutpoint(oldTokenToConsume.currentOutpoint);
|
|
271
|
+
if (inputToken == null)
|
|
272
|
+
return { resolvedOldToken: undefined, inputToken: undefined };
|
|
273
|
+
return { resolvedOldToken: oldTokenToConsume, inputToken };
|
|
274
|
+
}
|
|
275
|
+
/** Creates the UMP action; falls back to a bare recovery action on failure. */
|
|
276
|
+
async createUMPAction(wallet, adminOriginator, inputs, outputs, inputToken, resolvedOldToken) {
|
|
281
277
|
try {
|
|
282
|
-
|
|
283
|
-
description:
|
|
278
|
+
return await wallet.createAction({
|
|
279
|
+
description: (resolvedOldToken == null) ? 'Create new UMP token' : 'Renew UMP token (consume old, create new)',
|
|
284
280
|
inputs,
|
|
285
281
|
outputs,
|
|
286
282
|
inputBEEF: inputToken === null || inputToken === void 0 ? void 0 : inputToken.beef,
|
|
287
|
-
options: {
|
|
288
|
-
randomizeOutputs: false,
|
|
289
|
-
acceptDelayedBroadcast: false
|
|
290
|
-
}
|
|
283
|
+
options: { randomizeOutputs: false, acceptDelayedBroadcast: false }
|
|
291
284
|
}, adminOriginator);
|
|
292
285
|
}
|
|
293
286
|
catch (e) {
|
|
294
287
|
console.error('Error with UMP token update. Attempting a last-ditch effort to get a new one', e);
|
|
295
|
-
|
|
288
|
+
return await wallet.createAction({
|
|
296
289
|
description: 'Recover UMP token',
|
|
297
290
|
outputs,
|
|
298
|
-
options: {
|
|
299
|
-
randomizeOutputs: false,
|
|
300
|
-
acceptDelayedBroadcast: false
|
|
301
|
-
}
|
|
302
|
-
}, adminOriginator);
|
|
303
|
-
}
|
|
304
|
-
// If the transaction is fully processed by the wallet
|
|
305
|
-
if (!createResult.signableTransaction) {
|
|
306
|
-
const finalTxid = createResult.txid || (createResult.tx ? sdk_1.Transaction.fromAtomicBEEF(createResult.tx).id('hex') : undefined);
|
|
307
|
-
if (!finalTxid) {
|
|
308
|
-
throw new Error('No signableTransaction and no final TX found.');
|
|
309
|
-
}
|
|
310
|
-
// Now broadcast to `tm_users` using SHIP
|
|
311
|
-
const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(createResult.tx);
|
|
312
|
-
const result = await this.broadcaster.broadcast(broadcastTx);
|
|
313
|
-
console.log('BROADCAST RESULT', result);
|
|
314
|
-
return `${finalTxid}.0`;
|
|
315
|
-
}
|
|
316
|
-
// 5) If oldTokenToConsume is present, we must sign the input referencing it.
|
|
317
|
-
// (If there's no old token, there's nothing to sign for the input.)
|
|
318
|
-
let finalTxid = '';
|
|
319
|
-
const reference = createResult.signableTransaction.reference;
|
|
320
|
-
const partialTx = sdk_1.Transaction.fromBEEF(createResult.signableTransaction.tx);
|
|
321
|
-
if (oldTokenToConsume === null || oldTokenToConsume === void 0 ? void 0 : oldTokenToConsume.currentOutpoint) {
|
|
322
|
-
// Unlock the old token with a matching PushDrop unlocker
|
|
323
|
-
const unlocker = new sdk_1.PushDrop(wallet, adminOriginator).unlock([2, 'admin user management token'], '1', 'self');
|
|
324
|
-
const unlockingScript = await unlocker.sign(partialTx, 0);
|
|
325
|
-
// Provide it to the wallet
|
|
326
|
-
const signResult = await wallet.signAction({
|
|
327
|
-
reference,
|
|
328
|
-
spends: {
|
|
329
|
-
0: {
|
|
330
|
-
unlockingScript: unlockingScript.toHex()
|
|
331
|
-
}
|
|
332
|
-
}
|
|
291
|
+
options: { randomizeOutputs: false, acceptDelayedBroadcast: false }
|
|
333
292
|
}, adminOriginator);
|
|
334
|
-
finalTxid = signResult.txid || (signResult.tx ? sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex') : '');
|
|
335
|
-
if (!finalTxid) {
|
|
336
|
-
throw new Error('Could not finalize transaction for renewed UMP token.');
|
|
337
|
-
}
|
|
338
|
-
// 6) Broadcast to `tm_users`
|
|
339
|
-
const finalAtomicTx = signResult.tx;
|
|
340
|
-
if (!finalAtomicTx) {
|
|
341
|
-
throw new Error('Final transaction data missing after signing renewed UMP token.');
|
|
342
|
-
}
|
|
343
|
-
const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(finalAtomicTx);
|
|
344
|
-
const result = await this.broadcaster.broadcast(broadcastTx);
|
|
345
|
-
console.log('BROADCAST RESULT', result);
|
|
346
|
-
return `${finalTxid}.0`;
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
// Fallback for creating a new token (no input spending)
|
|
350
|
-
const signResult = await wallet.signAction({ reference, spends: {} }, adminOriginator);
|
|
351
|
-
finalTxid = signResult.txid || (signResult.tx ? sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex') : '');
|
|
352
|
-
if (!finalTxid) {
|
|
353
|
-
throw new Error('Failed to finalize new UMP token transaction.');
|
|
354
|
-
}
|
|
355
|
-
const finalAtomicTx = signResult.tx;
|
|
356
|
-
if (!finalAtomicTx) {
|
|
357
|
-
throw new Error('Final transaction data missing after signing new UMP token.');
|
|
358
|
-
}
|
|
359
|
-
const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(finalAtomicTx);
|
|
360
|
-
const result = await this.broadcaster.broadcast(broadcastTx);
|
|
361
|
-
console.log('BROADCAST RESULT', result);
|
|
362
|
-
return `${finalTxid}.0`;
|
|
363
293
|
}
|
|
364
294
|
}
|
|
295
|
+
/** Handles a fully-finalized (no signable tx) createAction result — broadcasts and returns outpoint. */
|
|
296
|
+
async broadcastFinishedUMPAction(createResult) {
|
|
297
|
+
const finalTxid = createResult.txid || (createResult.tx != null ? sdk_1.Transaction.fromAtomicBEEF(createResult.tx).id('hex') : undefined);
|
|
298
|
+
if (!finalTxid)
|
|
299
|
+
throw new Error('No signableTransaction and no final TX found.');
|
|
300
|
+
if (createResult.tx == null)
|
|
301
|
+
throw new Error('No final TX data to broadcast.');
|
|
302
|
+
const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(createResult.tx);
|
|
303
|
+
const result = await this.broadcaster.broadcast(broadcastTx);
|
|
304
|
+
console.log('BROADCAST RESULT', result);
|
|
305
|
+
return `${finalTxid}.0`;
|
|
306
|
+
}
|
|
307
|
+
/** Signs the old-token input and broadcasts — used during UMP token renewal. */
|
|
308
|
+
async signAndBroadcastWithOldToken(wallet, adminOriginator, reference, partialTx) {
|
|
309
|
+
const unlocker = new sdk_1.PushDrop(wallet, adminOriginator).unlock([2, 'admin user management token'], '1', 'self');
|
|
310
|
+
const unlockingScript = await unlocker.sign(partialTx, 0);
|
|
311
|
+
const signResult = await wallet.signAction({ reference, spends: { 0: { unlockingScript: unlockingScript.toHex() } } }, adminOriginator);
|
|
312
|
+
const finalTxid = signResult.txid || ((signResult.tx == null) ? '' : sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex'));
|
|
313
|
+
if (!finalTxid)
|
|
314
|
+
throw new Error('Could not finalize transaction for renewed UMP token.');
|
|
315
|
+
if (signResult.tx == null)
|
|
316
|
+
throw new Error('Final transaction data missing after signing renewed UMP token.');
|
|
317
|
+
const result = await this.broadcaster.broadcast(sdk_1.Transaction.fromAtomicBEEF(signResult.tx));
|
|
318
|
+
console.log('BROADCAST RESULT', result);
|
|
319
|
+
return `${finalTxid}.0`;
|
|
320
|
+
}
|
|
321
|
+
/** Signs without input spending and broadcasts — used when creating a brand-new UMP token. */
|
|
322
|
+
async signAndBroadcastNewToken(wallet, adminOriginator, reference) {
|
|
323
|
+
const signResult = await wallet.signAction({ reference, spends: {} }, adminOriginator);
|
|
324
|
+
const finalTxid = signResult.txid || ((signResult.tx == null) ? '' : sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex'));
|
|
325
|
+
if (!finalTxid)
|
|
326
|
+
throw new Error('Failed to finalize new UMP token transaction.');
|
|
327
|
+
if (signResult.tx == null)
|
|
328
|
+
throw new Error('Final transaction data missing after signing new UMP token.');
|
|
329
|
+
const result = await this.broadcaster.broadcast(sdk_1.Transaction.fromAtomicBEEF(signResult.tx));
|
|
330
|
+
console.log('BROADCAST RESULT', result);
|
|
331
|
+
return `${finalTxid}.0`;
|
|
332
|
+
}
|
|
365
333
|
/**
|
|
366
334
|
* Attempts to parse a LookupAnswer from the UMP lookup service. If successful,
|
|
367
335
|
* extracts the token fields from the resulting transaction and constructs
|
|
@@ -390,13 +358,19 @@ class OverlayUMPTokenInteractor {
|
|
|
390
358
|
}
|
|
391
359
|
// Parse protocol fields, excluding the trailing PushDrop signature only when
|
|
392
360
|
// it is cryptographically valid for the preceding field payload.
|
|
393
|
-
|
|
361
|
+
const protocolFields = stripVerifiedPushDropSignature(decoded.fields, decoded.lockingPublicKey);
|
|
394
362
|
// Detect v3 token metadata in either layout:
|
|
395
363
|
// - with profilesEncrypted present: [0..10]=core, [11]=profiles, [12]=version, [13]=algorithm, [14]=params
|
|
396
364
|
// - without profilesEncrypted: [0..10]=core, [11]=version, [12]=algorithm, [13]=params
|
|
397
365
|
const hasV3MetadataWithProfiles = protocolFields.length >= 15 && ((_b = protocolFields[12]) === null || _b === void 0 ? void 0 : _b.length) === 1 && protocolFields[12][0] === 3;
|
|
398
366
|
const hasV3MetadataWithoutProfiles = protocolFields.length >= 14 && ((_c = protocolFields[11]) === null || _c === void 0 ? void 0 : _c.length) === 1 && protocolFields[11][0] === 3;
|
|
399
|
-
|
|
367
|
+
let kdfVersionFieldIndex;
|
|
368
|
+
if (hasV3MetadataWithProfiles)
|
|
369
|
+
kdfVersionFieldIndex = 12;
|
|
370
|
+
else if (hasV3MetadataWithoutProfiles)
|
|
371
|
+
kdfVersionFieldIndex = 11;
|
|
372
|
+
else
|
|
373
|
+
kdfVersionFieldIndex = -1;
|
|
400
374
|
// Build the UMP token from these fields, preserving outpoint
|
|
401
375
|
const t = {
|
|
402
376
|
// Core fields (unchanged for all versions)
|
|
@@ -464,7 +438,7 @@ class OverlayUMPTokenInteractor {
|
|
|
464
438
|
if (results.type !== 'output-list') {
|
|
465
439
|
return undefined;
|
|
466
440
|
}
|
|
467
|
-
if (!results.outputs ||
|
|
441
|
+
if (!results.outputs || (results.outputs.length === 0)) {
|
|
468
442
|
return undefined;
|
|
469
443
|
}
|
|
470
444
|
return results.outputs[0];
|
|
@@ -477,6 +451,18 @@ exports.OverlayUMPTokenInteractor = OverlayUMPTokenInteractor;
|
|
|
477
451
|
* supporting multiple user profiles under a single account.
|
|
478
452
|
*/
|
|
479
453
|
class CWIStyleWalletManager {
|
|
454
|
+
/**
|
|
455
|
+
* Resolves once the optional snapshot (if provided to the constructor) has been
|
|
456
|
+
* fully loaded and the wallet is ready to accept calls.
|
|
457
|
+
* When no snapshot is provided this resolves immediately.
|
|
458
|
+
* Await `ready` before calling wallet methods after constructing with a snapshot.
|
|
459
|
+
*/
|
|
460
|
+
get ready() {
|
|
461
|
+
if (this._readyInit === undefined) {
|
|
462
|
+
this._readyInit = this._init();
|
|
463
|
+
}
|
|
464
|
+
return this._readyInit;
|
|
465
|
+
}
|
|
480
466
|
/**
|
|
481
467
|
* Constructs a new CWIStyleWalletManager.
|
|
482
468
|
*
|
|
@@ -522,14 +508,14 @@ class CWIStyleWalletManager {
|
|
|
522
508
|
parallelism: (_d = kdfConfig === null || kdfConfig === void 0 ? void 0 : kdfConfig.parallelism) !== null && _d !== void 0 ? _d : exports.ARGON2ID_DEFAULT_PARALLELISM,
|
|
523
509
|
hashLength: (_e = kdfConfig === null || kdfConfig === void 0 ? void 0 : kdfConfig.hashLength) !== null && _e !== void 0 ? _e : exports.ARGON2ID_DEFAULT_HASH_LENGTH
|
|
524
510
|
};
|
|
525
|
-
//
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
if (
|
|
530
|
-
this.loadSnapshot(
|
|
511
|
+
// Store snapshot for lazy init; callers await ready before calling wallet methods.
|
|
512
|
+
this._initSnapshot = stateSnapshot;
|
|
513
|
+
}
|
|
514
|
+
async _init() {
|
|
515
|
+
if (this._initSnapshot !== undefined) {
|
|
516
|
+
await this.loadSnapshot(this._initSnapshot).catch((err) => {
|
|
531
517
|
console.error('Failed to load snapshot during construction:', err);
|
|
532
|
-
// Clear potentially partially loaded state
|
|
518
|
+
// Clear potentially partially loaded state. destroy() is synchronous.
|
|
533
519
|
this.destroy();
|
|
534
520
|
});
|
|
535
521
|
}
|
|
@@ -547,7 +533,7 @@ class CWIStyleWalletManager {
|
|
|
547
533
|
}
|
|
548
534
|
const hash = sdk_1.Hash.sha256(key);
|
|
549
535
|
const token = await this.UMPTokenInteractor.findByPresentationKeyHash(hash);
|
|
550
|
-
if (
|
|
536
|
+
if (token == null) {
|
|
551
537
|
// No token found -> New user
|
|
552
538
|
this.authenticationFlow = 'new-user';
|
|
553
539
|
this.presentationKey = key;
|
|
@@ -563,119 +549,98 @@ class CWIStyleWalletManager {
|
|
|
563
549
|
* Provides the password.
|
|
564
550
|
*/
|
|
565
551
|
async providePassword(password) {
|
|
566
|
-
if (this.authenticated)
|
|
552
|
+
if (this.authenticated)
|
|
567
553
|
throw new Error('User is already authenticated');
|
|
568
|
-
}
|
|
569
554
|
if (this.authenticationMode === 'presentation-key-and-recovery-key') {
|
|
570
555
|
throw new Error('Password is not needed in this mode');
|
|
571
556
|
}
|
|
572
557
|
if (this.authenticationFlow === 'existing-user') {
|
|
573
|
-
|
|
574
|
-
if (!this.currentUMPToken) {
|
|
575
|
-
throw new Error('Provide presentation or recovery key first.');
|
|
576
|
-
}
|
|
577
|
-
// Use token-driven KDF (legacy PBKDF2 or v3 Argon2id)
|
|
578
|
-
const derivedPasswordKey = await derivePasswordKey(this.currentUMPToken, sdk_1.Utils.toArray(password, 'utf8'));
|
|
579
|
-
let rootPrimaryKey;
|
|
580
|
-
let rootPrivilegedKey; // Only needed for recovery mode
|
|
581
|
-
if (this.authenticationMode === 'presentation-key-and-password') {
|
|
582
|
-
if (!this.presentationKey)
|
|
583
|
-
throw new Error('No presentation key found!');
|
|
584
|
-
const xorKey = this.XOR(this.presentationKey, derivedPasswordKey);
|
|
585
|
-
rootPrimaryKey = new sdk_1.SymmetricKey(xorKey).decrypt(this.currentUMPToken.passwordPresentationPrimary);
|
|
586
|
-
}
|
|
587
|
-
else {
|
|
588
|
-
// 'recovery-key-and-password'
|
|
589
|
-
if (!this.recoveryKey)
|
|
590
|
-
throw new Error('No recovery key found!');
|
|
591
|
-
const primaryDecryptionKey = this.XOR(this.recoveryKey, derivedPasswordKey);
|
|
592
|
-
rootPrimaryKey = new sdk_1.SymmetricKey(primaryDecryptionKey).decrypt(this.currentUMPToken.passwordRecoveryPrimary);
|
|
593
|
-
const privilegedDecryptionKey = this.XOR(rootPrimaryKey, derivedPasswordKey);
|
|
594
|
-
rootPrivilegedKey = new sdk_1.SymmetricKey(privilegedDecryptionKey).decrypt(this.currentUMPToken.passwordPrimaryPrivileged);
|
|
595
|
-
}
|
|
596
|
-
// Build root infrastructure, load profiles, and switch to default profile initially
|
|
597
|
-
await this.setupRootInfrastructure(rootPrimaryKey, rootPrivilegedKey);
|
|
598
|
-
await this.switchProfile(this.activeProfileId);
|
|
558
|
+
await this.handleExistingUserPassword(password);
|
|
599
559
|
}
|
|
600
560
|
else {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
561
|
+
await this.handleNewUserPassword(password);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
/** Handles the password step for an existing user — derives keys, sets up infrastructure. */
|
|
565
|
+
async handleExistingUserPassword(password) {
|
|
566
|
+
if (this.currentUMPToken == null)
|
|
567
|
+
throw new Error('Provide presentation or recovery key first.');
|
|
568
|
+
const derivedPasswordKey = await derivePasswordKey(this.currentUMPToken, sdk_1.Utils.toArray(password, 'utf8'));
|
|
569
|
+
let rootPrimaryKey;
|
|
570
|
+
let rootPrivilegedKey;
|
|
571
|
+
if (this.authenticationMode === 'presentation-key-and-password') {
|
|
572
|
+
if (this.presentationKey == null)
|
|
573
|
+
throw new Error('No presentation key found!');
|
|
574
|
+
rootPrimaryKey = new sdk_1.SymmetricKey(this.XOR(this.presentationKey, derivedPasswordKey))
|
|
575
|
+
.decrypt(this.currentUMPToken.passwordPresentationPrimary);
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
// 'recovery-key-and-password'
|
|
579
|
+
if (this.recoveryKey == null)
|
|
580
|
+
throw new Error('No recovery key found!');
|
|
581
|
+
const primaryDecryptionKey = this.XOR(this.recoveryKey, derivedPasswordKey);
|
|
582
|
+
rootPrimaryKey = new sdk_1.SymmetricKey(primaryDecryptionKey).decrypt(this.currentUMPToken.passwordRecoveryPrimary);
|
|
583
|
+
rootPrivilegedKey = new sdk_1.SymmetricKey(this.XOR(rootPrimaryKey, derivedPasswordKey))
|
|
584
|
+
.decrypt(this.currentUMPToken.passwordPrimaryPrivileged);
|
|
585
|
+
}
|
|
586
|
+
await this.setupRootInfrastructure(rootPrimaryKey, rootPrivilegedKey);
|
|
587
|
+
await this.switchProfile(this.activeProfileId);
|
|
588
|
+
}
|
|
589
|
+
/** Handles the password step for a new user — generates keys, builds UMP token, publishes on-chain. */
|
|
590
|
+
async handleNewUserPassword(password) {
|
|
591
|
+
if (this.authenticationMode !== 'presentation-key-and-password') {
|
|
592
|
+
throw new Error('New-user flow requires presentation key and password mode.');
|
|
593
|
+
}
|
|
594
|
+
if (this.presentationKey == null)
|
|
595
|
+
throw new Error('No presentation key provided for new-user flow.');
|
|
596
|
+
// Generate new keys/salt
|
|
597
|
+
const recoveryKey = (0, sdk_1.Random)(32);
|
|
598
|
+
await this.recoveryKeySaver(recoveryKey);
|
|
599
|
+
const passwordSalt = (0, sdk_1.Random)(32);
|
|
600
|
+
const passwordKey = await derivePasswordKey({ passwordSalt, passwordKdf: this.kdfConfig }, sdk_1.Utils.toArray(password, 'utf8'));
|
|
601
|
+
const rootPrimaryKey = (0, sdk_1.Random)(32);
|
|
602
|
+
const rootPrivilegedKey = (0, sdk_1.Random)(32);
|
|
603
|
+
// Build XOR-combined symmetric keys
|
|
604
|
+
const presentationPassword = new sdk_1.SymmetricKey(this.XOR(this.presentationKey, passwordKey));
|
|
605
|
+
const presentationRecovery = new sdk_1.SymmetricKey(this.XOR(this.presentationKey, recoveryKey));
|
|
606
|
+
const recoveryPassword = new sdk_1.SymmetricKey(this.XOR(recoveryKey, passwordKey));
|
|
607
|
+
const primaryPassword = new sdk_1.SymmetricKey(this.XOR(rootPrimaryKey, passwordKey));
|
|
608
|
+
const tempPrivilegedKeyManager = new PrivilegedKeyManager_1.PrivilegedKeyManager(async () => new sdk_1.PrivateKey(rootPrivilegedKey));
|
|
609
|
+
const wrapKey = async (plaintext) => (await tempPrivilegedKeyManager.encrypt({ plaintext, protocolID: [2, 'admin key wrapping'], keyID: '1' })).ciphertext;
|
|
610
|
+
// Build new UMP token (v3 with KDF metadata, no profiles initially)
|
|
611
|
+
const newToken = {
|
|
612
|
+
passwordSalt,
|
|
613
|
+
passwordPresentationPrimary: presentationPassword.encrypt(rootPrimaryKey),
|
|
614
|
+
passwordRecoveryPrimary: recoveryPassword.encrypt(rootPrimaryKey),
|
|
615
|
+
presentationRecoveryPrimary: presentationRecovery.encrypt(rootPrimaryKey),
|
|
616
|
+
passwordPrimaryPrivileged: primaryPassword.encrypt(rootPrivilegedKey),
|
|
617
|
+
presentationRecoveryPrivileged: presentationRecovery.encrypt(rootPrivilegedKey),
|
|
618
|
+
presentationHash: sdk_1.Hash.sha256(this.presentationKey),
|
|
619
|
+
recoveryHash: sdk_1.Hash.sha256(recoveryKey),
|
|
620
|
+
presentationKeyEncrypted: await wrapKey(this.presentationKey),
|
|
621
|
+
passwordKeyEncrypted: await wrapKey(passwordKey),
|
|
622
|
+
recoveryKeyEncrypted: await wrapKey(recoveryKey),
|
|
623
|
+
profilesEncrypted: undefined,
|
|
624
|
+
umpVersion: 3,
|
|
625
|
+
passwordKdf: this.kdfConfig
|
|
626
|
+
};
|
|
627
|
+
this.currentUMPToken = newToken;
|
|
628
|
+
await this.setupRootInfrastructure(rootPrimaryKey);
|
|
629
|
+
await this.switchProfile(exports.DEFAULT_PROFILE_ID);
|
|
630
|
+
// Fund the *default* wallet if funder provided
|
|
631
|
+
if ((this.newWalletFunder != null) && (this.underlying != null)) {
|
|
632
|
+
try {
|
|
633
|
+
await this.newWalletFunder(this.presentationKey, this.underlying, this.adminOriginator);
|
|
670
634
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
throw new Error(
|
|
635
|
+
catch (e) {
|
|
636
|
+
console.error('Error funding new wallet:', e);
|
|
637
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
638
|
+
throw new Error(`Failed to fund new wallet before publishing UMP token: ${message}`);
|
|
675
639
|
}
|
|
676
|
-
this.currentUMPToken.currentOutpoint = await this.UMPTokenInteractor.buildAndSend(this.underlying, // Use the default profile wallet
|
|
677
|
-
this.adminOriginator, newToken);
|
|
678
640
|
}
|
|
641
|
+
if (this.underlying == null)
|
|
642
|
+
throw new Error('Default profile wallet not built before attempting to publish UMP token.');
|
|
643
|
+
this.currentUMPToken.currentOutpoint = await this.UMPTokenInteractor.buildAndSend(this.underlying, this.adminOriginator, newToken);
|
|
679
644
|
}
|
|
680
645
|
/**
|
|
681
646
|
* Provides the recovery key.
|
|
@@ -694,7 +659,7 @@ class CWIStyleWalletManager {
|
|
|
694
659
|
// Wait for password
|
|
695
660
|
const hash = sdk_1.Hash.sha256(recoveryKey);
|
|
696
661
|
const token = await this.UMPTokenInteractor.findByRecoveryKeyHash(hash);
|
|
697
|
-
if (
|
|
662
|
+
if (token == null)
|
|
698
663
|
throw new Error('No user found with this recovery key');
|
|
699
664
|
this.authenticationFlow = 'existing-user';
|
|
700
665
|
this.recoveryKey = recoveryKey;
|
|
@@ -702,9 +667,9 @@ class CWIStyleWalletManager {
|
|
|
702
667
|
}
|
|
703
668
|
else {
|
|
704
669
|
// 'presentation-key-and-recovery-key'
|
|
705
|
-
if (
|
|
670
|
+
if (this.presentationKey == null)
|
|
706
671
|
throw new Error('Provide the presentation key first');
|
|
707
|
-
if (
|
|
672
|
+
if (this.currentUMPToken == null)
|
|
708
673
|
throw new Error('Current UMP token not found');
|
|
709
674
|
const xorKey = this.XOR(this.presentationKey, recoveryKey);
|
|
710
675
|
const rootPrimaryKey = new sdk_1.SymmetricKey(xorKey).decrypt(this.currentUMPToken.presentationRecoveryPrimary);
|
|
@@ -723,7 +688,7 @@ class CWIStyleWalletManager {
|
|
|
723
688
|
* @returns Encrypted snapshot bytes.
|
|
724
689
|
*/
|
|
725
690
|
saveSnapshot() {
|
|
726
|
-
if (
|
|
691
|
+
if ((this.rootPrimaryKey == null) || (this.currentUMPToken == null)) {
|
|
727
692
|
throw new Error('No root primary key or current UMP token set');
|
|
728
693
|
}
|
|
729
694
|
const snapshotKey = (0, sdk_1.Random)(32);
|
|
@@ -795,18 +760,18 @@ class CWIStyleWalletManager {
|
|
|
795
760
|
}
|
|
796
761
|
}
|
|
797
762
|
async syncUMPToken() {
|
|
798
|
-
if (!this.authenticated ||
|
|
763
|
+
if (!this.authenticated || (this.currentUMPToken == null) || (this.rootPrimaryKey == null)) {
|
|
799
764
|
throw new Error('Wallet not authenticated or missing UMP token.');
|
|
800
765
|
}
|
|
801
766
|
const currentToken = this.currentUMPToken;
|
|
802
767
|
let refreshed;
|
|
803
|
-
if (currentToken.presentationHash && currentToken.presentationHash.length) {
|
|
768
|
+
if (currentToken.presentationHash && (currentToken.presentationHash.length > 0)) {
|
|
804
769
|
refreshed = await this.UMPTokenInteractor.findByPresentationKeyHash(currentToken.presentationHash);
|
|
805
770
|
}
|
|
806
|
-
if (
|
|
771
|
+
if ((refreshed == null) && currentToken.recoveryHash && (currentToken.recoveryHash.length > 0)) {
|
|
807
772
|
refreshed = await this.UMPTokenInteractor.findByRecoveryKeyHash(currentToken.recoveryHash);
|
|
808
773
|
}
|
|
809
|
-
if (
|
|
774
|
+
if (refreshed == null) {
|
|
810
775
|
return false;
|
|
811
776
|
}
|
|
812
777
|
if (refreshed.currentOutpoint &&
|
|
@@ -873,7 +838,7 @@ class CWIStyleWalletManager {
|
|
|
873
838
|
* @returns The ID of the newly created profile.
|
|
874
839
|
*/
|
|
875
840
|
async addProfile(name) {
|
|
876
|
-
if (!this.authenticated ||
|
|
841
|
+
if (!this.authenticated || (this.rootPrimaryKey == null) || (this.currentUMPToken == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
877
842
|
throw new Error('Wallet not fully initialized or authenticated.');
|
|
878
843
|
}
|
|
879
844
|
// Ensure name is unique (including 'default')
|
|
@@ -904,7 +869,7 @@ class CWIStyleWalletManager {
|
|
|
904
869
|
* @param profileId The 16-byte ID of the profile to delete.
|
|
905
870
|
*/
|
|
906
871
|
async deleteProfile(profileId) {
|
|
907
|
-
if (!this.authenticated ||
|
|
872
|
+
if (!this.authenticated || (this.rootPrimaryKey == null) || (this.currentUMPToken == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
908
873
|
throw new Error('Wallet not fully initialized or authenticated.');
|
|
909
874
|
}
|
|
910
875
|
if (profileId.every(x => x === 0)) {
|
|
@@ -931,7 +896,7 @@ class CWIStyleWalletManager {
|
|
|
931
896
|
* @param profileId The 16-byte ID of the profile to switch to (use DEFAULT_PROFILE_ID for default).
|
|
932
897
|
*/
|
|
933
898
|
async switchProfile(profileId) {
|
|
934
|
-
if (!this.authenticated ||
|
|
899
|
+
if (!this.authenticated || (this.rootPrimaryKey == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
935
900
|
throw new Error('Cannot switch profile: Wallet not authenticated or root keys missing.');
|
|
936
901
|
}
|
|
937
902
|
let profilePrimaryKey;
|
|
@@ -945,7 +910,7 @@ class CWIStyleWalletManager {
|
|
|
945
910
|
else {
|
|
946
911
|
// Switching to a non-default profile
|
|
947
912
|
const profile = this.profiles.find(p => p.id.every((x, i) => x === profileId[i]));
|
|
948
|
-
if (
|
|
913
|
+
if (profile == null) {
|
|
949
914
|
throw new Error('Profile not found.');
|
|
950
915
|
}
|
|
951
916
|
profilePrimaryKey = this.XOR(this.rootPrimaryKey, profile.primaryPad);
|
|
@@ -959,9 +924,9 @@ class CWIStyleWalletManager {
|
|
|
959
924
|
const rootPrivileged = await this.rootPrivilegedKeyManager.getPrivilegedKey(reason);
|
|
960
925
|
const rootPrivilegedBytes = rootPrivileged.toArray();
|
|
961
926
|
// Apply the profile's pad if applicable
|
|
962
|
-
const profilePrivilegedBytes = profilePrivilegedPad
|
|
963
|
-
?
|
|
964
|
-
: rootPrivilegedBytes;
|
|
927
|
+
const profilePrivilegedBytes = (profilePrivilegedPad == null)
|
|
928
|
+
? rootPrivilegedBytes
|
|
929
|
+
: this.XOR(rootPrivilegedBytes, profilePrivilegedPad);
|
|
965
930
|
return new sdk_1.PrivateKey(profilePrivilegedBytes);
|
|
966
931
|
});
|
|
967
932
|
// Build the underlying wallet for the specific profile
|
|
@@ -975,7 +940,7 @@ class CWIStyleWalletManager {
|
|
|
975
940
|
*/
|
|
976
941
|
async changePassword(newPassword) {
|
|
977
942
|
var _a;
|
|
978
|
-
if (!this.authenticated ||
|
|
943
|
+
if (!this.authenticated || (this.currentUMPToken == null) || (this.rootPrimaryKey == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
979
944
|
throw new Error('Not authenticated or missing required data.');
|
|
980
945
|
}
|
|
981
946
|
const passwordSalt = (0, sdk_1.Random)(32);
|
|
@@ -998,16 +963,16 @@ class CWIStyleWalletManager {
|
|
|
998
963
|
* Retrieves the current recovery key. Requires privileged access.
|
|
999
964
|
*/
|
|
1000
965
|
async getRecoveryKey() {
|
|
1001
|
-
if (!this.authenticated ||
|
|
966
|
+
if (!this.authenticated || (this.currentUMPToken == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
1002
967
|
throw new Error('Not authenticated or missing required data.');
|
|
1003
968
|
}
|
|
1004
|
-
return this.getFactor('recoveryKey');
|
|
969
|
+
return await this.getFactor('recoveryKey');
|
|
1005
970
|
}
|
|
1006
971
|
/**
|
|
1007
972
|
* Changes the user's recovery key. Prompts user to save the new key.
|
|
1008
973
|
*/
|
|
1009
974
|
async changeRecoveryKey() {
|
|
1010
|
-
if (!this.authenticated ||
|
|
975
|
+
if (!this.authenticated || (this.currentUMPToken == null) || (this.rootPrimaryKey == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
1011
976
|
throw new Error('Not authenticated or missing required data.');
|
|
1012
977
|
}
|
|
1013
978
|
// Decrypt existing factors needed
|
|
@@ -1025,7 +990,7 @@ class CWIStyleWalletManager {
|
|
|
1025
990
|
* Changes the user's presentation key.
|
|
1026
991
|
*/
|
|
1027
992
|
async changePresentationKey(newPresentationKey) {
|
|
1028
|
-
if (!this.authenticated ||
|
|
993
|
+
if (!this.authenticated || (this.currentUMPToken == null) || (this.rootPrimaryKey == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
1029
994
|
throw new Error('Not authenticated or missing required data.');
|
|
1030
995
|
}
|
|
1031
996
|
if (newPresentationKey.length !== 32) {
|
|
@@ -1039,7 +1004,7 @@ class CWIStyleWalletManager {
|
|
|
1039
1004
|
recoveryKey, this.rootPrimaryKey, rootPrivilegedKey, this.profiles // Preserve profiles
|
|
1040
1005
|
);
|
|
1041
1006
|
// Update the temporarily stored key if it was set
|
|
1042
|
-
if (this.presentationKey) {
|
|
1007
|
+
if (this.presentationKey != null) {
|
|
1043
1008
|
this.presentationKey = newPresentationKey;
|
|
1044
1009
|
}
|
|
1045
1010
|
}
|
|
@@ -1066,7 +1031,7 @@ class CWIStyleWalletManager {
|
|
|
1066
1031
|
* @returns The decrypted key bytes.
|
|
1067
1032
|
*/
|
|
1068
1033
|
async getFactor(factorName) {
|
|
1069
|
-
if (!this.authenticated ||
|
|
1034
|
+
if (!this.authenticated || (this.currentUMPToken == null) || (this.rootPrivilegedKeyManager == null)) {
|
|
1070
1035
|
throw new Error(`Cannot get factor "${factorName}": Wallet not ready.`);
|
|
1071
1036
|
}
|
|
1072
1037
|
const protocolID = [2, 'admin key wrapping']; // Protocol used for encrypting factors
|
|
@@ -1114,7 +1079,7 @@ class CWIStyleWalletManager {
|
|
|
1114
1079
|
async updateAuthFactors(passwordSalt, passwordKey, presentationKey, recoveryKey, rootPrimaryKey, rootPrivilegedKey, // Explicitly pass the root key bytes
|
|
1115
1080
|
profiles // Pass current/new profiles list
|
|
1116
1081
|
) {
|
|
1117
|
-
if (!this.authenticated ||
|
|
1082
|
+
if (!this.authenticated || (this.rootPrimaryKey == null) || (this.currentUMPToken == null)) {
|
|
1118
1083
|
throw new Error('Wallet is not properly authenticated or missing data for update.');
|
|
1119
1084
|
}
|
|
1120
1085
|
// Ensure we have the OLD token to consume
|
|
@@ -1131,7 +1096,7 @@ class CWIStyleWalletManager {
|
|
|
1131
1096
|
const tempRootPrivilegedKeyManager = new PrivilegedKeyManager_1.PrivilegedKeyManager(async () => new sdk_1.PrivateKey(rootPrivilegedKey));
|
|
1132
1097
|
// Encrypt profiles if provided
|
|
1133
1098
|
let profilesEncrypted;
|
|
1134
|
-
if (profiles && profiles.length > 0) {
|
|
1099
|
+
if ((profiles != null) && profiles.length > 0) {
|
|
1135
1100
|
const profilesJson = JSON.stringify(profiles);
|
|
1136
1101
|
const profilesBytes = sdk_1.Utils.toArray(profilesJson, 'utf8');
|
|
1137
1102
|
profilesEncrypted = new sdk_1.SymmetricKey(rootPrimaryKey).encrypt(profilesBytes);
|
|
@@ -1166,12 +1131,12 @@ class CWIStyleWalletManager {
|
|
|
1166
1131
|
keyID: '1'
|
|
1167
1132
|
})).ciphertext,
|
|
1168
1133
|
profilesEncrypted, // Add encrypted profiles
|
|
1169
|
-
...(kdfMetadata
|
|
1170
|
-
? {
|
|
1134
|
+
...(kdfMetadata == null
|
|
1135
|
+
? {}
|
|
1136
|
+
: {
|
|
1171
1137
|
umpVersion: 3,
|
|
1172
1138
|
passwordKdf: kdfMetadata
|
|
1173
|
-
}
|
|
1174
|
-
: {})
|
|
1139
|
+
})
|
|
1175
1140
|
// currentOutpoint will be set after publishing
|
|
1176
1141
|
};
|
|
1177
1142
|
// We need the wallet built for the DEFAULT profile to publish the UMP token.
|
|
@@ -1183,7 +1148,7 @@ class CWIStyleWalletManager {
|
|
|
1183
1148
|
await this.switchProfile(exports.DEFAULT_PROFILE_ID); // This rebuilds this.underlying
|
|
1184
1149
|
walletToUse = this.underlying;
|
|
1185
1150
|
}
|
|
1186
|
-
if (
|
|
1151
|
+
if (walletToUse == null) {
|
|
1187
1152
|
throw new Error('Default profile wallet could not be activated for UMP token update.');
|
|
1188
1153
|
}
|
|
1189
1154
|
// Publish the new token on-chain, consuming the old one
|
|
@@ -1230,7 +1195,7 @@ class CWIStyleWalletManager {
|
|
|
1230
1195
|
writeArray(token.passwordKeyEncrypted); // 9
|
|
1231
1196
|
writeArray(token.recoveryKeyEncrypted); // 10
|
|
1232
1197
|
// Write optional profiles field
|
|
1233
|
-
if (token.profilesEncrypted && token.profilesEncrypted.length > 0) {
|
|
1198
|
+
if ((token.profilesEncrypted != null) && token.profilesEncrypted.length > 0) {
|
|
1234
1199
|
writer.writeUInt8(1); // Flag indicating profiles present
|
|
1235
1200
|
writeArray(token.profilesEncrypted);
|
|
1236
1201
|
}
|
|
@@ -1360,18 +1325,18 @@ class CWIStyleWalletManager {
|
|
|
1360
1325
|
* @param ephemeralRootPrivilegedKey Optional root privileged key (e.g., during recovery flows).
|
|
1361
1326
|
*/
|
|
1362
1327
|
async setupRootInfrastructure(rootPrimaryKey, ephemeralRootPrivilegedKey) {
|
|
1363
|
-
if (
|
|
1328
|
+
if (this.currentUMPToken == null) {
|
|
1364
1329
|
throw new Error('A UMP token must exist before setting up root infrastructure!');
|
|
1365
1330
|
}
|
|
1366
1331
|
this.rootPrimaryKey = rootPrimaryKey;
|
|
1367
1332
|
// Store ephemeral key if provided, for one-time use by the manager
|
|
1368
|
-
let oneTimePrivilegedKey = ephemeralRootPrivilegedKey
|
|
1369
|
-
?
|
|
1370
|
-
:
|
|
1333
|
+
let oneTimePrivilegedKey = (ephemeralRootPrivilegedKey == null)
|
|
1334
|
+
? undefined
|
|
1335
|
+
: new sdk_1.PrivateKey(ephemeralRootPrivilegedKey);
|
|
1371
1336
|
// Create the ROOT PrivilegedKeyManager
|
|
1372
1337
|
this.rootPrivilegedKeyManager = new PrivilegedKeyManager_1.PrivilegedKeyManager(async (reason) => {
|
|
1373
1338
|
// 1. Use one-time key if available (for recovery)
|
|
1374
|
-
if (oneTimePrivilegedKey) {
|
|
1339
|
+
if (oneTimePrivilegedKey != null) {
|
|
1375
1340
|
const tempKey = oneTimePrivilegedKey;
|
|
1376
1341
|
oneTimePrivilegedKey = undefined; // Consume it
|
|
1377
1342
|
return tempKey;
|
|
@@ -1384,7 +1349,10 @@ class CWIStyleWalletManager {
|
|
|
1384
1349
|
const decryptedPrivileged = new sdk_1.SymmetricKey(privilegedDecryptor).decrypt(this.currentUMPToken.passwordPrimaryPrivileged);
|
|
1385
1350
|
return !!decryptedPrivileged; // Test passes if decryption works
|
|
1386
1351
|
}
|
|
1387
|
-
catch (
|
|
1352
|
+
catch (_intentionallyIgnored) {
|
|
1353
|
+
// Decryption failure means the password candidate is wrong — this is the
|
|
1354
|
+
// expected rejection path for an incorrect password. Returning false causes
|
|
1355
|
+
// the password-retriever loop to prompt the user again rather than crashing.
|
|
1388
1356
|
return false;
|
|
1389
1357
|
}
|
|
1390
1358
|
});
|
|
@@ -1396,7 +1364,7 @@ class CWIStyleWalletManager {
|
|
|
1396
1364
|
});
|
|
1397
1365
|
// Decrypt and load profiles if present in the token
|
|
1398
1366
|
this.profiles = []; // Clear existing profiles before loading
|
|
1399
|
-
if (this.currentUMPToken.profilesEncrypted && this.currentUMPToken.profilesEncrypted.length > 0) {
|
|
1367
|
+
if ((this.currentUMPToken.profilesEncrypted != null) && this.currentUMPToken.profilesEncrypted.length > 0) {
|
|
1400
1368
|
try {
|
|
1401
1369
|
const decryptedProfileBytes = new sdk_1.SymmetricKey(rootPrimaryKey).decrypt(this.currentUMPToken.profilesEncrypted);
|
|
1402
1370
|
const profilesJson = sdk_1.Utils.toUTF8(decryptedProfileBytes);
|
|
@@ -1424,7 +1392,7 @@ class CWIStyleWalletManager {
|
|
|
1424
1392
|
if (!this.authenticated) {
|
|
1425
1393
|
throw new Error('User is not authenticated.');
|
|
1426
1394
|
}
|
|
1427
|
-
if (
|
|
1395
|
+
if (this.underlying == null) {
|
|
1428
1396
|
// This might happen if authentication succeeded but profile switching failed
|
|
1429
1397
|
throw new Error('Underlying wallet for the active profile is not initialized.');
|
|
1430
1398
|
}
|
|
@@ -1435,91 +1403,91 @@ class CWIStyleWalletManager {
|
|
|
1435
1403
|
// Example proxy method (repeat pattern for all others)
|
|
1436
1404
|
async getPublicKey(args, originator) {
|
|
1437
1405
|
this.checkAuthAndUnderlying(originator);
|
|
1438
|
-
return this.underlying.getPublicKey(args, originator);
|
|
1406
|
+
return await this.underlying.getPublicKey(args, originator);
|
|
1439
1407
|
}
|
|
1440
1408
|
async revealCounterpartyKeyLinkage(args, originator) {
|
|
1441
1409
|
this.checkAuthAndUnderlying(originator);
|
|
1442
|
-
return this.underlying.revealCounterpartyKeyLinkage(args, originator);
|
|
1410
|
+
return await this.underlying.revealCounterpartyKeyLinkage(args, originator);
|
|
1443
1411
|
}
|
|
1444
1412
|
async revealSpecificKeyLinkage(args, originator) {
|
|
1445
1413
|
this.checkAuthAndUnderlying(originator);
|
|
1446
|
-
return this.underlying.revealSpecificKeyLinkage(args, originator);
|
|
1414
|
+
return await this.underlying.revealSpecificKeyLinkage(args, originator);
|
|
1447
1415
|
}
|
|
1448
1416
|
async encrypt(args, originator) {
|
|
1449
1417
|
this.checkAuthAndUnderlying(originator);
|
|
1450
|
-
return this.underlying.encrypt(args, originator);
|
|
1418
|
+
return await this.underlying.encrypt(args, originator);
|
|
1451
1419
|
}
|
|
1452
1420
|
async decrypt(args, originator) {
|
|
1453
1421
|
this.checkAuthAndUnderlying(originator);
|
|
1454
|
-
return this.underlying.decrypt(args, originator);
|
|
1422
|
+
return await this.underlying.decrypt(args, originator);
|
|
1455
1423
|
}
|
|
1456
1424
|
async createHmac(args, originator) {
|
|
1457
1425
|
this.checkAuthAndUnderlying(originator);
|
|
1458
|
-
return this.underlying.createHmac(args, originator);
|
|
1426
|
+
return await this.underlying.createHmac(args, originator);
|
|
1459
1427
|
}
|
|
1460
1428
|
async verifyHmac(args, originator) {
|
|
1461
1429
|
this.checkAuthAndUnderlying(originator);
|
|
1462
|
-
return this.underlying.verifyHmac(args, originator);
|
|
1430
|
+
return await this.underlying.verifyHmac(args, originator);
|
|
1463
1431
|
}
|
|
1464
1432
|
async createSignature(args, originator) {
|
|
1465
1433
|
this.checkAuthAndUnderlying(originator);
|
|
1466
|
-
return this.underlying.createSignature(args, originator);
|
|
1434
|
+
return await this.underlying.createSignature(args, originator);
|
|
1467
1435
|
}
|
|
1468
1436
|
async verifySignature(args, originator) {
|
|
1469
1437
|
this.checkAuthAndUnderlying(originator);
|
|
1470
|
-
return this.underlying.verifySignature(args, originator);
|
|
1438
|
+
return await this.underlying.verifySignature(args, originator);
|
|
1471
1439
|
}
|
|
1472
1440
|
async createAction(args, originator) {
|
|
1473
1441
|
this.checkAuthAndUnderlying(originator);
|
|
1474
|
-
return this.underlying.createAction(args, originator);
|
|
1442
|
+
return await this.underlying.createAction(args, originator);
|
|
1475
1443
|
}
|
|
1476
1444
|
async signAction(args, originator) {
|
|
1477
1445
|
this.checkAuthAndUnderlying(originator);
|
|
1478
|
-
return this.underlying.signAction(args, originator);
|
|
1446
|
+
return await this.underlying.signAction(args, originator);
|
|
1479
1447
|
}
|
|
1480
1448
|
async abortAction(args, originator) {
|
|
1481
1449
|
this.checkAuthAndUnderlying(originator);
|
|
1482
|
-
return this.underlying.abortAction(args, originator);
|
|
1450
|
+
return await this.underlying.abortAction(args, originator);
|
|
1483
1451
|
}
|
|
1484
1452
|
async listActions(args, originator) {
|
|
1485
1453
|
this.checkAuthAndUnderlying(originator);
|
|
1486
|
-
return this.underlying.listActions(args, originator);
|
|
1454
|
+
return await this.underlying.listActions(args, originator);
|
|
1487
1455
|
}
|
|
1488
1456
|
async internalizeAction(args, originator) {
|
|
1489
1457
|
this.checkAuthAndUnderlying(originator);
|
|
1490
|
-
return this.underlying.internalizeAction(args, originator);
|
|
1458
|
+
return await this.underlying.internalizeAction(args, originator);
|
|
1491
1459
|
}
|
|
1492
1460
|
async listOutputs(args, originator) {
|
|
1493
1461
|
this.checkAuthAndUnderlying(originator);
|
|
1494
|
-
return this.underlying.listOutputs(args, originator);
|
|
1462
|
+
return await this.underlying.listOutputs(args, originator);
|
|
1495
1463
|
}
|
|
1496
1464
|
async relinquishOutput(args, originator) {
|
|
1497
1465
|
this.checkAuthAndUnderlying(originator);
|
|
1498
|
-
return this.underlying.relinquishOutput(args, originator);
|
|
1466
|
+
return await this.underlying.relinquishOutput(args, originator);
|
|
1499
1467
|
}
|
|
1500
1468
|
async acquireCertificate(args, originator) {
|
|
1501
1469
|
this.checkAuthAndUnderlying(originator);
|
|
1502
|
-
return this.underlying.acquireCertificate(args, originator);
|
|
1470
|
+
return await this.underlying.acquireCertificate(args, originator);
|
|
1503
1471
|
}
|
|
1504
1472
|
async listCertificates(args, originator) {
|
|
1505
1473
|
this.checkAuthAndUnderlying(originator);
|
|
1506
|
-
return this.underlying.listCertificates(args, originator);
|
|
1474
|
+
return await this.underlying.listCertificates(args, originator);
|
|
1507
1475
|
}
|
|
1508
1476
|
async proveCertificate(args, originator) {
|
|
1509
1477
|
this.checkAuthAndUnderlying(originator);
|
|
1510
|
-
return this.underlying.proveCertificate(args, originator);
|
|
1478
|
+
return await this.underlying.proveCertificate(args, originator);
|
|
1511
1479
|
}
|
|
1512
1480
|
async relinquishCertificate(args, originator) {
|
|
1513
1481
|
this.checkAuthAndUnderlying(originator);
|
|
1514
|
-
return this.underlying.relinquishCertificate(args, originator);
|
|
1482
|
+
return await this.underlying.relinquishCertificate(args, originator);
|
|
1515
1483
|
}
|
|
1516
1484
|
async discoverByIdentityKey(args, originator) {
|
|
1517
1485
|
this.checkAuthAndUnderlying(originator);
|
|
1518
|
-
return this.underlying.discoverByIdentityKey(args, originator);
|
|
1486
|
+
return await this.underlying.discoverByIdentityKey(args, originator);
|
|
1519
1487
|
}
|
|
1520
1488
|
async discoverByAttributes(args, originator) {
|
|
1521
1489
|
this.checkAuthAndUnderlying(originator);
|
|
1522
|
-
return this.underlying.discoverByAttributes(args, originator);
|
|
1490
|
+
return await this.underlying.discoverByAttributes(args, originator);
|
|
1523
1491
|
}
|
|
1524
1492
|
async isAuthenticated(_, originator) {
|
|
1525
1493
|
if (!this.authenticated) {
|
|
@@ -1534,26 +1502,26 @@ class CWIStyleWalletManager {
|
|
|
1534
1502
|
if (originator === this.adminOriginator) {
|
|
1535
1503
|
throw new Error('External applications are not allowed to use the admin originator.');
|
|
1536
1504
|
}
|
|
1537
|
-
while (!this.authenticated ||
|
|
1505
|
+
while (!this.authenticated || (this.underlying == null)) {
|
|
1538
1506
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
1539
1507
|
}
|
|
1540
1508
|
return await this.underlying.waitForAuthentication({}, originator);
|
|
1541
1509
|
}
|
|
1542
1510
|
async getHeight(_, originator) {
|
|
1543
1511
|
this.checkAuthAndUnderlying(originator);
|
|
1544
|
-
return this.underlying.getHeight({}, originator);
|
|
1512
|
+
return await this.underlying.getHeight({}, originator);
|
|
1545
1513
|
}
|
|
1546
1514
|
async getHeaderForHeight(args, originator) {
|
|
1547
1515
|
this.checkAuthAndUnderlying(originator);
|
|
1548
|
-
return this.underlying.getHeaderForHeight(args, originator);
|
|
1516
|
+
return await this.underlying.getHeaderForHeight(args, originator);
|
|
1549
1517
|
}
|
|
1550
1518
|
async getNetwork(_, originator) {
|
|
1551
1519
|
this.checkAuthAndUnderlying(originator);
|
|
1552
|
-
return this.underlying.getNetwork({}, originator);
|
|
1520
|
+
return await this.underlying.getNetwork({}, originator);
|
|
1553
1521
|
}
|
|
1554
1522
|
async getVersion(_, originator) {
|
|
1555
1523
|
this.checkAuthAndUnderlying(originator);
|
|
1556
|
-
return this.underlying.getVersion({}, originator);
|
|
1524
|
+
return await this.underlying.getVersion({}, originator);
|
|
1557
1525
|
}
|
|
1558
1526
|
}
|
|
1559
1527
|
exports.CWIStyleWalletManager = CWIStyleWalletManager;
|