@aptos-labs/ts-sdk 1.14.0-zeta.0 → 1.14.0-zeta.1

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 (482) hide show
  1. package/dist/common/{accountAddress-NPQwRmxn.d.ts → accountAddress-u9wEan9p.d.ts} +32 -4
  2. package/dist/common/chunk-QRI7EC4T.js +24 -0
  3. package/dist/common/chunk-QRI7EC4T.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +245 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +290 -171
  8. package/dist/common/index.js +11786 -374
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/account/Account.mjs +55 -1
  11. package/dist/esm/account/Ed25519Account.mjs +53 -1
  12. package/dist/esm/account/EphemeralKeyPair.d.mts +38 -5
  13. package/dist/esm/account/EphemeralKeyPair.mjs +36 -1
  14. package/dist/esm/account/KeylessAccount.d.mts +75 -37
  15. package/dist/esm/account/KeylessAccount.mjs +56 -1
  16. package/dist/esm/account/MultiKeyAccount.d.mts +4 -0
  17. package/dist/esm/account/MultiKeyAccount.mjs +55 -1
  18. package/dist/esm/account/SingleKeyAccount.mjs +53 -1
  19. package/dist/esm/account/index.d.mts +2 -1
  20. package/dist/esm/account/index.mjs +76 -1
  21. package/dist/esm/api/account.mjs +76 -1
  22. package/dist/esm/api/ans.mjs +87 -1
  23. package/dist/esm/api/aptos.d.mts +1 -0
  24. package/dist/esm/api/aptos.mjs +116 -1
  25. package/dist/esm/api/aptosConfig.mjs +9 -1
  26. package/dist/esm/api/coin.mjs +86 -1
  27. package/dist/esm/api/digitalAsset.mjs +87 -1
  28. package/dist/esm/api/event.mjs +54 -1
  29. package/dist/esm/api/faucet.mjs +53 -1
  30. package/dist/esm/api/fungibleAsset.mjs +87 -1
  31. package/dist/esm/api/general.mjs +84 -1
  32. package/dist/esm/api/index.d.mts +1 -0
  33. package/dist/esm/api/index.mjs +120 -1
  34. package/dist/esm/api/keyless.d.mts +19 -5
  35. package/dist/esm/api/keyless.mjs +70 -1
  36. package/dist/esm/api/staking.mjs +54 -1
  37. package/dist/esm/api/transaction.mjs +94 -1
  38. package/dist/esm/api/transactionSubmission/build.mjs +85 -1
  39. package/dist/esm/api/transactionSubmission/helpers.mjs +9 -1
  40. package/dist/esm/api/transactionSubmission/management.mjs +89 -1
  41. package/dist/esm/api/transactionSubmission/sign.mjs +109 -1
  42. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  43. package/dist/esm/api/transactionSubmission/simulate.mjs +86 -1
  44. package/dist/esm/api/transactionSubmission/submit.mjs +86 -1
  45. package/dist/esm/api/utils.mjs +34 -1
  46. package/dist/esm/bcs/consts.mjs +17 -1
  47. package/dist/esm/bcs/deserializer.d.mts +26 -0
  48. package/dist/esm/bcs/deserializer.mjs +8 -1
  49. package/dist/esm/bcs/index.mjs +57 -1
  50. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +12 -1
  51. package/dist/esm/bcs/serializable/fixedBytes.mjs +11 -1
  52. package/dist/esm/bcs/serializable/movePrimitives.mjs +25 -1
  53. package/dist/esm/bcs/serializable/moveStructs.mjs +18 -1
  54. package/dist/esm/bcs/serializer.mjs +18 -1
  55. package/dist/esm/chunk-2JOCR2VL.mjs +32 -0
  56. package/dist/esm/chunk-2JOCR2VL.mjs.map +1 -0
  57. package/dist/esm/chunk-2OQW7BMN.mjs +129 -0
  58. package/dist/esm/{chunk-7WJTKYRG.mjs.map → chunk-2OQW7BMN.mjs.map} +1 -1
  59. package/dist/esm/chunk-2TJJWII2.mjs +23 -0
  60. package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-2TJJWII2.mjs.map} +1 -1
  61. package/dist/esm/chunk-2ZEGJU43.mjs +252 -0
  62. package/dist/esm/{chunk-KWNBC5MF.mjs.map → chunk-2ZEGJU43.mjs.map} +1 -1
  63. package/dist/esm/chunk-4OYYOYSO.mjs +336 -0
  64. package/dist/esm/chunk-4OYYOYSO.mjs.map +1 -0
  65. package/dist/esm/{chunk-S4SEFF4K.mjs → chunk-4PJ5FYGQ.mjs} +302 -27
  66. package/dist/esm/{chunk-S4SEFF4K.mjs.map → chunk-4PJ5FYGQ.mjs.map} +1 -1
  67. package/dist/esm/chunk-55NODGHC.mjs +135 -0
  68. package/dist/esm/{chunk-G4XSNSOT.mjs.map → chunk-55NODGHC.mjs.map} +1 -1
  69. package/dist/esm/chunk-6LRQSBRH.mjs +130 -0
  70. package/dist/esm/{chunk-C5UVSNZW.mjs.map → chunk-6LRQSBRH.mjs.map} +1 -1
  71. package/dist/esm/chunk-6MSZMIFW.mjs +23 -0
  72. package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-6MSZMIFW.mjs.map} +1 -1
  73. package/dist/esm/chunk-76TSTAU4.mjs +120 -0
  74. package/dist/esm/{chunk-FLYEALDB.mjs.map → chunk-76TSTAU4.mjs.map} +1 -1
  75. package/dist/esm/chunk-7FO3S6IZ.mjs +324 -0
  76. package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-7FO3S6IZ.mjs.map} +1 -1
  77. package/dist/esm/chunk-7FUHWL6A.mjs +42 -0
  78. package/dist/esm/{chunk-SRPTQ4VV.mjs.map → chunk-7FUHWL6A.mjs.map} +1 -1
  79. package/dist/esm/chunk-7IDBB4J4.mjs +33 -0
  80. package/dist/esm/{chunk-PINF6ZWP.mjs.map → chunk-7IDBB4J4.mjs.map} +1 -1
  81. package/dist/esm/chunk-7JRMOHBP.mjs +247 -0
  82. package/dist/esm/chunk-7JRMOHBP.mjs.map +1 -0
  83. package/dist/esm/chunk-7REUIYF4.mjs +63 -0
  84. package/dist/esm/chunk-7REUIYF4.mjs.map +1 -0
  85. package/dist/esm/chunk-AC3OGAL6.mjs +87 -0
  86. package/dist/esm/{chunk-U6Z4FNB7.mjs.map → chunk-AC3OGAL6.mjs.map} +1 -1
  87. package/dist/esm/chunk-AR7X6GWQ.mjs +356 -0
  88. package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-AR7X6GWQ.mjs.map} +1 -1
  89. package/dist/esm/chunk-ASF2VWOX.mjs +142 -0
  90. package/dist/esm/{chunk-O34EOOVF.mjs.map → chunk-ASF2VWOX.mjs.map} +1 -1
  91. package/dist/esm/chunk-ATVFVXR6.mjs +43 -0
  92. package/dist/esm/{chunk-IXYXFDJZ.mjs.map → chunk-ATVFVXR6.mjs.map} +1 -1
  93. package/dist/esm/chunk-B5S6DDUD.mjs +120 -0
  94. package/dist/esm/chunk-B5S6DDUD.mjs.map +1 -0
  95. package/dist/esm/chunk-BXMHDQHW.mjs +512 -0
  96. package/dist/esm/{chunk-DLTC6PJP.mjs.map → chunk-BXMHDQHW.mjs.map} +1 -1
  97. package/dist/esm/chunk-CC4DQ6NH.mjs +19 -0
  98. package/dist/esm/{chunk-H3TFQ7K4.mjs.map → chunk-CC4DQ6NH.mjs.map} +1 -1
  99. package/dist/esm/chunk-CMNJG4NN.mjs +345 -0
  100. package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-CMNJG4NN.mjs.map} +1 -1
  101. package/dist/esm/chunk-CTJSZT5V.mjs +87 -0
  102. package/dist/esm/{chunk-J7J7ZTBF.mjs.map → chunk-CTJSZT5V.mjs.map} +1 -1
  103. package/dist/esm/chunk-CX3NAVRD.mjs +205 -0
  104. package/dist/esm/chunk-CX3NAVRD.mjs.map +1 -0
  105. package/dist/esm/chunk-CXUGZXED.mjs +307 -0
  106. package/dist/esm/{chunk-EKABTHUZ.mjs.map → chunk-CXUGZXED.mjs.map} +1 -1
  107. package/dist/esm/chunk-D2BVBXWO.mjs +7 -0
  108. package/dist/esm/{chunk-7PSX4LCV.mjs.map → chunk-D2BVBXWO.mjs.map} +1 -1
  109. package/dist/esm/chunk-DGV7DYU4.mjs +413 -0
  110. package/dist/esm/{chunk-7Q2NVO5M.mjs.map → chunk-DGV7DYU4.mjs.map} +1 -1
  111. package/dist/esm/chunk-DIYZRGR6.mjs +242 -0
  112. package/dist/esm/{chunk-UVOU6BW2.mjs.map → chunk-DIYZRGR6.mjs.map} +1 -1
  113. package/dist/esm/chunk-DNPMS2OF.mjs +236 -0
  114. package/dist/esm/{chunk-PFFAQZHT.mjs.map → chunk-DNPMS2OF.mjs.map} +1 -1
  115. package/dist/esm/chunk-DVPQGCFT.mjs +74 -0
  116. package/dist/esm/{chunk-RBPGL6YB.mjs.map → chunk-DVPQGCFT.mjs.map} +1 -1
  117. package/dist/esm/chunk-EYHRMZPO.mjs +34 -0
  118. package/dist/esm/{chunk-AH44UPM4.mjs.map → chunk-EYHRMZPO.mjs.map} +1 -1
  119. package/dist/esm/chunk-F2ZWA7B7.mjs +412 -0
  120. package/dist/esm/{chunk-RTSEMQCK.mjs.map → chunk-F2ZWA7B7.mjs.map} +1 -1
  121. package/dist/esm/chunk-FDWJNY4U.mjs +22 -0
  122. package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-FDWJNY4U.mjs.map} +1 -1
  123. package/dist/esm/chunk-FF4JPDKD.mjs +315 -0
  124. package/dist/esm/{chunk-5DW2AJPI.mjs.map → chunk-FF4JPDKD.mjs.map} +1 -1
  125. package/dist/esm/chunk-FQQW55X7.mjs +288 -0
  126. package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-FQQW55X7.mjs.map} +1 -1
  127. package/dist/esm/chunk-FXKSE3ZP.mjs +25 -0
  128. package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-FXKSE3ZP.mjs.map} +1 -1
  129. package/dist/esm/chunk-GBEVD2VM.mjs +99 -0
  130. package/dist/esm/chunk-GBEVD2VM.mjs.map +1 -0
  131. package/dist/esm/chunk-GGMTQAQP.mjs +11 -0
  132. package/dist/esm/{chunk-3JPVQHOR.mjs.map → chunk-GGMTQAQP.mjs.map} +1 -1
  133. package/dist/esm/chunk-GSVQ6EUD.mjs +649 -0
  134. package/dist/esm/{chunk-WOLIXKOK.mjs.map → chunk-GSVQ6EUD.mjs.map} +1 -1
  135. package/dist/esm/chunk-HBNSRCZN.mjs +100 -0
  136. package/dist/esm/{chunk-FKSACFCB.mjs.map → chunk-HBNSRCZN.mjs.map} +1 -1
  137. package/dist/esm/chunk-IC56GQFJ.mjs +127 -0
  138. package/dist/esm/{chunk-XN4SQWI5.mjs.map → chunk-IC56GQFJ.mjs.map} +1 -1
  139. package/dist/esm/chunk-IHNPN5CQ.mjs +256 -0
  140. package/dist/esm/chunk-IHNPN5CQ.mjs.map +1 -0
  141. package/dist/esm/chunk-JHDHNGJ3.mjs +126 -0
  142. package/dist/esm/{chunk-JVKMQ64G.mjs.map → chunk-JHDHNGJ3.mjs.map} +1 -1
  143. package/dist/esm/chunk-JL2JHVS4.mjs +49 -0
  144. package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-JL2JHVS4.mjs.map} +1 -1
  145. package/dist/esm/chunk-JV3GSIJW.mjs +268 -0
  146. package/dist/esm/chunk-JV3GSIJW.mjs.map +1 -0
  147. package/dist/esm/chunk-KK2BSALW.mjs +32 -0
  148. package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-KK2BSALW.mjs.map} +1 -1
  149. package/dist/esm/chunk-KMXSRHJ6.mjs +93 -0
  150. package/dist/esm/{chunk-NMECYE3D.mjs.map → chunk-KMXSRHJ6.mjs.map} +1 -1
  151. package/dist/esm/chunk-KVSQ57HU.mjs +45 -0
  152. package/dist/esm/{chunk-NNW6HWIO.mjs.map → chunk-KVSQ57HU.mjs.map} +1 -1
  153. package/dist/esm/chunk-LI2QV6RU.mjs +129 -0
  154. package/dist/esm/chunk-LI2QV6RU.mjs.map +1 -0
  155. package/dist/esm/chunk-LLLQJWRZ.mjs +35 -0
  156. package/dist/esm/{chunk-QNHDS64I.mjs.map → chunk-LLLQJWRZ.mjs.map} +1 -1
  157. package/dist/esm/chunk-LYK4TQZO.mjs +70 -0
  158. package/dist/esm/{chunk-OZC3FCJP.mjs.map → chunk-LYK4TQZO.mjs.map} +1 -1
  159. package/dist/esm/chunk-LYMY63SO.mjs +124 -0
  160. package/dist/esm/{chunk-UGIJHLL3.mjs.map → chunk-LYMY63SO.mjs.map} +1 -1
  161. package/dist/esm/chunk-MZZLEY6O.mjs +92 -0
  162. package/dist/esm/{chunk-NKCZ4KGO.mjs.map → chunk-MZZLEY6O.mjs.map} +1 -1
  163. package/dist/esm/chunk-N4WKFNQ6.mjs +156 -0
  164. package/dist/esm/{chunk-LDQ6JFEF.mjs.map → chunk-N4WKFNQ6.mjs.map} +1 -1
  165. package/dist/esm/chunk-NFJCQRVK.mjs +37 -0
  166. package/dist/esm/{chunk-YE5B2S5L.mjs.map → chunk-NFJCQRVK.mjs.map} +1 -1
  167. package/dist/esm/chunk-NMKCJNQM.mjs +20 -0
  168. package/dist/esm/{chunk-TJDC5PWD.mjs.map → chunk-NMKCJNQM.mjs.map} +1 -1
  169. package/dist/esm/chunk-NW45SCPY.mjs +36 -0
  170. package/dist/esm/{chunk-V7P6MLSY.mjs.map → chunk-NW45SCPY.mjs.map} +1 -1
  171. package/dist/esm/chunk-NXFO2W4G.mjs +84 -0
  172. package/dist/esm/{chunk-D22EMNIY.mjs.map → chunk-NXFO2W4G.mjs.map} +1 -1
  173. package/dist/esm/chunk-NYL77J4X.mjs +97 -0
  174. package/dist/esm/{chunk-43WARVT3.mjs.map → chunk-NYL77J4X.mjs.map} +1 -1
  175. package/dist/esm/chunk-O6PSHSN3.mjs +53 -0
  176. package/dist/esm/{chunk-6LOTZ4GY.mjs.map → chunk-O6PSHSN3.mjs.map} +1 -1
  177. package/dist/esm/chunk-OR7TEZ25.mjs +16 -0
  178. package/dist/esm/chunk-PCLNX6FS.mjs +17 -0
  179. package/dist/esm/{chunk-6FBKUTGF.mjs.map → chunk-PCLNX6FS.mjs.map} +1 -1
  180. package/dist/esm/chunk-PIMQHG2J.mjs +49 -0
  181. package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-PIMQHG2J.mjs.map} +1 -1
  182. package/dist/esm/chunk-PU5AFUX3.mjs +52 -0
  183. package/dist/esm/chunk-PU5AFUX3.mjs.map +1 -0
  184. package/dist/esm/chunk-PYLOAMR2.mjs +29 -0
  185. package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-PYLOAMR2.mjs.map} +1 -1
  186. package/dist/esm/chunk-QBBTUC66.mjs +15 -0
  187. package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-QBBTUC66.mjs.map} +1 -1
  188. package/dist/esm/chunk-QFOG4LIN.mjs +319 -0
  189. package/dist/esm/{chunk-RJ4PSGZ4.mjs.map → chunk-QFOG4LIN.mjs.map} +1 -1
  190. package/dist/esm/chunk-QMM2KL6C.mjs +12 -0
  191. package/dist/esm/{chunk-FBPNHF54.mjs.map → chunk-QMM2KL6C.mjs.map} +1 -1
  192. package/dist/esm/chunk-RCQMWXEW.mjs +35 -0
  193. package/dist/esm/{chunk-TXMPXZBG.mjs.map → chunk-RCQMWXEW.mjs.map} +1 -1
  194. package/dist/esm/chunk-RX4VG2AT.mjs +314 -0
  195. package/dist/esm/chunk-RX4VG2AT.mjs.map +1 -0
  196. package/dist/esm/chunk-SBB4YEPT.mjs +17 -0
  197. package/dist/esm/{chunk-56CNRT2K.mjs.map → chunk-SBB4YEPT.mjs.map} +1 -1
  198. package/dist/esm/chunk-SIJELMDP.mjs +29 -0
  199. package/dist/esm/{chunk-6EMN3BOV.mjs.map → chunk-SIJELMDP.mjs.map} +1 -1
  200. package/dist/esm/chunk-SS3NUM5L.mjs +94 -0
  201. package/dist/esm/{chunk-L54P6EGN.mjs.map → chunk-SS3NUM5L.mjs.map} +1 -1
  202. package/dist/esm/chunk-ST4QXIMI.mjs +37 -0
  203. package/dist/esm/{chunk-XMFPKHB5.mjs.map → chunk-ST4QXIMI.mjs.map} +1 -1
  204. package/dist/esm/chunk-TBHU6ZW6.mjs +215 -0
  205. package/dist/esm/{chunk-QHVZL3LZ.mjs.map → chunk-TBHU6ZW6.mjs.map} +1 -1
  206. package/dist/esm/chunk-TLNHRJB2.mjs +155 -0
  207. package/dist/esm/{chunk-H6LYW7HG.mjs.map → chunk-TLNHRJB2.mjs.map} +1 -1
  208. package/dist/esm/chunk-U3IUCR2G.mjs +54 -0
  209. package/dist/esm/{chunk-52ECIIIH.mjs.map → chunk-U3IUCR2G.mjs.map} +1 -1
  210. package/dist/esm/chunk-U7QBZ6PP.mjs +400 -0
  211. package/dist/esm/{chunk-ZM436N3W.mjs.map → chunk-U7QBZ6PP.mjs.map} +1 -1
  212. package/dist/esm/chunk-UEBBLQJ5.mjs +94 -0
  213. package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-UEBBLQJ5.mjs.map} +1 -1
  214. package/dist/esm/chunk-UKU6A2W2.mjs +232 -0
  215. package/dist/esm/{chunk-HXSW6X7K.mjs.map → chunk-UKU6A2W2.mjs.map} +1 -1
  216. package/dist/esm/chunk-UX5NSZEN.mjs +134 -0
  217. package/dist/esm/{chunk-WVIPPU2C.mjs.map → chunk-UX5NSZEN.mjs.map} +1 -1
  218. package/dist/esm/chunk-VDJBDX3A.mjs +79 -0
  219. package/dist/esm/{chunk-25N7RLBW.mjs.map → chunk-VDJBDX3A.mjs.map} +1 -1
  220. package/dist/esm/chunk-VJP2VWMF.mjs +58 -0
  221. package/dist/esm/{chunk-56NB52W6.mjs.map → chunk-VJP2VWMF.mjs.map} +1 -1
  222. package/dist/esm/chunk-VKJQORON.mjs +93 -0
  223. package/dist/esm/{chunk-3OELNIC6.mjs.map → chunk-VKJQORON.mjs.map} +1 -1
  224. package/dist/esm/chunk-VPWUODU4.mjs +51 -0
  225. package/dist/esm/{chunk-NNIHTVLA.mjs.map → chunk-VPWUODU4.mjs.map} +1 -1
  226. package/dist/esm/chunk-VZQXLVEP.mjs +197 -0
  227. package/dist/esm/{chunk-VJJN3GFD.mjs.map → chunk-VZQXLVEP.mjs.map} +1 -1
  228. package/dist/esm/chunk-W76MGKZB.mjs +33 -0
  229. package/dist/esm/{chunk-CLVAGDXO.mjs.map → chunk-W76MGKZB.mjs.map} +1 -1
  230. package/dist/esm/chunk-WDRH2URB.mjs +91 -0
  231. package/dist/esm/{chunk-65UZZNN2.mjs.map → chunk-WDRH2URB.mjs.map} +1 -1
  232. package/dist/esm/chunk-WHBWEN6N.mjs +206 -0
  233. package/dist/esm/{chunk-NGNETNK2.mjs.map → chunk-WHBWEN6N.mjs.map} +1 -1
  234. package/dist/esm/chunk-WK5ZSNE2.mjs +173 -0
  235. package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-WK5ZSNE2.mjs.map} +1 -1
  236. package/dist/esm/chunk-WLTBF4DF.mjs +22 -0
  237. package/dist/esm/chunk-WLTBF4DF.mjs.map +1 -0
  238. package/dist/esm/chunk-WVGO4D7K.mjs +254 -0
  239. package/dist/esm/{chunk-OLGSIKFB.mjs.map → chunk-WVGO4D7K.mjs.map} +1 -1
  240. package/dist/esm/chunk-XANFAUBD.mjs +44 -0
  241. package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-XANFAUBD.mjs.map} +1 -1
  242. package/dist/esm/chunk-Y2LV3S5W.mjs +410 -0
  243. package/dist/esm/{chunk-6SHLLRJA.mjs.map → chunk-Y2LV3S5W.mjs.map} +1 -1
  244. package/dist/esm/chunk-YV7M4CFP.mjs +137 -0
  245. package/dist/esm/{chunk-AOCNYMMX.mjs.map → chunk-YV7M4CFP.mjs.map} +1 -1
  246. package/dist/esm/chunk-YYOPNUX5.mjs +41 -0
  247. package/dist/esm/chunk-YYOPNUX5.mjs.map +1 -0
  248. package/dist/esm/chunk-ZAHJ7KXB.mjs +81 -0
  249. package/dist/esm/{chunk-Z5KKUXYI.mjs.map → chunk-ZAHJ7KXB.mjs.map} +1 -1
  250. package/dist/esm/chunk-ZMFKQUHL.mjs +117 -0
  251. package/dist/esm/{chunk-TICM455H.mjs.map → chunk-ZMFKQUHL.mjs.map} +1 -1
  252. package/dist/esm/cli/index.mjs +12 -1
  253. package/dist/esm/cli/localNode.mjs +8 -1
  254. package/dist/esm/cli/move.mjs +7 -1
  255. package/dist/esm/client/core.mjs +27 -1
  256. package/dist/esm/client/get.mjs +32 -1
  257. package/dist/esm/client/index.mjs +55 -1
  258. package/dist/esm/client/post.mjs +36 -1
  259. package/dist/esm/client/types.d.mts +5 -1
  260. package/dist/esm/client/types.mjs +7 -1
  261. package/dist/esm/core/account/index.mjs +19 -1
  262. package/dist/esm/core/account/utils/address.mjs +18 -1
  263. package/dist/esm/core/account/utils/index.mjs +19 -1
  264. package/dist/esm/core/accountAddress.mjs +15 -1
  265. package/dist/esm/core/authenticationKey.mjs +14 -1
  266. package/dist/esm/core/common.mjs +7 -1
  267. package/dist/esm/core/crypto/ed25519.d.mts +10 -0
  268. package/dist/esm/core/crypto/ed25519.mjs +29 -1
  269. package/dist/esm/core/crypto/ephemeral.d.mts +16 -20
  270. package/dist/esm/core/crypto/ephemeral.mjs +28 -1
  271. package/dist/esm/core/crypto/hdKey.d.mts +1 -15
  272. package/dist/esm/core/crypto/hdKey.mjs +25 -1
  273. package/dist/esm/core/crypto/index.d.mts +3 -2
  274. package/dist/esm/core/crypto/index.mjs +124 -1
  275. package/dist/esm/core/crypto/keyless.d.mts +121 -106
  276. package/dist/esm/core/crypto/keyless.mjs +55 -1
  277. package/dist/esm/core/crypto/multiEd25519.mjs +28 -1
  278. package/dist/esm/core/crypto/multiKey.mjs +34 -1
  279. package/dist/esm/core/crypto/poseidon.mjs +15 -1
  280. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  281. package/dist/esm/core/crypto/proof.d.mts +21 -0
  282. package/dist/esm/core/crypto/proof.mjs +20 -0
  283. package/dist/esm/core/crypto/proof.mjs.map +1 -0
  284. package/dist/esm/core/crypto/publicKey.mjs +21 -1
  285. package/dist/esm/core/crypto/secp256k1.mjs +27 -1
  286. package/dist/esm/core/crypto/signature.mjs +19 -1
  287. package/dist/esm/core/crypto/singleKey.mjs +33 -1
  288. package/dist/esm/core/crypto/utils.mjs +9 -1
  289. package/dist/esm/core/hex.mjs +10 -1
  290. package/dist/esm/core/index.d.mts +3 -2
  291. package/dist/esm/core/index.mjs +141 -1
  292. package/dist/esm/index.d.mts +5 -4
  293. package/dist/esm/index.mjs +635 -1
  294. package/dist/esm/internal/account.mjs +106 -1
  295. package/dist/esm/internal/ans.mjs +120 -1
  296. package/dist/esm/internal/coin.mjs +85 -1
  297. package/dist/esm/internal/digitalAsset.mjs +127 -1
  298. package/dist/esm/internal/event.mjs +55 -1
  299. package/dist/esm/internal/faucet.mjs +52 -1
  300. package/dist/esm/internal/fungibleAsset.mjs +91 -1
  301. package/dist/esm/internal/general.mjs +46 -1
  302. package/dist/esm/internal/keyless.d.mts +4 -3
  303. package/dist/esm/internal/keyless.mjs +73 -1
  304. package/dist/esm/internal/staking.mjs +53 -1
  305. package/dist/esm/internal/transaction.mjs +51 -1
  306. package/dist/esm/internal/transactionSubmission.mjs +102 -1
  307. package/dist/esm/internal/view.mjs +83 -1
  308. package/dist/esm/transactions/authenticator/account.mjs +44 -1
  309. package/dist/esm/transactions/authenticator/index.mjs +60 -1
  310. package/dist/esm/transactions/authenticator/transaction.mjs +48 -1
  311. package/dist/esm/transactions/index.mjs +284 -1
  312. package/dist/esm/transactions/instances/chainId.mjs +11 -1
  313. package/dist/esm/transactions/instances/identifier.mjs +11 -1
  314. package/dist/esm/transactions/instances/index.mjs +96 -1
  315. package/dist/esm/transactions/instances/moduleId.mjs +38 -1
  316. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +43 -1
  317. package/dist/esm/transactions/instances/rawTransaction.mjs +48 -1
  318. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +20 -1
  319. package/dist/esm/transactions/instances/signedTransaction.mjs +45 -1
  320. package/dist/esm/transactions/instances/simpleTransaction.mjs +43 -1
  321. package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
  322. package/dist/esm/transactions/instances/transactionPayload.mjs +56 -1
  323. package/dist/esm/transactions/management/accountSequenceNumber.mjs +74 -1
  324. package/dist/esm/transactions/management/asyncQueue.mjs +9 -1
  325. package/dist/esm/transactions/management/index.mjs +95 -1
  326. package/dist/esm/transactions/management/transactionWorker.mjs +91 -1
  327. package/dist/esm/transactions/transactionBuilder/helpers.mjs +75 -1
  328. package/dist/esm/transactions/transactionBuilder/index.mjs +162 -1
  329. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +85 -1
  330. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +58 -1
  331. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +98 -1
  332. package/dist/esm/transactions/typeTag/index.mjs +74 -1
  333. package/dist/esm/transactions/typeTag/parser.mjs +43 -1
  334. package/dist/esm/transactions/types.mjs +1 -1
  335. package/dist/esm/types/generated/queries.mjs +57 -1
  336. package/dist/esm/types/generated/types.mjs +809 -1
  337. package/dist/esm/types/generated/types.mjs.map +1 -1
  338. package/dist/esm/types/index.d.mts +6 -4
  339. package/dist/esm/types/index.mjs +68 -1
  340. package/dist/esm/types/indexer.mjs +1 -1
  341. package/dist/esm/types/keyless.d.mts +54 -1
  342. package/dist/esm/types/keyless.mjs +9 -0
  343. package/dist/esm/utils/apiEndpoints.mjs +21 -1
  344. package/dist/esm/utils/const.mjs +21 -1
  345. package/dist/esm/utils/helpers.mjs +7 -1
  346. package/dist/esm/utils/index.mjs +56 -1
  347. package/dist/esm/utils/memoize.mjs +9 -1
  348. package/dist/esm/utils/normalizeBundle.mjs +19 -1
  349. package/dist/esm/version.d.mts +1 -1
  350. package/dist/esm/version.mjs +7 -1
  351. package/package.json +5 -2
  352. package/src/account/EphemeralKeyPair.ts +45 -7
  353. package/src/account/KeylessAccount.ts +152 -113
  354. package/src/account/MultiKeyAccount.ts +4 -0
  355. package/src/api/keyless.ts +17 -4
  356. package/src/bcs/deserializer.ts +40 -0
  357. package/src/client/core.ts +1 -1
  358. package/src/client/types.ts +1 -1
  359. package/src/core/account/index.ts +0 -1
  360. package/src/core/crypto/ed25519.ts +24 -4
  361. package/src/core/crypto/ephemeral.ts +17 -28
  362. package/src/core/crypto/hdKey.ts +0 -31
  363. package/src/core/crypto/keyless.ts +231 -286
  364. package/src/core/crypto/proof.ts +16 -0
  365. package/src/internal/keyless.ts +16 -15
  366. package/src/internal/transactionSubmission.ts +16 -6
  367. package/src/transactions/management/transactionWorker.ts +1 -7
  368. package/src/types/index.ts +5 -2
  369. package/src/types/keyless.ts +31 -0
  370. package/src/utils/apiEndpoints.ts +6 -6
  371. package/src/version.ts +1 -1
  372. package/dist/common/chunk-KSEUZTKY.js +0 -2
  373. package/dist/common/chunk-KSEUZTKY.js.map +0 -1
  374. package/dist/esm/chunk-25N7RLBW.mjs +0 -2
  375. package/dist/esm/chunk-32355KGV.mjs +0 -2
  376. package/dist/esm/chunk-32355KGV.mjs.map +0 -1
  377. package/dist/esm/chunk-3FVRXELT.mjs +0 -2
  378. package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
  379. package/dist/esm/chunk-3OELNIC6.mjs +0 -2
  380. package/dist/esm/chunk-3U5VRZLS.mjs +0 -2
  381. package/dist/esm/chunk-3U5VRZLS.mjs.map +0 -1
  382. package/dist/esm/chunk-3VGX3TXH.mjs +0 -2
  383. package/dist/esm/chunk-43WARVT3.mjs +0 -2
  384. package/dist/esm/chunk-52ECIIIH.mjs +0 -2
  385. package/dist/esm/chunk-56CNRT2K.mjs +0 -2
  386. package/dist/esm/chunk-56NB52W6.mjs +0 -2
  387. package/dist/esm/chunk-5DW2AJPI.mjs +0 -2
  388. package/dist/esm/chunk-5QWUIVAQ.mjs +0 -2
  389. package/dist/esm/chunk-5QWUIVAQ.mjs.map +0 -1
  390. package/dist/esm/chunk-6456EI2E.mjs +0 -2
  391. package/dist/esm/chunk-6456EI2E.mjs.map +0 -1
  392. package/dist/esm/chunk-65UZZNN2.mjs +0 -2
  393. package/dist/esm/chunk-6EMN3BOV.mjs +0 -2
  394. package/dist/esm/chunk-6FBKUTGF.mjs +0 -2
  395. package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
  396. package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
  397. package/dist/esm/chunk-6LOTZ4GY.mjs +0 -2
  398. package/dist/esm/chunk-6RBUXB5I.mjs +0 -2
  399. package/dist/esm/chunk-6SHLLRJA.mjs +0 -2
  400. package/dist/esm/chunk-73Y4NTDU.mjs +0 -2
  401. package/dist/esm/chunk-73Y4NTDU.mjs.map +0 -1
  402. package/dist/esm/chunk-7PSX4LCV.mjs +0 -2
  403. package/dist/esm/chunk-7Q2NVO5M.mjs +0 -2
  404. package/dist/esm/chunk-7STYQ5ZE.mjs +0 -2
  405. package/dist/esm/chunk-7WJTKYRG.mjs +0 -2
  406. package/dist/esm/chunk-AH44UPM4.mjs +0 -2
  407. package/dist/esm/chunk-AOCNYMMX.mjs +0 -2
  408. package/dist/esm/chunk-C3L4ETUF.mjs +0 -2
  409. package/dist/esm/chunk-C5UVSNZW.mjs +0 -2
  410. package/dist/esm/chunk-CLVAGDXO.mjs +0 -2
  411. package/dist/esm/chunk-COW5IGYC.mjs +0 -2
  412. package/dist/esm/chunk-D22EMNIY.mjs +0 -2
  413. package/dist/esm/chunk-DLTC6PJP.mjs +0 -2
  414. package/dist/esm/chunk-EB7AI4B4.mjs +0 -2
  415. package/dist/esm/chunk-EKABTHUZ.mjs +0 -2
  416. package/dist/esm/chunk-EOMDZYSJ.mjs +0 -2
  417. package/dist/esm/chunk-EOMDZYSJ.mjs.map +0 -1
  418. package/dist/esm/chunk-FBPNHF54.mjs +0 -2
  419. package/dist/esm/chunk-FKSACFCB.mjs +0 -2
  420. package/dist/esm/chunk-FLYEALDB.mjs +0 -2
  421. package/dist/esm/chunk-FVA2OPG4.mjs +0 -2
  422. package/dist/esm/chunk-G4XSNSOT.mjs +0 -2
  423. package/dist/esm/chunk-H3TFQ7K4.mjs +0 -2
  424. package/dist/esm/chunk-H6LYW7HG.mjs +0 -2
  425. package/dist/esm/chunk-HCGWCB5E.mjs +0 -2
  426. package/dist/esm/chunk-HCGWCB5E.mjs.map +0 -1
  427. package/dist/esm/chunk-HGZGTBA4.mjs +0 -2
  428. package/dist/esm/chunk-HXSW6X7K.mjs +0 -2
  429. package/dist/esm/chunk-IXYXFDJZ.mjs +0 -2
  430. package/dist/esm/chunk-J7J7ZTBF.mjs +0 -2
  431. package/dist/esm/chunk-JVKMQ64G.mjs +0 -2
  432. package/dist/esm/chunk-KWNBC5MF.mjs +0 -2
  433. package/dist/esm/chunk-L54P6EGN.mjs +0 -2
  434. package/dist/esm/chunk-LDQ6JFEF.mjs +0 -2
  435. package/dist/esm/chunk-MGOHPDX4.mjs +0 -2
  436. package/dist/esm/chunk-MWUJCP27.mjs +0 -2
  437. package/dist/esm/chunk-NC5HHEEM.mjs +0 -2
  438. package/dist/esm/chunk-NGNETNK2.mjs +0 -2
  439. package/dist/esm/chunk-NKCZ4KGO.mjs +0 -2
  440. package/dist/esm/chunk-NMECYE3D.mjs +0 -2
  441. package/dist/esm/chunk-NNIHTVLA.mjs +0 -2
  442. package/dist/esm/chunk-NNW6HWIO.mjs +0 -2
  443. package/dist/esm/chunk-O34EOOVF.mjs +0 -2
  444. package/dist/esm/chunk-OBEVVLF7.mjs +0 -2
  445. package/dist/esm/chunk-OBEVVLF7.mjs.map +0 -1
  446. package/dist/esm/chunk-OKRUEVF3.mjs +0 -2
  447. package/dist/esm/chunk-OKRUEVF3.mjs.map +0 -1
  448. package/dist/esm/chunk-OLGSIKFB.mjs +0 -2
  449. package/dist/esm/chunk-OZC3FCJP.mjs +0 -2
  450. package/dist/esm/chunk-PFFAQZHT.mjs +0 -2
  451. package/dist/esm/chunk-PINF6ZWP.mjs +0 -2
  452. package/dist/esm/chunk-PJXRQBF6.mjs +0 -2
  453. package/dist/esm/chunk-PJXRQBF6.mjs.map +0 -1
  454. package/dist/esm/chunk-QHVZL3LZ.mjs +0 -2
  455. package/dist/esm/chunk-QNHDS64I.mjs +0 -2
  456. package/dist/esm/chunk-RBPGL6YB.mjs +0 -2
  457. package/dist/esm/chunk-RJ4PSGZ4.mjs +0 -2
  458. package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
  459. package/dist/esm/chunk-RTSEMQCK.mjs +0 -2
  460. package/dist/esm/chunk-SRPTQ4VV.mjs +0 -2
  461. package/dist/esm/chunk-STYDBDYL.mjs +0 -2
  462. package/dist/esm/chunk-T23OVRNF.mjs +0 -2
  463. package/dist/esm/chunk-TICM455H.mjs +0 -2
  464. package/dist/esm/chunk-TJDC5PWD.mjs +0 -2
  465. package/dist/esm/chunk-TVRJ3M7B.mjs +0 -2
  466. package/dist/esm/chunk-TXMPXZBG.mjs +0 -2
  467. package/dist/esm/chunk-U6Z4FNB7.mjs +0 -2
  468. package/dist/esm/chunk-UGIJHLL3.mjs +0 -2
  469. package/dist/esm/chunk-UVOU6BW2.mjs +0 -2
  470. package/dist/esm/chunk-V7P6MLSY.mjs +0 -2
  471. package/dist/esm/chunk-VJJN3GFD.mjs +0 -2
  472. package/dist/esm/chunk-WOLIXKOK.mjs +0 -2
  473. package/dist/esm/chunk-WVIPPU2C.mjs +0 -2
  474. package/dist/esm/chunk-XCR3YNHW.mjs +0 -2
  475. package/dist/esm/chunk-XCR3YNHW.mjs.map +0 -1
  476. package/dist/esm/chunk-XMFPKHB5.mjs +0 -2
  477. package/dist/esm/chunk-XN4SQWI5.mjs +0 -2
  478. package/dist/esm/chunk-YE5B2S5L.mjs +0 -2
  479. package/dist/esm/chunk-Z5KKUXYI.mjs +0 -2
  480. package/dist/esm/chunk-ZM436N3W.mjs +0 -2
  481. package/dist/esm/chunk-ZNEBMSNC.mjs +0 -2
  482. /package/dist/esm/{chunk-FVA2OPG4.mjs.map → chunk-OR7TEZ25.mjs.map} +0 -0
