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