@bsv/wallet-toolbox 1.1.23 → 1.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.
Files changed (201) hide show
  1. package/docs/client.md +2404 -870
  2. package/docs/setup.md +102 -134
  3. package/docs/wallet.md +2404 -870
  4. package/out/src/CWIStyleWalletManager.d.ts +411 -0
  5. package/out/src/CWIStyleWalletManager.d.ts.map +1 -0
  6. package/out/src/CWIStyleWalletManager.js +1131 -0
  7. package/out/src/CWIStyleWalletManager.js.map +1 -0
  8. package/out/src/Setup.d.ts +252 -8
  9. package/out/src/Setup.d.ts.map +1 -1
  10. package/out/src/Setup.js +299 -5
  11. package/out/src/Setup.js.map +1 -1
  12. package/out/src/SetupClient.d.ts +2 -16
  13. package/out/src/SetupClient.d.ts.map +1 -1
  14. package/out/src/SetupClient.js +8 -72
  15. package/out/src/SetupClient.js.map +1 -1
  16. package/out/src/SimpleWalletManager.d.ts +169 -0
  17. package/out/src/SimpleWalletManager.d.ts.map +1 -0
  18. package/out/src/SimpleWalletManager.js +315 -0
  19. package/out/src/SimpleWalletManager.js.map +1 -0
  20. package/out/src/Wallet.d.ts +6 -1
  21. package/out/src/Wallet.d.ts.map +1 -1
  22. package/out/src/Wallet.js +29 -2
  23. package/out/src/Wallet.js.map +1 -1
  24. package/out/src/WalletAuthenticationManager.d.ts +33 -0
  25. package/out/src/WalletAuthenticationManager.d.ts.map +1 -0
  26. package/out/src/WalletAuthenticationManager.js +107 -0
  27. package/out/src/WalletAuthenticationManager.js.map +1 -0
  28. package/out/src/WalletPermissionsManager.d.ts +575 -0
  29. package/out/src/WalletPermissionsManager.d.ts.map +1 -0
  30. package/out/src/WalletPermissionsManager.js +1807 -0
  31. package/out/src/WalletPermissionsManager.js.map +1 -0
  32. package/out/src/WalletSettingsManager.d.ts +59 -0
  33. package/out/src/WalletSettingsManager.d.ts.map +1 -0
  34. package/out/src/WalletSettingsManager.js +168 -0
  35. package/out/src/WalletSettingsManager.js.map +1 -0
  36. package/out/src/__tests/CWIStyleWalletManager.test.d.ts +2 -0
  37. package/out/src/__tests/CWIStyleWalletManager.test.d.ts.map +1 -0
  38. package/out/src/__tests/CWIStyleWalletManager.test.js +472 -0
  39. package/out/src/__tests/CWIStyleWalletManager.test.js.map +1 -0
  40. package/out/src/__tests/WalletPermissionsManager.callbacks.test.d.ts +2 -0
  41. package/out/src/__tests/WalletPermissionsManager.callbacks.test.d.ts.map +1 -0
  42. package/out/src/__tests/WalletPermissionsManager.callbacks.test.js +239 -0
  43. package/out/src/__tests/WalletPermissionsManager.callbacks.test.js.map +1 -0
  44. package/out/src/__tests/WalletPermissionsManager.checks.test.d.ts +2 -0
  45. package/out/src/__tests/WalletPermissionsManager.checks.test.d.ts.map +1 -0
  46. package/out/src/__tests/WalletPermissionsManager.checks.test.js +644 -0
  47. package/out/src/__tests/WalletPermissionsManager.checks.test.js.map +1 -0
  48. package/out/src/__tests/WalletPermissionsManager.encryption.test.d.ts +2 -0
  49. package/out/src/__tests/WalletPermissionsManager.encryption.test.d.ts.map +1 -0
  50. package/out/src/__tests/WalletPermissionsManager.encryption.test.js +295 -0
  51. package/out/src/__tests/WalletPermissionsManager.encryption.test.js.map +1 -0
  52. package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts +82 -0
  53. package/out/src/__tests/WalletPermissionsManager.fixtures.d.ts.map +1 -0
  54. package/out/src/__tests/WalletPermissionsManager.fixtures.js +260 -0
  55. package/out/src/__tests/WalletPermissionsManager.fixtures.js.map +1 -0
  56. package/out/src/__tests/WalletPermissionsManager.flows.test.d.ts +2 -0
  57. package/out/src/__tests/WalletPermissionsManager.flows.test.d.ts.map +1 -0
  58. package/out/src/__tests/WalletPermissionsManager.flows.test.js +389 -0
  59. package/out/src/__tests/WalletPermissionsManager.flows.test.js.map +1 -0
  60. package/out/src/__tests/WalletPermissionsManager.initialization.test.d.ts +2 -0
  61. package/out/src/__tests/WalletPermissionsManager.initialization.test.d.ts.map +1 -0
  62. package/out/src/__tests/WalletPermissionsManager.initialization.test.js +227 -0
  63. package/out/src/__tests/WalletPermissionsManager.initialization.test.js.map +1 -0
  64. package/out/src/__tests/WalletPermissionsManager.proxying.test.d.ts +2 -0
  65. package/out/src/__tests/WalletPermissionsManager.proxying.test.d.ts.map +1 -0
  66. package/out/src/__tests/WalletPermissionsManager.proxying.test.js +566 -0
  67. package/out/src/__tests/WalletPermissionsManager.proxying.test.js.map +1 -0
  68. package/out/src/__tests/WalletPermissionsManager.tokens.test.d.ts +2 -0
  69. package/out/src/__tests/WalletPermissionsManager.tokens.test.d.ts.map +1 -0
  70. package/out/src/__tests/WalletPermissionsManager.tokens.test.js +460 -0
  71. package/out/src/__tests/WalletPermissionsManager.tokens.test.js.map +1 -0
  72. package/out/src/index.all.d.ts +9 -1
  73. package/out/src/index.all.d.ts.map +1 -1
  74. package/out/src/index.all.js +10 -3
  75. package/out/src/index.all.js.map +1 -1
  76. package/out/src/index.client.d.ts +9 -1
  77. package/out/src/index.client.d.ts.map +1 -1
  78. package/out/src/index.client.js +10 -3
  79. package/out/src/index.client.js.map +1 -1
  80. package/out/src/utility/identityUtils.d.ts +31 -0
  81. package/out/src/utility/identityUtils.d.ts.map +1 -0
  82. package/out/src/utility/identityUtils.js +114 -0
  83. package/out/src/utility/identityUtils.js.map +1 -0
  84. package/out/src/wab-client/WABClient.d.ts +38 -0
  85. package/out/src/wab-client/WABClient.d.ts.map +1 -0
  86. package/out/src/wab-client/WABClient.js +95 -0
  87. package/out/src/wab-client/WABClient.js.map +1 -0
  88. package/out/src/wab-client/__tests/WABClient.test.d.ts +2 -0
  89. package/out/src/wab-client/__tests/WABClient.test.d.ts.map +1 -0
  90. package/out/src/wab-client/__tests/WABClient.test.js +47 -0
  91. package/out/src/wab-client/__tests/WABClient.test.js.map +1 -0
  92. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +34 -0
  93. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -0
  94. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +16 -0
  95. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -0
  96. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts +7 -0
  97. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts.map +1 -0
  98. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js +40 -0
  99. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js.map +1 -0
  100. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts +28 -0
  101. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts.map +1 -0
  102. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js +73 -0
  103. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js.map +1 -0
  104. package/out/test/Wallet/action/abortAction.test.d.ts.map +1 -0
  105. package/out/test/{wallet → Wallet}/action/abortAction.test.js.map +1 -1
  106. package/out/test/Wallet/action/createAction.test.d.ts.map +1 -0
  107. package/out/test/{wallet → Wallet}/action/createAction.test.js.map +1 -1
  108. package/out/test/{wallet → Wallet}/action/createAction2.test.d.ts.map +1 -1
  109. package/out/test/{wallet → Wallet}/action/createAction2.test.js.map +1 -1
  110. package/out/test/Wallet/action/createActionToGenerateBeefs.man.test.d.ts.map +1 -0
  111. package/out/test/{wallet → Wallet}/action/createActionToGenerateBeefs.man.test.js.map +1 -1
  112. package/out/test/Wallet/action/internalizeAction.test.d.ts.map +1 -0
  113. package/out/test/{wallet → Wallet}/action/internalizeAction.test.js.map +1 -1
  114. package/out/test/Wallet/action/relinquishOutput.test.d.ts.map +1 -0
  115. package/out/test/{wallet → Wallet}/action/relinquishOutput.test.js.map +1 -1
  116. package/out/test/Wallet/construct/Wallet.constructor.test.d.ts.map +1 -0
  117. package/out/test/{wallet → Wallet}/construct/Wallet.constructor.test.js.map +1 -1
  118. package/out/test/Wallet/list/listActions.test.d.ts.map +1 -0
  119. package/out/test/{wallet → Wallet}/list/listActions.test.js.map +1 -1
  120. package/out/test/Wallet/list/listActions2.test.d.ts.map +1 -0
  121. package/out/test/{wallet → Wallet}/list/listActions2.test.js.map +1 -1
  122. package/out/test/Wallet/list/listCertificates.test.d.ts.map +1 -0
  123. package/out/test/{wallet → Wallet}/list/listCertificates.test.js.map +1 -1
  124. package/out/test/Wallet/list/listOutputs.test.d.ts.map +1 -0
  125. package/out/test/{wallet → Wallet}/list/listOutputs.test.js.map +1 -1
  126. package/out/test/Wallet/sync/Wallet.sync.test.d.ts.map +1 -0
  127. package/out/test/{wallet → Wallet}/sync/Wallet.sync.test.js.map +1 -1
  128. package/out/tsconfig.all.tsbuildinfo +1 -1
  129. package/package.json +3 -3
  130. package/src/CWIStyleWalletManager.ts +1891 -0
  131. package/src/Setup.ts +514 -8
  132. package/src/SimpleWalletManager.ts +553 -0
  133. package/src/Wallet.ts +47 -3
  134. package/src/WalletAuthenticationManager.ts +183 -0
  135. package/src/WalletPermissionsManager.ts +2639 -0
  136. package/src/WalletSettingsManager.ts +241 -0
  137. package/src/__tests/CWIStyleWalletManager.test.ts +709 -0
  138. package/src/__tests/WalletPermissionsManager.callbacks.test.ts +328 -0
  139. package/src/__tests/WalletPermissionsManager.checks.test.ts +857 -0
  140. package/src/__tests/WalletPermissionsManager.encryption.test.ts +407 -0
  141. package/src/__tests/WalletPermissionsManager.fixtures.ts +283 -0
  142. package/src/__tests/WalletPermissionsManager.flows.test.ts +490 -0
  143. package/src/__tests/WalletPermissionsManager.initialization.test.ts +333 -0
  144. package/src/__tests/WalletPermissionsManager.proxying.test.ts +753 -0
  145. package/src/__tests/WalletPermissionsManager.tokens.test.ts +584 -0
  146. package/src/index.all.ts +9 -9
  147. package/src/index.client.ts +9 -1
  148. package/src/utility/identityUtils.ts +170 -0
  149. package/src/wab-client/WABClient.ts +103 -0
  150. package/src/wab-client/__tests/WABClient.test.ts +58 -0
  151. package/src/wab-client/auth-method-interactors/AuthMethodInteractor.ts +47 -0
  152. package/src/wab-client/auth-method-interactors/PersonaIDInteractor.ts +45 -0
  153. package/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.ts +82 -0
  154. package/out/test/wallet/action/abortAction.test.d.ts.map +0 -1
  155. package/out/test/wallet/action/createAction.test.d.ts.map +0 -1
  156. package/out/test/wallet/action/createActionToGenerateBeefs.man.test.d.ts.map +0 -1
  157. package/out/test/wallet/action/internalizeAction.test.d.ts.map +0 -1
  158. package/out/test/wallet/action/relinquishOutput.test.d.ts.map +0 -1
  159. package/out/test/wallet/construct/Wallet.constructor.test.d.ts.map +0 -1
  160. package/out/test/wallet/list/listActions.test.d.ts.map +0 -1
  161. package/out/test/wallet/list/listActions2.test.d.ts.map +0 -1
  162. package/out/test/wallet/list/listCertificates.test.d.ts.map +0 -1
  163. package/out/test/wallet/list/listOutputs.test.d.ts.map +0 -1
  164. package/out/test/wallet/sync/Wallet.sync.test.d.ts.map +0 -1
  165. package/src/SetupClient.ts +0 -532
  166. /package/out/test/{wallet → Wallet}/action/abortAction.test.d.ts +0 -0
  167. /package/out/test/{wallet → Wallet}/action/abortAction.test.js +0 -0
  168. /package/out/test/{wallet → Wallet}/action/createAction.test.d.ts +0 -0
  169. /package/out/test/{wallet → Wallet}/action/createAction.test.js +0 -0
  170. /package/out/test/{wallet → Wallet}/action/createAction2.test.d.ts +0 -0
  171. /package/out/test/{wallet → Wallet}/action/createAction2.test.js +0 -0
  172. /package/out/test/{wallet → Wallet}/action/createActionToGenerateBeefs.man.test.d.ts +0 -0
  173. /package/out/test/{wallet → Wallet}/action/createActionToGenerateBeefs.man.test.js +0 -0
  174. /package/out/test/{wallet → Wallet}/action/internalizeAction.test.d.ts +0 -0
  175. /package/out/test/{wallet → Wallet}/action/internalizeAction.test.js +0 -0
  176. /package/out/test/{wallet → Wallet}/action/relinquishOutput.test.d.ts +0 -0
  177. /package/out/test/{wallet → Wallet}/action/relinquishOutput.test.js +0 -0
  178. /package/out/test/{wallet → Wallet}/construct/Wallet.constructor.test.d.ts +0 -0
  179. /package/out/test/{wallet → Wallet}/construct/Wallet.constructor.test.js +0 -0
  180. /package/out/test/{wallet → Wallet}/list/listActions.test.d.ts +0 -0
  181. /package/out/test/{wallet → Wallet}/list/listActions.test.js +0 -0
  182. /package/out/test/{wallet → Wallet}/list/listActions2.test.d.ts +0 -0
  183. /package/out/test/{wallet → Wallet}/list/listActions2.test.js +0 -0
  184. /package/out/test/{wallet → Wallet}/list/listCertificates.test.d.ts +0 -0
  185. /package/out/test/{wallet → Wallet}/list/listCertificates.test.js +0 -0
  186. /package/out/test/{wallet → Wallet}/list/listOutputs.test.d.ts +0 -0
  187. /package/out/test/{wallet → Wallet}/list/listOutputs.test.js +0 -0
  188. /package/out/test/{wallet → Wallet}/sync/Wallet.sync.test.d.ts +0 -0
  189. /package/out/test/{wallet → Wallet}/sync/Wallet.sync.test.js +0 -0
  190. /package/test/{wallet → Wallet}/action/abortAction.test.ts +0 -0
  191. /package/test/{wallet → Wallet}/action/createAction.test.ts +0 -0
  192. /package/test/{wallet → Wallet}/action/createAction2.test.ts +0 -0
  193. /package/test/{wallet → Wallet}/action/createActionToGenerateBeefs.man.test.ts +0 -0
  194. /package/test/{wallet → Wallet}/action/internalizeAction.test.ts +0 -0
  195. /package/test/{wallet → Wallet}/action/relinquishOutput.test.ts +0 -0
  196. /package/test/{wallet → Wallet}/construct/Wallet.constructor.test.ts +0 -0
  197. /package/test/{wallet → Wallet}/list/listActions.test.ts +0 -0
  198. /package/test/{wallet → Wallet}/list/listActions2.test.ts +0 -0
  199. /package/test/{wallet → Wallet}/list/listCertificates.test.ts +0 -0
  200. /package/test/{wallet → Wallet}/list/listOutputs.test.ts +0 -0
  201. /package/test/{wallet → Wallet}/sync/Wallet.sync.test.ts +0 -0
package/docs/wallet.md CHANGED
@@ -13,57 +13,60 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
13
13
 
14
14
  | | | |
15
15
  | --- | --- | --- |
