@aptos-labs/ts-sdk 1.27.1 → 1.28.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 (466) hide show
  1. package/dist/common/{accountAddress-LOYE4_sG.d.ts → accountAddress-0OnKb1b9.d.ts} +5 -3
  2. package/dist/common/chunk-HBPH2AD3.js +2 -0
  3. package/dist/common/chunk-HBPH2AD3.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +252 -41
  8. package/dist/common/index.js +28 -28
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
  11. package/dist/esm/account/Account.d.mts +2 -2
  12. package/dist/esm/account/Account.mjs +1 -1
  13. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  14. package/dist/esm/account/Ed25519Account.mjs +1 -1
  15. package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
  16. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  17. package/dist/esm/account/FederatedKeylessAccount.d.mts +75 -0
  18. package/dist/esm/account/FederatedKeylessAccount.mjs +2 -0
  19. package/dist/esm/account/KeylessAccount.d.mts +13 -130
  20. package/dist/esm/account/KeylessAccount.mjs +1 -1
  21. package/dist/esm/account/KeylessAccountCommon.d.mts +207 -0
  22. package/dist/esm/account/KeylessAccountCommon.mjs +2 -0
  23. package/dist/esm/account/MultiKeyAccount.d.mts +4 -3
  24. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  25. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  26. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  27. package/dist/esm/account/index.d.mts +6 -3
  28. package/dist/esm/account/index.mjs +1 -1
  29. package/dist/esm/api/account.d.mts +4 -3
  30. package/dist/esm/api/account.mjs +1 -1
  31. package/dist/esm/api/ans.d.mts +2 -2
  32. package/dist/esm/api/ans.mjs +1 -1
  33. package/dist/esm/api/aptos.d.mts +5 -2
  34. package/dist/esm/api/aptos.mjs +1 -1
  35. package/dist/esm/api/aptosConfig.mjs +1 -1
  36. package/dist/esm/api/coin.d.mts +1 -1
  37. package/dist/esm/api/coin.mjs +1 -1
  38. package/dist/esm/api/digitalAsset.d.mts +2 -2
  39. package/dist/esm/api/digitalAsset.mjs +1 -1
  40. package/dist/esm/api/event.mjs +1 -1
  41. package/dist/esm/api/faucet.mjs +1 -1
  42. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  43. package/dist/esm/api/fungibleAsset.mjs +1 -1
  44. package/dist/esm/api/general.d.mts +1 -1
  45. package/dist/esm/api/general.mjs +1 -1
  46. package/dist/esm/api/index.d.mts +5 -2
  47. package/dist/esm/api/index.mjs +1 -1
  48. package/dist/esm/api/keyless.d.mts +35 -21
  49. package/dist/esm/api/keyless.mjs +1 -1
  50. package/dist/esm/api/object.mjs +1 -1
  51. package/dist/esm/api/staking.mjs +1 -1
  52. package/dist/esm/api/table.mjs +1 -1
  53. package/dist/esm/api/transaction.d.mts +2 -2
  54. package/dist/esm/api/transaction.mjs +1 -1
  55. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  56. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  57. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  58. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  59. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  60. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  62. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  63. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  64. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  65. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  66. package/dist/esm/api/utils.mjs +1 -1
  67. package/dist/esm/bcs/index.d.mts +1 -1
  68. package/dist/esm/bcs/index.mjs +1 -1
  69. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  70. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  71. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  72. package/dist/esm/bcs/serializable/moveStructs.d.mts +10 -1
  73. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  74. package/dist/esm/bcs/serializer.mjs +1 -1
  75. package/dist/esm/chunk-23J256KA.mjs +2 -0
  76. package/dist/esm/chunk-23J256KA.mjs.map +1 -0
  77. package/dist/esm/{chunk-KEN2VRIM.mjs → chunk-2KLLSBBN.mjs} +2 -2
  78. package/dist/esm/{chunk-WFOYGJS5.mjs → chunk-2X3YDREK.mjs} +2 -2
  79. package/dist/esm/{chunk-PO33LVUF.mjs → chunk-35LCHJIH.mjs} +2 -2
  80. package/dist/esm/{chunk-G5MGSV7Y.mjs → chunk-3CE63FFN.mjs} +2 -2
  81. package/dist/esm/chunk-3TSO6PDV.mjs +2 -0
  82. package/dist/esm/{chunk-QE5OL6KN.mjs → chunk-3XXBKVEX.mjs} +2 -2
  83. package/dist/esm/{chunk-ZXYTLPP6.mjs → chunk-4I6IUAHQ.mjs} +2 -2
  84. package/dist/esm/chunk-4LHVEO7T.mjs +2 -0
  85. package/dist/esm/chunk-4LHVEO7T.mjs.map +1 -0
  86. package/dist/esm/{chunk-NCWD4NA3.mjs → chunk-4X4ODN6K.mjs} +2 -2
  87. package/dist/esm/{chunk-SUJLWCRN.mjs → chunk-5FPWLBZT.mjs} +2 -2
  88. package/dist/esm/chunk-5HI4R3A2.mjs +2 -0
  89. package/dist/esm/{chunk-AYX5JMB4.mjs → chunk-5HWJ3SN4.mjs} +2 -2
  90. package/dist/esm/{chunk-PY4TS34X.mjs → chunk-5MZJD6SA.mjs} +2 -2
  91. package/dist/esm/{chunk-3SPU4V2B.mjs → chunk-5RNKD3GW.mjs} +2 -2
  92. package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-5VQK4F5X.mjs} +2 -2
  93. package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-5VQK4F5X.mjs.map} +1 -1
  94. package/dist/esm/{chunk-F7NVDHR2.mjs → chunk-72S2NOM5.mjs} +2 -2
  95. package/dist/esm/chunk-72S2NOM5.mjs.map +1 -0
  96. package/dist/esm/{chunk-76HTG7Z7.mjs → chunk-7BPKOPP7.mjs} +2 -2
  97. package/dist/esm/chunk-7NQHLM3Y.mjs +2 -0
  98. package/dist/esm/chunk-7NQHLM3Y.mjs.map +1 -0
  99. package/dist/esm/{chunk-NRRADUK4.mjs → chunk-7T4PLPI7.mjs} +2 -2
  100. package/dist/esm/chunk-7T5CUI2H.mjs +2 -0
  101. package/dist/esm/{chunk-Q7MD4V7H.mjs.map → chunk-7T5CUI2H.mjs.map} +1 -1
  102. package/dist/esm/{chunk-UV7M72QD.mjs → chunk-AGFN3VVA.mjs} +2 -2
  103. package/dist/esm/{chunk-UO52TECC.mjs → chunk-AGTINH7K.mjs} +2 -2
  104. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
  105. package/dist/esm/{chunk-GHKMF253.mjs → chunk-ASQ2YBOR.mjs} +2 -2
  106. package/dist/esm/chunk-ASQIKTEF.mjs +2 -0
  107. package/dist/esm/chunk-ASQIKTEF.mjs.map +1 -0
  108. package/dist/esm/{chunk-GNFEBKFV.mjs → chunk-AT2A7OZD.mjs} +2 -2
  109. package/dist/esm/{chunk-A4T373F3.mjs → chunk-AWQNX3RT.mjs} +2 -2
  110. package/dist/esm/{chunk-NWOMSL6K.mjs → chunk-AZ642ORV.mjs} +2 -2
  111. package/dist/esm/{chunk-52KPINA4.mjs → chunk-B5NYEWNM.mjs} +2 -2
  112. package/dist/esm/chunk-BC5BEOKM.mjs +2 -0
  113. package/dist/esm/{chunk-G7UNU5GI.mjs → chunk-BQPQLOIW.mjs} +2 -2
  114. package/dist/esm/chunk-CDIKSNSU.mjs +2 -0
  115. package/dist/esm/chunk-CUDIVR4U.mjs +2 -0
  116. package/dist/esm/chunk-CUDIVR4U.mjs.map +1 -0
  117. package/dist/esm/chunk-DAIOG6HU.mjs +2 -0
  118. package/dist/esm/chunk-DAIOG6HU.mjs.map +1 -0
  119. package/dist/esm/chunk-DFMC56WX.mjs +2 -0
  120. package/dist/esm/chunk-DFMC56WX.mjs.map +1 -0
  121. package/dist/esm/chunk-DYMN66K5.mjs +2 -0
  122. package/dist/esm/{chunk-4ZMI5G5L.mjs.map → chunk-DYMN66K5.mjs.map} +1 -1
  123. package/dist/esm/{chunk-3NRBTP3S.mjs → chunk-E2WOZVJX.mjs} +2 -2
  124. package/dist/esm/chunk-E7VSBBQM.mjs +2 -0
  125. package/dist/esm/{chunk-YPHH6CAO.mjs.map → chunk-E7VSBBQM.mjs.map} +1 -1
  126. package/dist/esm/{chunk-OHRL766V.mjs → chunk-EDVGFSB5.mjs} +2 -2
  127. package/dist/esm/{chunk-OHRL766V.mjs.map → chunk-EDVGFSB5.mjs.map} +1 -1
  128. package/dist/esm/chunk-EXP5STXZ.mjs +2 -0
  129. package/dist/esm/chunk-EXP5STXZ.mjs.map +1 -0
  130. package/dist/esm/chunk-FBPNHF54.mjs +2 -0
  131. package/dist/esm/{chunk-UWPO7WWS.mjs → chunk-FDD6WNN6.mjs} +2 -2
  132. package/dist/esm/{chunk-6ERHGCK2.mjs → chunk-FDTLBR6D.mjs} +2 -2
  133. package/dist/esm/{chunk-FOHGSNYZ.mjs → chunk-FLNLQ7K5.mjs} +2 -2
  134. package/dist/esm/chunk-FOLCONSQ.mjs +2 -0
  135. package/dist/esm/{chunk-5IUXBOS5.mjs → chunk-FTBXTZM2.mjs} +2 -2
  136. package/dist/esm/chunk-GAEAYY44.mjs +1 -0
  137. package/dist/esm/chunk-GAEAYY44.mjs.map +1 -0
  138. package/dist/esm/{chunk-ZXPBRVOA.mjs → chunk-GKRIMGKW.mjs} +2 -2
  139. package/dist/esm/{chunk-MEKXPGK7.mjs → chunk-GX2II7H4.mjs} +2 -2
  140. package/dist/esm/{chunk-I5XQKNOK.mjs → chunk-H3TJNBHX.mjs} +2 -2
  141. package/dist/esm/{chunk-MLL54PYO.mjs → chunk-HAT5S2XX.mjs} +2 -2
  142. package/dist/esm/{chunk-MLL54PYO.mjs.map → chunk-HAT5S2XX.mjs.map} +1 -1
  143. package/dist/esm/{chunk-ECKJI2TV.mjs → chunk-HOQCND6F.mjs} +2 -2
  144. package/dist/esm/chunk-IA4RELOH.mjs +1 -0
  145. package/dist/esm/chunk-IA4RELOH.mjs.map +1 -0
  146. package/dist/esm/chunk-IEH7ILF3.mjs +2 -0
  147. package/dist/esm/chunk-IEH7ILF3.mjs.map +1 -0
  148. package/dist/esm/{chunk-ORXEFE6X.mjs → chunk-ILI5TDXD.mjs} +2 -2
  149. package/dist/esm/{chunk-SONTIUAM.mjs → chunk-J45FMNYT.mjs} +2 -2
  150. package/dist/esm/{chunk-HHU7UCFI.mjs → chunk-K7ZPRL7C.mjs} +2 -2
  151. package/dist/esm/chunk-K7ZPRL7C.mjs.map +1 -0
  152. package/dist/esm/{chunk-7AIKM3UF.mjs → chunk-KRRHWHTG.mjs} +2 -2
  153. package/dist/esm/{chunk-USOIC4HO.mjs → chunk-LKN324IO.mjs} +2 -2
  154. package/dist/esm/chunk-MYF2VRVN.mjs +2 -0
  155. package/dist/esm/chunk-MYF2VRVN.mjs.map +1 -0
  156. package/dist/esm/chunk-N6EC72OZ.mjs +2 -0
  157. package/dist/esm/chunk-ND23H3AK.mjs +2 -0
  158. package/dist/esm/{chunk-JKNTGRSQ.mjs → chunk-NGIPNL7N.mjs} +2 -2
  159. package/dist/esm/{chunk-ZQFFRZJ4.mjs → chunk-NLV3PTOE.mjs} +2 -2
  160. package/dist/esm/{chunk-ZZRSKHWS.mjs → chunk-NOVJ2ROD.mjs} +2 -2
  161. package/dist/esm/{chunk-FNT3VLRD.mjs → chunk-NWTMTPPX.mjs} +2 -2
  162. package/dist/esm/chunk-OOVNFKA6.mjs +2 -0
  163. package/dist/esm/{chunk-CTJX4CUF.mjs → chunk-PDY3AFVI.mjs} +2 -2
  164. package/dist/esm/{chunk-T2NJUIOQ.mjs → chunk-QKVID52D.mjs} +2 -2
  165. package/dist/esm/{chunk-7Y3MRBG6.mjs → chunk-QOE5WJMC.mjs} +2 -2
  166. package/dist/esm/chunk-QP2A5ISX.mjs +2 -0
  167. package/dist/esm/{chunk-O4BBULNE.mjs → chunk-QTTDBQAJ.mjs} +2 -2
  168. package/dist/esm/{chunk-H33YIMTU.mjs → chunk-R2RMAWDH.mjs} +2 -2
  169. package/dist/esm/{chunk-5L3PLK3W.mjs → chunk-S3I4THN5.mjs} +2 -2
  170. package/dist/esm/{chunk-HRIYZBXY.mjs → chunk-S6TRBKP5.mjs} +2 -2
  171. package/dist/esm/{chunk-WRRQ7L5K.mjs → chunk-SHOPSMRK.mjs} +2 -2
  172. package/dist/esm/{chunk-YDZBU2DJ.mjs → chunk-SP4PT77Z.mjs} +2 -2
  173. package/dist/esm/chunk-SVO6PVAX.mjs +2 -0
  174. package/dist/esm/chunk-SVO6PVAX.mjs.map +1 -0
  175. package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
  176. package/dist/esm/chunk-TKQEC2WD.mjs +2 -0
  177. package/dist/esm/chunk-TKQEC2WD.mjs.map +1 -0
  178. package/dist/esm/chunk-TVWAYKEP.mjs +2 -0
  179. package/dist/esm/chunk-UAL27G6B.mjs +2 -0
  180. package/dist/esm/chunk-UAL27G6B.mjs.map +1 -0
  181. package/dist/esm/chunk-UW5TIZFE.mjs +2 -0
  182. package/dist/esm/{chunk-2N2VEGT6.mjs → chunk-VNIBQXNX.mjs} +2 -2
  183. package/dist/esm/{chunk-NMD45OTM.mjs → chunk-VTEOS4PS.mjs} +2 -2
  184. package/dist/esm/{chunk-6BYVG7H4.mjs → chunk-VZKENIJR.mjs} +2 -2
  185. package/dist/esm/{chunk-OEOUZFHD.mjs → chunk-X26OHQZO.mjs} +2 -2
  186. package/dist/esm/{chunk-HKMG3LZX.mjs → chunk-YACGA3YS.mjs} +2 -2
  187. package/dist/esm/chunk-YELQZVBK.mjs +2 -0
  188. package/dist/esm/chunk-YELQZVBK.mjs.map +1 -0
  189. package/dist/esm/{chunk-2CC67KW5.mjs → chunk-YSVXROOO.mjs} +2 -2
  190. package/dist/esm/{chunk-74YFNJ7A.mjs → chunk-YTOQGCAM.mjs} +2 -2
  191. package/dist/esm/chunk-Z56T4OGM.mjs +2 -0
  192. package/dist/esm/chunk-Z56T4OGM.mjs.map +1 -0
  193. package/dist/esm/chunk-ZAHUEAGT.mjs +2 -0
  194. package/dist/esm/chunk-ZAHUEAGT.mjs.map +1 -0
  195. package/dist/esm/chunk-ZASN3QQQ.mjs +2 -0
  196. package/dist/esm/chunk-ZXVQ2OBJ.mjs +2 -0
  197. package/dist/esm/{chunk-ZEYOFDIO.mjs.map → chunk-ZXVQ2OBJ.mjs.map} +1 -1
  198. package/dist/esm/{chunk-A63SMUOU.mjs → chunk-ZZIMFLVT.mjs} +2 -2
  199. package/dist/esm/cli/index.mjs +1 -1
  200. package/dist/esm/cli/localNode.mjs +1 -1
  201. package/dist/esm/cli/move.mjs +1 -1
  202. package/dist/esm/client/core.mjs +1 -1
  203. package/dist/esm/client/get.mjs +1 -1
  204. package/dist/esm/client/index.mjs +1 -1
  205. package/dist/esm/client/post.mjs +1 -1
  206. package/dist/esm/client/types.mjs +1 -1
  207. package/dist/esm/core/account/index.mjs +1 -1
  208. package/dist/esm/core/account/utils/address.mjs +1 -1
  209. package/dist/esm/core/account/utils/index.mjs +1 -1
  210. package/dist/esm/core/accountAddress.mjs +1 -1
  211. package/dist/esm/core/authenticationKey.d.mts +1 -1
  212. package/dist/esm/core/authenticationKey.mjs +1 -1
  213. package/dist/esm/core/common.mjs +1 -1
  214. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  215. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  216. package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
  217. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  218. package/dist/esm/core/crypto/federatedKeyless.d.mts +97 -0
  219. package/dist/esm/core/crypto/federatedKeyless.mjs +2 -0
  220. package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -0
  221. package/dist/esm/core/crypto/index.d.mts +4 -3
  222. package/dist/esm/core/crypto/index.mjs +1 -1
  223. package/dist/esm/core/crypto/keyless.d.mts +1 -1
  224. package/dist/esm/core/crypto/keyless.mjs +1 -1
  225. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  226. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  227. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  228. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  229. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  230. package/dist/esm/core/crypto/proof.mjs +1 -1
  231. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  232. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  233. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  234. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  235. package/dist/esm/core/crypto/signature.mjs +1 -1
  236. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  237. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  238. package/dist/esm/core/crypto/utils.mjs +1 -1
  239. package/dist/esm/core/hex.mjs +1 -1
  240. package/dist/esm/core/index.d.mts +2 -1
  241. package/dist/esm/core/index.mjs +1 -1
  242. package/dist/esm/index.d.mts +9 -6
  243. package/dist/esm/index.mjs +1 -1
  244. package/dist/esm/internal/account.d.mts +2 -2
  245. package/dist/esm/internal/account.mjs +1 -1
  246. package/dist/esm/internal/ans.d.mts +2 -2
  247. package/dist/esm/internal/ans.mjs +1 -1
  248. package/dist/esm/internal/coin.d.mts +1 -1
  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.mjs +1 -1
  253. package/dist/esm/internal/faucet.mjs +1 -1
  254. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  255. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  256. package/dist/esm/internal/general.mjs +1 -1
  257. package/dist/esm/internal/keyless.d.mts +25 -14
  258. package/dist/esm/internal/keyless.mjs +1 -1
  259. package/dist/esm/internal/object.mjs +1 -1
  260. package/dist/esm/internal/staking.mjs +1 -1
  261. package/dist/esm/internal/table.mjs +1 -1
  262. package/dist/esm/internal/transaction.mjs +1 -1
  263. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  264. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  265. package/dist/esm/internal/view.d.mts +1 -1
  266. package/dist/esm/internal/view.mjs +1 -1
  267. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  268. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  269. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  270. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  271. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  272. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  273. package/dist/esm/transactions/index.d.mts +1 -1
  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.d.mts +1 -1
  278. package/dist/esm/transactions/instances/index.mjs +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.d.mts +1 -1
  283. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  284. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  285. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  286. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  287. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  288. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  289. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  290. package/dist/esm/transactions/management/index.d.mts +2 -2
  291. package/dist/esm/transactions/management/index.mjs +1 -1
  292. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  293. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  294. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  295. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  296. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  297. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  298. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
  299. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  300. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
  301. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  302. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  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 +3 -3
  307. package/dist/esm/types/index.d.mts +4 -2
  308. package/dist/esm/types/index.mjs +1 -1
  309. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  310. package/dist/esm/utils/const.d.mts +2 -1
  311. package/dist/esm/utils/const.mjs +1 -1
  312. package/dist/esm/utils/helpers.d.mts +41 -1
  313. package/dist/esm/utils/helpers.mjs +1 -1
  314. package/dist/esm/utils/index.d.mts +2 -2
  315. package/dist/esm/utils/index.mjs +1 -1
  316. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  317. package/dist/esm/version.d.mts +1 -1
  318. package/dist/esm/version.mjs +1 -1
  319. package/package.json +1 -1
  320. package/src/account/FederatedKeylessAccount.ts +115 -0
  321. package/src/account/KeylessAccount.ts +6 -291
  322. package/src/account/KeylessAccountCommon.ts +329 -0
  323. package/src/account/MultiKeyAccount.ts +4 -4
  324. package/src/account/index.ts +2 -0
  325. package/src/api/account.ts +31 -4
  326. package/src/api/keyless.ts +50 -4
  327. package/src/bcs/serializable/moveStructs.ts +41 -8
  328. package/src/cli/move.ts +1 -1
  329. package/src/core/crypto/federatedKeyless.ts +134 -0
  330. package/src/core/crypto/index.ts +1 -0
  331. package/src/core/crypto/singleKey.ts +6 -0
  332. package/src/internal/account.ts +6 -5
  333. package/src/internal/event.ts +10 -3
  334. package/src/internal/keyless.ts +82 -8
  335. package/src/internal/transactionSubmission.ts +2 -2
  336. package/src/transactions/instances/transactionPayload.ts +3 -1
  337. package/src/transactions/transactionBuilder/transactionBuilder.ts +25 -14
  338. package/src/transactions/types.ts +4 -2
  339. package/src/types/index.ts +2 -0
  340. package/src/utils/apiEndpoints.ts +2 -2
  341. package/src/utils/const.ts +1 -0
  342. package/src/utils/helpers.ts +70 -0
  343. package/src/version.ts +1 -1
  344. package/dist/common/chunk-J4IUXT5W.js +0 -2
  345. package/dist/common/chunk-J4IUXT5W.js.map +0 -1
  346. package/dist/esm/chunk-4SDUQ7AS.mjs +0 -2
  347. package/dist/esm/chunk-4SDUQ7AS.mjs.map +0 -1
  348. package/dist/esm/chunk-4ZMI5G5L.mjs +0 -2
  349. package/dist/esm/chunk-76OH2Z4Q.mjs +0 -2
  350. package/dist/esm/chunk-7Z6DYLCA.mjs +0 -1
  351. package/dist/esm/chunk-AQ4I7VVB.mjs +0 -1
  352. package/dist/esm/chunk-BOYYQAB4.mjs +0 -2
  353. package/dist/esm/chunk-EZIF26UH.mjs +0 -2
  354. package/dist/esm/chunk-EZIF26UH.mjs.map +0 -1
  355. package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
  356. package/dist/esm/chunk-F7NVDHR2.mjs.map +0 -1
  357. package/dist/esm/chunk-GXTEJ7NO.mjs +0 -2
  358. package/dist/esm/chunk-H6YNXJNF.mjs +0 -2
  359. package/dist/esm/chunk-HHU7UCFI.mjs.map +0 -1
  360. package/dist/esm/chunk-KMJ6TF6Y.mjs +0 -2
  361. package/dist/esm/chunk-KMJ6TF6Y.mjs.map +0 -1
  362. package/dist/esm/chunk-L36ZHC7J.mjs +0 -2
  363. package/dist/esm/chunk-L36ZHC7J.mjs.map +0 -1
  364. package/dist/esm/chunk-LDTF3ABK.mjs +0 -2
  365. package/dist/esm/chunk-LDTF3ABK.mjs.map +0 -1
  366. package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
  367. package/dist/esm/chunk-MLDQ2TY2.mjs +0 -2
  368. package/dist/esm/chunk-MQGW234H.mjs +0 -2
  369. package/dist/esm/chunk-NU55IEL4.mjs +0 -2
  370. package/dist/esm/chunk-NU55IEL4.mjs.map +0 -1
  371. package/dist/esm/chunk-P5V7OZNN.mjs +0 -2
  372. package/dist/esm/chunk-Q67DUNMI.mjs +0 -2
  373. package/dist/esm/chunk-Q7MD4V7H.mjs +0 -2
  374. package/dist/esm/chunk-QV6EZL2G.mjs +0 -2
  375. package/dist/esm/chunk-RA3YPQG2.mjs +0 -2
  376. package/dist/esm/chunk-RA3YPQG2.mjs.map +0 -1
  377. package/dist/esm/chunk-TDGQGILY.mjs +0 -2
  378. package/dist/esm/chunk-THRXIXIO.mjs +0 -2
  379. package/dist/esm/chunk-THRXIXIO.mjs.map +0 -1
  380. package/dist/esm/chunk-WABFFJGI.mjs +0 -2
  381. package/dist/esm/chunk-WABFFJGI.mjs.map +0 -1
  382. package/dist/esm/chunk-WHW4Z7TK.mjs +0 -2
  383. package/dist/esm/chunk-WHW4Z7TK.mjs.map +0 -1
  384. package/dist/esm/chunk-Y3HLYCF3.mjs +0 -2
  385. package/dist/esm/chunk-YPHH6CAO.mjs +0 -2
  386. package/dist/esm/chunk-YUNDX5I7.mjs +0 -2
  387. package/dist/esm/chunk-YXITAP46.mjs +0 -2
  388. package/dist/esm/chunk-YXITAP46.mjs.map +0 -1
  389. package/dist/esm/chunk-YY2XW5R4.mjs +0 -2
  390. package/dist/esm/chunk-YY2XW5R4.mjs.map +0 -1
  391. package/dist/esm/chunk-ZEYOFDIO.mjs +0 -2
  392. package/dist/esm/chunk-ZOMXBB6Z.mjs +0 -2
  393. package/dist/esm/chunk-ZOMXBB6Z.mjs.map +0 -1
  394. /package/dist/esm/{chunk-7Z6DYLCA.mjs.map → account/FederatedKeylessAccount.mjs.map} +0 -0
  395. /package/dist/esm/{chunk-AQ4I7VVB.mjs.map → account/KeylessAccountCommon.mjs.map} +0 -0
  396. /package/dist/esm/{chunk-KEN2VRIM.mjs.map → chunk-2KLLSBBN.mjs.map} +0 -0
  397. /package/dist/esm/{chunk-WFOYGJS5.mjs.map → chunk-2X3YDREK.mjs.map} +0 -0
  398. /package/dist/esm/{chunk-PO33LVUF.mjs.map → chunk-35LCHJIH.mjs.map} +0 -0
  399. /package/dist/esm/{chunk-G5MGSV7Y.mjs.map → chunk-3CE63FFN.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-TDGQGILY.mjs.map → chunk-3TSO6PDV.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-QE5OL6KN.mjs.map → chunk-3XXBKVEX.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-ZXYTLPP6.mjs.map → chunk-4I6IUAHQ.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-NCWD4NA3.mjs.map → chunk-4X4ODN6K.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-SUJLWCRN.mjs.map → chunk-5FPWLBZT.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-YUNDX5I7.mjs.map → chunk-5HI4R3A2.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-AYX5JMB4.mjs.map → chunk-5HWJ3SN4.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-PY4TS34X.mjs.map → chunk-5MZJD6SA.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-3SPU4V2B.mjs.map → chunk-5RNKD3GW.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-76HTG7Z7.mjs.map → chunk-7BPKOPP7.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-NRRADUK4.mjs.map → chunk-7T4PLPI7.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-UV7M72QD.mjs.map → chunk-AGFN3VVA.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-UO52TECC.mjs.map → chunk-AGTINH7K.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
  414. /package/dist/esm/{chunk-GHKMF253.mjs.map → chunk-ASQ2YBOR.mjs.map} +0 -0
  415. /package/dist/esm/{chunk-GNFEBKFV.mjs.map → chunk-AT2A7OZD.mjs.map} +0 -0
  416. /package/dist/esm/{chunk-A4T373F3.mjs.map → chunk-AWQNX3RT.mjs.map} +0 -0
  417. /package/dist/esm/{chunk-NWOMSL6K.mjs.map → chunk-AZ642ORV.mjs.map} +0 -0
  418. /package/dist/esm/{chunk-52KPINA4.mjs.map → chunk-B5NYEWNM.mjs.map} +0 -0
  419. /package/dist/esm/{chunk-Q67DUNMI.mjs.map → chunk-BC5BEOKM.mjs.map} +0 -0
  420. /package/dist/esm/{chunk-G7UNU5GI.mjs.map → chunk-BQPQLOIW.mjs.map} +0 -0
  421. /package/dist/esm/{chunk-P5V7OZNN.mjs.map → chunk-CDIKSNSU.mjs.map} +0 -0
  422. /package/dist/esm/{chunk-3NRBTP3S.mjs.map → chunk-E2WOZVJX.mjs.map} +0 -0
  423. /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
  424. /package/dist/esm/{chunk-UWPO7WWS.mjs.map → chunk-FDD6WNN6.mjs.map} +0 -0
  425. /package/dist/esm/{chunk-6ERHGCK2.mjs.map → chunk-FDTLBR6D.mjs.map} +0 -0
  426. /package/dist/esm/{chunk-FOHGSNYZ.mjs.map → chunk-FLNLQ7K5.mjs.map} +0 -0
  427. /package/dist/esm/{chunk-76OH2Z4Q.mjs.map → chunk-FOLCONSQ.mjs.map} +0 -0
  428. /package/dist/esm/{chunk-5IUXBOS5.mjs.map → chunk-FTBXTZM2.mjs.map} +0 -0
  429. /package/dist/esm/{chunk-ZXPBRVOA.mjs.map → chunk-GKRIMGKW.mjs.map} +0 -0
  430. /package/dist/esm/{chunk-MEKXPGK7.mjs.map → chunk-GX2II7H4.mjs.map} +0 -0
  431. /package/dist/esm/{chunk-I5XQKNOK.mjs.map → chunk-H3TJNBHX.mjs.map} +0 -0
  432. /package/dist/esm/{chunk-ECKJI2TV.mjs.map → chunk-HOQCND6F.mjs.map} +0 -0
  433. /package/dist/esm/{chunk-ORXEFE6X.mjs.map → chunk-ILI5TDXD.mjs.map} +0 -0
  434. /package/dist/esm/{chunk-SONTIUAM.mjs.map → chunk-J45FMNYT.mjs.map} +0 -0
  435. /package/dist/esm/{chunk-7AIKM3UF.mjs.map → chunk-KRRHWHTG.mjs.map} +0 -0
  436. /package/dist/esm/{chunk-USOIC4HO.mjs.map → chunk-LKN324IO.mjs.map} +0 -0
  437. /package/dist/esm/{chunk-MQGW234H.mjs.map → chunk-N6EC72OZ.mjs.map} +0 -0
  438. /package/dist/esm/{chunk-GXTEJ7NO.mjs.map → chunk-ND23H3AK.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-JKNTGRSQ.mjs.map → chunk-NGIPNL7N.mjs.map} +0 -0
  440. /package/dist/esm/{chunk-ZQFFRZJ4.mjs.map → chunk-NLV3PTOE.mjs.map} +0 -0
  441. /package/dist/esm/{chunk-ZZRSKHWS.mjs.map → chunk-NOVJ2ROD.mjs.map} +0 -0
  442. /package/dist/esm/{chunk-FNT3VLRD.mjs.map → chunk-NWTMTPPX.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-QV6EZL2G.mjs.map → chunk-OOVNFKA6.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-CTJX4CUF.mjs.map → chunk-PDY3AFVI.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-T2NJUIOQ.mjs.map → chunk-QKVID52D.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-7Y3MRBG6.mjs.map → chunk-QOE5WJMC.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-MLDQ2TY2.mjs.map → chunk-QP2A5ISX.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-O4BBULNE.mjs.map → chunk-QTTDBQAJ.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-H33YIMTU.mjs.map → chunk-R2RMAWDH.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-5L3PLK3W.mjs.map → chunk-S3I4THN5.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-HRIYZBXY.mjs.map → chunk-S6TRBKP5.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-WRRQ7L5K.mjs.map → chunk-SHOPSMRK.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-YDZBU2DJ.mjs.map → chunk-SP4PT77Z.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-H6YNXJNF.mjs.map → chunk-TVWAYKEP.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-BOYYQAB4.mjs.map → chunk-UW5TIZFE.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-2N2VEGT6.mjs.map → chunk-VNIBQXNX.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-NMD45OTM.mjs.map → chunk-VTEOS4PS.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-6BYVG7H4.mjs.map → chunk-VZKENIJR.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-OEOUZFHD.mjs.map → chunk-X26OHQZO.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-HKMG3LZX.mjs.map → chunk-YACGA3YS.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-2CC67KW5.mjs.map → chunk-YSVXROOO.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-74YFNJ7A.mjs.map → chunk-YTOQGCAM.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-Y3HLYCF3.mjs.map → chunk-ZASN3QQQ.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-A63SMUOU.mjs.map → chunk-ZZIMFLVT.mjs.map} +0 -0
  466. /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
@@ -2,27 +2,13 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { JwtPayload, jwtDecode } from "jwt-decode";
5
- import EventEmitter from "eventemitter3";
6
- import { EphemeralCertificateVariant, HexInput, SigningScheme } from "../types";
5
+ import { HexInput } from "../types";
7
6
  import { AccountAddress } from "../core/accountAddress";
8
- import {
9
- AnyPublicKey,
10
- AnySignature,
11
- KeylessPublicKey,
12
- KeylessSignature,
13
- EphemeralCertificate,
14
- ZeroKnowledgeSig,
15
- ZkProof,
16
- } from "../core/crypto";
7
+ import { ZeroKnowledgeSig } from "../core/crypto";
17
8
 
18
- import { Account } from "./Account";
19
9
  import { EphemeralKeyPair } from "./EphemeralKeyPair";
20
- import { Hex } from "../core/hex";
21
- import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
22
- import { Deserializer, Serializable, Serializer } from "../bcs";
23
- import { deriveTransactionType, generateSigningMessage } from "../transactions/transactionBuilder/signingMessage";
24
- import { AnyRawTransaction, AnyRawTransactionInstance } from "../transactions/types";
25
- import { base64UrlDecode } from "../utils/helpers";
10
+ import { Deserializer, Serializer } from "../bcs";
11
+ import { KeylessAccountCommon, ProofFetchCallback } from "./KeylessAccountCommon";
26
12
 
27
13
  /**
28
14
  * Account implementation for the Keyless authentication scheme.
@@ -34,71 +20,7 @@ import { base64UrlDecode } from "../utils/helpers";
34
20
  * When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,
35
21
  * EphemeralKeyPair, and corresponding proof.
36
22
  */
37
- export class KeylessAccount extends Serializable implements Account {
38
- static readonly PEPPER_LENGTH: number = 31;
39
-
40
- /**
41
- * The KeylessPublicKey associated with the account
42
- */
43
- readonly publicKey: KeylessPublicKey;
44
-
45
- /**
46
- * The EphemeralKeyPair used to generate sign.
47
- */
48
- readonly ephemeralKeyPair: EphemeralKeyPair;
49
-
50
- /**
51
- * The claim on the JWT to identify a user. This is typically 'sub' or 'email'.
52
- */
53
- readonly uidKey: string;
54
-
55
- /**
56
- * The value of the uidKey claim on the JWT. This intended to be a stable user identifier.
57
- */
58
- readonly uidVal: string;
59
-
60
- /**
61
- * The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's
62
- * OIDC registration with the identity provider.
63
- */
64
- readonly aud: string;
65
-
66
- /**
67
- * A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
68
- */
69
- readonly pepper: Uint8Array;
70
-
71
- /**
72
- * Account address associated with the account
73
- */
74
- readonly accountAddress: AccountAddress;
75
-
76
- /**
77
- * The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
78
- */
79
- proof: ZeroKnowledgeSig | undefined;
80
-
81
- /**
82
- * The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on
83
- * fetching the proof.
84
- */
85
- readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
86
-
87
- /**
88
- * Signing scheme used to sign transactions
89
- */
90
- readonly signingScheme: SigningScheme;
91
-
92
- /**
93
- * The JWT token used to derive the account
94
- */
95
- readonly jwt: string;
96
-
97
- /**
98
- * An event emitter used to assist in handling asycronous proof fetching.
99
- */
100
- private readonly emitter: EventEmitter<ProofFetchEvents>;
101
-
23
+ export class KeylessAccount extends KeylessAccountCommon {
102
24
  // Use the static constructor 'create' instead.
103
25
  private constructor(args: {
104
26
  address?: AccountAddress;
@@ -112,52 +34,7 @@ export class KeylessAccount extends Serializable implements Account {
112
34
  proofFetchCallback?: ProofFetchCallback;
113
35
  jwt: string;
114
36
  }) {
115
- super();
116
- const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proof, proofFetchCallback, jwt } = args;
117
- this.ephemeralKeyPair = ephemeralKeyPair;
118
- this.publicKey = KeylessPublicKey.create(args);
119
- this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
120
- this.uidKey = uidKey;
121
- this.uidVal = uidVal;
122
- this.aud = aud;
123
- this.jwt = jwt;
124
- this.emitter = new EventEmitter<ProofFetchEvents>();
125
- this.proofOrPromise = proof;
126
- if (proof instanceof ZeroKnowledgeSig) {
127
- this.proof = proof;
128
- } else {
129
- if (proofFetchCallback === undefined) {
130
- throw new Error("Must provide callback for async proof fetch");
131
- }
132
- this.emitter.on("proofFetchFinish", async (status) => {
133
- await proofFetchCallback(status);
134
- this.emitter.removeAllListeners();
135
- });
136
- this.init(proof);
137
- }
138
- this.signingScheme = SigningScheme.SingleKey;
139
- const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
140
- if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {
141
- throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);
142
- }
143
- this.pepper = pepperBytes;
144
- }
145
-
146
- /**
147
- * This initializes the asyncronous proof fetch
148
- * @return
149
- */
150
- async init(promise: Promise<ZeroKnowledgeSig>) {
151
- try {
152
- this.proof = await promise;
153
- this.emitter.emit("proofFetchFinish", { status: "Success" });
154
- } catch (error) {
155
- if (error instanceof Error) {
156
- this.emitter.emit("proofFetchFinish", { status: "Failed", error: error.toString() });
157
- } else {
158
- this.emitter.emit("proofFetchFinish", { status: "Failed", error: "Unknown" });
159
- }
160
- }
37
+ super(args);
161
38
  }
162
39
 
163
40
  serialize(serializer: Serializer): void {
@@ -186,110 +63,6 @@ export class KeylessAccount extends Serializable implements Account {
186
63
  });
187
64
  }
188
65
 
189
- /**
190
- * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair
191
- * and JWT token.
192
- * @return boolean
193
- */
194
- isExpired(): boolean {
195
- return this.ephemeralKeyPair.isExpired();
196
- }
197
-
198
- /**
199
- * Sign a message using Keyless.
200
- * @param message the message to sign, as binary input
201
- * @return the AccountAuthenticator containing the signature, together with the account's public key
202
- */
203
- signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
204
- const signature = new AnySignature(this.sign(message));
205
- const publicKey = new AnyPublicKey(this.publicKey);
206
- return new AccountAuthenticatorSingleKey(publicKey, signature);
207
- }
208
-
209
- /**
210
- * Sign a transaction using Keyless.
211
- * @param transaction the raw transaction
212
- * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
213
- */
214
- signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
215
- const signature = new AnySignature(this.signTransaction(transaction));
216
- const publicKey = new AnyPublicKey(this.publicKey);
217
- return new AccountAuthenticatorSingleKey(publicKey, signature);
218
- }
219
-
220
- /**
221
- * Waits for asyncronous proof fetching to finish.
222
- * @return
223
- */
224
- async waitForProofFetch() {
225
- if (this.proofOrPromise instanceof Promise) {
226
- await this.proofOrPromise;
227
- }
228
- }
229
-
230
- /**
231
- * Sign the given message using Keyless.
232
- * @param message in HexInput format
233
- * @returns Signature
234
- */
235
- sign(data: HexInput): KeylessSignature {
236
- const { expiryDateSecs } = this.ephemeralKeyPair;
237
- if (this.isExpired()) {
238
- throw new Error("EphemeralKeyPair is expired");
239
- }
240
- if (this.proof === undefined) {
241
- throw new Error("Proof not defined");
242
- }
243
- const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
244
- const ephemeralSignature = this.ephemeralKeyPair.sign(data);
245
-
246
- return new KeylessSignature({
247
- jwtHeader: base64UrlDecode(this.jwt.split(".")[0]),
248
- ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),
249
- expiryDateSecs,
250
- ephemeralPublicKey,
251
- ephemeralSignature,
252
- });
253
- }
254
-
255
- /**
256
- * Sign the given transaction with Keyless.
257
- * Signs the transaction and proof to guard against proof malleability.
258
- * @param transaction the transaction to be signed
259
- * @returns KeylessSignature
260
- */
261
- signTransaction(transaction: AnyRawTransaction): KeylessSignature {
262
- if (this.proof === undefined) {
263
- throw new Error("Proof not found");
264
- }
265
- const raw = deriveTransactionType(transaction);
266
- const txnAndProof = new TransactionAndProof(raw, this.proof.proof);
267
- const signMess = txnAndProof.hash();
268
- return this.sign(signMess);
269
- }
270
-
271
- /**
272
- * Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount
273
- *
274
- * Verifies a signature given the message.
275
- *
276
- * TODO: Groth16 proof verification
277
- *
278
- * @param args.message the message that was signed.
279
- * @param args.signature the KeylessSignature to verify
280
- * @returns boolean
281
- */
282
- verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {
283
- const { message, signature } = args;
284
- if (this.isExpired()) {
285
- return false;
286
- }
287
- if (!this.ephemeralKeyPair.getPublicKey().verifySignature({ message, signature: signature.ephemeralSignature })) {
288
- return false;
289
- }
290
- return true;
291
- }
292
-
293
66
  static fromBytes(bytes: Uint8Array): KeylessAccount {
294
67
  return KeylessAccount.deserialize(new Deserializer(bytes));
295
68
  }
