@aptos-labs/ts-sdk 1.13.3 → 1.14.0-zeta.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 (483) hide show
  1. package/dist/common/accountAddress-NPQwRmxn.d.ts +2121 -0
  2. package/dist/common/cli/index.d.ts +94 -1
  3. package/dist/common/cli/index.js +1 -1
  4. package/dist/common/cli/index.js.map +1 -1
  5. package/dist/common/index.d.ts +2588 -4127
  6. package/dist/common/index.js +26 -26
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/{Ed25519Account--qjfup2u.d.mts → Ed25519Account-9zBaZEnp.d.mts} +76 -9
  9. package/dist/esm/account/Account.d.mts +34 -0
  10. package/dist/esm/account/Account.mjs +2 -0
  11. package/dist/esm/account/Ed25519Account.d.mts +34 -0
  12. package/dist/esm/account/Ed25519Account.mjs +2 -0
  13. package/dist/esm/account/EphemeralKeyPair.d.mts +47 -0
  14. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  15. package/dist/esm/account/KeylessAccount.d.mts +107 -0
  16. package/dist/esm/account/KeylessAccount.mjs +2 -0
  17. package/dist/esm/account/MultiKeyAccount.d.mts +134 -0
  18. package/dist/esm/account/MultiKeyAccount.mjs +2 -0
  19. package/dist/esm/account/SingleKeyAccount.d.mts +34 -0
  20. package/dist/esm/account/SingleKeyAccount.mjs +2 -0
  21. package/dist/esm/account/index.d.mts +40 -0
  22. package/dist/esm/account/index.mjs +2 -0
  23. package/dist/esm/api/account.d.mts +13 -1
  24. package/dist/esm/api/account.mjs +1 -1
  25. package/dist/esm/api/ans.d.mts +2 -2
  26. package/dist/esm/api/ans.mjs +1 -1
  27. package/dist/esm/api/aptos.d.mts +14 -8
  28. package/dist/esm/api/aptos.mjs +1 -1
  29. package/dist/esm/api/aptosConfig.d.mts +20 -0
  30. package/dist/esm/api/aptosConfig.mjs +1 -1
  31. package/dist/esm/api/coin.d.mts +7 -7
  32. package/dist/esm/api/coin.mjs +1 -1
  33. package/dist/esm/api/digitalAsset.d.mts +1 -1
  34. package/dist/esm/api/digitalAsset.mjs +1 -1
  35. package/dist/esm/api/event.mjs +1 -1
  36. package/dist/esm/api/faucet.mjs +1 -1
  37. package/dist/esm/api/fungibleAsset.d.mts +5 -5
  38. package/dist/esm/api/fungibleAsset.mjs +1 -1
  39. package/dist/esm/api/general.d.mts +7 -7
  40. package/dist/esm/api/general.mjs +1 -1
  41. package/dist/esm/api/index.d.mts +13 -8
  42. package/dist/esm/api/index.mjs +1 -1
  43. package/dist/esm/api/keyless.d.mts +67 -0
  44. package/dist/esm/api/keyless.mjs +2 -0
  45. package/dist/esm/api/keyless.mjs.map +1 -0
  46. package/dist/esm/api/staking.mjs +1 -1
  47. package/dist/esm/api/transaction.d.mts +1 -1
  48. package/dist/esm/api/transaction.mjs +1 -1
  49. package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
  50. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  51. package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
  52. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  53. package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
  54. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  55. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  56. package/dist/esm/api/transactionSubmission/simulate.d.mts +6 -6
  57. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  58. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  59. package/dist/esm/api/utils.mjs +1 -1
  60. package/dist/esm/bcs/index.mjs +1 -1
  61. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  62. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  63. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  64. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  65. package/dist/esm/bcs/serializer.d.mts +2 -0
  66. package/dist/esm/bcs/serializer.mjs +1 -1
  67. package/dist/esm/{chunk-IKYIJYBY.mjs → chunk-25N7RLBW.mjs} +2 -2
  68. package/dist/esm/chunk-25N7RLBW.mjs.map +1 -0
  69. package/dist/esm/chunk-32355KGV.mjs +2 -0
  70. package/dist/esm/chunk-32355KGV.mjs.map +1 -0
  71. package/dist/esm/{chunk-TBMAJ6AW.mjs → chunk-3FVRXELT.mjs} +2 -2
  72. package/dist/esm/chunk-3OELNIC6.mjs +2 -0
  73. package/dist/esm/{chunk-734YX27W.mjs.map → chunk-3OELNIC6.mjs.map} +1 -1
  74. package/dist/esm/chunk-3U5VRZLS.mjs +2 -0
  75. package/dist/esm/chunk-3U5VRZLS.mjs.map +1 -0
  76. package/dist/esm/{chunk-DMKUAQB7.mjs → chunk-3VGX3TXH.mjs} +2 -2
  77. package/dist/esm/chunk-43WARVT3.mjs +2 -0
  78. package/dist/esm/chunk-43WARVT3.mjs.map +1 -0
  79. package/dist/esm/{chunk-CU67XZNB.mjs → chunk-52ECIIIH.mjs} +2 -2
  80. package/dist/esm/chunk-56NB52W6.mjs +2 -0
  81. package/dist/esm/chunk-56NB52W6.mjs.map +1 -0
  82. package/dist/esm/chunk-5DW2AJPI.mjs +2 -0
  83. package/dist/esm/chunk-5DW2AJPI.mjs.map +1 -0
  84. package/dist/esm/chunk-5QWUIVAQ.mjs +2 -0
  85. package/dist/esm/chunk-5QWUIVAQ.mjs.map +1 -0
  86. package/dist/esm/chunk-6456EI2E.mjs +2 -0
  87. package/dist/esm/chunk-6456EI2E.mjs.map +1 -0
  88. package/dist/esm/{chunk-Q3TZGQVC.mjs → chunk-65UZZNN2.mjs} +2 -2
  89. package/dist/esm/chunk-65UZZNN2.mjs.map +1 -0
  90. package/dist/esm/{chunk-MFKMAAWA.mjs → chunk-6LOTZ4GY.mjs} +2 -2
  91. package/dist/esm/{chunk-QIAHBEEW.mjs → chunk-6RBUXB5I.mjs} +2 -2
  92. package/dist/esm/{chunk-IIPYR7PF.mjs → chunk-6SHLLRJA.mjs} +2 -2
  93. package/dist/esm/chunk-6SHLLRJA.mjs.map +1 -0
  94. package/dist/esm/chunk-73Y4NTDU.mjs +2 -0
  95. package/dist/esm/chunk-73Y4NTDU.mjs.map +1 -0
  96. package/dist/esm/chunk-7PSX4LCV.mjs +2 -0
  97. package/dist/esm/{chunk-B7TQGVGL.mjs.map → chunk-7PSX4LCV.mjs.map} +1 -1
  98. package/dist/esm/chunk-7Q2NVO5M.mjs +2 -0
  99. package/dist/esm/chunk-7Q2NVO5M.mjs.map +1 -0
  100. package/dist/esm/{chunk-NPFNYP75.mjs → chunk-7STYQ5ZE.mjs} +2 -2
  101. package/dist/esm/{chunk-PZGLV5UQ.mjs → chunk-7WJTKYRG.mjs} +2 -2
  102. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  103. package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
  104. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  105. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  106. package/dist/esm/{chunk-ZYYK3UXP.mjs → chunk-C3L4ETUF.mjs} +2 -2
  107. package/dist/esm/chunk-C5UVSNZW.mjs +2 -0
  108. package/dist/esm/chunk-C5UVSNZW.mjs.map +1 -0
  109. package/dist/esm/{chunk-CTIN3GTP.mjs → chunk-CLVAGDXO.mjs} +2 -2
  110. package/dist/esm/{chunk-WFZDFFBM.mjs → chunk-COW5IGYC.mjs} +2 -2
  111. package/dist/esm/chunk-D22EMNIY.mjs +2 -0
  112. package/dist/esm/{chunk-QMURTXFM.mjs.map → chunk-D22EMNIY.mjs.map} +1 -1
  113. package/dist/esm/{chunk-6CFRW26C.mjs → chunk-DLTC6PJP.mjs} +2 -2
  114. package/dist/esm/chunk-DLTC6PJP.mjs.map +1 -0
  115. package/dist/esm/{chunk-FS3NSGBF.mjs → chunk-EB7AI4B4.mjs} +2 -2
  116. package/dist/esm/{chunk-YU3KB3UV.mjs → chunk-EKABTHUZ.mjs} +2 -2
  117. package/dist/esm/chunk-EOMDZYSJ.mjs +2 -0
  118. package/dist/esm/chunk-EOMDZYSJ.mjs.map +1 -0
  119. package/dist/esm/{chunk-SG4MAOCF.mjs → chunk-FKSACFCB.mjs} +2 -2
  120. package/dist/esm/chunk-FLYEALDB.mjs +2 -0
  121. package/dist/esm/chunk-FLYEALDB.mjs.map +1 -0
  122. package/dist/esm/{chunk-WLF5YQM4.mjs → chunk-G4XSNSOT.mjs} +2 -2
  123. package/dist/esm/chunk-G4XSNSOT.mjs.map +1 -0
  124. package/dist/esm/{chunk-MACC2BLE.mjs → chunk-H3TFQ7K4.mjs} +2 -2
  125. package/dist/esm/chunk-H6LYW7HG.mjs +2 -0
  126. package/dist/esm/chunk-H6LYW7HG.mjs.map +1 -0
  127. package/dist/esm/chunk-HCGWCB5E.mjs +2 -0
  128. package/dist/esm/chunk-HCGWCB5E.mjs.map +1 -0
  129. package/dist/esm/{chunk-UML2VQZT.mjs → chunk-HGZGTBA4.mjs} +2 -2
  130. package/dist/esm/{chunk-XO3HHRJV.mjs → chunk-HXSW6X7K.mjs} +2 -2
  131. package/dist/esm/chunk-IXYXFDJZ.mjs +2 -0
  132. package/dist/esm/{chunk-UFT7US42.mjs → chunk-J7J7ZTBF.mjs} +2 -2
  133. package/dist/esm/chunk-JVKMQ64G.mjs +2 -0
  134. package/dist/esm/chunk-JVKMQ64G.mjs.map +1 -0
  135. package/dist/esm/chunk-JXCZTOYC.mjs +1 -0
  136. package/dist/esm/chunk-JXCZTOYC.mjs.map +1 -0
  137. package/dist/esm/chunk-KWNBC5MF.mjs +2 -0
  138. package/dist/esm/chunk-KWNBC5MF.mjs.map +1 -0
  139. package/dist/esm/chunk-LDQ6JFEF.mjs +2 -0
  140. package/dist/esm/chunk-LDQ6JFEF.mjs.map +1 -0
  141. package/dist/esm/{chunk-DSTKXJMA.mjs → chunk-MGOHPDX4.mjs} +2 -2
  142. package/dist/esm/{chunk-BWFJHFBQ.mjs → chunk-MWUJCP27.mjs} +2 -2
  143. package/dist/esm/{chunk-QTRYMRYK.mjs → chunk-NC5HHEEM.mjs} +2 -2
  144. package/dist/esm/chunk-NGNETNK2.mjs +2 -0
  145. package/dist/esm/chunk-NGNETNK2.mjs.map +1 -0
  146. package/dist/esm/chunk-NKCZ4KGO.mjs +2 -0
  147. package/dist/esm/chunk-NKCZ4KGO.mjs.map +1 -0
  148. package/dist/esm/chunk-NMECYE3D.mjs +2 -0
  149. package/dist/esm/chunk-NMECYE3D.mjs.map +1 -0
  150. package/dist/esm/{chunk-AU6W5OIH.mjs → chunk-NNIHTVLA.mjs} +2 -2
  151. package/dist/esm/chunk-NNW6HWIO.mjs +2 -0
  152. package/dist/esm/{chunk-G2O323HP.mjs → chunk-O34EOOVF.mjs} +2 -2
  153. package/dist/esm/chunk-OBEVVLF7.mjs +2 -0
  154. package/dist/esm/chunk-OBEVVLF7.mjs.map +1 -0
  155. package/dist/esm/chunk-OKRUEVF3.mjs +2 -0
  156. package/dist/esm/chunk-OKRUEVF3.mjs.map +1 -0
  157. package/dist/esm/{chunk-PFIMEXNN.mjs → chunk-OLGSIKFB.mjs} +2 -2
  158. package/dist/esm/chunk-OLGSIKFB.mjs.map +1 -0
  159. package/dist/esm/chunk-OZC3FCJP.mjs +2 -0
  160. package/dist/esm/chunk-OZC3FCJP.mjs.map +1 -0
  161. package/dist/esm/{chunk-U43IJHQN.mjs → chunk-PFFAQZHT.mjs} +2 -2
  162. package/dist/esm/{chunk-ZZZZVONX.mjs → chunk-PINF6ZWP.mjs} +2 -2
  163. package/dist/esm/chunk-PJXRQBF6.mjs +2 -0
  164. package/dist/esm/chunk-PJXRQBF6.mjs.map +1 -0
  165. package/dist/esm/{chunk-7QJ6YJXP.mjs → chunk-QHVZL3LZ.mjs} +2 -2
  166. package/dist/esm/{chunk-DPV25ZKR.mjs → chunk-QNHDS64I.mjs} +2 -2
  167. package/dist/esm/{chunk-O2F53NKI.mjs → chunk-RBPGL6YB.mjs} +2 -2
  168. package/dist/esm/chunk-RFSO3JRG.mjs +1 -0
  169. package/dist/esm/chunk-RFSO3JRG.mjs.map +1 -0
  170. package/dist/esm/{chunk-DM44OGQH.mjs → chunk-RJ4PSGZ4.mjs} +2 -2
  171. package/dist/esm/{chunk-B3R6G6QP.mjs → chunk-RTSEMQCK.mjs} +2 -2
  172. package/dist/esm/chunk-RTSEMQCK.mjs.map +1 -0
  173. package/dist/esm/{chunk-V3Q2KXJU.mjs → chunk-SRPTQ4VV.mjs} +2 -2
  174. package/dist/esm/{chunk-R5QUBEH6.mjs → chunk-STYDBDYL.mjs} +2 -2
  175. package/dist/esm/{chunk-IOSQVDZI.mjs → chunk-T23OVRNF.mjs} +2 -2
  176. package/dist/esm/{chunk-RIUZPGI5.mjs → chunk-TICM455H.mjs} +2 -2
  177. package/dist/esm/{chunk-52C73T26.mjs → chunk-TVRJ3M7B.mjs} +2 -2
  178. package/dist/esm/{chunk-52C73T26.mjs.map → chunk-TVRJ3M7B.mjs.map} +1 -1
  179. package/dist/esm/{chunk-3WUGR46O.mjs → chunk-TXMPXZBG.mjs} +2 -2
  180. package/dist/esm/{chunk-W4ZW7QHA.mjs → chunk-UGIJHLL3.mjs} +2 -2
  181. package/dist/esm/{chunk-O4JRPZZM.mjs → chunk-UVOU6BW2.mjs} +2 -2
  182. package/dist/esm/{chunk-GSD4OOM3.mjs → chunk-V7P6MLSY.mjs} +2 -2
  183. package/dist/esm/{chunk-V6OS74OS.mjs → chunk-VJJN3GFD.mjs} +2 -2
  184. package/dist/esm/chunk-WOLIXKOK.mjs +2 -0
  185. package/dist/esm/chunk-WOLIXKOK.mjs.map +1 -0
  186. package/dist/esm/{chunk-Z5YFM2AW.mjs → chunk-WVIPPU2C.mjs} +2 -2
  187. package/dist/esm/chunk-WVIPPU2C.mjs.map +1 -0
  188. package/dist/esm/chunk-XCR3YNHW.mjs +2 -0
  189. package/dist/esm/chunk-XCR3YNHW.mjs.map +1 -0
  190. package/dist/esm/{chunk-5P2S2SZZ.mjs → chunk-XMFPKHB5.mjs} +2 -2
  191. package/dist/esm/chunk-XN4SQWI5.mjs +2 -0
  192. package/dist/esm/chunk-XN4SQWI5.mjs.map +1 -0
  193. package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
  194. package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
  195. package/dist/esm/chunk-Z5KKUXYI.mjs +2 -0
  196. package/dist/esm/chunk-Z5KKUXYI.mjs.map +1 -0
  197. package/dist/esm/chunk-ZM436N3W.mjs +2 -0
  198. package/dist/esm/chunk-ZM436N3W.mjs.map +1 -0
  199. package/dist/esm/{chunk-RHBCVCOS.mjs → chunk-ZNEBMSNC.mjs} +2 -2
  200. package/dist/esm/cli/index.d.mts +12 -0
  201. package/dist/esm/cli/index.mjs +1 -1
  202. package/dist/esm/cli/move.d.mts +105 -0
  203. package/dist/esm/cli/move.mjs +2 -0
  204. package/dist/esm/cli/move.mjs.map +1 -0
  205. package/dist/esm/client/core.mjs +1 -1
  206. package/dist/esm/client/get.d.mts +2 -1
  207. package/dist/esm/client/get.mjs +1 -1
  208. package/dist/esm/client/index.d.mts +2 -2
  209. package/dist/esm/client/index.mjs +1 -1
  210. package/dist/esm/client/post.d.mts +3 -1
  211. package/dist/esm/client/post.mjs +1 -1
  212. package/dist/esm/core/account/index.d.mts +5 -14
  213. package/dist/esm/core/account/index.mjs +1 -1
  214. package/dist/esm/core/account/utils/address.mjs +1 -1
  215. package/dist/esm/core/account/utils/index.mjs +1 -1
  216. package/dist/esm/core/accountAddress.mjs +1 -1
  217. package/dist/esm/core/authenticationKey.mjs +1 -1
  218. package/dist/esm/core/crypto/ed25519.d.mts +0 -10
  219. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  220. package/dist/esm/core/crypto/ephemeral.d.mts +77 -0
  221. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  222. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  223. package/dist/esm/core/crypto/hdKey.d.mts +15 -1
  224. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  225. package/dist/esm/core/crypto/index.d.mts +6 -4
  226. package/dist/esm/core/crypto/index.mjs +1 -1
  227. package/dist/esm/core/crypto/keyless.d.mts +217 -0
  228. package/dist/esm/core/crypto/keyless.mjs +2 -0
  229. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  230. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  231. package/dist/esm/core/crypto/multiKey.d.mts +7 -0
  232. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  233. package/dist/esm/core/crypto/poseidon.d.mts +7 -0
  234. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  235. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  236. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  237. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  238. package/dist/esm/core/crypto/signature.mjs +1 -1
  239. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  240. package/dist/esm/core/index.d.mts +5 -6
  241. package/dist/esm/core/index.mjs +1 -1
  242. package/dist/esm/index.d.mts +15 -9
  243. package/dist/esm/index.mjs +1 -1
  244. package/dist/esm/internal/account.d.mts +13 -1
  245. package/dist/esm/internal/account.mjs +1 -1
  246. package/dist/esm/internal/ans.d.mts +1 -1
  247. package/dist/esm/internal/ans.mjs +1 -1
  248. package/dist/esm/internal/coin.d.mts +7 -7
  249. package/dist/esm/internal/coin.mjs +1 -1
  250. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  251. package/dist/esm/internal/digitalAsset.mjs +1 -1
  252. package/dist/esm/internal/event.d.mts +1 -1
  253. package/dist/esm/internal/event.mjs +1 -1
  254. package/dist/esm/internal/faucet.d.mts +1 -1
  255. package/dist/esm/internal/faucet.mjs +1 -1
  256. package/dist/esm/internal/fungibleAsset.d.mts +5 -5
  257. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  258. package/dist/esm/internal/general.mjs +1 -1
  259. package/dist/esm/internal/keyless.d.mts +67 -0
  260. package/dist/esm/internal/keyless.mjs +2 -0
  261. package/dist/esm/internal/keyless.mjs.map +1 -0
  262. package/dist/esm/internal/staking.d.mts +1 -1
  263. package/dist/esm/internal/staking.mjs +1 -1
  264. package/dist/esm/internal/transaction.mjs +1 -1
  265. package/dist/esm/internal/transactionSubmission.d.mts +1 -1
  266. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  267. package/dist/esm/internal/view.d.mts +7 -7
  268. package/dist/esm/internal/view.mjs +1 -1
  269. package/dist/esm/transactions/authenticator/account.d.mts +3 -4
  270. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  271. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  272. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  273. package/dist/esm/transactions/index.d.mts +2 -2
  274. package/dist/esm/transactions/index.mjs +1 -1
  275. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  276. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  277. package/dist/esm/transactions/instances/index.mjs +1 -1
  278. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  279. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  280. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  281. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  282. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  283. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  284. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  285. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  286. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  287. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +13 -1
  288. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  289. package/dist/esm/transactions/management/index.d.mts +2 -2
  290. package/dist/esm/transactions/management/index.mjs +1 -1
  291. package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
  292. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  293. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
  294. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  295. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
  296. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  297. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
  298. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  299. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +72 -0
  300. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
  301. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
  302. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +6 -28
  303. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  304. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  305. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  306. package/dist/esm/transactions/types.d.mts +6 -6
  307. package/dist/esm/types/index.d.mts +17 -3
  308. package/dist/esm/types/index.mjs +1 -1
  309. package/dist/esm/types/keyless.d.mts +16 -0
  310. package/dist/esm/types/keyless.mjs +1 -0
  311. package/dist/esm/types/keyless.mjs.map +1 -0
  312. package/dist/esm/utils/apiEndpoints.d.mts +3 -2
  313. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  314. package/dist/esm/utils/const.d.mts +3 -1
  315. package/dist/esm/utils/const.mjs +1 -1
  316. package/dist/esm/utils/index.d.mts +1 -1
  317. package/dist/esm/utils/index.mjs +1 -1
  318. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  319. package/dist/esm/version.d.mts +1 -1
  320. package/dist/esm/version.mjs +1 -1
  321. package/package.json +7 -2
  322. package/src/{core/account → account}/Account.ts +25 -15
  323. package/src/{core/account → account}/Ed25519Account.ts +45 -9
  324. package/src/account/EphemeralKeyPair.ts +123 -0
  325. package/src/account/KeylessAccount.ts +303 -0
  326. package/src/account/MultiKeyAccount.ts +182 -0
  327. package/src/{core/account → account}/SingleKeyAccount.ts +45 -10
  328. package/src/account/index.ts +6 -0
  329. package/src/api/account.ts +2 -1
  330. package/src/api/ans.ts +2 -1
  331. package/src/api/aptos.ts +6 -0
  332. package/src/api/aptosConfig.ts +46 -1
  333. package/src/api/digitalAsset.ts +2 -1
  334. package/src/api/fungibleAsset.ts +2 -1
  335. package/src/api/keyless.ts +35 -0
  336. package/src/api/transaction.ts +2 -1
  337. package/src/api/transactionSubmission/management.ts +1 -1
  338. package/src/api/transactionSubmission/sign.ts +1 -1
  339. package/src/bcs/serializer.ts +18 -0
  340. package/src/cli/index.ts +1 -0
  341. package/src/cli/move.ts +183 -0
  342. package/src/client/core.ts +8 -0
  343. package/src/client/get.ts +6 -0
  344. package/src/client/post.ts +12 -0
  345. package/src/core/account/index.ts +1 -3
  346. package/src/core/crypto/ed25519.ts +4 -24
  347. package/src/core/crypto/ephemeral.ts +149 -0
  348. package/src/core/crypto/hdKey.ts +31 -0
  349. package/src/core/crypto/index.ts +2 -0
  350. package/src/core/crypto/keyless.ts +508 -0
  351. package/src/core/crypto/multiKey.ts +17 -6
  352. package/src/core/crypto/poseidon.ts +134 -0
  353. package/src/core/crypto/singleKey.ts +11 -0
  354. package/src/core/index.ts +0 -1
  355. package/src/index.ts +1 -0
  356. package/src/internal/account.ts +1 -1
  357. package/src/internal/ans.ts +2 -2
  358. package/src/internal/digitalAsset.ts +2 -1
  359. package/src/internal/fungibleAsset.ts +3 -2
  360. package/src/internal/keyless.ts +118 -0
  361. package/src/internal/transactionSubmission.ts +8 -7
  362. package/src/transactions/authenticator/account.ts +6 -11
  363. package/src/transactions/management/accountSequenceNumber.ts +1 -1
  364. package/src/transactions/management/transactionWorker.ts +8 -2
  365. package/src/transactions/transactionBuilder/index.ts +1 -0
  366. package/src/transactions/transactionBuilder/signingMessage.ts +93 -0
  367. package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -75
  368. package/src/types/index.ts +19 -0
  369. package/src/types/keyless.ts +6 -0
  370. package/src/utils/apiEndpoints.ts +14 -6
  371. package/src/utils/const.ts +2 -0
  372. package/src/version.ts +1 -1
  373. package/dist/esm/chunk-24IKVZBK.mjs +0 -2
  374. package/dist/esm/chunk-24IKVZBK.mjs.map +0 -1
  375. package/dist/esm/chunk-2HISPUZZ.mjs +0 -2
  376. package/dist/esm/chunk-2HISPUZZ.mjs.map +0 -1
  377. package/dist/esm/chunk-6CFRW26C.mjs.map +0 -1
  378. package/dist/esm/chunk-734YX27W.mjs +0 -2
  379. package/dist/esm/chunk-AD3VLZ7I.mjs +0 -2
  380. package/dist/esm/chunk-AD3VLZ7I.mjs.map +0 -1
  381. package/dist/esm/chunk-B3R6G6QP.mjs.map +0 -1
  382. package/dist/esm/chunk-B7TQGVGL.mjs +0 -2
  383. package/dist/esm/chunk-CNMQNPNV.mjs +0 -2
  384. package/dist/esm/chunk-CNMQNPNV.mjs.map +0 -1
  385. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  386. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  387. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  388. package/dist/esm/chunk-EOFJFE4T.mjs +0 -2
  389. package/dist/esm/chunk-EOFJFE4T.mjs.map +0 -1
  390. package/dist/esm/chunk-FATWMUXK.mjs +0 -2
  391. package/dist/esm/chunk-FATWMUXK.mjs.map +0 -1
  392. package/dist/esm/chunk-HQ5I4Q3H.mjs +0 -2
  393. package/dist/esm/chunk-HQ5I4Q3H.mjs.map +0 -1
  394. package/dist/esm/chunk-IIPYR7PF.mjs.map +0 -1
  395. package/dist/esm/chunk-IKYIJYBY.mjs.map +0 -1
  396. package/dist/esm/chunk-KVZ4XMZS.mjs +0 -2
  397. package/dist/esm/chunk-KVZ4XMZS.mjs.map +0 -1
  398. package/dist/esm/chunk-LR65XHSF.mjs +0 -2
  399. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  400. package/dist/esm/chunk-MC6G725U.mjs +0 -2
  401. package/dist/esm/chunk-MC6G725U.mjs.map +0 -1
  402. package/dist/esm/chunk-MLWIHWNH.mjs +0 -1
  403. package/dist/esm/chunk-NNQJBFRB.mjs +0 -2
  404. package/dist/esm/chunk-ODRO4CSA.mjs +0 -2
  405. package/dist/esm/chunk-ODRO4CSA.mjs.map +0 -1
  406. package/dist/esm/chunk-OVJQWQ2N.mjs +0 -2
  407. package/dist/esm/chunk-OVJQWQ2N.mjs.map +0 -1
  408. package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
  409. package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
  410. package/dist/esm/chunk-PFIMEXNN.mjs.map +0 -1
  411. package/dist/esm/chunk-Q3TZGQVC.mjs.map +0 -1
  412. package/dist/esm/chunk-QMURTXFM.mjs +0 -2
  413. package/dist/esm/chunk-R7G3CLRI.mjs +0 -1
  414. package/dist/esm/chunk-SUAKPNKQ.mjs +0 -2
  415. package/dist/esm/chunk-SUAKPNKQ.mjs.map +0 -1
  416. package/dist/esm/chunk-TLOPIURC.mjs +0 -2
  417. package/dist/esm/chunk-TLOPIURC.mjs.map +0 -1
  418. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  419. package/dist/esm/chunk-V4SRNEV3.mjs +0 -2
  420. package/dist/esm/chunk-V4SRNEV3.mjs.map +0 -1
  421. package/dist/esm/chunk-VVIG4E7Q.mjs +0 -2
  422. package/dist/esm/chunk-WLF5YQM4.mjs.map +0 -1
  423. package/dist/esm/chunk-XDGQTMDV.mjs +0 -2
  424. package/dist/esm/chunk-XDGQTMDV.mjs.map +0 -1
  425. package/dist/esm/chunk-YFRXBEOC.mjs +0 -2
  426. package/dist/esm/chunk-YFRXBEOC.mjs.map +0 -1
  427. package/dist/esm/chunk-YPTF6MLX.mjs +0 -2
  428. package/dist/esm/chunk-YPTF6MLX.mjs.map +0 -1
  429. package/dist/esm/chunk-Z5YFM2AW.mjs.map +0 -1
  430. package/dist/esm/core/account/Account.d.mts +0 -20
  431. package/dist/esm/core/account/Account.mjs +0 -2
  432. package/dist/esm/core/account/Ed25519Account.d.mts +0 -20
  433. package/dist/esm/core/account/Ed25519Account.mjs +0 -2
  434. package/dist/esm/core/account/SingleKeyAccount.d.mts +0 -20
  435. package/dist/esm/core/account/SingleKeyAccount.mjs +0 -2
  436. /package/dist/esm/{core/account → account}/Account.mjs.map +0 -0
  437. /package/dist/esm/{core/account → account}/Ed25519Account.mjs.map +0 -0
  438. /package/dist/esm/{chunk-E7FWVXGX.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-MLWIHWNH.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  440. /package/dist/esm/{chunk-R7G3CLRI.mjs.map → account/MultiKeyAccount.mjs.map} +0 -0
  441. /package/dist/esm/{core/account → account}/SingleKeyAccount.mjs.map +0 -0
  442. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/index.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-TBMAJ6AW.mjs.map → chunk-3FVRXELT.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-DMKUAQB7.mjs.map → chunk-3VGX3TXH.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-CU67XZNB.mjs.map → chunk-52ECIIIH.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-MFKMAAWA.mjs.map → chunk-6LOTZ4GY.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-QIAHBEEW.mjs.map → chunk-6RBUXB5I.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-NPFNYP75.mjs.map → chunk-7STYQ5ZE.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-PZGLV5UQ.mjs.map → chunk-7WJTKYRG.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-ZYYK3UXP.mjs.map → chunk-C3L4ETUF.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-CTIN3GTP.mjs.map → chunk-CLVAGDXO.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-WFZDFFBM.mjs.map → chunk-COW5IGYC.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-FS3NSGBF.mjs.map → chunk-EB7AI4B4.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-YU3KB3UV.mjs.map → chunk-EKABTHUZ.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-SG4MAOCF.mjs.map → chunk-FKSACFCB.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-MACC2BLE.mjs.map → chunk-H3TFQ7K4.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-UML2VQZT.mjs.map → chunk-HGZGTBA4.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-XO3HHRJV.mjs.map → chunk-HXSW6X7K.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-VVIG4E7Q.mjs.map → chunk-IXYXFDJZ.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-UFT7US42.mjs.map → chunk-J7J7ZTBF.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-DSTKXJMA.mjs.map → chunk-MGOHPDX4.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-BWFJHFBQ.mjs.map → chunk-MWUJCP27.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-QTRYMRYK.mjs.map → chunk-NC5HHEEM.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-AU6W5OIH.mjs.map → chunk-NNIHTVLA.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-NNQJBFRB.mjs.map → chunk-NNW6HWIO.mjs.map} +0 -0
  466. /package/dist/esm/{chunk-G2O323HP.mjs.map → chunk-O34EOOVF.mjs.map} +0 -0
  467. /package/dist/esm/{chunk-U43IJHQN.mjs.map → chunk-PFFAQZHT.mjs.map} +0 -0
  468. /package/dist/esm/{chunk-ZZZZVONX.mjs.map → chunk-PINF6ZWP.mjs.map} +0 -0
  469. /package/dist/esm/{chunk-7QJ6YJXP.mjs.map → chunk-QHVZL3LZ.mjs.map} +0 -0
  470. /package/dist/esm/{chunk-DPV25ZKR.mjs.map → chunk-QNHDS64I.mjs.map} +0 -0
  471. /package/dist/esm/{chunk-O2F53NKI.mjs.map → chunk-RBPGL6YB.mjs.map} +0 -0
  472. /package/dist/esm/{chunk-DM44OGQH.mjs.map → chunk-RJ4PSGZ4.mjs.map} +0 -0
  473. /package/dist/esm/{chunk-V3Q2KXJU.mjs.map → chunk-SRPTQ4VV.mjs.map} +0 -0
  474. /package/dist/esm/{chunk-R5QUBEH6.mjs.map → chunk-STYDBDYL.mjs.map} +0 -0
  475. /package/dist/esm/{chunk-IOSQVDZI.mjs.map → chunk-T23OVRNF.mjs.map} +0 -0
  476. /package/dist/esm/{chunk-RIUZPGI5.mjs.map → chunk-TICM455H.mjs.map} +0 -0
  477. /package/dist/esm/{chunk-3WUGR46O.mjs.map → chunk-TXMPXZBG.mjs.map} +0 -0
  478. /package/dist/esm/{chunk-W4ZW7QHA.mjs.map → chunk-UGIJHLL3.mjs.map} +0 -0
  479. /package/dist/esm/{chunk-O4JRPZZM.mjs.map → chunk-UVOU6BW2.mjs.map} +0 -0
  480. /package/dist/esm/{chunk-GSD4OOM3.mjs.map → chunk-V7P6MLSY.mjs.map} +0 -0
  481. /package/dist/esm/{chunk-V6OS74OS.mjs.map → chunk-VJJN3GFD.mjs.map} +0 -0
  482. /package/dist/esm/{chunk-5P2S2SZZ.mjs.map → chunk-XMFPKHB5.mjs.map} +0 -0
  483. /package/dist/esm/{chunk-RHBCVCOS.mjs.map → chunk-ZNEBMSNC.mjs.map} +0 -0