16
- | [ArcConfig](#interface-arcconfig) | [PostBeefResultForTxidApi](#interface-postbeefresultfortxidapi) | [TableProvenTx](#interface-tableproventx) |
17
- | [ArcMinerGetTxData](#interface-arcminergettxdata) | [PostReqsToNetworkDetails](#interface-postreqstonetworkdetails) | [TableProvenTxReq](#interface-tableproventxreq) |
18
- | [AuthId](#interface-authid) | [PostReqsToNetworkResult](#interface-postreqstonetworkresult) | [TableProvenTxReqDynamics](#interface-tableproventxreqdynamics) |
19
- | [BaseBlockHeader](#interface-baseblockheader) | [PostTxResultForTxid](#interface-posttxresultfortxid) | [TableSettings](#interface-tablesettings) |
20
- | [BlockHeader](#interface-blockheader) | [PostTxResultForTxidError](#interface-posttxresultfortxiderror) | [TableSyncState](#interface-tablesyncstate) |
21
- | [BsvExchangeRate](#interface-bsvexchangerate) | [PostTxsResult](#interface-posttxsresult) | [TableTransaction](#interface-tabletransaction) |
22
- | [CertOpsWallet](#interface-certopswallet) | [ProcessSyncChunkResult](#interface-processsyncchunkresult) | [TableTxLabel](#interface-tabletxlabel) |
23
- | [CommitNewTxResults](#interface-commitnewtxresults) | [ProvenOrRawTx](#interface-provenorrawtx) | [TableTxLabelMap](#interface-tabletxlabelmap) |
24
- | [EntitySyncMap](#interface-entitysyncmap) | [ProvenTxFromTxidResult](#interface-proventxfromtxidresult) | [TableUser](#interface-tableuser) |
25
- | [EntityTimeStamp](#interface-entitytimestamp) | [ProvenTxReqHistory](#interface-proventxreqhistory) | [TaskPurgeParams](#interface-taskpurgeparams) |
26
- | [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [ProvenTxReqHistorySummaryApi](#interface-proventxreqhistorysummaryapi) | [TrxToken](#interface-trxtoken) |
27
- | [FiatExchangeRates](#interface-fiatexchangerates) | [ProvenTxReqNotify](#interface-proventxreqnotify) | [TscMerkleProofApi](#interface-tscmerkleproofapi) |
28
- | [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [PurgeParams](#interface-purgeparams) | [TxScriptOffsets](#interface-txscriptoffsets) |
29
- | [FindCertificatesArgs](#interface-findcertificatesargs) | [PurgeResults](#interface-purgeresults) | [UpdateProvenTxReqWithNewProvenTxArgs](#interface-updateproventxreqwithnewproventxargs) |
30
- | [FindCommissionsArgs](#interface-findcommissionsargs) | [RequestSyncChunkArgs](#interface-requestsyncchunkargs) | [UpdateProvenTxReqWithNewProvenTxResult](#interface-updateproventxreqwithnewproventxresult) |
31
- | [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [ScriptTemplateParamsBRC29](#interface-scripttemplateparamsbrc29) | [ValidAbortActionArgs](#interface-validabortactionargs) |
32
- | [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [ScriptTemplateUnlock](#interface-scripttemplateunlock) | [ValidAcquireCertificateArgs](#interface-validacquirecertificateargs) |
33
- | [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [SetupEnv](#interface-setupenv) | [ValidAcquireDirectCertificateArgs](#interface-validacquiredirectcertificateargs) |
34
- | [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [SetupWallet](#interface-setupwallet) | [ValidAcquireIssuanceCertificateArgs](#interface-validacquireissuancecertificateargs) |
35
- | [FindOutputTagsArgs](#interface-findoutputtagsargs) | [SetupWalletArgs](#interface-setupwalletargs) | [ValidBasketInsertion](#interface-validbasketinsertion) |
36
- | [FindOutputsArgs](#interface-findoutputsargs) | [SetupWalletClient](#interface-setupwalletclient) | [ValidCreateActionArgs](#interface-validcreateactionargs) |
37
- | [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [SetupWalletClientArgs](#interface-setupwalletclientargs) | [ValidCreateActionInput](#interface-validcreateactioninput) |
38
- | [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [StorageCreateActionResult](#interface-storagecreateactionresult) | [ValidCreateActionOptions](#interface-validcreateactionoptions) |
39
- | [FindProvenTxsArgs](#interface-findproventxsargs) | [StorageCreateTransactionSdkInput](#interface-storagecreatetransactionsdkinput) | [ValidCreateActionOutput](#interface-validcreateactionoutput) |
40
- | [FindSincePagedArgs](#interface-findsincepagedargs) | [StorageCreateTransactionSdkOutput](#interface-storagecreatetransactionsdkoutput) | [ValidDiscoverByAttributesArgs](#interface-validdiscoverbyattributesargs) |
41
- | [FindSyncStatesArgs](#interface-findsyncstatesargs) | [StorageFeeModel](#interface-storagefeemodel) | [ValidDiscoverByIdentityKeyArgs](#interface-validdiscoverbyidentitykeyargs) |
42
- | [FindTransactionsArgs](#interface-findtransactionsargs) | [StorageGetBeefOptions](#interface-storagegetbeefoptions) | [ValidInternalizeActionArgs](#interface-validinternalizeactionargs) |
43
- | [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [StorageIdentity](#interface-storageidentity) | [ValidInternalizeOutput](#interface-validinternalizeoutput) |
44
- | [FindTxLabelsArgs](#interface-findtxlabelsargs) | [StorageInternalizeActionResult](#interface-storageinternalizeactionresult) | [ValidListActionsArgs](#interface-validlistactionsargs) |
45
- | [FindUsersArgs](#interface-findusersargs) | [StorageProcessActionArgs](#interface-storageprocessactionargs) | [ValidListCertificatesArgs](#interface-validlistcertificatesargs) |
46
- | [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [StorageProcessActionResults](#interface-storageprocessactionresults) | [ValidListOutputsArgs](#interface-validlistoutputsargs) |
47
- | [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [StorageProvenOrReq](#interface-storageprovenorreq) | [ValidProcessActionArgs](#interface-validprocessactionargs) |
48
- | [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [StorageProviderOptions](#interface-storageprovideroptions) | [ValidProcessActionOptions](#interface-validprocessactionoptions) |
49
- | [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [StorageReaderOptions](#interface-storagereaderoptions) | [ValidProveCertificateArgs](#interface-validprovecertificateargs) |
50
- | [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [StorageReaderWriterOptions](#interface-storagereaderwriteroptions) | [ValidRelinquishCertificateArgs](#interface-validrelinquishcertificateargs) |
51
- | [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [StorageSyncReader](#interface-storagesyncreader) | [ValidRelinquishOutputArgs](#interface-validrelinquishoutputargs) |
52
- | [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [StorageSyncReaderOptions](#interface-storagesyncreaderoptions) | [ValidSignActionArgs](#interface-validsignactionargs) |
53
- | [GetMerklePathResult](#interface-getmerklepathresult) | [StorageSyncReaderWriter](#interface-storagesyncreaderwriter) | [ValidSignActionOptions](#interface-validsignactionoptions) |
54
- | [GetRawTxResult](#interface-getrawtxresult) | [SyncChunk](#interface-syncchunk) | [ValidWalletPayment](#interface-validwalletpayment) |
55
- | [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [SyncError](#interface-syncerror) | [ValidWalletSignerArgs](#interface-validwalletsignerargs) |
56
- | [GetReqsAndBeefResult](#interface-getreqsandbeefresult) | [SyncMap](#interface-syncmap) | [ValidateGenerateChangeSdkParamsResult](#interface-validategeneratechangesdkparamsresult) |
57
- | [GetUtxoStatusDetails](#interface-getutxostatusdetails) | [TableCertificate](#interface-tablecertificate) | [WalletArgs](#interface-walletargs) |
58
- | [GetUtxoStatusResult](#interface-getutxostatusresult) | [TableCertificateField](#interface-tablecertificatefield) | [WalletServices](#interface-walletservices) |
59
- | [KeyPair](#interface-keypair) | [TableCertificateX](#interface-tablecertificatex) | [WalletServicesOptions](#interface-walletservicesoptions) |
60
- | [KeyPairAddress](#interface-keypairaddress) | [TableCommission](#interface-tablecommission) | [WalletSigner](#interface-walletsigner) |
61
- | [MonitorOptions](#interface-monitoroptions) | [TableMonitorEvent](#interface-tablemonitorevent) | [WalletStorage](#interface-walletstorage) |
62
- | [OutPoint](#interface-outpoint) | [TableOutput](#interface-tableoutput) | [WalletStorageProvider](#interface-walletstorageprovider) |
63
- | [Paged](#interface-paged) | [TableOutputBasket](#interface-tableoutputbasket) | [WalletStorageReader](#interface-walletstoragereader) |
64
- | [PendingSignAction](#interface-pendingsignaction) | [TableOutputTag](#interface-tableoutputtag) | [WalletStorageSync](#interface-walletstoragesync) |
65
- | [PendingStorageInput](#interface-pendingstorageinput) | [TableOutputTagMap](#interface-tableoutputtagmap) | [WalletStorageWriter](#interface-walletstoragewriter) |
66
- | [PostBeefResult](#interface-postbeefresult) | [TableOutputX](#interface-tableoutputx) | [XValidCreateActionOutput](#interface-xvalidcreateactionoutput) |
16
+ | [ArcConfig](#interface-arcconfig) | [PermissionToken](#interface-permissiontoken) | [TableSyncState](#interface-tablesyncstate) |
17
+ | [ArcMinerGetTxData](#interface-arcminergettxdata) | [PermissionsManagerConfig](#interface-permissionsmanagerconfig) | [TableTransaction](#interface-tabletransaction) |
18
+ | [AuthId](#interface-authid) | [PostBeefResult](#interface-postbeefresult) | [TableTxLabel](#interface-tabletxlabel) |
19
+ | [AuthPayload](#interface-authpayload) | [PostBeefResultForTxidApi](#interface-postbeefresultfortxidapi) | [TableTxLabelMap](#interface-tabletxlabelmap) |
20
+ | [BaseBlockHeader](#interface-baseblockheader) | [PostReqsToNetworkDetails](#interface-postreqstonetworkdetails) | [TableUser](#interface-tableuser) |
21
+ | [BlockHeader](#interface-blockheader) | [PostReqsToNetworkResult](#interface-postreqstonetworkresult) | [TaskPurgeParams](#interface-taskpurgeparams) |
22
+ | [BsvExchangeRate](#interface-bsvexchangerate) | [PostTxResultForTxid](#interface-posttxresultfortxid) | [TrustSettings](#interface-trustsettings) |
23
+ | [CertOpsWallet](#interface-certopswallet) | [PostTxResultForTxidError](#interface-posttxresultfortxiderror) | [TrxToken](#interface-trxtoken) |
24
+ | [Certifier](#interface-certifier) | [PostTxsResult](#interface-posttxsresult) | [TscMerkleProofApi](#interface-tscmerkleproofapi) |
25
+ | [CommitNewTxResults](#interface-commitnewtxresults) | [ProcessSyncChunkResult](#interface-processsyncchunkresult) | [TxScriptOffsets](#interface-txscriptoffsets) |
26
+ | [CompleteAuthResponse](#interface-completeauthresponse) | [ProvenOrRawTx](#interface-provenorrawtx) | [UMPToken](#interface-umptoken) |
27
+ | [EntitySyncMap](#interface-entitysyncmap) | [ProvenTxFromTxidResult](#interface-proventxfromtxidresult) | [UMPTokenInteractor](#interface-umptokeninteractor) |
28
+ | [EntityTimeStamp](#interface-entitytimestamp) | [ProvenTxReqHistory](#interface-proventxreqhistory) | [UpdateProvenTxReqWithNewProvenTxArgs](#interface-updateproventxreqwithnewproventxargs) |
29
+ | [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [ProvenTxReqHistorySummaryApi](#interface-proventxreqhistorysummaryapi) | [UpdateProvenTxReqWithNewProvenTxResult](#interface-updateproventxreqwithnewproventxresult) |
30
+ | [ExtendedVerifiableCertificate](#interface-extendedverifiablecertificate) | [ProvenTxReqNotify](#interface-proventxreqnotify) | [ValidAbortActionArgs](#interface-validabortactionargs) |
31
+ | [FiatExchangeRates](#interface-fiatexchangerates) | [PurgeParams](#interface-purgeparams) | [ValidAcquireCertificateArgs](#interface-validacquirecertificateargs) |
32
+ | [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [PurgeResults](#interface-purgeresults) | [ValidAcquireDirectCertificateArgs](#interface-validacquiredirectcertificateargs) |
33
+ | [FindCertificatesArgs](#interface-findcertificatesargs) | [RequestSyncChunkArgs](#interface-requestsyncchunkargs) | [ValidAcquireIssuanceCertificateArgs](#interface-validacquireissuancecertificateargs) |
34
+ | [FindCommissionsArgs](#interface-findcommissionsargs) | [ScriptTemplateParamsBRC29](#interface-scripttemplateparamsbrc29) | [ValidBasketInsertion](#interface-validbasketinsertion) |
35
+ | [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [ScriptTemplateUnlock](#interface-scripttemplateunlock) | [ValidCreateActionArgs](#interface-validcreateactionargs) |
36
+ | [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [StartAuthResponse](#interface-startauthresponse) | [ValidCreateActionInput](#interface-validcreateactioninput) |
37
+ | [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [StorageCreateActionResult](#interface-storagecreateactionresult) | [ValidCreateActionOptions](#interface-validcreateactionoptions) |
38
+ | [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [StorageCreateTransactionSdkInput](#interface-storagecreatetransactionsdkinput) | [ValidCreateActionOutput](#interface-validcreateactionoutput) |
39
+ | [FindOutputTagsArgs](#interface-findoutputtagsargs) | [StorageCreateTransactionSdkOutput](#interface-storagecreatetransactionsdkoutput) | [ValidDiscoverByAttributesArgs](#interface-validdiscoverbyattributesargs) |
40
+ | [FindOutputsArgs](#interface-findoutputsargs) | [StorageFeeModel](#interface-storagefeemodel) | [ValidDiscoverByIdentityKeyArgs](#interface-validdiscoverbyidentitykeyargs) |
41
+ | [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [StorageGetBeefOptions](#interface-storagegetbeefoptions) | [ValidInternalizeActionArgs](#interface-validinternalizeactionargs) |
42
+ | [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [StorageIdentity](#interface-storageidentity) | [ValidInternalizeOutput](#interface-validinternalizeoutput) |
43
+ | [FindProvenTxsArgs](#interface-findproventxsargs) | [StorageInternalizeActionResult](#interface-storageinternalizeactionresult) | [ValidListActionsArgs](#interface-validlistactionsargs) |
44
+ | [FindSincePagedArgs](#interface-findsincepagedargs) | [StorageProcessActionArgs](#interface-storageprocessactionargs) | [ValidListCertificatesArgs](#interface-validlistcertificatesargs) |
45
+ | [FindSyncStatesArgs](#interface-findsyncstatesargs) | [StorageProcessActionResults](#interface-storageprocessactionresults) | [ValidListOutputsArgs](#interface-validlistoutputsargs) |
46
+ | [FindTransactionsArgs](#interface-findtransactionsargs) | [StorageProvenOrReq](#interface-storageprovenorreq) | [ValidProcessActionArgs](#interface-validprocessactionargs) |
47
+ | [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [StorageProviderOptions](#interface-storageprovideroptions) | [ValidProcessActionOptions](#interface-validprocessactionoptions) |
48
+ | [FindTxLabelsArgs](#interface-findtxlabelsargs) | [StorageReaderOptions](#interface-storagereaderoptions) | [ValidProveCertificateArgs](#interface-validprovecertificateargs) |
49
+ | [FindUsersArgs](#interface-findusersargs) | [StorageReaderWriterOptions](#interface-storagereaderwriteroptions) | [ValidRelinquishCertificateArgs](#interface-validrelinquishcertificateargs) |
50
+ | [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [StorageSyncReader](#interface-storagesyncreader) | [ValidRelinquishOutputArgs](#interface-validrelinquishoutputargs) |
51
+ | [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [StorageSyncReaderOptions](#interface-storagesyncreaderoptions) | [ValidSignActionArgs](#interface-validsignactionargs) |
52
+ | [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [StorageSyncReaderWriter](#interface-storagesyncreaderwriter) | [ValidSignActionOptions](#interface-validsignactionoptions) |
53
+ | [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [SyncChunk](#interface-syncchunk) | [ValidWalletPayment](#interface-validwalletpayment) |
54
+ | [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [SyncError](#interface-syncerror) | [ValidWalletSignerArgs](#interface-validwalletsignerargs) |
55
+ | [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [SyncMap](#interface-syncmap) | [ValidateGenerateChangeSdkParamsResult](#interface-validategeneratechangesdkparamsresult) |
56
+ | [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [TableCertificate](#interface-tablecertificate) | [WalletArgs](#interface-walletargs) |
57
+ | [GetMerklePathResult](#interface-getmerklepathresult) | [TableCertificateField](#interface-tablecertificatefield) | [WalletPermissionsManagerCallbacks](#interface-walletpermissionsmanagercallbacks) |
58
+ | [GetRawTxResult](#interface-getrawtxresult) | [TableCertificateX](#interface-tablecertificatex) | [WalletServices](#interface-walletservices) |
59
+ | [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [TableCommission](#interface-tablecommission) | [WalletServicesOptions](#interface-walletservicesoptions) |
60
+ | [GetReqsAndBeefResult](#interface-getreqsandbeefresult) | [TableMonitorEvent](#interface-tablemonitorevent) | [WalletSettings](#interface-walletsettings) |
61
+ | [GetUtxoStatusDetails](#interface-getutxostatusdetails) | [TableOutput](#interface-tableoutput) | [WalletSettingsManagerConfig](#interface-walletsettingsmanagerconfig) |
62
+ | [GetUtxoStatusResult](#interface-getutxostatusresult) | [TableOutputBasket](#interface-tableoutputbasket) | [WalletSigner](#interface-walletsigner) |
63
+ | [KeyPair](#interface-keypair) | [TableOutputTag](#interface-tableoutputtag) | [WalletStorage](#interface-walletstorage) |
64
+ | [MonitorOptions](#interface-monitoroptions) | [TableOutputTagMap](#interface-tableoutputtagmap) | [WalletStorageProvider](#interface-walletstorageprovider) |
65
+ | [OutPoint](#interface-outpoint) | [TableOutputX](#interface-tableoutputx) | [WalletStorageReader](#interface-walletstoragereader) |
66
+ | [Paged](#interface-paged) | [TableProvenTx](#interface-tableproventx) | [WalletStorageSync](#interface-walletstoragesync) |
67
+ | [PendingSignAction](#interface-pendingsignaction) | [TableProvenTxReq](#interface-tableproventxreq) | [WalletStorageWriter](#interface-walletstoragewriter) |
68
+ | [PendingStorageInput](#interface-pendingstorageinput) | [TableProvenTxReqDynamics](#interface-tableproventxreqdynamics) | [WalletTheme](#interface-wallettheme) |
69
+ | [PermissionRequest](#interface-permissionrequest) | [TableSettings](#interface-tablesettings) | [XValidCreateActionOutput](#interface-xvalidcreateactionoutput) |
67
70
 
68
71
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
69
72
 
@@ -167,6 +170,22 @@ export interface AuthId {
167
170
 
168
171
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
169
172
 
173
+ ---
174
+ ##### Interface: AuthPayload
175
+
176
+ AuthMethodInteractor
177
+
178
+ A base interface/class for client-side logic to interact with a server
179
+ for a specific Auth Method's flow (start, complete).
180
+
181
+ ```ts
182
+ export interface AuthPayload {
183
+ [key: string]: any;
184
+ }
185
+ ```
186
+
187
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
188
+
170
189
  ---
171
190
  ##### Interface: BaseBlockHeader
172
191
 
@@ -294,6 +313,22 @@ export interface CertOpsWallet {
294
313
 
295
314
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
296
315
 
316
+ ---
317
+ ##### Interface: Certifier
318
+
319
+ ```ts
320
+ export interface Certifier {
321
+ name: string;
322
+ description: string;
323
+ identityKey: PubKeyHex;
324
+ trust: number;
325
+ iconUrl?: string;
326
+ baseURL?: string;
327
+ }
328
+ ```
329
+
330
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
331
+
297
332
  ---
298
333
  ##### Interface: CommitNewTxResults
299
334
 
@@ -308,6 +343,19 @@ See also: [EntityProvenTxReq](./storage.md#class-entityproventxreq)
308
343
 
309
344
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
310
345
 
346
+ ---
347
+ ##### Interface: CompleteAuthResponse
348
+
349
+ ```ts
350
+ export interface CompleteAuthResponse {
351
+ success: boolean;
352
+ message?: string;
353
+ presentationKey?: string;
354
+ }
355
+ ```
356
+
357
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
358
+
311
359
  ---
312
360
  ##### Interface: EntitySyncMap
313
361
 
@@ -378,6 +426,18 @@ export interface ExchangeRatesIoApi {
378
426
 
379
427
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
380
428
 
429
+ ---
430
+ ##### Interface: ExtendedVerifiableCertificate
431
+
432
+ ```ts
433
+ export interface ExtendedVerifiableCertificate extends IdentityCertificate {
434
+ certifierInfo: IdentityCertifier;
435
+ publiclyRevealedKeyring: Record<string, Base64String>;
436
+ }
437
+ ```
438
+
439
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
440
+
381
441
  ---
382
442
  ##### Interface: FiatExchangeRates
383
443
 
@@ -1046,21 +1106,6 @@ export interface KeyPair {
1046
1106
 
1047
1107
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1048
1108
 
1049
- ---
1050
- ##### Interface: KeyPairAddress
1051
-
1052
- A private key and associated public key and address.
1053
-
1054
- ```ts
1055
- export interface KeyPairAddress {
1056
- privateKey: PrivateKey;
1057
- publicKey: PublicKey;
1058
- address: string;
1059
- }
1060
- ```
1061
-
1062
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1063
-
1064
1109
  ---
1065
1110
  ##### Interface: MonitorOptions
1066
1111
 
@@ -1167,767 +1212,876 @@ export interface PendingStorageInput {
1167
1212
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1168
1213
 
1169
1214
  ---
1170
- ##### Interface: PostBeefResult
1215
+ ##### Interface: PermissionRequest
1216
+
1217
+ Describes a single requested permission that the user must either grant or deny.
1218
+
1219
+ Four categories of permission are supported, each with a unique protocol:
1220
+ 1) protocol - "DPACP" (Domain Protocol Access Control Protocol)
1221
+ 2) basket - "DBAP" (Domain Basket Access Protocol)
1222
+ 3) certificate - "DCAP" (Domain Certificate Access Protocol)
1223
+ 4) spending - "DSAP" (Domain Spending Authorization Protocol)
1224
+
1225
+ This model underpins "requests" made to the user for permission, which the user can
1226
+ either grant or deny. The manager can then create on-chain tokens (PushDrop outputs)
1227
+ if permission is granted. Denying requests cause the underlying operation to throw,
1228
+ and no token is created. An "ephemeral" grant is also possible, denoting a one-time
1229
+ authorization without an associated persistent on-chain token.
1171
1230
 
1172
1231
  ```ts
1173
- export interface PostBeefResult extends PostTxsResult {
1232
+ export interface PermissionRequest {
1233
+ type: "protocol" | "basket" | "certificate" | "spending";
1234
+ originator: string;
1235
+ privileged?: boolean;
1236
+ protocolID?: [
1237
+ 0 | 1 | 2,
1238
+ string
1239
+ ];
1240
+ counterparty?: string;
1241
+ basket?: string;
1242
+ certificate?: {
1243
+ verifier: string;
1244
+ certType: string;
1245
+ fields: string[];
1246
+ };
1247
+ spending?: {
1248
+ satoshis: number;
1249
+ lineItems?: Array<{
1250
+ type: "input" | "output" | "fee";
1251
+ description: string;
1252
+ satoshis: number;
1253
+ }>;
1254
+ };
1255
+ reason?: string;
1256
+ renewal?: boolean;
1257
+ previousToken?: PermissionToken;
1174
1258
  }
1175
1259
  ```
1176
1260
 
1177
- See also: [PostTxsResult](./client.md#interface-posttxsresult)
1261
+ See also: [PermissionToken](./client.md#interface-permissiontoken)
1178
1262
 
1179
1263
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1180
1264
 
1181
1265
  ---
1182
- ##### Interface: PostBeefResultForTxidApi
1266
+ ##### Interface: PermissionToken
1267
+
1268
+ Data structure representing an on-chain permission token.
1269
+ It is typically stored as a single unspent PushDrop output in a special "internal" admin basket belonging to
1270
+ the user, held in their underlying wallet.
1271
+
1272
+ It can represent any of the four permission categories by having the relevant fields:
1273
+ - DPACP: originator, privileged, protocol, securityLevel, counterparty
1274
+ - DBAP: originator, basketName
1275
+ - DCAP: originator, privileged, verifier, certType, certFields
1276
+ - DSAP: originator, authorizedAmount
1183
1277
 
1184
1278
  ```ts
1185
- export interface PostBeefResultForTxidApi {
1279
+ export interface PermissionToken {
1186
1280
  txid: string;
1187
- status: "success" | "error";
1188
- alreadyKnown?: boolean;
1189
- blockHash?: string;
1190
- blockHeight?: number;
1191
- merklePath?: string;
1281
+ outputIndex: number;
1282
+ outputScript: string;
1283
+ satoshis: number;
1284
+ originator: string;
1285
+ expiry: number;
1286
+ privileged?: boolean;
1287
+ protocol?: string;
1288
+ securityLevel?: 0 | 1 | 2;
1289
+ counterparty?: string;
1290
+ basketName?: string;
1291
+ certType?: string;
1292
+ certFields?: string[];
1293
+ verifier?: string;
1294
+ authorizedAmount?: number;
1192
1295
  }
1193
1296
  ```
1194
1297
 
1195
- ###### Property alreadyKnown
1196
-
1197
- if true, the transaction was already known to this service. Usually treat as a success.
1298
+ ###### Property authorizedAmount
1198
1299
 
1199
- Potentially stop posting to additional transaction processors.
1300
+ For DSAP, the maximum authorized spending for the month.
1200
1301
 
1201
1302
  ```ts
1202
- alreadyKnown?: boolean
1303
+ authorizedAmount?: number
1203
1304
  ```
1204
1305
 
1205
- ###### Property status
1306
+ ###### Property basketName
1206
1307
 
1207
- 'success' - The transaction was accepted for processing
1308
+ The name of a basket, if this is a DBAP token.
1208
1309
 
1209
1310
  ```ts
1210
- status: "success" | "error"
1311
+ basketName?: string
1211
1312
  ```
1212
1313
 
1213
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1314
+ ###### Property certFields
1214
1315
 
1215
- ---
1216
- ##### Interface: PostReqsToNetworkDetails
1316
+ The certificate fields that this token covers, if DCAP token.
1217
1317
 
1218
1318
  ```ts
1219
- export interface PostReqsToNetworkDetails {
1220
- txid: string;
1221
- req: EntityProvenTxReq;
1222
- status: PostReqsToNetworkDetailsStatus;
1223
- pbrft: sdk.PostTxResultForTxid;
1224
- data?: string;
1225
- error?: string;
1226
- }
1319
+ certFields?: string[]
1227
1320
  ```
1228
1321
 
1229
- See also: [EntityProvenTxReq](./storage.md#class-entityproventxreq), [PostReqsToNetworkDetailsStatus](./storage.md#type-postreqstonetworkdetailsstatus), [PostTxResultForTxid](./client.md#interface-posttxresultfortxid)
1322
+ ###### Property certType
1230
1323
 
1231
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1232
-
1233
- ---
1234
- ##### Interface: PostReqsToNetworkResult
1324
+ The certificate type, if this is a DCAP token.
1235
1325
 
1236
1326
  ```ts
1237
- export interface PostReqsToNetworkResult {
1238
- status: "success" | "error";
1239
- beef: Beef;
1240
- details: PostReqsToNetworkDetails[];
1241
- pbr?: sdk.PostBeefResult;
1242
- log: string;
1243
- }
1327
+ certType?: string
1244
1328
  ```
1245
1329
 
1246
- See also: [PostBeefResult](./client.md#interface-postbeefresult), [PostReqsToNetworkDetails](./storage.md#interface-postreqstonetworkdetails)
1247
-
1248
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1330
+ ###### Property counterparty
1249
1331
 
1250
- ---
1251
- ##### Interface: PostTxResultForTxid
1332
+ The counterparty, for DPACP.
1252
1333
 
1253
1334
  ```ts
1254
- export interface PostTxResultForTxid {
1255
- txid: string;
1256
- status: "success" | "error";
1257
- alreadyKnown?: boolean;
1258
- doubleSpend?: boolean;
1259
- blockHash?: string;
1260
- blockHeight?: number;
1261
- merklePath?: MerklePath;
1262
- competingTxs?: string[];
1263
- data?: object | string | PostTxResultForTxidError;
1264
- }
1335
+ counterparty?: string
1265
1336
  ```
1266
1337
 
1267
- See also: [PostTxResultForTxidError](./client.md#interface-posttxresultfortxiderror)
1338
+ ###### Property expiry
1268
1339
 
1269
- ###### Property alreadyKnown
1340
+ The expiration time for this token in UNIX epoch seconds. (0 or omitted for spending authorizations, which are indefinite)
1270
1341
 
1271
- if true, the transaction was already known to this service. Usually treat as a success.
1342
+ ```ts
1343
+ expiry: number
1344
+ ```
1272
1345
 
1273
- Potentially stop posting to additional transaction processors.
1346
+ ###### Property originator
1347
+
1348
+ The originator domain or FQDN that is allowed to use this permission.
1274
1349
 
1275
1350
  ```ts
1276
- alreadyKnown?: boolean
1351
+ originator: string
1277
1352
  ```
1278
1353
 
1279
- ###### Property doubleSpend
1354
+ ###### Property outputIndex
1280
1355
 
1281
- service indicated this broadcast double spends at least one input
1282
- `competingTxs` may be an array of txids that were first seen spends of at least one input.
1356
+ The output index within that transaction.
1283
1357
 
1284
1358
  ```ts
1285
- doubleSpend?: boolean
1359
+ outputIndex: number
1286
1360
  ```
1287
1361
 
1288
- ###### Property status
1362
+ ###### Property outputScript
1289
1363
 
1290
- 'success' - The transaction was accepted for processing
1364
+ The exact script hex for the locking script.
1291
1365
 
1292
1366
  ```ts
1293
- status: "success" | "error"
1367
+ outputScript: string
1294
1368
  ```
1295
1369
 
1296
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1370
+ ###### Property privileged
1297
1371
 
1298
- ---
1299
- ##### Interface: PostTxResultForTxidError
1372
+ Whether this token grants privileged usage (for protocol or certificate).
1300
1373
 
1301
1374
  ```ts
1302
- export interface PostTxResultForTxidError {
1303
- status?: string;
1304
- detail?: string;
1305
- more?: object;
1306
- }
1375
+ privileged?: boolean
1307
1376
  ```
1308
1377
 
1309
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1310
-
1311
- ---
1312
- ##### Interface: PostTxsResult
1378
+ ###### Property protocol
1313
1379
 
1314
- Properties on array items of result returned from `WalletServices` function `postBeef`.
1380
+ The protocol name, if this is a DPACP token.
1315
1381
 
1316
1382
  ```ts
1317
- export interface PostTxsResult {
1318
- name: string;
1319
- status: "success" | "error";
1320
- error?: sdk.WalletError;
1321
- txidResults: PostTxResultForTxid[];
1322
- data?: object;
1323
- }
1383
+ protocol?: string
1324
1384
  ```
1325
1385
 
1326
- See also: [PostTxResultForTxid](./client.md#interface-posttxresultfortxid), [WalletError](./client.md#class-walleterror)
1386
+ ###### Property satoshis
1327
1387
 
1328
- ###### Property data
1388
+ The amount of satoshis assigned to the permission output (often 1).
1329
1389
 
1330
- Service response object. Use service name and status to infer type of object.
1390
+ ```ts
1391
+ satoshis: number
1392
+ ```
1393
+
1394
+ ###### Property securityLevel
1395
+
1396
+ The security level (0,1,2) for DPACP.
1331
1397
 
1332
1398
  ```ts
1333
- data?: object
1399
+ securityLevel?: 0 | 1 | 2
1334
1400
  ```
1335
1401
 
1336
- ###### Property name
1402
+ ###### Property txid
1337
1403
 
1338
- The name of the service to which the transaction was submitted for processing
1404
+ The transaction ID where this token resides.
1339
1405
 
1340
1406
  ```ts
1341
- name: string
1407
+ txid: string
1342
1408
  ```
1343
1409
 
1344
- ###### Property status
1410
+ ###### Property verifier
1345
1411
 
1346
- 'success' all txids returned status of 'success'
1347
- 'error' one or more txids returned status of 'error'. See txidResults for details.
1412
+ The "verifier" public key string, if DCAP.
1348
1413
 
1349
1414
  ```ts
1350
- status: "success" | "error"
1415
+ verifier?: string
1351
1416
  ```
1352
1417
 
1353
1418
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1354
1419
 
1355
1420
  ---
1356
- ##### Interface: ProcessSyncChunkResult
1421
+ ##### Interface: PermissionsManagerConfig
1422
+
1423
+ Configuration object for the WalletPermissionsManager. If a given option is `false`,
1424
+ the manager will skip or alter certain permission checks or behaviors.
1425
+
1426
+ By default, all of these are `true` unless specified otherwise. This is the most secure configuration.
1357
1427
 
1358
1428
  ```ts
1359
- export interface ProcessSyncChunkResult {
1360
- done: boolean;
1361
- maxUpdated_at: Date | undefined;
1362
- updates: number;
1363
- inserts: number;
1364
- error?: sdk.WalletError;
1429
+ export interface PermissionsManagerConfig {
1430
+ seekProtocolPermissionsForSigning?: boolean;
1431
+ seekProtocolPermissionsForEncrypting?: boolean;
1432
+ seekProtocolPermissionsForHMAC?: boolean;
1433
+ seekPermissionsForKeyLinkageRevelation?: boolean;
1434
+ seekPermissionsForPublicKeyRevelation?: boolean;
1435
+ seekPermissionsForIdentityKeyRevelation?: boolean;
1436
+ seekPermissionsForIdentityResolution?: boolean;
1437
+ seekBasketInsertionPermissions?: boolean;
1438
+ seekBasketRemovalPermissions?: boolean;
1439
+ seekBasketListingPermissions?: boolean;
1440
+ seekPermissionWhenApplyingActionLabels?: boolean;
1441
+ seekPermissionWhenListingActionsByLabel?: boolean;
1442
+ seekCertificateDisclosurePermissions?: boolean;
1443
+ seekCertificateAcquisitionPermissions?: boolean;
1444
+ seekCertificateRelinquishmentPermissions?: boolean;
1445
+ seekCertificateListingPermissions?: boolean;
1446
+ encryptWalletMetadata?: boolean;
1447
+ seekSpendingPermissions?: boolean;
1448
+ differentiatePrivilegedOperations?: boolean;
1365
1449
  }
1366
1450
  ```
1367
1451
 
1368
- See also: [WalletError](./client.md#class-walleterror)
1452
+ ###### Property differentiatePrivilegedOperations
1369
1453
 
1370
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1454
+ If false, permissions are checked without regard for whether we are in
1455
+ privileged mode. Privileged status is ignored with respect to whether
1456
+ permissions are granted. Internally, they are always sought and checked
1457
+ with privileged=false, regardless of the actual value.
1371
1458
 
1372
- ---
1373
- ##### Interface: ProvenOrRawTx
1459
+ ```ts
1460
+ differentiatePrivilegedOperations?: boolean
1461
+ ```
1462
+
1463
+ ###### Property encryptWalletMetadata
1464
+
1465
+ Should transaction descriptions, input descriptions, and output descriptions be encrypted
1466
+ when before they are passed to the underlying wallet, and transparently decrypted when retrieved?
1374
1467
 
1375
1468
  ```ts
1376
- export interface ProvenOrRawTx {
1377
- proven?: TableProvenTx;
1378
- rawTx?: number[];
1379
- inputBEEF?: number[];
1380
- }
1469
+ encryptWalletMetadata?: boolean
1381
1470
  ```
1382
1471
 
1383
- See also: [TableProvenTx](./storage.md#interface-tableproventx)
1472
+ ###### Property seekBasketInsertionPermissions
1384
1473
 
1385
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1474
+ When we do internalizeAction with `basket insertion`, or include outputs in baskets
1475
+ with `createAction, do we ask for basket permission?
1386
1476
 
1387
- ---
1388
- ##### Interface: ProvenTxFromTxidResult
1477
+ ```ts
1478
+ seekBasketInsertionPermissions?: boolean
1479
+ ```
1480
+
1481
+ ###### Property seekBasketListingPermissions
1482
+
1483
+ When listOutputs is called, do we ask for basket permission?
1389
1484
 
1390
1485
  ```ts
1391
- export interface ProvenTxFromTxidResult {
1392
- proven?: EntityProvenTx;
1393
- rawTx?: number[];
1394
- }
1486
+ seekBasketListingPermissions?: boolean
1395
1487
  ```
1396
1488
 
1397
- See also: [EntityProvenTx](./storage.md#class-entityproventx)
1489
+ ###### Property seekBasketRemovalPermissions
1398
1490
 
1399
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1491
+ When relinquishOutput is called, do we ask for basket permission?
1400
1492
 
1401
- ---
1402
- ##### Interface: ProvenTxReqHistory
1493
+ ```ts
1494
+ seekBasketRemovalPermissions?: boolean
1495
+ ```
1496
+
1497
+ ###### Property seekCertificateAcquisitionPermissions
1498
+
1499
+ If acquiring a certificate (acquireCertificate), do we require a permission check?
1403
1500
 
1404
1501
  ```ts
1405
- export interface ProvenTxReqHistory {
1406
- notes?: Record<string, string>;
1407
- }
1502
+ seekCertificateAcquisitionPermissions?: boolean
1408
1503
  ```
1409
1504
 
1410
- ###### Property notes
1505
+ ###### Property seekCertificateDisclosurePermissions
1411
1506
 
1412
- Keys are Date().toISOString()
1413
- Values are a description of what happened.
1507
+ If proving a certificate (proveCertificate) or revealing certificate fields,
1508
+ do we require a "certificate access" permission?
1414
1509
 
1415
1510
  ```ts
1416
- notes?: Record<string, string>
1511
+ seekCertificateDisclosurePermissions?: boolean
1417
1512
  ```
1418
1513
 
1419
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1514
+ ###### Property seekCertificateListingPermissions
1420
1515
 
1421
- ---
1422
- ##### Interface: ProvenTxReqHistorySummaryApi
1516
+ If listing a user's certificates (listCertificates), do we require a permission check?
1423
1517
 
1424
1518
  ```ts
1425
- export interface ProvenTxReqHistorySummaryApi {
1426
- setToCompleted: boolean;
1427
- setToCallback: boolean;
1428
- setToUnmined: boolean;
1429
- setToDoubleSpend: boolean;
1430
- setToSending: boolean;
1431
- setToUnconfirmed: boolean;
1432
- }
1519
+ seekCertificateListingPermissions?: boolean
1433
1520
  ```
1434
1521
 
1435
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1522
+ ###### Property seekCertificateRelinquishmentPermissions
1436
1523
 
1437
- ---
1438
- ##### Interface: ProvenTxReqNotify
1524
+ If relinquishing a certificate (relinquishCertificate), do we require a permission check?
1439
1525
 
1440
1526
  ```ts
1441
- export interface ProvenTxReqNotify {
1442
- transactionIds?: number[];
1443
- }
1527
+ seekCertificateRelinquishmentPermissions?: boolean
1444
1528
  ```
1445
1529
 
1446
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1530
+ ###### Property seekPermissionWhenApplyingActionLabels
1447
1531
 
1448
- ---
1449
- ##### Interface: PurgeParams
1532
+ When createAction is called with labels, do we ask for "label usage" permission?
1450
1533
 
1451
1534
  ```ts
1452
- export interface PurgeParams {
1453
- purgeCompleted: boolean;
1454
- purgeFailed: boolean;
1455
- purgeSpent: boolean;
1456
- purgeCompletedAge?: number;
1457
- purgeFailedAge?: number;
1458
- purgeSpentAge?: number;
1459
- }
1535
+ seekPermissionWhenApplyingActionLabels?: boolean
1460
1536
  ```
1461
1537
 
1462
- ###### Property purgeCompletedAge
1538
+ ###### Property seekPermissionWhenListingActionsByLabel
1463
1539
 
1464
- Minimum age in msecs for transient completed transaction data purge.
1465
- Default is 14 days.
1540
+ When listActions is called with labels, do we ask for "label usage" permission?
1466
1541
 
1467
1542
  ```ts
1468
- purgeCompletedAge?: number
1543
+ seekPermissionWhenListingActionsByLabel?: boolean
1469
1544
  ```
1470
1545
 
1471
- ###### Property purgeFailedAge
1546
+ ###### Property seekPermissionsForIdentityKeyRevelation
1472
1547
 
1473
- Minimum age in msecs for failed transaction data purge.
1474
- Default is 14 days.
1548
+ If getPublicKey is requested with `identityKey=true`, do we require permission?
1475
1549
 
1476
1550
  ```ts
1477
- purgeFailedAge?: number
1551
+ seekPermissionsForIdentityKeyRevelation?: boolean
1478
1552
  ```
1479
1553
 
1480
- ###### Property purgeSpentAge
1554
+ ###### Property seekPermissionsForIdentityResolution
1481
1555
 
1482
- Minimum age in msecs for failed transaction data purge.
1483
- Default is 14 days.
1556
+ If discoverByIdentityKey / discoverByAttributes are called, do we require permission
1557
+ for "identity resolution" usage?
1484
1558
 
1485
1559
  ```ts
1486
- purgeSpentAge?: number
1560
+ seekPermissionsForIdentityResolution?: boolean
1487
1561
  ```
1488
1562
 
1489
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1563
+ ###### Property seekPermissionsForKeyLinkageRevelation
1490
1564
 
1491
- ---
1492
- ##### Interface: PurgeResults
1565
+ For revealing counterparty-level or specific key linkage revelation information,
1566
+ should we require permission?
1493
1567
 
1494
1568
  ```ts
1495
- export interface PurgeResults {
1496
- count: number;
1497
- log: string;
1498
- }
1569
+ seekPermissionsForKeyLinkageRevelation?: boolean
1499
1570
  ```
1500
1571
 
1501
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1572
+ ###### Property seekPermissionsForPublicKeyRevelation
1502
1573
 
1503
- ---
1504
- ##### Interface: RequestSyncChunkArgs
1574
+ For revealing any user public key (getPublicKey) **other** than the identity key,
1575
+ should we require permission?
1505
1576
 
1506
1577
  ```ts
1507
- export interface RequestSyncChunkArgs {
1508
- fromStorageIdentityKey: string;
1509
- toStorageIdentityKey: string;
1510
- identityKey: string;
1511
- since?: Date;
1512
- maxRoughSize: number;
1513
- maxItems: number;
1514
- offsets: {
1515
- name: string;
1516
- offset: number;
1517
- }[];
1518
- }
1578
+ seekPermissionsForPublicKeyRevelation?: boolean
1519
1579
  ```
1520
1580
 
1521
- ###### Property fromStorageIdentityKey
1581
+ ###### Property seekProtocolPermissionsForEncrypting
1522
1582
 
1523
- The storageIdentityKey of the storage supplying the update SyncChunk data.
1583
+ For methods that perform encryption (encrypt/decrypt), require
1584
+ a "protocol usage" permission check?
1524
1585
 
1525
1586
  ```ts
1526
- fromStorageIdentityKey: string
1587
+ seekProtocolPermissionsForEncrypting?: boolean
1527
1588
  ```
1528
1589
 
1529
- ###### Property identityKey
1590
+ ###### Property seekProtocolPermissionsForHMAC
1530
1591
 
1531
- The identity of whose data is being requested
1592
+ For methods that perform HMAC creation or verification (createHmac, verifyHmac),
1593
+ require a "protocol usage" permission check?
1532
1594
 
1533
1595
  ```ts
1534
- identityKey: string
1596
+ seekProtocolPermissionsForHMAC?: boolean
1535
1597
  ```
1536
1598
 
1537
- ###### Property maxItems
1599
+ ###### Property seekProtocolPermissionsForSigning
1538
1600
 
1539
- The maximum number of items (records) to be returned.
1601
+ For `createSignature` and `verifySignature`,
1602
+ require a "protocol usage" permission check?
1540
1603
 
1541
1604
  ```ts
1542
- maxItems: number
1605
+ seekProtocolPermissionsForSigning?: boolean
1543
1606
  ```
1544
1607
 
1545
- ###### Property maxRoughSize
1608
+ ###### Property seekSpendingPermissions
1546
1609
 
1547
- A rough limit on how large the response should be.
1548
- The item that exceeds the limit is included and ends adding more items.
1610
+ If the originator tries to spend wallet funds (netSpent > 0 in createAction),
1611
+ do we seek spending authorization?
1549
1612
 
1550
1613
  ```ts
1551
- maxRoughSize: number
1614
+ seekSpendingPermissions?: boolean
1552
1615
  ```
1553
1616
 
1554
- ###### Property offsets
1617
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1555
1618
 
1556
- For each entity in dependency order, the offset at which to start returning items
1557
- from `since`.
1619
+ ---
1620
+ ##### Interface: PostBeefResult
1558
1621
 
1559
- The entity order is:
1560
- 0 ProvenTxs
1561
- 1 ProvenTxReqs
1562
- 2 OutputBaskets
1563
- 3 TxLabels
1564
- 4 OutputTags
1565
- 5 Transactions
1566
- 6 TxLabelMaps
1567
- 7 Commissions
1568
- 8 Outputs
1569
- 9 OutputTagMaps
1570
- 10 Certificates
1571
- 11 CertificateFields
1622
+ ```ts
1623
+ export interface PostBeefResult extends PostTxsResult {
1624
+ }
1625
+ ```
1626
+
1627
+ See also: [PostTxsResult](./client.md#interface-posttxsresult)
1628
+
1629
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1630
+
1631
+ ---
1632
+ ##### Interface: PostBeefResultForTxidApi
1572
1633
 
1573
1634
  ```ts
1574
- offsets: {
1575
- name: string;
1576
- offset: number;
1577
- }[]
1635
+ export interface PostBeefResultForTxidApi {
1636
+ txid: string;
1637
+ status: "success" | "error";
1638
+ alreadyKnown?: boolean;
1639
+ blockHash?: string;
1640
+ blockHeight?: number;
1641
+ merklePath?: string;
1642
+ }
1578
1643
  ```
1579
1644
 
1580
- ###### Property since
1645
+ ###### Property alreadyKnown
1581
1646
 
1582
- The max updated_at time received from the storage service receiving the request.
1583
- Will be undefiend if this is the first request or if no data was previously sync'ed.
1647
+ if true, the transaction was already known to this service. Usually treat as a success.
1584
1648
 
1585
- `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.
1649
+ Potentially stop posting to additional transaction processors.
1586
1650
 
1587
1651
  ```ts
1588
- since?: Date
1652
+ alreadyKnown?: boolean
1589
1653
  ```
1590
1654
 
1591
- ###### Property toStorageIdentityKey
1655
+ ###### Property status
1592
1656
 
1593
- The storageIdentityKey of the storage consuming the update SyncChunk data.
1657
+ 'success' - The transaction was accepted for processing
1594
1658
 
1595
1659
  ```ts
1596
- toStorageIdentityKey: string
1660
+ status: "success" | "error"
1597
1661
  ```
1598
1662
 
1599
1663
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1600
1664
 
1601
1665
  ---
1602
- ##### Interface: ScriptTemplateParamsBRC29
1666
+ ##### Interface: PostReqsToNetworkDetails
1603
1667
 
1604
1668
  ```ts
1605
- export interface ScriptTemplateParamsBRC29 {
1606
- derivationPrefix?: string;
1607
- derivationSuffix?: string;
1608
- keyDeriver: KeyDeriverApi;
1669
+ export interface PostReqsToNetworkDetails {
1670
+ txid: string;
1671
+ req: EntityProvenTxReq;
1672
+ status: PostReqsToNetworkDetailsStatus;
1673
+ pbrft: sdk.PostTxResultForTxid;
1674
+ data?: string;
1675
+ error?: string;
1609
1676
  }
1610
1677
  ```
1611
1678
 
1679
+ See also: [EntityProvenTxReq](./storage.md#class-entityproventxreq), [PostReqsToNetworkDetailsStatus](./storage.md#type-postreqstonetworkdetailsstatus), [PostTxResultForTxid](./client.md#interface-posttxresultfortxid)
1680
+
1612
1681
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1613
1682
 
1614
1683
  ---
1615
- ##### Interface: ScriptTemplateUnlock
1684
+ ##### Interface: PostReqsToNetworkResult
1616
1685
 
1617
1686
  ```ts
1618
- export interface ScriptTemplateUnlock {
1619
- sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
1620
- estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
1687
+ export interface PostReqsToNetworkResult {
1688
+ status: "success" | "error";
1689
+ beef: Beef;
1690
+ details: PostReqsToNetworkDetails[];
1691
+ pbr?: sdk.PostBeefResult;
1692
+ log: string;
1621
1693
  }
1622
1694
  ```
1623
1695
 
1696
+ See also: [PostBeefResult](./client.md#interface-postbeefresult), [PostReqsToNetworkDetails](./storage.md#interface-postreqstonetworkdetails)
1697
+
1624
1698
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1625
1699
 
1626
1700
  ---
1627
- ##### Interface: SetupEnv
1701
+ ##### Interface: PostTxResultForTxid
1628
1702
 
1629
- `SetupEnv` provides a starting point for managing secrets that
1630
- must not appear in source code.
1703
+ ```ts
1704
+ export interface PostTxResultForTxid {
1705
+ txid: string;
1706
+ status: "success" | "error";
1707
+ alreadyKnown?: boolean;
1708
+ doubleSpend?: boolean;
1709
+ blockHash?: string;
1710
+ blockHeight?: number;
1711
+ merklePath?: MerklePath;
1712
+ competingTxs?: string[];
1713
+ data?: object | string | PostTxResultForTxidError;
1714
+ }
1715
+ ```
1631
1716
 
1632
- The `makeEnv` and `getEnv` functions of the `Setup` and `SetupClient` classes
1633
- provide an easy way to create and import these secrets and related properties.
1717
+ See also: [PostTxResultForTxidError](./client.md#interface-posttxresultfortxiderror)
1718
+
1719
+ ###### Property alreadyKnown
1720
+
1721
+ if true, the transaction was already known to this service. Usually treat as a success.
1722
+
1723
+ Potentially stop posting to additional transaction processors.
1634
1724
 
1635
1725
  ```ts
1636
- export interface SetupEnv {
1637
- chain: sdk.Chain;
1638
- identityKey: string;
1639
- identityKey2: string;
1640
- filePath: string | undefined;
1641
- taalApiKey: string;
1642
- devKeys: Record<string, string>;
1643
- mySQLConnection: string;
1644
- }
1726
+ alreadyKnown?: boolean
1645
1727
  ```
1646
1728
 
1647
- See also: [Chain](./client.md#type-chain)
1729
+ ###### Property doubleSpend
1648
1730
 
1649
- ###### Property chain
1731
+ service indicated this broadcast double spends at least one input
1732
+ `competingTxs` may be an array of txids that were first seen spends of at least one input.
1733
+
1734
+ ```ts
1735
+ doubleSpend?: boolean
1736
+ ```
1737
+
1738
+ ###### Property status
1650
1739
 
1651
- The chan being accessed: 'main' for mainnet, 'test' for 'testnet'.
1740
+ 'success' - The transaction was accepted for processing
1652
1741
 
1653
1742
  ```ts
1654
- chain: sdk.Chain
1743
+ status: "success" | "error"
1655
1744
  ```
1656
- See also: [Chain](./client.md#type-chain)
1657
1745
 
1658
- ###### Property devKeys
1746
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1659
1747
 
1660
- A map of public keys (identity keys, hex strings) to private keys (hex strings).
1748
+ ---
1749
+ ##### Interface: PostTxResultForTxidError
1661
1750
 
1662
1751
  ```ts
1663
- devKeys: Record<string, string>
1752
+ export interface PostTxResultForTxidError {
1753
+ status?: string;
1754
+ detail?: string;
1755
+ more?: object;
1756
+ }
1664
1757
  ```
1665
1758
 
1666
- ###### Property filePath
1759
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1760
+
1761
+ ---
1762
+ ##### Interface: PostTxsResult
1667
1763
 
1668
- Filepath to sqlite file to be used for identityKey wallet.
1764
+ Properties on array items of result returned from `WalletServices` function `postBeef`.
1669
1765
 
1670
1766
  ```ts
1671
- filePath: string | undefined
1767
+ export interface PostTxsResult {
1768
+ name: string;
1769
+ status: "success" | "error";
1770
+ error?: sdk.WalletError;
1771
+ txidResults: PostTxResultForTxid[];
1772
+ data?: object;
1773
+ }
1672
1774
  ```
1673
1775
 
1674
- ###### Property identityKey
1776
+ See also: [PostTxResultForTxid](./client.md#interface-posttxresultfortxid), [WalletError](./client.md#class-walleterror)
1777
+
1778
+ ###### Property data
1675
1779
 
1676
- The user's primary identity key (public key).
1780
+ Service response object. Use service name and status to infer type of object.
1677
1781
 
1678
1782
  ```ts
1679
- identityKey: string
1783
+ data?: object
1680
1784
  ```
1681
1785
 
1682
- ###### Property identityKey2
1786
+ ###### Property name
1683
1787
 
1684
- A secondary identity key (public key), used to test exchanges with other users.
1788
+ The name of the service to which the transaction was submitted for processing
1685
1789
 
1686
1790
  ```ts
1687
- identityKey2: string
1791
+ name: string
1688
1792
  ```
1689
1793
 
1690
- ###### Property mySQLConnection
1794
+ ###### Property status
1691
1795
 
1692
- A MySQL connection string including user and password properties.
1693
- Must be valid to make use of MySQL `Setup` class support.
1796
+ 'success' all txids returned status of 'success'
1797
+ 'error' one or more txids returned status of 'error'. See txidResults for details.
1694
1798
 
1695
1799
  ```ts
1696
- mySQLConnection: string
1800
+ status: "success" | "error"
1697
1801
  ```
1698
1802
 
1699
- ###### Property taalApiKey
1803
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1700
1804
 
1701
- A vaild TAAL API key for use by `Services`
1805
+ ---
1806
+ ##### Interface: ProcessSyncChunkResult
1702
1807
 
1703
1808
  ```ts
1704
- taalApiKey: string
1809
+ export interface ProcessSyncChunkResult {
1810
+ done: boolean;
1811
+ maxUpdated_at: Date | undefined;
1812
+ updates: number;
1813
+ inserts: number;
1814
+ error?: sdk.WalletError;
1815
+ }
1705
1816
  ```
1706
1817
 
1818
+ See also: [WalletError](./client.md#class-walleterror)
1819
+
1707
1820
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1708
1821
 
1709
1822
  ---
1710
- ##### Interface: SetupWallet
1823
+ ##### Interface: ProvenOrRawTx
1824
+
1825
+ ```ts
1826
+ export interface ProvenOrRawTx {
1827
+ proven?: TableProvenTx;
1828
+ rawTx?: number[];
1829
+ inputBEEF?: number[];
1830
+ }
1831
+ ```
1711
1832
 
1712
- When creating a BRC-100 compatible `Wallet`, many components come into play.
1833
+ See also: [TableProvenTx](./storage.md#interface-tableproventx)
1834
+
1835
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1713
1836
 
1714
- All of the `createWallet` functions in the `Setup` and `SetupClient` classes return
1715
- an object with direct access to each component to facilitate experimentation, testing
1716
- and customization.
1837
+ ---
1838
+ ##### Interface: ProvenTxFromTxidResult
1717
1839
 
1718
1840
  ```ts
1719
- export interface SetupWallet {
1720
- rootKey: PrivateKey;
1721
- identityKey: string;
1722
- keyDeriver: KeyDeriver;
1723
- chain: sdk.Chain;
1724
- storage: WalletStorageManager;
1725
- services: Services;
1726
- monitor: Monitor;
1727
- wallet: Wallet;
1841
+ export interface ProvenTxFromTxidResult {
1842
+ proven?: EntityProvenTx;
1843
+ rawTx?: number[];
1728
1844
  }
1729
1845
  ```
1730
1846
 
1731
- See also: [Chain](./client.md#type-chain), [Monitor](./monitor.md#class-monitor), [Services](./services.md#class-services), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager)
1847
+ See also: [EntityProvenTx](./storage.md#class-entityproventx)
1732
1848
 
1733
- ###### Property chain
1849
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1734
1850
 
1735
- The chain ('main' or 'test') which the wallet accesses.
1851
+ ---
1852
+ ##### Interface: ProvenTxReqHistory
1736
1853
 
1737
1854
  ```ts
1738
- chain: sdk.Chain
1855
+ export interface ProvenTxReqHistory {
1856
+ notes?: Record<string, string>;
1857
+ }
1739
1858
  ```
1740
- See also: [Chain](./client.md#type-chain)
1741
1859
 
1742
- ###### Property identityKey
1860
+ ###### Property notes
1743
1861
 
1744
- The pubilc key associated with the `rootKey` which also serves as the wallet's identity.
1862
+ Keys are Date().toISOString()
1863
+ Values are a description of what happened.
1745
1864
 
1746
1865
  ```ts
1747
- identityKey: string
1866
+ notes?: Record<string, string>
1748
1867
  ```
1749
1868
 
1750
- ###### Property keyDeriver
1869
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1751
1870
 
1752
- The `KeyDeriver` component used by the wallet for key derivation and cryptographic functions.
1871
+ ---
1872
+ ##### Interface: ProvenTxReqHistorySummaryApi
1753
1873
 
1754
1874
  ```ts
1755
- keyDeriver: KeyDeriver
1875
+ export interface ProvenTxReqHistorySummaryApi {
1876
+ setToCompleted: boolean;
1877
+ setToCallback: boolean;
1878
+ setToUnmined: boolean;
1879
+ setToDoubleSpend: boolean;
1880
+ setToSending: boolean;
1881
+ setToUnconfirmed: boolean;
1882
+ }
1756
1883
  ```
1757
1884
 
1758
- ###### Property monitor
1885
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1759
1886
 
1760
- The background task `Monitor` component available to the wallet to offload tasks
1761
- that speed up wallet operations and maintain data integrity.
1887
+ ---
1888
+ ##### Interface: ProvenTxReqNotify
1762
1889
 
1763
1890
  ```ts
1764
- monitor: Monitor
1891
+ export interface ProvenTxReqNotify {
1892
+ transactionIds?: number[];
1893
+ }
1765
1894
  ```
1766
- See also: [Monitor](./monitor.md#class-monitor)
1767
1895
 
1768
- ###### Property rootKey
1896
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1769
1897
 
1770
- The rootKey of the `KeyDeriver`. The private key from which other keys are derived.
1898
+ ---
1899
+ ##### Interface: PurgeParams
1771
1900
 
1772
1901
  ```ts
1773
- rootKey: PrivateKey
1902
+ export interface PurgeParams {
1903
+ purgeCompleted: boolean;
1904
+ purgeFailed: boolean;
1905
+ purgeSpent: boolean;
1906
+ purgeCompletedAge?: number;
1907
+ purgeFailedAge?: number;
1908
+ purgeSpentAge?: number;
1909
+ }
1774
1910
  ```
1775
1911
 
1776
- ###### Property services
1912
+ ###### Property purgeCompletedAge
1777
1913
 
1778
- The network `Services` component which provides the wallet with access to external services hosted
1779
- on the public network.
1914
+ Minimum age in msecs for transient completed transaction data purge.
1915
+ Default is 14 days.
1780
1916
 
1781
1917
  ```ts
1782
- services: Services
1918
+ purgeCompletedAge?: number
1783
1919
  ```
1784
- See also: [Services](./services.md#class-services)
1785
1920
 
1786
- ###### Property storage
1921
+ ###### Property purgeFailedAge
1787
1922
 
1788
- The `WalletStorageManager` that manages all the configured storage providers (active and backups)
1789
- accessed by the wallet.
1923
+ Minimum age in msecs for failed transaction data purge.
1924
+ Default is 14 days.
1790
1925
 
1791
1926
  ```ts
1792
- storage: WalletStorageManager
1927
+ purgeFailedAge?: number
1793
1928
  ```
1794
- See also: [WalletStorageManager](./storage.md#class-walletstoragemanager)
1795
-
1796
- ###### Property wallet
1797
1929
 
1798
- The actual BRC-100 `Wallet` to which all the other properties and components contribute.
1930
+ ###### Property purgeSpentAge
1799
1931
 
1800
- Note that internally, the wallet is itself linked to all these properties and components.
1801
- They are included in this interface to facilitate access after wallet construction for
1802
- experimentation, testing and customization. Any changes made to the configuration of these
1803
- components after construction may disrupt the normal operation of the wallet.
1932
+ Minimum age in msecs for failed transaction data purge.
1933
+ Default is 14 days.
1804
1934
 
1805
1935
  ```ts
1806
- wallet: Wallet
1936
+ purgeSpentAge?: number
1807
1937
  ```
1808
- See also: [Wallet](./client.md#class-wallet)
1809
1938
 
1810
1939
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1811
1940
 
1812
1941
  ---
1813
- ##### Interface: SetupWalletArgs
1814
-
1815
- Arguments used by `createWallet` to construct a `SetupWallet`.
1816
-
1817
- Extension `SetupWalletClientArgs` used by `createWalletClient` to construct a `SetupWalletClient`.
1942
+ ##### Interface: PurgeResults
1818
1943
 
1819
- Extension `SetupWalletKnexArgs` used by `createWalletKnex` to construct a `SetupWalletKnex`.
1944
+ ```ts
1945
+ export interface PurgeResults {
1946
+ count: number;
1947
+ log: string;
1948
+ }
1949
+ ```
1820
1950
 
1821
- Extension `SetupWalletMySQLArgs` used by `createWalletMySQL` to construct a `SetupWalletKnex`.
1951
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1822
1952
 
1823
- Extension `SetupWalletSQLiteArgs` used by `createWalletSQLite` to construct a `SetupWalletKnex`.
1953
+ ---
1954
+ ##### Interface: RequestSyncChunkArgs
1824
1955
 
1825
1956
  ```ts
1826
- export interface SetupWalletArgs {
1827
- env: SetupEnv;
1828
- rootKeyHex?: string;
1829
- privilegedKeyGetter?: () => Promise<PrivateKey>;
1830
- active?: sdk.WalletStorageProvider;
1831
- backups?: sdk.WalletStorageProvider[];
1957
+ export interface RequestSyncChunkArgs {
1958
+ fromStorageIdentityKey: string;
1959
+ toStorageIdentityKey: string;
1960
+ identityKey: string;
1961
+ since?: Date;
1962
+ maxRoughSize: number;
1963
+ maxItems: number;
1964
+ offsets: {
1965
+ name: string;
1966
+ offset: number;
1967
+ }[];
1832
1968
  }
1833
1969
  ```
1834
1970
 
1835
- See also: [SetupEnv](./setup.md#interface-setupenv), [WalletStorageProvider](./client.md#interface-walletstorageprovider)
1836
-
1837
- ###### Property active
1971
+ ###### Property fromStorageIdentityKey
1838
1972
 
1839
- Optional. Active wallet storage. Can be added later.
1973
+ The storageIdentityKey of the storage supplying the update SyncChunk data.
1840
1974
 
1841
1975
  ```ts
1842
- active?: sdk.WalletStorageProvider
1976
+ fromStorageIdentityKey: string
1843
1977
  ```
1844
- See also: [WalletStorageProvider](./client.md#interface-walletstorageprovider)
1845
1978
 
1846
- ###### Property backups
1979
+ ###### Property identityKey
1847
1980
 
1848
- Optional. One or more storage providers managed as backup destinations. Can be added later.
1981
+ The identity of whose data is being requested
1849
1982
 
1850
1983
  ```ts
1851
- backups?: sdk.WalletStorageProvider[]
1984
+ identityKey: string
1852
1985
  ```
1853
- See also: [WalletStorageProvider](./client.md#interface-walletstorageprovider)
1854
1986
 
1855
- ###### Property env
1987
+ ###### Property maxItems
1856
1988
 
1857
- Configuration "secrets" typically obtained by `Setup.makeEnv` and `Setup.getEnv` functions.
1989
+ The maximum number of items (records) to be returned.
1858
1990
 
1859
1991
  ```ts
1860
- env: SetupEnv
1992
+ maxItems: number
1861
1993
  ```
1862
- See also: [SetupEnv](./setup.md#interface-setupenv)
1863
1994
 
1864
- ###### Property privilegedKeyGetter
1995
+ ###### Property maxRoughSize
1865
1996
 
1866
- Optional. The privileged private key getter used to initialize the `PrivilegedKeyManager`.
1867
- Defaults to undefined.
1997
+ A rough limit on how large the response should be.
1998
+ The item that exceeds the limit is included and ends adding more items.
1868
1999
 
1869
2000
  ```ts
1870
- privilegedKeyGetter?: () => Promise<PrivateKey>
2001
+ maxRoughSize: number
1871
2002
  ```
1872
2003
 
1873
- ###### Property rootKeyHex
2004
+ ###### Property offsets
2005
+
2006
+ For each entity in dependency order, the offset at which to start returning items
2007
+ from `since`.
1874
2008
 
1875
- Optional. The non-privileged private key used to initialize the `KeyDeriver` and determine the `identityKey`.
1876
- Defaults to `env.devKeys[env.identityKey]
2009
+ The entity order is:
2010
+ 0 ProvenTxs
2011
+ 1 ProvenTxReqs
2012
+ 2 OutputBaskets
2013
+ 3 TxLabels
2014
+ 4 OutputTags
2015
+ 5 Transactions
2016
+ 6 TxLabelMaps
2017
+ 7 Commissions
2018
+ 8 Outputs
2019
+ 9 OutputTagMaps
2020
+ 10 Certificates
2021
+ 11 CertificateFields
1877
2022
 
1878
2023
  ```ts
1879
- rootKeyHex?: string
2024
+ offsets: {
2025
+ name: string;
2026
+ offset: number;
2027
+ }[]
1880
2028
  ```
1881
2029
 
1882
- Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
2030
+ ###### Property since
1883
2031
 
1884
- ---
1885
- ##### Interface: SetupWalletClient
2032
+ The max updated_at time received from the storage service receiving the request.
2033
+ Will be undefiend if this is the first request or if no data was previously sync'ed.
1886
2034
 
1887
- Extension `SetupWalletClient` of `SetupWallet` is returned by `createWalletClient`
2035
+ `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.
1888
2036
 
1889
2037
  ```ts
1890
- export interface SetupWalletClient extends SetupWallet {
1891
- endpointUrl: string;
1892
- }
2038
+ since?: Date
1893
2039
  ```
1894
2040
 
1895
- See also: [SetupWallet](./setup.md#interface-setupwallet)
1896
-
1897
- ###### Property endpointUrl
2041
+ ###### Property toStorageIdentityKey
1898
2042
 
1899
- The endpoint URL of the service hosting the `StorageServer` JSON-RPC service to
1900
- which a `StorageClient` instance is connected to function as
1901
- the active storage provider of the wallet.
2043
+ The storageIdentityKey of the storage consuming the update SyncChunk data.
1902
2044
 
1903
2045
  ```ts
1904
- endpointUrl: string
2046
+ toStorageIdentityKey: string
1905
2047
  ```
1906
2048
 
1907
2049
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1908
2050
 
1909
2051
  ---
1910
- ##### Interface: SetupWalletClientArgs
1911
-
1912
- Extension `SetupWalletClientArgs` of `SetupWalletArgs` is used by `createWalletClient`
1913
- to construct a `SetupWalletClient`.
2052
+ ##### Interface: ScriptTemplateParamsBRC29
1914
2053
 
1915
2054
  ```ts
1916
- export interface SetupWalletClientArgs extends SetupWalletArgs {
1917
- endpointUrl?: string;
2055
+ export interface ScriptTemplateParamsBRC29 {
2056
+ derivationPrefix?: string;
2057
+ derivationSuffix?: string;
2058
+ keyDeriver: KeyDeriverApi;
1918
2059
  }
1919
2060
  ```
1920
2061
 
1921
- See also: [SetupWalletArgs](./setup.md#interface-setupwalletargs)
2062
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
2063
+
2064
+ ---
2065
+ ##### Interface: ScriptTemplateUnlock
2066
+
2067
+ ```ts
2068
+ export interface ScriptTemplateUnlock {
2069
+ sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
2070
+ estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
2071
+ }
2072
+ ```
1922
2073
 
1923
- ###### Property endpointUrl
2074
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
1924
2075
 
1925
- The endpoint URL of a service hosting the `StorageServer` JSON-RPC service to
1926
- which a `StorageClient` instance should connect to function as
1927
- the active storage provider of the newly created wallet.
2076
+ ---
2077
+ ##### Interface: StartAuthResponse
1928
2078
 
1929
2079
  ```ts
1930
- endpointUrl?: string
2080
+ export interface StartAuthResponse {
2081
+ success: boolean;
2082
+ message?: string;
2083
+ data?: any;
2084
+ }
1931
2085
  ```
1932
2086
 
1933
2087
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
@@ -3063,6 +3217,20 @@ See also: [PurgeParams](./client.md#interface-purgeparams)
3063
3217
 
3064
3218
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3065
3219
 
3220
+ ---
3221
+ ##### Interface: TrustSettings
3222
+
3223
+ ```ts
3224
+ export interface TrustSettings {
3225
+ trustLevel: number;
3226
+ trustedCertifiers: Certifier[];
3227
+ }
3228
+ ```
3229
+
3230
+ See also: [Certifier](./client.md#interface-certifier)
3231
+
3232
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3233
+
3066
3234
  ---
3067
3235
  ##### Interface: TrxToken
3068
3236
 
@@ -3108,6 +3276,172 @@ export interface TxScriptOffsets {
3108
3276
 
3109
3277
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3110
3278
 
3279
+ ---
3280
+ ##### Interface: UMPToken
3281
+
3282
+ Describes the structure of a User Management Protocol (UMP) token.
3283
+
3284
+ ```ts
3285
+ export interface UMPToken {
3286
+ passwordPresentationPrimary: number[];
3287
+ passwordRecoveryPrimary: number[];
3288
+ presentationRecoveryPrimary: number[];
3289
+ passwordPrimaryPrivileged: number[];
3290
+ presentationRecoveryPrivileged: number[];
3291
+ presentationHash: number[];
3292
+ passwordSalt: number[];
3293
+ recoveryHash: number[];
3294
+ presentationKeyEncrypted: number[];
3295
+ recoveryKeyEncrypted: number[];
3296
+ passwordKeyEncrypted: number[];
3297
+ currentOutpoint?: OutpointString;
3298
+ }
3299
+ ```
3300
+
3301
+ ###### Property currentOutpoint
3302
+
3303
+ Describes the token's location on-chain, if it's already been published.
3304
+
3305
+ ```ts
3306
+ currentOutpoint?: OutpointString
3307
+ ```
3308
+
3309
+ ###### Property passwordKeyEncrypted
3310
+
3311
+ A copy of the password key encrypted with the privileged key.
3312
+
3313
+ ```ts
3314
+ passwordKeyEncrypted: number[]
3315
+ ```
3316
+
3317
+ ###### Property passwordPresentationPrimary
3318
+
3319
+ Primary key encrypted by the XOR of the password and presentation keys.
3320
+
3321
+ ```ts
3322
+ passwordPresentationPrimary: number[]
3323
+ ```
3324
+
3325
+ ###### Property passwordPrimaryPrivileged
3326
+
3327
+ Privileged key encrypted by the XOR of the password and primary keys.
3328
+
3329
+ ```ts
3330
+ passwordPrimaryPrivileged: number[]
3331
+ ```
3332
+
3333
+ ###### Property passwordRecoveryPrimary
3334
+
3335
+ Primary key encrypted by the XOR of the password and recovery keys.
3336
+
3337
+ ```ts
3338
+ passwordRecoveryPrimary: number[]
3339
+ ```
3340
+
3341
+ ###### Property passwordSalt
3342
+
3343
+ PBKDF2 salt used in conjunction with the password to derive the password key.
3344
+
3345
+ ```ts
3346
+ passwordSalt: number[]
3347
+ ```
3348
+
3349
+ ###### Property presentationHash
3350
+
3351
+ Hash of the presentation key.
3352
+
3353
+ ```ts
3354
+ presentationHash: number[]
3355
+ ```
3356
+
3357
+ ###### Property presentationKeyEncrypted
3358
+
3359
+ A copy of the presentation key encrypted with the privileged key.
3360
+
3361
+ ```ts
3362
+ presentationKeyEncrypted: number[]
3363
+ ```
3364
+
3365
+ ###### Property presentationRecoveryPrimary
3366
+
3367
+ Primary key encrypted by the XOR of the presentation and recovery keys.
3368
+
3369
+ ```ts
3370
+ presentationRecoveryPrimary: number[]
3371
+ ```
3372
+
3373
+ ###### Property presentationRecoveryPrivileged
3374
+
3375
+ Privileged key encrypted by the XOR of the presentation and recovery keys.
3376
+
3377
+ ```ts
3378
+ presentationRecoveryPrivileged: number[]
3379
+ ```
3380
+
3381
+ ###### Property recoveryHash
3382
+
3383
+ Hash of the recovery key.
3384
+
3385
+ ```ts
3386
+ recoveryHash: number[]
3387
+ ```
3388
+
3389
+ ###### Property recoveryKeyEncrypted
3390
+
3391
+ A copy of the recovery key encrypted with the privileged key.
3392
+
3393
+ ```ts
3394
+ recoveryKeyEncrypted: number[]
3395
+ ```
3396
+
3397
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3398
+
3399
+ ---
3400
+ ##### Interface: UMPTokenInteractor
3401
+
3402
+ Describes a system capable of finding and updating UMP tokens on the blockchain.
3403
+
3404
+ ```ts
3405
+ export interface UMPTokenInteractor {
3406
+ findByPresentationKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
3407
+ findByRecoveryKeyHash: (hash: number[]) => Promise<UMPToken | undefined>;
3408
+ buildAndSend: (wallet: WalletInterface, adminOriginator: OriginatorDomainNameStringUnder250Bytes, token: UMPToken, oldTokenToConsume?: UMPToken) => Promise<OutpointString>;
3409
+ }
3410
+ ```
3411
+
3412
+ See also: [UMPToken](./client.md#interface-umptoken)
3413
+
3414
+ ###### Property buildAndSend
3415
+
3416
+ Creates (and optionally consumes the previous version of) a UMP token on-chain.
3417
+
3418
+ ```ts
3419
+ buildAndSend: (wallet: WalletInterface, adminOriginator: OriginatorDomainNameStringUnder250Bytes, token: UMPToken, oldTokenToConsume?: UMPToken) => Promise<OutpointString>
3420
+ ```
3421
+ See also: [UMPToken](./client.md#interface-umptoken)
3422
+
3423
+ ###### Property findByPresentationKeyHash
3424
+
3425
+ Locates the latest valid copy of a UMP token (including its outpoint)
3426
+ based on the presentation key hash.
3427
+
3428
+ ```ts
3429
+ findByPresentationKeyHash: (hash: number[]) => Promise<UMPToken | undefined>
3430
+ ```
3431
+ See also: [UMPToken](./client.md#interface-umptoken)
3432
+
3433
+ ###### Property findByRecoveryKeyHash
3434
+
3435
+ Locates the latest valid copy of a UMP token (including its outpoint)
3436
+ based on the recovery key hash.
3437
+
3438
+ ```ts
3439
+ findByRecoveryKeyHash: (hash: number[]) => Promise<UMPToken | undefined>
3440
+ ```
3441
+ See also: [UMPToken](./client.md#interface-umptoken)
3442
+
3443
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3444
+
3111
3445
  ---
3112
3446
  ##### Interface: UpdateProvenTxReqWithNewProvenTxArgs
3113
3447
 
@@ -3624,10 +3958,31 @@ export interface WalletArgs {
3624
3958
  services?: sdk.WalletServices;
3625
3959
  monitor?: Monitor;
3626
3960
  privilegedKeyManager?: sdk.PrivilegedKeyManager;
3961
+ settingsManager?: WalletSettingsManager;
3962
+ lookupResolver?: LookupResolver;
3963
+ }
3964
+ ```
3965
+
3966
+ See also: [Chain](./client.md#type-chain), [Monitor](./monitor.md#class-monitor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [WalletServices](./client.md#interface-walletservices), [WalletSettingsManager](./client.md#class-walletsettingsmanager), [WalletStorageManager](./storage.md#class-walletstoragemanager)
3967
+
3968
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3969
+
3970
+ ---
3971
+ ##### Interface: WalletPermissionsManagerCallbacks
3972
+
3973
+ The set of callbacks that external code can bind to, e.g. to display UI prompts or logs
3974
+ when a permission is requested.
3975
+
3976
+ ```ts
3977
+ export interface WalletPermissionsManagerCallbacks {
3978
+ onProtocolPermissionRequested?: PermissionEventHandler[];
3979
+ onBasketAccessRequested?: PermissionEventHandler[];
3980
+ onCertificateAccessRequested?: PermissionEventHandler[];
3981
+ onSpendingAuthorizationRequested?: PermissionEventHandler[];
3627
3982
  }
3628
3983
  ```
3629
3984
 
3630
- See also: [Chain](./client.md#type-chain), [Monitor](./monitor.md#class-monitor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [WalletServices](./client.md#interface-walletservices), [WalletStorageManager](./storage.md#class-walletstoragemanager)
3985
+ See also: [PermissionEventHandler](./client.md#type-permissioneventhandler)
3631
3986
 
3632
3987
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3633
3988
 
@@ -3851,7 +4206,34 @@ export interface WalletServicesOptions {
3851
4206
  }
3852
4207
  ```
3853
4208
 
3854
- See also: [ArcConfig](./services.md#interface-arcconfig), [BsvExchangeRate](./client.md#interface-bsvexchangerate), [Chain](./client.md#type-chain), [FiatExchangeRates](./client.md#interface-fiatexchangerates)
4209
+ See also: [ArcConfig](./services.md#interface-arcconfig), [BsvExchangeRate](./client.md#interface-bsvexchangerate), [Chain](./client.md#type-chain), [FiatExchangeRates](./client.md#interface-fiatexchangerates)
4210
+
4211
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4212
+
4213
+ ---
4214
+ ##### Interface: WalletSettings
4215
+
4216
+ ```ts
4217
+ export interface WalletSettings {
4218
+ trustSettings: TrustSettings;
4219
+ theme?: WalletTheme;
4220
+ }
4221
+ ```
4222
+
4223
+ See also: [TrustSettings](./client.md#interface-trustsettings), [WalletTheme](./client.md#interface-wallettheme)
4224
+
4225
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4226
+
4227
+ ---
4228
+ ##### Interface: WalletSettingsManagerConfig
4229
+
4230
+ ```ts
4231
+ export interface WalletSettingsManagerConfig {
4232
+ defaultSettings: WalletSettings;
4233
+ }
4234
+ ```
4235
+
4236
+ See also: [WalletSettings](./client.md#interface-walletsettings)
3855
4237
 
3856
4238
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
3857
4239
 
@@ -4019,6 +4401,17 @@ See also: [AuthId](./client.md#interface-authid), [StorageCreateActionResult](./
4019
4401
 
4020
4402
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4021
4403
 
4404
+ ---
4405
+ ##### Interface: WalletTheme
4406
+
4407
+ ```ts
4408
+ export interface WalletTheme {
4409
+ mode: string;
4410
+ }
4411
+ ```
4412
+
4413
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4414
+
4022
4415
  ---
4023
4416
  ##### Interface: XValidCreateActionOutput
4024
4417
 
@@ -4041,25 +4434,28 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
4041
4434
 
4042
4435
  | | | |
4043
4436
  | --- | --- | --- |
4044
- | [ARC](#class-arc) | [PrivilegedKeyManager](#class-privilegedkeymanager) | [WERR_BAD_REQUEST](#class-werr_bad_request) |
4045
- | [CertOps](#class-certops) | [ScriptTemplateBRC29](#class-scripttemplatebrc29) | [WERR_BROADCAST_UNAVAILABLE](#class-werr_broadcast_unavailable) |
4046
- | [EntityBase](#class-entitybase) | [SdkWhatsOnChain](#class-sdkwhatsonchain) | [WERR_INSUFFICIENT_FUNDS](#class-werr_insufficient_funds) |
4047
- | [EntityCertificate](#class-entitycertificate) | [ServiceCollection](#class-servicecollection) | [WERR_INTERNAL](#class-werr_internal) |
4048
- | [EntityCertificateField](#class-entitycertificatefield) | [Services](#class-services) | [WERR_INVALID_OPERATION](#class-werr_invalid_operation) |
4049
- | [EntityCommission](#class-entitycommission) | [SetupClient](#class-setupclient) | [WERR_INVALID_PARAMETER](#class-werr_invalid_parameter) |
4050
- | [EntityOutput](#class-entityoutput) | [StorageClient](#class-storageclient) | [WERR_INVALID_PUBLIC_KEY](#class-werr_invalid_public_key) |
4051
- | [EntityOutputBasket](#class-entityoutputbasket) | [StorageProvider](#class-storageprovider) | [WERR_MISSING_PARAMETER](#class-werr_missing_parameter) |
4052
- | [EntityOutputTag](#class-entityoutputtag) | [StorageReader](#class-storagereader) | [WERR_NETWORK_CHAIN](#class-werr_network_chain) |
4053
- | [EntityOutputTagMap](#class-entityoutputtagmap) | [StorageReaderWriter](#class-storagereaderwriter) | [WERR_NOT_ACTIVE](#class-werr_not_active) |
4054
- | [EntityProvenTx](#class-entityproventx) | [StorageSyncReader](#class-storagesyncreader) | [WERR_NOT_IMPLEMENTED](#class-werr_not_implemented) |
4055
- | [EntityProvenTxReq](#class-entityproventxreq) | [TaskCheckForProofs](#class-taskcheckforproofs) | [WERR_UNAUTHORIZED](#class-werr_unauthorized) |
4056
- | [EntitySyncState](#class-entitysyncstate) | [TaskClock](#class-taskclock) | [Wallet](#class-wallet) |
4057
- | [EntityTransaction](#class-entitytransaction) | [TaskFailAbandoned](#class-taskfailabandoned) | [WalletError](#class-walleterror) |
4058
- | [EntityTxLabel](#class-entitytxlabel) | [TaskNewHeader](#class-tasknewheader) | [WalletMonitorTask](#class-walletmonitortask) |
4059
- | [EntityTxLabelMap](#class-entitytxlabelmap) | [TaskPurge](#class-taskpurge) | [WalletSigner](#class-walletsigner) |
4060
- | [EntityUser](#class-entityuser) | [TaskReviewStatus](#class-taskreviewstatus) | [WalletStorageManager](#class-walletstoragemanager) |
4061
- | [MergeEntity](#class-mergeentity) | [TaskSendWaiting](#class-tasksendwaiting) | [WhatsOnChain](#class-whatsonchain) |
4062
- | [Monitor](#class-monitor) | [TaskSyncWhenIdle](#class-tasksyncwhenidle) | |
4437
+ | [ARC](#class-arc) | [PersonaIDInteractor](#class-personaidinteractor) | [WERR_BAD_REQUEST](#class-werr_bad_request) |
4438
+ | [AuthMethodInteractor](#class-authmethodinteractor) | [PrivilegedKeyManager](#class-privilegedkeymanager) | [WERR_BROADCAST_UNAVAILABLE](#class-werr_broadcast_unavailable) |
4439
+ | [CWIStyleWalletManager](#class-cwistylewalletmanager) | [ScriptTemplateBRC29](#class-scripttemplatebrc29) | [WERR_INSUFFICIENT_FUNDS](#class-werr_insufficient_funds) |
4440
+ | [CertOps](#class-certops) | [SdkWhatsOnChain](#class-sdkwhatsonchain) | [WERR_INTERNAL](#class-werr_internal) |
4441
+ | [EntityBase](#class-entitybase) | [ServiceCollection](#class-servicecollection) | [WERR_INVALID_OPERATION](#class-werr_invalid_operation) |
4442
+ | [EntityCertificate](#class-entitycertificate) | [Services](#class-services) | [WERR_INVALID_PARAMETER](#class-werr_invalid_parameter) |
4443
+ | [EntityCertificateField](#class-entitycertificatefield) | [SimpleWalletManager](#class-simplewalletmanager) | [WERR_INVALID_PUBLIC_KEY](#class-werr_invalid_public_key) |
4444
+ | [EntityCommission](#class-entitycommission) | [StorageClient](#class-storageclient) | [WERR_MISSING_PARAMETER](#class-werr_missing_parameter) |
4445
+ | [EntityOutput](#class-entityoutput) | [StorageProvider](#class-storageprovider) | [WERR_NETWORK_CHAIN](#class-werr_network_chain) |
4446
+ | [EntityOutputBasket](#class-entityoutputbasket) | [StorageReader](#class-storagereader) | [WERR_NOT_ACTIVE](#class-werr_not_active) |
4447
+ | [EntityOutputTag](#class-entityoutputtag) | [StorageReaderWriter](#class-storagereaderwriter) | [WERR_NOT_IMPLEMENTED](#class-werr_not_implemented) |
4448
+ | [EntityOutputTagMap](#class-entityoutputtagmap) | [StorageSyncReader](#class-storagesyncreader) | [WERR_UNAUTHORIZED](#class-werr_unauthorized) |
4449
+ | [EntityProvenTx](#class-entityproventx) | [TaskCheckForProofs](#class-taskcheckforproofs) | [Wallet](#class-wallet) |
4450
+ | [EntityProvenTxReq](#class-entityproventxreq) | [TaskClock](#class-taskclock) | [WalletAuthenticationManager](#class-walletauthenticationmanager) |
4451
+ | [EntitySyncState](#class-entitysyncstate) | [TaskFailAbandoned](#class-taskfailabandoned) | [WalletError](#class-walleterror) |
4452
+ | [EntityTransaction](#class-entitytransaction) | [TaskNewHeader](#class-tasknewheader) | [WalletMonitorTask](#class-walletmonitortask) |
4453
+ | [EntityTxLabel](#class-entitytxlabel) | [TaskPurge](#class-taskpurge) | [WalletPermissionsManager](#class-walletpermissionsmanager) |
4454
+ | [EntityTxLabelMap](#class-entitytxlabelmap) | [TaskReviewStatus](#class-taskreviewstatus) | [WalletSettingsManager](#class-walletsettingsmanager) |
4455
+ | [EntityUser](#class-entityuser) | [TaskSendWaiting](#class-tasksendwaiting) | [WalletSigner](#class-walletsigner) |
4456
+ | [MergeEntity](#class-mergeentity) | [TaskSyncWhenIdle](#class-tasksyncwhenidle) | [WalletStorageManager](#class-walletstoragemanager) |
4457
+ | [Monitor](#class-monitor) | [TwilioPhoneInteractor](#class-twiliophoneinteractor) | [WhatsOnChain](#class-whatsonchain) |
4458
+ | [OverlayUMPTokenInteractor](#class-overlayumptokeninteractor) | [WABClient](#class-wabclient) | |
4063
4459
 
4064
4460
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4065
4461
 
@@ -4157,6 +4553,304 @@ See also: [PostTxResultForTxid](./client.md#interface-posttxresultfortxid)
4157
4553
 
4158
4554
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4159
4555
 
4556
+ ---
4557
+ ##### Class: AuthMethodInteractor
4558
+
4559
+ Abstract client-side interactor for an Auth Method
4560
+
4561
+ ```ts
4562
+ export abstract class AuthMethodInteractor {
4563
+ public abstract methodType: string;
4564
+ public abstract startAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<StartAuthResponse>;
4565
+ public abstract completeAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<CompleteAuthResponse>;
4566
+ }
4567
+ ```
4568
+
4569
+ See also: [AuthPayload](./client.md#interface-authpayload), [CompleteAuthResponse](./client.md#interface-completeauthresponse), [StartAuthResponse](./client.md#interface-startauthresponse)
4570
+
4571
+ ###### Method completeAuth
4572
+
4573
+ Complete the flow (e.g. confirm OTP).
4574
+
4575
+ ```ts
4576
+ public abstract completeAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<CompleteAuthResponse>
4577
+ ```
4578
+ See also: [AuthPayload](./client.md#interface-authpayload), [CompleteAuthResponse](./client.md#interface-completeauthresponse)
4579
+
4580
+ ###### Method startAuth
4581
+
4582
+ Start the flow (e.g. request an OTP or create a session).
4583
+
4584
+ ```ts
4585
+ public abstract startAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<StartAuthResponse>
4586
+ ```
4587
+ See also: [AuthPayload](./client.md#interface-authpayload), [StartAuthResponse](./client.md#interface-startauthresponse)
4588
+
4589
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4590
+
4591
+ ---
4592
+ ##### Class: CWIStyleWalletManager
4593
+
4594
+ Manages a "CWI-style" wallet that uses a UMP token and a
4595
+ multi-key authentication scheme (password, presentation key, and recovery key).
4596
+
4597
+ ```ts
4598
+ export class CWIStyleWalletManager implements WalletInterface {
4599
+ authenticated: boolean;
4600
+ authenticationMode: "presentation-key-and-password" | "presentation-key-and-recovery-key" | "recovery-key-and-password" = "presentation-key-and-password";
4601
+ authenticationFlow: "new-user" | "existing-user" = "new-user";
4602
+ constructor(adminOriginator: OriginatorDomainNameStringUnder250Bytes, walletBuilder: (primaryKey: number[], privilegedKeyManager: PrivilegedKeyManager) => Promise<WalletInterface>, interactor: UMPTokenInteractor = new OverlayUMPTokenInteractor(), recoveryKeySaver: (key: number[]) => Promise<true>, passwordRetriever: (reason: string, test: (passwordCandidate: string) => boolean) => Promise<string>, newWalletFunder?: (presentationKey: number[], wallet: WalletInterface, adminOriginator: OriginatorDomainNameStringUnder250Bytes) => Promise<void>, stateSnapshot?: number[])
4603
+ async providePresentationKey(key: number[]): Promise<void>
4604
+ async providePassword(password: string): Promise<void>
4605
+ async provideRecoveryKey(recoveryKey: number[]): Promise<void>
4606
+ saveSnapshot(): number[]
4607
+ async loadSnapshot(snapshot: number[]): Promise<void>
4608
+ destroy(): void
4609
+ async changePassword(newPassword: string): Promise<void>
4610
+ async changeRecoveryKey(): Promise<void>
4611
+ async changePresentationKey(presentationKey: number[]): Promise<void>
4612
+ async getPublicKey(args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetPublicKeyResult>
4613
+ async revealCounterpartyKeyLinkage(args: RevealCounterpartyKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RevealCounterpartyKeyLinkageResult>
4614
+ async revealSpecificKeyLinkage(args: RevealSpecificKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RevealSpecificKeyLinkageResult>
4615
+ async encrypt(args: WalletEncryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletEncryptResult>
4616
+ async decrypt(args: WalletDecryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletDecryptResult>
4617
+ async createHmac(args: CreateHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateHmacResult>
4618
+ async verifyHmac(args: VerifyHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<VerifyHmacResult>
4619
+ async createSignature(args: CreateSignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateSignatureResult>
4620
+ async verifySignature(args: VerifySignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<VerifySignatureResult>
4621
+ async createAction(args: CreateActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateActionResult>
4622
+ async signAction(args: SignActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<SignActionResult>
4623
+ async abortAction(args: AbortActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AbortActionResult>
4624
+ async listActions(args: ListActionsArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListActionsResult>
4625
+ async internalizeAction(args: InternalizeActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<InternalizeActionResult>
4626
+ async listOutputs(args: ListOutputsArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListOutputsResult>
4627
+ async relinquishOutput(args: RelinquishOutputArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RelinquishOutputResult>
4628
+ async acquireCertificate(args: AcquireCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AcquireCertificateResult>
4629
+ async listCertificates(args: ListCertificatesArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListCertificatesResult>
4630
+ async proveCertificate(args: ProveCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ProveCertificateResult>
4631
+ async relinquishCertificate(args: RelinquishCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RelinquishCertificateResult>
4632
+ async discoverByIdentityKey(args: DiscoverByIdentityKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<DiscoverCertificatesResult>
4633
+ async discoverByAttributes(args: DiscoverByAttributesArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<DiscoverCertificatesResult>
4634
+ async isAuthenticated(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult>
4635
+ async waitForAuthentication(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult>
4636
+ async getHeight(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetHeightResult>
4637
+ async getHeaderForHeight(args: GetHeaderArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetHeaderResult>
4638
+ async getNetwork(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetNetworkResult>
4639
+ async getVersion(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetVersionResult>
4640
+ }
4641
+ ```
4642
+
4643
+ See also: [OverlayUMPTokenInteractor](./client.md#class-overlayumptokeninteractor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [UMPTokenInteractor](./client.md#interface-umptokeninteractor), [createAction](./storage.md#function-createaction), [internalizeAction](./storage.md#function-internalizeaction), [listActions](./storage.md#function-listactions), [listCertificates](./storage.md#function-listcertificates), [listOutputs](./storage.md#function-listoutputs), [proveCertificate](./client.md#function-provecertificate), [signAction](./client.md#function-signaction)
4644
+
4645
+ ###### Constructor
4646
+
4647
+ Constructs a new CWIStyleWalletManager.
4648
+
4649
+ ```ts
4650
+ constructor(adminOriginator: OriginatorDomainNameStringUnder250Bytes, walletBuilder: (primaryKey: number[], privilegedKeyManager: PrivilegedKeyManager) => Promise<WalletInterface>, interactor: UMPTokenInteractor = new OverlayUMPTokenInteractor(), recoveryKeySaver: (key: number[]) => Promise<true>, passwordRetriever: (reason: string, test: (passwordCandidate: string) => boolean) => Promise<string>, newWalletFunder?: (presentationKey: number[], wallet: WalletInterface, adminOriginator: OriginatorDomainNameStringUnder250Bytes) => Promise<void>, stateSnapshot?: number[])
4651
+ ```
4652
+ See also: [OverlayUMPTokenInteractor](./client.md#class-overlayumptokeninteractor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [UMPTokenInteractor](./client.md#interface-umptokeninteractor)
4653
+
4654
+ Argument Details
4655
+
4656
+ + **adminOriginator**
4657
+ + The domain name of the administrative originator.
4658
+ + **walletBuilder**
4659
+ + A function that can build an underlying wallet instance
4660
+ from a primary key and a privileged key manager
4661
+ + **interactor**
4662
+ + An instance of UMPTokenInteractor capable of managing UMP tokens.
4663
+ + **recoveryKeySaver**
4664
+ + A function that can persist or display a newly generated recovery key.
4665
+ + **passwordRetriever**
4666
+ + A function to request the user's password, given a reason and a test function.
4667
+ + **newWalletFunder**
4668
+ + An optional function called with the presentation key and a new Wallet post-construction to fund it before use.
4669
+ + **stateSnapshot**
4670
+ + If provided, a previously saved snapshot of the wallet's state.
4671
+
4672
+ ###### Property authenticated
4673
+
4674
+ Whether the user is currently authenticated.
4675
+
4676
+ ```ts
4677
+ authenticated: boolean
4678
+ ```
4679
+
4680
+ ###### Property authenticationFlow
4681
+
4682
+ Indicates whether this is a new user or an existing user flow:
4683
+ - 'new-user'
4684
+ - 'existing-user'
4685
+
4686
+ ```ts
4687
+ authenticationFlow: "new-user" | "existing-user" = "new-user"
4688
+ ```
4689
+
4690
+ ###### Property authenticationMode
4691
+
4692
+ The current mode of authentication:
4693
+ - 'presentation-key-and-password'
4694
+ - 'presentation-key-and-recovery-key'
4695
+ - 'recovery-key-and-password'
4696
+
4697
+ ```ts
4698
+ authenticationMode: "presentation-key-and-password" | "presentation-key-and-recovery-key" | "recovery-key-and-password" = "presentation-key-and-password"
4699
+ ```
4700
+
4701
+ ###### Method changePassword
4702
+
4703
+ Changes the user's password, re-wrapping the primary and privileged keys with the new password factor.
4704
+
4705
+ ```ts
4706
+ async changePassword(newPassword: string): Promise<void>
4707
+ ```
4708
+
4709
+ Argument Details
4710
+
4711
+ + **newPassword**
4712
+ + The user's new password as a string.
4713
+
4714
+ Throws
4715
+
4716
+ If the user is not authenticated, or if underlying token references are missing.
4717
+
4718
+ ###### Method changePresentationKey
4719
+
4720
+ Changes the user's presentation key.
4721
+
4722
+ ```ts
4723
+ async changePresentationKey(presentationKey: number[]): Promise<void>
4724
+ ```
4725
+
4726
+ Argument Details
4727
+
4728
+ + **presentationKey**
4729
+ + The new presentation key (32 bytes).
4730
+
4731
+ Throws
4732
+
4733
+ If the user is not authenticated, or if underlying token references are missing.
4734
+
4735
+ ###### Method changeRecoveryKey
4736
+
4737
+ Changes the user's recovery key, prompting the user to save the new key.
4738
+
4739
+ ```ts
4740
+ async changeRecoveryKey(): Promise<void>
4741
+ ```
4742
+
4743
+ Throws
4744
+
4745
+ If the user is not authenticated, or if underlying token references are missing.
4746
+
4747
+ ###### Method destroy
4748
+
4749
+ Destroys the underlying wallet, returning to a default state
4750
+
4751
+ ```ts
4752
+ destroy(): void
4753
+ ```
4754
+
4755
+ ###### Method loadSnapshot
4756
+
4757
+ Loads a previously saved state snapshot (e.g. from `saveSnapshot`).
4758
+ Upon success, the wallet becomes authenticated without needing to re-enter keys.
4759
+
4760
+ ```ts
4761
+ async loadSnapshot(snapshot: number[]): Promise<void>
4762
+ ```
4763
+
4764
+ Argument Details
4765
+
4766
+ + **snapshot**
4767
+ + An array of bytes that was previously produced by `saveSnapshot`.
4768
+
4769
+ Throws
4770
+
4771
+ If the snapshot format is invalid or decryption fails.
4772
+
4773
+ ###### Method providePassword
4774
+
4775
+ Provides the password in an authentication mode that requires it.
4776
+
4777
+ - **Existing user**:
4778
+ Decrypts the primary key using the provided password (and either the presentation key or recovery key, depending on the mode).
4779
+ Then builds the underlying wallet, marking the user as authenticated.
4780
+
4781
+ - **New user**:
4782
+ Generates a new UMP token with fresh keys (primary, privileged, recovery). Publishes it on-chain and builds the wallet.
4783
+
4784
+ ```ts
4785
+ async providePassword(password: string): Promise<void>
4786
+ ```
4787
+
4788
+ Argument Details
4789
+
4790
+ + **password**
4791
+ + The user's password as a string.
4792
+
4793
+ Throws
4794
+
4795
+ If the user is already authenticated, if the mode does not use a password, or if required keys are missing.
4796
+
4797
+ ###### Method providePresentationKey
4798
+
4799
+ Provides the presentation key in an authentication mode that requires it.
4800
+ If a UMP token is found based on the key's hash, this is an existing-user flow.
4801
+ Otherwise, it is treated as a new-user flow.
4802
+
4803
+ ```ts
4804
+ async providePresentationKey(key: number[]): Promise<void>
4805
+ ```
4806
+
4807
+ Argument Details
4808
+
4809
+ + **key**
4810
+ + The user's presentation key (32 bytes).
4811
+
4812
+ Throws
4813
+
4814
+ if user is already authenticated, or if the current mode does not require a presentation key.
4815
+
4816
+ ###### Method provideRecoveryKey
4817
+
4818
+ Provides the recovery key in an authentication flow that requires it.
4819
+
4820
+ ```ts
4821
+ async provideRecoveryKey(recoveryKey: number[]): Promise<void>
4822
+ ```
4823
+
4824
+ Argument Details
4825
+
4826
+ + **recoveryKey**
4827
+ + The user's recovery key (32 bytes).
4828
+
4829
+ Throws
4830
+
4831
+ if user is already authenticated, if the mode does not use a recovery key,
4832
+ or if a required presentation key is missing in "presentation-key-and-recovery-key" mode.
4833
+
4834
+ ###### Method saveSnapshot
4835
+
4836
+ Saves the current wallet state (including the current UMP token and primary key)
4837
+ into an encrypted snapshot. This snapshot can be stored locally and later passed
4838
+ to `loadSnapshot` to restore the wallet state without re-authenticating manually.
4839
+
4840
+ ```ts
4841
+ saveSnapshot(): number[]
4842
+ ```
4843
+
4844
+ Returns
4845
+
4846
+ An array of bytes representing the encrypted snapshot.
4847
+
4848
+ Throws
4849
+
4850
+ if no primary key or token is currently set.
4851
+
4852
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
4853
+
4160
4854
  ---
4161
4855
  ##### Class: CertOps
4162
4856
 
@@ -5285,48 +5979,159 @@ See also: [WalletMonitorTask](./monitor.md#class-walletmonitortask)
5285
5979
 
5286
5980
  ###### Method addDefaultTasks
5287
5981
 
5288
- Default tasks with settings appropriate for a single user storage
5289
- possibly with sync'ing enabled
5982
+ Default tasks with settings appropriate for a single user storage
5983
+ possibly with sync'ing enabled
5984
+
5985
+ ```ts
5986
+ addDefaultTasks(): void
5987
+ ```
5988
+
5989
+ ###### Method addMultiUserTasks
5990
+
5991
+ Tasks appropriate for multi-user storage
5992
+ without sync'ing enabled.
5993
+
5994
+ ```ts
5995
+ addMultiUserTasks(): void
5996
+ ```
5997
+
5998
+ ###### Method processNewBlockHeader
5999
+
6000
+ Process new chain header event received from Chaintracks
6001
+
6002
+ Kicks processing 'unconfirmed' and 'unmined' request processing.
6003
+
6004
+ ```ts
6005
+ processNewBlockHeader(header: BlockHeader): void
6006
+ ```
6007
+ See also: [BlockHeader](./client.md#interface-blockheader)
6008
+
6009
+ ###### Method processReorg
6010
+
6011
+ Process reorg event received from Chaintracks
6012
+
6013
+ Reorgs can move recent transactions to new blocks at new index positions.
6014
+ Affected transaction proofs become invalid and must be updated.
6015
+
6016
+ It is possible for a transaction to become invalid.
6017
+
6018
+ Coinbase transactions always become invalid.
6019
+
6020
+ ```ts
6021
+ processReorg(depth: number, oldTip: BlockHeader, newTip: BlockHeader): void
6022
+ ```
6023
+ See also: [BlockHeader](./client.md#interface-blockheader)
6024
+
6025
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6026
+
6027
+ ---
6028
+ ##### Class: OverlayUMPTokenInteractor
6029
+
6030
+ ```ts
6031
+ export class OverlayUMPTokenInteractor implements UMPTokenInteractor {
6032
+ constructor(resolver: LookupResolver = new LookupResolver(), broadcaster: SHIPBroadcaster = new SHIPBroadcaster(["tm_users"]))
6033
+ public async findByPresentationKeyHash(hash: number[]): Promise<UMPToken | undefined>
6034
+ public async findByRecoveryKeyHash(hash: number[]): Promise<UMPToken | undefined>
6035
+ public async buildAndSend(wallet: WalletInterface, adminOriginator: OriginatorDomainNameStringUnder250Bytes, token: UMPToken, oldTokenToConsume?: UMPToken): Promise<OutpointString>
6036
+ }
6037
+ ```
6038
+
6039
+ See also: [UMPToken](./client.md#interface-umptoken), [UMPTokenInteractor](./client.md#interface-umptokeninteractor)
6040
+
6041
+ ###### Constructor
6042
+
6043
+ Construct a new OverlayUMPTokenInteractor.
6044
+
6045
+ ```ts
6046
+ constructor(resolver: LookupResolver = new LookupResolver(), broadcaster: SHIPBroadcaster = new SHIPBroadcaster(["tm_users"]))
6047
+ ```
6048
+
6049
+ Argument Details
6050
+
6051
+ + **resolver**
6052
+ + A LookupResolver instance for performing overlay queries (ls_users).
6053
+ + **broadcaster**
6054
+ + A SHIPBroadcaster instance for sharing new or updated tokens across the `tm_users` overlay.
6055
+
6056
+ ###### Method buildAndSend
6057
+
6058
+ Creates or updates (replaces) a UMP token on-chain. If `oldTokenToConsume` is provided,
6059
+ it is spent in the same transaction that creates the new token output. The new token is
6060
+ then broadcast and published under the `tm_users` topic using a SHIP broadcast, ensuring
6061
+ overlay participants see the updated token.
6062
+
6063
+ ```ts
6064
+ public async buildAndSend(wallet: WalletInterface, adminOriginator: OriginatorDomainNameStringUnder250Bytes, token: UMPToken, oldTokenToConsume?: UMPToken): Promise<OutpointString>
6065
+ ```
6066
+ See also: [UMPToken](./client.md#interface-umptoken)
6067
+
6068
+ Returns
6069
+
6070
+ The outpoint of the newly created UMP token (e.g. "abcd1234...ef.0").
6071
+
6072
+ Argument Details
6073
+
6074
+ + **wallet**
6075
+ + The wallet used to build and sign the transaction.
6076
+ + **adminOriginator**
6077
+ + The domain/FQDN of the administrative originator (wallet operator).
6078
+ + **token**
6079
+ + The new UMPToken to create on-chain.
6080
+ + **oldTokenToConsume**
6081
+ + Optionally, an existing token to consume/spend in the same transaction.
6082
+
6083
+ ###### Method findByPresentationKeyHash
6084
+
6085
+ Finds a UMP token on-chain by the given presentation key hash, if it exists.
6086
+ Uses the ls_users overlay service to perform the lookup.
5290
6087
 
5291
6088
  ```ts
5292
- addDefaultTasks(): void
6089
+ public async findByPresentationKeyHash(hash: number[]): Promise<UMPToken | undefined>
5293
6090
  ```
6091
+ See also: [UMPToken](./client.md#interface-umptoken)
5294
6092
 
5295
- ###### Method addMultiUserTasks
6093
+ Returns
5296
6094
 
5297
- Tasks appropriate for multi-user storage
5298
- without sync'ing enabled.
6095
+ A UMPToken object (including currentOutpoint) if found, otherwise undefined.
5299
6096
 
5300
- ```ts
5301
- addMultiUserTasks(): void
5302
- ```
6097
+ Argument Details
5303
6098
 
5304
- ###### Method processNewBlockHeader
6099
+ + **hash**
6100
+ + The 32-byte SHA-256 hash of the presentation key.
5305
6101
 
5306
- Process new chain header event received from Chaintracks
6102
+ ###### Method findByRecoveryKeyHash
5307
6103
 
5308
- Kicks processing 'unconfirmed' and 'unmined' request processing.
6104
+ Finds a UMP token on-chain by the given recovery key hash, if it exists.
6105
+ Uses the ls_users overlay service to perform the lookup.
5309
6106
 
5310
6107
  ```ts
5311
- processNewBlockHeader(header: BlockHeader): void
6108
+ public async findByRecoveryKeyHash(hash: number[]): Promise<UMPToken | undefined>
5312
6109
  ```
5313
- See also: [BlockHeader](./client.md#interface-blockheader)
6110
+ See also: [UMPToken](./client.md#interface-umptoken)
5314
6111
 
5315
- ###### Method processReorg
6112
+ Returns
5316
6113
 
5317
- Process reorg event received from Chaintracks
6114
+ A UMPToken object (including currentOutpoint) if found, otherwise undefined.
5318
6115
 
5319
- Reorgs can move recent transactions to new blocks at new index positions.
5320
- Affected transaction proofs become invalid and must be updated.
6116
+ Argument Details
5321
6117
 
5322
- It is possible for a transaction to become invalid.
6118
+ + **hash**
6119
+ + The 32-byte SHA-256 hash of the recovery key.
5323
6120
 
5324
- Coinbase transactions always become invalid.
6121
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
6122
+
6123
+ ---
6124
+ ##### Class: PersonaIDInteractor
5325
6125
 
5326
6126
  ```ts
5327
- processReorg(depth: number, oldTip: BlockHeader, newTip: BlockHeader): void
6127
+ export class PersonaIDInteractor extends AuthMethodInteractor {
6128
+ public methodType = "PersonaID";
6129
+ public async startAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<StartAuthResponse>
6130
+ public async completeAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<CompleteAuthResponse>
6131
+ }
5328
6132
  ```
5329
- See also: [BlockHeader](./client.md#interface-blockheader)
6133
+
6134
+ See also: [AuthMethodInteractor](./client.md#class-authmethodinteractor), [AuthPayload](./client.md#interface-authpayload), [CompleteAuthResponse](./client.md#interface-completeauthresponse), [StartAuthResponse](./client.md#interface-startauthresponse)
5330
6135
 
5331
6136
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
5332
6137
 
@@ -5526,377 +6331,224 @@ See also: [ARC](./services.md#class-arc), [BlockHeader](./client.md#interface-bl
5526
6331
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
5527
6332
 
5528
6333
  ---
5529
- ##### Class: SetupClient
5530
-
5531
- The `SetupClient` class provides static setup functions to construct BRC-100 compatible
5532
- wallets in a variety of configurations.
5533
-
5534
- It serves as a starting point for experimentation and customization.
5535
-
5536
- `SetupClient` references only browser compatible code including storage via `StorageClient`.
5537
- `Setup` extends `SetupClient` adding database storage via `Knex` and `StorageKnex`.
5538
-
5539
- ```ts
5540
- export abstract class SetupClient {
5541
- static noEnv(chain: sdk.Chain): boolean
5542
- static makeEnv(): string {
5543
- const testPrivKey1 = PrivateKey.fromRandom();
5544
- const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
5545
- const testPrivKey2 = PrivateKey.fromRandom();
5546
- const testIdentityKey2 = testPrivKey2.toPublicKey().toString();
5547
- const mainPrivKey1 = PrivateKey.fromRandom();
5548
- const mainIdentityKey1 = mainPrivKey1.toPublicKey().toString();
5549
- const mainPrivKey2 = PrivateKey.fromRandom();
5550
- const mainIdentityKey2 = mainPrivKey2.toPublicKey().toString();
5551
- const log = `
5552
- # .env file template for working with wallet-toolbox Setup functions.
5553
- MY_TEST_IDENTITY = '${testIdentityKey1}'
5554
- MY_TEST_IDENTITY2 = '${testIdentityKey2}'
5555
- MY_MAIN_IDENTITY = '${mainIdentityKey1}'
5556
- MY_MAIN_IDENTITY2 = '${mainIdentityKey2}'
5557
- MAIN_TAAL_API_KEY='mainnet_9596de07e92300c6287e4393594ae39c'
5558
- TEST_TAAL_API_KEY='testnet_0e6cf72133b43ea2d7861da2a38684e3'
5559
- MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"your_password","database":"your_database", "timezone": "Z"}'
5560
- DEV_KEYS = '{
5561
- "${testIdentityKey1}": "${testPrivKey1.toString()}",
5562
- "${testIdentityKey2}": "${testPrivKey2.toString()}",
5563
- "${mainIdentityKey1}": "${mainPrivKey1.toString()}",
5564
- "${mainIdentityKey2}": "${mainPrivKey2.toString()}"
5565
- }'
5566
- `;
5567
- console.log(log);
5568
- return log;
5569
- }
5570
- static getEnv(chain: sdk.Chain): SetupEnv {
5571
- const identityKey = chain === "main"
5572
- ? process.env.MY_MAIN_IDENTITY
5573
- : process.env.MY_TEST_IDENTITY;
5574
- const identityKey2 = chain === "main"
5575
- ? process.env.MY_MAIN_IDENTITY2
5576
- : process.env.MY_TEST_IDENTITY2;
5577
- const filePath = chain === "main"
5578
- ? process.env.MY_MAIN_FILEPATH
5579
- : process.env.MY_TEST_FILEPATH;
5580
- const DEV_KEYS = process.env.DEV_KEYS || "{}";
5581
- const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
5582
- const taalApiKey = verifyTruthy(chain === "main"
5583
- ? process.env.MAIN_TAAL_API_KEY
5584
- : process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
5585
- if (!identityKey || !identityKey2)
5586
- throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
5587
- return {
5588
- chain,
5589
- identityKey,
5590
- identityKey2,
5591
- filePath,
5592
- taalApiKey,
5593
- devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
5594
- mySQLConnection
5595
- };
5596
- }
5597
- static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
5598
- const chain = args.env.chain;
5599
- args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
5600
- const rootKey = PrivateKey.fromHex(args.rootKeyHex);
5601
- const identityKey = rootKey.toPublicKey().toString();
5602
- const keyDeriver = new KeyDeriver(rootKey);
5603
- const storage = new WalletStorageManager(identityKey, args.active, args.backups);
5604
- if (storage.stores.length > 0)
5605
- await storage.makeAvailable();
5606
- const serviceOptions = Services.createDefaultOptions(chain);
5607
- serviceOptions.taalApiKey = args.env.taalApiKey;
5608
- const services = new Services(serviceOptions);
5609
- const monopts = Monitor.createDefaultWalletMonitorOptions(chain, storage, services);
5610
- const monitor = new Monitor(monopts);
5611
- monitor.addDefaultTasks();
5612
- const privilegedKeyManager = args.privilegedKeyGetter
5613
- ? new sdk.PrivilegedKeyManager(args.privilegedKeyGetter)
5614
- : undefined;
5615
- const wallet = new Wallet({
5616
- chain,
5617
- keyDeriver,
5618
- storage,
5619
- services,
5620
- monitor,
5621
- privilegedKeyManager
5622
- });
5623
- const r: SetupWallet = {
5624
- rootKey,
5625
- identityKey,
5626
- keyDeriver,
5627
- chain,
5628
- storage,
5629
- services,
5630
- monitor,
5631
- wallet
5632
- };
5633
- return r;
5634
- }
5635
- static async createWalletClientNoEnv(args: {
5636
- chain: sdk.Chain;
5637
- rootKeyHex: string;
5638
- storageUrl?: string;
5639
- privilegedKeyGetter?: () => Promise<PrivateKey>;
5640
- }): Promise<Wallet>
5641
- static async createWalletClient(args: SetupWalletClientArgs): Promise<SetupWalletClient> {
5642
- const wo = await SetupClient.createWallet(args);
5643
- const endpointUrl = args.endpointUrl ||
5644
- `https://${args.env.chain !== "main" ? "staging-" : ""}storage.babbage.systems`;
5645
- const client = new StorageClient(wo.wallet, endpointUrl);
5646
- await wo.storage.addWalletStorageProvider(client);
5647
- await wo.storage.makeAvailable();
5648
- return {
5649
- ...wo,
5650
- endpointUrl
5651
- };
5652
- }
5653
- static getKeyPair(priv?: string | PrivateKey): KeyPairAddress {
5654
- if (priv === undefined)
5655
- priv = PrivateKey.fromRandom();
5656
- else if (typeof priv === "string")
5657
- priv = new PrivateKey(priv, "hex");
5658
- const pub = PublicKey.fromPrivateKey(priv);
5659
- const address = pub.toAddress();
5660
- return { privateKey: priv, publicKey: pub, address };
5661
- }
5662
- static getLockP2PKH(address: string): LockingScript {
5663
- const p2pkh = new P2PKH();
5664
- const lock = p2pkh.lock(address);
5665
- return lock;
5666
- }
5667
- static getUnlockP2PKH(priv: PrivateKey, satoshis: number): sdk.ScriptTemplateUnlock {
5668
- const p2pkh = new P2PKH();
5669
- const lock = SetupClient.getLockP2PKH(SetupClient.getKeyPair(priv).address);
5670
- const unlock = p2pkh.unlock(priv, "all", false, satoshis, lock);
5671
- return unlock;
5672
- }
5673
- static createP2PKHOutputs(outputs: {
5674
- address: string;
5675
- satoshis: number;
5676
- outputDescription?: string;
5677
- basket?: string;
5678
- tags?: string[];
5679
- }[]): CreateActionOutput[] {
5680
- const os: CreateActionOutput[] = [];
5681
- const count = outputs.length;
5682
- for (let i = 0; i < count; i++) {
5683
- const o = outputs[i];
5684
- os.push({
5685
- basket: o.basket,
5686
- tags: o.tags,
5687
- satoshis: o.satoshis,
5688
- lockingScript: SetupClient.getLockP2PKH(o.address).toHex(),
5689
- outputDescription: o.outputDescription || `p2pkh ${i}`
5690
- });
5691
- }
5692
- return os;
5693
- }
5694
- static async createP2PKHOutputsAction(wallet: WalletInterface, outputs: {
5695
- address: string;
5696
- satoshis: number;
5697
- outputDescription?: string;
5698
- basket?: string;
5699
- tags?: string[];
5700
- }[], options?: CreateActionOptions): Promise<{
5701
- cr: CreateActionResult;
5702
- outpoints: string[] | undefined;
5703
- }> {
5704
- const os = SetupClient.createP2PKHOutputs(outputs);
5705
- const createArgs: CreateActionArgs = {
5706
- description: `createP2PKHOutputs`,
5707
- outputs: os,
5708
- options: {
5709
- ...options,
5710
- randomizeOutputs: false
5711
- }
5712
- };
5713
- const cr = await wallet.createAction(createArgs);
5714
- let outpoints: string[] | undefined;
5715
- if (cr.txid) {
5716
- outpoints = os.map((o, i) => `${cr.txid}.${i}`);
5717
- }
5718
- return { cr, outpoints };
5719
- }
5720
- static async fundWalletFromP2PKHOutpoints(wallet: WalletInterface, outpoints: string[], p2pkhKey: KeyPairAddress, inputBEEF?: BEEF) {
5721
- }
5722
- }
5723
- ```
6334
+ ##### Class: SimpleWalletManager
5724
6335
 
5725
- See also: [Chain](./client.md#type-chain), [KeyPairAddress](./setup.md#interface-keypairaddress), [Monitor](./monitor.md#class-monitor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [ScriptTemplateUnlock](./client.md#interface-scripttemplateunlock), [Services](./services.md#class-services), [Setup](./setup.md#class-setup), [SetupEnv](./setup.md#interface-setupenv), [SetupWallet](./setup.md#interface-setupwallet), [SetupWalletArgs](./setup.md#interface-setupwalletargs), [SetupWalletClient](./setup.md#interface-setupwalletclient), [SetupWalletClientArgs](./setup.md#interface-setupwalletclientargs), [StorageClient](./storage.md#class-storageclient), [WERR_INVALID_OPERATION](./client.md#class-werr_invalid_operation), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager), [createAction](./storage.md#function-createaction), [verifyTruthy](./client.md#function-verifytruthy)
5726
-
5727
- ###### Method createWallet
5728
-
5729
- Create a `Wallet`. Storage can optionally be provided or configured later.
5730
-
5731
- The following components are configured: KeyDeriver, WalletStorageManager, WalletService, WalletStorage.
5732
- Optionally, PrivilegedKeyManager is also configured.
5733
-
5734
- ```ts
5735
- static async createWallet(args: SetupWalletArgs): Promise<SetupWallet> {
5736
- const chain = args.env.chain;
5737
- args.rootKeyHex ||= args.env.devKeys[args.env.identityKey];
5738
- const rootKey = PrivateKey.fromHex(args.rootKeyHex);
5739
- const identityKey = rootKey.toPublicKey().toString();
5740
- const keyDeriver = new KeyDeriver(rootKey);
5741
- const storage = new WalletStorageManager(identityKey, args.active, args.backups);
5742
- if (storage.stores.length > 0)
5743
- await storage.makeAvailable();
5744
- const serviceOptions = Services.createDefaultOptions(chain);
5745
- serviceOptions.taalApiKey = args.env.taalApiKey;
5746
- const services = new Services(serviceOptions);
5747
- const monopts = Monitor.createDefaultWalletMonitorOptions(chain, storage, services);
5748
- const monitor = new Monitor(monopts);
5749
- monitor.addDefaultTasks();
5750
- const privilegedKeyManager = args.privilegedKeyGetter
5751
- ? new sdk.PrivilegedKeyManager(args.privilegedKeyGetter)
5752
- : undefined;
5753
- const wallet = new Wallet({
5754
- chain,
5755
- keyDeriver,
5756
- storage,
5757
- services,
5758
- monitor,
5759
- privilegedKeyManager
5760
- });
5761
- const r: SetupWallet = {
5762
- rootKey,
5763
- identityKey,
5764
- keyDeriver,
5765
- chain,
5766
- storage,
5767
- services,
5768
- monitor,
5769
- wallet
5770
- };
5771
- return r;
6336
+ SimpleWalletManager is a slimmed-down wallet manager that only requires two things to authenticate:
6337
+ 1. A primary key (32 bytes), which represents the core secret for the wallet.
6338
+ 2. A privileged key manager (an instance of `PrivilegedKeyManager`), responsible for
6339
+ more sensitive operations.
6340
+
6341
+ Once both pieces are provided (or if a snapshot containing the primary key is loaded,
6342
+ and the privileged key manager is provided separately), the wallet becomes authenticated.
6343
+
6344
+ After authentication, calls to the standard wallet methods (`createAction`, `signAction`, etc.)
6345
+ are proxied to an underlying `WalletInterface` instance returned by a user-supplied `walletBuilder`.
6346
+
6347
+ **Important**: This manager does not handle user password flows, recovery, or on-chain
6348
+ token management. It is a straightforward wrapper that ensures the user has provided
6349
+ both their main secret (primary key) and a privileged key manager before allowing usage.
6350
+
6351
+ It also prevents calls from the special "admin originator" from being used externally.
6352
+ (Any call that tries to use the admin originator as its originator, other than the manager itself,
6353
+ will result in an error, ensuring that only internal operations can use that originator.)
6354
+
6355
+ The manager can also save and load snapshots of its state. In this simplified version,
6356
+ the snapshot only contains the primary key. If you load a snapshot, you still need to
6357
+ re-provide the privileged key manager to complete authentication.
6358
+
6359
+ ```ts
6360
+ export class SimpleWalletManager implements WalletInterface {
6361
+ authenticated: boolean;
6362
+ constructor(adminOriginator: OriginatorDomainNameStringUnder250Bytes, walletBuilder: (primaryKey: number[], privilegedKeyManager: PrivilegedKeyManager) => Promise<WalletInterface>, stateSnapshot?: number[])
6363
+ async providePrimaryKey(key: number[]): Promise<void>
6364
+ async providePrivilegedKeyManager(manager: PrivilegedKeyManager): Promise<void>
6365
+ destroy(): void
6366
+ saveSnapshot(): number[]
6367
+ async loadSnapshot(snapshot: number[]): Promise<void>
6368
+ async isAuthenticated(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult>
6369
+ async waitForAuthentication(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult>
6370
+ async getPublicKey(args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetPublicKeyResult>
6371
+ async revealCounterpartyKeyLinkage(args: RevealCounterpartyKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RevealCounterpartyKeyLinkageResult>
6372
+ async revealSpecificKeyLinkage(args: RevealSpecificKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RevealSpecificKeyLinkageResult>
6373
+ async encrypt(args: WalletEncryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletEncryptResult>
6374
+ async decrypt(args: WalletDecryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletDecryptResult>
6375
+ async createHmac(args: CreateHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateHmacResult>
6376
+ async verifyHmac(args: VerifyHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<VerifyHmacResult>
6377
+ async createSignature(args: CreateSignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateSignatureResult>
6378
+ async verifySignature(args: VerifySignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<VerifySignatureResult>
6379
+ async createAction(args: CreateActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateActionResult>
6380
+ async signAction(args: SignActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<SignActionResult>
6381
+ async abortAction(args: AbortActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AbortActionResult>
6382
+ async listActions(args: ListActionsArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListActionsResult>
6383
+ async internalizeAction(args: InternalizeActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<InternalizeActionResult>
6384
+ async listOutputs(args: ListOutputsArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListOutputsResult>
6385
+ async relinquishOutput(args: RelinquishOutputArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RelinquishOutputResult>
6386
+ async acquireCertificate(args: AcquireCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AcquireCertificateResult>
6387
+ async listCertificates(args: ListCertificatesArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ListCertificatesResult>
6388
+ async proveCertificate(args: ProveCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<ProveCertificateResult>
6389
+ async relinquishCertificate(args: RelinquishCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RelinquishCertificateResult>
6390
+ async discoverByIdentityKey(args: DiscoverByIdentityKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<DiscoverCertificatesResult>
6391
+ async discoverByAttributes(args: DiscoverByAttributesArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<DiscoverCertificatesResult>
6392
+ async getHeight(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetHeightResult>
6393
+ async getHeaderForHeight(args: GetHeaderArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetHeaderResult>
6394
+ async getNetwork(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetNetworkResult>
6395
+ async getVersion(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetVersionResult>
5772
6396
  }
5773
6397
  ```
5774
- See also: [Monitor](./monitor.md#class-monitor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [Services](./services.md#class-services), [SetupWallet](./setup.md#interface-setupwallet), [SetupWalletArgs](./setup.md#interface-setupwalletargs), [Wallet](./client.md#class-wallet), [WalletStorageManager](./storage.md#class-walletstoragemanager)
5775
6398
 
5776
- ###### Method createWalletClientNoEnv
6399
+ See also: [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [createAction](./storage.md#function-createaction), [internalizeAction](./storage.md#function-internalizeaction), [listActions](./storage.md#function-listactions), [listCertificates](./storage.md#function-listcertificates), [listOutputs](./storage.md#function-listoutputs), [proveCertificate](./client.md#function-provecertificate), [signAction](./client.md#function-signaction)
6400
+
6401
+ ###### Constructor
5777
6402
 
5778
- Setup a new `Wallet` without requiring a .env file.
6403
+ Constructs a new `SimpleWalletManager`.
5779
6404
 
5780
6405
  ```ts
5781
- static async createWalletClientNoEnv(args: {
5782
- chain: sdk.Chain;
5783
- rootKeyHex: string;
5784
- storageUrl?: string;
5785
- privilegedKeyGetter?: () => Promise<PrivateKey>;
5786
- }): Promise<Wallet>
6406
+ constructor(adminOriginator: OriginatorDomainNameStringUnder250Bytes, walletBuilder: (primaryKey: number[], privilegedKeyManager: PrivilegedKeyManager) => Promise<WalletInterface>, stateSnapshot?: number[])
5787
6407
  ```
5788
- See also: [Chain](./client.md#type-chain), [Wallet](./client.md#class-wallet)
6408
+ See also: [PrivilegedKeyManager](./client.md#class-privilegedkeymanager)
5789
6409
 
5790
6410
  Argument Details
5791
6411
 
5792
- + **args.chain**
5793
- + 'main' or 'test'
5794
- + **args.rootKeyHex**
5795
- + Root private key for wallet's key deriver.
5796
- + **args.storageUrl**
5797
- + Optional. `StorageClient` and `chain` compatible endpoint URL.
5798
- + **args.privilegedKeyGetter**
5799
- + Optional. Method that will return the privileged `PrivateKey`, on demand.
5800
-
5801
- ###### Method getEnv
5802
-
5803
- Reads a .env file of the format created by `makeEnv`.
5804
-
5805
- Returns values for designated `chain`.
5806
-
5807
- Access private keys through the `devKeys` object: `devKeys[identityKey]`
5808
-
5809
- ```ts
5810
- static getEnv(chain: sdk.Chain): SetupEnv {
5811
- const identityKey = chain === "main"
5812
- ? process.env.MY_MAIN_IDENTITY
5813
- : process.env.MY_TEST_IDENTITY;
5814
- const identityKey2 = chain === "main"
5815
- ? process.env.MY_MAIN_IDENTITY2
5816
- : process.env.MY_TEST_IDENTITY2;
5817
- const filePath = chain === "main"
5818
- ? process.env.MY_MAIN_FILEPATH
5819
- : process.env.MY_TEST_FILEPATH;
5820
- const DEV_KEYS = process.env.DEV_KEYS || "{}";
5821
- const mySQLConnection = process.env.MYSQL_CONNECTION || "{}";
5822
- const taalApiKey = verifyTruthy(chain === "main"
5823
- ? process.env.MAIN_TAAL_API_KEY
5824
- : process.env.TEST_TAAL_API_KEY, `.env value for '${chain.toUpperCase()}_TAAL_API_KEY' is required.`);
5825
- if (!identityKey || !identityKey2)
5826
- throw new sdk.WERR_INVALID_OPERATION(".env is not a valid SetupEnv configuration.");
5827
- return {
5828
- chain,
5829
- identityKey,
5830
- identityKey2,
5831
- filePath,
5832
- taalApiKey,
5833
- devKeys: JSON.parse(DEV_KEYS) as Record<string, string>,
5834
- mySQLConnection
5835
- };
5836
- }
6412
+ + **adminOriginator**
6413
+ + The domain name of the administrative originator.
6414
+ + **walletBuilder**
6415
+ + A function that, given a primary key and privileged key manager,
6416
+ returns a fully functional `WalletInterface`.
6417
+ + **stateSnapshot**
6418
+ + If provided, a previously saved snapshot of the wallet's state.
6419
+ If the snapshot contains a primary key, it will be loaded immediately
6420
+ (though you will still need to provide a privileged key manager to authenticate).
6421
+
6422
+ ###### Property authenticated
6423
+
6424
+ Whether the user is currently authenticated (meaning both the primary key
6425
+ and privileged key manager have been provided).
6426
+
6427
+ ```ts
6428
+ authenticated: boolean
5837
6429
  ```
5838
- See also: [Chain](./client.md#type-chain), [SetupEnv](./setup.md#interface-setupenv), [WERR_INVALID_OPERATION](./client.md#class-werr_invalid_operation), [verifyTruthy](./client.md#function-verifytruthy)
5839
6430
 
5840
- Returns
6431
+ ###### Method destroy
6432
+
6433
+ Destroys the underlying wallet, returning to a default (unauthenticated) state.
6434
+
6435
+ This clears the primary key, the privileged key manager, and the `authenticated` flag.
6436
+
6437
+ ```ts
6438
+ destroy(): void
6439
+ ```
6440
+
6441
+ ###### Method isAuthenticated
5841
6442
 
5842
- with configuration environment secrets used by `Setup` functions.
6443
+ Returns whether the user is currently authenticated (the wallet has a primary key
6444
+ and a privileged key manager). If not authenticated, an error is thrown.
6445
+
6446
+ ```ts
6447
+ async isAuthenticated(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult>
6448
+ ```
5843
6449
 
5844
6450
  Argument Details
5845
6451
 
5846
- + **chain**
5847
- + Which chain to use: 'test' or 'main'
6452
+ + **_**
6453
+ + Not used in this manager.
6454
+ + **originator**
6455
+ + The originator domain, which must not be the admin originator.
5848
6456
 
5849
- ###### Method makeEnv
6457
+ Throws
5850
6458
 
5851
- Creates content for .env file with some private keys, identity keys, sample API keys, and sample MySQL connection string.
6459
+ If not authenticated, or if the originator is the admin.
5852
6460
 
5853
- Two new, random private keys are generated each time, with their associated public identity keys.
6461
+ ###### Method loadSnapshot
5854
6462
 
5855
- Loading secrets from a .env file is intended only for experimentation and getting started.
5856
- Private keys should never be included directly in your source code.
6463
+ Loads a previously saved state snapshot (produced by `saveSnapshot`).
6464
+ This will restore the primary key but will **not** restore the privileged key manager
6465
+ (that must be provided separately to complete authentication).
5857
6466
 
5858
6467
  ```ts
5859
- static makeEnv(): string {
5860
- const testPrivKey1 = PrivateKey.fromRandom();
5861
- const testIdentityKey1 = testPrivKey1.toPublicKey().toString();
5862
- const testPrivKey2 = PrivateKey.fromRandom();
5863
- const testIdentityKey2 = testPrivKey2.toPublicKey().toString();
5864
- const mainPrivKey1 = PrivateKey.fromRandom();
5865
- const mainIdentityKey1 = mainPrivKey1.toPublicKey().toString();
5866
- const mainPrivKey2 = PrivateKey.fromRandom();
5867
- const mainIdentityKey2 = mainPrivKey2.toPublicKey().toString();
5868
- const log = `
5869
- # .env file template for working with wallet-toolbox Setup functions.
5870
- MY_TEST_IDENTITY = '${testIdentityKey1}'
5871
- MY_TEST_IDENTITY2 = '${testIdentityKey2}'
5872
- MY_MAIN_IDENTITY = '${mainIdentityKey1}'
5873
- MY_MAIN_IDENTITY2 = '${mainIdentityKey2}'
5874
- MAIN_TAAL_API_KEY='mainnet_9596de07e92300c6287e4393594ae39c'
5875
- TEST_TAAL_API_KEY='testnet_0e6cf72133b43ea2d7861da2a38684e3'
5876
- MYSQL_CONNECTION='{"port":3306,"host":"127.0.0.1","user":"root","password":"your_password","database":"your_database", "timezone": "Z"}'
5877
- DEV_KEYS = '{
5878
- "${testIdentityKey1}": "${testPrivKey1.toString()}",
5879
- "${testIdentityKey2}": "${testPrivKey2.toString()}",
5880
- "${mainIdentityKey1}": "${mainPrivKey1.toString()}",
5881
- "${mainIdentityKey2}": "${mainPrivKey2.toString()}"
5882
- }'
5883
- `;
5884
- console.log(log);
5885
- return log;
5886
- }
6468
+ async loadSnapshot(snapshot: number[]): Promise<void>
5887
6469
  ```
5888
- See also: [Setup](./setup.md#class-setup)
5889
6470
 
5890
- ###### Method noEnv
6471
+ Argument Details
6472
+
6473
+ + **snapshot**
6474
+ + A byte array that was previously returned by `saveSnapshot`.
6475
+
6476
+ Throws
6477
+
6478
+ If the snapshot format is invalid or decryption fails.
6479
+
6480
+ ###### Method providePrimaryKey
6481
+
6482
+ Provides the primary key (32 bytes) needed for authentication.
6483
+ If a privileged key manager has already been provided, we attempt to build
6484
+ the underlying wallet. Otherwise, we wait until the manager is also provided.
5891
6485
 
5892
6486
  ```ts
5893
- static noEnv(chain: sdk.Chain): boolean
6487
+ async providePrimaryKey(key: number[]): Promise<void>
6488
+ ```
6489
+
6490
+ Argument Details
6491
+
6492
+ + **key**
6493
+ + A 32-byte primary key.
6494
+
6495
+ ###### Method providePrivilegedKeyManager
6496
+
6497
+ Provides the privileged key manager needed for sensitive tasks.
6498
+ If a primary key has already been provided (or loaded from a snapshot),
6499
+ we attempt to build the underlying wallet. Otherwise, we wait until the key is provided.
6500
+
6501
+ ```ts
6502
+ async providePrivilegedKeyManager(manager: PrivilegedKeyManager): Promise<void>
6503
+ ```
6504
+ See also: [PrivilegedKeyManager](./client.md#class-privilegedkeymanager)
6505
+
6506
+ Argument Details
6507
+
6508
+ + **manager**
6509
+ + An instance of `PrivilegedKeyManager`.
6510
+
6511
+ ###### Method saveSnapshot
6512
+
6513
+ Saves the current wallet state (including just the primary key)
6514
+ into an encrypted snapshot. This snapshot can be stored and later
6515
+ passed to `loadSnapshot` to restore the primary key (and partially authenticate).
6516
+
6517
+ **Note**: The snapshot does NOT include the privileged key manager.
6518
+ You must still provide that separately after loading the snapshot
6519
+ in order to complete authentication.
6520
+
6521
+ ```ts
6522
+ saveSnapshot(): number[]
5894
6523
  ```
5895
- See also: [Chain](./client.md#type-chain)
5896
6524
 
5897
6525
  Returns
5898
6526
 
5899
- true if .env is not valid for chain
6527
+ A byte array representing the encrypted snapshot.
6528
+
6529
+ Throws
6530
+
6531
+ if no primary key is currently set.
6532
+
6533
+ ###### Method waitForAuthentication
6534
+
6535
+ Blocks until the user is authenticated (by providing primaryKey and privileged manager).
6536
+ If not authenticated yet, it waits until that occurs.
6537
+
6538
+ ```ts
6539
+ async waitForAuthentication(_: {}, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult>
6540
+ ```
6541
+
6542
+ Argument Details
6543
+
6544
+ + **_**
6545
+ + Not used in this manager.
6546
+ + **originator**
6547
+ + The originator domain, which must not be the admin originator.
6548
+
6549
+ Throws
6550
+
6551
+ If the originator is the admin.
5900
6552
 
5901
6553
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
5902
6554
 
@@ -7120,6 +7772,158 @@ See also: [Monitor](./monitor.md#class-monitor), [WalletMonitorTask](./monitor.m
7120
7772
 
7121
7773
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7122
7774
 
7775
+ ---
7776
+ ##### Class: TwilioPhoneInteractor
7777
+
7778
+ TwilioPhoneInteractor
7779
+
7780
+ A client-side class that knows how to call the WAB server for Twilio-based phone verification.
7781
+
7782
+ ```ts
7783
+ export class TwilioPhoneInteractor extends AuthMethodInteractor {
7784
+ public methodType = "TwilioPhone";
7785
+ public async startAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<StartAuthResponse>
7786
+ public async completeAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<CompleteAuthResponse>
7787
+ }
7788
+ ```
7789
+
7790
+ See also: [AuthMethodInteractor](./client.md#class-authmethodinteractor), [AuthPayload](./client.md#interface-authpayload), [CompleteAuthResponse](./client.md#interface-completeauthresponse), [StartAuthResponse](./client.md#interface-startauthresponse)
7791
+
7792
+ ###### Method completeAuth
7793
+
7794
+ Complete the Twilio phone verification on the server.
7795
+ - The server will verify the code with Twilio Verify’s verificationChecks endpoint.
7796
+
7797
+ ```ts
7798
+ public async completeAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<CompleteAuthResponse>
7799
+ ```
7800
+ See also: [AuthPayload](./client.md#interface-authpayload), [CompleteAuthResponse](./client.md#interface-completeauthresponse)
7801
+
7802
+ Returns
7803
+
7804
+ - { success, message, presentationKey }
7805
+
7806
+ Argument Details
7807
+
7808
+ + **serverUrl**
7809
+ + The base URL of the WAB server
7810
+ + **presentationKey**
7811
+ + The 256-bit key
7812
+ + **payload**
7813
+ + { phoneNumber: string, otp: string } (the code that was received via SMS)
7814
+
7815
+ ###### Method startAuth
7816
+
7817
+ Start the Twilio phone verification on the server.
7818
+ - The server will send an SMS code to the user’s phone, using Twilio Verify.
7819
+
7820
+ ```ts
7821
+ public async startAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<StartAuthResponse>
7822
+ ```
7823
+ See also: [AuthPayload](./client.md#interface-authpayload), [StartAuthResponse](./client.md#interface-startauthresponse)
7824
+
7825
+ Returns
7826
+
7827
+ - { success, message, data }
7828
+
7829
+ Argument Details
7830
+
7831
+ + **serverUrl**
7832
+ + The base URL of the WAB server (e.g. http://localhost:3000)
7833
+ + **presentationKey**
7834
+ + The 256-bit key the client is attempting to authenticate with
7835
+ + **payload**
7836
+ + { phoneNumber: string } (the phone number to verify)
7837
+
7838
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7839
+
7840
+ ---
7841
+ ##### Class: WABClient
7842
+
7843
+ ```ts
7844
+ export class WABClient {
7845
+ constructor(private serverUrl: string)
7846
+ public async getInfo()
7847
+ public generateRandomPresentationKey(): string
7848
+ public async startAuthMethod(authMethod: AuthMethodInteractor, presentationKey: string, payload: any)
7849
+ public async completeAuthMethod(authMethod: AuthMethodInteractor, presentationKey: string, payload: any)
7850
+ public async listLinkedMethods(presentationKey: string)
7851
+ public async unlinkMethod(presentationKey: string, authMethodId: number)
7852
+ public async requestFaucet(presentationKey: string)
7853
+ public async deleteUser(presentationKey: string)
7854
+ }
7855
+ ```
7856
+
7857
+ See also: [AuthMethodInteractor](./client.md#class-authmethodinteractor)
7858
+
7859
+ ###### Method completeAuthMethod
7860
+
7861
+ Complete an Auth Method flow
7862
+
7863
+ ```ts
7864
+ public async completeAuthMethod(authMethod: AuthMethodInteractor, presentationKey: string, payload: any)
7865
+ ```
7866
+ See also: [AuthMethodInteractor](./client.md#class-authmethodinteractor)
7867
+
7868
+ ###### Method deleteUser
7869
+
7870
+ Delete user
7871
+
7872
+ ```ts
7873
+ public async deleteUser(presentationKey: string)
7874
+ ```
7875
+
7876
+ ###### Method generateRandomPresentationKey
7877
+
7878
+ Generate a random 256-bit presentation key as a hex string (client side).
7879
+
7880
+ ```ts
7881
+ public generateRandomPresentationKey(): string
7882
+ ```
7883
+
7884
+ ###### Method getInfo
7885
+
7886
+ Return the WAB server info
7887
+
7888
+ ```ts
7889
+ public async getInfo()
7890
+ ```
7891
+
7892
+ ###### Method listLinkedMethods
7893
+
7894
+ List user-linked methods
7895
+
7896
+ ```ts
7897
+ public async listLinkedMethods(presentationKey: string)
7898
+ ```
7899
+
7900
+ ###### Method requestFaucet
7901
+
7902
+ Request faucet
7903
+
7904
+ ```ts
7905
+ public async requestFaucet(presentationKey: string)
7906
+ ```
7907
+
7908
+ ###### Method startAuthMethod
7909
+
7910
+ Start an Auth Method flow
7911
+
7912
+ ```ts
7913
+ public async startAuthMethod(authMethod: AuthMethodInteractor, presentationKey: string, payload: any)
7914
+ ```
7915
+ See also: [AuthMethodInteractor](./client.md#class-authmethodinteractor)
7916
+
7917
+ ###### Method unlinkMethod
7918
+
7919
+ Unlink a given Auth Method by ID
7920
+
7921
+ ```ts
7922
+ public async unlinkMethod(presentationKey: string, authMethodId: number)
7923
+ ```
7924
+
7925
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7926
+
7123
7927
  ---
7124
7928
  ##### Class: WERR_BAD_REQUEST
7125
7929
 
@@ -7343,6 +8147,8 @@ export class Wallet implements WalletInterface, ProtoWallet {
7343
8147
  chain: sdk.Chain;
7344
8148
  keyDeriver: KeyDeriver;
7345
8149
  storage: WalletStorageManager;
8150
+ settingsManager: WalletSettingsManager;
8151
+ lookupResolver: LookupResolver;
7346
8152
  services?: sdk.WalletServices;
7347
8153
  monitor?: Monitor;
7348
8154
  identityKey: string;
@@ -7393,7 +8199,7 @@ export class Wallet implements WalletInterface, ProtoWallet {
7393
8199
  }
7394
8200
  ```
7395
8201
 
7396
- See also: [Chain](./client.md#type-chain), [KeyPair](./client.md#interface-keypair), [Monitor](./monitor.md#class-monitor), [PendingSignAction](./client.md#interface-pendingsignaction), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [StorageIdentity](./client.md#interface-storageidentity), [WalletArgs](./client.md#interface-walletargs), [WalletServices](./client.md#interface-walletservices), [WalletSigner](./client.md#class-walletsigner), [WalletStorageManager](./storage.md#class-walletstoragemanager), [createAction](./storage.md#function-createaction), [getIdentityKey](./client.md#function-getidentitykey), [internalizeAction](./storage.md#function-internalizeaction), [listActions](./storage.md#function-listactions), [listCertificates](./storage.md#function-listcertificates), [listOutputs](./storage.md#function-listoutputs), [proveCertificate](./client.md#function-provecertificate), [signAction](./client.md#function-signaction)
8202
+ See also: [Chain](./client.md#type-chain), [KeyPair](./client.md#interface-keypair), [Monitor](./monitor.md#class-monitor), [PendingSignAction](./client.md#interface-pendingsignaction), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [StorageIdentity](./client.md#interface-storageidentity), [WalletArgs](./client.md#interface-walletargs), [WalletServices](./client.md#interface-walletservices), [WalletSettingsManager](./client.md#class-walletsettingsmanager), [WalletSigner](./client.md#class-walletsigner), [WalletStorageManager](./storage.md#class-walletstoragemanager), [createAction](./storage.md#function-createaction), [getIdentityKey](./client.md#function-getidentitykey), [internalizeAction](./storage.md#function-internalizeaction), [listActions](./storage.md#function-listactions), [listCertificates](./storage.md#function-listcertificates), [listOutputs](./storage.md#function-listoutputs), [proveCertificate](./client.md#function-provecertificate), [signAction](./client.md#function-signaction)
7397
8203
 
7398
8204
  ###### Property beef
7399
8205
 
@@ -7424,28 +8230,76 @@ randomVals?: number[] = undefined
7424
8230
  getKnownTxids(newKnownTxids?: string[]): string[]
7425
8231
  ```
7426
8232
 
7427
- Returns
8233
+ Returns
8234
+
8235
+ the full list of txids whose validity this wallet claims to know.
8236
+
8237
+ Argument Details
8238
+
8239
+ + **newKnownTxids**
8240
+ + Optional. Additional new txids known to be valid by the caller to be merged.
8241
+
8242
+ ###### Method sweepTo
8243
+
8244
+ Transfer all possible satoshis held by this wallet to `toWallet`.
8245
+
8246
+ ```ts
8247
+ async sweepTo(toWallet: Wallet): Promise<void>
8248
+ ```
8249
+ See also: [Wallet](./client.md#class-wallet)
8250
+
8251
+ Argument Details
8252
+
8253
+ + **toWallet**
8254
+ + wallet which will receive this wallet's satoshis.
8255
+
8256
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8257
+
8258
+ ---
8259
+ ##### Class: WalletAuthenticationManager
8260
+
8261
+ WalletAuthenticationManager
8262
+
8263
+ A wallet manager that integrates
8264
+ with a WABClient for user authentication flows (e.g. Twilio phone).
8265
+
8266
+ ```ts
8267
+ export class WalletAuthenticationManager extends CWIStyleWalletManager {
8268
+ constructor(adminOriginator: string, walletBuilder: (primaryKey: number[], privilegedKeyManager: PrivilegedKeyManager) => Promise<WalletInterface>, interactor: UMPTokenInteractor = new OverlayUMPTokenInteractor(), recoveryKeySaver: (key: number[]) => Promise<true>, passwordRetriever: (reason: string, test: (passwordCandidate: string) => boolean) => Promise<string>, wabClient: WABClient, authMethod?: AuthMethodInteractor, stateSnapshot?: number[])
8269
+ public setAuthMethod(method: AuthMethodInteractor)
8270
+ public async startAuth(payload: any): Promise<void>
8271
+ public async completeAuth(payload: any): Promise<void>
8272
+ }
8273
+ ```
8274
+
8275
+ See also: [AuthMethodInteractor](./client.md#class-authmethodinteractor), [CWIStyleWalletManager](./client.md#class-cwistylewalletmanager), [OverlayUMPTokenInteractor](./client.md#class-overlayumptokeninteractor), [PrivilegedKeyManager](./client.md#class-privilegedkeymanager), [UMPTokenInteractor](./client.md#interface-umptokeninteractor), [WABClient](./client.md#class-wabclient)
7428
8276
 
7429
- the full list of txids whose validity this wallet claims to know.
8277
+ ###### Method completeAuth
7430
8278
 
7431
- Argument Details
8279
+ Completes the WAB-based flow, retrieving the final presentationKey from WAB if successful.
7432
8280
 
7433
- + **newKnownTxids**
7434
- + Optional. Additional new txids known to be valid by the caller to be merged.
8281
+ ```ts
8282
+ public async completeAuth(payload: any): Promise<void>
8283
+ ```
7435
8284
 
7436
- ###### Method sweepTo
8285
+ ###### Method setAuthMethod
7437
8286
 
7438
- Transfer all possible satoshis held by this wallet to `toWallet`.
8287
+ Sets (or switches) the chosen AuthMethodInteractor at runtime,
8288
+ in case the user changes their mind or picks a new method in the UI.
7439
8289
 
7440
8290
  ```ts
7441
- async sweepTo(toWallet: Wallet): Promise<void>
8291
+ public setAuthMethod(method: AuthMethodInteractor)
7442
8292
  ```
7443
- See also: [Wallet](./client.md#class-wallet)
8293
+ See also: [AuthMethodInteractor](./client.md#class-authmethodinteractor)
7444
8294
 
7445
- Argument Details
8295
+ ###### Method startAuth
7446
8296
 
7447
- + **toWallet**
7448
- + wallet which will receive this wallet's satoshis.
8297
+ Initiate the WAB-based flow, e.g. sending an SMS code or starting an ID check,
8298
+ using the chosen AuthMethodInteractor.
8299
+
8300
+ ```ts
8301
+ public async startAuth(payload: any): Promise<void>
8302
+ ```
7449
8303
 
7450
8304
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7451
8305
 
@@ -7569,6 +8423,497 @@ abstract trigger(nowMsecsSinceEpoch: number): {
7569
8423
 
7570
8424
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
7571
8425
 
8426
+ ---
8427
+ ##### Class: WalletPermissionsManager
8428
+
8429
+ ```ts
8430
+ export class WalletPermissionsManager implements WalletInterface {
8431
+ constructor(underlyingWallet: WalletInterface, adminOriginator: string, config: PermissionsManagerConfig = {})
8432
+ public bindCallback(eventName: keyof WalletPermissionsManagerCallbacks, handler: PermissionEventHandler): number
8433
+ public unbindCallback(eventName: keyof WalletPermissionsManagerCallbacks, reference: number | Function): boolean
8434
+ public async grantPermission(params: {
8435
+ requestID: string;
8436
+ expiry?: number;
8437
+ ephemeral?: boolean;
8438
+ amount?: number;
8439
+ }): Promise<void>
8440
+ public async denyPermission(requestID: string): Promise<void>
8441
+ public async ensureProtocolPermission({ originator, privileged, protocolID, counterparty, reason, seekPermission = true, usageType }: {
8442
+ originator: string;
8443
+ privileged: boolean;
8444
+ protocolID: [
8445
+ 0 | 1 | 2,
8446
+ string
8447
+ ];
8448
+ counterparty: string;
8449
+ reason?: string;
8450
+ seekPermission?: boolean;
8451
+ usageType: "signing" | "encrypting" | "hmac" | "publicKey" | "identityKey" | "linkageRevelation" | "generic";
8452
+ }): Promise<boolean>
8453
+ public async ensureBasketAccess({ originator, basket, reason, seekPermission = true, usageType }: {
8454
+ originator: string;
8455
+ basket: string;
8456
+ reason?: string;
8457
+ seekPermission?: boolean;
8458
+ usageType: "insertion" | "removal" | "listing";
8459
+ }): Promise<boolean>
8460
+ public async ensureCertificateAccess({ originator, privileged, verifier, certType, fields, reason, seekPermission = true, usageType }: {
8461
+ originator: string;
8462
+ privileged: boolean;
8463
+ verifier: string;
8464
+ certType: string;
8465
+ fields: string[];
8466
+ reason?: string;
8467
+ seekPermission?: boolean;
8468
+ usageType: "disclosure";
8469
+ }): Promise<boolean>
8470
+ public async ensureSpendingAuthorization({ originator, satoshis, lineItems, reason, seekPermission = true }: {
8471
+ originator: string;
8472
+ satoshis: number;
8473
+ lineItems?: Array<{
8474
+ type: "input" | "output" | "fee";
8475
+ description: string;
8476
+ satoshis: number;
8477
+ }>;
8478
+ reason?: string;
8479
+ seekPermission?: boolean;
8480
+ }): Promise<boolean>
8481
+ public async ensureLabelAccess({ originator, label, reason, seekPermission = true, usageType }: {
8482
+ originator: string;
8483
+ label: string;
8484
+ reason?: string;
8485
+ seekPermission?: boolean;
8486
+ usageType: "apply" | "list";
8487
+ }): Promise<boolean>
8488
+ public async querySpentSince(token: PermissionToken): Promise<number>
8489
+ public async listProtocolPermissions({ originator }: {
8490
+ originator?: string;
8491
+ }): Promise<PermissionToken[]>
8492
+ public async hasProtocolPermission(params: {
8493
+ originator: string;
8494
+ privileged: boolean;
8495
+ protocolID: [
8496
+ 0 | 1 | 2,
8497
+ string
8498
+ ];
8499
+ counterparty: string;
8500
+ }): Promise<boolean>
8501
+ public async listBasketAccess(params: {
8502
+ originator?: string;
8503
+ }): Promise<PermissionToken[]>
8504
+ public async hasBasketAccess(params: {
8505
+ originator: string;
8506
+ basket: string;
8507
+ }): Promise<boolean>
8508
+ public async listSpendingAuthorizations(params: {
8509
+ originator?: string;
8510
+ }): Promise<PermissionToken[]>
8511
+ public async hasSpendingAuthorization(params: {
8512
+ originator: string;
8513
+ satoshis: number;
8514
+ }): Promise<boolean>
8515
+ public async listCertificateAccess(params: {
8516
+ originator?: string;
8517
+ }): Promise<PermissionToken[]>
8518
+ public async hasCertificateAccess(params: {
8519
+ originator: string;
8520
+ privileged: boolean;
8521
+ verifier: string;
8522
+ certType: string;
8523
+ fields: string[];
8524
+ }): Promise<boolean>
8525
+ public async revokePermission(oldToken: PermissionToken): Promise<void>
8526
+ public async createAction(args: Parameters<WalletInterface["createAction"]>[0], originator?: string): ReturnType<WalletInterface["createAction"]>
8527
+ public async signAction(...args: Parameters<WalletInterface["signAction"]>): ReturnType<WalletInterface["signAction"]>
8528
+ public async abortAction(...args: Parameters<WalletInterface["abortAction"]>): ReturnType<WalletInterface["abortAction"]>
8529
+ public async listActions(...args: Parameters<WalletInterface["listActions"]>): ReturnType<WalletInterface["listActions"]>
8530
+ public async internalizeAction(...args: Parameters<WalletInterface["internalizeAction"]>): ReturnType<WalletInterface["internalizeAction"]>
8531
+ public async listOutputs(...args: Parameters<WalletInterface["listOutputs"]>): ReturnType<WalletInterface["listOutputs"]>
8532
+ public async relinquishOutput(...args: Parameters<WalletInterface["relinquishOutput"]>): ReturnType<WalletInterface["relinquishOutput"]>
8533
+ public async getPublicKey(...args: Parameters<WalletInterface["getPublicKey"]>): ReturnType<WalletInterface["getPublicKey"]>
8534
+ public async revealCounterpartyKeyLinkage(...args: Parameters<WalletInterface["revealCounterpartyKeyLinkage"]>): ReturnType<WalletInterface["revealCounterpartyKeyLinkage"]>
8535
+ public async revealSpecificKeyLinkage(...args: Parameters<WalletInterface["revealSpecificKeyLinkage"]>): ReturnType<WalletInterface["revealSpecificKeyLinkage"]>
8536
+ public async encrypt(...args: Parameters<WalletInterface["encrypt"]>): ReturnType<WalletInterface["encrypt"]>
8537
+ public async decrypt(...args: Parameters<WalletInterface["decrypt"]>): ReturnType<WalletInterface["decrypt"]>
8538
+ public async createHmac(...args: Parameters<WalletInterface["createHmac"]>): ReturnType<WalletInterface["createHmac"]>
8539
+ public async verifyHmac(...args: Parameters<WalletInterface["verifyHmac"]>): ReturnType<WalletInterface["verifyHmac"]>
8540
+ public async createSignature(...args: Parameters<WalletInterface["createSignature"]>): ReturnType<WalletInterface["createSignature"]>
8541
+ public async verifySignature(...args: Parameters<WalletInterface["verifySignature"]>): ReturnType<WalletInterface["verifySignature"]>
8542
+ public async acquireCertificate(...args: Parameters<WalletInterface["acquireCertificate"]>): ReturnType<WalletInterface["acquireCertificate"]>
8543
+ public async listCertificates(...args: Parameters<WalletInterface["listCertificates"]>): ReturnType<WalletInterface["listCertificates"]>
8544
+ public async proveCertificate(...args: Parameters<WalletInterface["proveCertificate"]>): ReturnType<WalletInterface["proveCertificate"]>
8545
+ public async relinquishCertificate(...args: Parameters<WalletInterface["relinquishCertificate"]>): ReturnType<WalletInterface["relinquishCertificate"]>
8546
+ public async discoverByIdentityKey(...args: Parameters<WalletInterface["discoverByIdentityKey"]>): ReturnType<WalletInterface["discoverByIdentityKey"]>
8547
+ public async discoverByAttributes(...args: Parameters<WalletInterface["discoverByAttributes"]>): ReturnType<WalletInterface["discoverByAttributes"]>
8548
+ public async isAuthenticated(...args: Parameters<WalletInterface["isAuthenticated"]>): ReturnType<WalletInterface["isAuthenticated"]>
8549
+ public async waitForAuthentication(...args: Parameters<WalletInterface["waitForAuthentication"]>): ReturnType<WalletInterface["waitForAuthentication"]>
8550
+ public async getHeight(...args: Parameters<WalletInterface["getHeight"]>): ReturnType<WalletInterface["getHeight"]>
8551
+ public async getHeaderForHeight(...args: Parameters<WalletInterface["getHeaderForHeight"]>): ReturnType<WalletInterface["getHeaderForHeight"]>
8552
+ public async getNetwork(...args: Parameters<WalletInterface["getNetwork"]>): ReturnType<WalletInterface["getNetwork"]>
8553
+ public async getVersion(...args: Parameters<WalletInterface["getVersion"]>): ReturnType<WalletInterface["getVersion"]>
8554
+ }
8555
+ ```
8556
+
8557
+ See also: [PermissionEventHandler](./client.md#type-permissioneventhandler), [PermissionToken](./client.md#interface-permissiontoken), [PermissionsManagerConfig](./client.md#interface-permissionsmanagerconfig), [WalletPermissionsManagerCallbacks](./client.md#interface-walletpermissionsmanagercallbacks), [createAction](./storage.md#function-createaction), [internalizeAction](./storage.md#function-internalizeaction), [listActions](./storage.md#function-listactions), [listCertificates](./storage.md#function-listcertificates), [listOutputs](./storage.md#function-listoutputs), [proveCertificate](./client.md#function-provecertificate), [signAction](./client.md#function-signaction)
8558
+
8559
+ ###### Constructor
8560
+
8561
+ Constructs a new Permissions Manager instance.
8562
+
8563
+ ```ts
8564
+ constructor(underlyingWallet: WalletInterface, adminOriginator: string, config: PermissionsManagerConfig = {})
8565
+ ```
8566
+ See also: [PermissionsManagerConfig](./client.md#interface-permissionsmanagerconfig)
8567
+
8568
+ Argument Details
8569
+
8570
+ + **underlyingWallet**
8571
+ + The underlying BRC-100 wallet, where requests are forwarded after permission is granted
8572
+ + **adminOriginator**
8573
+ + The domain or FQDN that is automatically allowed everything
8574
+ + **config**
8575
+ + A set of boolean flags controlling how strictly permissions are enforced
8576
+
8577
+ ###### Method bindCallback
8578
+
8579
+ Binds a callback function to a named event, such as `onProtocolPermissionRequested`.
8580
+
8581
+ ```ts
8582
+ public bindCallback(eventName: keyof WalletPermissionsManagerCallbacks, handler: PermissionEventHandler): number
8583
+ ```
8584
+ See also: [PermissionEventHandler](./client.md#type-permissioneventhandler), [WalletPermissionsManagerCallbacks](./client.md#interface-walletpermissionsmanagercallbacks)
8585
+
8586
+ Returns
8587
+
8588
+ A numeric ID you can use to unbind later
8589
+
8590
+ Argument Details
8591
+
8592
+ + **eventName**
8593
+ + The name of the event to listen to
8594
+ + **handler**
8595
+ + A function that handles the event
8596
+
8597
+ ###### Method denyPermission
8598
+
8599
+ Denies a previously requested permission.
8600
+ This method rejects all pending promise calls waiting on that request
8601
+
8602
+ ```ts
8603
+ public async denyPermission(requestID: string): Promise<void>
8604
+ ```
8605
+
8606
+ Argument Details
8607
+
8608
+ + **requestID**
8609
+ + requestID identifying which request to deny
8610
+
8611
+ ###### Method ensureBasketAccess
8612
+
8613
+ Ensures the originator has basket usage permission for the specified basket.
8614
+ If not, triggers a permission request flow.
8615
+
8616
+ ```ts
8617
+ public async ensureBasketAccess({ originator, basket, reason, seekPermission = true, usageType }: {
8618
+ originator: string;
8619
+ basket: string;
8620
+ reason?: string;
8621
+ seekPermission?: boolean;
8622
+ usageType: "insertion" | "removal" | "listing";
8623
+ }): Promise<boolean>
8624
+ ```
8625
+
8626
+ ###### Method ensureCertificateAccess
8627
+
8628
+ Ensures the originator has a valid certificate permission.
8629
+ This is relevant when revealing certificate fields in DCAP contexts.
8630
+
8631
+ ```ts
8632
+ public async ensureCertificateAccess({ originator, privileged, verifier, certType, fields, reason, seekPermission = true, usageType }: {
8633
+ originator: string;
8634
+ privileged: boolean;
8635
+ verifier: string;
8636
+ certType: string;
8637
+ fields: string[];
8638
+ reason?: string;
8639
+ seekPermission?: boolean;
8640
+ usageType: "disclosure";
8641
+ }): Promise<boolean>
8642
+ ```
8643
+
8644
+ ###### Method ensureLabelAccess
8645
+
8646
+ Ensures the originator has label usage permission.
8647
+ If no valid (unexpired) permission token is found, triggers a permission request flow.
8648
+
8649
+ ```ts
8650
+ public async ensureLabelAccess({ originator, label, reason, seekPermission = true, usageType }: {
8651
+ originator: string;
8652
+ label: string;
8653
+ reason?: string;
8654
+ seekPermission?: boolean;
8655
+ usageType: "apply" | "list";
8656
+ }): Promise<boolean>
8657
+ ```
8658
+
8659
+ ###### Method ensureProtocolPermission
8660
+
8661
+ Ensures the originator has protocol usage permission.
8662
+ If no valid (unexpired) permission token is found, triggers a permission request flow.
8663
+
8664
+ ```ts
8665
+ public async ensureProtocolPermission({ originator, privileged, protocolID, counterparty, reason, seekPermission = true, usageType }: {
8666
+ originator: string;
8667
+ privileged: boolean;
8668
+ protocolID: [
8669
+ 0 | 1 | 2,
8670
+ string
8671
+ ];
8672
+ counterparty: string;
8673
+ reason?: string;
8674
+ seekPermission?: boolean;
8675
+ usageType: "signing" | "encrypting" | "hmac" | "publicKey" | "identityKey" | "linkageRevelation" | "generic";
8676
+ }): Promise<boolean>
8677
+ ```
8678
+
8679
+ ###### Method ensureSpendingAuthorization
8680
+
8681
+ Ensures the originator has spending authorization (DSAP) for a certain satoshi amount.
8682
+ If the existing token limit is insufficient, attempts to renew. If no token, attempts to create one.
8683
+
8684
+ ```ts
8685
+ public async ensureSpendingAuthorization({ originator, satoshis, lineItems, reason, seekPermission = true }: {
8686
+ originator: string;
8687
+ satoshis: number;
8688
+ lineItems?: Array<{
8689
+ type: "input" | "output" | "fee";
8690
+ description: string;
8691
+ satoshis: number;
8692
+ }>;
8693
+ reason?: string;
8694
+ seekPermission?: boolean;
8695
+ }): Promise<boolean>
8696
+ ```
8697
+
8698
+ ###### Method grantPermission
8699
+
8700
+ Grants a previously requested permission.
8701
+ This method:
8702
+ 1) Resolves all pending promise calls waiting on this request
8703
+ 2) Optionally creates or renews an on-chain PushDrop token (unless `ephemeral===true`)
8704
+
8705
+ ```ts
8706
+ public async grantPermission(params: {
8707
+ requestID: string;
8708
+ expiry?: number;
8709
+ ephemeral?: boolean;
8710
+ amount?: number;
8711
+ }): Promise<void>
8712
+ ```
8713
+
8714
+ Argument Details
8715
+
8716
+ + **params**
8717
+ + requestID to identify which request is granted, plus optional expiry
8718
+ or `ephemeral` usage, etc.
8719
+
8720
+ ###### Method hasBasketAccess
8721
+
8722
+ Returns `true` if the originator already holds a valid unexpired basket permission for `basket`.
8723
+
8724
+ ```ts
8725
+ public async hasBasketAccess(params: {
8726
+ originator: string;
8727
+ basket: string;
8728
+ }): Promise<boolean>
8729
+ ```
8730
+
8731
+ ###### Method hasCertificateAccess
8732
+
8733
+ Returns `true` if the originator already holds a valid unexpired certificate access
8734
+ for the given certType/fields. Does not prompt the user.
8735
+
8736
+ ```ts
8737
+ public async hasCertificateAccess(params: {
8738
+ originator: string;
8739
+ privileged: boolean;
8740
+ verifier: string;
8741
+ certType: string;
8742
+ fields: string[];
8743
+ }): Promise<boolean>
8744
+ ```
8745
+
8746
+ ###### Method hasProtocolPermission
8747
+
8748
+ Returns true if the originator already holds a valid unexpired protocol permission.
8749
+ This calls `ensureProtocolPermission` with `seekPermission=false`, so it won't prompt.
8750
+
8751
+ ```ts
8752
+ public async hasProtocolPermission(params: {
8753
+ originator: string;
8754
+ privileged: boolean;
8755
+ protocolID: [
8756
+ 0 | 1 | 2,
8757
+ string
8758
+ ];
8759
+ counterparty: string;
8760
+ }): Promise<boolean>
8761
+ ```
8762
+
8763
+ ###### Method hasSpendingAuthorization
8764
+
8765
+ Returns `true` if the originator already holds a valid spending authorization token
8766
+ with enough available monthly spend. We do not prompt (seekPermission=false).
8767
+
8768
+ ```ts
8769
+ public async hasSpendingAuthorization(params: {
8770
+ originator: string;
8771
+ satoshis: number;
8772
+ }): Promise<boolean>
8773
+ ```
8774
+
8775
+ ###### Method listBasketAccess
8776
+
8777
+ Lists basket permission tokens (DBAP) for a given originator (or for all if not specified).
8778
+
8779
+ ```ts
8780
+ public async listBasketAccess(params: {
8781
+ originator?: string;
8782
+ }): Promise<PermissionToken[]>
8783
+ ```
8784
+ See also: [PermissionToken](./client.md#interface-permissiontoken)
8785
+
8786
+ ###### Method listCertificateAccess
8787
+
8788
+ Lists certificate permission tokens (DCAP) for a given originator (or all).
8789
+
8790
+ ```ts
8791
+ public async listCertificateAccess(params: {
8792
+ originator?: string;
8793
+ }): Promise<PermissionToken[]>
8794
+ ```
8795
+ See also: [PermissionToken](./client.md#interface-permissiontoken)
8796
+
8797
+ ###### Method listProtocolPermissions
8798
+
8799
+ Lists all protocol permission tokens (DPACP) for a given originator or for all if originator is undefined.
8800
+ This is a convenience method for UI or debug.
8801
+
8802
+ ```ts
8803
+ public async listProtocolPermissions({ originator }: {
8804
+ originator?: string;
8805
+ }): Promise<PermissionToken[]>
8806
+ ```
8807
+ See also: [PermissionToken](./client.md#interface-permissiontoken)
8808
+
8809
+ ###### Method listSpendingAuthorizations
8810
+
8811
+ Lists spending authorization tokens (DSAP) for a given originator (or all).
8812
+
8813
+ ```ts
8814
+ public async listSpendingAuthorizations(params: {
8815
+ originator?: string;
8816
+ }): Promise<PermissionToken[]>
8817
+ ```
8818
+ See also: [PermissionToken](./client.md#interface-permissiontoken)
8819
+
8820
+ ###### Method querySpentSince
8821
+
8822
+ Returns spending for an originator in the current calendar month.
8823
+
8824
+ ```ts
8825
+ public async querySpentSince(token: PermissionToken): Promise<number>
8826
+ ```
8827
+ See also: [PermissionToken](./client.md#interface-permissiontoken)
8828
+
8829
+ ###### Method revokePermission
8830
+
8831
+ Revokes a permission token by spending it with no replacement output.
8832
+ The manager builds a BRC-100 transaction that consumes the token, effectively invalidating it.
8833
+
8834
+ ```ts
8835
+ public async revokePermission(oldToken: PermissionToken): Promise<void>
8836
+ ```
8837
+ See also: [PermissionToken](./client.md#interface-permissiontoken)
8838
+
8839
+ ###### Method unbindCallback
8840
+
8841
+ Unbinds a previously registered callback by either its numeric ID (returned by `bindCallback`)
8842
+ or by exact function reference.
8843
+
8844
+ ```ts
8845
+ public unbindCallback(eventName: keyof WalletPermissionsManagerCallbacks, reference: number | Function): boolean
8846
+ ```
8847
+ See also: [WalletPermissionsManagerCallbacks](./client.md#interface-walletpermissionsmanagercallbacks)
8848
+
8849
+ Returns
8850
+
8851
+ True if successfully unbound, false otherwise
8852
+
8853
+ Argument Details
8854
+
8855
+ + **eventName**
8856
+ + The event name, e.g. "onProtocolPermissionRequested"
8857
+ + **reference**
8858
+ + Either the numeric ID or the function reference
8859
+
8860
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8861
+
8862
+ ---
8863
+ ##### Class: WalletSettingsManager
8864
+
8865
+ Manages wallet settings
8866
+
8867
+ ```ts
8868
+ export class WalletSettingsManager {
8869
+ constructor(private wallet: WalletInterface, private config: WalletSettingsManagerConfig = {
8870
+ defaultSettings: DEFAULT_SETTINGS
8871
+ })
8872
+ async get(): Promise<WalletSettings>
8873
+ async set(settings: WalletSettings): Promise<void>
8874
+ async delete(): Promise<void>
8875
+ }
8876
+ ```
8877
+
8878
+ See also: [DEFAULT_SETTINGS](./client.md#variable-default_settings), [WalletSettings](./client.md#interface-walletsettings), [WalletSettingsManagerConfig](./client.md#interface-walletsettingsmanagerconfig)
8879
+
8880
+ ###### Method delete
8881
+
8882
+ Deletes the user's settings token.
8883
+
8884
+ ```ts
8885
+ async delete(): Promise<void>
8886
+ ```
8887
+
8888
+ ###### Method get
8889
+
8890
+ Returns a user's wallet settings
8891
+
8892
+ ```ts
8893
+ async get(): Promise<WalletSettings>
8894
+ ```
8895
+ See also: [WalletSettings](./client.md#interface-walletsettings)
8896
+
8897
+ Returns
8898
+
8899
+ - Wallet settings object
8900
+
8901
+ ###### Method set
8902
+
8903
+ Creates (or updates) the user's settings token.
8904
+
8905
+ ```ts
8906
+ async set(settings: WalletSettings): Promise<void>
8907
+ ```
8908
+ See also: [WalletSettings](./client.md#interface-walletsettings)
8909
+
8910
+ Argument Details
8911
+
8912
+ + **settings**
8913
+ + The wallet settings to be stored.
8914
+
8915
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
8916
+
7572
8917
  ---
7573
8918
  ##### Class: WalletSigner
7574
8919
 
@@ -9256,15 +10601,15 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
9256
10601
 
9257
10602
  | | |
9258
10603
  | --- | --- |
9259
- | [Chain](#type-chain) | [PostReqsToNetworkDetailsStatus](#type-postreqstonetworkdetailsstatus) |
9260
- | [DBType](#type-dbtype) | [PostTxsService](#type-posttxsservice) |
9261
- | [EntityStorage](#type-entitystorage) | [ProvenTxReqStatus](#type-proventxreqstatus) |
9262
- | [GetMerklePathService](#type-getmerklepathservice) | [StorageProvidedBy](#type-storageprovidedby) |
9263
- | [GetRawTxService](#type-getrawtxservice) | [SyncProtocolVersion](#type-syncprotocolversion) |
9264
- | [GetUtxoStatusOutputFormat](#type-getutxostatusoutputformat) | [SyncStatus](#type-syncstatus) |
9265
- | [GetUtxoStatusService](#type-getutxostatusservice) | [TransactionStatus](#type-transactionstatus) |
9266
- | [MonitorStorage](#type-monitorstorage) | [UpdateFiatExchangeRateService](#type-updatefiatexchangerateservice) |
9267
- | [PostBeefService](#type-postbeefservice) | |
10604
+ | [Chain](#type-chain) | [PostBeefService](#type-postbeefservice) |
10605
+ | [DBType](#type-dbtype) | [PostReqsToNetworkDetailsStatus](#type-postreqstonetworkdetailsstatus) |
10606
+ | [EntityStorage](#type-entitystorage) | [PostTxsService](#type-posttxsservice) |
10607
+ | [GetMerklePathService](#type-getmerklepathservice) | [ProvenTxReqStatus](#type-proventxreqstatus) |
10608
+ | [GetRawTxService](#type-getrawtxservice) | [StorageProvidedBy](#type-storageprovidedby) |
10609
+ | [GetUtxoStatusOutputFormat](#type-getutxostatusoutputformat) | [SyncProtocolVersion](#type-syncprotocolversion) |
10610
+ | [GetUtxoStatusService](#type-getutxostatusservice) | [SyncStatus](#type-syncstatus) |
10611
+ | [MonitorStorage](#type-monitorstorage) | [TransactionStatus](#type-transactionstatus) |
10612
+ | [PermissionEventHandler](#type-permissioneventhandler) | [UpdateFiatExchangeRateService](#type-updatefiatexchangerateservice) |
9268
10613
 
9269
10614
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
9270
10615
 
@@ -9351,6 +10696,21 @@ See also: [WalletStorageManager](./storage.md#class-walletstoragemanager)
9351
10696
 
9352
10697
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
9353
10698
 
10699
+ ---
10700
+ ##### Type: PermissionEventHandler
10701
+
10702
+ Signature for functions that handle a permission request event, e.g. "Please ask the user to allow basket X".
10703
+
10704
+ ```ts
10705
+ export type PermissionEventHandler = (request: PermissionRequest & {
10706
+ requestID: string;
10707
+ }) => void | Promise<void>
10708
+ ```
10709
+
10710
+ See also: [PermissionRequest](./client.md#interface-permissionrequest)
10711
+
10712
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
10713
+
9354
10714
  ---
9355
10715
  ##### Type: PostBeefService
9356
10716
 
@@ -9483,17 +10843,71 @@ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](
9483
10843
 
9484
10844
  | |
9485
10845
  | --- |
10846
+ | [DEFAULT_SETTINGS](#variable-default_settings) |
10847
+ | [PBKDF2_NUM_ROUNDS](#variable-pbkdf2_num_rounds) |
9486
10848
  | [ProvenTxReqNonTerminalStatus](#variable-proventxreqnonterminalstatus) |
9487
10849
  | [ProvenTxReqTerminalStatus](#variable-proventxreqterminalstatus) |
10850
+ | [TESTNET_DEFAULT_SETTINGS](#variable-testnet_default_settings) |
9488
10851
  | [brc29ProtocolID](#variable-brc29protocolid) |
9489
10852
  | [maxPossibleSatoshis](#variable-maxpossiblesatoshis) |
9490
10853
  | [outputColumnsWithoutLockingScript](#variable-outputcolumnswithoutlockingscript) |
10854
+ | [parseResults](#variable-parseresults) |
10855
+ | [queryOverlay](#variable-queryoverlay) |
9491
10856
  | [transactionColumnsWithoutRawTx](#variable-transactioncolumnswithoutrawtx) |
10857
+ | [transformVerifiableCertificatesWithTrust](#variable-transformverifiablecertificateswithtrust) |
10858
+
10859
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
10860
+
10861
+ ---
10862
+
10863
+ ##### Variable: DEFAULT_SETTINGS
10864
+
10865
+ ```ts
10866
+ DEFAULT_SETTINGS = {
10867
+ trustSettings: {
10868
+ trustLevel: 2,
10869
+ trustedCertifiers: [
10870
+ {
10871
+ name: "Babbage Trust Services",
10872
+ description: "Resolves identity information for Babbage-run APIs and Bitcoin infrastructure.",
10873
+ iconUrl: "https://projectbabbage.com/favicon.ico",
10874
+ identityKey: "028703956178067ea7ca405111f1ca698290a0112a3d7cf3d843e195bf58a7cfa6",
10875
+ trust: 4
10876
+ },
10877
+ {
10878
+ name: "IdentiCert",
10879
+ description: "Certifies legal first and last name, and photos",
10880
+ iconUrl: "https://identicert.me/favicon.ico",
10881
+ trust: 5,
10882
+ identityKey: "0295bf1c7842d14babf60daf2c733956c331f9dcb2c79e41f85fd1dda6a3fa4549"
10883
+ },
10884
+ {
10885
+ name: "SocialCert",
10886
+ description: "Certifies social media handles, phone numbers and emails",
10887
+ iconUrl: "https://socialcert.net/favicon.ico",
10888
+ trust: 3,
10889
+ identityKey: "03285263f06139b66fb27f51cf8a92e9dd007c4c4b83876ad6c3e7028db450a4c2"
10890
+ }
10891
+ ]
10892
+ },
10893
+ theme: { mode: "dark" }
10894
+ } as WalletSettings
10895
+ ```
10896
+
10897
+ See also: [WalletSettings](./client.md#interface-walletsettings)
9492
10898
 
9493
10899
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
9494
10900
 
9495
10901
  ---
10902
+ ##### Variable: PBKDF2_NUM_ROUNDS
9496
10903
 
10904
+ ```ts
10905
+ PBKDF2_NUM_ROUNDS = 7777
10906
+ ```
10907
+
10908
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
10909
+
10910
+ ---
9497
10911
  ##### Variable: ProvenTxReqNonTerminalStatus
9498
10912
 
9499
10913
  ```ts
@@ -9529,6 +10943,26 @@ See also: [ProvenTxReqStatus](./client.md#type-proventxreqstatus)
9529
10943
 
9530
10944
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
9531
10945
 
10946
+ ---
10947
+ ##### Variable: TESTNET_DEFAULT_SETTINGS
10948
+
10949
+ ```ts
10950
+ TESTNET_DEFAULT_SETTINGS: WalletSettings = {
10951
+ ...DEFAULT_SETTINGS,
10952
+ trustSettings: {
10953
+ ...DEFAULT_SETTINGS.trustSettings,
10954
+ trustedCertifiers: DEFAULT_SETTINGS.trustSettings.trustedCertifiers.map(certifier => ({
10955
+ ...certifier,
10956
+ identityKey: TESTNET_IDENTITY_KEYS[certifier.name] || certifier.identityKey
10957
+ }))
10958
+ }
10959
+ }
10960
+ ```
10961
+
10962
+ See also: [DEFAULT_SETTINGS](./client.md#variable-default_settings), [WalletSettings](./client.md#interface-walletsettings)
10963
+
10964
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
10965
+
9532
10966
  ---
9533
10967
  ##### Variable: brc29ProtocolID
9534
10968
 
@@ -9581,6 +11015,52 @@ outputColumnsWithoutLockingScript = [
9581
11015
 
9582
11016
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
9583
11017
 
11018
+ ---
11019
+ ##### Variable: parseResults
11020
+
11021
+ ```ts
11022
+ parseResults = async (lookupResult: LookupAnswer): Promise<VerifiableCertificate[]> => {
11023
+ if (lookupResult.type === "output-list") {
11024
+ const parsedResults: VerifiableCertificate[] = [];
11025
+ for (const output of lookupResult.outputs) {
11026
+ try {
11027
+ const tx = Transaction.fromAtomicBEEF(output.beef);
11028
+ const decodedOutput = PushDrop.decode(tx.outputs[OUTPUT_INDEX].lockingScript);
11029
+ const certificate: VerifiableCertificate = JSON.parse(Utils.toUTF8(decodedOutput.fields[0]));
11030
+ const verifiableCert = new VerifiableCertificate(certificate.type, certificate.serialNumber, certificate.subject, certificate.revocationOutpoint, certificate.certifier, certificate.fields, certificate.keyring, certificate.signature);
11031
+ const decryptedFields = await verifiableCert.decryptFields(new ProtoWallet("anyone"));
11032
+ verifiableCert.decryptedFields = decryptedFields;
11033
+ parsedResults.push(verifiableCert);
11034
+ }
11035
+ catch (error) {
11036
+ console.error(error);
11037
+ }
11038
+ }
11039
+ return parsedResults;
11040
+ }
11041
+ return [];
11042
+ }
11043
+ ```
11044
+
11045
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
11046
+
11047
+ ---
11048
+ ##### Variable: queryOverlay
11049
+
11050
+ ```ts
11051
+ queryOverlay = async (query: unknown, resolver: LookupResolver): Promise<VerifiableCertificate[]> => {
11052
+ const results = await resolver.query({
11053
+ service: "ls_identity",
11054
+ query
11055
+ });
11056
+ return await parseResults(results);
11057
+ }
11058
+ ```
11059
+
11060
+ See also: [parseResults](./client.md#variable-parseresults)
11061
+
11062
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
11063
+
9584
11064
  ---
9585
11065
  ##### Variable: transactionColumnsWithoutRawTx
9586
11066
 
@@ -9604,6 +11084,60 @@ transactionColumnsWithoutRawTx = [
9604
11084
 
9605
11085
  Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
9606
11086
 
11087
+ ---
11088
+ ##### Variable: transformVerifiableCertificatesWithTrust
11089
+
11090
+ ```ts
11091
+ transformVerifiableCertificatesWithTrust = (trustSettings: TrustSettings, certificates: VerifiableCertificate[]): DiscoverCertificatesResult => {
11092
+ const identityGroups: Record<string, IdentityGroup> = {};
11093
+ const certifierCache: Record<string, Certifier> = {};
11094
+ certificates.forEach(cert => {
11095
+ const { subject, certifier } = cert;
11096
+ if (!subject || !certifier)
11097
+ return;
11098
+ if (!certifierCache[certifier]) {
11099
+ const found = trustSettings.trustedCertifiers.find(x => x.identityKey === certifier);
11100
+ if (!found)
11101
+ return;
11102
+ certifierCache[certifier] = found;
11103
+ }
11104
+ const certifierInfo: IdentityCertifier = {
11105
+ name: certifierCache[certifier].name,
11106
+ iconUrl: certifierCache[certifier].iconUrl || "",
11107
+ description: certifierCache[certifier].description,
11108
+ trust: certifierCache[certifier].trust
11109
+ };
11110
+ const extendedCert: IdentityCertificate = {
11111
+ ...cert,
11112
+ signature: cert.signature!,
11113
+ decryptedFields: cert.decryptedFields as Record<string, string>,
11114
+ publiclyRevealedKeyring: cert.keyring,
11115
+ certifierInfo
11116
+ };
11117
+ if (!identityGroups[subject]) {
11118
+ identityGroups[subject] = { totalTrust: 0, members: [] };
11119
+ }
11120
+ identityGroups[subject].totalTrust += certifierInfo.trust;
11121
+ identityGroups[subject].members.push(extendedCert);
11122
+ });
11123
+ const finalResults: ExtendedVerifiableCertificate[] = [];
11124
+ Object.values(identityGroups).forEach(group => {
11125
+ if (group.totalTrust >= trustSettings.trustLevel) {
11126
+ finalResults.push(...group.members);
11127
+ }
11128
+ });
11129
+ finalResults.sort((a, b) => b.certifierInfo.trust - a.certifierInfo.trust);
11130
+ return {
11131
+ totalCertificates: finalResults.length,
11132
+ certificates: finalResults
11133
+ };
11134
+ }
11135
+ ```
11136
+
11137
+ See also: [Certifier](./client.md#interface-certifier), [ExtendedVerifiableCertificate](./client.md#interface-extendedverifiablecertificate), [TrustSettings](./client.md#interface-trustsettings)
11138
+
11139
+ Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables)
11140
+
9607
11141
  ---
9608
11142
 
9609
11143
  <!--#endregion ts2md-api-merged-here-->