@@ -326,61 +99,3 @@ export class KeylessAccount extends Serializable implements Account {
326
99
  });
327
100
  }
328
101
  }
329
-
330
- /**
331
- * A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create
332
- * the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.
333
- */
334
- class TransactionAndProof extends Serializable {
335
- /**
336
- * The transaction to sign.
337
- */
338
- transaction: AnyRawTransactionInstance;
339
-
340
- /**
341
- * The zero knowledge proof used in signing the transaction.
342
- */
343
- proof?: ZkProof;
344
-
345
- /**
346
- * The domain separator prefix used when hashing.
347
- */
348
- readonly domainSeparator = "APTOS::TransactionAndProof";
349
-
350
- constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {
351
- super();
352
- this.transaction = transaction;
353
- this.proof = proof;
354
- }
355
-
356
- serialize(serializer: Serializer): void {
357
- serializer.serializeFixedBytes(this.transaction.bcsToBytes());
358
- serializer.serializeOption(this.proof);
359
- }
360
-
361
- /**
362
- * Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core.
363
- *
364
- * @returns Uint8Array
365
- */
366
- hash(): Uint8Array {
367
- return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);
368
- }
369
- }
370
-
371
- export type ProofFetchSuccess = {
372
- status: "Success";
373
- };
374
-
375
- export type ProofFetchFailure = {
376
- status: "Failed";
377
- error: string;
378
- };
379
-
380
- export type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;
381
-
382
- export type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;
383
-
384
- export interface ProofFetchEvents {
385
- proofFetchFinish: (status: ProofFetchStatus) => void;
386
- }
@@ -0,0 +1,329 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import EventEmitter from "eventemitter3";
5
+ import { EphemeralCertificateVariant, HexInput, SigningScheme } from "../types";
6
+ import { AccountAddress } from "../core/accountAddress";
7
+ import {
8
+ AnyPublicKey,
9
+ AnySignature,
10
+ KeylessPublicKey,
11
+ KeylessSignature,
12
+ EphemeralCertificate,
13
+ ZeroKnowledgeSig,
14
+ ZkProof,
15
+ } from "../core/crypto";
16
+
17
+ import { Account } from "./Account";
18
+ import { EphemeralKeyPair } from "./EphemeralKeyPair";
19
+ import { Hex } from "../core/hex";
20
+ import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
21
+ import { Serializable, Serializer } from "../bcs";
22
+ import { deriveTransactionType, generateSigningMessage } from "../transactions/transactionBuilder/signingMessage";
23
+ import { AnyRawTransaction, AnyRawTransactionInstance } from "../transactions/types";
24
+ import { base64UrlDecode } from "../utils/helpers";
25
+ import { FederatedKeylessPublicKey } from "../core/crypto/federatedKeyless";
26
+
27
+ /**
28
+ * Account implementation for the Keyless authentication scheme. This abstract class is used for standard Keyless Accounts
29
+ * and Federated Keyless Accounts.
30
+ */
31
+ export abstract class KeylessAccountCommon extends Serializable implements Account {
32
+ static readonly PEPPER_LENGTH: number = 31;
33
+
34
+ /**
35
+ * The KeylessPublicKey associated with the account
36
+ */
37
+ readonly publicKey: KeylessPublicKey | FederatedKeylessPublicKey;
38
+
39
+ /**
40
+ * The EphemeralKeyPair used to generate sign.
41
+ */
42
+ readonly ephemeralKeyPair: EphemeralKeyPair;
43
+
44
+ /**
45
+ * The claim on the JWT to identify a user. This is typically 'sub' or 'email'.
46
+ */
47
+ readonly uidKey: string;
48
+
49
+ /**
50
+ * The value of the uidKey claim on the JWT. This intended to be a stable user identifier.
51
+ */
52
+ readonly uidVal: string;
53
+
54
+ /**
55
+ * The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's
56
+ * OIDC registration with the identity provider.
57
+ */
58
+ readonly aud: string;
59
+
60
+ /**
61
+ * A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
62
+ */
63
+ readonly pepper: Uint8Array;
64
+
65
+ /**
66
+ * Account address associated with the account
67
+ */
68
+ readonly accountAddress: AccountAddress;
69
+
70
+ /**
71
+ * The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
72
+ */
73
+ proof: ZeroKnowledgeSig | undefined;
74
+
75
+ /**
76
+ * The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on
77
+ * fetching the proof.
78
+ */
79
+ readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
80
+
81
+ /**
82
+ * Signing scheme used to sign transactions
83
+ */
84
+ readonly signingScheme: SigningScheme;
85
+
86
+ /**
87
+ * The JWT token used to derive the account
88
+ */
89
+ readonly jwt: string;
90
+
91
+ /**
92
+ * An event emitter used to assist in handling asycronous proof fetching.
93
+ */
94
+ private readonly emitter: EventEmitter<ProofFetchEvents>;
95
+
96
+ // Use the static constructor 'create' instead.
97
+ constructor(args: {
98
+ address?: AccountAddress;
99
+ ephemeralKeyPair: EphemeralKeyPair;
100
+ iss: string;
101
+ uidKey: string;
102
+ uidVal: string;
103
+ aud: string;
104
+ pepper: HexInput;
105
+ proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
106
+ proofFetchCallback?: ProofFetchCallback;
107
+ jwt: string;
108
+ }) {
109
+ super();
110
+ const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proof, proofFetchCallback, jwt } = args;
111
+ this.ephemeralKeyPair = ephemeralKeyPair;
112
+ this.publicKey = KeylessPublicKey.create(args);
113
+ this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
114
+ this.uidKey = uidKey;
115
+ this.uidVal = uidVal;
116
+ this.aud = aud;
117
+ this.jwt = jwt;
118
+ this.emitter = new EventEmitter<ProofFetchEvents>();
119
+ this.proofOrPromise = proof;
120
+ if (proof instanceof ZeroKnowledgeSig) {
121
+ this.proof = proof;
122
+ } else {
123
+ if (proofFetchCallback === undefined) {
124
+ throw new Error("Must provide callback for async proof fetch");
125
+ }
126
+ this.emitter.on("proofFetchFinish", async (status) => {
127
+ await proofFetchCallback(status);
128
+ this.emitter.removeAllListeners();
129
+ });
130
+ this.init(proof);
131
+ }
132
+ this.signingScheme = SigningScheme.SingleKey;
133
+ const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
134
+ if (pepperBytes.length !== KeylessAccountCommon.PEPPER_LENGTH) {
135
+ throw new Error(`Pepper length in bytes should be ${KeylessAccountCommon.PEPPER_LENGTH}`);
136
+ }
137
+ this.pepper = pepperBytes;
138
+ }
139
+
140
+ /**
141
+ * This initializes the asyncronous proof fetch
142
+ * @return
143
+ */
144
+ async init(promise: Promise<ZeroKnowledgeSig>) {
145
+ try {
146
+ this.proof = await promise;
147
+ this.emitter.emit("proofFetchFinish", { status: "Success" });
148
+ } catch (error) {
149
+ if (error instanceof Error) {
150
+ this.emitter.emit("proofFetchFinish", { status: "Failed", error: error.toString() });
151
+ } else {
152
+ this.emitter.emit("proofFetchFinish", { status: "Failed", error: "Unknown" });
153
+ }
154
+ }
155
+ }
156
+
157
+ serialize(serializer: Serializer): void {
158
+ serializer.serializeStr(this.jwt);
159
+ serializer.serializeStr(this.uidKey);
160
+ serializer.serializeFixedBytes(this.pepper);
161
+ this.ephemeralKeyPair.serialize(serializer);
162
+ if (this.proof === undefined) {
163
+ throw new Error("Connot serialize - proof undefined");
164
+ }
165
+ this.proof.serialize(serializer);
166
+ }
167
+
168
+ /**
169
+ * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair
170
+ * and JWT token.
171
+ * @return boolean
172
+ */
173
+ isExpired(): boolean {
174
+ return this.ephemeralKeyPair.isExpired();
175
+ }
176
+
177
+ /**
178
+ * Sign a message using Keyless.
179
+ * @param message the message to sign, as binary input
180
+ * @return the AccountAuthenticator containing the signature, together with the account's public key
181
+ */
182
+ signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
183
+ const signature = new AnySignature(this.sign(message));
184
+ const publicKey = new AnyPublicKey(this.publicKey);
185
+ return new AccountAuthenticatorSingleKey(publicKey, signature);
186
+ }
187
+
188
+ /**
189
+ * Sign a transaction using Keyless.
190
+ * @param transaction the raw transaction
191
+ * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
192
+ */
193
+ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
194
+ const signature = new AnySignature(this.signTransaction(transaction));
195
+ const publicKey = new AnyPublicKey(this.publicKey);
196
+ return new AccountAuthenticatorSingleKey(publicKey, signature);
197
+ }
198
+
199
+ /**
200
+ * Waits for asyncronous proof fetching to finish.
201
+ * @return
202
+ */
203
+ async waitForProofFetch() {
204
+ if (this.proofOrPromise instanceof Promise) {
205
+ await this.proofOrPromise;
206
+ }
207
+ }
208
+
209
+ /**
210
+ * Sign the given message using Keyless.
211
+ * @param message in HexInput format
212
+ * @returns Signature
213
+ */
214
+ sign(data: HexInput): KeylessSignature {
215
+ const { expiryDateSecs } = this.ephemeralKeyPair;
216
+ if (this.isExpired()) {
217
+ throw new Error("EphemeralKeyPair is expired");
218
+ }
219
+ if (this.proof === undefined) {
220
+ throw new Error("Proof not defined");
221
+ }
222
+ const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
223
+ const ephemeralSignature = this.ephemeralKeyPair.sign(data);
224
+
225
+ return new KeylessSignature({
226
+ jwtHeader: base64UrlDecode(this.jwt.split(".")[0]),
227
+ ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),
228
+ expiryDateSecs,
229
+ ephemeralPublicKey,
230
+ ephemeralSignature,
231
+ });
232
+ }
233
+
234
+ /**
235
+ * Sign the given transaction with Keyless.
236
+ * Signs the transaction and proof to guard against proof malleability.
237
+ * @param transaction the transaction to be signed
238
+ * @returns KeylessSignature
239
+ */
240
+ signTransaction(transaction: AnyRawTransaction): KeylessSignature {
241
+ if (this.proof === undefined) {
242
+ throw new Error("Proof not found");
243
+ }
244
+ const raw = deriveTransactionType(transaction);
245
+ const txnAndProof = new TransactionAndProof(raw, this.proof.proof);
246
+ const signMess = txnAndProof.hash();
247
+ return this.sign(signMess);
248
+ }
249
+
250
+ /**
251
+ * Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount
252
+ *
253
+ * Verifies a signature given the message.
254
+ *
255
+ * TODO: Groth16 proof verification
256
+ *
257
+ * @param args.message the message that was signed.
258
+ * @param args.signature the KeylessSignature to verify
259
+ * @returns boolean
260
+ */
261
+ verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {
262
+ const { message, signature } = args;
263
+ if (this.isExpired()) {
264
+ return false;
265
+ }
266
+ if (!this.ephemeralKeyPair.getPublicKey().verifySignature({ message, signature: signature.ephemeralSignature })) {
267
+ return false;
268
+ }
269
+ return true;
270
+ }
271
+ }
272
+
273
+ /**
274
+ * A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create
275
+ * the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.
276
+ */
277
+ export class TransactionAndProof extends Serializable {
278
+ /**
279
+ * The transaction to sign.
280
+ */
281
+ transaction: AnyRawTransactionInstance;
282
+
283
+ /**
284
+ * The zero knowledge proof used in signing the transaction.
285
+ */
286
+ proof?: ZkProof;
287
+
288
+ /**
289
+ * The domain separator prefix used when hashing.
290
+ */
291
+ readonly domainSeparator = "APTOS::TransactionAndProof";
292
+
293
+ constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {
294
+ super();
295
+ this.transaction = transaction;
296
+ this.proof = proof;
297
+ }
298
+
299
+ serialize(serializer: Serializer): void {
300
+ serializer.serializeFixedBytes(this.transaction.bcsToBytes());
301
+ serializer.serializeOption(this.proof);
302
+ }
303
+
304
+ /**
305
+ * Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core.
306
+ *
307
+ * @returns Uint8Array
308
+ */
309
+ hash(): Uint8Array {
310
+ return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);
311
+ }
312
+ }
313
+
314
+ export type ProofFetchSuccess = {
315
+ status: "Success";
316
+ };
317
+
318
+ export type ProofFetchFailure = {
319
+ status: "Failed";
320
+ error: string;
321
+ };
322
+
323
+ export type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;
324
+
325
+ export type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;
326
+
327
+ export interface ProofFetchEvents {
328
+ proofFetchFinish: (status: ProofFetchStatus) => void;
329
+ }
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { Account } from "./Account";
5
5
  import { MultiKey, MultiKeySignature, PublicKey } from "../core/crypto";
