@aeternity/aepp-sdk 10.0.0 → 12.0.0

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 (424) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -14
  3. package/dist/aepp-sdk.browser-script.js +1 -1
  4. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +13 -40
  5. package/dist/aepp-sdk.browser-script.js.map +1 -1
  6. package/dist/aepp-sdk.browser.js +1 -1
  7. package/dist/aepp-sdk.browser.js.map +1 -1
  8. package/dist/aepp-sdk.js +1 -1
  9. package/dist/aepp-sdk.js.map +1 -1
  10. package/es/AeSdk.d.ts +37 -0
  11. package/es/AeSdk.mjs +81 -0
  12. package/es/AeSdk.mjs.map +1 -0
  13. package/es/AeSdkAepp.d.ts +69 -0
  14. package/es/AeSdkAepp.mjs +175 -0
  15. package/es/AeSdkAepp.mjs.map +1 -0
  16. package/es/AeSdkBase.d.ts +212 -0
  17. package/es/AeSdkBase.mjs +310 -0
  18. package/es/AeSdkBase.mjs.map +1 -0
  19. package/es/AeSdkWallet.d.ts +103 -0
  20. package/es/AeSdkWallet.mjs +322 -0
  21. package/es/AeSdkWallet.mjs.map +1 -0
  22. package/es/Node.d.ts +44 -0
  23. package/es/Node.mjs +141 -0
  24. package/es/Node.mjs.map +1 -0
  25. package/es/account/Base.d.ts +65 -0
  26. package/es/account/Base.mjs +123 -0
  27. package/es/account/Base.mjs.map +1 -0
  28. package/es/account/Memory.d.ts +25 -0
  29. package/es/account/Memory.mjs +81 -0
  30. package/es/account/Memory.mjs.map +1 -0
  31. package/es/account/Rpc.d.ts +27 -0
  32. package/es/account/Rpc.mjs +79 -0
  33. package/es/account/Rpc.mjs.map +1 -0
  34. package/es/aens.d.ts +209 -0
  35. package/es/aens.mjs +332 -0
  36. package/es/aens.mjs.map +1 -0
  37. package/es/aepp-wallet-communication/connection/Browser.d.ts +32 -0
  38. package/es/aepp-wallet-communication/connection/Browser.mjs +70 -0
  39. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
  40. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +17 -0
  41. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +57 -0
  42. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
  43. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +35 -0
  44. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +142 -0
  45. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
  46. package/es/aepp-wallet-communication/connection-proxy.d.ts +10 -0
  47. package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +15 -11
  48. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
  49. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +33 -0
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
  51. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
  52. package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
  54. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
  55. package/es/aepp-wallet-communication/schema.d.ts +118 -0
  56. package/es/aepp-wallet-communication/schema.mjs +214 -0
  57. package/es/aepp-wallet-communication/schema.mjs.map +1 -0
  58. package/es/aepp-wallet-communication/wallet-detector.d.ts +24 -0
  59. package/es/aepp-wallet-communication/wallet-detector.mjs +63 -0
  60. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
  61. package/es/apis/compiler/compiler.d.ts +92 -0
  62. package/es/apis/compiler/compiler.mjs +576 -0
  63. package/es/apis/compiler/compiler.mjs.map +1 -0
  64. package/es/apis/compiler/index.d.ts +2 -0
  65. package/es/apis/compiler/index.mjs +3 -0
  66. package/es/apis/compiler/index.mjs.map +1 -0
  67. package/es/apis/compiler/models/index.d.ts +248 -0
  68. package/es/apis/compiler/models/index.mjs +48 -0
  69. package/es/apis/compiler/models/index.mjs.map +1 -0
  70. package/es/apis/compiler/models/mappers.d.ts +23 -0
  71. package/es/apis/compiler/models/mappers.mjs +585 -0
  72. package/es/apis/compiler/models/mappers.mjs.map +1 -0
  73. package/es/apis/compiler/models/parameters.d.ts +13 -0
  74. package/es/apis/compiler/models/parameters.mjs +71 -0
  75. package/es/apis/compiler/models/parameters.mjs.map +1 -0
  76. package/es/apis/node/index.d.ts +2 -0
  77. package/es/apis/node/index.mjs +3 -0
  78. package/es/apis/node/index.mjs.map +1 -0
  79. package/es/apis/node/models/index.d.ts +1061 -0
  80. package/es/apis/node/models/index.mjs +2 -0
  81. package/es/apis/node/models/index.mjs.map +1 -0
  82. package/es/apis/node/models/mappers.d.ts +95 -0
  83. package/es/apis/node/models/mappers.mjs +4164 -0
  84. package/es/apis/node/models/mappers.mjs.map +1 -0
  85. package/es/apis/node/models/parameters.d.ts +17 -0
  86. package/es/apis/node/models/parameters.mjs +165 -0
  87. package/es/apis/node/models/parameters.mjs.map +1 -0
  88. package/es/apis/node/node.d.ts +215 -0
  89. package/es/apis/node/node.mjs +1165 -0
  90. package/es/apis/node/node.mjs.map +1 -0
  91. package/es/chain.d.ts +220 -0
  92. package/es/chain.mjs +524 -0
  93. package/es/chain.mjs.map +1 -0
  94. package/es/channel/handlers.d.ts +34 -0
  95. package/es/channel/{handlers.js → handlers.mjs} +163 -130
  96. package/es/channel/handlers.mjs.map +1 -0
  97. package/es/channel/index.d.ts +634 -0
  98. package/es/channel/index.mjs +978 -0
  99. package/es/channel/index.mjs.map +1 -0
  100. package/es/channel/internal.d.ts +100 -0
  101. package/es/channel/internal.mjs +328 -0
  102. package/es/channel/internal.mjs.map +1 -0
  103. package/es/contract/Compiler.d.ts +17 -0
  104. package/es/contract/Compiler.mjs +67 -0
  105. package/es/contract/Compiler.mjs.map +1 -0
  106. package/es/contract/aci.d.ts +125 -0
  107. package/es/contract/aci.mjs +496 -0
  108. package/es/contract/aci.mjs.map +1 -0
  109. package/es/contract/ga.d.ts +68 -0
  110. package/es/contract/ga.mjs +190 -0
  111. package/es/contract/ga.mjs.map +1 -0
  112. package/es/contract/methods.d.ts +68 -0
  113. package/es/contract/methods.mjs +101 -0
  114. package/es/contract/methods.mjs.map +1 -0
  115. package/es/index.d.ts +32 -0
  116. package/es/index.mjs +49 -0
  117. package/es/index.mjs.map +1 -0
  118. package/es/oracle.d.ts +154 -0
  119. package/es/oracle.mjs +288 -0
  120. package/es/oracle.mjs.map +1 -0
  121. package/es/spend.d.ts +61 -0
  122. package/es/spend.mjs +122 -0
  123. package/es/spend.mjs.map +1 -0
  124. package/es/tx/builder/constants.d.ts +41 -0
  125. package/es/tx/builder/constants.mjs +100 -0
  126. package/es/tx/builder/constants.mjs.map +1 -0
  127. package/es/tx/builder/field-types.d.ts +62 -0
  128. package/es/tx/builder/field-types.mjs +126 -0
  129. package/es/tx/builder/field-types.mjs.map +1 -0
  130. package/es/tx/builder/helpers.d.ts +131 -0
  131. package/es/tx/builder/helpers.mjs +223 -0
  132. package/es/tx/builder/helpers.mjs.map +1 -0
  133. package/es/tx/builder/index.d.ts +75 -0
  134. package/es/tx/builder/index.mjs +424 -0
  135. package/es/tx/builder/index.mjs.map +1 -0
  136. package/es/tx/builder/schema.d.ts +350 -0
  137. package/es/tx/builder/schema.mjs +320 -0
  138. package/es/tx/builder/schema.mjs.map +1 -0
  139. package/es/tx/index.d.ts +63 -0
  140. package/es/tx/index.mjs +209 -0
  141. package/es/tx/index.mjs.map +1 -0
  142. package/es/tx/min-fee.d.ts +20 -0
  143. package/es/tx/min-fee.mjs +148 -0
  144. package/es/tx/min-fee.mjs.map +1 -0
  145. package/es/tx/validator.d.ts +19 -0
  146. package/es/tx/validator.mjs +240 -0
  147. package/es/tx/validator.mjs.map +1 -0
  148. package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
  149. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
  150. package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
  151. package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
  152. package/es/typings/bip32-path/index.d.mjs +2 -0
  153. package/es/typings/bip32-path/index.d.mjs.map +1 -0
  154. package/es/typings/blakejs/index.d.mjs +2 -0
  155. package/es/typings/blakejs/index.d.mjs.map +1 -0
  156. package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
  157. package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
  158. package/es/utils/amount-formatter.d.ts +42 -0
  159. package/es/utils/{amount-formatter.js → amount-formatter.mjs} +38 -44
  160. package/es/utils/amount-formatter.mjs.map +1 -0
  161. package/es/utils/autorest.d.ts +6 -0
  162. package/es/utils/autorest.mjs +97 -0
  163. package/es/utils/autorest.mjs.map +1 -0
  164. package/es/utils/bignumber.d.ts +13 -0
  165. package/es/utils/bignumber.mjs +23 -0
  166. package/es/utils/bignumber.mjs.map +1 -0
  167. package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
  168. package/es/utils/{bytes.js → bytes.mjs} +26 -22
  169. package/es/utils/bytes.mjs.map +1 -0
  170. package/es/utils/crypto.d.ts +103 -0
  171. package/es/utils/crypto.mjs +221 -0
  172. package/es/utils/crypto.mjs.map +1 -0
  173. package/es/utils/encoder.d.ts +26 -0
  174. package/es/utils/encoder.mjs +102 -0
  175. package/es/utils/encoder.mjs.map +1 -0
  176. package/es/utils/errors.d.ts +481 -0
  177. package/es/utils/errors.mjs +882 -0
  178. package/es/utils/errors.mjs.map +1 -0
  179. package/es/utils/hd-wallet.d.ts +34 -0
  180. package/es/utils/hd-wallet.mjs +122 -0
  181. package/es/utils/hd-wallet.mjs.map +1 -0
  182. package/es/utils/json-big.d.ts +5 -0
  183. package/es/utils/json-big.mjs +41 -0
  184. package/es/utils/json-big.mjs.map +1 -0
  185. package/es/utils/keystore.d.ts +51 -0
  186. package/es/utils/keystore.mjs +145 -0
  187. package/es/utils/keystore.mjs.map +1 -0
  188. package/es/{mptree.d.ts → utils/mptree.d.ts} +5 -8
  189. package/es/utils/{mptree.js → mptree.mjs} +33 -25
  190. package/es/utils/mptree.mjs.map +1 -0
  191. package/es/utils/other.d.ts +14 -0
  192. package/es/utils/other.mjs +28 -0
  193. package/es/utils/other.mjs.map +1 -0
  194. package/es/{semver-satisfies.d.ts → utils/semver-satisfies.d.ts} +0 -0
  195. package/es/utils/{semver-satisfies.js → semver-satisfies.mjs} +1 -1
  196. package/es/utils/semver-satisfies.mjs.map +1 -0
  197. package/es/utils/string.d.ts +24 -0
  198. package/es/utils/{string.js → string.mjs} +9 -11
  199. package/es/utils/string.mjs.map +1 -0
  200. package/package.json +67 -64
  201. package/src/AeSdk.ts +65 -0
  202. package/src/AeSdkAepp.ts +167 -0
  203. package/src/AeSdkBase.ts +320 -0
  204. package/src/AeSdkWallet.ts +332 -0
  205. package/src/Node.ts +167 -0
  206. package/src/account/Base.ts +114 -0
  207. package/src/account/Memory.ts +83 -0
  208. package/src/account/Rpc.ts +67 -0
  209. package/src/aens.ts +391 -0
  210. package/src/aepp-wallet-communication/connection/Browser.ts +68 -0
  211. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +58 -0
  212. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +111 -0
  213. package/{es/utils/crypto-ts.js → src/aepp-wallet-communication/connection-proxy.ts} +16 -9
  214. package/src/aepp-wallet-communication/rpc/RpcClient.ts +137 -0
  215. package/src/aepp-wallet-communication/rpc/types.ts +66 -0
  216. package/src/aepp-wallet-communication/schema.ts +181 -0
  217. package/src/aepp-wallet-communication/wallet-detector.ts +71 -0
  218. package/src/apis/compiler/code-model-v4.yaml +2649 -0
  219. package/src/apis/compiler/compiler.ts +585 -0
  220. package/src/apis/compiler/index.ts +2 -0
  221. package/src/apis/compiler/models/index.ts +301 -0
  222. package/src/apis/compiler/models/mappers.ts +583 -0
  223. package/src/apis/compiler/models/parameters.ts +93 -0
  224. package/src/apis/node/code-model-v4.yaml +10046 -0
  225. package/src/apis/node/index.ts +2 -0
  226. package/src/apis/node/models/index.ts +1253 -0
  227. package/src/apis/node/models/mappers.ts +4278 -0
  228. package/src/apis/node/models/parameters.ts +188 -0
  229. package/src/apis/node/node.ts +1299 -0
  230. package/src/chain.ts +444 -0
  231. package/src/channel/{handlers.js → handlers.ts} +238 -143
  232. package/src/channel/index.ts +991 -0
  233. package/src/channel/internal.ts +345 -0
  234. package/src/contract/Compiler.ts +66 -0
  235. package/src/contract/aci.ts +529 -0
  236. package/src/contract/ga.ts +178 -0
  237. package/src/contract/methods.ts +118 -0
  238. package/src/index.ts +51 -0
  239. package/src/oracle.ts +342 -0
  240. package/src/spend.ts +152 -0
  241. package/src/tx/builder/constants.ts +96 -0
  242. package/src/tx/builder/field-types.ts +111 -0
  243. package/src/tx/builder/helpers.ts +253 -0
  244. package/src/tx/builder/index.ts +394 -0
  245. package/src/tx/builder/schema.ts +771 -0
  246. package/src/tx/index.ts +199 -0
  247. package/src/tx/min-fee.ts +136 -0
  248. package/src/tx/validator.ts +226 -0
  249. package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
  250. package/src/typings/@aeternity__uuid/index.d.ts +3 -0
  251. package/src/typings/bip32-path/index.d.ts +33 -0
  252. package/src/typings/tweetnacl-auth/index.d.ts +14 -0
  253. package/src/utils/amount-formatter.ts +29 -41
  254. package/src/utils/autorest.ts +90 -0
  255. package/src/utils/bignumber.ts +9 -19
  256. package/src/utils/bytes.ts +15 -16
  257. package/src/utils/crypto.ts +217 -0
  258. package/src/utils/encoder.ts +98 -0
  259. package/src/utils/errors.ts +817 -0
  260. package/src/utils/hd-wallet.ts +134 -0
  261. package/src/utils/json-big.ts +26 -0
  262. package/src/utils/keystore.ts +179 -0
  263. package/src/utils/mptree.ts +26 -20
  264. package/src/utils/other.ts +28 -43
  265. package/src/utils/string.ts +8 -10
  266. package/CHANGELOG.md +0 -1603
  267. package/es/account/base.js +0 -169
  268. package/es/account/base.js.map +0 -1
  269. package/es/account/memory.js +0 -84
  270. package/es/account/memory.js.map +0 -1
  271. package/es/account/multiple.js +0 -178
  272. package/es/account/multiple.js.map +0 -1
  273. package/es/ae/aens.js +0 -408
  274. package/es/ae/aens.js.map +0 -1
  275. package/es/ae/aepp.js +0 -45
  276. package/es/ae/aepp.js.map +0 -1
  277. package/es/ae/contract.js +0 -312
  278. package/es/ae/contract.js.map +0 -1
  279. package/es/ae/index.js +0 -206
  280. package/es/ae/index.js.map +0 -1
  281. package/es/ae/oracle.js +0 -322
  282. package/es/ae/oracle.js.map +0 -1
  283. package/es/ae/universal.js +0 -45
  284. package/es/ae/universal.js.map +0 -1
  285. package/es/ae/wallet.js +0 -50
  286. package/es/ae/wallet.js.map +0 -1
  287. package/es/amount-formatter.d.ts +0 -58
  288. package/es/bignumber.d.ts +0 -24
  289. package/es/chain/index.js +0 -256
  290. package/es/chain/index.js.map +0 -1
  291. package/es/chain/node.js +0 -394
  292. package/es/chain/node.js.map +0 -1
  293. package/es/channel/handlers.js.map +0 -1
  294. package/es/channel/index.js +0 -980
  295. package/es/channel/index.js.map +0 -1
  296. package/es/channel/internal.js +0 -266
  297. package/es/channel/internal.js.map +0 -1
  298. package/es/contract/aci/helpers.js +0 -298
  299. package/es/contract/aci/helpers.js.map +0 -1
  300. package/es/contract/aci/index.js +0 -361
  301. package/es/contract/aci/index.js.map +0 -1
  302. package/es/contract/aci/transformation.js +0 -66
  303. package/es/contract/aci/transformation.js.map +0 -1
  304. package/es/contract/compiler.js +0 -244
  305. package/es/contract/compiler.js.map +0 -1
  306. package/es/contract/ga/helpers.js +0 -22
  307. package/es/contract/ga/helpers.js.map +0 -1
  308. package/es/contract/ga/index.js +0 -170
  309. package/es/contract/ga/index.js.map +0 -1
  310. package/es/contract/index.js +0 -162
  311. package/es/contract/index.js.map +0 -1
  312. package/es/crypto-ts.d.ts +0 -9
  313. package/es/index.js +0 -57
  314. package/es/index.js.map +0 -1
  315. package/es/node-pool/index.js +0 -187
  316. package/es/node-pool/index.js.map +0 -1
  317. package/es/node.js +0 -132
  318. package/es/node.js.map +0 -1
  319. package/es/other.d.ts +0 -31
  320. package/es/string.d.ts +0 -26
  321. package/es/tx/builder/helpers.js +0 -305
  322. package/es/tx/builder/helpers.js.map +0 -1
  323. package/es/tx/builder/index.js +0 -595
  324. package/es/tx/builder/index.js.map +0 -1
  325. package/es/tx/builder/schema.js +0 -814
  326. package/es/tx/builder/schema.js.map +0 -1
  327. package/es/tx/index.js +0 -300
  328. package/es/tx/index.js.map +0 -1
  329. package/es/tx/tx-object.js +0 -276
  330. package/es/tx/tx-object.js.map +0 -1
  331. package/es/tx/tx.js +0 -937
  332. package/es/tx/tx.js.map +0 -1
  333. package/es/tx/validator.js +0 -208
  334. package/es/tx/validator.js.map +0 -1
  335. package/es/typings/blakejs/index.d.js +0 -2
  336. package/es/typings/blakejs/index.d.js.map +0 -1
  337. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -131
  338. package/es/utils/aepp-wallet-communication/connection/browser-runtime.js.map +0 -1
  339. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -184
  340. package/es/utils/aepp-wallet-communication/connection/browser-window-message.js.map +0 -1
  341. package/es/utils/aepp-wallet-communication/connection/index.js +0 -84
  342. package/es/utils/aepp-wallet-communication/connection/index.js.map +0 -1
  343. package/es/utils/aepp-wallet-communication/content-script-bridge.js +0 -97
  344. package/es/utils/aepp-wallet-communication/content-script-bridge.js.map +0 -1
  345. package/es/utils/aepp-wallet-communication/helpers.js +0 -103
  346. package/es/utils/aepp-wallet-communication/helpers.js.map +0 -1
  347. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -329
  348. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.js.map +0 -1
  349. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -270
  350. package/es/utils/aepp-wallet-communication/rpc/rpc-client.js.map +0 -1
  351. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -533
  352. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.js.map +0 -1
  353. package/es/utils/aepp-wallet-communication/schema.js +0 -107
  354. package/es/utils/aepp-wallet-communication/schema.js.map +0 -1
  355. package/es/utils/aepp-wallet-communication/wallet-detector.js +0 -109
  356. package/es/utils/aepp-wallet-communication/wallet-detector.js.map +0 -1
  357. package/es/utils/amount-formatter.js.map +0 -1
  358. package/es/utils/async-init.js +0 -67
  359. package/es/utils/async-init.js.map +0 -1
  360. package/es/utils/bignumber.js +0 -28
  361. package/es/utils/bignumber.js.map +0 -1
  362. package/es/utils/bytes.js.map +0 -1
  363. package/es/utils/crypto-ts.js.map +0 -1
  364. package/es/utils/crypto.js +0 -304
  365. package/es/utils/crypto.js.map +0 -1
  366. package/es/utils/hd-wallet.js +0 -112
  367. package/es/utils/hd-wallet.js.map +0 -1
  368. package/es/utils/json-big.js +0 -45
  369. package/es/utils/json-big.js.map +0 -1
  370. package/es/utils/keystore.js +0 -228
  371. package/es/utils/keystore.js.map +0 -1
  372. package/es/utils/mptree.js.map +0 -1
  373. package/es/utils/other.js +0 -43
  374. package/es/utils/other.js.map +0 -1
  375. package/es/utils/semver-satisfies.js.map +0 -1
  376. package/es/utils/string.js.map +0 -1
  377. package/es/utils/swagger.js +0 -132
  378. package/es/utils/swagger.js.map +0 -1
  379. package/src/account/base.js +0 -153
  380. package/src/account/memory.js +0 -78
  381. package/src/account/multiple.js +0 -154
  382. package/src/ae/aens.js +0 -366
  383. package/src/ae/aepp.js +0 -45
  384. package/src/ae/contract.js +0 -285
  385. package/src/ae/index.js +0 -167
  386. package/src/ae/oracle.js +0 -296
  387. package/src/ae/universal.js +0 -47
  388. package/src/ae/wallet.js +0 -50
  389. package/src/chain/index.js +0 -250
  390. package/src/chain/node.js +0 -293
  391. package/src/channel/index.js +0 -898
  392. package/src/channel/internal.js +0 -231
  393. package/src/contract/aci/index.js +0 -317
  394. package/src/contract/aci/transformation.js +0 -72
  395. package/src/contract/compiler.js +0 -195
  396. package/src/contract/ga/helpers.js +0 -17
  397. package/src/contract/ga/index.js +0 -147
  398. package/src/contract/index.js +0 -163
  399. package/src/index.js +0 -90
  400. package/src/node-pool/index.js +0 -171
  401. package/src/node.js +0 -118
  402. package/src/tx/builder/helpers.js +0 -325
  403. package/src/tx/builder/index.js +0 -460
  404. package/src/tx/builder/schema.js +0 -1211
  405. package/src/tx/index.js +0 -301
  406. package/src/tx/tx-object.js +0 -186
  407. package/src/tx/tx.js +0 -622
  408. package/src/tx/validator.js +0 -161
  409. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -114
  410. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -161
  411. package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
  412. package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -85
  413. package/src/utils/aepp-wallet-communication/helpers.js +0 -70
  414. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -268
  415. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -223
  416. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -390
  417. package/src/utils/aepp-wallet-communication/schema.js +0 -108
  418. package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -91
  419. package/src/utils/async-init.js +0 -41
  420. package/src/utils/crypto.js +0 -312
  421. package/src/utils/hd-wallet.js +0 -115
  422. package/src/utils/json-big.js +0 -26
  423. package/src/utils/keystore.js +0 -223
  424. package/src/utils/swagger.js +0 -133
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.mjs","names":["BaseError","Error","constructor","message","name","AccountError","AensError","AeppError","ChannelError","CompilerError","ContractError","CryptographyError","NodeError","TransactionError","WalletError","ArgumentError","argumentName","requirement","argumentValue","String","IllegalArgumentError","ArgumentCountMismatchError","functionName","requiredCount","providedCount","InsufficientBalanceError","MissingParamError","NoSerializerFoundError","RequestTimedOutError","requestTime","currentHeight","height","undefined","TxTimedOutError","blocks","th","join","TypeError","UnsupportedPlatformError","UnsupportedProtocolError","NotImplementedError","UnsupportedVersionError","dependency","version","geVersion","ltVersion","InternalError","UnexpectedTsError","InvalidKeypairError","UnavailableAccountError","address","AensPointerContextError","nameOrId","prefix","InsufficientNameFeeError","nameFee","minNameFee","toString","InvalidAensNameError","InvalidRpcMessageError","MissingCallbackError","id","UnAuthorizedAccountError","onAccount","UnknownRpcClientError","UnsubscribedAccountError","ChannelCallError","ChannelConnectionError","ChannelPingTimedOutError","UnexpectedChannelMessageError","UnknownChannelStateError","InvalidAuthDataError","BytecodeMismatchError","source","DuplicateContractError","InactiveContractError","contractAddress","InvalidMethodInvocationError","MissingContractAddressError","MissingContractDefError","MissingFunctionNameError","NodeInvocationError","transaction","NoSuchContractFunctionError","NotPayableFunctionError","amount","fn","MissingEventDefinitionError","eventNameHash","eventAddress","AmbiguousEventDefinitionError","matchedEvents","map","InvalidChecksumError","InvalidPasswordError","MerkleTreeHashMismatchError","MissingNodeInTreeError","UnknownNodeLengthError","nodeLength","UnknownPathNibbleError","nibble","DuplicateNodeError","NodeNotFoundError","DecodeError","PayloadLengthError","DryRunError","IllegalBidFeeError","InvalidSignatureError","InvalidTxError","validation","InvalidTxParamsError","PrefixNotFoundError","tag","SchemaNotFoundError","schemaName","key","TagNotFoundError","TxNotInChainError","txHash","UnknownTxError","UnsupportedABIversionError","UnsupportedVMversionError","AlreadyConnectedError","NoWalletConnectedError","RpcConnectionError"],"sources":["../../src/utils/errors.ts"],"sourcesContent":["import BigNumber from 'bignumber.js'\nimport { ValidatorResult } from '../tx/validator'\nimport { EncodedData } from './encoder'\n\n/**\n * aepp-sdk originated error\n * @category exception\n */\nexport abstract class BaseError extends Error {\n constructor (message: string) {\n super(message)\n this.name = 'BaseError'\n }\n}\n\n/**\n * @category exception\n */\nexport class AccountError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'AccountError'\n }\n}\n\n/**\n * @category exception\n */\nexport class AensError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'AensError'\n }\n}\n\n/**\n * @category exception\n */\nexport class AeppError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'AeppError'\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'ChannelError'\n }\n}\n\n/**\n * @category exception\n */\nexport class CompilerError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'CompilerError'\n }\n}\n\n/**\n * @category exception\n */\nexport class ContractError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'ContractError'\n }\n}\n\n/**\n * @category exception\n */\nexport class CryptographyError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'CryptographyError'\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'NodeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class TransactionError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'TransactionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class WalletError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'WalletError'\n }\n}\n\n/**\n * @category exception\n */\nexport class ArgumentError extends BaseError {\n constructor (argumentName: string, requirement: string, argumentValue: any) {\n super(`${argumentName} should be ${requirement}, got ${String(argumentValue)} instead`)\n this.name = 'ArgumentError'\n }\n}\n\n/**\n * @category exception\n */\nexport class IllegalArgumentError extends CryptographyError {\n constructor (message: string) {\n super(message)\n this.name = 'IllegalArgumentError'\n }\n}\n\n/**\n * @category exception\n */\nexport class ArgumentCountMismatchError extends BaseError {\n constructor (functionName: string, requiredCount: number, providedCount: number) {\n super(`${functionName} expects ${requiredCount} arguments, got ${providedCount} instead`)\n this.name = 'ArgumentCountMismatchError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InsufficientBalanceError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'InsufficientBalanceError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingParamError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'MissingParamError'\n }\n}\n\n/**\n * @category exception\n */\nexport class NoSerializerFoundError extends BaseError {\n constructor () {\n super('Byte serialization not supported')\n this.name = 'NoSerializerFoundError'\n }\n}\n\n/**\n * @category exception\n */\nexport class RequestTimedOutError extends BaseError {\n constructor (requestTime: number, currentHeight?: number, height?: number) {\n if (currentHeight !== undefined && height !== undefined) {\n super(`Giving up after ${requestTime}ms, current height: ${currentHeight}, desired height: ${height}`)\n } else {\n super(`Giving up after ${requestTime} ms`)\n }\n this.name = 'RequestTimedOutError'\n }\n}\n\n/**\n * @category exception\n */\nexport class TxTimedOutError extends BaseError {\n constructor (blocks: number, th: string) {\n super([\n `Giving up after ${blocks} blocks mined`,\n `transaction hash: ${th}`\n ].join(', '))\n this.name = 'TxTimedOutError'\n }\n}\n\n/**\n * @category exception\n */\nexport class TypeError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'TypeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedPlatformError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'UnsupportedPlatformError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedProtocolError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'UnsupportedProtocolError'\n }\n}\n\n/**\n * @category exception\n */\nexport class NotImplementedError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'NotImplementedError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedVersionError extends BaseError {\n constructor (dependency: string, version: string, geVersion: string, ltVersion: string) {\n super(`Unsupported ${dependency} version ${version}. Supported: >= ${geVersion} < ${ltVersion}`)\n this.name = 'UnsupportedVersionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InternalError extends BaseError {\n constructor (message: string) {\n super(message)\n this.name = 'InternalError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnexpectedTsError extends InternalError {\n constructor (message: string = 'Expected to not happen, required for TS') {\n super(message)\n this.name = 'UnexpectedTsError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidKeypairError extends AccountError {\n constructor (message: string) {\n super(message)\n this.name = 'InvalidKeypairError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnavailableAccountError extends AccountError {\n constructor (address: string) {\n super(`Account for ${address} not available`)\n this.name = 'UnavailableAccountError'\n }\n}\n\n/**\n * @category exception\n */\nexport class AensPointerContextError extends AensError {\n constructor (nameOrId: string, prefix: string) {\n super(`Name ${nameOrId} don't have pointers for ${prefix}`)\n this.name = 'AensPointerContextError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InsufficientNameFeeError extends AensError {\n constructor (nameFee: BigNumber, minNameFee: BigNumber) {\n super(`the provided fee ${nameFee.toString()} is not enough to execute the claim, required: ${minNameFee.toString()}`)\n this.name = 'InsufficientNameFeeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidAensNameError extends AensError {\n constructor (message: string) {\n super(message)\n this.name = 'InvalidAensNameError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidRpcMessageError extends AeppError {\n constructor (message: string) {\n super(`Received invalid message: ${message}`)\n this.name = 'InvalidRpcMessageError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingCallbackError extends AeppError {\n constructor (id: number) {\n super(`Can't find callback for this messageId ${id}`)\n this.name = 'MissingCallbackError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnAuthorizedAccountError extends AeppError {\n constructor (onAccount: string) {\n super(`You do not have access to account ${onAccount}`)\n this.name = 'UnAuthorizedAccountError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownRpcClientError extends AeppError {\n constructor (id: string) {\n super(`RpcClient with id ${id} do not exist`)\n this.name = 'UnknownRpcClientError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsubscribedAccountError extends AeppError {\n constructor () {\n super('You are not subscribed for an account.')\n this.name = 'UnsubscribedAccountError'\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelCallError extends ChannelError {\n constructor (message: string) {\n super(message)\n this.name = 'ChannelCallError'\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelConnectionError extends ChannelError {\n constructor (message: string) {\n super(message)\n this.name = 'ChannelConnectionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelPingTimedOutError extends ChannelError {\n constructor () {\n super('Server pong timed out')\n this.name = 'ChannelPingTimedOutError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnexpectedChannelMessageError extends ChannelError {\n constructor (message: string) {\n super(message)\n this.name = 'UnexpectedChannelMessageError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownChannelStateError extends ChannelError {\n constructor () {\n super('State Channels FSM entered unknown state')\n this.name = 'UnknownChannelStateError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidAuthDataError extends CompilerError {\n constructor (message: string) {\n super(message)\n this.name = 'InvalidAuthDataError'\n }\n}\n\n/**\n * @category exception\n */\nexport class BytecodeMismatchError extends ContractError {\n constructor (source: string) {\n super(`Contract ${source} do not correspond to the bytecode deployed on the chain`)\n this.name = 'BytecodeMismatchError'\n }\n}\n\n/**\n * @category exception\n */\nexport class DuplicateContractError extends ContractError {\n constructor () {\n super('Contract already deployed')\n this.name = 'DuplicateContractError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InactiveContractError extends ContractError {\n constructor (contractAddress: string) {\n super(`Contract with address ${contractAddress} not active`)\n this.name = 'InactiveContractError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidMethodInvocationError extends ContractError {\n constructor (message: string) {\n super(message)\n this.name = 'InvalidMethodInvocationError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingContractAddressError extends ContractError {\n constructor (message: string) {\n super(message)\n this.name = 'MissingContractAddressError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingContractDefError extends ContractError {\n constructor () {\n super('Either ACI or source code is required')\n this.name = 'MissingContractDefError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingFunctionNameError extends ContractError {\n constructor () {\n super('Function name is required')\n this.name = 'MissingFunctionNameError'\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeInvocationError extends ContractError {\n transaction: string\n\n constructor (message: string, transaction: string) {\n super(`Invocation failed${message == null ? '' : `: \"${message}\"`}`)\n this.name = 'NodeInvocationError'\n this.transaction = transaction\n }\n}\n\n/**\n * @category exception\n */\nexport class NoSuchContractFunctionError extends ContractError {\n constructor (name: string) {\n super(`Function ${name} doesn't exist in contract`)\n this.name = 'NoSuchContractFunctionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class NotPayableFunctionError extends ContractError {\n constructor (amount: string, fn: string) {\n super(\n `You try to pay \"${amount}\" to function \"${fn}\" which is not payable. ` +\n 'Only payable function can accept coins')\n this.name = 'NotPayableFunctionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingEventDefinitionError extends ContractError {\n constructor (eventNameHash: string, eventAddress: string) {\n super(\n `Can't find definition of ${eventNameHash} event emitted by ${eventAddress}` +\n ' (use omitUnknown option to ignore events like this)'\n )\n this.name = 'MissingEventDefinitionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class AmbiguousEventDefinitionError extends ContractError {\n constructor (eventAddress: string, matchedEvents: Array<[string, string]>) {\n super(\n `Found multiple definitions of \"${matchedEvents[0][1]}\" event emitted by ${eventAddress}` +\n ` in ${matchedEvents.map(([name]) => `\"${name}\"`).join(', ')} contracts` +\n ' (use contractAddressToName option to specify contract name corresponding to address)'\n )\n this.name = 'AmbiguousEventDefinitionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidChecksumError extends CryptographyError {\n constructor () {\n super('Invalid checksum')\n this.name = 'InvalidChecksumError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidPasswordError extends CryptographyError {\n constructor () {\n super('Invalid password or nonce')\n this.name = 'InvalidPasswordError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MerkleTreeHashMismatchError extends CryptographyError {\n constructor () {\n super('Node hash is not equal to provided one')\n this.name = 'MerkleTreeHashMismatchError'\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingNodeInTreeError extends CryptographyError {\n constructor (message: string) {\n super(message)\n this.name = 'MissingNodeInTreeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownNodeLengthError extends CryptographyError {\n constructor (nodeLength: number) {\n super(`Unknown node length: ${nodeLength}`)\n this.name = 'UnknownNodeLengthError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownPathNibbleError extends CryptographyError {\n constructor (nibble: number) {\n super(`Unknown path nibble: ${nibble}`)\n this.name = 'UnknownPathNibbleError'\n }\n}\n\n/**\n * @category exception\n */\nexport class DuplicateNodeError extends NodeError {\n constructor (name: string) {\n super(`Node with name ${name} already exist`)\n this.name = 'DuplicateNodeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeNotFoundError extends NodeError {\n constructor (message: string) {\n super(message)\n this.name = 'NodeNotFoundError'\n }\n}\n\n/**\n * @category exception\n */\nexport class DecodeError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'DecodeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class PayloadLengthError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'PayloadLengthError'\n }\n}\n\n/**\n * @category exception\n */\nexport class DryRunError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'DryRunError'\n }\n}\n\n/**\n * @category exception\n */\nexport class IllegalBidFeeError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'IllegalBidFeeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidSignatureError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'InvalidSignatureError'\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidTxError extends TransactionError {\n validation: ValidatorResult[]\n transaction: EncodedData<'tx'>\n constructor (message: string, validation: ValidatorResult[], transaction: EncodedData<'tx'>) {\n super(message)\n this.name = 'InvalidTxError'\n this.validation = validation\n this.transaction = transaction\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidTxParamsError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'InvalidTxParamsError'\n }\n}\n\n/**\n * @category exception\n */\nexport class PrefixNotFoundError extends TransactionError {\n constructor (tag: number) {\n super(`Prefix for id-tag ${tag} not found.`)\n this.name = 'PrefixNotFoundError'\n }\n}\n\n/**\n * @category exception\n */\nexport class SchemaNotFoundError extends TransactionError {\n constructor (schemaName: string, key: string, version: number) {\n super(`Transaction ${schemaName} not implemented for ${key} version ${version}`)\n this.name = 'SchemaNotFoundError'\n }\n}\n\n/**\n * @category exception\n */\nexport class TagNotFoundError extends TransactionError {\n constructor (prefix: string) {\n super(`Id tag for prefix ${prefix} not found.`)\n this.name = 'DecodeError'\n }\n}\n\n/**\n * @category exception\n */\nexport class TxNotInChainError extends TransactionError {\n constructor (txHash: string) {\n super(`Transaction ${txHash} is removed from chain`)\n this.name = 'TxNotInChainError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownTxError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'UnknownTxError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedABIversionError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'UnsupportedABIversionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedVMversionError extends TransactionError {\n constructor (message: string) {\n super(message)\n this.name = 'UnsupportedVMversionError'\n }\n}\n\n/**\n * @category exception\n */\nexport class AlreadyConnectedError extends WalletError {\n constructor (message: string) {\n super(message)\n this.name = 'AlreadyConnectedError'\n }\n}\n\n/**\n * @category exception\n */\nexport class NoWalletConnectedError extends WalletError {\n constructor (message: string) {\n super(message)\n this.name = 'NoWalletConnectedError'\n }\n}\n\n/**\n * @category exception\n */\nexport class RpcConnectionError extends WalletError {\n constructor (message: string) {\n super(message)\n this.name = 'RpcConnectionError'\n }\n}\n"],"mappings":"AAIA;AACA;AACA;AACA;AACA,OAAO,MAAeA,SAAf,SAAiCC,KAAjC,CAAuC;EAC5CC,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,WAAZ;EACD;;AAJ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BAA5B;IACA,KAAKlH,IAAL,GAAY,mBAAZ;EACD;;AAJqD;AAOxD;AACA;AACA;;AACA,OAAO,MAAMmH,cAAN,SAA6B1G,gBAA7B,CAA8C;EACnDX,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,gBAAZ;EACD;;AAJkD;AAOrD;AACA;AACA;;AACA,OAAO,MAAMoH,0BAAN,SAAyC3G,gBAAzC,CAA0D;EAC/DX,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,4BAAZ;EACD;;AAJ8D;AAOjE;AACA;AACA;;AACA,OAAO,MAAMqH,yBAAN,SAAwC5G,gBAAxC,CAAyD;EAC9DX,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,2BAAZ;EACD;;AAJ6D;AAOhE;AACA;AACA;;AACA,OAAO,MAAMsH,qBAAN,SAAoC5G,WAApC,CAAgD;EACrDZ,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,uBAAZ;EACD;;AAJoD;AAOvD;AACA;AACA;;AACA,OAAO,MAAMuH,sBAAN,SAAqC7G,WAArC,CAAiD;EACtDZ,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,wBAAZ;EACD;;AAJqD;AAOxD;AACA;AACA;;AACA,OAAO,MAAMwH,kBAAN,SAAiC9G,WAAjC,CAA6C;EAClDZ,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,oBAAZ;EACD;;AAJiD"}
@@ -0,0 +1,34 @@
1
+ import nacl from 'tweetnacl';
2
+ import { CryptographyError } from './errors';
3
+ /**
4
+ * @category exception
5
+ */
6
+ export declare class DerivationError extends CryptographyError {
7
+ constructor(message: string);
8
+ }
9
+ interface KeyTreeNode {
10
+ secretKey: Uint8Array;
11
+ chainCode: Uint8Array;
12
+ }
13
+ interface HDWallet {
14
+ secretKey: string;
15
+ chainCode: string;
16
+ }
17
+ interface Account {
18
+ secretKey: string;
19
+ publicKey: string;
20
+ }
21
+ declare type Dec<N extends number> = [-1, 0, 1, 2, 3, 4][N];
22
+ declare type Bip32PathT<MaxLen extends number, H extends 'H' | 'h' | '\''> = MaxLen extends -1 ? `${number}${H}` : Bip32PathT<Dec<MaxLen>, H> | `${Bip32PathT<Dec<MaxLen>, H>}/${number}${H}`;
23
+ declare type Bip32Path<MaxLen extends number> = '' | Bip32PathT<MaxLen, 'H'> | Bip32PathT<MaxLen, 'h'> | Bip32PathT<MaxLen, '\''>;
24
+ export declare function derivePathFromKey(path: Bip32Path<5>, key: KeyTreeNode): KeyTreeNode;
25
+ export declare function derivePathFromSeed(path: 'm' | `m/${Bip32Path<5>}`, seed: Uint8Array): KeyTreeNode;
26
+ export declare function getKeyPair(secretKey: Uint8Array): nacl.SignKeyPair;
27
+ export declare function getMasterKeyFromSeed(seed: Uint8Array): KeyTreeNode;
28
+ export declare function deriveChild({ secretKey, chainCode }: KeyTreeNode, index: number): KeyTreeNode;
29
+ export declare function generateSaveHDWalletFromSeed(seed: Uint8Array, password: string): HDWallet;
30
+ export declare function getSaveHDWalletAccounts(saveHDWallet: HDWallet, password: string, accountCount: number): Account[];
31
+ export declare const getHdWalletAccountFromSeed: (seed: Uint8Array, accountIdx: number) => Account & {
32
+ idx: number;
33
+ };
34
+ export {};
@@ -0,0 +1,122 @@
1
+ import _buffer from "buffer";
2
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
3
+ const {
4
+ Buffer: _Buffer
5
+ } = _buffer;
6
+ import nacl from 'tweetnacl';
7
+ import _tweetnaclAuth from 'tweetnacl-auth';
8
+ const {
9
+ full: hmac
10
+ } = _tweetnaclAuth;
11
+ import _bip32Path from 'bip32-path';
12
+ const {
13
+ fromString
14
+ } = _bip32Path;
15
+ import { decryptKey, encryptKey } from "./crypto.mjs";
16
+ import { encode } from "./encoder.mjs";
17
+ import { CryptographyError } from "./errors.mjs";
18
+ import { bytesToHex } from "./bytes.mjs";
19
+ import { concatBuffers } from "./other.mjs";
20
+ /**
21
+ * @category exception
22
+ */
23
+
24
+ export class DerivationError extends CryptographyError {
25
+ constructor(message) {
26
+ super(message);
27
+ this.name = 'DerivationError';
28
+ }
29
+
30
+ }
31
+
32
+ const ED25519_CURVE = _Buffer.from('ed25519 seed');
33
+
34
+ const HARDENED_OFFSET = 0x80000000;
35
+ export function derivePathFromKey(path, key) {
36
+ const segments = path === '' ? [] : fromString(path).toPathArray();
37
+ segments.forEach((segment, i) => {
38
+ if (segment < HARDENED_OFFSET) {
39
+ throw new DerivationError(`Segment #${i + 1} is not hardened`);
40
+ }
41
+ });
42
+ return segments.reduce((parentKey, segment) => deriveChild(parentKey, segment), key);
43
+ }
44
+ export function derivePathFromSeed(path, seed) {
45
+ var _context;
46
+
47
+ if (!_includesInstanceProperty(_context = ['m', 'm/']).call(_context, path.slice(0, 2))) {
48
+ throw new DerivationError('Root element is required');
49
+ }
50
+
51
+ const masterKey = getMasterKeyFromSeed(seed);
52
+ return derivePathFromKey(path.slice(2), masterKey);
53
+ }
54
+
55
+ function formatAccount(keys) {
56
+ const {
57
+ secretKey,
58
+ publicKey
59
+ } = keys;
60
+ return {
61
+ secretKey: bytesToHex(secretKey),
62
+ publicKey: encode(publicKey, 'ak')
63
+ };
64
+ }
65
+
66
+ export function getKeyPair(secretKey) {
67
+ return nacl.sign.keyPair.fromSeed(secretKey);
68
+ }
69
+ export function getMasterKeyFromSeed(seed) {
70
+ const I = hmac(seed, ED25519_CURVE);
71
+ const IL = I.slice(0, 32);
72
+ const IR = I.slice(32);
73
+ return {
74
+ secretKey: IL,
75
+ chainCode: IR
76
+ };
77
+ }
78
+ export function deriveChild(_ref, index) {
79
+ let {
80
+ secretKey,
81
+ chainCode
82
+ } = _ref;
83
+
84
+ if (index < HARDENED_OFFSET) {
85
+ throw new DerivationError(`Segment ${index} is not hardened`);
86
+ }
87
+
88
+ const indexBuffer = _Buffer.allocUnsafe(4);
89
+
90
+ indexBuffer.writeUInt32BE(index, 0);
91
+ const data = concatBuffers([_Buffer.alloc(1, 0), secretKey, indexBuffer]);
92
+ const I = hmac(data, chainCode);
93
+ const IL = I.slice(0, 32);
94
+ const IR = I.slice(32);
95
+ return {
96
+ secretKey: IL,
97
+ chainCode: IR
98
+ };
99
+ }
100
+ export function generateSaveHDWalletFromSeed(seed, password) {
101
+ const walletKey = derivePathFromSeed('m/44h/457h', seed);
102
+ return {
103
+ secretKey: bytesToHex(encryptKey(password, walletKey.secretKey)),
104
+ chainCode: bytesToHex(encryptKey(password, walletKey.chainCode))
105
+ };
106
+ }
107
+ export function getSaveHDWalletAccounts(saveHDWallet, password, accountCount) {
108
+ const walletKey = {
109
+ secretKey: decryptKey(password, _Buffer.from(saveHDWallet.secretKey, 'hex')),
110
+ chainCode: decryptKey(password, _Buffer.from(saveHDWallet.chainCode, 'hex'))
111
+ };
112
+ return new Array(accountCount).fill(undefined).map((_, idx) => formatAccount(getKeyPair(derivePathFromKey(`${idx}h/0h/0h`, walletKey).secretKey)));
113
+ }
114
+ export const getHdWalletAccountFromSeed = (seed, accountIdx) => {
115
+ const walletKey = derivePathFromSeed('m/44h/457h', seed);
116
+ const derived = derivePathFromKey(`${accountIdx}h/0h/0h`, walletKey);
117
+ const keyPair = getKeyPair(derived.secretKey);
118
+ return { ...formatAccount(keyPair),
119
+ idx: accountIdx
120
+ };
121
+ };
122
+ //# sourceMappingURL=hd-wallet.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hd-wallet.mjs","names":["nacl","decryptKey","encryptKey","encode","CryptographyError","bytesToHex","concatBuffers","DerivationError","constructor","message","name","ED25519_CURVE","from","HARDENED_OFFSET","derivePathFromKey","path","key","segments","fromString","toPathArray","forEach","segment","i","reduce","parentKey","deriveChild","derivePathFromSeed","seed","slice","masterKey","getMasterKeyFromSeed","formatAccount","keys","secretKey","publicKey","getKeyPair","sign","keyPair","fromSeed","I","hmac","IL","IR","chainCode","index","indexBuffer","allocUnsafe","writeUInt32BE","data","alloc","generateSaveHDWalletFromSeed","password","walletKey","getSaveHDWalletAccounts","saveHDWallet","accountCount","Array","fill","undefined","map","_","idx","getHdWalletAccountFromSeed","accountIdx","derived"],"sources":["../../src/utils/hd-wallet.ts"],"sourcesContent":["import nacl from 'tweetnacl'\nimport { full as hmac } from 'tweetnacl-auth'\nimport { fromString } from 'bip32-path'\nimport { decryptKey, encryptKey } from './crypto'\nimport { encode } from './encoder'\nimport { CryptographyError } from './errors'\nimport { bytesToHex } from './bytes'\nimport { concatBuffers } from './other'\n\n/**\n * @category exception\n */\nexport class DerivationError extends CryptographyError {\n constructor (message: string) {\n super(message)\n this.name = 'DerivationError'\n }\n}\n\nconst ED25519_CURVE = Buffer.from('ed25519 seed')\nconst HARDENED_OFFSET = 0x80000000\n\ninterface KeyTreeNode {\n secretKey: Uint8Array\n chainCode: Uint8Array\n}\n\ninterface HDWallet {\n secretKey: string\n chainCode: string\n}\n\ninterface Account {\n secretKey: string\n publicKey: string\n}\n\ntype Dec<N extends number> = [-1, 0, 1, 2, 3, 4][N]\ntype Bip32PathT<MaxLen extends number, H extends 'H' | 'h' | '\\''> = MaxLen extends -1\n ? `${number}${H}`\n : Bip32PathT<Dec<MaxLen>, H> | `${Bip32PathT<Dec<MaxLen>, H>}/${number}${H}`\ntype Bip32Path<MaxLen extends number> =\n '' | Bip32PathT<MaxLen, 'H'> | Bip32PathT<MaxLen, 'h'> | Bip32PathT<MaxLen, '\\''>\n\nexport function derivePathFromKey (path: Bip32Path<5>, key: KeyTreeNode): KeyTreeNode {\n const segments = path === '' ? [] : fromString(path).toPathArray()\n segments.forEach((segment, i) => {\n if (segment < HARDENED_OFFSET) {\n throw new DerivationError(`Segment #${i + 1} is not hardened`)\n }\n })\n\n return segments.reduce((parentKey, segment) => deriveChild(parentKey, segment), key)\n}\n\nexport function derivePathFromSeed (path: 'm' | `m/${Bip32Path<5>}`, seed: Uint8Array): KeyTreeNode {\n if (!['m', 'm/'].includes(path.slice(0, 2))) {\n throw new DerivationError('Root element is required')\n }\n const masterKey = getMasterKeyFromSeed(seed)\n return derivePathFromKey(path.slice(2) as Bip32Path<5>, masterKey)\n}\n\nfunction formatAccount (keys: nacl.SignKeyPair): Account {\n const { secretKey, publicKey } = keys\n return {\n secretKey: bytesToHex(secretKey),\n publicKey: encode(publicKey, 'ak')\n }\n}\n\nexport function getKeyPair (secretKey: Uint8Array): nacl.SignKeyPair {\n return nacl.sign.keyPair.fromSeed(secretKey)\n}\n\nexport function getMasterKeyFromSeed (seed: Uint8Array): KeyTreeNode {\n const I = hmac(seed, ED25519_CURVE)\n const IL = I.slice(0, 32)\n const IR = I.slice(32)\n return {\n secretKey: IL,\n chainCode: IR\n }\n}\n\nexport function deriveChild ({ secretKey, chainCode }: KeyTreeNode, index: number): KeyTreeNode {\n if (index < HARDENED_OFFSET) {\n throw new DerivationError(`Segment ${index} is not hardened`)\n }\n const indexBuffer = Buffer.allocUnsafe(4)\n indexBuffer.writeUInt32BE(index, 0)\n\n const data = concatBuffers([Buffer.alloc(1, 0), secretKey, indexBuffer])\n\n const I = hmac(data, chainCode)\n const IL = I.slice(0, 32)\n const IR = I.slice(32)\n return {\n secretKey: IL,\n chainCode: IR\n }\n}\n\nexport function generateSaveHDWalletFromSeed (seed: Uint8Array, password: string): HDWallet {\n const walletKey = derivePathFromSeed('m/44h/457h', seed)\n return {\n secretKey: bytesToHex(encryptKey(password, walletKey.secretKey)),\n chainCode: bytesToHex(encryptKey(password, walletKey.chainCode))\n }\n}\n\nexport function getSaveHDWalletAccounts (\n saveHDWallet: HDWallet, password: string, accountCount: number\n): Account[] {\n const walletKey = {\n secretKey: decryptKey(password, Buffer.from(saveHDWallet.secretKey, 'hex')),\n chainCode: decryptKey(password, Buffer.from(saveHDWallet.chainCode, 'hex'))\n }\n return (new Array(accountCount)).fill(undefined)\n .map((_, idx) =>\n formatAccount(getKeyPair(derivePathFromKey(`${idx}h/0h/0h`, walletKey).secretKey)))\n}\n\nexport const getHdWalletAccountFromSeed = (\n seed: Uint8Array, accountIdx: number\n): Account & { idx: number } => {\n const walletKey = derivePathFromSeed('m/44h/457h', seed)\n const derived = derivePathFromKey(`${accountIdx}h/0h/0h`, walletKey)\n const keyPair = getKeyPair(derived.secretKey)\n return {\n ...formatAccount(keyPair),\n idx: accountIdx\n }\n}\n"],"mappings":";;;;;AAAA,OAAOA,IAAP,MAAiB,WAAjB;AACA,2BAA6B,gBAA7B;;;;AACA,uBAA2B,YAA3B;;;;SACSC,U,EAAYC,U;SACZC,M;SACAC,iB;SACAC,U;SACAC,a;AAET;AACA;AACA;;AACA,OAAO,MAAMC,eAAN,SAA8BH,iBAA9B,CAAgD;EACrDI,WAAW,CAAEC,OAAF,EAAmB;IAC5B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,iBAAZ;EACD;;AAJoD;;AAOvD,MAAMC,aAAa,GAAG,QAAOC,IAAP,CAAY,cAAZ,CAAtB;;AACA,MAAMC,eAAe,GAAG,UAAxB;AAwBA,OAAO,SAASC,iBAAT,CAA4BC,IAA5B,EAAgDC,GAAhD,EAA+E;EACpF,MAAMC,QAAQ,GAAGF,IAAI,KAAK,EAAT,GAAc,EAAd,GAAmBG,UAAU,CAACH,IAAD,CAAV,CAAiBI,WAAjB,EAApC;EACAF,QAAQ,CAACG,OAAT,CAAiB,CAACC,OAAD,EAAUC,CAAV,KAAgB;IAC/B,IAAID,OAAO,GAAGR,eAAd,EAA+B;MAC7B,MAAM,IAAIN,eAAJ,CAAqB,YAAWe,CAAC,GAAG,CAAE,kBAAtC,CAAN;IACD;EACF,CAJD;EAMA,OAAOL,QAAQ,CAACM,MAAT,CAAgB,CAACC,SAAD,EAAYH,OAAZ,KAAwBI,WAAW,CAACD,SAAD,EAAYH,OAAZ,CAAnD,EAAyEL,GAAzE,CAAP;AACD;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;EAIA,OAAQ,IAAIa,KAAJ,CAAUD,YAAV,CAAD,CAA0BE,IAA1B,CAA+BC,SAA/B,EACJC,GADI,CACA,CAACC,CAAD,EAAIC,GAAJ,KACH9B,aAAa,CAACI,UAAU,CAACrB,iBAAiB,CAAE,GAAE+C,GAAI,SAAR,EAAkBT,SAAlB,CAAjB,CAA8CnB,SAA/C,CAAX,CAFV,CAAP;AAGD;AAED,OAAO,MAAM6B,0BAA0B,GAAG,CACxCnC,IADwC,EACtBoC,UADsB,KAEV;EAC9B,MAAMX,SAAS,GAAG1B,kBAAkB,CAAC,YAAD,EAAeC,IAAf,CAApC;EACA,MAAMqC,OAAO,GAAGlD,iBAAiB,CAAE,GAAEiD,UAAW,SAAf,EAAyBX,SAAzB,CAAjC;EACA,MAAMf,OAAO,GAAGF,UAAU,CAAC6B,OAAO,CAAC/B,SAAT,CAA1B;EACA,OAAO,EACL,GAAGF,aAAa,CAACM,OAAD,CADX;IAELwB,GAAG,EAAEE;EAFA,CAAP;AAID,CAVM"}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ stringify: (value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined) => string;
3
+ parse: (text: string, reviver?: ((this: any, key: string, value: any) => any) | undefined) => any;
4
+ };
5
+ export default _default;
@@ -0,0 +1,41 @@
1
+ import JsonBig from 'json-bigint';
2
+ import BigNumber from 'bignumber.js';
3
+ import { mapObject } from "./other.mjs";
4
+ const jsonBig = JsonBig({
5
+ storeAsString: true
6
+ });
7
+
8
+ const convertValuesToBigNumbers = value => {
9
+ if (typeof value === 'object' && value !== null && value.constructor === Object) {
10
+ return mapObject(value, _ref => {
11
+ let [key, value] = _ref;
12
+ return [key, convertValuesToBigNumbers(value)];
13
+ });
14
+ }
15
+
16
+ if (Array.isArray(value)) {
17
+ return value.map(item => convertValuesToBigNumbers(item));
18
+ }
19
+
20
+ if (typeof value === 'string' && new BigNumber(value).toString(10) === value) {
21
+ const bn = new BigNumber(value);
22
+
23
+ bn.toJSON = () => bn.toString(10);
24
+
25
+ return bn;
26
+ }
27
+
28
+ return value;
29
+ };
30
+
31
+ export default {
32
+ stringify: function () {
33
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
34
+ args[_key] = arguments[_key];
35
+ }
36
+
37
+ return jsonBig.stringify(convertValuesToBigNumbers(args[0]), ...args.slice(1));
38
+ },
39
+ parse: jsonBig.parse
40
+ };
41
+ //# sourceMappingURL=json-big.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-big.mjs","names":["JsonBig","BigNumber","mapObject","jsonBig","storeAsString","convertValuesToBigNumbers","value","constructor","Object","key","Array","isArray","map","item","toString","bn","toJSON","stringify","args","slice","parse"],"sources":["../../src/utils/json-big.ts"],"sourcesContent":["import JsonBig from 'json-bigint'\nimport BigNumber from 'bignumber.js'\nimport { mapObject } from './other'\n\nconst jsonBig = JsonBig({ storeAsString: true })\n\nconst convertValuesToBigNumbers = (value: any): any => {\n if (typeof value === 'object' && value !== null && value.constructor === Object) {\n return mapObject(value, ([key, value]) => [key, convertValuesToBigNumbers(value)])\n }\n if (Array.isArray(value)) {\n return value.map(item => convertValuesToBigNumbers(item))\n }\n if (typeof value === 'string' && new BigNumber(value).toString(10) === value) {\n const bn = new BigNumber(value)\n bn.toJSON = () => bn.toString(10)\n return bn\n }\n return value\n}\n\nexport default {\n stringify: (...args: Parameters<typeof JsonBig['stringify']>): string =>\n jsonBig.stringify(convertValuesToBigNumbers(args[0]), ...args.slice(1)),\n parse: jsonBig.parse\n}\n"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,aAApB;AACA,OAAOC,SAAP,MAAsB,cAAtB;SACSC,S;AAET,MAAMC,OAAO,GAAGH,OAAO,CAAC;EAAEI,aAAa,EAAE;AAAjB,CAAD,CAAvB;;AAEA,MAAMC,yBAAyB,GAAIC,KAAD,IAAqB;EACrD,IAAI,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,KAAK,IAAvC,IAA+CA,KAAK,CAACC,WAAN,KAAsBC,MAAzE,EAAiF;IAC/E,OAAON,SAAS,CAACI,KAAD,EAAQ;MAAA,IAAC,CAACG,GAAD,EAAMH,KAAN,CAAD;MAAA,OAAkB,CAACG,GAAD,EAAMJ,yBAAyB,CAACC,KAAD,CAA/B,CAAlB;IAAA,CAAR,CAAhB;EACD;;EACD,IAAII,KAAK,CAACC,OAAN,CAAcL,KAAd,CAAJ,EAA0B;IACxB,OAAOA,KAAK,CAACM,GAAN,CAAUC,IAAI,IAAIR,yBAAyB,CAACQ,IAAD,CAA3C,CAAP;EACD;;EACD,IAAI,OAAOP,KAAP,KAAiB,QAAjB,IAA6B,IAAIL,SAAJ,CAAcK,KAAd,EAAqBQ,QAArB,CAA8B,EAA9B,MAAsCR,KAAvE,EAA8E;IAC5E,MAAMS,EAAE,GAAG,IAAId,SAAJ,CAAcK,KAAd,CAAX;;IACAS,EAAE,CAACC,MAAH,GAAY,MAAMD,EAAE,CAACD,QAAH,CAAY,EAAZ,CAAlB;;IACA,OAAOC,EAAP;EACD;;EACD,OAAOT,KAAP;AACD,CAbD;;AAeA,eAAe;EACbW,SAAS,EAAE;IAAA,kCAAIC,IAAJ;MAAIA,IAAJ;IAAA;;IAAA,OACTf,OAAO,CAACc,SAAR,CAAkBZ,yBAAyB,CAACa,IAAI,CAAC,CAAD,CAAL,CAA3C,EAAsD,GAAGA,IAAI,CAACC,KAAL,CAAW,CAAX,CAAzD,CADS;EAAA,CADE;EAGbC,KAAK,EAAEjB,OAAO,CAACiB;AAHF,CAAf"}
@@ -0,0 +1,51 @@
1
+ import nacl from 'tweetnacl';
2
+ declare const DERIVED_KEY_FUNCTIONS: {
3
+ argon2id(pass: string | Uint8Array, salt: string | Uint8Array, params: Partial<Keystore['crypto']['kdf_params']>): Promise<Uint8Array>;
4
+ };
5
+ declare const CRYPTO_FUNCTIONS: {
6
+ 'xsalsa20-poly1305': {
7
+ encrypt: nacl.secretbox;
8
+ decrypt(box: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;
9
+ };
10
+ };
11
+ export interface Keystore {
12
+ name: string;
13
+ version: 1;
14
+ public_key: string;
15
+ id: string;
16
+ crypto: {
17
+ secret_type: 'ed25519';
18
+ symmetric_alg: keyof typeof CRYPTO_FUNCTIONS;
19
+ ciphertext: string;
20
+ cipher_params: {
21
+ nonce: string;
22
+ };
23
+ kdf: keyof typeof DERIVED_KEY_FUNCTIONS;
24
+ kdf_params: {
25
+ memlimit_kib: number;
26
+ opslimit: number;
27
+ parallelism: number;
28
+ salt: string;
29
+ };
30
+ };
31
+ }
32
+ /**
33
+ * Recover plaintext private key from secret-storage key object.
34
+ * @param password - Keystore object password.
35
+ * @param keystore - Keystore object.
36
+ * @returns Plaintext private key.
37
+ */
38
+ export declare function recover(password: string | Uint8Array, { crypto }: Keystore): Promise<string>;
39
+ /**
40
+ * Export private key to keystore secret-storage format.
41
+ * @param name - Key name.
42
+ * @param password - User-supplied password.
43
+ * @param privateKey - Private key as hex-string or a Buffer.
44
+ * @param nonce - Randomly generated 24byte nonce.
45
+ * @param salt - Randomly generated 16byte salt.
46
+ * @param options - Encryption parameters.
47
+ * @param options.kdf - Key derivation function.
48
+ * @param options.kdf_params - KDF parameters.
49
+ */
50
+ export declare function dump(name: string, password: string | Uint8Array, privateKey: string | Uint8Array, nonce?: Uint8Array, salt?: Uint8Array, options?: Partial<Keystore['crypto']>): Promise<Keystore>;
51
+ export {};
@@ -0,0 +1,145 @@
1
+ import nacl from 'tweetnacl';
2
+ import { v4 as uuid } from '@aeternity/uuid';
3
+ import _aeternityArgon2BrowserDistArgon2BundledMinJs from '@aeternity/argon2-browser/dist/argon2-bundled.min.js';
4
+ const {
5
+ ArgonType,
6
+ hash
7
+ } = _aeternityArgon2BrowserDistArgon2BundledMinJs;
8
+ import { getAddressFromPriv } from "./crypto.mjs";
9
+ import { bytesToHex, hexToBytes } from "./bytes.mjs";
10
+ import { InvalidPasswordError } from "./errors.mjs";
11
+ const DERIVED_KEY_FUNCTIONS = {
12
+ async argon2id(pass, salt, params) {
13
+ const {
14
+ memlimit_kib: mem,
15
+ opslimit: time
16
+ } = params;
17
+ return (await hash({
18
+ hashLen: 32,
19
+ pass,
20
+ salt,
21
+ time,
22
+ mem,
23
+ type: ArgonType.Argon2id
24
+ })).hash;
25
+ }
26
+
27
+ };
28
+ const CRYPTO_FUNCTIONS = {
29
+ 'xsalsa20-poly1305': {
30
+ encrypt: nacl.secretbox,
31
+
32
+ decrypt() {
33
+ const res = nacl.secretbox.open(...arguments);
34
+ if (res == null) throw new InvalidPasswordError();
35
+ return res;
36
+ }
37
+
38
+ }
39
+ };
40
+ const CRYPTO_DEFAULTS = {
41
+ secret_type: 'ed25519',
42
+ symmetric_alg: 'xsalsa20-poly1305',
43
+ kdf: 'argon2id',
44
+ kdf_params: {
45
+ memlimit_kib: 65536,
46
+ opslimit: 3,
47
+ parallelism: 1
48
+ }
49
+ };
50
+ /**
51
+ * Symmetric private key encryption using secret (derived) key.
52
+ * @param plaintext - Data to be encrypted.
53
+ * @param key - Secret key.
54
+ * @param nonce - Randomly generated nonce.
55
+ * @param algo - Encryption algorithm.
56
+ * @returns Encrypted data.
57
+ */
58
+
59
+ function encrypt(plaintext, key, nonce) {
60
+ let algo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : CRYPTO_DEFAULTS.symmetric_alg;
61
+ return CRYPTO_FUNCTIONS[algo].encrypt(plaintext, nonce, key);
62
+ }
63
+ /**
64
+ * Symmetric private key decryption using secret (derived) key.
65
+ * @param ciphertext - Data to be decrypted.
66
+ * @param key - Secret key.
67
+ * @param nonce - Nonce from key-object.
68
+ * @param algo - Encryption algorithm.
69
+ * @returns Decrypted data.
70
+ */
71
+
72
+
73
+ function decrypt(ciphertext, key, nonce) {
74
+ let algo = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : CRYPTO_DEFAULTS.symmetric_alg;
75
+ return CRYPTO_FUNCTIONS[algo].decrypt(ciphertext, nonce, key);
76
+ }
77
+ /**
78
+ * Derive secret key from password with key derivation function.
79
+ * @param password - User-supplied password.
80
+ * @param nonce - Randomly generated nonce.
81
+ * @param kdf - Key derivation function.
82
+ * @param kdfParams - KDF parameters.
83
+ * @returns Secret key derived from password.
84
+ */
85
+
86
+
87
+ async function deriveKey(password, nonce, kdf, kdfParams) {
88
+ return await DERIVED_KEY_FUNCTIONS[kdf](password, nonce, kdfParams);
89
+ }
90
+ /**
91
+ * Recover plaintext private key from secret-storage key object.
92
+ * @param password - Keystore object password.
93
+ * @param keystore - Keystore object.
94
+ * @returns Plaintext private key.
95
+ */
96
+
97
+
98
+ export async function recover(password, _ref) {
99
+ let {
100
+ crypto
101
+ } = _ref;
102
+ const salt = hexToBytes(crypto.kdf_params.salt);
103
+ return bytesToHex(decrypt(hexToBytes(crypto.ciphertext), await deriveKey(password, salt, crypto.kdf, crypto.kdf_params), hexToBytes(crypto.cipher_params.nonce), crypto.symmetric_alg));
104
+ }
105
+ /**
106
+ * Export private key to keystore secret-storage format.
107
+ * @param name - Key name.
108
+ * @param password - User-supplied password.
109
+ * @param privateKey - Private key as hex-string or a Buffer.
110
+ * @param nonce - Randomly generated 24byte nonce.
111
+ * @param salt - Randomly generated 16byte salt.
112
+ * @param options - Encryption parameters.
113
+ * @param options.kdf - Key derivation function.
114
+ * @param options.kdf_params - KDF parameters.
115
+ */
116
+
117
+ export async function dump(name, password, privateKey) {
118
+ let nonce = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : nacl.randomBytes(24);
119
+ let salt = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : nacl.randomBytes(16);
120
+ let options = arguments.length > 5 ? arguments[5] : undefined;
121
+ const opt = { ...CRYPTO_DEFAULTS,
122
+ ...options
123
+ };
124
+ const derivedKey = await deriveKey(password, salt, opt.kdf, opt.kdf_params);
125
+ const payload = typeof privateKey === 'string' ? hexToBytes(privateKey) : privateKey;
126
+ return {
127
+ name,
128
+ version: 1,
129
+ public_key: getAddressFromPriv(payload),
130
+ id: uuid(),
131
+ crypto: {
132
+ secret_type: opt.secret_type,
133
+ symmetric_alg: opt.symmetric_alg,
134
+ ciphertext: bytesToHex(encrypt(payload, derivedKey, nonce, opt.symmetric_alg)),
135
+ cipher_params: {
136
+ nonce: bytesToHex(nonce)
137
+ },
138
+ kdf: opt.kdf,
139
+ kdf_params: { ...opt.kdf_params,
140
+ salt: bytesToHex(salt)
141
+ }
142
+ }
143
+ };
144
+ }
145
+ //# sourceMappingURL=keystore.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keystore.mjs","names":["nacl","v4","uuid","getAddressFromPriv","bytesToHex","hexToBytes","InvalidPasswordError","DERIVED_KEY_FUNCTIONS","argon2id","pass","salt","params","memlimit_kib","mem","opslimit","time","hash","hashLen","type","ArgonType","Argon2id","CRYPTO_FUNCTIONS","encrypt","secretbox","decrypt","res","open","CRYPTO_DEFAULTS","secret_type","symmetric_alg","kdf","kdf_params","parallelism","plaintext","key","nonce","algo","ciphertext","deriveKey","password","kdfParams","recover","crypto","cipher_params","dump","name","privateKey","randomBytes","options","opt","derivedKey","payload","version","public_key","id"],"sources":["../../src/utils/keystore.ts"],"sourcesContent":["import nacl from 'tweetnacl'\nimport { v4 as uuid } from '@aeternity/uuid'\nimport { ArgonType, hash } from '@aeternity/argon2-browser/dist/argon2-bundled.min.js'\nimport { getAddressFromPriv } from './crypto'\nimport { bytesToHex, hexToBytes } from './bytes'\nimport { InvalidPasswordError } from './errors'\n\nconst DERIVED_KEY_FUNCTIONS = {\n async argon2id (\n pass: string | Uint8Array,\n salt: string | Uint8Array,\n params: Partial<Keystore['crypto']['kdf_params']>\n ): Promise<Uint8Array> {\n const { memlimit_kib: mem, opslimit: time } = params\n\n return (await hash({\n hashLen: 32,\n pass,\n salt,\n time,\n mem,\n type: ArgonType.Argon2id\n })).hash\n }\n}\n\nconst CRYPTO_FUNCTIONS = {\n 'xsalsa20-poly1305': {\n encrypt: nacl.secretbox,\n decrypt (...args: Parameters<typeof nacl.secretbox.open>): Uint8Array {\n const res = nacl.secretbox.open(...args)\n if (res == null) throw new InvalidPasswordError()\n return res\n }\n }\n}\n\nexport interface Keystore {\n name: string\n version: 1\n public_key: string\n id: string\n crypto: {\n secret_type: 'ed25519'\n symmetric_alg: keyof typeof CRYPTO_FUNCTIONS\n ciphertext: string\n cipher_params: {\n nonce: string\n }\n kdf: keyof typeof DERIVED_KEY_FUNCTIONS\n kdf_params: {\n memlimit_kib: number\n opslimit: number\n parallelism: number\n salt: string\n }\n }\n}\n\nconst CRYPTO_DEFAULTS = {\n secret_type: 'ed25519',\n symmetric_alg: 'xsalsa20-poly1305',\n kdf: 'argon2id',\n kdf_params: {\n memlimit_kib: 65536,\n opslimit: 3,\n parallelism: 1\n }\n} as const\n\n/**\n * Symmetric private key encryption using secret (derived) key.\n * @param plaintext - Data to be encrypted.\n * @param key - Secret key.\n * @param nonce - Randomly generated nonce.\n * @param algo - Encryption algorithm.\n * @returns Encrypted data.\n */\nfunction encrypt (\n plaintext: Uint8Array,\n key: Uint8Array,\n nonce: Uint8Array,\n algo: keyof typeof CRYPTO_FUNCTIONS = CRYPTO_DEFAULTS.symmetric_alg\n): Uint8Array {\n return CRYPTO_FUNCTIONS[algo].encrypt(plaintext, nonce, key)\n}\n\n/**\n * Symmetric private key decryption using secret (derived) key.\n * @param ciphertext - Data to be decrypted.\n * @param key - Secret key.\n * @param nonce - Nonce from key-object.\n * @param algo - Encryption algorithm.\n * @returns Decrypted data.\n */\nfunction decrypt (\n ciphertext: Uint8Array,\n key: Uint8Array,\n nonce: Uint8Array,\n algo: keyof typeof CRYPTO_FUNCTIONS = CRYPTO_DEFAULTS.symmetric_alg\n): Uint8Array {\n return CRYPTO_FUNCTIONS[algo].decrypt(ciphertext, nonce, key)\n}\n\n/**\n * Derive secret key from password with key derivation function.\n * @param password - User-supplied password.\n * @param nonce - Randomly generated nonce.\n * @param kdf - Key derivation function.\n * @param kdfParams - KDF parameters.\n * @returns Secret key derived from password.\n */\nasync function deriveKey (\n password: string | Uint8Array,\n nonce: string | Uint8Array,\n kdf: Keystore['crypto']['kdf'],\n kdfParams: Omit<Keystore['crypto']['kdf_params'], 'salt'>\n): Promise<Uint8Array> {\n return await DERIVED_KEY_FUNCTIONS[kdf](password, nonce, kdfParams)\n}\n\n/**\n * Recover plaintext private key from secret-storage key object.\n * @param password - Keystore object password.\n * @param keystore - Keystore object.\n * @returns Plaintext private key.\n */\nexport async function recover (\n password: string | Uint8Array, { crypto }: Keystore\n): Promise<string> {\n const salt = hexToBytes(crypto.kdf_params.salt)\n return bytesToHex(decrypt(\n hexToBytes(crypto.ciphertext),\n await deriveKey(password, salt, crypto.kdf, crypto.kdf_params),\n hexToBytes(crypto.cipher_params.nonce),\n crypto.symmetric_alg\n ))\n}\n\n/**\n * Export private key to keystore secret-storage format.\n * @param name - Key name.\n * @param password - User-supplied password.\n * @param privateKey - Private key as hex-string or a Buffer.\n * @param nonce - Randomly generated 24byte nonce.\n * @param salt - Randomly generated 16byte salt.\n * @param options - Encryption parameters.\n * @param options.kdf - Key derivation function.\n * @param options.kdf_params - KDF parameters.\n */\nexport async function dump (\n name: string,\n password: string | Uint8Array,\n privateKey: string | Uint8Array,\n nonce: Uint8Array = nacl.randomBytes(24),\n salt: Uint8Array = nacl.randomBytes(16),\n options?: Partial<Keystore['crypto']>\n): Promise<Keystore> {\n const opt = { ...CRYPTO_DEFAULTS, ...options }\n const derivedKey = await deriveKey(password, salt, opt.kdf, opt.kdf_params)\n const payload = typeof privateKey === 'string' ? hexToBytes(privateKey) : privateKey\n return {\n name,\n version: 1,\n public_key: getAddressFromPriv(payload),\n id: uuid(),\n crypto: {\n secret_type: opt.secret_type,\n symmetric_alg: opt.symmetric_alg,\n ciphertext: bytesToHex(encrypt(payload, derivedKey, nonce, opt.symmetric_alg)),\n cipher_params: { nonce: bytesToHex(nonce) },\n kdf: opt.kdf,\n kdf_params: {\n ...opt.kdf_params,\n salt: bytesToHex(salt)\n }\n }\n }\n}\n"],"mappings":"A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AA,IAFnBrC,IAEmB,uEAFAV,IAAI,CAAC+C,WAAL,CAAiB,EAAjB,CAEA;EAAA,IADnBC,OACmB;EACnB,MAAMC,GAAG,GAAG,EAAE,GAAGtB,eAAL;IAAsB,GAAGqB;EAAzB,CAAZ;EACA,MAAME,UAAU,GAAG,MAAMZ,SAAS,CAACC,QAAD,EAAW7B,IAAX,EAAiBuC,GAAG,CAACnB,GAArB,EAA0BmB,GAAG,CAAClB,UAA9B,CAAlC;EACA,MAAMoB,OAAO,GAAG,OAAOL,UAAP,KAAsB,QAAtB,GAAiCzC,UAAU,CAACyC,UAAD,CAA3C,GAA0DA,UAA1E;EACA,OAAO;IACLD,IADK;IAELO,OAAO,EAAE,CAFJ;IAGLC,UAAU,EAAElD,kBAAkB,CAACgD,OAAD,CAHzB;IAILG,EAAE,EAAEpD,IAAI,EAJH;IAKLwC,MAAM,EAAE;MACNd,WAAW,EAAEqB,GAAG,CAACrB,WADX;MAENC,aAAa,EAAEoB,GAAG,CAACpB,aAFb;MAGNQ,UAAU,EAAEjC,UAAU,CAACkB,OAAO,CAAC6B,OAAD,EAAUD,UAAV,EAAsBf,KAAtB,EAA6Bc,GAAG,CAACpB,aAAjC,CAAR,CAHhB;MAINc,aAAa,EAAE;QAAER,KAAK,EAAE/B,UAAU,CAAC+B,KAAD;MAAnB,CAJT;MAKNL,GAAG,EAAEmB,GAAG,CAACnB,GALH;MAMNC,UAAU,EAAE,EACV,GAAGkB,GAAG,CAAClB,UADG;QAEVrB,IAAI,EAAEN,UAAU,CAACM,IAAD;MAFN;IANN;EALH,CAAP;AAiBD"}
@@ -6,24 +6,21 @@ export default class MPTree {
6
6
  private static nodeHash;
7
7
  /**
8
8
  * Deserialize Merkle Patricia Tree
9
- * @rtype (binary: Array) => MPTree
10
- * @param {Array} binary - Binary
11
- * @return {MPTree} Merkle Patricia Tree
9
+ * @param binary - Binary
10
+ * @returns Merkle Patricia Tree
12
11
  */
13
12
  constructor(binary: MPTreeBinary);
14
13
  isEqual(tree: MPTree): boolean;
15
14
  private static parseNode;
16
15
  /**
17
16
  * Serialize Merkle Patricia Tree
18
- * @rtype () => Array
19
- * @return {Array} Binary
17
+ * @returns Binary
20
18
  */
21
19
  serialize(): MPTreeBinary;
22
20
  /**
23
21
  * Retrieve value from Merkle Patricia Tree
24
- * @rtype (key: String) => Buffer
25
- * @param {String} key - The key of the element to retrieve
26
- * @return {Buffer} Value associated to the specified key
22
+ * @param key - The key of the element to retrieve
23
+ * @returns Value associated to the specified key
27
24
  */
28
25
  get(key: string): Buffer | undefined;
29
26
  }