@bsv/wallet-toolbox 1.3.21 → 1.3.22

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 (502) hide show
  1. package/mobile/out/src/CWIStyleWalletManager.d.ts +437 -0
  2. package/mobile/out/src/CWIStyleWalletManager.d.ts.map +1 -0
  3. package/mobile/out/src/CWIStyleWalletManager.js +1255 -0
  4. package/mobile/out/src/CWIStyleWalletManager.js.map +1 -0
  5. package/mobile/out/src/SetupClient.d.ts +126 -0
  6. package/mobile/out/src/SetupClient.d.ts.map +1 -0
  7. package/mobile/out/src/SetupClient.js +220 -0
  8. package/mobile/out/src/SetupClient.js.map +1 -0
  9. package/mobile/out/src/SetupWallet.d.ts +100 -0
  10. package/mobile/out/src/SetupWallet.d.ts.map +1 -0
  11. package/mobile/out/src/SetupWallet.js +3 -0
  12. package/mobile/out/src/SetupWallet.js.map +1 -0
  13. package/mobile/out/src/SimpleWalletManager.d.ts +169 -0
  14. package/mobile/out/src/SimpleWalletManager.d.ts.map +1 -0
  15. package/mobile/out/src/SimpleWalletManager.js +315 -0
  16. package/mobile/out/src/SimpleWalletManager.js.map +1 -0
  17. package/mobile/out/src/Wallet.d.ts +177 -0
  18. package/mobile/out/src/Wallet.d.ts.map +1 -0
  19. package/mobile/out/src/Wallet.js +742 -0
  20. package/mobile/out/src/Wallet.js.map +1 -0
  21. package/mobile/out/src/WalletAuthenticationManager.d.ts +33 -0
  22. package/mobile/out/src/WalletAuthenticationManager.d.ts.map +1 -0
  23. package/mobile/out/src/WalletAuthenticationManager.js +113 -0
  24. package/mobile/out/src/WalletAuthenticationManager.js.map +1 -0
  25. package/mobile/out/src/WalletPermissionsManager.d.ts +598 -0
  26. package/mobile/out/src/WalletPermissionsManager.d.ts.map +1 -0
  27. package/mobile/out/src/WalletPermissionsManager.js +1868 -0
  28. package/mobile/out/src/WalletPermissionsManager.js.map +1 -0
  29. package/mobile/out/src/WalletSettingsManager.d.ts +52 -0
  30. package/mobile/out/src/WalletSettingsManager.d.ts.map +1 -0
  31. package/mobile/out/src/WalletSettingsManager.js +82 -0
  32. package/mobile/out/src/WalletSettingsManager.js.map +1 -0
  33. package/mobile/out/src/index.client.d.ts +19 -0
  34. package/mobile/out/src/index.client.d.ts.map +1 -0
  35. package/mobile/out/src/index.client.js +58 -0
  36. package/mobile/out/src/index.client.js.map +1 -0
  37. package/mobile/out/src/index.mobile.d.ts +19 -0
  38. package/mobile/out/src/index.mobile.d.ts.map +1 -0
  39. package/mobile/out/src/index.mobile.js +58 -0
  40. package/mobile/out/src/index.mobile.js.map +1 -0
  41. package/mobile/out/src/monitor/Monitor.d.ts +91 -0
  42. package/mobile/out/src/monitor/Monitor.d.ts.map +1 -0
  43. package/mobile/out/src/monitor/Monitor.js +298 -0
  44. package/mobile/out/src/monitor/Monitor.js.map +1 -0
  45. package/mobile/out/src/monitor/tasks/TaskCheckForProofs.d.ts +53 -0
  46. package/mobile/out/src/monitor/tasks/TaskCheckForProofs.d.ts.map +1 -0
  47. package/mobile/out/src/monitor/tasks/TaskCheckForProofs.js +194 -0
  48. package/mobile/out/src/monitor/tasks/TaskCheckForProofs.js.map +1 -0
  49. package/mobile/out/src/monitor/tasks/TaskCheckNoSends.d.ts +33 -0
  50. package/mobile/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -0
  51. package/mobile/out/src/monitor/tasks/TaskCheckNoSends.js +65 -0
  52. package/mobile/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -0
  53. package/mobile/out/src/monitor/tasks/TaskClock.d.ts +14 -0
  54. package/mobile/out/src/monitor/tasks/TaskClock.d.ts.map +1 -0
  55. package/mobile/out/src/monitor/tasks/TaskClock.js +27 -0
  56. package/mobile/out/src/monitor/tasks/TaskClock.js.map +1 -0
  57. package/mobile/out/src/monitor/tasks/TaskFailAbandoned.d.ts +20 -0
  58. package/mobile/out/src/monitor/tasks/TaskFailAbandoned.d.ts.map +1 -0
  59. package/mobile/out/src/monitor/tasks/TaskFailAbandoned.js +52 -0
  60. package/mobile/out/src/monitor/tasks/TaskFailAbandoned.js.map +1 -0
  61. package/mobile/out/src/monitor/tasks/TaskNewHeader.d.ts +15 -0
  62. package/mobile/out/src/monitor/tasks/TaskNewHeader.d.ts.map +1 -0
  63. package/mobile/out/src/monitor/tasks/TaskNewHeader.js +43 -0
  64. package/mobile/out/src/monitor/tasks/TaskNewHeader.js.map +1 -0
  65. package/mobile/out/src/monitor/tasks/TaskPurge.d.ts +45 -0
  66. package/mobile/out/src/monitor/tasks/TaskPurge.d.ts.map +1 -0
  67. package/mobile/out/src/monitor/tasks/TaskPurge.js +34 -0
  68. package/mobile/out/src/monitor/tasks/TaskPurge.js.map +1 -0
  69. package/mobile/out/src/monitor/tasks/TaskReviewStatus.d.ts +26 -0
  70. package/mobile/out/src/monitor/tasks/TaskReviewStatus.d.ts.map +1 -0
  71. package/mobile/out/src/monitor/tasks/TaskReviewStatus.js +43 -0
  72. package/mobile/out/src/monitor/tasks/TaskReviewStatus.js.map +1 -0
  73. package/mobile/out/src/monitor/tasks/TaskSendWaiting.d.ts +35 -0
  74. package/mobile/out/src/monitor/tasks/TaskSendWaiting.d.ts.map +1 -0
  75. package/mobile/out/src/monitor/tasks/TaskSendWaiting.js +107 -0
  76. package/mobile/out/src/monitor/tasks/TaskSendWaiting.js.map +1 -0
  77. package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts +12 -0
  78. package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.d.ts.map +1 -0
  79. package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.js +22 -0
  80. package/mobile/out/src/monitor/tasks/TaskSyncWhenIdle.js.map +1 -0
  81. package/mobile/out/src/monitor/tasks/TaskUnFail.d.ts +41 -0
  82. package/mobile/out/src/monitor/tasks/TaskUnFail.d.ts.map +1 -0
  83. package/mobile/out/src/monitor/tasks/TaskUnFail.js +144 -0
  84. package/mobile/out/src/monitor/tasks/TaskUnFail.js.map +1 -0
  85. package/mobile/out/src/monitor/tasks/WalletMonitorTask.d.ts +40 -0
  86. package/mobile/out/src/monitor/tasks/WalletMonitorTask.d.ts.map +1 -0
  87. package/mobile/out/src/monitor/tasks/WalletMonitorTask.js +37 -0
  88. package/mobile/out/src/monitor/tasks/WalletMonitorTask.js.map +1 -0
  89. package/mobile/out/src/sdk/CertOpsWallet.d.ts +7 -0
  90. package/mobile/out/src/sdk/CertOpsWallet.d.ts.map +1 -0
  91. package/mobile/out/src/sdk/CertOpsWallet.js +3 -0
  92. package/mobile/out/src/sdk/CertOpsWallet.js.map +1 -0
  93. package/mobile/out/src/sdk/PrivilegedKeyManager.d.ts +125 -0
  94. package/mobile/out/src/sdk/PrivilegedKeyManager.d.ts.map +1 -0
  95. package/mobile/out/src/sdk/PrivilegedKeyManager.js +293 -0
  96. package/mobile/out/src/sdk/PrivilegedKeyManager.js.map +1 -0
  97. package/mobile/out/src/sdk/WERR_errors.d.ts +115 -0
  98. package/mobile/out/src/sdk/WERR_errors.d.ts.map +1 -0
  99. package/mobile/out/src/sdk/WERR_errors.js +158 -0
  100. package/mobile/out/src/sdk/WERR_errors.js.map +1 -0
  101. package/mobile/out/src/sdk/WalletError.d.ts +44 -0
  102. package/mobile/out/src/sdk/WalletError.d.ts.map +1 -0
  103. package/mobile/out/src/sdk/WalletError.js +118 -0
  104. package/mobile/out/src/sdk/WalletError.js.map +1 -0
  105. package/mobile/out/src/sdk/WalletServices.interfaces.d.ts +430 -0
  106. package/mobile/out/src/sdk/WalletServices.interfaces.d.ts.map +1 -0
  107. package/mobile/out/src/sdk/WalletServices.interfaces.js +3 -0
  108. package/mobile/out/src/sdk/WalletServices.interfaces.js.map +1 -0
  109. package/mobile/out/src/sdk/WalletSigner.interfaces.d.ts +10 -0
  110. package/mobile/out/src/sdk/WalletSigner.interfaces.d.ts.map +1 -0
  111. package/mobile/out/src/sdk/WalletSigner.interfaces.js +3 -0
  112. package/mobile/out/src/sdk/WalletSigner.interfaces.js.map +1 -0
  113. package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts +452 -0
  114. package/mobile/out/src/sdk/WalletStorage.interfaces.d.ts.map +1 -0
  115. package/mobile/out/src/sdk/WalletStorage.interfaces.js +3 -0
  116. package/mobile/out/src/sdk/WalletStorage.interfaces.js.map +1 -0
  117. package/mobile/out/src/sdk/index.d.ts +10 -0
  118. package/mobile/out/src/sdk/index.d.ts.map +1 -0
  119. package/mobile/out/src/sdk/index.js +26 -0
  120. package/mobile/out/src/sdk/index.js.map +1 -0
  121. package/mobile/out/src/sdk/types.d.ts +158 -0
  122. package/mobile/out/src/sdk/types.d.ts.map +1 -0
  123. package/mobile/out/src/sdk/types.js +90 -0
  124. package/mobile/out/src/sdk/types.js.map +1 -0
  125. package/mobile/out/src/sdk/validationHelpers.d.ts +301 -0
  126. package/mobile/out/src/sdk/validationHelpers.d.ts.map +1 -0
  127. package/mobile/out/src/sdk/validationHelpers.js +629 -0
  128. package/mobile/out/src/sdk/validationHelpers.js.map +1 -0
  129. package/mobile/out/src/services/ServiceCollection.d.ts +25 -0
  130. package/mobile/out/src/services/ServiceCollection.d.ts.map +1 -0
  131. package/mobile/out/src/services/ServiceCollection.js +43 -0
  132. package/mobile/out/src/services/ServiceCollection.js.map +1 -0
  133. package/mobile/out/src/services/Services.d.ts +67 -0
  134. package/mobile/out/src/services/Services.d.ts.map +1 -0
  135. package/mobile/out/src/services/Services.js +391 -0
  136. package/mobile/out/src/services/Services.js.map +1 -0
  137. package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.d.ts +15 -0
  138. package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.d.ts.map +1 -0
  139. package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.js +51 -0
  140. package/mobile/out/src/services/chaintracker/ChaintracksChainTracker.js.map +1 -0
  141. package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts +98 -0
  142. package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.d.ts.map +1 -0
  143. package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js +38 -0
  144. package/mobile/out/src/services/chaintracker/chaintracks/BlockHeaderApi.js.map +1 -0
  145. package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts +36 -0
  146. package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.d.ts.map +1 -0
  147. package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js +128 -0
  148. package/mobile/out/src/services/chaintracker/chaintracks/ChaintracksServiceClient.js.map +1 -0
  149. package/mobile/out/src/services/chaintracker/chaintracks/index.d.ts +3 -0
  150. package/mobile/out/src/services/chaintracker/chaintracks/index.d.ts.map +1 -0
  151. package/mobile/out/src/services/chaintracker/chaintracks/index.js +19 -0
  152. package/mobile/out/src/services/chaintracker/chaintracks/index.js.map +1 -0
  153. package/mobile/out/src/services/chaintracker/index.d.ts +3 -0
  154. package/mobile/out/src/services/chaintracker/index.d.ts.map +1 -0
  155. package/mobile/out/src/services/chaintracker/index.js +19 -0
  156. package/mobile/out/src/services/chaintracker/index.js.map +1 -0
  157. package/mobile/out/src/services/createDefaultWalletServicesOptions.d.ts +4 -0
  158. package/mobile/out/src/services/createDefaultWalletServicesOptions.d.ts.map +1 -0
  159. package/mobile/out/src/services/createDefaultWalletServicesOptions.js +46 -0
  160. package/mobile/out/src/services/createDefaultWalletServicesOptions.js.map +1 -0
  161. package/mobile/out/src/services/index.d.ts +2 -0
  162. package/mobile/out/src/services/index.d.ts.map +1 -0
  163. package/mobile/out/src/services/index.js +18 -0
  164. package/mobile/out/src/services/index.js.map +1 -0
  165. package/mobile/out/src/services/providers/ARC.d.ts +91 -0
  166. package/mobile/out/src/services/providers/ARC.d.ts.map +1 -0
  167. package/mobile/out/src/services/providers/ARC.js +267 -0
  168. package/mobile/out/src/services/providers/ARC.js.map +1 -0
  169. package/mobile/out/src/services/providers/Bitails.d.ts +49 -0
  170. package/mobile/out/src/services/providers/Bitails.d.ts.map +1 -0
  171. package/mobile/out/src/services/providers/Bitails.js +222 -0
  172. package/mobile/out/src/services/providers/Bitails.js.map +1 -0
  173. package/mobile/out/src/services/providers/SdkWhatsOnChain.d.ts +21 -0
  174. package/mobile/out/src/services/providers/SdkWhatsOnChain.d.ts.map +1 -0
  175. package/mobile/out/src/services/providers/SdkWhatsOnChain.js +67 -0
  176. package/mobile/out/src/services/providers/SdkWhatsOnChain.js.map +1 -0
  177. package/mobile/out/src/services/providers/WhatsOnChain.d.ts +71 -0
  178. package/mobile/out/src/services/providers/WhatsOnChain.d.ts.map +1 -0
  179. package/mobile/out/src/services/providers/WhatsOnChain.js +582 -0
  180. package/mobile/out/src/services/providers/WhatsOnChain.js.map +1 -0
  181. package/mobile/out/src/services/providers/echangeRates.d.ts +12 -0
  182. package/mobile/out/src/services/providers/echangeRates.d.ts.map +1 -0
  183. package/mobile/out/src/services/providers/echangeRates.js +237 -0
  184. package/mobile/out/src/services/providers/echangeRates.js.map +1 -0
  185. package/mobile/out/src/services/providers/getBeefForTxid.d.ts +4 -0
  186. package/mobile/out/src/services/providers/getBeefForTxid.d.ts.map +1 -0
  187. package/mobile/out/src/services/providers/getBeefForTxid.js +286 -0
  188. package/mobile/out/src/services/providers/getBeefForTxid.js.map +1 -0
  189. package/mobile/out/src/signer/WalletSigner.d.ts +11 -0
  190. package/mobile/out/src/signer/WalletSigner.d.ts.map +1 -0
  191. package/mobile/out/src/signer/WalletSigner.js +13 -0
  192. package/mobile/out/src/signer/WalletSigner.js.map +1 -0
  193. package/mobile/out/src/signer/methods/acquireDirectCertificate.d.ts +4 -0
  194. package/mobile/out/src/signer/methods/acquireDirectCertificate.d.ts.map +1 -0
  195. package/mobile/out/src/signer/methods/acquireDirectCertificate.js +45 -0
  196. package/mobile/out/src/signer/methods/acquireDirectCertificate.js.map +1 -0
  197. package/mobile/out/src/signer/methods/buildSignableTransaction.d.ts +10 -0
  198. package/mobile/out/src/signer/methods/buildSignableTransaction.d.ts.map +1 -0
  199. package/mobile/out/src/signer/methods/buildSignableTransaction.js +126 -0
  200. package/mobile/out/src/signer/methods/buildSignableTransaction.js.map +1 -0
  201. package/mobile/out/src/signer/methods/createAction.d.ts +20 -0
  202. package/mobile/out/src/signer/methods/createAction.d.ts.map +1 -0
  203. package/mobile/out/src/signer/methods/createAction.js +160 -0
  204. package/mobile/out/src/signer/methods/createAction.js.map +1 -0
  205. package/mobile/out/src/signer/methods/internalizeAction.d.ts +31 -0
  206. package/mobile/out/src/signer/methods/internalizeAction.d.ts.map +1 -0
  207. package/mobile/out/src/signer/methods/internalizeAction.js +95 -0
  208. package/mobile/out/src/signer/methods/internalizeAction.js.map +1 -0
  209. package/mobile/out/src/signer/methods/proveCertificate.d.ts +4 -0
  210. package/mobile/out/src/signer/methods/proveCertificate.d.ts.map +1 -0
  211. package/mobile/out/src/signer/methods/proveCertificate.js +29 -0
  212. package/mobile/out/src/signer/methods/proveCertificate.js.map +1 -0
  213. package/mobile/out/src/signer/methods/signAction.d.ts +13 -0
  214. package/mobile/out/src/signer/methods/signAction.d.ts.map +1 -0
  215. package/mobile/out/src/signer/methods/signAction.js +89 -0
  216. package/mobile/out/src/signer/methods/signAction.js.map +1 -0
  217. package/mobile/out/src/storage/StorageIdb.d.ts +208 -0
  218. package/mobile/out/src/storage/StorageIdb.d.ts.map +1 -0
  219. package/mobile/out/src/storage/StorageIdb.js +2296 -0
  220. package/mobile/out/src/storage/StorageIdb.js.map +1 -0
  221. package/mobile/out/src/storage/StorageProvider.d.ts +209 -0
  222. package/mobile/out/src/storage/StorageProvider.d.ts.map +1 -0
  223. package/mobile/out/src/storage/StorageProvider.js +550 -0
  224. package/mobile/out/src/storage/StorageProvider.js.map +1 -0
  225. package/mobile/out/src/storage/StorageReader.d.ts +76 -0
  226. package/mobile/out/src/storage/StorageReader.d.ts.map +1 -0
  227. package/mobile/out/src/storage/StorageReader.js +129 -0
  228. package/mobile/out/src/storage/StorageReader.js.map +1 -0
  229. package/mobile/out/src/storage/StorageReaderWriter.d.ts +87 -0
  230. package/mobile/out/src/storage/StorageReaderWriter.d.ts.map +1 -0
  231. package/mobile/out/src/storage/StorageReaderWriter.js +338 -0
  232. package/mobile/out/src/storage/StorageReaderWriter.js.map +1 -0
  233. package/mobile/out/src/storage/StorageSyncReader.d.ts +17 -0
  234. package/mobile/out/src/storage/StorageSyncReader.d.ts.map +1 -0
  235. package/mobile/out/src/storage/StorageSyncReader.js +38 -0
  236. package/mobile/out/src/storage/StorageSyncReader.js.map +1 -0
  237. package/mobile/out/src/storage/WalletStorageManager.d.ts +184 -0
  238. package/mobile/out/src/storage/WalletStorageManager.d.ts.map +1 -0
  239. package/mobile/out/src/storage/WalletStorageManager.js +665 -0
  240. package/mobile/out/src/storage/WalletStorageManager.js.map +1 -0
  241. package/mobile/out/src/storage/index.client.d.ts +8 -0
  242. package/mobile/out/src/storage/index.client.d.ts.map +1 -0
  243. package/mobile/out/src/storage/index.client.js +24 -0
  244. package/mobile/out/src/storage/index.client.js.map +1 -0
  245. package/mobile/out/src/storage/index.mobile.d.ts +7 -0
  246. package/mobile/out/src/storage/index.mobile.d.ts.map +1 -0
  247. package/mobile/out/src/storage/index.mobile.js +23 -0
  248. package/mobile/out/src/storage/index.mobile.js.map +1 -0
  249. package/mobile/out/src/storage/methods/ListActionsSpecOp.d.ts +16 -0
  250. package/mobile/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -0
  251. package/mobile/out/src/storage/methods/ListActionsSpecOp.js +40 -0
  252. package/mobile/out/src/storage/methods/ListActionsSpecOp.js.map +1 -0
  253. package/mobile/out/src/storage/methods/ListOutputsSpecOp.d.ts +26 -0
  254. package/mobile/out/src/storage/methods/ListOutputsSpecOp.d.ts.map +1 -0
  255. package/mobile/out/src/storage/methods/ListOutputsSpecOp.js +71 -0
  256. package/mobile/out/src/storage/methods/ListOutputsSpecOp.js.map +1 -0
  257. package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts +41 -0
  258. package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.d.ts.map +1 -0
  259. package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.js +320 -0
  260. package/mobile/out/src/storage/methods/attemptToPostReqsToNetwork.js.map +1 -0
  261. package/mobile/out/src/storage/methods/createAction.d.ts +24 -0
  262. package/mobile/out/src/storage/methods/createAction.d.ts.map +1 -0
  263. package/mobile/out/src/storage/methods/createAction.js +705 -0
  264. package/mobile/out/src/storage/methods/createAction.js.map +1 -0
  265. package/mobile/out/src/storage/methods/generateChange.d.ts +119 -0
  266. package/mobile/out/src/storage/methods/generateChange.d.ts.map +1 -0
  267. package/mobile/out/src/storage/methods/generateChange.js +448 -0
  268. package/mobile/out/src/storage/methods/generateChange.js.map +1 -0
  269. package/mobile/out/src/storage/methods/getBeefForTransaction.d.ts +22 -0
  270. package/mobile/out/src/storage/methods/getBeefForTransaction.d.ts.map +1 -0
  271. package/mobile/out/src/storage/methods/getBeefForTransaction.js +92 -0
  272. package/mobile/out/src/storage/methods/getBeefForTransaction.js.map +1 -0
  273. package/mobile/out/src/storage/methods/getSyncChunk.d.ts +10 -0
  274. package/mobile/out/src/storage/methods/getSyncChunk.d.ts.map +1 -0
  275. package/mobile/out/src/storage/methods/getSyncChunk.js +271 -0
  276. package/mobile/out/src/storage/methods/getSyncChunk.js.map +1 -0
  277. package/mobile/out/src/storage/methods/internalizeAction.d.ts +38 -0
  278. package/mobile/out/src/storage/methods/internalizeAction.d.ts.map +1 -0
  279. package/mobile/out/src/storage/methods/internalizeAction.js +371 -0
  280. package/mobile/out/src/storage/methods/internalizeAction.js.map +1 -0
  281. package/mobile/out/src/storage/methods/listActionsIdb.d.ts +5 -0
  282. package/mobile/out/src/storage/methods/listActionsIdb.d.ts.map +1 -0
  283. package/mobile/out/src/storage/methods/listActionsIdb.js +155 -0
  284. package/mobile/out/src/storage/methods/listActionsIdb.js.map +1 -0
  285. package/mobile/out/src/storage/methods/listCertificates.d.ts +5 -0
  286. package/mobile/out/src/storage/methods/listCertificates.d.ts.map +1 -0
  287. package/mobile/out/src/storage/methods/listCertificates.js +68 -0
  288. package/mobile/out/src/storage/methods/listCertificates.js.map +1 -0
  289. package/mobile/out/src/storage/methods/listOutputsIdb.d.ts +5 -0
  290. package/mobile/out/src/storage/methods/listOutputsIdb.d.ts.map +1 -0
  291. package/mobile/out/src/storage/methods/listOutputsIdb.js +181 -0
  292. package/mobile/out/src/storage/methods/listOutputsIdb.js.map +1 -0
  293. package/mobile/out/src/storage/methods/processAction.d.ts +35 -0
  294. package/mobile/out/src/storage/methods/processAction.d.ts.map +1 -0
  295. package/mobile/out/src/storage/methods/processAction.js +311 -0
  296. package/mobile/out/src/storage/methods/processAction.js.map +1 -0
  297. package/mobile/out/src/storage/methods/purgeDataIdb.d.ts +4 -0
  298. package/mobile/out/src/storage/methods/purgeDataIdb.d.ts.map +1 -0
  299. package/mobile/out/src/storage/methods/purgeDataIdb.js +9 -0
  300. package/mobile/out/src/storage/methods/purgeDataIdb.js.map +1 -0
  301. package/mobile/out/src/storage/methods/reviewStatusIdb.d.ts +20 -0
  302. package/mobile/out/src/storage/methods/reviewStatusIdb.d.ts.map +1 -0
  303. package/mobile/out/src/storage/methods/reviewStatusIdb.js +35 -0
  304. package/mobile/out/src/storage/methods/reviewStatusIdb.js.map +1 -0
  305. package/mobile/out/src/storage/remoting/StorageClient.d.ts +283 -0
  306. package/mobile/out/src/storage/remoting/StorageClient.d.ts.map +1 -0
  307. package/mobile/out/src/storage/remoting/StorageClient.js +477 -0
  308. package/mobile/out/src/storage/remoting/StorageClient.js.map +1 -0
  309. package/mobile/out/src/storage/schema/StorageIdbSchema.d.ts +133 -0
  310. package/mobile/out/src/storage/schema/StorageIdbSchema.d.ts.map +1 -0
  311. package/mobile/out/src/storage/schema/StorageIdbSchema.js +3 -0
  312. package/mobile/out/src/storage/schema/StorageIdbSchema.js.map +1 -0
  313. package/mobile/out/src/storage/schema/entities/EntityBase.d.ts +105 -0
  314. package/mobile/out/src/storage/schema/entities/EntityBase.d.ts.map +1 -0
  315. package/mobile/out/src/storage/schema/entities/EntityBase.js +100 -0
  316. package/mobile/out/src/storage/schema/entities/EntityBase.js.map +1 -0
  317. package/mobile/out/src/storage/schema/entities/EntityCertificate.d.ts +43 -0
  318. package/mobile/out/src/storage/schema/entities/EntityCertificate.d.ts.map +1 -0
  319. package/mobile/out/src/storage/schema/entities/EntityCertificate.js +162 -0
  320. package/mobile/out/src/storage/schema/entities/EntityCertificate.js.map +1 -0
  321. package/mobile/out/src/storage/schema/entities/EntityCertificateField.d.ts +32 -0
  322. package/mobile/out/src/storage/schema/entities/EntityCertificateField.d.ts.map +1 -0
  323. package/mobile/out/src/storage/schema/entities/EntityCertificateField.js +111 -0
  324. package/mobile/out/src/storage/schema/entities/EntityCertificateField.js.map +1 -0
  325. package/mobile/out/src/storage/schema/entities/EntityCommission.d.ts +37 -0
  326. package/mobile/out/src/storage/schema/entities/EntityCommission.d.ts.map +1 -0
  327. package/mobile/out/src/storage/schema/entities/EntityCommission.js +127 -0
  328. package/mobile/out/src/storage/schema/entities/EntityCommission.js.map +1 -0
  329. package/mobile/out/src/storage/schema/entities/EntityOutput.d.ts +67 -0
  330. package/mobile/out/src/storage/schema/entities/EntityOutput.d.ts.map +1 -0
  331. package/mobile/out/src/storage/schema/entities/EntityOutput.js +264 -0
  332. package/mobile/out/src/storage/schema/entities/EntityOutput.js.map +1 -0
  333. package/mobile/out/src/storage/schema/entities/EntityOutputBasket.d.ts +35 -0
  334. package/mobile/out/src/storage/schema/entities/EntityOutputBasket.d.ts.map +1 -0
  335. package/mobile/out/src/storage/schema/entities/EntityOutputBasket.js +133 -0
  336. package/mobile/out/src/storage/schema/entities/EntityOutputBasket.js.map +1 -0
  337. package/mobile/out/src/storage/schema/entities/EntityOutputTag.d.ts +31 -0
  338. package/mobile/out/src/storage/schema/entities/EntityOutputTag.d.ts.map +1 -0
  339. package/mobile/out/src/storage/schema/entities/EntityOutputTag.js +104 -0
  340. package/mobile/out/src/storage/schema/entities/EntityOutputTag.js.map +1 -0
  341. package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.d.ts +28 -0
  342. package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.d.ts.map +1 -0
  343. package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.js +97 -0
  344. package/mobile/out/src/storage/schema/entities/EntityOutputTagMap.js.map +1 -0
  345. package/mobile/out/src/storage/schema/entities/EntityProvenTx.d.ts +84 -0
  346. package/mobile/out/src/storage/schema/entities/EntityProvenTx.d.ts.map +1 -0
  347. package/mobile/out/src/storage/schema/entities/EntityProvenTx.js +276 -0
  348. package/mobile/out/src/storage/schema/entities/EntityProvenTx.js.map +1 -0
  349. package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.d.ts +135 -0
  350. package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.d.ts.map +1 -0
  351. package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.js +522 -0
  352. package/mobile/out/src/storage/schema/entities/EntityProvenTxReq.js.map +1 -0
  353. package/mobile/out/src/storage/schema/entities/EntitySyncState.d.ts +67 -0
  354. package/mobile/out/src/storage/schema/entities/EntitySyncState.d.ts.map +1 -0
  355. package/mobile/out/src/storage/schema/entities/EntitySyncState.js +319 -0
  356. package/mobile/out/src/storage/schema/entities/EntitySyncState.js.map +1 -0
  357. package/mobile/out/src/storage/schema/entities/EntityTransaction.d.ts +67 -0
  358. package/mobile/out/src/storage/schema/entities/EntityTransaction.d.ts.map +1 -0
  359. package/mobile/out/src/storage/schema/entities/EntityTransaction.js +255 -0
  360. package/mobile/out/src/storage/schema/entities/EntityTransaction.js.map +1 -0
  361. package/mobile/out/src/storage/schema/entities/EntityTxLabel.d.ts +31 -0
  362. package/mobile/out/src/storage/schema/entities/EntityTxLabel.d.ts.map +1 -0
  363. package/mobile/out/src/storage/schema/entities/EntityTxLabel.js +104 -0
  364. package/mobile/out/src/storage/schema/entities/EntityTxLabel.js.map +1 -0
  365. package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.d.ts +28 -0
  366. package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.d.ts.map +1 -0
  367. package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.js +97 -0
  368. package/mobile/out/src/storage/schema/entities/EntityTxLabelMap.js.map +1 -0
  369. package/mobile/out/src/storage/schema/entities/EntityUser.d.ts +29 -0
  370. package/mobile/out/src/storage/schema/entities/EntityUser.d.ts.map +1 -0
  371. package/mobile/out/src/storage/schema/entities/EntityUser.js +98 -0
  372. package/mobile/out/src/storage/schema/entities/EntityUser.js.map +1 -0
  373. package/mobile/out/src/storage/schema/entities/MergeEntity.d.ts +33 -0
  374. package/mobile/out/src/storage/schema/entities/MergeEntity.d.ts.map +1 -0
  375. package/mobile/out/src/storage/schema/entities/MergeEntity.js +62 -0
  376. package/mobile/out/src/storage/schema/entities/MergeEntity.js.map +1 -0
  377. package/mobile/out/src/storage/schema/entities/index.d.ts +17 -0
  378. package/mobile/out/src/storage/schema/entities/index.d.ts.map +1 -0
  379. package/mobile/out/src/storage/schema/entities/index.js +33 -0
  380. package/mobile/out/src/storage/schema/entities/index.js.map +1 -0
  381. package/mobile/out/src/storage/schema/tables/TableCertificate.d.ts +20 -0
  382. package/mobile/out/src/storage/schema/tables/TableCertificate.d.ts.map +1 -0
  383. package/mobile/out/src/storage/schema/tables/TableCertificate.js +3 -0
  384. package/mobile/out/src/storage/schema/tables/TableCertificate.js.map +1 -0
  385. package/mobile/out/src/storage/schema/tables/TableCertificateField.d.ts +12 -0
  386. package/mobile/out/src/storage/schema/tables/TableCertificateField.d.ts.map +1 -0
  387. package/mobile/out/src/storage/schema/tables/TableCertificateField.js +3 -0
  388. package/mobile/out/src/storage/schema/tables/TableCertificateField.js.map +1 -0
  389. package/mobile/out/src/storage/schema/tables/TableCommission.d.ts +13 -0
  390. package/mobile/out/src/storage/schema/tables/TableCommission.d.ts.map +1 -0
  391. package/mobile/out/src/storage/schema/tables/TableCommission.js +3 -0
  392. package/mobile/out/src/storage/schema/tables/TableCommission.js.map +1 -0
  393. package/mobile/out/src/storage/schema/tables/TableMonitorEvent.d.ts +9 -0
  394. package/mobile/out/src/storage/schema/tables/TableMonitorEvent.d.ts.map +1 -0
  395. package/mobile/out/src/storage/schema/tables/TableMonitorEvent.js +3 -0
  396. package/mobile/out/src/storage/schema/tables/TableMonitorEvent.js.map +1 -0
  397. package/mobile/out/src/storage/schema/tables/TableOutput.d.ts +36 -0
  398. package/mobile/out/src/storage/schema/tables/TableOutput.d.ts.map +1 -0
  399. package/mobile/out/src/storage/schema/tables/TableOutput.js +31 -0
  400. package/mobile/out/src/storage/schema/tables/TableOutput.js.map +1 -0
  401. package/mobile/out/src/storage/schema/tables/TableOutputBasket.d.ts +12 -0
  402. package/mobile/out/src/storage/schema/tables/TableOutputBasket.d.ts.map +1 -0
  403. package/mobile/out/src/storage/schema/tables/TableOutputBasket.js +3 -0
  404. package/mobile/out/src/storage/schema/tables/TableOutputBasket.js.map +1 -0
  405. package/mobile/out/src/storage/schema/tables/TableOutputTag.d.ts +10 -0
  406. package/mobile/out/src/storage/schema/tables/TableOutputTag.d.ts.map +1 -0
  407. package/mobile/out/src/storage/schema/tables/TableOutputTag.js +3 -0
  408. package/mobile/out/src/storage/schema/tables/TableOutputTag.js.map +1 -0
  409. package/mobile/out/src/storage/schema/tables/TableOutputTagMap.d.ts +9 -0
  410. package/mobile/out/src/storage/schema/tables/TableOutputTagMap.d.ts.map +1 -0
  411. package/mobile/out/src/storage/schema/tables/TableOutputTagMap.js +3 -0
  412. package/mobile/out/src/storage/schema/tables/TableOutputTagMap.js.map +1 -0
  413. package/mobile/out/src/storage/schema/tables/TableProvenTx.d.ts +14 -0
  414. package/mobile/out/src/storage/schema/tables/TableProvenTx.d.ts.map +1 -0
  415. package/mobile/out/src/storage/schema/tables/TableProvenTx.js +3 -0
  416. package/mobile/out/src/storage/schema/tables/TableProvenTx.js.map +1 -0
  417. package/mobile/out/src/storage/schema/tables/TableProvenTxReq.d.ts +64 -0
  418. package/mobile/out/src/storage/schema/tables/TableProvenTxReq.d.ts.map +1 -0
  419. package/mobile/out/src/storage/schema/tables/TableProvenTxReq.js +3 -0
  420. package/mobile/out/src/storage/schema/tables/TableProvenTxReq.js.map +1 -0
  421. package/mobile/out/src/storage/schema/tables/TableSettings.d.ts +17 -0
  422. package/mobile/out/src/storage/schema/tables/TableSettings.d.ts.map +1 -0
  423. package/mobile/out/src/storage/schema/tables/TableSettings.js +3 -0
  424. package/mobile/out/src/storage/schema/tables/TableSettings.js.map +1 -0
  425. package/mobile/out/src/storage/schema/tables/TableSyncState.d.ts +18 -0
  426. package/mobile/out/src/storage/schema/tables/TableSyncState.d.ts.map +1 -0
  427. package/mobile/out/src/storage/schema/tables/TableSyncState.js +3 -0
  428. package/mobile/out/src/storage/schema/tables/TableSyncState.js.map +1 -0
  429. package/mobile/out/src/storage/schema/tables/TableTransaction.d.ts +37 -0
  430. package/mobile/out/src/storage/schema/tables/TableTransaction.d.ts.map +1 -0
  431. package/mobile/out/src/storage/schema/tables/TableTransaction.js +21 -0
  432. package/mobile/out/src/storage/schema/tables/TableTransaction.js.map +1 -0
  433. package/mobile/out/src/storage/schema/tables/TableTxLabel.d.ts +10 -0
  434. package/mobile/out/src/storage/schema/tables/TableTxLabel.d.ts.map +1 -0
  435. package/mobile/out/src/storage/schema/tables/TableTxLabel.js +3 -0
  436. package/mobile/out/src/storage/schema/tables/TableTxLabel.js.map +1 -0
  437. package/mobile/out/src/storage/schema/tables/TableTxLabelMap.d.ts +9 -0
  438. package/mobile/out/src/storage/schema/tables/TableTxLabelMap.d.ts.map +1 -0
  439. package/mobile/out/src/storage/schema/tables/TableTxLabelMap.js +3 -0
  440. package/mobile/out/src/storage/schema/tables/TableTxLabelMap.js.map +1 -0
  441. package/mobile/out/src/storage/schema/tables/TableUser.d.ts +16 -0
  442. package/mobile/out/src/storage/schema/tables/TableUser.d.ts.map +1 -0
  443. package/mobile/out/src/storage/schema/tables/TableUser.js +3 -0
  444. package/mobile/out/src/storage/schema/tables/TableUser.js.map +1 -0
  445. package/mobile/out/src/storage/schema/tables/index.d.ts +17 -0
  446. package/mobile/out/src/storage/schema/tables/index.d.ts.map +1 -0
  447. package/mobile/out/src/storage/schema/tables/index.js +33 -0
  448. package/mobile/out/src/storage/schema/tables/index.js.map +1 -0
  449. package/mobile/out/src/utility/ScriptTemplateBRC29.d.ts +25 -0
  450. package/mobile/out/src/utility/ScriptTemplateBRC29.d.ts.map +1 -0
  451. package/mobile/out/src/utility/ScriptTemplateBRC29.js +48 -0
  452. package/mobile/out/src/utility/ScriptTemplateBRC29.js.map +1 -0
  453. package/mobile/out/src/utility/identityUtils.d.ts +31 -0
  454. package/mobile/out/src/utility/identityUtils.d.ts.map +1 -0
  455. package/mobile/out/src/utility/identityUtils.js +116 -0
  456. package/mobile/out/src/utility/identityUtils.js.map +1 -0
  457. package/mobile/out/src/utility/index.client.d.ts +7 -0
  458. package/mobile/out/src/utility/index.client.d.ts.map +1 -0
  459. package/mobile/out/src/utility/index.client.js +23 -0
  460. package/mobile/out/src/utility/index.client.js.map +1 -0
  461. package/mobile/out/src/utility/parseTxScriptOffsets.d.ts +14 -0
  462. package/mobile/out/src/utility/parseTxScriptOffsets.d.ts.map +1 -0
  463. package/mobile/out/src/utility/parseTxScriptOffsets.js +26 -0
  464. package/mobile/out/src/utility/parseTxScriptOffsets.js.map +1 -0
  465. package/mobile/out/src/utility/stampLog.d.ts +18 -0
  466. package/mobile/out/src/utility/stampLog.d.ts.map +1 -0
  467. package/mobile/out/src/utility/stampLog.js +72 -0
  468. package/mobile/out/src/utility/stampLog.js.map +1 -0
  469. package/mobile/out/src/utility/tscProofToMerklePath.d.ts +8 -0
  470. package/mobile/out/src/utility/tscProofToMerklePath.d.ts.map +1 -0
  471. package/mobile/out/src/utility/tscProofToMerklePath.js +41 -0
  472. package/mobile/out/src/utility/tscProofToMerklePath.js.map +1 -0
  473. package/mobile/out/src/utility/utilityHelpers.d.ts +129 -0
  474. package/mobile/out/src/utility/utilityHelpers.d.ts.map +1 -0
  475. package/mobile/out/src/utility/utilityHelpers.js +266 -0
  476. package/mobile/out/src/utility/utilityHelpers.js.map +1 -0
  477. package/mobile/out/src/utility/utilityHelpers.noBuffer.d.ts +9 -0
  478. package/mobile/out/src/utility/utilityHelpers.noBuffer.d.ts.map +1 -0
  479. package/mobile/out/src/utility/utilityHelpers.noBuffer.js +23 -0
  480. package/mobile/out/src/utility/utilityHelpers.noBuffer.js.map +1 -0
  481. package/mobile/out/src/wab-client/WABClient.d.ts +49 -0
  482. package/mobile/out/src/wab-client/WABClient.d.ts.map +1 -0
  483. package/mobile/out/src/wab-client/WABClient.js +80 -0
  484. package/mobile/out/src/wab-client/WABClient.js.map +1 -0
  485. package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +34 -0
  486. package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -0
  487. package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +16 -0
  488. package/mobile/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -0
  489. package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts +7 -0
  490. package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts.map +1 -0
  491. package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js +36 -0
  492. package/mobile/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js.map +1 -0
  493. package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts +28 -0
  494. package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts.map +1 -0
  495. package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js +69 -0
  496. package/mobile/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js.map +1 -0
  497. package/mobile/out/tsconfig.mobile.tsbuildinfo +1 -0
  498. package/mobile/package-lock.json +5 -12
  499. package/mobile/package.json +1 -1
  500. package/package.json +1 -1
  501. package/tsconfig.json +3 -0
  502. package/tsconfig.mobile.json +22 -0