@@ -0,0 +1,303 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { JwtPayload, jwtDecode } from "jwt-decode";
5
+ import { decode } from "base-64";
6
+ import EventEmitter from "eventemitter3";
7
+ import { HexInput, SigningScheme } from "../types";
8
+ import { AccountAddress } from "../core/accountAddress";
9
+ import {
10
+ AnyPublicKey,
11
+ AnySignature,
12
+ KeylessPublicKey,
13
+ KeylessSignature,
14
+ OpenIdSignature,
15
+ OpenIdSignatureOrZkProof,
16
+ Signature,
17
+ SignedGroth16Signature,
18
+ computeAddressSeed,
19
+ fromDerivationPath as fromDerivationPathInner,
20
+ } from "../core/crypto";
21
+
22
+ import { Account } from "./Account";
23
+ import { EphemeralKeyPair } from "./EphemeralKeyPair";
24
+ import { Hex } from "../core/hex";
25
+ import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
26
+ 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
+ };
43
+
44
+ export type ProofFetchFailure = {
45
+ status: "Failed";
46
+ error: string;
47
+ };
48
+
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
+ export class KeylessAccount extends Serializable implements Account {
58
+ static readonly PEPPER_LENGTH: number = 31;
59
+
60
+ static readonly SLIP_0010_SEED: string = "32 bytes";
61
+
62
+ publicKey: KeylessPublicKey;
63
+
64
+ ephemeralKeyPair: EphemeralKeyPair;
65
+
66
+ uidKey: string;
67
+
68
+ uidVal: string;
69
+
70
+ aud: string;
71
+
72
+ pepper: Uint8Array;
73
+
74
+ accountAddress: AccountAddress;
75
+
76
+ proof: SignedGroth16Signature | undefined;
77
+
78
+ proofOrPromise: SignedGroth16Signature | Promise<SignedGroth16Signature>;
79
+
80
+ signingScheme: SigningScheme;
81
+
82
+ jwt: string;
83
+
84
+ emitter: EventEmitter<ProofFetchEvents>;
85
+
86
+ constructor(args: {
87
+ address?: AccountAddress;
88
+ ephemeralKeyPair: EphemeralKeyPair;
89
+ iss: string;
90
+ uidKey: string;
91
+ uidVal: string;
92
+ aud: string;
93
+ pepper: HexInput;
94
+ proofOrFetcher: SignedGroth16Signature | Promise<SignedGroth16Signature>;
95
+ proofFetchCallback?: ProofFetchCallback
96
+ jwt: string;
97
+ }) {
98
+ super();
99
+ const { address, ephemeralKeyPair, iss, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;
100
+ this.ephemeralKeyPair = ephemeralKeyPair;
101
+ const addressSeed = computeAddressSeed(args);
102
+ this.publicKey = new KeylessPublicKey(iss, addressSeed);
103
+ this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
104
+ this.uidKey = uidKey;
105
+ this.uidVal = uidVal;
106
+ this.aud = aud;
107
+ this.jwt = jwt;
108
+ this.emitter = new EventEmitter<ProofFetchEvents>();
109
+ this.proofOrPromise = proofOrFetcher;
110
+ if (proofOrFetcher instanceof SignedGroth16Signature) {
111
+ this.proof = proofOrFetcher;
112
+ } else {
113
+ if (proofFetchCallback === undefined) {
114
+ throw new Error("Must provide callback for async proof fetch")
115
+ }
116
+ this.emitter.on("proofFetchFinish", async (status) => {
117
+ await proofFetchCallback(status);
118
+ this.emitter.removeAllListeners();
119
+ });
120
+ this.init(proofOrFetcher);
121
+ }
122
+
123
+
124
+ this.signingScheme = SigningScheme.SingleKey;
125
+ const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
126
+ if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {
127
+ throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);
128
+ }
129
+ this.pepper = pepperBytes;
130
+ }
131
+
132
+ async init(promise: Promise<SignedGroth16Signature>) {
133
+ try {
134
+ this.proof = await promise;
135
+ this.emitter.emit("proofFetchFinish", {status: "Success"});
136
+ } catch (error) {
137
+ if (error instanceof Error) {
138
+ this.emitter.emit("proofFetchFinish", {status: "Failed", error: error.toString()});
139
+ } else {
140
+ this.emitter.emit("proofFetchFinish", {status: "Failed", error: "Unknown"});
141
+ }
142
+ }
143
+ }
144
+
145
+ serialize(serializer: Serializer): void {
146
+ serializer.serializeStr(this.jwt);
147
+ serializer.serializeStr(this.uidKey);
148
+ serializer.serializeFixedBytes(this.pepper);
149
+ this.ephemeralKeyPair.serialize(serializer);
150
+ if (this.proof === undefined) {
151
+ throw new Error("Connot serialize - proof undefined")
152
+ }
153
+ this.proof.serialize(serializer);
154
+ }
155
+
156
+ static deserialize(deserializer: Deserializer): KeylessAccount {
157
+ const jwt = deserializer.deserializeStr();
158
+ const uidKey = deserializer.deserializeStr();
159
+ const pepper = deserializer.deserializeFixedBytes(31);
160
+ const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);
161
+ const proof = SignedGroth16Signature.deserialize(deserializer);
162
+ return KeylessAccount.fromJWTAndProof({
163
+ proof,
164
+ pepper,
165
+ uidKey,
166
+ jwt,
167
+ ephemeralKeyPair,
168
+ });
169
+ }
170
+
171
+ isExpired(): boolean {
172
+ return this.ephemeralKeyPair.isExpired();
173
+ }
174
+
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);
184
+ }
185
+
186
+ signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
187
+ const signature = new AnySignature(this.sign(message));
188
+ const publicKey = new AnyPublicKey(this.publicKey);
189
+ return new AccountAuthenticatorSingleKey(publicKey, signature);
190
+ }
191
+
192
+ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
193
+ const raw = deriveTransactionType(transaction);
194
+ const signature = new AnySignature(this.sign(raw.bcsToBytes()));
195
+ const publicKey = new AnyPublicKey(this.publicKey);
196
+ return new AccountAuthenticatorSingleKey(publicKey, signature);
197
+ }
198
+
199
+ async waitForProofFetch() {
200
+ if (this.proofOrPromise instanceof Promise) {
201
+ await this.proofOrPromise;
202
+ }
203
+ }
204
+
205
+ sign(data: HexInput): Signature {
206
+ const { expiryDateSecs } = this.ephemeralKeyPair;
207
+ const currentTimeInSeconds = Math.floor(new Date().getTime() / 1000);
208
+ if (expiryDateSecs < currentTimeInSeconds) {
209
+ throw new Error("Ephemeral key pair is expired.");
210
+ }
211
+ if (this.proof === undefined) {
212
+ throw new Error("Proof not found");
213
+ }
214
+ const jwtHeader = this.jwt.split(".")[0];
215
+ 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);
223
+
224
+ return new KeylessSignature({
225
+ jwtHeader: base64UrlDecode(jwtHeader),
226
+ openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(this.proof),
227
+ expiryDateSecs,
228
+ ephemeralPublicKey,
229
+ ephemeralSignature,
230
+ });
231
+ }
232
+
233
+ signTransaction(transaction: AnyRawTransaction): Signature {
234
+ 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
+ });
258
+ }
259
+
260
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
261
+ verifySignature(args: { message: HexInput; signature: Signature }): boolean {
262
+ return true;
263
+ }
264
+
265
+ static fromBytes(bytes: Uint8Array): KeylessAccount {
266
+ return KeylessAccount.deserialize(new Deserializer(bytes));
267
+ }
268
+
269
+ static fromJWTAndProof(args: {
270
+ proof: SignedGroth16Signature | Promise<SignedGroth16Signature>;
271
+ jwt: string;
272
+ ephemeralKeyPair: EphemeralKeyPair;
273
+ pepper: HexInput;
274
+ uidKey?: string;
275
+ proofFetchCallback?: ProofFetchCallback;
276
+ }): KeylessAccount {
277
+ const { proof, jwt, ephemeralKeyPair, pepper, proofFetchCallback } = args;
278
+ const uidKey = args.uidKey ?? "sub";
279
+
280
+ const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);
281
+ const iss = jwtPayload.iss!;
282
+ if (typeof jwtPayload.aud !== "string") {
283
+ throw new Error("aud was not found or an array of values");
284
+ }
285
+ const aud = jwtPayload.aud!;
286
+ const uidVal = jwtPayload[uidKey];
287
+ return new KeylessAccount({
288
+ proofOrFetcher: proof,
289
+ ephemeralKeyPair,
290
+ iss,
291
+ uidKey,
292
+ uidVal,
293
+ aud,
294
+ pepper,
295
+ jwt,
296
+ proofFetchCallback,
297
+ });
298
+ }
299
+
300
+ static fromDerivationPath(path: string, seed: Uint8Array): Uint8Array {
301
+ return fromDerivationPathInner(path, KeylessAccount.SLIP_0010_SEED, seed);
302
+ }
303
+ }
@@ -0,0 +1,182 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { Account } from "./Account";
5
+ import { MultiKey, MultiKeySignature, PublicKey } from "../core/crypto";
6
+ import { AccountAddress } from "../core/accountAddress";
7
+ import { HexInput, SigningScheme } from "../types";
8
+ import { AccountAuthenticatorMultiKey } from "../transactions/authenticator/account";
9
+ import { AnyRawTransaction } from "../transactions/types";
10
+ import { KeylessAccount } from "./KeylessAccount";
11
+
12
+ export interface VerifyMultiKeySignatureArgs {
13
+ message: HexInput;
14
+ signature: MultiKeySignature;
15
+ }
16
+
17
+ /**
18
+ * Signer implementation for the MultiKey authentication scheme.
19
+ *
20
+ * This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey}
21
+ * It signs messages via the array of M number of Accounts that individually correspond to a public key in the {@link MultiKey}.
22
+ *
23
+ * Note: Generating a signer instance does not create the account on-chain.
24
+ */
25
+ export class MultiKeyAccount implements Account {
26
+ /**
27
+ * Public key associated with the account
28
+ */
29
+ readonly publicKey: MultiKey;
30
+
31
+ /**
32
+ * Account address associated with the account
33
+ */
34
+ readonly accountAddress: AccountAddress;
35
+
36
+ /**
37
+ * Signing scheme used to sign transactions
38
+ */
39
+ readonly signingScheme: SigningScheme;
40
+
41
+ /**
42
+ * The signers used to sign messages. These signers should correspond to public keys in the
43
+ * MultiKeyAccount's public key. The number of signers should be equal or greater
44
+ * than this.publicKey.signaturesRequired
45
+ */
46
+ readonly signers: Account[];
47
+
48
+ /**
49
+ * An array of indicies where for signer[i], signerIndicies[i] is the index of the corresponding public key in
50
+ * publicKey.publicKeys. Used to derive the right public key to use for verification.
51
+ */
52
+ readonly signerIndicies: number[];
53
+
54
+ readonly signaturesBitmap: Uint8Array;
55
+
56
+ /**
57
+ * constructor for MultiKeyAccount
58
+ *
59
+ * @param args.multiKey the multikey of the account which consists of N public keys and a number M which is
60
+ * the number of required signatures.
61
+ * @param args.signers an array of M signers that will be used to sign the transaction
62
+ * @returns MultiKeyAccount
63
+ */
64
+ constructor(args: { multiKey: MultiKey; signers: Account[] }) {
65
+ const { multiKey, signers } = args;
66
+
67
+ this.publicKey = multiKey;
68
+ this.signingScheme = SigningScheme.MultiKey;
69
+
70
+ this.accountAddress = this.publicKey.authKey().derivedAddress();
71
+
72
+ // Get the index of each respective signer in the bitmap
73
+ const bitPositions: number[] = [];
74
+ for (const signer of signers) {
75
+ bitPositions.push(this.publicKey.getIndex(signer.publicKey));
76
+ }
77
+ // Zip signers and bit positions and sort signers by bit positions in order
78
+ // to ensure the signature is signed in ascending order according to the bitmap.
79
+ // Authentication on chain will fail otherwise.
80
+ const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);
81
+ signersAndBitPosition.sort((a, b) => a[1] - b[1]);
82
+ this.signers = signersAndBitPosition.map((value) => value[0]);
83
+ this.signerIndicies = signersAndBitPosition.map((value) => value[1]);
84
+ this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });
85
+ }
86
+
87
+ /**
88
+ * Static constructor for MultiKeyAccount
89
+ *
90
+ * @param args.publicKeys the N public keys of the MultiKeyAccount
91
+ * @param args.signaturesRequired the number of signatures required
92
+ * @param args.signers an array of M signers that will be used to sign the transaction
93
+ * @returns MultiKeyAccount
94
+ */
95
+ static fromPublicKeysAndSigners(args: {
96
+ publicKeys: PublicKey[];
97
+ signaturesRequired: number;
98
+ signers: Account[];
99
+ }): MultiKeyAccount {
100
+ const { publicKeys, signaturesRequired, signers } = args;
101
+ const multiKey = new MultiKey({ publicKeys, signaturesRequired });
102
+ return new MultiKeyAccount({ multiKey, signers });
103
+ }
104
+
105
+ static isMultiKeySigner(account: Account): account is MultiKeyAccount {
106
+ return account instanceof MultiKeyAccount;
107
+ }
108
+
109
+ /**
110
+ * Sign a message using the account's signers.
111
+ * @param message the signing message, as binary input
112
+ * @return the AccountAuthenticator containing the signature, together with the account's public key
113
+ */
114
+ signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {
115
+ return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));
116
+ }
117
+
118
+ /**
119
+ * Sign a transaction using the account's signers.
120
+ * @param transaction the raw transaction
121
+ * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
122
+ */
123
+ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {
124
+ return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));
125
+ }
126
+
127
+ async waitForProofFetch() {
128
+ const keylessSigners = this.signers.filter((signer) => signer instanceof KeylessAccount) as KeylessAccount[];
129
+ await Promise.all(keylessSigners.filter((signer) => signer.proof instanceof Promise).map((signer) => signer.proof));
130
+ }
131
+
132
+ /**
133
+ * Sign the given message using the MultiKeyAccount's signers
134
+ * @param message in HexInput format
135
+ * @returns MultiKeySignature
136
+ */
137
+ sign(data: HexInput): MultiKeySignature {
138
+ const signatures = [];
139
+ for (const signer of this.signers) {
140
+ signatures.push(signer.sign(data));
141
+ }
142
+ return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
143
+ }
144
+
145
+ /**
146
+ * Sign the given transaction using the MultiKeyAccount's signers
147
+ * @param transaction the transaction to be signed
148
+ * @returns MultiKeySignature
149
+ */
150
+ signTransaction(transaction: AnyRawTransaction): MultiKeySignature {
151
+ const signatures = [];
152
+ for (const signer of this.signers) {
153
+ signatures.push(signer.signTransaction(transaction));
154
+ }
155
+ return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
156
+ }
157
+
158
+ /**
159
+ * Verify the given message and signature with the public key.
160
+ *
161
+ * @param args.message raw message data in HexInput format
162
+ * @param args.signatures signed message MultiKeySignature
163
+ * @returns boolean
164
+ */
165
+ verifySignature(args: VerifyMultiKeySignatureArgs): boolean {
166
+ const { message, signature } = args;
167
+ const isSignerIndiciesSorted = this.signerIndicies.every(
168
+ (value, i) => i === 0 || value >= this.signerIndicies[i - 1],
169
+ );
170
+ if (!isSignerIndiciesSorted) {
171
+ return false;
172
+ }
173
+ for (let i = 0; i < signature.signatures.length; i += 1) {
174
+ const singleSignature = signature.signatures[i];
175
+ const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];
176
+ if (!publicKey.verifySignature({ message, signature: singleSignature })) {
177
+ return false;
178
+ }
179
+ }
180
+ return true;
181
+ }
182
+ }
@@ -1,8 +1,10 @@
1
- import { AccountAuthenticatorSingleKey } from "../../transactions/authenticator/account";
2
- import { type HexInput, SigningScheme, SigningSchemeInput } from "../../types";
3
- import { AccountAddress, AccountAddressInput } from "../accountAddress";
4
- import { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from "../crypto";
1
+ import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
2
+ import { type HexInput, SigningScheme, SigningSchemeInput } from "../types";
3
+ import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
4
+ import { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from "../core/crypto";
5
5
  import type { Account } from "./Account";
6
+ import { generateSigningMessageForTransaction } from "../transactions/transactionBuilder/signingMessage";
7
+ import { AnyRawTransaction } from "../transactions/types";
6
8
 
7
9
  export interface SingleKeySignerConstructorArgs {
8
10
  privateKey: PrivateKey;
@@ -102,18 +104,51 @@ export class SingleKeyAccount implements Account {
102
104
 
103
105
  // region Account
104
106
 
107
+ /**
108
+ * Verify the given message and signature with the public key.
109
+ *
110
+ * @param args.message raw message data in HexInput format
111
+ * @param args.signature signed message Signature
112
+ * @returns
113
+ */
105
114
  verifySignature(args: VerifySingleKeySignatureArgs): boolean {
106
115
  return this.publicKey.verifySignature(args);
107
116
  }
108
117
 
109
- signWithAuthenticator(message: HexInput) {
110
- const innerSignature = this.privateKey.sign(message);
111
- const signature = new AnySignature(innerSignature);
112
- return new AccountAuthenticatorSingleKey(this.publicKey, signature);
118
+ /**
119
+ * Sign a message using the account's private key.
120
+ * @param message the signing message, as binary input
121
+ * @return the AccountAuthenticator containing the signature, together with the account's public key
122
+ */
123
+ signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
124
+ return new AccountAuthenticatorSingleKey(this.publicKey, this.sign(message));
113
125
  }
114
126
 
115
- sign(message: HexInput) {
116
- return this.signWithAuthenticator(message).signature;
127
+ /**
128
+ * Sign a transaction using the account's private key.
129
+ * @param transaction the raw transaction
130
+ * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
131
+ */
132
+ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
133
+ return new AccountAuthenticatorSingleKey(this.publicKey, this.signTransaction(transaction));
134
+ }
135
+
136
+ /**
137
+ * Sign the given message using the account's private key.
138
+ * @param message in HexInput format
139
+ * @returns Signature
140
+ */
141
+ sign(message: HexInput): AnySignature {
142
+ return new AnySignature(this.privateKey.sign(message));
143
+ }
144
+
145
+ /**
146
+ * Sign the given transaction using the account's private key.
147
+ * @param transaction the transaction to be signed
148
+ * @returns Signature
149
+ */
150
+ signTransaction(transaction: AnyRawTransaction): AnySignature {
151
+ return this.sign(generateSigningMessageForTransaction(transaction));
117
152
  }
118
153
 
119
154
  // endregion
@@ -0,0 +1,6 @@
1
+ export * from "./Ed25519Account";
2
+ export * from "./Account";
3
+ export * from "./SingleKeyAccount";
4
+ export * from "./EphemeralKeyPair";
5
+ export * from "./KeylessAccount";
6
+ export * from "./MultiKeyAccount";
@@ -1,7 +1,8 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { AccountAddress, PrivateKey, Account as AccountModule, AccountAddressInput } from "../core";
4
+ import { Account as AccountModule } from "../account";
5
+ import { AccountAddress, PrivateKey, AccountAddressInput } from "../core";
5
6
  import {
6
7
  AccountData,
7
8
  AnyNumber,
package/src/api/ans.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Account, AccountAddress, AccountAddressInput } from "../core";
4
+ import { Account } from "../account";
5
+ import { AccountAddress, AccountAddressInput } from "../core";
5
6
  import {
6
7
  RegisterNameParameters,
7
8
  getExpiration,
package/src/api/aptos.ts CHANGED
@@ -12,6 +12,7 @@ import { General } from "./general";
12
12
  import { ANS } from "./ans";
13
13
  import { Staking } from "./staking";
14
14
  import { Transaction } from "./transaction";
15
+ import { Keyless } from "./keyless";
15
16
 
16
17
  /**
17
18
  * This class is the main entry point into Aptos's
@@ -47,6 +48,8 @@ export class Aptos {
47
48
 
48
49
  readonly transaction: Transaction;
49
50
 
51
+ readonly keyless: Keyless;
52
+
50
53
  constructor(settings?: AptosConfig) {
51
54
  this.config = new AptosConfig(settings);
52
55
  this.account = new Account(this.config);
@@ -59,6 +62,7 @@ export class Aptos {
59
62
  this.general = new General(this.config);
60
63
  this.staking = new Staking(this.config);
61
64
  this.transaction = new Transaction(this.config);
65
+ this.keyless = new Keyless(this.config);
62
66
  }
63
67
  }
64
68
 
@@ -73,6 +77,7 @@ export interface Aptos
73
77
  Faucet,
74
78
  FungibleAsset,
75
79
  General,
80
+ Keyless,
76
81
  Staking,
77
82
  Omit<Transaction, "build" | "simulate" | "submit" | "batch"> {}
78
83
 
@@ -107,3 +112,4 @@ applyMixin(Aptos, FungibleAsset, "fungibleAsset");
107
112
  applyMixin(Aptos, General, "general");
108
113
  applyMixin(Aptos, Staking, "staking");
109
114
  applyMixin(Aptos, Transaction, "transaction");
115
+ applyMixin(Aptos, Keyless, "keyless");