@@ -2,21 +2,20 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { JwtPayload, jwtDecode } from "jwt-decode";
5
+ import { JwksClient } from "jwks-rsa";
5
6
  import { decode } from "base-64";
6
7
  import EventEmitter from "eventemitter3";
7
- import { HexInput, SigningScheme } from "../types";
8
+ import { EphemeralCertificateVariant, HexInput, SigningScheme } from "../types";
8
9
  import { AccountAddress } from "../core/accountAddress";
9
10
  import {
10
11
  AnyPublicKey,
11
12
  AnySignature,
12
13
  KeylessPublicKey,
13
14
  KeylessSignature,
14
- OpenIdSignature,
15
- OpenIdSignatureOrZkProof,
15
+ EphemeralCertificate,
16
16
  Signature,
17
- SignedGroth16Signature,
18
- computeAddressSeed,
19
- fromDerivationPath as fromDerivationPathInner,
17
+ ZeroKnowledgeSig,
18
+ ZkProof,
20
19
  } from "../core/crypto";
21
20
 
22
21
  import { Account } from "./Account";
@@ -24,64 +23,44 @@ import { EphemeralKeyPair } from "./EphemeralKeyPair";
24
23
  import { Hex } from "../core/hex";
25
24
  import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
26
25
  import { Deserializer, Serializable, Serializer } from "../bcs";