6
- import { AccountAddress } from "../core/accountAddress";
6
+ import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
7
7
  import { HexInput, SigningScheme } from "../types";
8
8
  import { AccountAuthenticatorMultiKey } from "../transactions/authenticator/account";
9
9
  import { AnyRawTransaction } from "../transactions/types";
@@ -61,13 +61,13 @@ export class MultiKeyAccount implements Account {
61
61
  * @param args.signers an array of M signers that will be used to sign the transaction
62
62
  * @returns MultiKeyAccount
63
63
  */
64
- constructor(args: { multiKey: MultiKey; signers: Account[] }) {
65
- const { multiKey, signers } = args;
64
+ constructor(args: { multiKey: MultiKey; signers: Account[]; address?: AccountAddressInput }) {
65
+ const { multiKey, signers, address } = args;
66
66
 
67
67
  this.publicKey = multiKey;
68
68
  this.signingScheme = SigningScheme.MultiKey;
69
69
 
70
- this.accountAddress = this.publicKey.authKey().derivedAddress();
70
+ this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
71
71
 
72
72
  // Get the index of each respective signer in the bitmap
73
73
  const bitPositions: number[] = [];
@@ -3,4 +3,6 @@ export * from "./Account";
3
3
  export * from "./SingleKeyAccount";
4
4
  export * from "./EphemeralKeyPair";
5
5
  export * from "./KeylessAccount";
6
+ export * from "./KeylessAccountCommon";
7
+ export * from "./FederatedKeylessAccount";
6
8
  export * from "./MultiKeyAccount";