@@ -0,0 +1,665 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.WalletStorageManager = void 0;
37
+ const entities_1 = require("../storage/schema/entities");
38
+ const sdk = __importStar(require("../sdk"));
39
+ const utilityHelpers_1 = require("../utility/utilityHelpers");
40
+ class ManagedStorage {
41
+ constructor(storage) {
42
+ this.storage = storage;
43
+ this.isStorageProvider = storage.isStorageProvider();
44
+ this.isAvailable = false;
45
+ }
46
+ }
47
+ /**
48
+ * The `WalletStorageManager` class delivers authentication checking storage access to the wallet.
49
+ *
50
+ * If manages multiple `StorageBase` derived storage services: one actice, the rest as backups.
51
+ *
52
+ * Of the storage services, one is 'active' at any one time.
53
+ * On startup, and whenever triggered by the wallet, `WalletStorageManager` runs a syncrhonization sequence:
54
+ *
55
+ * 1. While synchronizing, all other access to storage is blocked waiting.
56
+ * 2. The active service is confirmed, potentially triggering a resolution process if there is disagreement.
57
+ * 3. Changes are pushed from the active storage service to each inactive, backup service.
58
+ *
59
+ * Some storage services do not support multiple writers. `WalletStorageManager` manages wait-blocking write requests
60
+ * for these services.
61
+ */
62
+ class WalletStorageManager {
63
+ constructor(identityKey, active, backups) {
64
+ /**
65
+ * All configured stores including current active, backups, and conflicting actives.
66
+ */
67
+ this._stores = [];
68
+ /**
69
+ * True if makeAvailable has been run and access to managed stores (active) is allowed
70
+ */
71
+ this._isAvailable = false;
72
+ /**
73
+ * How many read access operations are pending
74
+ */
75
+ this._readerCount = 0;
76
+ /**
77
+ * How many write access operations are pending
78
+ */
79
+ this._writerCount = 0;
80
+ /**
81
+ * if true, allow only a single writer to proceed at a time.
82
+ * queue the blocked requests so they get executed in order when released.
83
+ */
84
+ this._isSingleWriter = true;
85
+ /**
86
+ * if true, allow no new reader or writers to proceed.
87
+ * queue the blocked requests so they get executed in order when released.
88
+ */
89
+ this._syncLocked = false;
90
+ /**
91
+ * if true, allow no new reader or writers or sync to proceed.
92
+ * queue the blocked requests so they get executed in order when released.
93
+ */
94
+ this._storageProviderLocked = false;
95
+ const stores = [...(backups || [])];
96
+ if (active)
97
+ stores.unshift(active);
98
+ this._stores = stores.map(s => new ManagedStorage(s));
99
+ this._authId = { identityKey };
100
+ }
101
+ isStorageProvider() {
102
+ return false;
103
+ }
104
+ isAvailable() {
105
+ return this._isAvailable;
106
+ }
107
+ /**
108
+ * The active storage is "enabled" only if its `storageIdentityKey` matches the user's currently selected `activeStorage`,
109
+ * and only if there are no stores with conflicting `activeStorage` selections.
110
+ *
111
+ * A wallet may be created without including the user's currently selected active storage. This allows readonly access to their wallet data.
112
+ *
113
+ * In addition, if there are conflicting `activeStorage` selections among backup storage providers then the active remains disabled.
114
+ */
115
+ get isActiveEnabled() {
116
+ return (this._active !== undefined &&
117
+ this._active.settings.storageIdentityKey === this._active.user.activeStorage &&
118
+ this._conflictingActives !== undefined &&
119
+ this._conflictingActives.length === 0);
120
+ }
121
+ /**
122
+ * @returns true if at least one WalletStorageProvider has been added.
123
+ */
124
+ canMakeAvailable() {
125
+ return this._stores.length > 0;
126
+ }
127
+ /**
128
+ * This async function must be called after construction and before
129
+ * any other async function can proceed.
130
+ *
131
+ * Runs through `_stores` validating all properties and partitioning across `_active`, `_backups`, `_conflictingActives`.
132
+ *
133
+ * @throws WERR_INVALID_PARAMETER if canMakeAvailable returns false.
134
+ *
135
+ * @returns {TableSettings} from the active storage.
136
+ */
137
+ async makeAvailable() {
138
+ var _a;
139
+ if (this._isAvailable)
140
+ return this._active.settings;
141
+ this._active = undefined;
142
+ this._backups = [];
143
+ this._conflictingActives = [];
144
+ if (this._stores.length < 1)
145
+ throw new sdk.WERR_INVALID_PARAMETER('active', 'valid. Must add active storage provider to wallet.');
146
+ // Initial backups. conflictingActives will be removed.
147
+ const backups = [];
148
+ let i = -1;
149
+ for (const store of this._stores) {
150
+ i++;
151
+ if (!store.isAvailable || !store.settings || !store.user) {
152
+ // Validate all ManagedStorage properties.
153
+ store.settings = await store.storage.makeAvailable();
154
+ const r = await store.storage.findOrInsertUser(this._authId.identityKey);
155
+ store.user = r.user;
156
+ store.isAvailable = true;
157
+ }
158
+ if (!this._active)
159
+ // _stores[0] becomes the default active store. It may be replaced if it is not the user's "enabled" activeStorage and that store is found among the remainder (backups).
160
+ this._active = store;
161
+ else {
162
+ const ua = store.user.activeStorage;
163
+ const si = store.settings.storageIdentityKey;
164
+ if (ua === si && !this.isActiveEnabled) {
165
+ // This store's user record selects it as an enabled active storage...
166
+ // swap the current not-enabled active for this storeage.
167
+ backups.push(this._active);
168
+ this._active = store;
169
+ }
170
+ else {
171
+ // This store is a backup: Its user record selects some other storage as active.
172
+ backups.push(store);
173
+ }
174
+ }
175
+ }
176
+ // Review backups, partition out conflicting actives.
177
+ const si = (_a = this._active.settings) === null || _a === void 0 ? void 0 : _a.storageIdentityKey;
178
+ for (const store of backups) {
179
+ if (store.user.activeStorage !== si)
180
+ this._conflictingActives.push(store);
181
+ else
182
+ this._backups.push(store);
183
+ }
184
+ this._isAvailable = true;
185
+ this._authId.userId = this._active.user.userId;
186
+ this._authId.isActive = this.isActiveEnabled;
187
+ return this._active.settings;
188
+ }
189
+ verifyActive() {
190
+ if (!this._active || !this._isAvailable)
191
+ throw new sdk.WERR_INVALID_OPERATION('An active WalletStorageProvider must be added to this WalletStorageManager and makeAvailable must be called.');
192
+ return this._active;
193
+ }
194
+ async getAuth(mustBeActive) {
195
+ if (!this.isAvailable())
196
+ await this.makeAvailable();
197
+ if (mustBeActive && !this._authId.isActive)
198
+ throw new sdk.WERR_NOT_ACTIVE();
199
+ return this._authId;
200
+ }
201
+ async getUserId() {
202
+ return (await this.getAuth()).userId;
203
+ }
204
+ getActive() {
205
+ return this.verifyActive().storage;
206
+ }
207
+ getActiveSettings() {
208
+ return this.verifyActive().settings;
209
+ }
210
+ getActiveUser() {
211
+ return this.verifyActive().user;
212
+ }
213
+ getActiveStore() {
214
+ return this.verifyActive().settings.storageIdentityKey;
215
+ }
216
+ getActiveStoreName() {
217
+ return this.verifyActive().settings.storageName;
218
+ }
219
+ getBackupStores() {
220
+ this.verifyActive();
221
+ return this._backups.map(b => b.settings.storageIdentityKey);
222
+ }
223
+ getConflictingStores() {
224
+ this.verifyActive();
225
+ return this._conflictingActives.map(b => b.settings.storageIdentityKey);
226
+ }
227
+ getAllStores() {
228
+ this.verifyActive();
229
+ return this._stores.map(b => b.settings.storageIdentityKey);
230
+ }
231
+ async getActiveForWriter() {
232
+ if (!this.isAvailable())
233
+ await this.makeAvailable();
234
+ while (this._storageProviderLocked ||
235
+ this._syncLocked ||
236
+ (this._isSingleWriter && this._writerCount > 0) ||
237
+ this._readerCount > 0) {
238
+ await (0, utilityHelpers_1.wait)(100);
239
+ }
240
+ this._writerCount++;
241
+ return this.getActive();
242
+ }
243
+ async getActiveForReader() {
244
+ if (!this.isAvailable())
245
+ await this.makeAvailable();
246
+ while (this._storageProviderLocked || this._syncLocked || (this._isSingleWriter && this._writerCount > 0)) {
247
+ await (0, utilityHelpers_1.wait)(100);
248
+ }
249
+ this._readerCount++;
250
+ return this.getActive();
251
+ }
252
+ async getActiveForSync() {
253
+ if (!this.isAvailable())
254
+ await this.makeAvailable();
255
+ // Wait for a current sync task to complete...
256
+ while (this._syncLocked) {
257
+ await (0, utilityHelpers_1.wait)(100);
258
+ }
259
+ // Set syncLocked which prevents any new storageProvider, readers or writers...
260
+ this._syncLocked = true;
261
+ // Wait for any current storageProvider, readers and writers to complete
262
+ while (this._storageProviderLocked || this._readerCount > 0 || this._writerCount > 0) {
263
+ await (0, utilityHelpers_1.wait)(100);
264
+ }
265
+ // Allow the sync to proceed on the active store.
266
+ return this.getActive();
267
+ }
268
+ async getActiveForStorageProvider() {
269
+ if (!this.isAvailable())
270
+ await this.makeAvailable();
271
+ // Wait for a current storageProvider call to complete...
272
+ while (this._storageProviderLocked) {
273
+ await (0, utilityHelpers_1.wait)(100);
274
+ }
275
+ // Set storageProviderLocked which prevents any new sync, readers or writers...
276
+ this._storageProviderLocked = true;
277
+ // Wait for any current sync, readers and writers to complete
278
+ while (this._syncLocked || this._readerCount > 0 || this._writerCount > 0) {
279
+ await (0, utilityHelpers_1.wait)(100);
280
+ }
281
+ // We can finally confirm that active storage is still able to support `StorageProvider`
282
+ if (!this.getActive().isStorageProvider())
283
+ throw new sdk.WERR_INVALID_OPERATION('Active "WalletStorageProvider" does not support "StorageProvider" interface.');
284
+ // Allow the sync to proceed on the active store.
285
+ return this.getActive();
286
+ }
287
+ async runAsWriter(writer) {
288
+ try {
289
+ const active = await this.getActiveForWriter();
290
+ const r = await writer(active);
291
+ return r;
292
+ }
293
+ finally {
294
+ this._writerCount--;
295
+ }
296
+ }
297
+ async runAsReader(reader) {
298
+ try {
299
+ const active = await this.getActiveForReader();
300
+ const r = await reader(active);
301
+ return r;
302
+ }
303
+ finally {
304
+ this._readerCount--;
305
+ }
306
+ }
307
+ /**
308
+ *
309
+ * @param sync the function to run with sync access lock
310
+ * @param activeSync from chained sync functions, active storage already held under sync access lock.
311
+ * @returns
312
+ */
313
+ async runAsSync(sync, activeSync) {
314
+ try {
315
+ const active = activeSync || (await this.getActiveForSync());
316
+ const r = await sync(active);
317
+ return r;
318
+ }
319
+ finally {
320
+ if (!activeSync)
321
+ this._syncLocked = false;
322
+ }
323
+ }
324
+ async runAsStorageProvider(sync) {
325
+ try {
326
+ const active = await this.getActiveForStorageProvider();
327
+ const r = await sync(active);
328
+ return r;
329
+ }
330
+ finally {
331
+ this._storageProviderLocked = false;
332
+ }
333
+ }
334
+ /**
335
+ *
336
+ * @returns true if the active `WalletStorageProvider` also implements `StorageProvider`
337
+ */
338
+ isActiveStorageProvider() {
339
+ return this.getActive().isStorageProvider();
340
+ }
341
+ async addWalletStorageProvider(provider) {
342
+ await provider.makeAvailable();
343
+ if (this._services)
344
+ provider.setServices(this._services);
345
+ this._stores.push(new ManagedStorage(provider));
346
+ this._isAvailable = false;
347
+ await this.makeAvailable();
348
+ }
349
+ setServices(v) {
350
+ this._services = v;
351
+ for (const store of this._stores)
352
+ store.storage.setServices(v);
353
+ }
354
+ getServices() {
355
+ if (!this._services)
356
+ throw new sdk.WERR_INVALID_OPERATION('Must setServices first.');
357
+ return this._services;
358
+ }
359
+ getSettings() {
360
+ return this.getActive().getSettings();
361
+ }
362
+ async migrate(storageName, storageIdentityKey) {
363
+ return await this.runAsWriter(async (writer) => {
364
+ return writer.migrate(storageName, storageIdentityKey);
365
+ });
366
+ }
367
+ async destroy() {
368
+ if (this._stores.length < 1)
369
+ return;
370
+ return await this.runAsWriter(async (writer) => {
371
+ for (const store of this._stores)
372
+ await store.storage.destroy();
373
+ });
374
+ }
375
+ async findOrInsertUser(identityKey) {
376
+ const auth = await this.getAuth();
377
+ if (identityKey != auth.identityKey)
378
+ throw new sdk.WERR_UNAUTHORIZED();
379
+ return await this.runAsWriter(async (writer) => {
380
+ const r = await writer.findOrInsertUser(identityKey);
381
+ if (auth.userId && auth.userId !== r.user.userId)
382
+ throw new sdk.WERR_INTERNAL('userId may not change for given identityKey');
383
+ this._authId.userId = r.user.userId;
384
+ return r;
385
+ });
386
+ }
387
+ async abortAction(args) {
388
+ sdk.validateAbortActionArgs(args);
389
+ return await this.runAsWriter(async (writer) => {
390
+ const auth = await this.getAuth(true);
391
+ return await writer.abortAction(auth, args);
392
+ });
393
+ }
394
+ async createAction(vargs) {
395
+ return await this.runAsWriter(async (writer) => {
396
+ const auth = await this.getAuth(true);
397
+ return await writer.createAction(auth, vargs);
398
+ });
399
+ }
400
+ async internalizeAction(args) {
401
+ sdk.validateInternalizeActionArgs(args);
402
+ return await this.runAsWriter(async (writer) => {
403
+ const auth = await this.getAuth(true);
404
+ return await writer.internalizeAction(auth, args);
405
+ });
406
+ }
407
+ async relinquishCertificate(args) {
408
+ sdk.validateRelinquishCertificateArgs(args);
409
+ return await this.runAsWriter(async (writer) => {
410
+ const auth = await this.getAuth(true);
411
+ return await writer.relinquishCertificate(auth, args);
412
+ });
413
+ }
414
+ async relinquishOutput(args) {
415
+ sdk.validateRelinquishOutputArgs(args);
416
+ return await this.runAsWriter(async (writer) => {
417
+ const auth = await this.getAuth(true);
418
+ return await writer.relinquishOutput(auth, args);
419
+ });
420
+ }
421
+ async processAction(args) {
422
+ return await this.runAsWriter(async (writer) => {
423
+ const auth = await this.getAuth(true);
424
+ return await writer.processAction(auth, args);
425
+ });
426
+ }
427
+ async insertCertificate(certificate) {
428
+ return await this.runAsWriter(async (writer) => {
429
+ const auth = await this.getAuth(true);
430
+ return await writer.insertCertificateAuth(auth, certificate);
431
+ });
432
+ }
433
+ async listActions(vargs) {
434
+ const auth = await this.getAuth();
435
+ return await this.runAsReader(async (reader) => {
436
+ return await reader.listActions(auth, vargs);
437
+ });
438
+ }
439
+ async listCertificates(args) {
440
+ const auth = await this.getAuth();
441
+ return await this.runAsReader(async (reader) => {
442
+ return await reader.listCertificates(auth, args);
443
+ });
444
+ }
445
+ async listOutputs(vargs) {
446
+ const auth = await this.getAuth();
447
+ return await this.runAsReader(async (reader) => {
448
+ return await reader.listOutputs(auth, vargs);
449
+ });
450
+ }
451
+ async findCertificates(args) {
452
+ const auth = await this.getAuth();
453
+ return await this.runAsReader(async (reader) => {
454
+ return await reader.findCertificatesAuth(auth, args);
455
+ });
456
+ }
457
+ async findOutputBaskets(args) {
458
+ const auth = await this.getAuth();
459
+ return await this.runAsReader(async (reader) => {
460
+ return await reader.findOutputBasketsAuth(auth, args);
461
+ });
462
+ }
463
+ async findOutputs(args) {
464
+ const auth = await this.getAuth();
465
+ return await this.runAsReader(async (reader) => {
466
+ return await reader.findOutputsAuth(auth, args);
467
+ });
468
+ }
469
+ async findProvenTxReqs(args) {
470
+ return await this.runAsReader(async (reader) => {
471
+ return await reader.findProvenTxReqs(args);
472
+ });
473
+ }
474
+ async syncFromReader(identityKey, reader, activeSync, log = '') {
475
+ const auth = await this.getAuth();
476
+ if (identityKey !== auth.identityKey)
477
+ throw new sdk.WERR_UNAUTHORIZED();
478
+ const readerSettings = await reader.makeAvailable();
479
+ let inserts = 0, updates = 0;
480
+ log = await this.runAsSync(async (sync) => {
481
+ const writer = sync;
482
+ const writerSettings = this.getSettings();
483
+ log += `syncFromReader from ${readerSettings.storageName} to ${writerSettings.storageName}\n`;
484
+ let i = -1;
485
+ for (;;) {
486
+ i++;
487
+ const ss = await entities_1.EntitySyncState.fromStorage(writer, identityKey, readerSettings);
488
+ const args = ss.makeRequestSyncChunkArgs(identityKey, writerSettings.storageIdentityKey);
489
+ const chunk = await reader.getSyncChunk(args);
490
+ if (chunk.user) {
491
+ // Merging state from a reader cannot update activeStorage
492
+ chunk.user.activeStorage = this._active.user.activeStorage;
493
+ }
494
+ const r = await writer.processSyncChunk(args, chunk);
495
+ inserts += r.inserts;
496
+ updates += r.updates;
497
+ log += `chunk ${i} inserted ${r.inserts} updated ${r.updates} ${r.maxUpdated_at}\n`;
498
+ if (r.done)
499
+ break;
500
+ }
501
+ log += `syncFromReader complete: ${inserts} inserts, ${updates} updates\n`;
502
+ return log;
503
+ }, activeSync);
504
+ return { inserts, updates, log };
505
+ }
506
+ async syncToWriter(auth, writer, activeSync, log = '', progLog) {
507
+ progLog || (progLog = s => s);
508
+ const identityKey = auth.identityKey;
509
+ const writerSettings = await writer.makeAvailable();
510
+ let inserts = 0, updates = 0;
511
+ log = await this.runAsSync(async (sync) => {
512
+ const reader = sync;
513
+ const readerSettings = reader.getSettings();
514
+ log += progLog(`syncToWriter from ${readerSettings.storageName} to ${writerSettings.storageName}\n`);
515
+ let i = -1;
516
+ for (;;) {
517
+ i++;
518
+ const ss = await entities_1.EntitySyncState.fromStorage(writer, identityKey, readerSettings);
519
+ const args = ss.makeRequestSyncChunkArgs(identityKey, writerSettings.storageIdentityKey);
520
+ const chunk = await reader.getSyncChunk(args);
521
+ log += entities_1.EntitySyncState.syncChunkSummary(chunk);
522
+ const r = await writer.processSyncChunk(args, chunk);
523
+ inserts += r.inserts;
524
+ updates += r.updates;
525
+ log += progLog(`chunk ${i} inserted ${r.inserts} updated ${r.updates} ${r.maxUpdated_at}\n`);
526
+ if (r.done)
527
+ break;
528
+ }
529
+ log += progLog(`syncToWriter complete: ${inserts} inserts, ${updates} updates\n`);
530
+ return log;
531
+ }, activeSync);
532
+ return { inserts, updates, log };
533
+ }
534
+ async updateBackups(activeSync, progLog) {
535
+ progLog || (progLog = s => s);
536
+ const auth = await this.getAuth(true);
537
+ return await this.runAsSync(async (sync) => {
538
+ let log = progLog(`BACKUP CURRENT ACTIVE TO ${this._backups.length} STORES\n`);
539
+ for (const backup of this._backups) {
540
+ const stwr = await this.syncToWriter(auth, backup.storage, sync, undefined, progLog);
541
+ log += stwr.log;
542
+ }
543
+ return log;
544
+ }, activeSync);
545
+ }
546
+ /**
547
+ * Updates backups and switches to new active storage provider from among current backup providers.
548
+ *
549
+ * Also resolves conflicting actives.
550
+ *
551
+ * @param storageIdentityKey of current backup storage provider that is to become the new active provider.
552
+ */
553
+ async setActive(storageIdentityKey, progLog) {
554
+ progLog || (progLog = s => s);
555
+ if (!this.isAvailable())
556
+ await this.makeAvailable();
557
+ // Confirm a valid storageIdentityKey: must match one of the _stores.
558
+ const newActiveIndex = this._stores.findIndex(s => s.settings.storageIdentityKey === storageIdentityKey);
559
+ if (newActiveIndex < 0)
560
+ throw new sdk.WERR_INVALID_PARAMETER('storageIdentityKey', `registered with this "WalletStorageManager". ${storageIdentityKey} does not match any managed store.`);
561
+ const identityKey = (await this.getAuth()).identityKey;
562
+ const newActive = this._stores[newActiveIndex];
563
+ let log = progLog(`setActive to ${newActive.settings.storageName}`);
564
+ if (storageIdentityKey === this.getActiveStore() && this.isActiveEnabled)
565
+ /** Setting the current active as the new active is a permitted no-op. */
566
+ return log + progLog(` unchanged\n`);
567
+ log += progLog('\n');
568
+ log += await this.runAsSync(async (sync) => {
569
+ let log = '';
570
+ if (this._conflictingActives.length > 0) {
571
+ // Merge state from conflicting actives into `newActive`.
572
+ // Handle case where new active is current active to resolve conflicts.
573
+ // And where new active is one of the current conflict actives.
574
+ this._conflictingActives.push(this._active);
575
+ // Remove the new active from conflicting actives and
576
+ // set new active as the conflicting active that matches the target `storageIdentityKey`
577
+ this._conflictingActives = this._conflictingActives.filter(ca => {
578
+ const isNewActive = ca.settings.storageIdentityKey === storageIdentityKey;
579
+ return !isNewActive;
580
+ });
581
+ // Merge state from conflicting actives into `newActive`.
582
+ for (const conflict of this._conflictingActives) {
583
+ log += progLog('MERGING STATE FROM CONFLICTING ACTIVES:\n');
584
+ const sfr = await this.syncToWriter({ identityKey, userId: newActive.user.userId, isActive: false }, newActive.storage, conflict.storage, undefined, progLog);
585
+ log += sfr.log;
586
+ }
587
+ log += progLog('PROPAGATE MERGED ACTIVE STATE TO NON-ACTIVES\n');
588
+ }
589
+ else {
590
+ log += progLog('BACKUP CURRENT ACTIVE STATE THEN SET NEW ACTIVE\n');
591
+ }
592
+ // If there were conflicting actives,
593
+ // Push state merged from all merged actives into newActive to all stores other than the now single active.
594
+ // Otherwise,
595
+ // Push state from current active to all other stores.
596
+ const backupSource = this._conflictingActives.length > 0 ? newActive : this._active;
597
+ // Update the backupSource's user record with the new activeStorage
598
+ // which will propagate to all other stores in the following backup loop.
599
+ await backupSource.storage.setActive({ identityKey, userId: backupSource.user.userId }, storageIdentityKey);
600
+ for (const store of this._stores) {
601
+ // Update cached user.activeStorage of all stores
602
+ store.user.activeStorage = storageIdentityKey;
603
+ if (store.settings.storageIdentityKey !== backupSource.settings.storageIdentityKey) {
604
+ // If this store is not the backupSource store push state from backupSource to this store.
605
+ const stwr = await this.syncToWriter({ identityKey, userId: store.user.userId, isActive: false }, store.storage, backupSource.storage, undefined, progLog);
606
+ log += stwr.log;
607
+ }
608
+ }
609
+ this._isAvailable = false;
610
+ await this.makeAvailable();
611
+ return log;
612
+ });
613
+ return log;
614
+ }
615
+ getStoreEndpointURL(store) {
616
+ if (store.storage.constructor.name === 'StorageClient')
617
+ return store.storage.endpointUrl;
618
+ return undefined;
619
+ }
620
+ getStores() {
621
+ const stores = [];
622
+ if (this._active) {
623
+ stores.push({
624
+ isActive: true,
625
+ isEnabled: this.isActiveEnabled,
626
+ isBackup: false,
627
+ isConflicting: false,
628
+ userId: this._active.user.userId,
629
+ storageIdentityKey: this._active.settings.storageIdentityKey,
630
+ storageName: this._active.settings.storageName,
631
+ storageClass: this._active.storage.constructor.name,
632
+ endpointURL: this.getStoreEndpointURL(this._active)
633
+ });
634
+ }
635
+ for (const store of this._conflictingActives || []) {
636
+ stores.push({
637
+ isActive: true,
638
+ isEnabled: false,
639
+ isBackup: false,
640
+ isConflicting: true,
641
+ userId: store.user.userId,
642
+ storageIdentityKey: store.settings.storageIdentityKey,
643
+ storageName: store.settings.storageName,
644
+ storageClass: store.storage.constructor.name,
645
+ endpointURL: this.getStoreEndpointURL(store)
646
+ });
647
+ }
648
+ for (const store of this._backups || []) {
649
+ stores.push({
650
+ isActive: false,
651
+ isEnabled: false,
652
+ isBackup: true,
653
+ isConflicting: false,
654
+ userId: store.user.userId,
655
+ storageIdentityKey: store.settings.storageIdentityKey,
656
+ storageName: store.settings.storageName,
657
+ storageClass: store.storage.constructor.name,
658
+ endpointURL: this.getStoreEndpointURL(store)
659
+ });
660
+ }
661
+ return stores;
662
+ }
663
+ }
664
+ exports.WalletStorageManager = WalletStorageManager;
665
+ //# sourceMappingURL=WalletStorageManager.js.map