@bsv/wallet-toolbox-client 1.7.13 → 1.7.15

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 (666) hide show
  1. package/package.json +2 -2
  2. package/out/src/CWIStyleWalletManager.d.ts +0 -438
  3. package/out/src/CWIStyleWalletManager.d.ts.map +0 -1
  4. package/out/src/CWIStyleWalletManager.js +0 -1292
  5. package/out/src/CWIStyleWalletManager.js.map +0 -1
  6. package/out/src/SetupClient.d.ts +0 -130
  7. package/out/src/SetupClient.d.ts.map +0 -1
  8. package/out/src/SetupClient.js +0 -226
  9. package/out/src/SetupClient.js.map +0 -1
  10. package/out/src/SetupWallet.d.ts +0 -103
  11. package/out/src/SetupWallet.d.ts.map +0 -1
  12. package/out/src/SetupWallet.js +0 -3
  13. package/out/src/SetupWallet.js.map +0 -1
  14. package/out/src/SimpleWalletManager.d.ts +0 -169
  15. package/out/src/SimpleWalletManager.d.ts.map +0 -1
  16. package/out/src/SimpleWalletManager.js +0 -315
  17. package/out/src/SimpleWalletManager.js.map +0 -1
  18. package/out/src/Wallet.d.ts +0 -206
  19. package/out/src/Wallet.d.ts.map +0 -1
  20. package/out/src/Wallet.js +0 -797
  21. package/out/src/Wallet.js.map +0 -1
  22. package/out/src/WalletAuthenticationManager.d.ts +0 -33
  23. package/out/src/WalletAuthenticationManager.d.ts.map +0 -1
  24. package/out/src/WalletAuthenticationManager.js +0 -113
  25. package/out/src/WalletAuthenticationManager.js.map +0 -1
  26. package/out/src/WalletLogger.d.ts +0 -65
  27. package/out/src/WalletLogger.d.ts.map +0 -1
  28. package/out/src/WalletLogger.js +0 -167
  29. package/out/src/WalletLogger.js.map +0 -1
  30. package/out/src/WalletPermissionsManager.d.ts +0 -760
  31. package/out/src/WalletPermissionsManager.d.ts.map +0 -1
  32. package/out/src/WalletPermissionsManager.js +0 -2679
  33. package/out/src/WalletPermissionsManager.js.map +0 -1
  34. package/out/src/WalletSettingsManager.d.ts +0 -53
  35. package/out/src/WalletSettingsManager.d.ts.map +0 -1
  36. package/out/src/WalletSettingsManager.js +0 -83
  37. package/out/src/WalletSettingsManager.js.map +0 -1
  38. package/out/src/index.client.d.ts +0 -23
  39. package/out/src/index.client.d.ts.map +0 -1
  40. package/out/src/index.client.js +0 -62
  41. package/out/src/index.client.js.map +0 -1
  42. package/out/src/monitor/Monitor.d.ts +0 -148
  43. package/out/src/monitor/Monitor.d.ts.map +0 -1
  44. package/out/src/monitor/Monitor.js +0 -317
  45. package/out/src/monitor/Monitor.js.map +0 -1
  46. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts +0 -53
  47. package/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +0 -1
  48. package/out/src/monitor/tasks/TaskCheckForProofs.js +0 -213
  49. package/out/src/monitor/tasks/TaskCheckForProofs.js.map +0 -1
  50. package/out/src/monitor/tasks/TaskCheckNoSends.d.ts +0 -33
  51. package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +0 -1
  52. package/out/src/monitor/tasks/TaskCheckNoSends.js +0 -71
  53. package/out/src/monitor/tasks/TaskCheckNoSends.js.map +0 -1
  54. package/out/src/monitor/tasks/TaskClock.d.ts +0 -14
  55. package/out/src/monitor/tasks/TaskClock.d.ts.map +0 -1
  56. package/out/src/monitor/tasks/TaskClock.js +0 -28
  57. package/out/src/monitor/tasks/TaskClock.js.map +0 -1
  58. package/out/src/monitor/tasks/TaskFailAbandoned.d.ts +0 -20
  59. package/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +0 -1
  60. package/out/src/monitor/tasks/TaskFailAbandoned.js +0 -52
  61. package/out/src/monitor/tasks/TaskFailAbandoned.js.map +0 -1
  62. package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts +0 -12
  63. package/out/src/monitor/tasks/TaskMonitorCallHistory.d.ts.map +0 -1
  64. package/out/src/monitor/tasks/TaskMonitorCallHistory.js +0 -24
  65. package/out/src/monitor/tasks/TaskMonitorCallHistory.js.map +0 -1
  66. package/out/src/monitor/tasks/TaskNewHeader.d.ts +0 -50
  67. package/out/src/monitor/tasks/TaskNewHeader.d.ts.map +0 -1
  68. package/out/src/monitor/tasks/TaskNewHeader.js +0 -84
  69. package/out/src/monitor/tasks/TaskNewHeader.js.map +0 -1
  70. package/out/src/monitor/tasks/TaskPurge.d.ts +0 -45
  71. package/out/src/monitor/tasks/TaskPurge.d.ts.map +0 -1
  72. package/out/src/monitor/tasks/TaskPurge.js +0 -34
  73. package/out/src/monitor/tasks/TaskPurge.js.map +0 -1
  74. package/out/src/monitor/tasks/TaskReorg.d.ts +0 -43
  75. package/out/src/monitor/tasks/TaskReorg.d.ts.map +0 -1
  76. package/out/src/monitor/tasks/TaskReorg.js +0 -82
  77. package/out/src/monitor/tasks/TaskReorg.js.map +0 -1
  78. package/out/src/monitor/tasks/TaskReviewStatus.d.ts +0 -26
  79. package/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +0 -1
  80. package/out/src/monitor/tasks/TaskReviewStatus.js +0 -43
  81. package/out/src/monitor/tasks/TaskReviewStatus.js.map +0 -1
  82. package/out/src/monitor/tasks/TaskSendWaiting.d.ts +0 -35
  83. package/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +0 -1
  84. package/out/src/monitor/tasks/TaskSendWaiting.js +0 -117
  85. package/out/src/monitor/tasks/TaskSendWaiting.js.map +0 -1
  86. package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts +0 -12
  87. package/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts.map +0 -1
  88. package/out/src/monitor/tasks/TaskSyncWhenIdle.js +0 -22
  89. package/out/src/monitor/tasks/TaskSyncWhenIdle.js.map +0 -1
  90. package/out/src/monitor/tasks/TaskUnFail.d.ts +0 -41
  91. package/out/src/monitor/tasks/TaskUnFail.d.ts.map +0 -1
  92. package/out/src/monitor/tasks/TaskUnFail.js +0 -145
  93. package/out/src/monitor/tasks/TaskUnFail.js.map +0 -1
  94. package/out/src/monitor/tasks/WalletMonitorTask.d.ts +0 -40
  95. package/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +0 -1
  96. package/out/src/monitor/tasks/WalletMonitorTask.js +0 -37
  97. package/out/src/monitor/tasks/WalletMonitorTask.js.map +0 -1
  98. package/out/src/sdk/CertOpsWallet.d.ts +0 -7
  99. package/out/src/sdk/CertOpsWallet.d.ts.map +0 -1
  100. package/out/src/sdk/CertOpsWallet.js +0 -3
  101. package/out/src/sdk/CertOpsWallet.js.map +0 -1
  102. package/out/src/sdk/PrivilegedKeyManager.d.ts +0 -125
  103. package/out/src/sdk/PrivilegedKeyManager.d.ts.map +0 -1
  104. package/out/src/sdk/PrivilegedKeyManager.js +0 -293
  105. package/out/src/sdk/PrivilegedKeyManager.js.map +0 -1
  106. package/out/src/sdk/WERR_errors.d.ts +0 -136
  107. package/out/src/sdk/WERR_errors.d.ts.map +0 -1
  108. package/out/src/sdk/WERR_errors.js +0 -218
  109. package/out/src/sdk/WERR_errors.js.map +0 -1
  110. package/out/src/sdk/WalletError.d.ts +0 -63
  111. package/out/src/sdk/WalletError.d.ts.map +0 -1
  112. package/out/src/sdk/WalletError.js +0 -169
  113. package/out/src/sdk/WalletError.js.map +0 -1
  114. package/out/src/sdk/WalletErrorFromJson.d.ts +0 -12
  115. package/out/src/sdk/WalletErrorFromJson.d.ts.map +0 -1
  116. package/out/src/sdk/WalletErrorFromJson.js +0 -69
  117. package/out/src/sdk/WalletErrorFromJson.js.map +0 -1
  118. package/out/src/sdk/WalletServices.interfaces.d.ts +0 -618
  119. package/out/src/sdk/WalletServices.interfaces.d.ts.map +0 -1
  120. package/out/src/sdk/WalletServices.interfaces.js +0 -3
  121. package/out/src/sdk/WalletServices.interfaces.js.map +0 -1
  122. package/out/src/sdk/WalletSigner.interfaces.d.ts +0 -10
  123. package/out/src/sdk/WalletSigner.interfaces.d.ts.map +0 -1
  124. package/out/src/sdk/WalletSigner.interfaces.js +0 -3
  125. package/out/src/sdk/WalletSigner.interfaces.js.map +0 -1
  126. package/out/src/sdk/WalletStorage.interfaces.d.ts +0 -522
  127. package/out/src/sdk/WalletStorage.interfaces.d.ts.map +0 -1
  128. package/out/src/sdk/WalletStorage.interfaces.js +0 -3
  129. package/out/src/sdk/WalletStorage.interfaces.js.map +0 -1
  130. package/out/src/sdk/index.d.ts +0 -11
  131. package/out/src/sdk/index.d.ts.map +0 -1
  132. package/out/src/sdk/index.js +0 -29
  133. package/out/src/sdk/index.js.map +0 -1
  134. package/out/src/sdk/types.d.ts +0 -169
  135. package/out/src/sdk/types.d.ts.map +0 -1
  136. package/out/src/sdk/types.js +0 -90
  137. package/out/src/sdk/types.js.map +0 -1
  138. package/out/src/services/ServiceCollection.d.ts +0 -79
  139. package/out/src/services/ServiceCollection.d.ts.map +0 -1
  140. package/out/src/services/ServiceCollection.js +0 -192
  141. package/out/src/services/ServiceCollection.js.map +0 -1
  142. package/out/src/services/Services.d.ts +0 -71
  143. package/out/src/services/Services.d.ts.map +0 -1
  144. package/out/src/services/Services.js +0 -532
  145. package/out/src/services/Services.js.map +0 -1
  146. package/out/src/services/chaintracker/BHServiceClient.d.ts +0 -39
  147. package/out/src/services/chaintracker/BHServiceClient.d.ts.map +0 -1
  148. package/out/src/services/chaintracker/BHServiceClient.js +0 -174
  149. package/out/src/services/chaintracker/BHServiceClient.js.map +0 -1
  150. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +0 -15
  151. package/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +0 -1
  152. package/out/src/services/chaintracker/ChaintracksChainTracker.js +0 -53
  153. package/out/src/services/chaintracker/ChaintracksChainTracker.js.map +0 -1
  154. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts +0 -55
  155. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.d.ts.map +0 -1
  156. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js +0 -38
  157. package/out/src/services/chaintracker/chaintracks/Api/BlockHeaderApi.js.map +0 -1
  158. package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.d.ts +0 -70
  159. package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.d.ts.map +0 -1
  160. package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.js +0 -3
  161. package/out/src/services/chaintracker/chaintracks/Api/BulkIngestorApi.js.map +0 -1
  162. package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts +0 -81
  163. package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.d.ts.map +0 -1
  164. package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.js +0 -3
  165. package/out/src/services/chaintracker/chaintracks/Api/BulkStorageApi.js.map +0 -1
  166. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.d.ts +0 -54
  167. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.d.ts.map +0 -1
  168. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.js +0 -3
  169. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksApi.js.map +0 -1
  170. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.d.ts +0 -163
  171. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.d.ts.map +0 -1
  172. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.js +0 -3
  173. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksClientApi.js.map +0 -1
  174. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts +0 -18
  175. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.d.ts.map +0 -1
  176. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.js +0 -3
  177. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFetchApi.js.map +0 -1
  178. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.d.ts +0 -55
  179. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.d.ts.map +0 -1
  180. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.js +0 -3
  181. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksFsApi.js.map +0 -1
  182. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.d.ts +0 -338
  183. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.d.ts.map +0 -1
  184. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.js +0 -3
  185. package/out/src/services/chaintracker/chaintracks/Api/ChaintracksStorageApi.js.map +0 -1
  186. package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.d.ts +0 -19
  187. package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.d.ts.map +0 -1
  188. package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.js +0 -3
  189. package/out/src/services/chaintracker/chaintracks/Api/LiveIngestorApi.js.map +0 -1
  190. package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts +0 -101
  191. package/out/src/services/chaintracker/chaintracks/Chaintracks.d.ts.map +0 -1
  192. package/out/src/services/chaintracker/chaintracks/Chaintracks.js +0 -550
  193. package/out/src/services/chaintracker/chaintracks/Chaintracks.js.map +0 -1
  194. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts +0 -38
  195. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +0 -1
  196. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +0 -139
  197. package/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +0 -1
  198. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts +0 -60
  199. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.d.ts.map +0 -1
  200. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js +0 -119
  201. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorBase.js.map +0 -1
  202. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts +0 -76
  203. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.d.ts.map +0 -1
  204. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js +0 -114
  205. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDN.js.map +0 -1
  206. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts +0 -13
  207. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.d.ts.map +0 -1
  208. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js +0 -20
  209. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorCDNBabbage.js.map +0 -1
  210. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts +0 -62
  211. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.d.ts.map +0 -1
  212. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js +0 -59
  213. package/out/src/services/chaintracker/chaintracks/Ingest/BulkIngestorWhatsOnChainCdn.js.map +0 -1
  214. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts +0 -62
  215. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.d.ts.map +0 -1
  216. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js +0 -42
  217. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorBase.js.map +0 -1
  218. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts +0 -51
  219. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.d.ts.map +0 -1
  220. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js +0 -55
  221. package/out/src/services/chaintracker/chaintracks/Ingest/LiveIngestorWhatsOnChainPoll.js.map +0 -1
  222. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts +0 -171
  223. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.d.ts.map +0 -1
  224. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js +0 -501
  225. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainIngestorWs.js.map +0 -1
  226. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts +0 -89
  227. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.d.ts.map +0 -1
  228. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js +0 -137
  229. package/out/src/services/chaintracker/chaintracks/Ingest/WhatsOnChainServices.js.map +0 -1
  230. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts +0 -23
  231. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.d.ts.map +0 -1
  232. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js +0 -68
  233. package/out/src/services/chaintracker/chaintracks/Storage/BulkStorageBase.js.map +0 -1
  234. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts +0 -68
  235. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.d.ts.map +0 -1
  236. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js +0 -290
  237. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageBase.js.map +0 -1
  238. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts +0 -92
  239. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.d.ts.map +0 -1
  240. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js +0 -465
  241. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageIdb.js.map +0 -1
  242. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts +0 -37
  243. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.d.ts.map +0 -1
  244. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js +0 -260
  245. package/out/src/services/chaintracker/chaintracks/Storage/ChaintracksStorageNoDb.js.map +0 -1
  246. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts +0 -5
  247. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.d.ts.map +0 -1
  248. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js +0 -68
  249. package/out/src/services/chaintracker/chaintracks/createDefaultIdbChaintracksOptions.js.map +0 -1
  250. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts +0 -5
  251. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.d.ts.map +0 -1
  252. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js +0 -68
  253. package/out/src/services/chaintracker/chaintracks/createDefaultNoDbChaintracksOptions.js.map +0 -1
  254. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts +0 -13
  255. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.d.ts.map +0 -1
  256. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js +0 -27
  257. package/out/src/services/chaintracker/chaintracks/createIdbChaintracks.js.map +0 -1
  258. package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts +0 -13
  259. package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.d.ts.map +0 -1
  260. package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.js +0 -27
  261. package/out/src/services/chaintracker/chaintracks/createNoDbChaintracks.js.map +0 -1
  262. package/out/src/services/chaintracker/chaintracks/index.client.d.ts +0 -4
  263. package/out/src/services/chaintracker/chaintracks/index.client.d.ts.map +0 -1
  264. package/out/src/services/chaintracker/chaintracks/index.client.js +0 -20
  265. package/out/src/services/chaintracker/chaintracks/index.client.js.map +0 -1
  266. package/out/src/services/chaintracker/chaintracks/index.mobile.d.ts +0 -30
  267. package/out/src/services/chaintracker/chaintracks/index.mobile.d.ts.map +0 -1
  268. package/out/src/services/chaintracker/chaintracks/index.mobile.js +0 -68
  269. package/out/src/services/chaintracker/chaintracks/index.mobile.js.map +0 -1
  270. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts +0 -155
  271. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.d.ts.map +0 -1
  272. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js +0 -848
  273. package/out/src/services/chaintracker/chaintracks/util/BulkFileDataManager.js.map +0 -1
  274. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts +0 -78
  275. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.d.ts.map +0 -1
  276. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js +0 -261
  277. package/out/src/services/chaintracker/chaintracks/util/BulkFilesReader.js.map +0 -1
  278. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts +0 -129
  279. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.d.ts.map +0 -1
  280. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js +0 -145
  281. package/out/src/services/chaintracker/chaintracks/util/BulkHeaderFile.js.map +0 -1
  282. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts +0 -14
  283. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.d.ts.map +0 -1
  284. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js +0 -67
  285. package/out/src/services/chaintracker/chaintracks/util/ChaintracksFetch.js.map +0 -1
  286. package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts +0 -90
  287. package/out/src/services/chaintracker/chaintracks/util/HeightRange.d.ts.map +0 -1
  288. package/out/src/services/chaintracker/chaintracks/util/HeightRange.js +0 -140
  289. package/out/src/services/chaintracker/chaintracks/util/HeightRange.js.map +0 -1
  290. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts +0 -14
  291. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.d.ts.map +0 -1
  292. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js +0 -88
  293. package/out/src/services/chaintracker/chaintracks/util/SingleWriterMultiReaderLock.js.map +0 -1
  294. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts +0 -159
  295. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.d.ts.map +0 -1
  296. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js +0 -520
  297. package/out/src/services/chaintracker/chaintracks/util/blockHeaderUtilities.js.map +0 -1
  298. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts +0 -20
  299. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.d.ts.map +0 -1
  300. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js +0 -31
  301. package/out/src/services/chaintracker/chaintracks/util/dirtyHashes.js.map +0 -1
  302. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts +0 -37
  303. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.d.ts.map +0 -1
  304. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js +0 -432
  305. package/out/src/services/chaintracker/chaintracks/util/validBulkHeaderFilesByFileHash.js.map +0 -1
  306. package/out/src/services/chaintracker/index.client.d.ts +0 -4
  307. package/out/src/services/chaintracker/index.client.d.ts.map +0 -1
  308. package/out/src/services/chaintracker/index.client.js +0 -20
  309. package/out/src/services/chaintracker/index.client.js.map +0 -1
  310. package/out/src/services/createDefaultWalletServicesOptions.d.ts +0 -7
  311. package/out/src/services/createDefaultWalletServicesOptions.d.ts.map +0 -1
  312. package/out/src/services/createDefaultWalletServicesOptions.js +0 -65
  313. package/out/src/services/createDefaultWalletServicesOptions.js.map +0 -1
  314. package/out/src/services/providers/ARC.d.ts +0 -92
  315. package/out/src/services/providers/ARC.d.ts.map +0 -1
  316. package/out/src/services/providers/ARC.js +0 -270
  317. package/out/src/services/providers/ARC.js.map +0 -1
  318. package/out/src/services/providers/Bitails.d.ts +0 -50
  319. package/out/src/services/providers/Bitails.d.ts.map +0 -1
  320. package/out/src/services/providers/Bitails.js +0 -224
  321. package/out/src/services/providers/Bitails.js.map +0 -1
  322. package/out/src/services/providers/SdkWhatsOnChain.d.ts +0 -21
  323. package/out/src/services/providers/SdkWhatsOnChain.d.ts.map +0 -1
  324. package/out/src/services/providers/SdkWhatsOnChain.js +0 -67
  325. package/out/src/services/providers/SdkWhatsOnChain.js.map +0 -1
  326. package/out/src/services/providers/WhatsOnChain.d.ts +0 -130
  327. package/out/src/services/providers/WhatsOnChain.d.ts.map +0 -1
  328. package/out/src/services/providers/WhatsOnChain.js +0 -679
  329. package/out/src/services/providers/WhatsOnChain.js.map +0 -1
  330. package/out/src/services/providers/exchangeRates.d.ts +0 -12
  331. package/out/src/services/providers/exchangeRates.d.ts.map +0 -1
  332. package/out/src/services/providers/exchangeRates.js +0 -237
  333. package/out/src/services/providers/exchangeRates.js.map +0 -1
  334. package/out/src/services/providers/getBeefForTxid.d.ts +0 -4
  335. package/out/src/services/providers/getBeefForTxid.d.ts.map +0 -1
  336. package/out/src/services/providers/getBeefForTxid.js +0 -286
  337. package/out/src/services/providers/getBeefForTxid.js.map +0 -1
  338. package/out/src/signer/WalletSigner.d.ts +0 -11
  339. package/out/src/signer/WalletSigner.d.ts.map +0 -1
  340. package/out/src/signer/WalletSigner.js +0 -13
  341. package/out/src/signer/WalletSigner.js.map +0 -1
  342. package/out/src/signer/methods/acquireDirectCertificate.d.ts +0 -5
  343. package/out/src/signer/methods/acquireDirectCertificate.d.ts.map +0 -1
  344. package/out/src/signer/methods/acquireDirectCertificate.js +0 -45
  345. package/out/src/signer/methods/acquireDirectCertificate.js.map +0 -1
  346. package/out/src/signer/methods/buildSignableTransaction.d.ts +0 -15
  347. package/out/src/signer/methods/buildSignableTransaction.d.ts.map +0 -1
  348. package/out/src/signer/methods/buildSignableTransaction.js +0 -142
  349. package/out/src/signer/methods/buildSignableTransaction.js.map +0 -1
  350. package/out/src/signer/methods/completeSignedTransaction.d.ts +0 -10
  351. package/out/src/signer/methods/completeSignedTransaction.d.ts.map +0 -1
  352. package/out/src/signer/methods/completeSignedTransaction.js +0 -106
  353. package/out/src/signer/methods/completeSignedTransaction.js.map +0 -1
  354. package/out/src/signer/methods/createAction.d.ts +0 -14
  355. package/out/src/signer/methods/createAction.d.ts.map +0 -1
  356. package/out/src/signer/methods/createAction.js +0 -117
  357. package/out/src/signer/methods/createAction.js.map +0 -1
  358. package/out/src/signer/methods/internalizeAction.d.ts +0 -32
  359. package/out/src/signer/methods/internalizeAction.d.ts.map +0 -1
  360. package/out/src/signer/methods/internalizeAction.js +0 -93
  361. package/out/src/signer/methods/internalizeAction.js.map +0 -1
  362. package/out/src/signer/methods/proveCertificate.d.ts +0 -5
  363. package/out/src/signer/methods/proveCertificate.d.ts.map +0 -1
  364. package/out/src/signer/methods/proveCertificate.js +0 -29
  365. package/out/src/signer/methods/proveCertificate.js.map +0 -1
  366. package/out/src/signer/methods/signAction.d.ts +0 -11
  367. package/out/src/signer/methods/signAction.d.ts.map +0 -1
  368. package/out/src/signer/methods/signAction.js +0 -41
  369. package/out/src/signer/methods/signAction.js.map +0 -1
  370. package/out/src/storage/StorageIdb.d.ts +0 -210
  371. package/out/src/storage/StorageIdb.d.ts.map +0 -1
  372. package/out/src/storage/StorageIdb.js +0 -2297
  373. package/out/src/storage/StorageIdb.js.map +0 -1
  374. package/out/src/storage/StorageProvider.d.ts +0 -222
  375. package/out/src/storage/StorageProvider.d.ts.map +0 -1
  376. package/out/src/storage/StorageProvider.js +0 -567
  377. package/out/src/storage/StorageProvider.js.map +0 -1
  378. package/out/src/storage/StorageReader.d.ts +0 -77
  379. package/out/src/storage/StorageReader.d.ts.map +0 -1
  380. package/out/src/storage/StorageReader.js +0 -163
  381. package/out/src/storage/StorageReader.js.map +0 -1
  382. package/out/src/storage/StorageReaderWriter.d.ts +0 -102
  383. package/out/src/storage/StorageReaderWriter.d.ts.map +0 -1
  384. package/out/src/storage/StorageReaderWriter.js +0 -338
  385. package/out/src/storage/StorageReaderWriter.js.map +0 -1
  386. package/out/src/storage/StorageSyncReader.d.ts +0 -18
  387. package/out/src/storage/StorageSyncReader.d.ts.map +0 -1
  388. package/out/src/storage/StorageSyncReader.js +0 -71
  389. package/out/src/storage/StorageSyncReader.js.map +0 -1
  390. package/out/src/storage/WalletStorageManager.d.ts +0 -221
  391. package/out/src/storage/WalletStorageManager.d.ts.map +0 -1
  392. package/out/src/storage/WalletStorageManager.js +0 -819
  393. package/out/src/storage/WalletStorageManager.js.map +0 -1
  394. package/out/src/storage/index.client.d.ts +0 -8
  395. package/out/src/storage/index.client.d.ts.map +0 -1
  396. package/out/src/storage/index.client.js +0 -24
  397. package/out/src/storage/index.client.js.map +0 -1
  398. package/out/src/storage/methods/ListActionsSpecOp.d.ts +0 -18
  399. package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +0 -1
  400. package/out/src/storage/methods/ListActionsSpecOp.js +0 -40
  401. package/out/src/storage/methods/ListActionsSpecOp.js.map +0 -1
  402. package/out/src/storage/methods/ListOutputsSpecOp.d.ts +0 -26
  403. package/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +0 -1
  404. package/out/src/storage/methods/ListOutputsSpecOp.js +0 -73
  405. package/out/src/storage/methods/ListOutputsSpecOp.js.map +0 -1
  406. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +0 -41
  407. package/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +0 -1
  408. package/out/src/storage/methods/attemptToPostReqsToNetwork.js +0 -324
  409. package/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +0 -1
  410. package/out/src/storage/methods/createAction.d.ts +0 -13
  411. package/out/src/storage/methods/createAction.d.ts.map +0 -1
  412. package/out/src/storage/methods/createAction.js +0 -732
  413. package/out/src/storage/methods/createAction.js.map +0 -1
  414. package/out/src/storage/methods/generateChange.d.ts +0 -96
  415. package/out/src/storage/methods/generateChange.d.ts.map +0 -1
  416. package/out/src/storage/methods/generateChange.js +0 -405
  417. package/out/src/storage/methods/generateChange.js.map +0 -1
  418. package/out/src/storage/methods/getBeefForTransaction.d.ts +0 -23
  419. package/out/src/storage/methods/getBeefForTransaction.d.ts.map +0 -1
  420. package/out/src/storage/methods/getBeefForTransaction.js +0 -109
  421. package/out/src/storage/methods/getBeefForTransaction.js.map +0 -1
  422. package/out/src/storage/methods/getSyncChunk.d.ts +0 -10
  423. package/out/src/storage/methods/getSyncChunk.d.ts.map +0 -1
  424. package/out/src/storage/methods/getSyncChunk.js +0 -272
  425. package/out/src/storage/methods/getSyncChunk.js.map +0 -1
  426. package/out/src/storage/methods/internalizeAction.d.ts +0 -31
  427. package/out/src/storage/methods/internalizeAction.d.ts.map +0 -1
  428. package/out/src/storage/methods/internalizeAction.js +0 -462
  429. package/out/src/storage/methods/internalizeAction.js.map +0 -1
  430. package/out/src/storage/methods/listActionsIdb.d.ts +0 -5
  431. package/out/src/storage/methods/listActionsIdb.d.ts.map +0 -1
  432. package/out/src/storage/methods/listActionsIdb.js +0 -155
  433. package/out/src/storage/methods/listActionsIdb.js.map +0 -1
  434. package/out/src/storage/methods/listCertificates.d.ts +0 -5
  435. package/out/src/storage/methods/listCertificates.d.ts.map +0 -1
  436. package/out/src/storage/methods/listCertificates.js +0 -68
  437. package/out/src/storage/methods/listCertificates.js.map +0 -1
  438. package/out/src/storage/methods/listOutputsIdb.d.ts +0 -5
  439. package/out/src/storage/methods/listOutputsIdb.d.ts.map +0 -1
  440. package/out/src/storage/methods/listOutputsIdb.js +0 -185
  441. package/out/src/storage/methods/listOutputsIdb.js.map +0 -1
  442. package/out/src/storage/methods/offsetKey.d.ts +0 -24
  443. package/out/src/storage/methods/offsetKey.d.ts.map +0 -1
  444. package/out/src/storage/methods/offsetKey.js +0 -67
  445. package/out/src/storage/methods/offsetKey.js.map +0 -1
  446. package/out/src/storage/methods/processAction.d.ts +0 -54
  447. package/out/src/storage/methods/processAction.d.ts.map +0 -1
  448. package/out/src/storage/methods/processAction.js +0 -267
  449. package/out/src/storage/methods/processAction.js.map +0 -1
  450. package/out/src/storage/methods/purgeDataIdb.d.ts +0 -4
  451. package/out/src/storage/methods/purgeDataIdb.d.ts.map +0 -1
  452. package/out/src/storage/methods/purgeDataIdb.js +0 -9
  453. package/out/src/storage/methods/purgeDataIdb.js.map +0 -1
  454. package/out/src/storage/methods/reviewStatusIdb.d.ts +0 -20
  455. package/out/src/storage/methods/reviewStatusIdb.d.ts.map +0 -1
  456. package/out/src/storage/methods/reviewStatusIdb.js +0 -35
  457. package/out/src/storage/methods/reviewStatusIdb.js.map +0 -1
  458. package/out/src/storage/methods/utils.d.ts +0 -25
  459. package/out/src/storage/methods/utils.d.ts.map +0 -1
  460. package/out/src/storage/methods/utils.js +0 -53
  461. package/out/src/storage/methods/utils.js.map +0 -1
  462. package/out/src/storage/remoting/StorageClient.d.ts +0 -292
  463. package/out/src/storage/remoting/StorageClient.d.ts.map +0 -1
  464. package/out/src/storage/remoting/StorageClient.js +0 -497
  465. package/out/src/storage/remoting/StorageClient.js.map +0 -1
  466. package/out/src/storage/schema/StorageIdbSchema.d.ts +0 -133
  467. package/out/src/storage/schema/StorageIdbSchema.d.ts.map +0 -1
  468. package/out/src/storage/schema/StorageIdbSchema.js +0 -3
  469. package/out/src/storage/schema/StorageIdbSchema.js.map +0 -1
  470. package/out/src/storage/schema/entities/EntityBase.d.ts +0 -106
  471. package/out/src/storage/schema/entities/EntityBase.d.ts.map +0 -1
  472. package/out/src/storage/schema/entities/EntityBase.js +0 -100
  473. package/out/src/storage/schema/entities/EntityBase.js.map +0 -1
  474. package/out/src/storage/schema/entities/EntityCertificate.d.ts +0 -44
  475. package/out/src/storage/schema/entities/EntityCertificate.d.ts.map +0 -1
  476. package/out/src/storage/schema/entities/EntityCertificate.js +0 -162
  477. package/out/src/storage/schema/entities/EntityCertificate.js.map +0 -1
  478. package/out/src/storage/schema/entities/EntityCertificateField.d.ts +0 -33
  479. package/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +0 -1
  480. package/out/src/storage/schema/entities/EntityCertificateField.js +0 -112
  481. package/out/src/storage/schema/entities/EntityCertificateField.js.map +0 -1
  482. package/out/src/storage/schema/entities/EntityCommission.d.ts +0 -38
  483. package/out/src/storage/schema/entities/EntityCommission.d.ts.map +0 -1
  484. package/out/src/storage/schema/entities/EntityCommission.js +0 -127
  485. package/out/src/storage/schema/entities/EntityCommission.js.map +0 -1
  486. package/out/src/storage/schema/entities/EntityOutput.d.ts +0 -68
  487. package/out/src/storage/schema/entities/EntityOutput.d.ts.map +0 -1
  488. package/out/src/storage/schema/entities/EntityOutput.js +0 -264
  489. package/out/src/storage/schema/entities/EntityOutput.js.map +0 -1
  490. package/out/src/storage/schema/entities/EntityOutputBasket.d.ts +0 -36
  491. package/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +0 -1
  492. package/out/src/storage/schema/entities/EntityOutputBasket.js +0 -133
  493. package/out/src/storage/schema/entities/EntityOutputBasket.js.map +0 -1
  494. package/out/src/storage/schema/entities/EntityOutputTag.d.ts +0 -32
  495. package/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +0 -1
  496. package/out/src/storage/schema/entities/EntityOutputTag.js +0 -104
  497. package/out/src/storage/schema/entities/EntityOutputTag.js.map +0 -1
  498. package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts +0 -29
  499. package/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +0 -1
  500. package/out/src/storage/schema/entities/EntityOutputTagMap.js +0 -98
  501. package/out/src/storage/schema/entities/EntityOutputTagMap.js.map +0 -1
  502. package/out/src/storage/schema/entities/EntityProvenTx.d.ts +0 -87
  503. package/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +0 -1
  504. package/out/src/storage/schema/entities/EntityProvenTx.js +0 -278
  505. package/out/src/storage/schema/entities/EntityProvenTx.js.map +0 -1
  506. package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +0 -139
  507. package/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +0 -1
  508. package/out/src/storage/schema/entities/EntityProvenTxReq.js +0 -524
  509. package/out/src/storage/schema/entities/EntityProvenTxReq.js.map +0 -1
  510. package/out/src/storage/schema/entities/EntitySyncState.d.ts +0 -69
  511. package/out/src/storage/schema/entities/EntitySyncState.d.ts.map +0 -1
  512. package/out/src/storage/schema/entities/EntitySyncState.js +0 -334
  513. package/out/src/storage/schema/entities/EntitySyncState.js.map +0 -1
  514. package/out/src/storage/schema/entities/EntityTransaction.d.ts +0 -71
  515. package/out/src/storage/schema/entities/EntityTransaction.d.ts.map +0 -1
  516. package/out/src/storage/schema/entities/EntityTransaction.js +0 -255
  517. package/out/src/storage/schema/entities/EntityTransaction.js.map +0 -1
  518. package/out/src/storage/schema/entities/EntityTxLabel.d.ts +0 -32
  519. package/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +0 -1
  520. package/out/src/storage/schema/entities/EntityTxLabel.js +0 -104
  521. package/out/src/storage/schema/entities/EntityTxLabel.js.map +0 -1
  522. package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts +0 -29
  523. package/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +0 -1
  524. package/out/src/storage/schema/entities/EntityTxLabelMap.js +0 -98
  525. package/out/src/storage/schema/entities/EntityTxLabelMap.js.map +0 -1
  526. package/out/src/storage/schema/entities/EntityUser.d.ts +0 -30
  527. package/out/src/storage/schema/entities/EntityUser.d.ts.map +0 -1
  528. package/out/src/storage/schema/entities/EntityUser.js +0 -99
  529. package/out/src/storage/schema/entities/EntityUser.js.map +0 -1
  530. package/out/src/storage/schema/entities/MergeEntity.d.ts +0 -34
  531. package/out/src/storage/schema/entities/MergeEntity.d.ts.map +0 -1
  532. package/out/src/storage/schema/entities/MergeEntity.js +0 -63
  533. package/out/src/storage/schema/entities/MergeEntity.js.map +0 -1
  534. package/out/src/storage/schema/entities/index.d.ts +0 -17
  535. package/out/src/storage/schema/entities/index.d.ts.map +0 -1
  536. package/out/src/storage/schema/entities/index.js +0 -33
  537. package/out/src/storage/schema/entities/index.js.map +0 -1
  538. package/out/src/storage/schema/tables/TableCertificate.d.ts +0 -20
  539. package/out/src/storage/schema/tables/TableCertificate.d.ts.map +0 -1
  540. package/out/src/storage/schema/tables/TableCertificate.js +0 -3
  541. package/out/src/storage/schema/tables/TableCertificate.js.map +0 -1
  542. package/out/src/storage/schema/tables/TableCertificateField.d.ts +0 -12
  543. package/out/src/storage/schema/tables/TableCertificateField.d.ts.map +0 -1
  544. package/out/src/storage/schema/tables/TableCertificateField.js +0 -3
  545. package/out/src/storage/schema/tables/TableCertificateField.js.map +0 -1
  546. package/out/src/storage/schema/tables/TableCommission.d.ts +0 -13
  547. package/out/src/storage/schema/tables/TableCommission.d.ts.map +0 -1
  548. package/out/src/storage/schema/tables/TableCommission.js +0 -3
  549. package/out/src/storage/schema/tables/TableCommission.js.map +0 -1
  550. package/out/src/storage/schema/tables/TableMonitorEvent.d.ts +0 -9
  551. package/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +0 -1
  552. package/out/src/storage/schema/tables/TableMonitorEvent.js +0 -3
  553. package/out/src/storage/schema/tables/TableMonitorEvent.js.map +0 -1
  554. package/out/src/storage/schema/tables/TableOutput.d.ts +0 -36
  555. package/out/src/storage/schema/tables/TableOutput.d.ts.map +0 -1
  556. package/out/src/storage/schema/tables/TableOutput.js +0 -31
  557. package/out/src/storage/schema/tables/TableOutput.js.map +0 -1
  558. package/out/src/storage/schema/tables/TableOutputBasket.d.ts +0 -12
  559. package/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +0 -1
  560. package/out/src/storage/schema/tables/TableOutputBasket.js +0 -3
  561. package/out/src/storage/schema/tables/TableOutputBasket.js.map +0 -1
  562. package/out/src/storage/schema/tables/TableOutputTag.d.ts +0 -10
  563. package/out/src/storage/schema/tables/TableOutputTag.d.ts.map +0 -1
  564. package/out/src/storage/schema/tables/TableOutputTag.js +0 -3
  565. package/out/src/storage/schema/tables/TableOutputTag.js.map +0 -1
  566. package/out/src/storage/schema/tables/TableOutputTagMap.d.ts +0 -9
  567. package/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +0 -1
  568. package/out/src/storage/schema/tables/TableOutputTagMap.js +0 -3
  569. package/out/src/storage/schema/tables/TableOutputTagMap.js.map +0 -1
  570. package/out/src/storage/schema/tables/TableProvenTx.d.ts +0 -14
  571. package/out/src/storage/schema/tables/TableProvenTx.d.ts.map +0 -1
  572. package/out/src/storage/schema/tables/TableProvenTx.js +0 -3
  573. package/out/src/storage/schema/tables/TableProvenTx.js.map +0 -1
  574. package/out/src/storage/schema/tables/TableProvenTxReq.d.ts +0 -64
  575. package/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +0 -1
  576. package/out/src/storage/schema/tables/TableProvenTxReq.js +0 -3
  577. package/out/src/storage/schema/tables/TableProvenTxReq.js.map +0 -1
  578. package/out/src/storage/schema/tables/TableSettings.d.ts +0 -17
  579. package/out/src/storage/schema/tables/TableSettings.d.ts.map +0 -1
  580. package/out/src/storage/schema/tables/TableSettings.js +0 -3
  581. package/out/src/storage/schema/tables/TableSettings.js.map +0 -1
  582. package/out/src/storage/schema/tables/TableSyncState.d.ts +0 -18
  583. package/out/src/storage/schema/tables/TableSyncState.d.ts.map +0 -1
  584. package/out/src/storage/schema/tables/TableSyncState.js +0 -3
  585. package/out/src/storage/schema/tables/TableSyncState.js.map +0 -1
  586. package/out/src/storage/schema/tables/TableTransaction.d.ts +0 -37
  587. package/out/src/storage/schema/tables/TableTransaction.d.ts.map +0 -1
  588. package/out/src/storage/schema/tables/TableTransaction.js +0 -21
  589. package/out/src/storage/schema/tables/TableTransaction.js.map +0 -1
  590. package/out/src/storage/schema/tables/TableTxLabel.d.ts +0 -10
  591. package/out/src/storage/schema/tables/TableTxLabel.d.ts.map +0 -1
  592. package/out/src/storage/schema/tables/TableTxLabel.js +0 -3
  593. package/out/src/storage/schema/tables/TableTxLabel.js.map +0 -1
  594. package/out/src/storage/schema/tables/TableTxLabelMap.d.ts +0 -9
  595. package/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +0 -1
  596. package/out/src/storage/schema/tables/TableTxLabelMap.js +0 -3
  597. package/out/src/storage/schema/tables/TableTxLabelMap.js.map +0 -1
  598. package/out/src/storage/schema/tables/TableUser.d.ts +0 -16
  599. package/out/src/storage/schema/tables/TableUser.d.ts.map +0 -1
  600. package/out/src/storage/schema/tables/TableUser.js +0 -3
  601. package/out/src/storage/schema/tables/TableUser.js.map +0 -1
  602. package/out/src/storage/schema/tables/index.d.ts +0 -17
  603. package/out/src/storage/schema/tables/index.d.ts.map +0 -1
  604. package/out/src/storage/schema/tables/index.js +0 -33
  605. package/out/src/storage/schema/tables/index.js.map +0 -1
  606. package/out/src/utility/ReaderUint8Array.d.ts +0 -28
  607. package/out/src/utility/ReaderUint8Array.d.ts.map +0 -1
  608. package/out/src/utility/ReaderUint8Array.js +0 -166
  609. package/out/src/utility/ReaderUint8Array.js.map +0 -1
  610. package/out/src/utility/ScriptTemplateBRC29.d.ts +0 -25
  611. package/out/src/utility/ScriptTemplateBRC29.d.ts.map +0 -1
  612. package/out/src/utility/ScriptTemplateBRC29.js +0 -48
  613. package/out/src/utility/ScriptTemplateBRC29.js.map +0 -1
  614. package/out/src/utility/aggregateResults.d.ts +0 -8
  615. package/out/src/utility/aggregateResults.d.ts.map +0 -1
  616. package/out/src/utility/aggregateResults.js +0 -59
  617. package/out/src/utility/aggregateResults.js.map +0 -1
  618. package/out/src/utility/identityUtils.d.ts +0 -31
  619. package/out/src/utility/identityUtils.d.ts.map +0 -1
  620. package/out/src/utility/identityUtils.js +0 -116
  621. package/out/src/utility/identityUtils.js.map +0 -1
  622. package/out/src/utility/index.client.d.ts +0 -7
  623. package/out/src/utility/index.client.d.ts.map +0 -1
  624. package/out/src/utility/index.client.js +0 -23
  625. package/out/src/utility/index.client.js.map +0 -1
  626. package/out/src/utility/parseTxScriptOffsets.d.ts +0 -14
  627. package/out/src/utility/parseTxScriptOffsets.d.ts.map +0 -1
  628. package/out/src/utility/parseTxScriptOffsets.js +0 -26
  629. package/out/src/utility/parseTxScriptOffsets.js.map +0 -1
  630. package/out/src/utility/stampLog.d.ts +0 -18
  631. package/out/src/utility/stampLog.d.ts.map +0 -1
  632. package/out/src/utility/stampLog.js +0 -72
  633. package/out/src/utility/stampLog.js.map +0 -1
  634. package/out/src/utility/tscProofToMerklePath.d.ts +0 -8
  635. package/out/src/utility/tscProofToMerklePath.d.ts.map +0 -1
  636. package/out/src/utility/tscProofToMerklePath.js +0 -41
  637. package/out/src/utility/tscProofToMerklePath.js.map +0 -1
  638. package/out/src/utility/utilityHelpers.d.ts +0 -138
  639. package/out/src/utility/utilityHelpers.d.ts.map +0 -1
  640. package/out/src/utility/utilityHelpers.js +0 -294
  641. package/out/src/utility/utilityHelpers.js.map +0 -1
  642. package/out/src/utility/utilityHelpers.noBuffer.d.ts +0 -26
  643. package/out/src/utility/utilityHelpers.noBuffer.d.ts.map +0 -1
  644. package/out/src/utility/utilityHelpers.noBuffer.js +0 -64
  645. package/out/src/utility/utilityHelpers.noBuffer.js.map +0 -1
  646. package/out/src/wab-client/WABClient.d.ts +0 -49
  647. package/out/src/wab-client/WABClient.d.ts.map +0 -1
  648. package/out/src/wab-client/WABClient.js +0 -80
  649. package/out/src/wab-client/WABClient.js.map +0 -1
  650. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +0 -34
  651. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +0 -1
  652. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +0 -16
  653. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +0 -1
  654. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.d.ts +0 -29
  655. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.d.ts.map +0 -1
  656. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.js +0 -70
  657. package/out/src/wab-client/auth-method-interactors/DevConsoleInteractor.js.map +0 -1
  658. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts +0 -7
  659. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts.map +0 -1
  660. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js +0 -36
  661. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js.map +0 -1
  662. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts +0 -28
  663. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts.map +0 -1
  664. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js +0 -69
  665. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js.map +0 -1
  666. package/out/tsconfig.client.tsbuildinfo +0 -1