27
- import { deriveTransactionType, generateSigningMessage } from "../transactions/transactionBuilder/signingMessage";
28
- import { AnyRawTransaction } from "../transactions/types";
29
-
30
- function base64UrlDecode(base64Url: string): string {
31
- // Replace base64url-specific characters
32
- const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
33
- // Pad the string with '=' characters if needed
34
- const paddedBase64 = base64 + "==".substring(0, (3 - (base64.length % 3)) % 3);
35
- // Decode the base64 string using the base-64 library
36
- const decodedString = decode(paddedBase64);
37
- return decodedString;
38
- }
39
-
40
- export type ProofFetchSuccess = {
41
- status: "Success";
42
- };
26
+ import {
27
+ deriveTransactionType,
28
+ generateSigningMessageForSerializable,
29
+ } from "../transactions/transactionBuilder/signingMessage";
30
+ import { AnyRawTransaction, AnyRawTransactionInstance } from "../transactions/types";
43
31
 
44
- export type ProofFetchFailure = {
45
- status: "Failed";
46
- error: string;
32
+ export const IssuerToJwkEndpoint: Record<string, string> = {
33
+ "https://accounts.google.com": "https://www.googleapis.com/oauth2/v3/certs",
47
34
  };
48
35
 
49
- export type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure
50
-
51
- export type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;
52
-
53
- export interface ProofFetchEvents {
54
- proofFetchFinish: (status: ProofFetchStatus) => void;
55
- }
56
-
57
36
  export class KeylessAccount extends Serializable implements Account {
58
37
  static readonly PEPPER_LENGTH: number = 31;
59
38
 
60
- static readonly SLIP_0010_SEED: string = "32 bytes";
39
+ readonly publicKey: KeylessPublicKey;
61
40
 
62
- publicKey: KeylessPublicKey;
41
+ readonly ephemeralKeyPair: EphemeralKeyPair;
63
42
 
64
- ephemeralKeyPair: EphemeralKeyPair;
43
+ readonly uidKey: string;
65
44
 
66
- uidKey: string;
45
+ readonly uidVal: string;
67
46
 
68
- uidVal: string;
47
+ readonly aud: string;
69
48
 
70
- aud: string;
49
+ readonly pepper: Uint8Array;
71
50
 
72
- pepper: Uint8Array;
51
+ readonly accountAddress: AccountAddress;
73
52
 
74
- accountAddress: AccountAddress;
53
+ proof: ZeroKnowledgeSig | undefined;
75
54
 
76
- proof: SignedGroth16Signature | undefined;
55
+ readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
77
56
 
78
- proofOrPromise: SignedGroth16Signature | Promise<SignedGroth16Signature>;
57
+ readonly signingScheme: SigningScheme;
79
58
 
80
- signingScheme: SigningScheme;
59
+ private jwt: string;
81
60
 
82
- jwt: string;
61
+ private isJwtValid: boolean;
83
62
 
84
- emitter: EventEmitter<ProofFetchEvents>;
63
+ readonly emitter: EventEmitter<ProofFetchEvents>;
85
64
 
86
65
  constructor(args: {
87
66
  address?: AccountAddress;
@@ -91,15 +70,14 @@ export class KeylessAccount extends Serializable implements Account {
91
70
  uidVal: string;
92
71
  aud: string;
93
72
  pepper: HexInput;
94
- proofOrFetcher: SignedGroth16Signature | Promise<SignedGroth16Signature>;
95
- proofFetchCallback?: ProofFetchCallback
73
+ proofOrFetcher: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
74
+ proofFetchCallback?: ProofFetchCallback;
96
75
  jwt: string;
97
76
  }) {
98
77
  super();
99
- const { address, ephemeralKeyPair, iss, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;
78
+ const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;
100
79
  this.ephemeralKeyPair = ephemeralKeyPair;
101
- const addressSeed = computeAddressSeed(args);
102
- this.publicKey = new KeylessPublicKey(iss, addressSeed);
80
+ this.publicKey = KeylessPublicKey.create(args);
103
81
  this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
104
82
  this.uidKey = uidKey;
105
83
  this.uidVal = uidVal;
@@ -107,11 +85,11 @@ export class KeylessAccount extends Serializable implements Account {
107
85
  this.jwt = jwt;
108
86
  this.emitter = new EventEmitter<ProofFetchEvents>();
109
87
  this.proofOrPromise = proofOrFetcher;
110
- if (proofOrFetcher instanceof SignedGroth16Signature) {
88
+ if (proofOrFetcher instanceof ZeroKnowledgeSig) {
111
89
  this.proof = proofOrFetcher;
112
90
  } else {
113
91
  if (proofFetchCallback === undefined) {
114
- throw new Error("Must provide callback for async proof fetch")
92
+ throw new Error("Must provide callback for async proof fetch");
115
93
  }
116
94
  this.emitter.on("proofFetchFinish", async (status) => {
117
95
  await proofFetchCallback(status);
@@ -119,25 +97,28 @@ export class KeylessAccount extends Serializable implements Account {
119
97
  });
120
98
  this.init(proofOrFetcher);
121
99
  }
122
-
123
-
124
100
  this.signingScheme = SigningScheme.SingleKey;
125
101
  const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
126
102
  if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {
127
103
  throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);
128
104
  }
129
105
  this.pepper = pepperBytes;
106
+ this.isJwtValid = true;
130
107
  }
131
108
 
132
- async init(promise: Promise<SignedGroth16Signature>) {
109
+ /**
110
+ * This initializes the asyncronous proof fetch
111
+ * @return
112
+ */
113
+ async init(promise: Promise<ZeroKnowledgeSig>) {
133
114
  try {
134
115
  this.proof = await promise;
135
- this.emitter.emit("proofFetchFinish", {status: "Success"});
116
+ this.emitter.emit("proofFetchFinish", { status: "Success" });
136
117
  } catch (error) {
137
118
  if (error instanceof Error) {
138
- this.emitter.emit("proofFetchFinish", {status: "Failed", error: error.toString()});
119
+ this.emitter.emit("proofFetchFinish", { status: "Failed", error: error.toString() });
139
120
  } else {
140
- this.emitter.emit("proofFetchFinish", {status: "Failed", error: "Unknown"});
121
+ this.emitter.emit("proofFetchFinish", { status: "Failed", error: "Unknown" });
141
122
  }
142
123
  }
143
124
  }
@@ -148,7 +129,7 @@ export class KeylessAccount extends Serializable implements Account {
148
129
  serializer.serializeFixedBytes(this.pepper);
149
130
  this.ephemeralKeyPair.serialize(serializer);
150
131
  if (this.proof === undefined) {
151
- throw new Error("Connot serialize - proof undefined")
132
+ throw new Error("Connot serialize - proof undefined");
152
133
  }
153
134
  this.proof.serialize(serializer);
154
135
  }
@@ -158,7 +139,7 @@ export class KeylessAccount extends Serializable implements Account {
158
139
  const uidKey = deserializer.deserializeStr();
159
140
  const pepper = deserializer.deserializeFixedBytes(31);
160
141
  const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);
161
- const proof = SignedGroth16Signature.deserialize(deserializer);
142
+ const proof = ZeroKnowledgeSig.deserialize(deserializer);
162
143
  return KeylessAccount.fromJWTAndProof({
163
144
  proof,
164
145
  pepper,
@@ -168,98 +149,116 @@ export class KeylessAccount extends Serializable implements Account {
168
149
  });
169
150
  }
170
151
 
152
+ /**
153
+ * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair
154
+ * and JWT token.
155
+ * @return boolean
156
+ */
171
157
  isExpired(): boolean {
172
158
  return this.ephemeralKeyPair.isExpired();
173
159
  }
174
160
 
175
- bcsToBytes(): Uint8Array {
176
- const serializer = new Serializer();
177
- this.serialize(serializer);
178
- return serializer.toUint8Array();
179
- }
180
-
181
- bcsToHex(): Hex {
182
- const bcsBytes = this.bcsToBytes();
183
- return Hex.fromHexInput(bcsBytes);
161
+ /**
162
+ * Checks if the the JWK used to verify the token still exists on the issuer's JWK uri.
163
+ * Caches the result.
164
+ * @return boolean
165
+ */
166
+ async checkJwkValidity(): Promise<boolean> {
167
+ if (!this.isJwtValid) {
168
+ return false;
169
+ }
170
+ const jwtHeader = jwtDecode(this.jwt, { header: true });
171
+ const client = new JwksClient({
172
+ jwksUri: IssuerToJwkEndpoint[this.publicKey.iss],
173
+ });
174
+ try {
175
+ await client.getSigningKey(jwtHeader.kid);
176
+ return true;
177
+ } catch (error) {
178
+ this.isJwtValid = false;
179
+ return false;
180
+ }
184
181
  }
185
182
 
183
+ /**
184
+ * Sign a message using Keyless.
185
+ * @param message the message to sign, as binary input
186
+ * @return the AccountAuthenticator containing the signature, together with the account's public key
187
+ */
186
188
  signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
187
189
  const signature = new AnySignature(this.sign(message));
188
190
  const publicKey = new AnyPublicKey(this.publicKey);
189
191
  return new AccountAuthenticatorSingleKey(publicKey, signature);
190
192
  }
191
193
 
194
+ /**
195
+ * Sign a transaction using Keyless.
196
+ * @param transaction the raw transaction
197
+ * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
198
+ */
192
199
  signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
193
- const raw = deriveTransactionType(transaction);
194
- const signature = new AnySignature(this.sign(raw.bcsToBytes()));
200
+ const signature = new AnySignature(this.signTransaction(transaction));
195
201
  const publicKey = new AnyPublicKey(this.publicKey);
196
202
  return new AccountAuthenticatorSingleKey(publicKey, signature);
197
203
  }
198
204
 
205
+ /**
206
+ * Waits for asyncronous proof fetching to finish.
207
+ * @return
208
+ */
199
209
  async waitForProofFetch() {
200
210
  if (this.proofOrPromise instanceof Promise) {
201
211
  await this.proofOrPromise;
202
212
  }
203
213
  }
204
214
 
205
- sign(data: HexInput): Signature {
215
+ /**
216
+ * Sign the given message using Keyless.
217
+ * @param message in HexInput format
218
+ * @returns Signature
219
+ */
220
+ sign(data: HexInput): KeylessSignature {
206
221
  const { expiryDateSecs } = this.ephemeralKeyPair;
207
- const currentTimeInSeconds = Math.floor(new Date().getTime() / 1000);
208
- if (expiryDateSecs < currentTimeInSeconds) {
222
+ if (this.isExpired()) {
209
223
  throw new Error("Ephemeral key pair is expired.");
210
224
  }
211
225
  if (this.proof === undefined) {
212
226
  throw new Error("Proof not found");
213
227
  }
214
- const jwtHeader = this.jwt.split(".")[0];
228
+ if (!this.isJwtValid) {
229
+ throw new Error("The proof has expired. Please refetch proof");
230
+ }
215
231
  const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
216
-
217
- const serializer = new Serializer();
218
- serializer.serializeFixedBytes(Hex.fromHexInput(data).toUint8Array());
219
- serializer.serializeOption(this.proof.proof);
220
- const signMess = generateSigningMessage(serializer.toUint8Array(), "APTOS::TransactionAndProof");
221
-
222
- const ephemeralSignature = this.ephemeralKeyPair.sign(signMess);
232
+ const ephemeralSignature = this.ephemeralKeyPair.sign(data);
223
233
 
224
234
  return new KeylessSignature({
225
- jwtHeader: base64UrlDecode(jwtHeader),
226
- openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(this.proof),
235
+ jwtHeader: base64UrlDecode(this.jwt.split(".")[0]),
236
+ ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),
227
237
  expiryDateSecs,
228
238
  ephemeralPublicKey,
229
239
  ephemeralSignature,
230
240
  });
231
241
  }
232
242
 
233
- signTransaction(transaction: AnyRawTransaction): Signature {
243
+ /**
244
+ * Sign the given transaction with Keyless.
245
+ * Signs the transaction and proof to guard against proof malleability.
246
+ * @param transaction the transaction to be signed
247
+ * @returns KeylessSignature
248
+ */
249
+ signTransaction(transaction: AnyRawTransaction): KeylessSignature {
250
+ if (this.proof === undefined) {
251
+ throw new Error("Proof not found");
252
+ }
234
253
  const raw = deriveTransactionType(transaction);
235
- return this.sign(raw.bcsToBytes());
236
- }
237
-
238
- signWithOpenIdSignature(data: HexInput): Signature {
239
- const [jwtHeader, jwtPayload, jwtSignature] = this.jwt.split(".");
240
- const openIdSig = new OpenIdSignature({
241
- jwtSignature,
242
- jwtPayloadJson: jwtPayload,
243
- uidKey: this.uidKey,
244
- epkBlinder: this.ephemeralKeyPair.blinder,
245
- pepper: this.pepper,
246
- });
247
-
248
- const { expiryDateSecs } = this.ephemeralKeyPair;
249
- const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
250
- const ephemeralSignature = this.ephemeralKeyPair.sign(data);
251
- return new KeylessSignature({
252
- jwtHeader,
253
- openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(openIdSig),
254
- expiryDateSecs,
255
- ephemeralPublicKey,
256
- ephemeralSignature,
257
- });
254
+ const txnAndProof = new TransactionAndProof(raw, this.proof.proof);
255
+ const signMess = generateSigningMessageForSerializable(txnAndProof);
256
+ return this.sign(signMess);
258
257
  }
259
258
 
260
259
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
261
260
  verifySignature(args: { message: HexInput; signature: Signature }): boolean {
262
- return true;
261
+ throw new Error("Not implemented");
263
262
  }
264
263
 
265
264
  static fromBytes(bytes: Uint8Array): KeylessAccount {
@@ -267,7 +266,7 @@ export class KeylessAccount extends Serializable implements Account {
267
266
  }
268
267
 
269
268
  static fromJWTAndProof(args: {
270
- proof: SignedGroth16Signature | Promise<SignedGroth16Signature>;
269
+ proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
271
270
  jwt: string;
272
271
  ephemeralKeyPair: EphemeralKeyPair;
273
272
  pepper: HexInput;
@@ -296,8 +295,48 @@ export class KeylessAccount extends Serializable implements Account {
296
295
  proofFetchCallback,
297
296
  });
298
297
  }
298
+ }
299
+
300
+ class TransactionAndProof extends Serializable {
301
+ transaction: AnyRawTransactionInstance;
302
+
303
+ proof?: ZkProof;
304
+
305
+ constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {
306
+ super();
307
+ this.transaction = transaction;
308
+ this.proof = proof;
309
+ }
299
310
 
300
- static fromDerivationPath(path: string, seed: Uint8Array): Uint8Array {
301
- return fromDerivationPathInner(path, KeylessAccount.SLIP_0010_SEED, seed);
311
+ serialize(serializer: Serializer): void {
312
+ serializer.serializeFixedBytes(this.transaction.bcsToBytes());
313
+ serializer.serializeOption(this.proof);
302
314
  }
303
315
  }
316
+
317
+ function base64UrlDecode(base64Url: string): string {
318
+ // Replace base64url-specific characters
319
+ const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
320
+ // Pad the string with '=' characters if needed
321
+ const paddedBase64 = base64 + "==".substring(0, (3 - (base64.length % 3)) % 3);
322
+ // Decode the base64 string using the base-64 library
323
+ const decodedString = decode(paddedBase64);
324
+ return decodedString;
325
+ }
326
+
327
+ export type ProofFetchSuccess = {
328
+ status: "Success";
329
+ };
330
+
331
+ export type ProofFetchFailure = {
332
+ status: "Failed";
333
+ error: string;
334
+ };
335
+
336
+ export type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;
337
+
338
+ export type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;
339
+
340
+ export interface ProofFetchEvents {
341
+ proofFetchFinish: (status: ProofFetchStatus) => void;
342
+ }
@@ -124,6 +124,10 @@ export class MultiKeyAccount implements Account {
124
124
  return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));
125
125
  }
126
126
 
127
+ /**
128
+ * Waits for any proofs to be fetched
129
+ * @return
130
+ */
127
131
  async waitForProofFetch() {
128
132
  const keylessSigners = this.signers.filter((signer) => signer instanceof KeylessAccount) as KeylessAccount[];
129
133
  await Promise.all(keylessSigners.filter((signer) => signer.proof instanceof Promise).map((signer) => signer.proof));
@@ -7,21 +7,34 @@ import { HexInput } from "../types";
7
7
  import { AptosConfig } from "./aptosConfig";
8
8
 
9
9
  /**
10
- * A class to query all `OIDB` related queries on Aptos.
10
+ * A class to query all `Keyless` related queries on Aptos.
11
11
  */
12
12
  export class Keyless {
13
13
  constructor(readonly config: AptosConfig) {}
14
14
 
15
15
  /**
16
- * TODO
16
+ * Fetches the pepper from the Aptos pepper service API.
17
17
  *
18
- * @param args.jwt jwt token
19
- * @returns The pepper
18
+ * @param args.jwt JWT token
19
+ * @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token
20
+ * @returns The pepper which is a Uint8Array of length 31.
20
21
  */
21
22
  async getPepper(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair }): Promise<Uint8Array> {
22
23
  return getPepper({ aptosConfig: this.config, ...args });
23
24
  }
24
25
 
26
+ /**
27
+ * Fetches the pepper from the Aptos pepper service API.
28
+ *
29
+ * @param args.jwt JWT token
30
+ * @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token
31
+ * @param args.uidKey a key in the JWT token to use to set the uidVal in the IdCommitment
32
+ * @param args.pepper the pepper
33
+ * @param args.extraFieldKey a key in the JWT token used to reveal a value on chain
34
+ * @param args.proofFetchCallback a callback function that if set, the fetch of the proof will be done asyncronously. Once
35
+ * if finishes the callback function will be called.
36
+ * @returns A KeylessAccount that can be used to sign transactions
37
+ */
25
38
  async deriveKeylessAccount(args: {
26
39
  jwt: string;
27
40
  ephemeralKeyPair: EphemeralKeyPair;
@@ -56,6 +56,46 @@ export class Deserializer {
56
56
  return textDecoder.decode(value);
57
57
  }
58
58
 
59
+ /**
60
+ * Deserializes a an optional string.
61
+ *
62
+ * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content
63
+ * @example
64
+ * ```ts
65
+ * const deserializer = new Deserializer(new Uint8Array([0x00]));
66
+ * assert(deserializer.deserializeOptionStr() === undefined);
67
+ * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
68
+ * assert(deserializer.deserializeOptionStr() === "1234abcd");
69
+ * ```
70
+ */
71
+ deserializeOptionStr(): string | undefined {
72
+ const exists = this.deserializeUleb128AsU32();
73
+ if (exists === 1) {
74
+ return this.deserializeStr();
75
+ }
76
+ return undefined;
77
+ }
78
+
79
+ /**
80
+ * Deserializes a an optional string.
81
+ *
82
+ * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content
83
+ * @example
84
+ * ```ts
85
+ * const deserializer = new Deserializer(new Uint8Array([0x00]));
86
+ * assert(deserializer.deserializeOptionStr() === undefined);
87
+ * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
88
+ * assert(deserializer.deserializeOptionStr() === "1234abcd");
89
+ * ```
90
+ */
91
+ deserializeOption<T>(cls: Deserializable<T>): T | undefined {
92
+ const exists = this.deserializeUleb128AsU32();
93
+ if (exists === 1) {
94
+ return this.deserialize(cls);
95
+ }
96
+ return undefined;
97
+ }
98
+
59
99
  /**
60
100
  * Deserializes an array of bytes.
61
101
  *
@@ -110,7 +110,7 @@ export async function aptosRequest<Req extends {}, Res extends {}>(
110
110
  throw new AptosApiError(options, result, `${response.data}`);
111
111
  }
112
112
 
113
- if (aptosConfig.isPepperServiceRequest(url)) {
113
+ if (aptosConfig.isPepperServiceRequest(url) || aptosConfig.isProverServiceRequest(url)) {
114
114
  throw new AptosApiError(options, result, `${response.data}`);
115
115
  }
116
116
 
@@ -41,7 +41,7 @@ export class AptosApiError extends Error {
41
41
 
42
42
  readonly statusText: string;
43
43
 
44
- readonly data: any;
44
+ readonly data: { message: string; error_code?: string; vm_error_code?: number };
45
45
 
46
46
  readonly request: AptosRequest;
47
47
 
@@ -1,2 +1 @@
1
1
  export * from "./utils";
2
-
@@ -7,7 +7,7 @@ import { Serializable, Serializer } from "../../bcs/serializer";
7
7
  import { AuthenticationKey } from "../authenticationKey";
8
8
  import { Hex } from "../hex";
9
9
  import { HexInput, SigningScheme as AuthenticationKeyScheme } from "../../types";
10
- import { isValidHardenedPath, fromDerivationPath as fromDerivationPathInner, mnemonicToSeed } from "./hdKey";
10
+ import { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from "./hdKey";
11
11
  import { PrivateKey } from "./privateKey";
12
12
  import { AccountPublicKey, VerifySignatureArgs } from "./publicKey";
13
13
  import { Signature } from "./signature";
@@ -185,9 +185,29 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
185
185
  if (!isValidHardenedPath(path)) {
186
186
  throw new Error(`Invalid derivation path ${path}`);
187
187
  }
188
- return new Ed25519PrivateKey(
189
- fromDerivationPathInner(path, Ed25519PrivateKey.SLIP_0010_SEED, mnemonicToSeed(mnemonics)),
190
- );
188
+ return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
189
+ }
190
+
191
+ /**
192
+ * A private inner function so we can separate from the main fromDerivationPath() method
193
+ * to add tests to verify we create the keys correctly.
194
+ *
195
+ * @param path the BIP44 path
196
+ * @param seed the seed phrase created by the mnemonics
197
+ * @param offset the offset used for key derivation, defaults to 0x80000000
198
+ * @returns
199
+ */
200
+ private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {
201
+ const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);
202
+
203
+ const segments = splitPath(path).map((el) => parseInt(el, 10));
204
+
205
+ // Derive the child key based on the path
206
+ const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
207
+ key,
208
+ chainCode,
209
+ });
210
+ return new Ed25519PrivateKey(privateKey);
191
211
  }
192
212
 
193
213
  // endregion
@@ -6,16 +6,19 @@ import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
6
6
  import { Hex } from "../hex";
7
7
 
8
8
  /**
9
- * Represents ephemeral keys and signatures for Aptos Keyless accounts.
9
+ * Represents ephemeral public keys for Aptos Keyless accounts.
10
10
  *
11
- * TODO
11
+ * These are not public keys used as a public key on an account. They are only used ephemerally on Keyless accounts.
12
12
  */
13
13
  export class EphemeralPublicKey extends PublicKey {
14
14
  /**
15
- * Reference to the inner public key
15
+ * The public key itself
16
16
  */
17
17
  public readonly publicKey: PublicKey;
18
18
 
19
+ /**
20
+ * An enum indicating the scheme of the ephemeral public key
21
+ */
19
22
  public readonly variant: EphemeralPublicKeyVariant;
20
23
 
21
24
  constructor(publicKey: PublicKey) {
@@ -41,19 +44,10 @@ export class EphemeralPublicKey extends PublicKey {
41
44
  }
42
45
 
43
46
  /**
44
- * Get the public key as a hex string with the 0x prefix.
45
- *
46
- * @returns string representation of the public key
47
- */
48
- toString(): string {
49
- return this.bcsToHex().toString();
50
- }
51
-
52
- /**
53
- * Verifies a signed data with a public key
47
+ * Verifies a signed data with a the ephemeral public key
54
48
  *
55
49
  * @param args.message message
56
- * @param args.signature The signature
50
+ * @param args.signature The signature that was signed by the private key of the ephemeral public key
57
51
  * @returns true if the signature is valid
58
52
  */
59
53
  verifySignature(args: { message: HexInput; signature: EphemeralSignature }): boolean {
@@ -83,13 +77,17 @@ export class EphemeralPublicKey extends PublicKey {
83
77
  static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey {
84
78
  return publicKey instanceof EphemeralPublicKey;
85
79
  }
86
-
87
- isEd25519(): this is Ed25519PublicKey {
88
- return this.publicKey instanceof Ed25519PublicKey;
89
- }
90
80
  }
91
81
 
82
+ /**
83
+ * Represents ephemeral signatures used in Aptos Keyless accounts.
84
+ *
85
+ * These signatures are used inside of KeylessSignature
86
+ */
92
87
  export class EphemeralSignature extends Signature {
88
+ /**
89
+ * The signature signed by the private key of an EphemeralKeyPair
90
+ */
93
91
  public readonly signature: Signature;
94
92
 
95
93
  constructor(signature: Signature) {
@@ -110,16 +108,7 @@ export class EphemeralSignature extends Signature {
110
108
  * @returns Uint8Array representation of the public key
111
109
  */
112
110
  toUint8Array(): Uint8Array {
113
- return this.signature.toUint8Array();
114
- }
115
-
116
- /**
117
- * Get the public key as a hex string with the 0x prefix.
118
- *
119
- * @returns string representation of the public key
120
- */
121
- toString(): string {
122
- return this.signature.toString();
111
+ return this.bcsToBytes();
123
112
  }
124
113
 
125
114
  static fromHex(hexInput: HexInput): EphemeralSignature {