@@ -1,1292 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CWIStyleWalletManager = exports.OverlayUMPTokenInteractor = exports.DEFAULT_PROFILE_ID = exports.PBKDF2_NUM_ROUNDS = void 0;
4
- const sdk_1 = require("@bsv/sdk");
5
- const PrivilegedKeyManager_1 = require("./sdk/PrivilegedKeyManager");
6
- /**
7
- * Number of rounds used in PBKDF2 for deriving password keys.
8
- */
9
- exports.PBKDF2_NUM_ROUNDS = 7777;
10
- /**
11
- * PBKDF-2 that prefers the browser / Node 20+ WebCrypto implementation and
12
- * silently falls back to the existing JS code.
13
- *
14
- * @param passwordBytes Raw password bytes.
15
- * @param salt Salt bytes.
16
- * @param iterations Number of rounds.
17
- * @param keyLen Desired key length in bytes.
18
- * @param hash Digest algorithm (default "sha512").
19
- * @returns Derived key bytes.
20
- */
21
- async function pbkdf2NativeOrJs(passwordBytes, salt, iterations, keyLen, hash = 'sha512') {
22
- var _a;
23
- // ----- fast-path: WebCrypto (both browser & recent Node expose globalThis.crypto.subtle)
24
- const subtle = (_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.crypto) === null || _a === void 0 ? void 0 : _a.subtle;
25
- if (subtle) {
26
- try {
27
- const baseKey = await subtle.importKey('raw', new Uint8Array(passwordBytes), { name: 'PBKDF2' },
28
- /*extractable*/ false, ['deriveBits']);
29
- const bits = await subtle.deriveBits({
30
- name: 'PBKDF2',
31
- salt: new Uint8Array(salt),
32
- iterations,
33
- hash: hash.toUpperCase()
34
- }, baseKey, keyLen * 8);
35
- return Array.from(new Uint8Array(bits));
36
- }
37
- catch (err) {
38
- //console.warn('[pbkdf2] WebCrypto path failed → falling back to JS implementation', err)
39
- /* fall through */
40
- }
41
- }
42
- // ----- slow-path: old JavaScript implementation
43
- return sdk_1.Hash.pbkdf2(passwordBytes, salt, iterations, keyLen, hash);
44
- }
45
- /**
46
- * Unique Identifier for the default profile (16 zero bytes).
47
- */
48
- exports.DEFAULT_PROFILE_ID = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
49
- /**
50
- * @class OverlayUMPTokenInteractor
51
- *
52
- * A concrete implementation of the UMPTokenInteractor interface that interacts
53
- * with Overlay Services and the UMP (User Management Protocol) topic. This class
54
- * is responsible for:
55
- *
56
- * 1) Locating UMP tokens via overlay lookups (ls_users).
57
- * 2) Creating and publishing new or updated UMP token outputs on-chain under
58
- * the "tm_users" topic.
59
- * 3) Consuming (spending) an old token if provided.
60
- */
61
- class OverlayUMPTokenInteractor {
62
- /**
63
- * Construct a new OverlayUMPTokenInteractor.
64
- *
65
- * @param resolver A LookupResolver instance for performing overlay queries (ls_users).
66
- * @param broadcaster A SHIPBroadcaster instance for sharing new or updated tokens across the `tm_users` overlay.
67
- */
68
- constructor(resolver = new sdk_1.LookupResolver(), broadcaster = new sdk_1.SHIPBroadcaster(['tm_users'])) {
69
- this.resolver = resolver;
70
- this.broadcaster = broadcaster;
71
- }
72
- /**
73
- * Finds a UMP token on-chain by the given presentation key hash, if it exists.
74
- * Uses the ls_users overlay service to perform the lookup.
75
- *
76
- * @param hash The 32-byte SHA-256 hash of the presentation key.
77
- * @returns A UMPToken object (including currentOutpoint) if found, otherwise undefined.
78
- */
79
- async findByPresentationKeyHash(hash) {
80
- // Query ls_users for the given presentationHash
81
- const question = {
82
- service: 'ls_users',
83
- query: { presentationHash: sdk_1.Utils.toHex(hash) }
84
- };
85
- const answer = await this.resolver.query(question);
86
- return this.parseLookupAnswer(answer);
87
- }
88
- /**
89
- * Finds a UMP token on-chain by the given recovery key hash, if it exists.
90
- * Uses the ls_users overlay service to perform the lookup.
91
- *
92
- * @param hash The 32-byte SHA-256 hash of the recovery key.
93
- * @returns A UMPToken object (including currentOutpoint) if found, otherwise undefined.
94
- */
95
- async findByRecoveryKeyHash(hash) {
96
- const question = {
97
- service: 'ls_users',
98
- query: { recoveryHash: sdk_1.Utils.toHex(hash) }
99
- };
100
- const answer = await this.resolver.query(question);
101
- return this.parseLookupAnswer(answer);
102
- }
103
- /**
104
- * Creates or updates (replaces) a UMP token on-chain. If `oldTokenToConsume` is provided,
105
- * it is spent in the same transaction that creates the new token output. The new token is
106
- * then broadcast and published under the `tm_users` topic using a SHIP broadcast, ensuring
107
- * overlay participants see the updated token.
108
- *
109
- * @param wallet The wallet used to build and sign the transaction (MUST be operating under the DEFAULT profile).
110
- * @param adminOriginator The domain/FQDN of the administrative originator (wallet operator).
111
- * @param token The new UMPToken to create on-chain.
112
- * @param oldTokenToConsume Optionally, an existing token to consume/spend in the same transaction.
113
- * @returns The outpoint of the newly created UMP token (e.g. "abcd1234...ef.0").
114
- */
115
- async buildAndSend(wallet, // This wallet MUST be the one built for the default profile
116
- adminOriginator, token, oldTokenToConsume) {
117
- // 1) Construct the data fields for the new UMP token.
118
- const fields = [];
119
- fields[0] = token.passwordSalt;
120
- fields[1] = token.passwordPresentationPrimary;
121
- fields[2] = token.passwordRecoveryPrimary;
122
- fields[3] = token.presentationRecoveryPrimary;
123
- fields[4] = token.passwordPrimaryPrivileged;
124
- fields[5] = token.presentationRecoveryPrivileged;
125
- fields[6] = token.presentationHash;
126
- fields[7] = token.recoveryHash;
127
- fields[8] = token.presentationKeyEncrypted;
128
- fields[9] = token.passwordKeyEncrypted;
129
- fields[10] = token.recoveryKeyEncrypted;
130
- // Optional field (11) for encrypted profiles
131
- if (token.profilesEncrypted) {
132
- fields[11] = token.profilesEncrypted;
133
- }
134
- // 2) Create a PushDrop script referencing these fields, locked with the admin key.
135
- const script = await new sdk_1.PushDrop(wallet, adminOriginator).lock(fields, [2, 'admin user management token'], // protocolID
136
- '1', // keyID
137
- 'self', // counterparty
138
- /*forSelf=*/ true,
139
- /*includeSignature=*/ true);
140
- // 3) Prepare the createAction call. If oldTokenToConsume is provided, gather the outpoint.
141
- const inputs = [];
142
- let inputToken;
143
- if (oldTokenToConsume === null || oldTokenToConsume === void 0 ? void 0 : oldTokenToConsume.currentOutpoint) {
144
- inputToken = await this.findByOutpoint(oldTokenToConsume.currentOutpoint);
145
- // If there is no token on the overlay, we can't consume it. Just start over with a new token.
146
- if (!inputToken) {
147
- oldTokenToConsume = undefined;
148
- // Otherwise, add the input
149
- }
150
- else {
151
- inputs.push({
152
- outpoint: oldTokenToConsume.currentOutpoint,
153
- unlockingScriptLength: 73, // typical signature length
154
- inputDescription: 'Consume old UMP token'
155
- });
156
- }
157
- }
158
- const outputs = [
159
- {
160
- lockingScript: script.toHex(),
161
- satoshis: 1,
162
- outputDescription: 'New UMP token output'
163
- }
164
- ];
165
- // 4) Build the partial transaction via createAction.
166
- let createResult;
167
- try {
168
- createResult = await wallet.createAction({
169
- description: oldTokenToConsume ? 'Renew UMP token (consume old, create new)' : 'Create new UMP token',
170
- inputs,
171
- outputs,
172
- inputBEEF: inputToken === null || inputToken === void 0 ? void 0 : inputToken.beef,
173
- options: {
174
- randomizeOutputs: false,
175
- acceptDelayedBroadcast: false
176
- }
177
- }, adminOriginator);
178
- }
179
- catch (e) {
180
- console.error('Error with UMP token update. Attempting a last-ditch effort to get a new one', e);
181
- createResult = await wallet.createAction({
182
- description: 'Recover UMP token',
183
- outputs,
184
- options: {
185
- randomizeOutputs: false,
186
- acceptDelayedBroadcast: false
187
- }
188
- }, adminOriginator);
189
- }
190
- // If the transaction is fully processed by the wallet
191
- if (!createResult.signableTransaction) {
192
- const finalTxid = createResult.txid || (createResult.tx ? sdk_1.Transaction.fromAtomicBEEF(createResult.tx).id('hex') : undefined);
193
- if (!finalTxid) {
194
- throw new Error('No signableTransaction and no final TX found.');
195
- }
196
- // Now broadcast to `tm_users` using SHIP
197
- const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(createResult.tx);
198
- const result = await this.broadcaster.broadcast(broadcastTx);
199
- console.log('BROADCAST RESULT', result);
200
- return `${finalTxid}.0`;
201
- }
202
- // 5) If oldTokenToConsume is present, we must sign the input referencing it.
203
- // (If there's no old token, there's nothing to sign for the input.)
204
- let finalTxid = '';
205
- const reference = createResult.signableTransaction.reference;
206
- const partialTx = sdk_1.Transaction.fromBEEF(createResult.signableTransaction.tx);
207
- if (oldTokenToConsume === null || oldTokenToConsume === void 0 ? void 0 : oldTokenToConsume.currentOutpoint) {
208
- // Unlock the old token with a matching PushDrop unlocker
209
- const unlocker = new sdk_1.PushDrop(wallet, adminOriginator).unlock([2, 'admin user management token'], '1', 'self');
210
- const unlockingScript = await unlocker.sign(partialTx, 0);
211
- // Provide it to the wallet
212
- const signResult = await wallet.signAction({
213
- reference,
214
- spends: {
215
- 0: {
216
- unlockingScript: unlockingScript.toHex()
217
- }
218
- }
219
- }, adminOriginator);
220
- finalTxid = signResult.txid || (signResult.tx ? sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex') : '');
221
- if (!finalTxid) {
222
- throw new Error('Could not finalize transaction for renewed UMP token.');
223
- }
224
- // 6) Broadcast to `tm_users`
225
- const finalAtomicTx = signResult.tx;
226
- if (!finalAtomicTx) {
227
- throw new Error('Final transaction data missing after signing renewed UMP token.');
228
- }
229
- const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(finalAtomicTx);
230
- const result = await this.broadcaster.broadcast(broadcastTx);
231
- console.log('BROADCAST RESULT', result);
232
- return `${finalTxid}.0`;
233
- }
234
- else {
235
- // Fallback for creating a new token (no input spending)
236
- const signResult = await wallet.signAction({ reference, spends: {} }, adminOriginator);
237
- finalTxid = signResult.txid || (signResult.tx ? sdk_1.Transaction.fromAtomicBEEF(signResult.tx).id('hex') : '');
238
- if (!finalTxid) {
239
- throw new Error('Failed to finalize new UMP token transaction.');
240
- }
241
- const finalAtomicTx = signResult.tx;
242
- if (!finalAtomicTx) {
243
- throw new Error('Final transaction data missing after signing new UMP token.');
244
- }
245
- const broadcastTx = sdk_1.Transaction.fromAtomicBEEF(finalAtomicTx);
246
- const result = await this.broadcaster.broadcast(broadcastTx);
247
- console.log('BROADCAST RESULT', result);
248
- return `${finalTxid}.0`;
249
- }
250
- }
251
- /**
252
- * Attempts to parse a LookupAnswer from the UMP lookup service. If successful,
253
- * extracts the token fields from the resulting transaction and constructs
254
- * a UMPToken object.
255
- *
256
- * @param answer The LookupAnswer returned by a query to ls_users.
257
- * @returns The parsed UMPToken or `undefined` if none found/decodable.
258
- */
259
- parseLookupAnswer(answer) {
260
- var _a;
261
- if (answer.type !== 'output-list') {
262
- return undefined;
263
- }
264
- if (!answer.outputs || answer.outputs.length === 0) {
265
- return undefined;
266
- }
267
- const { beef, outputIndex } = answer.outputs[0];
268
- try {
269
- const tx = sdk_1.Transaction.fromBEEF(beef);
270
- const outpoint = `${tx.id('hex')}.${outputIndex}`;
271
- const decoded = sdk_1.PushDrop.decode(tx.outputs[outputIndex].lockingScript);
272
- // Expecting 11 or more fields for UMP
273
- if (!decoded.fields || decoded.fields.length < 11) {
274
- console.warn(`Unexpected number of fields in UMP token: ${(_a = decoded.fields) === null || _a === void 0 ? void 0 : _a.length}`);
275
- return undefined;
276
- }
277
- // Build the UMP token from these fields, preserving outpoint
278
- const t = {
279
- // Order matches buildAndSend and serialize/deserialize
280
- passwordSalt: decoded.fields[0],
281
- passwordPresentationPrimary: decoded.fields[1],
282
- passwordRecoveryPrimary: decoded.fields[2],
283
- presentationRecoveryPrimary: decoded.fields[3],
284
- passwordPrimaryPrivileged: decoded.fields[4],
285
- presentationRecoveryPrivileged: decoded.fields[5],
286
- presentationHash: decoded.fields[6],
287
- recoveryHash: decoded.fields[7],
288
- presentationKeyEncrypted: decoded.fields[8],
289
- passwordKeyEncrypted: decoded.fields[9],
290
- recoveryKeyEncrypted: decoded.fields[10],
291
- profilesEncrypted: decoded.fields[12] ? decoded.fields[11] : undefined, // If there's a signature in field 12, use field 11
292
- currentOutpoint: outpoint
293
- };
294
- return t;
295
- }
296
- catch (e) {
297
- console.error('Failed to parse or decode UMP token:', e);
298
- return undefined;
299
- }
300
- }
301
- /**
302
- * Finds by outpoint for unlocking / spending previous tokens.
303
- * @param outpoint The outpoint we are searching by
304
- * @returns The result so that we can use it to unlock the transaction
305
- */
306
- async findByOutpoint(outpoint) {
307
- const results = await this.resolver.query({
308
- service: 'ls_users',
309
- query: {
310
- outpoint
311
- }
312
- });
313
- if (results.type !== 'output-list') {
314
- return undefined;
315
- }
316
- if (!results.outputs || !results.outputs.length) {
317
- return undefined;
318
- }
319
- return results.outputs[0];
320
- }
321
- }
322
- exports.OverlayUMPTokenInteractor = OverlayUMPTokenInteractor;
323
- /**
324
- * Manages a "CWI-style" wallet that uses a UMP token and a
325
- * multi-key authentication scheme (password, presentation key, and recovery key),
326
- * supporting multiple user profiles under a single account.
327
- */
328
- class CWIStyleWalletManager {
329
- /**
330
- * Constructs a new CWIStyleWalletManager.
331
- *
332
- * @param adminOriginator The domain name of the administrative originator.
333
- * @param walletBuilder A function that can build an underlying wallet instance for a profile.
334
- * @param interactor An instance of UMPTokenInteractor.
335
- * @param recoveryKeySaver A function to persist a new recovery key.
336
- * @param passwordRetriever A function to request the user's password.
337
- * @param newWalletFunder Optional function to fund a new wallet.
338
- * @param stateSnapshot Optional previously saved state snapshot.
339
- */
340
- constructor(adminOriginator, walletBuilder, interactor = new OverlayUMPTokenInteractor(), recoveryKeySaver, passwordRetriever, newWalletFunder, stateSnapshot) {
341
- /**
342
- * Current mode of authentication.
343
- */
344
- this.authenticationMode = 'presentation-key-and-password';
345
- /**
346
- * Indicates new user or existing user flow.
347
- */
348
- this.authenticationFlow = 'new-user';
349
- /**
350
- * The currently active profile ID (null or DEFAULT_PROFILE_ID means default profile).
351
- */
352
- this.activeProfileId = exports.DEFAULT_PROFILE_ID;
353
- /**
354
- * List of loaded non-default profiles.
355
- */
356
- this.profiles = [];
357
- this.adminOriginator = adminOriginator;
358
- this.walletBuilder = walletBuilder;
359
- this.UMPTokenInteractor = interactor;
360
- this.recoveryKeySaver = recoveryKeySaver;
361
- this.passwordRetriever = passwordRetriever;
362
- this.authenticated = false;
363
- this.newWalletFunder = newWalletFunder;
364
- // If a saved snapshot is provided, attempt to load it.
365
- // Note: loadSnapshot now returns a promise. We don't await it here,
366
- // as the constructor must be synchronous. The caller should check
367
- // `this.authenticated` after construction if a snapshot was provided.
368
- if (stateSnapshot) {
369
- this.loadSnapshot(stateSnapshot).catch(err => {
370
- console.error('Failed to load snapshot during construction:', err);
371
- // Clear potentially partially loaded state
372
- this.destroy();
373
- });
374
- }
375
- }
376
- // --- Authentication Methods ---
377
- /**
378
- * Provides the presentation key.
379
- */
380
- async providePresentationKey(key) {
381
- if (this.authenticated) {
382
- throw new Error('User is already authenticated');
383
- }
384
- if (this.authenticationMode === 'recovery-key-and-password') {
385
- throw new Error('Presentation key is not needed in this mode');
386
- }
387
- const hash = sdk_1.Hash.sha256(key);
388
- const token = await this.UMPTokenInteractor.findByPresentationKeyHash(hash);
389
- if (!token) {
390
- // No token found -> New user
391
- this.authenticationFlow = 'new-user';
392
- this.presentationKey = key;
393
- }
394
- else {
395
- // Found token -> existing user
396
- this.authenticationFlow = 'existing-user';
397
- this.presentationKey = key;
398
- this.currentUMPToken = token;
399
- }
400
- }
401
- /**
402
- * Provides the password.
403
- */
404
- async providePassword(password) {
405
- if (this.authenticated) {
406
- throw new Error('User is already authenticated');
407
- }
408
- if (this.authenticationMode === 'presentation-key-and-recovery-key') {
409
- throw new Error('Password is not needed in this mode');
410
- }
411
- if (this.authenticationFlow === 'existing-user') {
412
- // Existing user flow
413
- if (!this.currentUMPToken) {
414
- throw new Error('Provide presentation or recovery key first.');
415
- }
416
- const derivedPasswordKey = await pbkdf2NativeOrJs(sdk_1.Utils.toArray(password, 'utf8'), this.currentUMPToken.passwordSalt, exports.PBKDF2_NUM_ROUNDS, 32, 'sha512');
417
- let rootPrimaryKey;
418
- let rootPrivilegedKey; // Only needed for recovery mode
419
- if (this.authenticationMode === 'presentation-key-and-password') {
420
- if (!this.presentationKey)
421
- throw new Error('No presentation key found!');
422
- const xorKey = this.XOR(this.presentationKey, derivedPasswordKey);
423
- rootPrimaryKey = new sdk_1.SymmetricKey(xorKey).decrypt(this.currentUMPToken.passwordPresentationPrimary);
424
- }
425
- else {
426
- // 'recovery-key-and-password'
427
- if (!this.recoveryKey)
428
- throw new Error('No recovery key found!');
429
- const primaryDecryptionKey = this.XOR(this.recoveryKey, derivedPasswordKey);
430
- rootPrimaryKey = new sdk_1.SymmetricKey(primaryDecryptionKey).decrypt(this.currentUMPToken.passwordRecoveryPrimary);
431
- const privilegedDecryptionKey = this.XOR(rootPrimaryKey, derivedPasswordKey);
432
- rootPrivilegedKey = new sdk_1.SymmetricKey(privilegedDecryptionKey).decrypt(this.currentUMPToken.passwordPrimaryPrivileged);
433
- }
434
- // Build root infrastructure, load profiles, and switch to default profile initially
435
- await this.setupRootInfrastructure(rootPrimaryKey, rootPrivilegedKey);
436
- await this.switchProfile(this.activeProfileId);
437
- }
438
- else {
439
- // New user flow (only 'presentation-key-and-password')
440
- if (this.authenticationMode !== 'presentation-key-and-password') {
441
- throw new Error('New-user flow requires presentation key and password mode.');
442
- }
443
- if (!this.presentationKey) {
444
- throw new Error('No presentation key provided for new-user flow.');
445
- }
446
- // Generate new keys/salt
447
- const recoveryKey = (0, sdk_1.Random)(32);
448
- await this.recoveryKeySaver(recoveryKey);
449
- const passwordSalt = (0, sdk_1.Random)(32);
450
- const passwordKey = await pbkdf2NativeOrJs(sdk_1.Utils.toArray(password, 'utf8'), passwordSalt, exports.PBKDF2_NUM_ROUNDS, 32, 'sha512');
451
- const rootPrimaryKey = (0, sdk_1.Random)(32);
452
- const rootPrivilegedKey = (0, sdk_1.Random)(32);
453
- // Build XOR keys
454
- const presentationPassword = new sdk_1.SymmetricKey(this.XOR(this.presentationKey, passwordKey));
455
- const presentationRecovery = new sdk_1.SymmetricKey(this.XOR(this.presentationKey, recoveryKey));
456
- const recoveryPassword = new sdk_1.SymmetricKey(this.XOR(recoveryKey, passwordKey));
457
- const primaryPassword = new sdk_1.SymmetricKey(this.XOR(rootPrimaryKey, passwordKey));
458
- // Temp manager for encryption
459
- const tempPrivilegedKeyManager = new PrivilegedKeyManager_1.PrivilegedKeyManager(async () => new sdk_1.PrivateKey(rootPrivilegedKey));
460
- // Build new UMP token (no profiles initially)
461
- const newToken = {
462
- passwordSalt,
463
- passwordPresentationPrimary: presentationPassword.encrypt(rootPrimaryKey),
464
- passwordRecoveryPrimary: recoveryPassword.encrypt(rootPrimaryKey),
465
- presentationRecoveryPrimary: presentationRecovery.encrypt(rootPrimaryKey),
466
- passwordPrimaryPrivileged: primaryPassword.encrypt(rootPrivilegedKey),
467
- presentationRecoveryPrivileged: presentationRecovery.encrypt(rootPrivilegedKey),
468
- presentationHash: sdk_1.Hash.sha256(this.presentationKey),
469
- recoveryHash: sdk_1.Hash.sha256(recoveryKey),
470
- presentationKeyEncrypted: (await tempPrivilegedKeyManager.encrypt({
471
- plaintext: this.presentationKey,
472
- protocolID: [2, 'admin key wrapping'],
473
- keyID: '1'
474
- })).ciphertext,
475
- passwordKeyEncrypted: (await tempPrivilegedKeyManager.encrypt({
476
- plaintext: passwordKey,
477
- protocolID: [2, 'admin key wrapping'],
478
- keyID: '1'
479
- })).ciphertext,
480
- recoveryKeyEncrypted: (await tempPrivilegedKeyManager.encrypt({
481
- plaintext: recoveryKey,
482
- protocolID: [2, 'admin key wrapping'],
483
- keyID: '1'
484
- })).ciphertext,
485
- profilesEncrypted: undefined // No profiles yet
486
- };
487
- this.currentUMPToken = newToken;
488
- // Setup root infrastructure and switch to default profile
489
- await this.setupRootInfrastructure(rootPrimaryKey);
490
- await this.switchProfile(exports.DEFAULT_PROFILE_ID);
491
- // Fund the *default* wallet if funder provided
492
- if (this.newWalletFunder && this.underlying) {
493
- try {
494
- await this.newWalletFunder(this.presentationKey, this.underlying, this.adminOriginator);
495
- }
496
- catch (e) {
497
- console.error('Error funding new wallet:', e);
498
- // Decide if this should halt the process or just log
499
- }
500
- }
501
- // Publish the new UMP token *after* potentially funding
502
- // We need the default profile wallet to sign the UMP creation TX
503
- if (!this.underlying) {
504
- throw new Error('Default profile wallet not built before attempting to publish UMP token.');
505
- }
506
- this.currentUMPToken.currentOutpoint = await this.UMPTokenInteractor.buildAndSend(this.underlying, // Use the default profile wallet
507
- this.adminOriginator, newToken);
508
- }
509
- }
510
- /**
511
- * Provides the recovery key.
512
- */
513
- async provideRecoveryKey(recoveryKey) {
514
- if (this.authenticated) {
515
- throw new Error('Already authenticated');
516
- }
517
- if (this.authenticationFlow === 'new-user') {
518
- throw new Error('Do not submit recovery key in new-user flow');
519
- }
520
- if (this.authenticationMode === 'presentation-key-and-password') {
521
- throw new Error('No recovery key required in this mode');
522
- }
523
- else if (this.authenticationMode === 'recovery-key-and-password') {
524
- // Wait for password
525
- const hash = sdk_1.Hash.sha256(recoveryKey);
526
- const token = await this.UMPTokenInteractor.findByRecoveryKeyHash(hash);
527
- if (!token)
528
- throw new Error('No user found with this recovery key');
529
- this.recoveryKey = recoveryKey;
530
- this.currentUMPToken = token;
531
- }
532
- else {
533
- // 'presentation-key-and-recovery-key'
534
- if (!this.presentationKey)
535
- throw new Error('Provide the presentation key first');
536
- if (!this.currentUMPToken)
537
- throw new Error('Current UMP token not found');
538
- const xorKey = this.XOR(this.presentationKey, recoveryKey);
539
- const rootPrimaryKey = new sdk_1.SymmetricKey(xorKey).decrypt(this.currentUMPToken.presentationRecoveryPrimary);
540
- const rootPrivilegedKey = new sdk_1.SymmetricKey(xorKey).decrypt(this.currentUMPToken.presentationRecoveryPrivileged);
541
- // Build root infrastructure, load profiles, switch to default
542
- await this.setupRootInfrastructure(rootPrimaryKey, rootPrivilegedKey);
543
- await this.switchProfile(this.activeProfileId);
544
- }
545
- }
546
- // --- State Management Methods ---
547
- /**
548
- * Saves the current wallet state (root key, UMP token, active profile) into an encrypted snapshot.
549
- * Version 2 format: [1 byte version=2] + [32 byte snapshot key] + [16 byte activeProfileId] + [encrypted payload]
550
- * Encrypted Payload: [32 byte rootPrimaryKey] + [varint token length + serialized UMP token]
551
- *
552
- * @returns Encrypted snapshot bytes.
553
- */
554
- saveSnapshot() {
555
- if (!this.rootPrimaryKey || !this.currentUMPToken) {
556
- throw new Error('No root primary key or current UMP token set');
557
- }
558
- const snapshotKey = (0, sdk_1.Random)(32);
559
- const snapshotPreimageWriter = new sdk_1.Utils.Writer();
560
- // Write root primary key
561
- snapshotPreimageWriter.write(this.rootPrimaryKey);
562
- // Write serialized UMP token (must have outpoint)
563
- if (!this.currentUMPToken.currentOutpoint) {
564
- throw new Error('UMP token cannot be saved without a current outpoint.');
565
- }
566
- const serializedToken = this.serializeUMPToken(this.currentUMPToken);
567
- snapshotPreimageWriter.writeVarIntNum(serializedToken.length);
568
- snapshotPreimageWriter.write(serializedToken);
569
- // Encrypt the payload
570
- const snapshotPreimage = snapshotPreimageWriter.toArray();
571
- const snapshotPayload = new sdk_1.SymmetricKey(snapshotKey).encrypt(snapshotPreimage);
572
- // Build final snapshot (Version 2)
573
- const snapshotWriter = new sdk_1.Utils.Writer();
574
- snapshotWriter.writeUInt8(2); // Version
575
- snapshotWriter.write(snapshotKey);
576
- snapshotWriter.write(this.activeProfileId); // Active profile ID
577
- snapshotWriter.write(snapshotPayload); // Encrypted data
578
- return snapshotWriter.toArray();
579
- }
580
- /**
581
- * Loads a previously saved state snapshot. Restores root key, UMP token, profiles, and active profile.
582
- * Handles Version 1 (legacy) and Version 2 formats.
583
- *
584
- * @param snapshot Encrypted snapshot bytes.
585
- */
586
- async loadSnapshot(snapshot) {
587
- try {
588
- const reader = new sdk_1.Utils.Reader(snapshot);
589
- const version = reader.readUInt8();
590
- let snapshotKey;
591
- let encryptedPayload;
592
- let activeProfileId = exports.DEFAULT_PROFILE_ID; // Default for V1
593
- if (version === 1) {
594
- snapshotKey = reader.read(32);
595
- encryptedPayload = reader.read();
596
- }
597
- else if (version === 2) {
598
- snapshotKey = reader.read(32);
599
- activeProfileId = reader.read(16); // Read active profile ID
600
- encryptedPayload = reader.read();
601
- }
602
- else {
603
- throw new Error(`Unsupported snapshot version: ${version}`);
604
- }
605
- // Decrypt payload
606
- const decryptedPayload = new sdk_1.SymmetricKey(snapshotKey).decrypt(encryptedPayload);
607
- const payloadReader = new sdk_1.Utils.Reader(decryptedPayload);
608
- // Read root primary key
609
- const rootPrimaryKey = payloadReader.read(32);
610
- // Read serialized UMP token
611
- const tokenLen = payloadReader.readVarIntNum();
612
- const tokenBytes = payloadReader.read(tokenLen);
613
- const token = this.deserializeUMPToken(tokenBytes);
614
- // Assign loaded data
615
- this.currentUMPToken = token;
616
- // Setup root infrastructure, load profiles, and switch to the loaded active profile
617
- await this.setupRootInfrastructure(rootPrimaryKey); // Will automatically load profiles
618
- await this.switchProfile(activeProfileId); // Switch to the profile saved in the snapshot
619
- this.authenticationFlow = 'existing-user'; // Loading implies existing user
620
- }
621
- catch (error) {
622
- this.destroy(); // Clear state on error
623
- throw new Error(`Failed to load snapshot: ${error.message}`);
624
- }
625
- }
626
- /**
627
- * Destroys the wallet state, clearing keys, tokens, and profiles.
628
- */
629
- destroy() {
630
- this.underlying = undefined;
631
- this.rootPrivilegedKeyManager = undefined;
632
- this.authenticated = false;
633
- this.rootPrimaryKey = undefined;
634
- this.currentUMPToken = undefined;
635
- this.presentationKey = undefined;
636
- this.recoveryKey = undefined;
637
- this.profiles = [];
638
- this.activeProfileId = exports.DEFAULT_PROFILE_ID;
639
- this.authenticationMode = 'presentation-key-and-password';
640
- this.authenticationFlow = 'new-user';
641
- }
642
- // --- Profile Management Methods ---
643
- /**
644
- * Lists all available profiles, including the default profile.
645
- * @returns Array of profile info objects, including an 'active' flag.
646
- */
647
- listProfiles() {
648
- if (!this.authenticated) {
649
- throw new Error('Not authenticated.');
650
- }
651
- const profileList = [
652
- // Default profile
653
- {
654
- id: exports.DEFAULT_PROFILE_ID,
655
- name: 'default',
656
- createdAt: null, // Default profile doesn't have a creation timestamp in the same way
657
- active: this.activeProfileId.every(x => x === 0),
658
- identityKey: new sdk_1.PrivateKey(this.rootPrimaryKey).toPublicKey().toString()
659
- },
660
- // Other profiles
661
- ...this.profiles.map(p => ({
662
- id: p.id,
663
- name: p.name,
664
- createdAt: p.createdAt,
665
- active: this.activeProfileId.every((x, i) => x === p.id[i]),
666
- identityKey: new sdk_1.PrivateKey(this.XOR(this.rootPrimaryKey, p.primaryPad)).toPublicKey().toString()
667
- }))
668
- ];
669
- return profileList;
670
- }
671
- /**
672
- * Adds a new profile with the given name.
673
- * Generates necessary pads and updates the UMP token.
674
- * Does not switch to the new profile automatically.
675
- *
676
- * @param name The desired name for the new profile.
677
- * @returns The ID of the newly created profile.
678
- */
679
- async addProfile(name) {
680
- if (!this.authenticated || !this.rootPrimaryKey || !this.currentUMPToken || !this.rootPrivilegedKeyManager) {
681
- throw new Error('Wallet not fully initialized or authenticated.');
682
- }
683
- // Ensure name is unique (including 'default')
684
- if (name === 'default' || this.profiles.some(p => p.name.toLowerCase() === name.toLowerCase())) {
685
- throw new Error(`Profile name "${name}" is already in use.`);
686
- }
687
- const newProfile = {
688
- name,
689
- id: (0, sdk_1.Random)(16),
690
- primaryPad: (0, sdk_1.Random)(32),
691
- privilegedPad: (0, sdk_1.Random)(32),
692
- createdAt: Math.floor(Date.now() / 1000)
693
- };
694
- this.profiles.push(newProfile);
695
- // Update the UMP token with the new profile list
696
- await this.updateAuthFactors(this.currentUMPToken.passwordSalt,
697
- // Need to re-derive/decrypt factors needed for re-encryption
698
- await this.getFactor('passwordKey'), await this.getFactor('presentationKey'), await this.getFactor('recoveryKey'), this.rootPrimaryKey, await this.getFactor('privilegedKey'), // Get ROOT privileged key
699
- this.profiles // Pass the updated profile list
700
- );
701
- return newProfile.id;
702
- }
703
- /**
704
- * Deletes a profile by its ID.
705
- * Cannot delete the default profile. If the active profile is deleted,
706
- * it switches back to the default profile.
707
- *
708
- * @param profileId The 16-byte ID of the profile to delete.
709
- */
710
- async deleteProfile(profileId) {
711
- if (!this.authenticated || !this.rootPrimaryKey || !this.currentUMPToken || !this.rootPrivilegedKeyManager) {
712
- throw new Error('Wallet not fully initialized or authenticated.');
713
- }
714
- if (profileId.every(x => x === 0)) {
715
- throw new Error('Cannot delete the default profile.');
716
- }
717
- const profileIndex = this.profiles.findIndex(p => p.id.every((x, i) => x === profileId[i]));
718
- if (profileIndex === -1) {
719
- throw new Error('Profile not found.');
720
- }
721
- // Remove the profile
722
- this.profiles.splice(profileIndex, 1);
723
- // If the deleted profile was active, switch to default
724
- if (this.activeProfileId.every((x, i) => x === profileId[i])) {
725
- await this.switchProfile(exports.DEFAULT_PROFILE_ID); // This rebuilds the wallet
726
- }
727
- // Update the UMP token
728
- await this.updateAuthFactors(this.currentUMPToken.passwordSalt, await this.getFactor('passwordKey'), await this.getFactor('presentationKey'), await this.getFactor('recoveryKey'), this.rootPrimaryKey, await this.getFactor('privilegedKey'), // Get ROOT privileged key
729
- this.profiles // Pass updated list
730
- );
731
- }
732
- /**
733
- * Switches the active profile. This re-derives keys and rebuilds the underlying wallet.
734
- *
735
- * @param profileId The 16-byte ID of the profile to switch to (use DEFAULT_PROFILE_ID for default).
736
- */
737
- async switchProfile(profileId) {
738
- if (!this.authenticated || !this.rootPrimaryKey || !this.rootPrivilegedKeyManager) {
739
- throw new Error('Cannot switch profile: Wallet not authenticated or root keys missing.');
740
- }
741
- let profilePrimaryKey;
742
- let profilePrivilegedPad; // Pad for the target profile
743
- if (profileId.every(x => x === 0)) {
744
- // Switching to default profile
745
- profilePrimaryKey = this.rootPrimaryKey;
746
- profilePrivilegedPad = undefined; // No pad for default
747
- this.activeProfileId = exports.DEFAULT_PROFILE_ID;
748
- }
749
- else {
750
- // Switching to a non-default profile
751
- const profile = this.profiles.find(p => p.id.every((x, i) => x === profileId[i]));
752
- if (!profile) {
753
- throw new Error('Profile not found.');
754
- }
755
- profilePrimaryKey = this.XOR(this.rootPrimaryKey, profile.primaryPad);
756
- profilePrivilegedPad = profile.privilegedPad;
757
- this.activeProfileId = profileId;
758
- }
759
- // Create a *profile-specific* PrivilegedKeyManager.
760
- // It uses the ROOT manager internally but applies the profile's pad.
761
- const profilePrivilegedKeyManager = new PrivilegedKeyManager_1.PrivilegedKeyManager(async (reason) => {
762
- // Request the ROOT privileged key using the root manager
763
- const rootPrivileged = await this.rootPrivilegedKeyManager.getPrivilegedKey(reason);
764
- const rootPrivilegedBytes = rootPrivileged.toArray();
765
- // Apply the profile's pad if applicable
766
- const profilePrivilegedBytes = profilePrivilegedPad
767
- ? this.XOR(rootPrivilegedBytes, profilePrivilegedPad)
768
- : rootPrivilegedBytes;
769
- return new sdk_1.PrivateKey(profilePrivilegedBytes);
770
- });
771
- // Build the underlying wallet for the specific profile
772
- this.underlying = await this.walletBuilder(profilePrimaryKey, profilePrivilegedKeyManager, // Pass the profile-specific manager
773
- this.activeProfileId // Pass the ID of the profile being activated
774
- );
775
- }
776
- // --- Key Management Methods ---
777
- /**
778
- * Changes the user's password. Re-wraps keys and updates the UMP token.
779
- */
780
- async changePassword(newPassword) {
781
- if (!this.authenticated || !this.currentUMPToken || !this.rootPrimaryKey || !this.rootPrivilegedKeyManager) {
782
- throw new Error('Not authenticated or missing required data.');
783
- }
784
- const passwordSalt = (0, sdk_1.Random)(32);
785
- const newPasswordKey = await pbkdf2NativeOrJs(sdk_1.Utils.toArray(newPassword, 'utf8'), passwordSalt, exports.PBKDF2_NUM_ROUNDS, 32, 'sha512');
786
- // Decrypt existing factors needed for re-encryption, using the *root* privileged key manager
787
- const recoveryKey = await this.getFactor('recoveryKey');
788
- const presentationKey = await this.getFactor('presentationKey');
789
- const rootPrivilegedKey = await this.getFactor('privilegedKey'); // Get ROOT privileged key
790
- await this.updateAuthFactors(passwordSalt, newPasswordKey, presentationKey, recoveryKey, this.rootPrimaryKey, rootPrivilegedKey, // Pass the explicitly fetched root key
791
- this.profiles // Preserve existing profiles
792
- );
793
- }
794
- /**
795
- * Retrieves the current recovery key. Requires privileged access.
796
- */
797
- async getRecoveryKey() {
798
- if (!this.authenticated || !this.currentUMPToken || !this.rootPrivilegedKeyManager) {
799
- throw new Error('Not authenticated or missing required data.');
800
- }
801
- return this.getFactor('recoveryKey');
802
- }
803
- /**
804
- * Changes the user's recovery key. Prompts user to save the new key.
805
- */
806
- async changeRecoveryKey() {
807
- if (!this.authenticated || !this.currentUMPToken || !this.rootPrimaryKey || !this.rootPrivilegedKeyManager) {
808
- throw new Error('Not authenticated or missing required data.');
809
- }
810
- // Decrypt existing factors needed
811
- const passwordKey = await this.getFactor('passwordKey');
812
- const presentationKey = await this.getFactor('presentationKey');
813
- const rootPrivilegedKey = await this.getFactor('privilegedKey'); // Get ROOT privileged key
814
- // Generate and save new recovery key
815
- const newRecoveryKey = (0, sdk_1.Random)(32);
816
- await this.recoveryKeySaver(newRecoveryKey);
817
- await this.updateAuthFactors(this.currentUMPToken.passwordSalt, passwordKey, presentationKey, newRecoveryKey, // Use the new key
818
- this.rootPrimaryKey, rootPrivilegedKey, this.profiles // Preserve profiles
819
- );
820
- }
821
- /**
822
- * Changes the user's presentation key.
823
- */
824
- async changePresentationKey(newPresentationKey) {
825
- if (!this.authenticated || !this.currentUMPToken || !this.rootPrimaryKey || !this.rootPrivilegedKeyManager) {
826
- throw new Error('Not authenticated or missing required data.');
827
- }
828
- if (newPresentationKey.length !== 32) {
829
- throw new Error('Presentation key must be 32 bytes.');
830
- }
831
- // Decrypt existing factors
832
- const recoveryKey = await this.getFactor('recoveryKey');
833
- const passwordKey = await this.getFactor('passwordKey');
834
- const rootPrivilegedKey = await this.getFactor('privilegedKey'); // Get ROOT privileged key
835
- await this.updateAuthFactors(this.currentUMPToken.passwordSalt, passwordKey, newPresentationKey, // Use the new key
836
- recoveryKey, this.rootPrimaryKey, rootPrivilegedKey, this.profiles // Preserve profiles
837
- );
838
- // Update the temporarily stored key if it was set
839
- if (this.presentationKey) {
840
- this.presentationKey = newPresentationKey;
841
- }
842
- }
843
- // --- Internal Helper Methods ---
844
- /**
845
- * Performs XOR operation on two byte arrays.
846
- */
847
- XOR(n1, n2) {
848
- if (n1.length !== n2.length) {
849
- // Provide more context in error
850
- throw new Error(`XOR length mismatch: ${n1.length} vs ${n2.length}`);
851
- }
852
- const r = new Array(n1.length);
853
- for (let i = 0; i < n1.length; i++) {
854
- r[i] = n1[i] ^ n2[i];
855
- }
856
- return r;
857
- }
858
- /**
859
- * Helper to decrypt a specific factor (key) stored encrypted in the UMP token.
860
- * Requires the root privileged key manager.
861
- * @param factorName Name of the factor to decrypt ('passwordKey', 'presentationKey', 'recoveryKey', 'privilegedKey').
862
- * @param getRoot If true and factorName is 'privilegedKey', returns the root privileged key bytes directly.
863
- * @returns The decrypted key bytes.
864
- */
865
- async getFactor(factorName) {
866
- if (!this.authenticated || !this.currentUMPToken || !this.rootPrivilegedKeyManager) {
867
- throw new Error(`Cannot get factor "${factorName}": Wallet not ready.`);
868
- }
869
- const protocolID = [2, 'admin key wrapping']; // Protocol used for encrypting factors
870
- const keyID = '1'; // Key ID used
871
- try {
872
- switch (factorName) {
873
- case 'passwordKey':
874
- return (await this.rootPrivilegedKeyManager.decrypt({
875
- ciphertext: this.currentUMPToken.passwordKeyEncrypted,
876
- protocolID,
877
- keyID
878
- })).plaintext;
879
- case 'presentationKey':
880
- return (await this.rootPrivilegedKeyManager.decrypt({
881
- ciphertext: this.currentUMPToken.presentationKeyEncrypted,
882
- protocolID,
883
- keyID
884
- })).plaintext;
885
- case 'recoveryKey':
886
- return (await this.rootPrivilegedKeyManager.decrypt({
887
- ciphertext: this.currentUMPToken.recoveryKeyEncrypted,
888
- protocolID,
889
- keyID
890
- })).plaintext;
891
- case 'privilegedKey': {
892
- // This needs careful handling based on whether the ROOT or PROFILE key is needed.
893
- // This helper is mostly used for UMP updates, which need the ROOT key.
894
- // We retrieve the PrivateKey object first.
895
- const pk = await this.rootPrivilegedKeyManager.getPrivilegedKey('UMP token update', true); // Force retrieval of root key
896
- return pk.toArray(); // Return bytes
897
- }
898
- default:
899
- throw new Error(`Unknown factor name: ${factorName}`);
900
- }
901
- }
902
- catch (error) {
903
- console.error(`Error decrypting factor ${factorName}:`, error);
904
- throw new Error(`Failed to decrypt factor "${factorName}": ${error.message}`);
905
- }
906
- }
907
- /**
908
- * Recomputes UMP token fields with updated factors and profiles, then publishes the update.
909
- * This operation requires the *root* privileged key and the *default* profile wallet.
910
- */
911
- async updateAuthFactors(passwordSalt, passwordKey, presentationKey, recoveryKey, rootPrimaryKey, rootPrivilegedKey, // Explicitly pass the root key bytes
912
- profiles // Pass current/new profiles list
913
- ) {
914
- if (!this.authenticated || !this.rootPrimaryKey || !this.currentUMPToken) {
915
- throw new Error('Wallet is not properly authenticated or missing data for update.');
916
- }
917
- // Ensure we have the OLD token to consume
918
- const oldTokenToConsume = { ...this.currentUMPToken };
919
- if (!oldTokenToConsume.currentOutpoint) {
920
- throw new Error('Cannot update UMP token: Old token has no outpoint.');
921
- }
922
- // Derive symmetrical encryption keys using XOR for the *root* keys
923
- const presentationPassword = new sdk_1.SymmetricKey(this.XOR(presentationKey, passwordKey));
924
- const presentationRecovery = new sdk_1.SymmetricKey(this.XOR(presentationKey, recoveryKey));
925
- const recoveryPassword = new sdk_1.SymmetricKey(this.XOR(recoveryKey, passwordKey));
926
- const primaryPassword = new sdk_1.SymmetricKey(this.XOR(rootPrimaryKey, passwordKey)); // Use rootPrimaryKey
927
- // Build a temporary privileged key manager using the explicit ROOT privileged key
928
- const tempRootPrivilegedKeyManager = new PrivilegedKeyManager_1.PrivilegedKeyManager(async () => new sdk_1.PrivateKey(rootPrivilegedKey));
929
- // Encrypt profiles if provided
930
- let profilesEncrypted;
931
- if (profiles && profiles.length > 0) {
932
- const profilesJson = JSON.stringify(profiles);
933
- const profilesBytes = sdk_1.Utils.toArray(profilesJson, 'utf8');
934
- profilesEncrypted = new sdk_1.SymmetricKey(rootPrimaryKey).encrypt(profilesBytes);
935
- }
936
- // Construct the new UMP token data
937
- const newTokenData = {
938
- passwordSalt,
939
- passwordPresentationPrimary: presentationPassword.encrypt(rootPrimaryKey),
940
- passwordRecoveryPrimary: recoveryPassword.encrypt(rootPrimaryKey),
941
- presentationRecoveryPrimary: presentationRecovery.encrypt(rootPrimaryKey),
942
- passwordPrimaryPrivileged: primaryPassword.encrypt(rootPrivilegedKey),
943
- presentationRecoveryPrivileged: presentationRecovery.encrypt(rootPrivilegedKey),
944
- presentationHash: sdk_1.Hash.sha256(presentationKey),
945
- recoveryHash: sdk_1.Hash.sha256(recoveryKey),
946
- presentationKeyEncrypted: (await tempRootPrivilegedKeyManager.encrypt({
947
- plaintext: presentationKey,
948
- protocolID: [2, 'admin key wrapping'],
949
- keyID: '1'
950
- })).ciphertext,
951
- passwordKeyEncrypted: (await tempRootPrivilegedKeyManager.encrypt({
952
- plaintext: passwordKey,
953
- protocolID: [2, 'admin key wrapping'],
954
- keyID: '1'
955
- })).ciphertext,
956
- recoveryKeyEncrypted: (await tempRootPrivilegedKeyManager.encrypt({
957
- plaintext: recoveryKey,
958
- protocolID: [2, 'admin key wrapping'],
959
- keyID: '1'
960
- })).ciphertext,
961
- profilesEncrypted // Add encrypted profiles
962
- // currentOutpoint will be set after publishing
963
- };
964
- // We need the wallet built for the DEFAULT profile to publish the UMP token.
965
- // If the current active profile is not default, temporarily switch, publish, then switch back.
966
- const currentActiveId = this.activeProfileId;
967
- let walletToUse = this.underlying;
968
- if (!currentActiveId.every(x => x === 0)) {
969
- console.log('Temporarily switching to default profile to update UMP token...');
970
- await this.switchProfile(exports.DEFAULT_PROFILE_ID); // This rebuilds this.underlying
971
- walletToUse = this.underlying;
972
- }
973
- if (!walletToUse) {
974
- throw new Error('Default profile wallet could not be activated for UMP token update.');
975
- }
976
- // Publish the new token on-chain, consuming the old one
977
- try {
978
- newTokenData.currentOutpoint = await this.UMPTokenInteractor.buildAndSend(walletToUse, this.adminOriginator, newTokenData, oldTokenToConsume // Consume the previous token
979
- );
980
- // Update the manager's state
981
- this.currentUMPToken = newTokenData;
982
- // Profiles are already updated in this.profiles if they were passed in
983
- }
984
- finally {
985
- // Switch back if we temporarily switched
986
- if (!currentActiveId.every(x => x === 0)) {
987
- console.log('Switching back to original profile...');
988
- await this.switchProfile(currentActiveId);
989
- }
990
- }
991
- }
992
- /**
993
- * Serializes a UMP token to binary format (Version 2 with optional profiles).
994
- * Layout: [1 byte version=2] + [11 * (varint len + bytes) for standard fields] + [1 byte profile_flag] + [IF flag=1 THEN varint len + profile bytes] + [varint len + outpoint bytes]
995
- */
996
- serializeUMPToken(token) {
997
- if (!token.currentOutpoint) {
998
- throw new Error('Token must have outpoint for serialization');
999
- }
1000
- const writer = new sdk_1.Utils.Writer();
1001
- writer.writeUInt8(2); // Version 2
1002
- const writeArray = (arr) => {
1003
- writer.writeVarIntNum(arr.length);
1004
- writer.write(arr);
1005
- };
1006
- // Write standard fields in specific order
1007
- writeArray(token.passwordSalt); // 0
1008
- writeArray(token.passwordPresentationPrimary); // 1
1009
- writeArray(token.passwordRecoveryPrimary); // 2
1010
- writeArray(token.presentationRecoveryPrimary); // 3
1011
- writeArray(token.passwordPrimaryPrivileged); // 4
1012
- writeArray(token.presentationRecoveryPrivileged); // 5
1013
- writeArray(token.presentationHash); // 6
1014
- writeArray(token.recoveryHash); // 7
1015
- writeArray(token.presentationKeyEncrypted); // 8
1016
- writeArray(token.passwordKeyEncrypted); // 9 - Swapped order vs original doc comment
1017
- writeArray(token.recoveryKeyEncrypted); // 10
1018
- // Write optional profiles field
1019
- if (token.profilesEncrypted && token.profilesEncrypted.length > 0) {
1020
- writer.writeUInt8(1); // Flag indicating profiles present
1021
- writeArray(token.profilesEncrypted);
1022
- }
1023
- else {
1024
- writer.writeUInt8(0); // Flag indicating no profiles
1025
- }
1026
- // Write outpoint string
1027
- const outpointBytes = sdk_1.Utils.toArray(token.currentOutpoint, 'utf8');
1028
- writer.writeVarIntNum(outpointBytes.length);
1029
- writer.write(outpointBytes);
1030
- return writer.toArray();
1031
- }
1032
- /**
1033
- * Deserializes a UMP token from binary format (Handles Version 1 and 2).
1034
- */
1035
- deserializeUMPToken(bin) {
1036
- const reader = new sdk_1.Utils.Reader(bin);
1037
- const version = reader.readUInt8();
1038
- if (version !== 1 && version !== 2) {
1039
- throw new Error(`Unsupported UMP token serialization version: ${version}`);
1040
- }
1041
- const readArray = () => {
1042
- const length = reader.readVarIntNum();
1043
- return reader.read(length);
1044
- };
1045
- // Read standard fields (order matches serialization V2)
1046
- const passwordSalt = readArray(); // 0
1047
- const passwordPresentationPrimary = readArray(); // 1
1048
- const passwordRecoveryPrimary = readArray(); // 2
1049
- const presentationRecoveryPrimary = readArray(); // 3
1050
- const passwordPrimaryPrivileged = readArray(); // 4
1051
- const presentationRecoveryPrivileged = readArray(); // 5
1052
- const presentationHash = readArray(); // 6
1053
- const recoveryHash = readArray(); // 7
1054
- const presentationKeyEncrypted = readArray(); // 8
1055
- const passwordKeyEncrypted = readArray(); // 9
1056
- const recoveryKeyEncrypted = readArray(); // 10
1057
- // Read optional profiles (only in V2)
1058
- let profilesEncrypted;
1059
- if (version === 2) {
1060
- const profilesFlag = reader.readUInt8();
1061
- if (profilesFlag === 1) {
1062
- profilesEncrypted = readArray();
1063
- }
1064
- }
1065
- // Read outpoint string
1066
- const outpointLen = reader.readVarIntNum();
1067
- const outpointBytes = reader.read(outpointLen);
1068
- const currentOutpoint = sdk_1.Utils.toUTF8(outpointBytes);
1069
- const token = {
1070
- passwordSalt,
1071
- passwordPresentationPrimary,
1072
- passwordRecoveryPrimary,
1073
- presentationRecoveryPrimary,
1074
- passwordPrimaryPrivileged,
1075
- presentationRecoveryPrivileged,
1076
- presentationHash,
1077
- recoveryHash,
1078
- presentationKeyEncrypted,
1079
- passwordKeyEncrypted, // Corrected order
1080
- recoveryKeyEncrypted,
1081
- profilesEncrypted, // May be undefined
1082
- currentOutpoint
1083
- };
1084
- return token;
1085
- }
1086
- /**
1087
- * Sets up the root key infrastructure after authentication or loading from snapshot.
1088
- * Initializes the root primary key, root privileged key manager, loads profiles,
1089
- * and sets the authenticated flag. Does NOT switch profile initially.
1090
- *
1091
- * @param rootPrimaryKey The user's root primary key (32 bytes).
1092
- * @param ephemeralRootPrivilegedKey Optional root privileged key (e.g., during recovery flows).
1093
- */
1094
- async setupRootInfrastructure(rootPrimaryKey, ephemeralRootPrivilegedKey) {
1095
- if (!this.currentUMPToken) {
1096
- throw new Error('A UMP token must exist before setting up root infrastructure!');
1097
- }
1098
- this.rootPrimaryKey = rootPrimaryKey;
1099
- // Store ephemeral key if provided, for one-time use by the manager
1100
- let oneTimePrivilegedKey = ephemeralRootPrivilegedKey
1101
- ? new sdk_1.PrivateKey(ephemeralRootPrivilegedKey)
1102
- : undefined;
1103
- // Create the ROOT PrivilegedKeyManager
1104
- this.rootPrivilegedKeyManager = new PrivilegedKeyManager_1.PrivilegedKeyManager(async (reason) => {
1105
- // 1. Use one-time key if available (for recovery)
1106
- if (oneTimePrivilegedKey) {
1107
- const tempKey = oneTimePrivilegedKey;
1108
- oneTimePrivilegedKey = undefined; // Consume it
1109
- return tempKey;
1110
- }
1111
- // 2. Otherwise, derive from password
1112
- const password = await this.passwordRetriever(reason, (passwordCandidate) => {
1113
- try {
1114
- const derivedPasswordKey = sdk_1.Hash.pbkdf2(sdk_1.Utils.toArray(passwordCandidate, 'utf8'), this.currentUMPToken.passwordSalt, exports.PBKDF2_NUM_ROUNDS, 32, 'sha512');
1115
- const privilegedDecryptor = this.XOR(this.rootPrimaryKey, derivedPasswordKey);
1116
- const decryptedPrivileged = new sdk_1.SymmetricKey(privilegedDecryptor).decrypt(this.currentUMPToken.passwordPrimaryPrivileged);
1117
- return !!decryptedPrivileged; // Test passes if decryption works
1118
- }
1119
- catch (e) {
1120
- return false;
1121
- }
1122
- });
1123
- // Decrypt the root privileged key using the confirmed password
1124
- const derivedPasswordKey = await pbkdf2NativeOrJs(sdk_1.Utils.toArray(password, 'utf8'), this.currentUMPToken.passwordSalt, exports.PBKDF2_NUM_ROUNDS, 32, 'sha512');
1125
- const privilegedDecryptor = this.XOR(this.rootPrimaryKey, derivedPasswordKey);
1126
- const rootPrivilegedBytes = new sdk_1.SymmetricKey(privilegedDecryptor).decrypt(this.currentUMPToken.passwordPrimaryPrivileged);
1127
- return new sdk_1.PrivateKey(rootPrivilegedBytes); // Return the ROOT key object
1128
- });
1129
- // Decrypt and load profiles if present in the token
1130
- this.profiles = []; // Clear existing profiles before loading
1131
- if (this.currentUMPToken.profilesEncrypted && this.currentUMPToken.profilesEncrypted.length > 0) {
1132
- try {
1133
- const decryptedProfileBytes = new sdk_1.SymmetricKey(rootPrimaryKey).decrypt(this.currentUMPToken.profilesEncrypted);
1134
- const profilesJson = sdk_1.Utils.toUTF8(decryptedProfileBytes);
1135
- this.profiles = JSON.parse(profilesJson);
1136
- }
1137
- catch (error) {
1138
- console.error('Failed to decrypt or parse profiles:', error);
1139
- // Decide if this should be fatal or just log and continue without profiles
1140
- this.profiles = []; // Ensure profiles are empty on error
1141
- // Optionally re-throw or handle more gracefully
1142
- throw new Error(`Failed to load profiles: ${error.message}`);
1143
- }
1144
- }
1145
- this.authenticated = true;
1146
- // Note: We don't call switchProfile here anymore.
1147
- // It's called by the auth methods (providePassword/provideRecoveryKey) or loadSnapshot after this.
1148
- }
1149
- /*
1150
- * ---------------------------------------------------------------------------------------
1151
- * Standard WalletInterface methods proxying to the *active* underlying wallet.
1152
- * Includes authentication checks and admin originator protection.
1153
- * ---------------------------------------------------------------------------------------
1154
- */
1155
- checkAuthAndUnderlying(originator) {
1156
- if (!this.authenticated) {
1157
- throw new Error('User is not authenticated.');
1158
- }
1159
- if (!this.underlying) {
1160
- // This might happen if authentication succeeded but profile switching failed
1161
- throw new Error('Underlying wallet for the active profile is not initialized.');
1162
- }
1163
- if (originator === this.adminOriginator) {
1164
- throw new Error('External applications are not allowed to use the admin originator.');
1165
- }
1166
- }
1167
- // Example proxy method (repeat pattern for all others)
1168
- async getPublicKey(args, originator) {
1169
- this.checkAuthAndUnderlying(originator);
1170
- return this.underlying.getPublicKey(args, originator);
1171
- }
1172
- async revealCounterpartyKeyLinkage(args, originator) {
1173
- this.checkAuthAndUnderlying(originator);
1174
- return this.underlying.revealCounterpartyKeyLinkage(args, originator);
1175
- }
1176
- async revealSpecificKeyLinkage(args, originator) {
1177
- this.checkAuthAndUnderlying(originator);
1178
- return this.underlying.revealSpecificKeyLinkage(args, originator);
1179
- }
1180
- async encrypt(args, originator) {
1181
- this.checkAuthAndUnderlying(originator);
1182
- return this.underlying.encrypt(args, originator);
1183
- }
1184
- async decrypt(args, originator) {
1185
- this.checkAuthAndUnderlying(originator);
1186
- return this.underlying.decrypt(args, originator);
1187
- }
1188
- async createHmac(args, originator) {
1189
- this.checkAuthAndUnderlying(originator);
1190
- return this.underlying.createHmac(args, originator);
1191
- }
1192
- async verifyHmac(args, originator) {
1193
- this.checkAuthAndUnderlying(originator);
1194
- return this.underlying.verifyHmac(args, originator);
1195
- }
1196
- async createSignature(args, originator) {
1197
- this.checkAuthAndUnderlying(originator);
1198
- return this.underlying.createSignature(args, originator);
1199
- }
1200
- async verifySignature(args, originator) {
1201
- this.checkAuthAndUnderlying(originator);
1202
- return this.underlying.verifySignature(args, originator);
1203
- }
1204
- async createAction(args, originator) {
1205
- this.checkAuthAndUnderlying(originator);
1206
- return this.underlying.createAction(args, originator);
1207
- }
1208
- async signAction(args, originator) {
1209
- this.checkAuthAndUnderlying(originator);
1210
- return this.underlying.signAction(args, originator);
1211
- }
1212
- async abortAction(args, originator) {
1213
- this.checkAuthAndUnderlying(originator);
1214
- return this.underlying.abortAction(args, originator);
1215
- }
1216
- async listActions(args, originator) {
1217
- this.checkAuthAndUnderlying(originator);
1218
- return this.underlying.listActions(args, originator);
1219
- }
1220
- async internalizeAction(args, originator) {
1221
- this.checkAuthAndUnderlying(originator);
1222
- return this.underlying.internalizeAction(args, originator);
1223
- }
1224
- async listOutputs(args, originator) {
1225
- this.checkAuthAndUnderlying(originator);
1226
- return this.underlying.listOutputs(args, originator);
1227
- }
1228
- async relinquishOutput(args, originator) {
1229
- this.checkAuthAndUnderlying(originator);
1230
- return this.underlying.relinquishOutput(args, originator);
1231
- }
1232
- async acquireCertificate(args, originator) {
1233
- this.checkAuthAndUnderlying(originator);
1234
- return this.underlying.acquireCertificate(args, originator);
1235
- }
1236
- async listCertificates(args, originator) {
1237
- this.checkAuthAndUnderlying(originator);
1238
- return this.underlying.listCertificates(args, originator);
1239
- }
1240
- async proveCertificate(args, originator) {
1241
- this.checkAuthAndUnderlying(originator);
1242
- return this.underlying.proveCertificate(args, originator);
1243
- }
1244
- async relinquishCertificate(args, originator) {
1245
- this.checkAuthAndUnderlying(originator);
1246
- return this.underlying.relinquishCertificate(args, originator);
1247
- }
1248
- async discoverByIdentityKey(args, originator) {
1249
- this.checkAuthAndUnderlying(originator);
1250
- return this.underlying.discoverByIdentityKey(args, originator);
1251
- }
1252
- async discoverByAttributes(args, originator) {
1253
- this.checkAuthAndUnderlying(originator);
1254
- return this.underlying.discoverByAttributes(args, originator);
1255
- }
1256
- async isAuthenticated(_, originator) {
1257
- if (!this.authenticated) {
1258
- throw new Error('User is not authenticated.');
1259
- }
1260
- if (originator === this.adminOriginator) {
1261
- throw new Error('External applications are not allowed to use the admin originator.');
1262
- }
1263
- return { authenticated: true };
1264
- }
1265
- async waitForAuthentication(_, originator) {
1266
- if (originator === this.adminOriginator) {
1267
- throw new Error('External applications are not allowed to use the admin originator.');
1268
- }
1269
- while (!this.authenticated || !this.underlying) {
1270
- await new Promise(resolve => setTimeout(resolve, 100));
1271
- }
1272
- return await this.underlying.waitForAuthentication({}, originator);
1273
- }
1274
- async getHeight(_, originator) {
1275
- this.checkAuthAndUnderlying(originator);
1276
- return this.underlying.getHeight({}, originator);
1277
- }
1278
- async getHeaderForHeight(args, originator) {
1279
- this.checkAuthAndUnderlying(originator);
1280
- return this.underlying.getHeaderForHeight(args, originator);
1281
- }
1282
- async getNetwork(_, originator) {
1283
- this.checkAuthAndUnderlying(originator);
1284
- return this.underlying.getNetwork({}, originator);
1285
- }
1286
- async getVersion(_, originator) {
1287
- this.checkAuthAndUnderlying(originator);
1288
- return this.underlying.getVersion({}, originator);
1289
- }
1290
- }
1291
- exports.CWIStyleWalletManager = CWIStyleWalletManager;
1292
- //# sourceMappingURL=CWIStyleWalletManager.js.map