@aptos-labs/ts-sdk 1.31.0 → 1.32.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 (541) hide show
  1. package/README.md +1 -1
  2. package/dist/common/{accountAddress-DnSqjhSl.d.ts → accountAddress-6RqI8Aam.d.ts} +144 -63
  3. package/dist/common/chunk-F43XVDYJ.js +2 -0
  4. package/dist/common/chunk-F43XVDYJ.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +1 -1
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +542 -111
  9. package/dist/common/index.js +36 -29
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/{Ed25519Account-DpH9qAcg.d.mts → Ed25519Account-B3xHXAQe.d.mts} +2 -2
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +86 -14
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +5 -4
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +5 -4
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.d.mts +4 -3
  19. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  20. package/dist/esm/account/FederatedKeylessAccount.d.mts +57 -8
  21. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  22. package/dist/esm/account/KeylessAccount.d.mts +29 -11
  23. package/dist/esm/account/KeylessAccount.mjs +1 -1
  24. package/dist/esm/account/MultiKeyAccount.d.mts +23 -10
  25. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  26. package/dist/esm/account/SingleKeyAccount.d.mts +5 -4
  27. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  28. package/dist/esm/account/index.d.mts +6 -5
  29. package/dist/esm/account/index.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +6 -5
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.d.mts +4 -3
  33. package/dist/esm/api/ans.mjs +1 -1
  34. package/dist/esm/api/aptos.d.mts +6 -4
  35. package/dist/esm/api/aptos.mjs +1 -1
  36. package/dist/esm/api/aptosConfig.d.mts +2 -1
  37. package/dist/esm/api/coin.d.mts +4 -3
  38. package/dist/esm/api/coin.mjs +1 -1
  39. package/dist/esm/api/digitalAsset.d.mts +6 -5
  40. package/dist/esm/api/digitalAsset.mjs +1 -1
  41. package/dist/esm/api/event.d.mts +4 -3
  42. package/dist/esm/api/event.mjs +1 -1
  43. package/dist/esm/api/faucet.d.mts +3 -2
  44. package/dist/esm/api/faucet.mjs +1 -1
  45. package/dist/esm/api/fungibleAsset.d.mts +6 -5
  46. package/dist/esm/api/fungibleAsset.mjs +1 -1
  47. package/dist/esm/api/general.d.mts +4 -3
  48. package/dist/esm/api/general.mjs +1 -1
  49. package/dist/esm/api/index.d.mts +6 -4
  50. package/dist/esm/api/index.mjs +1 -1
  51. package/dist/esm/api/keyless.d.mts +7 -6
  52. package/dist/esm/api/keyless.mjs +1 -1
  53. package/dist/esm/api/object.d.mts +4 -3
  54. package/dist/esm/api/object.mjs +1 -1
  55. package/dist/esm/api/staking.d.mts +4 -3
  56. package/dist/esm/api/staking.mjs +1 -1
  57. package/dist/esm/api/table.d.mts +4 -3
  58. package/dist/esm/api/table.mjs +1 -1
  59. package/dist/esm/api/transaction.d.mts +5 -3
  60. package/dist/esm/api/transaction.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/build.d.mts +69 -3
  62. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/management.d.mts +5 -4
  64. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  65. package/dist/esm/api/transactionSubmission/sign.d.mts +5 -4
  66. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  67. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  68. package/dist/esm/api/transactionSubmission/simulate.d.mts +4 -3
  69. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/submit.d.mts +4 -3
  71. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  72. package/dist/esm/api/utils.d.mts +3 -2
  73. package/dist/esm/api/utils.mjs +1 -1
  74. package/dist/esm/bcs/consts.d.mts +3 -2
  75. package/dist/esm/bcs/deserializer.d.mts +36 -27
  76. package/dist/esm/bcs/deserializer.mjs +1 -1
  77. package/dist/esm/bcs/index.d.mts +3 -2
  78. package/dist/esm/bcs/index.mjs +1 -1
  79. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +3 -2
  80. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  81. package/dist/esm/bcs/serializable/fixedBytes.d.mts +3 -2
  82. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  83. package/dist/esm/bcs/serializable/movePrimitives.d.mts +3 -2
  84. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  85. package/dist/esm/bcs/serializable/moveStructs.d.mts +12 -12
  86. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  87. package/dist/esm/bcs/serializer.d.mts +14 -13
  88. package/dist/esm/bcs/serializer.mjs +1 -1
  89. package/dist/esm/{chunk-4ZK3JNQT.mjs → chunk-2NHQQQZK.mjs} +2 -2
  90. package/dist/esm/{chunk-MSHZ4FWB.mjs → chunk-2QBCTW67.mjs} +2 -2
  91. package/dist/esm/{chunk-MSHZ4FWB.mjs.map → chunk-2QBCTW67.mjs.map} +1 -1
  92. package/dist/esm/{chunk-F2RY4YQ7.mjs → chunk-37Y54PJ5.mjs} +2 -2
  93. package/dist/esm/chunk-3DQVGPFE.mjs +2 -0
  94. package/dist/esm/chunk-3DQVGPFE.mjs.map +1 -0
  95. package/dist/esm/{chunk-OAEDFM7T.mjs → chunk-3XCYCFYI.mjs} +2 -2
  96. package/dist/esm/{chunk-6FLHGOKP.mjs → chunk-42H7WETG.mjs} +2 -2
  97. package/dist/esm/{chunk-AZ6LVQEG.mjs → chunk-46L6BAJG.mjs} +2 -2
  98. package/dist/esm/{chunk-KW4FVBDD.mjs → chunk-4DNCQM3S.mjs} +2 -2
  99. package/dist/esm/chunk-4O5XDQDO.mjs +2 -0
  100. package/dist/esm/chunk-4PBXTMN3.mjs +2 -0
  101. package/dist/esm/chunk-4PBXTMN3.mjs.map +1 -0
  102. package/dist/esm/chunk-4YEOOZ2N.mjs +4 -0
  103. package/dist/esm/{chunk-HM5HITUC.mjs.map → chunk-4YEOOZ2N.mjs.map} +1 -1
  104. package/dist/esm/{chunk-5N6KJ7KS.mjs → chunk-5AKSORBJ.mjs} +2 -2
  105. package/dist/esm/chunk-5B3SMBXQ.mjs +2 -0
  106. package/dist/esm/{chunk-UCRROMZN.mjs → chunk-5NJWJXSS.mjs} +2 -2
  107. package/dist/esm/{chunk-CL6EEMSL.mjs → chunk-6K4TOFCO.mjs} +2 -2
  108. package/dist/esm/{chunk-RNJHULIT.mjs → chunk-6LLGRGCN.mjs} +2 -2
  109. package/dist/esm/chunk-6LLGRGCN.mjs.map +1 -0
  110. package/dist/esm/{chunk-IAVI3H4V.mjs → chunk-6PJH53CK.mjs} +2 -2
  111. package/dist/esm/{chunk-PCLU4KLY.mjs → chunk-6ZOVTYLJ.mjs} +2 -2
  112. package/dist/esm/chunk-7ECCT6PK.mjs +1 -0
  113. package/dist/esm/chunk-7WXDXBXK.mjs +2 -0
  114. package/dist/esm/{chunk-WV2VJQDS.mjs.map → chunk-7WXDXBXK.mjs.map} +1 -1
  115. package/dist/esm/{chunk-RAJTNQNL.mjs → chunk-AAATWCJT.mjs} +2 -2
  116. package/dist/esm/{chunk-NODYW7DM.mjs → chunk-ACVIE7IE.mjs} +2 -2
  117. package/dist/esm/chunk-AHWZA3GD.mjs +2 -0
  118. package/dist/esm/chunk-AHWZA3GD.mjs.map +1 -0
  119. package/dist/esm/{chunk-QQIVWB6G.mjs → chunk-AJ5JHBAE.mjs} +2 -2
  120. package/dist/esm/{chunk-QQIVWB6G.mjs.map → chunk-AJ5JHBAE.mjs.map} +1 -1
  121. package/dist/esm/{chunk-PRZ7AIGA.mjs → chunk-AKIO3OIT.mjs} +2 -2
  122. package/dist/esm/chunk-AMCJQIOT.mjs +2 -0
  123. package/dist/esm/{chunk-2CGJLPHP.mjs.map → chunk-AMCJQIOT.mjs.map} +1 -1
  124. package/dist/esm/{chunk-KRVLR3L4.mjs → chunk-AOROYJ74.mjs} +2 -2
  125. package/dist/esm/chunk-AVPQOD67.mjs +2 -0
  126. package/dist/esm/chunk-AVPQOD67.mjs.map +1 -0
  127. package/dist/esm/chunk-AVZYJAXR.mjs +2 -0
  128. package/dist/esm/chunk-AVZYJAXR.mjs.map +1 -0
  129. package/dist/esm/{chunk-6DMDYBV6.mjs → chunk-BLLHTGAP.mjs} +2 -2
  130. package/dist/esm/{chunk-JGNMNCQB.mjs → chunk-BRV3RLKW.mjs} +2 -2
  131. package/dist/esm/{chunk-7JK7UG4E.mjs → chunk-CA3Q2X6B.mjs} +2 -2
  132. package/dist/esm/chunk-D52UKPQF.mjs +2 -0
  133. package/dist/esm/chunk-D52UKPQF.mjs.map +1 -0
  134. package/dist/esm/{chunk-SOLWFAUY.mjs → chunk-DDVOBEJA.mjs} +2 -2
  135. package/dist/esm/chunk-DDVOBEJA.mjs.map +1 -0
  136. package/dist/esm/{chunk-RNRNGJDA.mjs → chunk-DP3YPGIK.mjs} +2 -2
  137. package/dist/esm/{chunk-KYJU5PWF.mjs → chunk-DSKAMBBL.mjs} +2 -2
  138. package/dist/esm/{chunk-L5J3V3HW.mjs → chunk-E2NYQVP3.mjs} +2 -2
  139. package/dist/esm/chunk-EEB7EZFO.mjs +2 -0
  140. package/dist/esm/chunk-EEB7EZFO.mjs.map +1 -0
  141. package/dist/esm/{chunk-4JXB6V5O.mjs → chunk-F2AIWA7L.mjs} +2 -2
  142. package/dist/esm/chunk-F45G3GP3.mjs +7 -0
  143. package/dist/esm/chunk-F45G3GP3.mjs.map +1 -0
  144. package/dist/esm/{chunk-WSZCPSV4.mjs → chunk-FXUI3SSD.mjs} +2 -2
  145. package/dist/esm/chunk-G2GN4LH5.mjs +2 -0
  146. package/dist/esm/chunk-G2GN4LH5.mjs.map +1 -0
  147. package/dist/esm/chunk-GBVRCWCD.mjs +2 -0
  148. package/dist/esm/chunk-GBVRCWCD.mjs.map +1 -0
  149. package/dist/esm/chunk-H457BI3I.mjs +2 -0
  150. package/dist/esm/chunk-H457BI3I.mjs.map +1 -0
  151. package/dist/esm/{chunk-A2AEFKXS.mjs → chunk-HEHVWRMO.mjs} +2 -2
  152. package/dist/esm/{chunk-UGL2GPGK.mjs → chunk-HFWFDS6Y.mjs} +2 -2
  153. package/dist/esm/{chunk-OXM4BVAY.mjs → chunk-HXXELLHN.mjs} +2 -2
  154. package/dist/esm/{chunk-RBJNSUSU.mjs → chunk-IBMZYDAR.mjs} +2 -2
  155. package/dist/esm/{chunk-AT2ZGTXQ.mjs → chunk-IDNDUJOK.mjs} +2 -2
  156. package/dist/esm/{chunk-3H5DGQKX.mjs → chunk-II654QZU.mjs} +2 -2
  157. package/dist/esm/{chunk-JNRMHDRA.mjs → chunk-JDNI5VIJ.mjs} +2 -2
  158. package/dist/esm/{chunk-73GCGRFW.mjs → chunk-JJUINAQE.mjs} +2 -2
  159. package/dist/esm/{chunk-VYMRIKUV.mjs → chunk-JLD7DLKM.mjs} +2 -2
  160. package/dist/esm/chunk-JNO7KPMG.mjs +4 -0
  161. package/dist/esm/chunk-JNO7KPMG.mjs.map +1 -0
  162. package/dist/esm/chunk-K4TJRYGQ.mjs +2 -0
  163. package/dist/esm/chunk-K4TJRYGQ.mjs.map +1 -0
  164. package/dist/esm/{chunk-XFJD6QIP.mjs → chunk-KA5FX53Q.mjs} +2 -2
  165. package/dist/esm/{chunk-2GEIHUHT.mjs → chunk-KT3DT5GV.mjs} +2 -2
  166. package/dist/esm/chunk-KT3DT5GV.mjs.map +1 -0
  167. package/dist/esm/chunk-KUL55M2H.mjs +2 -0
  168. package/dist/esm/chunk-KUL55M2H.mjs.map +1 -0
  169. package/dist/esm/{chunk-ZPIMARUG.mjs → chunk-L2QVUMBV.mjs} +2 -2
  170. package/dist/esm/chunk-L2SDI7PI.mjs +2 -0
  171. package/dist/esm/chunk-L2SDI7PI.mjs.map +1 -0
  172. package/dist/esm/chunk-L56DQ4N3.mjs +2 -0
  173. package/dist/esm/chunk-L56DQ4N3.mjs.map +1 -0
  174. package/dist/esm/{chunk-TPJLAYW6.mjs → chunk-LAAFLCDM.mjs} +2 -2
  175. package/dist/esm/{chunk-AGBA3Y7A.mjs → chunk-LGTOOAQI.mjs} +2 -2
  176. package/dist/esm/chunk-MHN6XY4Z.mjs +2 -0
  177. package/dist/esm/{chunk-JVTDP4KV.mjs → chunk-MOGPSSTD.mjs} +2 -2
  178. package/dist/esm/{chunk-WZCKSN2U.mjs → chunk-NARS3JDH.mjs} +2 -2
  179. package/dist/esm/{chunk-YZ5BCOGI.mjs → chunk-NHKAQRJB.mjs} +2 -2
  180. package/dist/esm/{chunk-PHP47DI4.mjs → chunk-OIOGOW6I.mjs} +1 -1
  181. package/dist/esm/{chunk-PHP47DI4.mjs.map → chunk-OIOGOW6I.mjs.map} +1 -1
  182. package/dist/esm/{chunk-T5BCTWGK.mjs → chunk-OJBMR5CT.mjs} +2 -2
  183. package/dist/esm/chunk-OJBMR5CT.mjs.map +1 -0
  184. package/dist/esm/{chunk-LDZPO76C.mjs → chunk-OKE3FXIP.mjs} +2 -2
  185. package/dist/esm/chunk-ONFKJ57C.mjs +2 -0
  186. package/dist/esm/chunk-ONFKJ57C.mjs.map +1 -0
  187. package/dist/esm/{chunk-ZINOJTLU.mjs → chunk-OPO5EYF7.mjs} +2 -2
  188. package/dist/esm/{chunk-BVVHGSWC.mjs → chunk-PW3ISXPN.mjs} +2 -2
  189. package/dist/esm/{chunk-CC7VOPYH.mjs → chunk-QQM47PHZ.mjs} +2 -2
  190. package/dist/esm/{chunk-EUGLLGYW.mjs → chunk-SBCLBDCP.mjs} +2 -2
  191. package/dist/esm/chunk-SPRNSFUV.mjs +2 -0
  192. package/dist/esm/chunk-SPRNSFUV.mjs.map +1 -0
  193. package/dist/esm/{chunk-EE7GDBA5.mjs → chunk-SU2WB34N.mjs} +2 -2
  194. package/dist/esm/{chunk-OTY3NO7Q.mjs → chunk-T6ADNZE5.mjs} +2 -2
  195. package/dist/esm/{chunk-IECDO22V.mjs → chunk-TM7OZT3W.mjs} +2 -2
  196. package/dist/esm/chunk-TM7OZT3W.mjs.map +1 -0
  197. package/dist/esm/chunk-UGTIALNW.mjs +2 -0
  198. package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
  199. package/dist/esm/chunk-UZTJWOLS.mjs +2 -0
  200. package/dist/esm/chunk-V4FKFCBL.mjs +2 -0
  201. package/dist/esm/chunk-V4FKFCBL.mjs.map +1 -0
  202. package/dist/esm/{chunk-ZPQUCT22.mjs → chunk-VCY3JGZM.mjs} +2 -2
  203. package/dist/esm/{chunk-XOCRDV2V.mjs → chunk-VQZMI3EZ.mjs} +2 -2
  204. package/dist/esm/chunk-WGIYSLH6.mjs +2 -0
  205. package/dist/esm/chunk-WGIYSLH6.mjs.map +1 -0
  206. package/dist/esm/{chunk-2652SPOM.mjs → chunk-WKNX43KN.mjs} +2 -2
  207. package/dist/esm/chunk-WKNX43KN.mjs.map +1 -0
  208. package/dist/esm/chunk-WQF3IOXC.mjs +2 -0
  209. package/dist/esm/chunk-WQF3IOXC.mjs.map +1 -0
  210. package/dist/esm/{chunk-IFXUWUP2.mjs → chunk-WSFHH3BK.mjs} +2 -2
  211. package/dist/esm/{chunk-4LKLOUMG.mjs → chunk-X3JPX7T6.mjs} +2 -2
  212. package/dist/esm/{chunk-22ZSW5EN.mjs → chunk-XKOSS5KC.mjs} +2 -2
  213. package/dist/esm/{chunk-BG2TZI3H.mjs → chunk-XT5T5LAP.mjs} +2 -2
  214. package/dist/esm/chunk-XUP6VABV.mjs +2 -0
  215. package/dist/esm/chunk-XUP6VABV.mjs.map +1 -0
  216. package/dist/esm/{chunk-XQ7ONNII.mjs → chunk-YNT7JHMS.mjs} +2 -2
  217. package/dist/esm/{chunk-BOWPP6YG.mjs → chunk-YPBNYKOD.mjs} +2 -2
  218. package/dist/esm/{chunk-MK2QAHXC.mjs → chunk-YZ3YPLEU.mjs} +2 -2
  219. package/dist/esm/{chunk-OZN3OOJV.mjs → chunk-ZMBXHMVQ.mjs} +2 -2
  220. package/dist/esm/{chunk-XFY4O2S3.mjs → chunk-ZRWZIAF5.mjs} +2 -2
  221. package/dist/esm/cli/index.d.mts +3 -2
  222. package/dist/esm/cli/index.mjs +1 -1
  223. package/dist/esm/cli/localNode.mjs +1 -1
  224. package/dist/esm/cli/move.d.mts +2 -1
  225. package/dist/esm/client/core.d.mts +2 -2
  226. package/dist/esm/client/core.mjs +1 -1
  227. package/dist/esm/client/get.d.mts +2 -2
  228. package/dist/esm/client/get.mjs +1 -1
  229. package/dist/esm/client/index.d.mts +3 -3
  230. package/dist/esm/client/index.mjs +1 -1
  231. package/dist/esm/client/post.d.mts +2 -2
  232. package/dist/esm/client/post.mjs +1 -1
  233. package/dist/esm/core/account/index.d.mts +3 -2
  234. package/dist/esm/core/account/index.mjs +1 -1
  235. package/dist/esm/core/account/utils/address.d.mts +3 -2
  236. package/dist/esm/core/account/utils/address.mjs +1 -1
  237. package/dist/esm/core/account/utils/index.d.mts +3 -2
  238. package/dist/esm/core/account/utils/index.mjs +1 -1
  239. package/dist/esm/core/accountAddress.d.mts +20 -10
  240. package/dist/esm/core/accountAddress.mjs +1 -1
  241. package/dist/esm/core/authenticationKey.d.mts +4 -3
  242. package/dist/esm/core/authenticationKey.mjs +1 -1
  243. package/dist/esm/core/crypto/ed25519.d.mts +27 -12
  244. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  245. package/dist/esm/core/crypto/ephemeral.d.mts +4 -3
  246. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  247. package/dist/esm/core/crypto/federatedKeyless.d.mts +5 -4
  248. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  249. package/dist/esm/core/crypto/hdKey.d.mts +0 -1
  250. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  251. package/dist/esm/core/crypto/index.d.mts +5 -4
  252. package/dist/esm/core/crypto/index.mjs +1 -1
  253. package/dist/esm/core/crypto/keyless.d.mts +73 -11
  254. package/dist/esm/core/crypto/keyless.mjs +1 -1
  255. package/dist/esm/core/crypto/multiEd25519.d.mts +4 -3
  256. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  257. package/dist/esm/core/crypto/multiKey.d.mts +4 -3
  258. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  259. package/dist/esm/core/crypto/privateKey.d.mts +38 -10
  260. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  261. package/dist/esm/core/crypto/proof.d.mts +3 -2
  262. package/dist/esm/core/crypto/proof.mjs +1 -1
  263. package/dist/esm/core/crypto/publicKey.d.mts +4 -3
  264. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  265. package/dist/esm/core/crypto/secp256k1.d.mts +24 -9
  266. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  267. package/dist/esm/core/crypto/signature.d.mts +3 -2
  268. package/dist/esm/core/crypto/signature.mjs +1 -1
  269. package/dist/esm/core/crypto/singleKey.d.mts +4 -3
  270. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  271. package/dist/esm/core/crypto/utils.d.mts +3 -2
  272. package/dist/esm/core/crypto/utils.mjs +1 -1
  273. package/dist/esm/core/hex.d.mts +40 -3
  274. package/dist/esm/core/hex.mjs +1 -1
  275. package/dist/esm/core/index.d.mts +6 -5
  276. package/dist/esm/core/index.mjs +1 -1
  277. package/dist/esm/errors/index.d.mts +123 -0
  278. package/dist/esm/errors/index.mjs +2 -0
  279. package/dist/esm/index.d.mts +13 -11
  280. package/dist/esm/index.mjs +1 -1
  281. package/dist/esm/internal/account.d.mts +5 -4
  282. package/dist/esm/internal/account.mjs +1 -1
  283. package/dist/esm/internal/ans.d.mts +5 -4
  284. package/dist/esm/internal/ans.mjs +1 -1
  285. package/dist/esm/internal/coin.d.mts +3 -2
  286. package/dist/esm/internal/coin.mjs +1 -1
  287. package/dist/esm/internal/digitalAsset.d.mts +5 -4
  288. package/dist/esm/internal/digitalAsset.mjs +1 -1
  289. package/dist/esm/internal/event.d.mts +3 -2
  290. package/dist/esm/internal/event.mjs +1 -1
  291. package/dist/esm/internal/faucet.d.mts +2 -1
  292. package/dist/esm/internal/faucet.mjs +1 -1
  293. package/dist/esm/internal/fungibleAsset.d.mts +5 -4
  294. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  295. package/dist/esm/internal/general.d.mts +3 -2
  296. package/dist/esm/internal/general.mjs +1 -1
  297. package/dist/esm/internal/keyless.d.mts +10 -5
  298. package/dist/esm/internal/keyless.mjs +1 -1
  299. package/dist/esm/internal/object.d.mts +3 -2
  300. package/dist/esm/internal/object.mjs +1 -1
  301. package/dist/esm/internal/staking.d.mts +2 -1
  302. package/dist/esm/internal/staking.mjs +1 -1
  303. package/dist/esm/internal/table.d.mts +3 -2
  304. package/dist/esm/internal/table.mjs +1 -1
  305. package/dist/esm/internal/transaction.d.mts +2 -1
  306. package/dist/esm/internal/transaction.mjs +1 -1
  307. package/dist/esm/internal/transactionSubmission.d.mts +4 -3
  308. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  309. package/dist/esm/internal/view.d.mts +4 -3
  310. package/dist/esm/internal/view.mjs +1 -1
  311. package/dist/esm/{publicKey-_tPa99ea.d.mts → publicKey-BVXX1nVl.d.mts} +2 -2
  312. package/dist/esm/transactions/authenticator/account.d.mts +4 -3
  313. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  314. package/dist/esm/transactions/authenticator/index.d.mts +4 -3
  315. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  316. package/dist/esm/transactions/authenticator/transaction.d.mts +10 -4
  317. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  318. package/dist/esm/transactions/index.d.mts +7 -5
  319. package/dist/esm/transactions/index.mjs +1 -1
  320. package/dist/esm/transactions/instances/chainId.d.mts +3 -2
  321. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  322. package/dist/esm/transactions/instances/identifier.d.mts +3 -2
  323. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  324. package/dist/esm/transactions/instances/index.d.mts +4 -3
  325. package/dist/esm/transactions/instances/index.mjs +1 -1
  326. package/dist/esm/transactions/instances/moduleId.d.mts +3 -2
  327. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  328. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +3 -2
  329. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  330. package/dist/esm/transactions/instances/rawTransaction.d.mts +3 -2
  331. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  332. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +4 -3
  333. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  334. package/dist/esm/transactions/instances/signedTransaction.d.mts +4 -3
  335. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  336. package/dist/esm/transactions/instances/simpleTransaction.d.mts +3 -2
  337. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  338. package/dist/esm/transactions/instances/transactionArgument.d.mts +3 -2
  339. package/dist/esm/transactions/instances/transactionPayload.d.mts +3 -2
  340. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  341. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +5 -4
  342. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  343. package/dist/esm/transactions/management/index.d.mts +5 -4
  344. package/dist/esm/transactions/management/index.mjs +1 -1
  345. package/dist/esm/transactions/management/transactionWorker.d.mts +5 -4
  346. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  347. package/dist/esm/transactions/script-composer/index.d.mts +44 -0
  348. package/dist/esm/transactions/script-composer/index.mjs +2 -0
  349. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -2
  350. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  351. package/dist/esm/transactions/transactionBuilder/index.d.mts +5 -4
  352. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  353. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +26 -5
  354. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  355. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -3
  356. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  357. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +4 -3
  358. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  359. package/dist/esm/transactions/typeTag/index.d.mts +3 -2
  360. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  361. package/dist/esm/transactions/typeTag/parser.d.mts +3 -2
  362. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  363. package/dist/esm/transactions/types.d.mts +12 -3
  364. package/dist/esm/types/index.d.mts +4 -1260
  365. package/dist/esm/types/index.mjs +1 -1
  366. package/dist/esm/types/keyless.d.mts +22 -1
  367. package/dist/esm/types/types.d.mts +1290 -0
  368. package/dist/esm/types/types.mjs +2 -0
  369. package/dist/esm/types/types.mjs.map +1 -0
  370. package/dist/esm/utils/helpers.d.mts +11 -3
  371. package/dist/esm/utils/helpers.mjs +1 -1
  372. package/dist/esm/utils/index.d.mts +3 -2
  373. package/dist/esm/utils/index.mjs +1 -1
  374. package/dist/esm/utils/normalizeBundle.d.mts +3 -2
  375. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  376. package/dist/esm/version.d.mts +1 -1
  377. package/dist/esm/version.mjs +1 -1
  378. package/package.json +2 -1
  379. package/src/account/AbstractKeylessAccount.ts +203 -10
  380. package/src/account/FederatedKeylessAccount.ts +83 -35
  381. package/src/account/KeylessAccount.ts +44 -37
  382. package/src/account/MultiKeyAccount.ts +18 -5
  383. package/src/api/keyless.ts +2 -2
  384. package/src/api/transactionSubmission/build.ts +82 -1
  385. package/src/bcs/deserializer.ts +53 -30
  386. package/src/bcs/serializable/moveStructs.ts +16 -17
  387. package/src/bcs/serializer.ts +22 -12
  388. package/src/client/core.ts +2 -2
  389. package/src/client/get.ts +1 -2
  390. package/src/client/index.ts +0 -1
  391. package/src/client/post.ts +1 -2
  392. package/src/core/accountAddress.ts +36 -9
  393. package/src/core/crypto/ed25519.ts +34 -14
  394. package/src/core/crypto/hdKey.ts +0 -1
  395. package/src/core/crypto/keyless.ts +245 -38
  396. package/src/core/crypto/privateKey.ts +81 -5
  397. package/src/core/crypto/secp256k1.ts +31 -11
  398. package/src/core/hex.ts +47 -0
  399. package/src/errors/index.ts +406 -0
  400. package/src/index.ts +1 -0
  401. package/src/internal/account.ts +6 -6
  402. package/src/internal/ans.ts +2 -1
  403. package/src/internal/keyless.ts +46 -18
  404. package/src/internal/transaction.ts +2 -1
  405. package/src/internal/transactionSubmission.ts +36 -18
  406. package/src/transactions/authenticator/transaction.ts +20 -0
  407. package/src/transactions/index.ts +1 -0
  408. package/src/transactions/script-composer/index.ts +76 -0
  409. package/src/transactions/transactionBuilder/remoteAbi.ts +55 -1
  410. package/src/transactions/types.ts +11 -0
  411. package/src/types/index.ts +2 -1483
  412. package/src/types/keyless.ts +19 -0
  413. package/src/types/types.ts +1512 -0
  414. package/src/utils/helpers.ts +10 -0
  415. package/src/version.ts +1 -1
  416. package/dist/common/chunk-7IYTZDXV.js +0 -2
  417. package/dist/common/chunk-7IYTZDXV.js.map +0 -1
  418. package/dist/esm/chunk-2652SPOM.mjs.map +0 -1
  419. package/dist/esm/chunk-2CGJLPHP.mjs +0 -2
  420. package/dist/esm/chunk-2GEIHUHT.mjs.map +0 -1
  421. package/dist/esm/chunk-4CDDWSKZ.mjs +0 -2
  422. package/dist/esm/chunk-4OV7QU2U.mjs +0 -2
  423. package/dist/esm/chunk-4VU2ABLU.mjs +0 -2
  424. package/dist/esm/chunk-4VU2ABLU.mjs.map +0 -1
  425. package/dist/esm/chunk-5S3Z7MT4.mjs +0 -2
  426. package/dist/esm/chunk-5S3Z7MT4.mjs.map +0 -1
  427. package/dist/esm/chunk-5SGSPCOY.mjs +0 -2
  428. package/dist/esm/chunk-5SGSPCOY.mjs.map +0 -1
  429. package/dist/esm/chunk-7XS45O6M.mjs +0 -2
  430. package/dist/esm/chunk-7XS45O6M.mjs.map +0 -1
  431. package/dist/esm/chunk-BAGUHYFD.mjs +0 -2
  432. package/dist/esm/chunk-BAGUHYFD.mjs.map +0 -1
  433. package/dist/esm/chunk-CDQGPCHU.mjs +0 -2
  434. package/dist/esm/chunk-CDQGPCHU.mjs.map +0 -1
  435. package/dist/esm/chunk-DMSHPWA5.mjs +0 -2
  436. package/dist/esm/chunk-DMSHPWA5.mjs.map +0 -1
  437. package/dist/esm/chunk-FTZGP6XW.mjs +0 -2
  438. package/dist/esm/chunk-FTZGP6XW.mjs.map +0 -1
  439. package/dist/esm/chunk-GLATLXF6.mjs +0 -2
  440. package/dist/esm/chunk-GLATLXF6.mjs.map +0 -1
  441. package/dist/esm/chunk-GQABU3RQ.mjs +0 -2
  442. package/dist/esm/chunk-GQABU3RQ.mjs.map +0 -1
  443. package/dist/esm/chunk-HM5HITUC.mjs +0 -4
  444. package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
  445. package/dist/esm/chunk-IBLZ6MZU.mjs +0 -2
  446. package/dist/esm/chunk-IECDO22V.mjs.map +0 -1
  447. package/dist/esm/chunk-JN36BNWA.mjs +0 -2
  448. package/dist/esm/chunk-JN36BNWA.mjs.map +0 -1
  449. package/dist/esm/chunk-KFNDDPOW.mjs +0 -2
  450. package/dist/esm/chunk-KFNDDPOW.mjs.map +0 -1
  451. package/dist/esm/chunk-KIW54KWR.mjs +0 -2
  452. package/dist/esm/chunk-KM6UXNC7.mjs +0 -2
  453. package/dist/esm/chunk-KM6UXNC7.mjs.map +0 -1
  454. package/dist/esm/chunk-KUX6GQ2E.mjs +0 -1
  455. package/dist/esm/chunk-LEKBJ2EG.mjs +0 -2
  456. package/dist/esm/chunk-LEKBJ2EG.mjs.map +0 -1
  457. package/dist/esm/chunk-M22UGFQ5.mjs +0 -2
  458. package/dist/esm/chunk-M22UGFQ5.mjs.map +0 -1
  459. package/dist/esm/chunk-N2FKVZ4D.mjs +0 -1
  460. package/dist/esm/chunk-N47FTRYO.mjs +0 -2
  461. package/dist/esm/chunk-N47FTRYO.mjs.map +0 -1
  462. package/dist/esm/chunk-ONBFUPEC.mjs +0 -2
  463. package/dist/esm/chunk-P3J54CQG.mjs +0 -2
  464. package/dist/esm/chunk-P3J54CQG.mjs.map +0 -1
  465. package/dist/esm/chunk-RNJHULIT.mjs.map +0 -1
  466. package/dist/esm/chunk-SGQFWWLQ.mjs +0 -2
  467. package/dist/esm/chunk-SGQFWWLQ.mjs.map +0 -1
  468. package/dist/esm/chunk-SOLWFAUY.mjs.map +0 -1
  469. package/dist/esm/chunk-T5BCTWGK.mjs.map +0 -1
  470. package/dist/esm/chunk-WV2VJQDS.mjs +0 -2
  471. package/dist/esm/chunk-Y267I7DC.mjs +0 -2
  472. package/dist/esm/chunk-Y267I7DC.mjs.map +0 -1
  473. package/dist/esm/client/types.d.mts +0 -66
  474. package/dist/esm/client/types.mjs +0 -2
  475. package/src/client/types.ts +0 -138
  476. /package/dist/esm/{chunk-4ZK3JNQT.mjs.map → chunk-2NHQQQZK.mjs.map} +0 -0
  477. /package/dist/esm/{chunk-F2RY4YQ7.mjs.map → chunk-37Y54PJ5.mjs.map} +0 -0
  478. /package/dist/esm/{chunk-OAEDFM7T.mjs.map → chunk-3XCYCFYI.mjs.map} +0 -0
  479. /package/dist/esm/{chunk-6FLHGOKP.mjs.map → chunk-42H7WETG.mjs.map} +0 -0
  480. /package/dist/esm/{chunk-AZ6LVQEG.mjs.map → chunk-46L6BAJG.mjs.map} +0 -0
  481. /package/dist/esm/{chunk-KW4FVBDD.mjs.map → chunk-4DNCQM3S.mjs.map} +0 -0
  482. /package/dist/esm/{chunk-IBLZ6MZU.mjs.map → chunk-4O5XDQDO.mjs.map} +0 -0
  483. /package/dist/esm/{chunk-5N6KJ7KS.mjs.map → chunk-5AKSORBJ.mjs.map} +0 -0
  484. /package/dist/esm/{chunk-KIW54KWR.mjs.map → chunk-5B3SMBXQ.mjs.map} +0 -0
  485. /package/dist/esm/{chunk-UCRROMZN.mjs.map → chunk-5NJWJXSS.mjs.map} +0 -0
  486. /package/dist/esm/{chunk-CL6EEMSL.mjs.map → chunk-6K4TOFCO.mjs.map} +0 -0
  487. /package/dist/esm/{chunk-IAVI3H4V.mjs.map → chunk-6PJH53CK.mjs.map} +0 -0
  488. /package/dist/esm/{chunk-PCLU4KLY.mjs.map → chunk-6ZOVTYLJ.mjs.map} +0 -0
  489. /package/dist/esm/{chunk-I5OYNCZS.mjs.map → chunk-7ECCT6PK.mjs.map} +0 -0
  490. /package/dist/esm/{chunk-RAJTNQNL.mjs.map → chunk-AAATWCJT.mjs.map} +0 -0
  491. /package/dist/esm/{chunk-NODYW7DM.mjs.map → chunk-ACVIE7IE.mjs.map} +0 -0
  492. /package/dist/esm/{chunk-PRZ7AIGA.mjs.map → chunk-AKIO3OIT.mjs.map} +0 -0
  493. /package/dist/esm/{chunk-KRVLR3L4.mjs.map → chunk-AOROYJ74.mjs.map} +0 -0
  494. /package/dist/esm/{chunk-6DMDYBV6.mjs.map → chunk-BLLHTGAP.mjs.map} +0 -0
  495. /package/dist/esm/{chunk-JGNMNCQB.mjs.map → chunk-BRV3RLKW.mjs.map} +0 -0
  496. /package/dist/esm/{chunk-7JK7UG4E.mjs.map → chunk-CA3Q2X6B.mjs.map} +0 -0
  497. /package/dist/esm/{chunk-RNRNGJDA.mjs.map → chunk-DP3YPGIK.mjs.map} +0 -0
  498. /package/dist/esm/{chunk-KYJU5PWF.mjs.map → chunk-DSKAMBBL.mjs.map} +0 -0
  499. /package/dist/esm/{chunk-L5J3V3HW.mjs.map → chunk-E2NYQVP3.mjs.map} +0 -0
  500. /package/dist/esm/{chunk-4JXB6V5O.mjs.map → chunk-F2AIWA7L.mjs.map} +0 -0
  501. /package/dist/esm/{chunk-WSZCPSV4.mjs.map → chunk-FXUI3SSD.mjs.map} +0 -0
  502. /package/dist/esm/{chunk-A2AEFKXS.mjs.map → chunk-HEHVWRMO.mjs.map} +0 -0
  503. /package/dist/esm/{chunk-UGL2GPGK.mjs.map → chunk-HFWFDS6Y.mjs.map} +0 -0
  504. /package/dist/esm/{chunk-OXM4BVAY.mjs.map → chunk-HXXELLHN.mjs.map} +0 -0
  505. /package/dist/esm/{chunk-RBJNSUSU.mjs.map → chunk-IBMZYDAR.mjs.map} +0 -0
  506. /package/dist/esm/{chunk-AT2ZGTXQ.mjs.map → chunk-IDNDUJOK.mjs.map} +0 -0
  507. /package/dist/esm/{chunk-3H5DGQKX.mjs.map → chunk-II654QZU.mjs.map} +0 -0
  508. /package/dist/esm/{chunk-JNRMHDRA.mjs.map → chunk-JDNI5VIJ.mjs.map} +0 -0
  509. /package/dist/esm/{chunk-73GCGRFW.mjs.map → chunk-JJUINAQE.mjs.map} +0 -0
  510. /package/dist/esm/{chunk-VYMRIKUV.mjs.map → chunk-JLD7DLKM.mjs.map} +0 -0
  511. /package/dist/esm/{chunk-XFJD6QIP.mjs.map → chunk-KA5FX53Q.mjs.map} +0 -0
  512. /package/dist/esm/{chunk-ZPIMARUG.mjs.map → chunk-L2QVUMBV.mjs.map} +0 -0
  513. /package/dist/esm/{chunk-TPJLAYW6.mjs.map → chunk-LAAFLCDM.mjs.map} +0 -0
  514. /package/dist/esm/{chunk-AGBA3Y7A.mjs.map → chunk-LGTOOAQI.mjs.map} +0 -0
  515. /package/dist/esm/{chunk-4OV7QU2U.mjs.map → chunk-MHN6XY4Z.mjs.map} +0 -0
  516. /package/dist/esm/{chunk-JVTDP4KV.mjs.map → chunk-MOGPSSTD.mjs.map} +0 -0
  517. /package/dist/esm/{chunk-WZCKSN2U.mjs.map → chunk-NARS3JDH.mjs.map} +0 -0
  518. /package/dist/esm/{chunk-YZ5BCOGI.mjs.map → chunk-NHKAQRJB.mjs.map} +0 -0
  519. /package/dist/esm/{chunk-LDZPO76C.mjs.map → chunk-OKE3FXIP.mjs.map} +0 -0
  520. /package/dist/esm/{chunk-ZINOJTLU.mjs.map → chunk-OPO5EYF7.mjs.map} +0 -0
  521. /package/dist/esm/{chunk-BVVHGSWC.mjs.map → chunk-PW3ISXPN.mjs.map} +0 -0
  522. /package/dist/esm/{chunk-CC7VOPYH.mjs.map → chunk-QQM47PHZ.mjs.map} +0 -0
  523. /package/dist/esm/{chunk-EUGLLGYW.mjs.map → chunk-SBCLBDCP.mjs.map} +0 -0
  524. /package/dist/esm/{chunk-EE7GDBA5.mjs.map → chunk-SU2WB34N.mjs.map} +0 -0
  525. /package/dist/esm/{chunk-OTY3NO7Q.mjs.map → chunk-T6ADNZE5.mjs.map} +0 -0
  526. /package/dist/esm/{chunk-ONBFUPEC.mjs.map → chunk-UGTIALNW.mjs.map} +0 -0
  527. /package/dist/esm/{chunk-KUX6GQ2E.mjs.map → chunk-UIRAXHDH.mjs.map} +0 -0
  528. /package/dist/esm/{chunk-4CDDWSKZ.mjs.map → chunk-UZTJWOLS.mjs.map} +0 -0
  529. /package/dist/esm/{chunk-ZPQUCT22.mjs.map → chunk-VCY3JGZM.mjs.map} +0 -0
  530. /package/dist/esm/{chunk-XOCRDV2V.mjs.map → chunk-VQZMI3EZ.mjs.map} +0 -0
  531. /package/dist/esm/{chunk-IFXUWUP2.mjs.map → chunk-WSFHH3BK.mjs.map} +0 -0
  532. /package/dist/esm/{chunk-4LKLOUMG.mjs.map → chunk-X3JPX7T6.mjs.map} +0 -0
  533. /package/dist/esm/{chunk-22ZSW5EN.mjs.map → chunk-XKOSS5KC.mjs.map} +0 -0
  534. /package/dist/esm/{chunk-BG2TZI3H.mjs.map → chunk-XT5T5LAP.mjs.map} +0 -0
  535. /package/dist/esm/{chunk-XQ7ONNII.mjs.map → chunk-YNT7JHMS.mjs.map} +0 -0
  536. /package/dist/esm/{chunk-BOWPP6YG.mjs.map → chunk-YPBNYKOD.mjs.map} +0 -0
  537. /package/dist/esm/{chunk-MK2QAHXC.mjs.map → chunk-YZ3YPLEU.mjs.map} +0 -0
  538. /package/dist/esm/{chunk-OZN3OOJV.mjs.map → chunk-ZMBXHMVQ.mjs.map} +0 -0
  539. /package/dist/esm/{chunk-XFY4O2S3.mjs.map → chunk-ZRWZIAF5.mjs.map} +0 -0
  540. /package/dist/esm/{chunk-N2FKVZ4D.mjs.map → errors/index.mjs.map} +0 -0
  541. /package/dist/esm/{client/types.mjs.map → transactions/script-composer/index.mjs.map} +0 -0
@@ -19,6 +19,7 @@ export enum AddressInvalidReason {
19
19
  LEADING_ZERO_X_REQUIRED = "leading_zero_x_required",
20
20
  LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special",
21
21
  INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES",
22
+ INVALID_PADDING_STRICTNESS = "INVALID_PADDING_STRICTNESS",
22
23
  }
23
24
 
24
25
  /**
@@ -249,7 +250,9 @@ export class AccountAddress extends Serializable implements TransactionArgument
249
250
  *
250
251
  * @throws {ParsingError} If the hex string does not start with 0x or is not in a valid format.
251
252
  *
252
- * @note This function has strict parsing behavior. For relaxed behavior, please use the `fromString` function.
253
+ * @remarks
254
+ *
255
+ * This function has strict parsing behavior. For relaxed behavior, please use the `fromString` function.
253
256
  *
254
257
  * @see AIP-40 documentation for more details on address formats:
255
258
  * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
@@ -288,7 +291,7 @@ export class AccountAddress extends Serializable implements TransactionArgument
288
291
  /**
289
292
  * NOTE: This function has relaxed parsing behavior. For strict behavior, please use
290
293
  * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this
291
- * function, `fromString` is only provided for backwards compatibility.
294
+ * function, `fromString`.
292
295
  *
293
296
  * Creates an instance of AccountAddress from a hex string.
294
297
  *
@@ -296,23 +299,24 @@ export class AccountAddress extends Serializable implements TransactionArgument
296
299
  * following formats are accepted:
297
300
  *
298
301
  * - LONG, with or without leading 0x
299
- * - SHORT, with or without leading 0x
302
+ * - SHORT*, with or without leading 0x
300
303
  *
301
304
  * Where:
302
305
  * - LONG is 64 hex characters.
303
- * - SHORT is 1 to 63 hex characters inclusive.
306
+ * - SHORT* is 1 to 63 hex characters inclusive. The address can have missing values up to `maxMissingChars` before it is padded.
304
307
  * - Padding zeroes are allowed, e.g. 0x0123 is valid.
305
308
  *
306
309
  * Learn more about the different address formats by reading AIP-40:
307
310
  * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
308
311
  *
309
- * @param input - A hex string representing an account address.
312
+ * @param input A hex string representing an account address.
313
+ * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.
310
314
  *
311
315
  * @returns An instance of AccountAddress.
312
316
  *
313
317
  * @throws ParsingError if the hex string is too short, too long, or contains invalid characters.
314
318
  */
315
- static fromString(input: string): AccountAddress {
319
+ static fromString(input: string, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): AccountAddress {
316
320
  let parsedInput = input;
317
321
  // Remove leading 0x for parsing.
318
322
  if (input.startsWith("0x")) {
@@ -335,6 +339,14 @@ export class AccountAddress extends Serializable implements TransactionArgument
335
339
  );
336
340
  }
337
341
 
342
+ // Ensure that the maxMissingChars is between or equal to 0 and 63.
343
+ if (maxMissingChars > 63 || maxMissingChars < 0) {
344
+ throw new ParsingError(
345
+ `maxMissingChars must be between or equal to 0 and 63. Received ${maxMissingChars}`,
346
+ AddressInvalidReason.INVALID_PADDING_STRICTNESS,
347
+ );
348
+ }
349
+
338
350
  let addressBytes: Uint8Array;
339
351
  try {
340
352
  // Pad the address with leading zeroes, so it is 64 chars long and then convert
@@ -347,7 +359,21 @@ export class AccountAddress extends Serializable implements TransactionArgument
347
359
  throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);
348
360
  }
349
361
 
350
- return new AccountAddress(addressBytes);
362
+ const address = new AccountAddress(addressBytes);
363
+
364
+ // Cannot pad the address if it has more than maxMissingChars missing.
365
+ if (parsedInput.length < 64 - maxMissingChars) {
366
+ if (!address.isSpecial()) {
367
+ throw new ParsingError(
368
+ `Hex string is too short, must be ${64 - maxMissingChars} to 64 chars long, excluding the leading 0x. You may need to fix
369
+ the addresss by padding it with 0s before passing it to \`fromString\` (e.g. <addressString>.padStart(64, '0')).
370
+ Received ${input}`,
371
+ AddressInvalidReason.TOO_SHORT,
372
+ );
373
+ }
374
+ }
375
+
376
+ return address;
351
377
  }
352
378
 
353
379
  /**
@@ -357,10 +383,11 @@ export class AccountAddress extends Serializable implements TransactionArgument
357
383
  *
358
384
  * @param input - The input to convert into an AccountAddress. This can be a string representation of an address, a Uint8Array,
359
385
  * or an existing AccountAddress.
386
+ * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.
360
387
  */
361
- static from(input: AccountAddressInput): AccountAddress {
388
+ static from(input: AccountAddressInput, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): AccountAddress {
362
389
  if (typeof input === "string") {
363
- return AccountAddress.fromString(input);
390
+ return AccountAddress.fromString(input, { maxMissingChars });
364
391
  }
365
392
  if (input instanceof Uint8Array) {
366
393
  return new AccountAddress(input);
@@ -6,7 +6,7 @@ import { Deserializer } from "../../bcs/deserializer";
6
6
  import { Serializable, Serializer } from "../../bcs/serializer";
7
7
  import { AuthenticationKey } from "../authenticationKey";
8
8
  import { Hex } from "../hex";
9
- import { HexInput, SigningScheme as AuthenticationKeyScheme } from "../../types";
9
+ import { HexInput, SigningScheme as AuthenticationKeyScheme, PrivateKeyVariants } from "../../types";
10
10
  import { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from "./hdKey";
11
11
  import { PrivateKey } from "./privateKey";
12
12
  import { AccountPublicKey, PublicKey, VerifySignatureArgs } from "./publicKey";
@@ -181,21 +181,18 @@ export class Ed25519PublicKey extends AccountPublicKey {
181
181
 
182
182
  /**
183
183
  * Represents the private key of an Ed25519 key pair.
184
- *
185
- * @static
186
- * @readonly LENGTH - Length of an Ed25519 private key.
187
- * @static
188
- * @readonly SLIP_0010_SEED - The Ed25519 key seed to use for BIP-32 compatibility.
189
184
  */
190
185
  export class Ed25519PrivateKey extends Serializable implements PrivateKey {
191
186
  /**
192
187
  * Length of an Ed25519 private key
188
+ * @readonly
193
189
  */
194
190
  static readonly LENGTH: number = 32;
195
191
 
196
192
  /**
197
193
  * The Ed25519 key seed to use for BIP-32 compatibility
198
194
  * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}
195
+ * @readonly
199
196
  */
200
197
  static readonly SLIP_0010_SEED = "ed25519 seed";
201
198
 
@@ -210,12 +207,15 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
210
207
  /**
211
208
  * Create a new PrivateKey instance from a Uint8Array or String.
212
209
  *
210
+ * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
211
+ *
213
212
  * @param hexInput HexInput (string or Uint8Array)
213
+ * @param strict If true, private key must AIP-80 compliant.
214
214
  */
215
- constructor(hexInput: HexInput) {
215
+ constructor(hexInput: HexInput, strict?: boolean) {
216
216
  super();
217
217
 
218
- const privateKeyHex = Hex.fromHexInput(hexInput);
218
+ const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Ed25519, strict);
219
219
  if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {
220
220
  throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);
221
221
  }
@@ -231,7 +231,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
231
231
  */
232
232
  static generate(): Ed25519PrivateKey {
233
233
  const keyPair = ed25519.utils.randomPrivateKey();
234
- return new Ed25519PrivateKey(keyPair);
234
+ return new Ed25519PrivateKey(keyPair, false);
235
235
  }
236
236
 
237
237
  /**
@@ -271,7 +271,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
271
271
  key,
272
272
  chainCode,
273
273
  });
274
- return new Ed25519PrivateKey(privateKey);
274
+ return new Ed25519PrivateKey(privateKey, false);
275
275
  }
276
276
 
277
277
  // endregion
@@ -317,9 +317,29 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
317
317
  * @returns string representation of the private key.
318
318
  */
319
319
  toString(): string {
320
+ return this.toHexString();
321
+ }
322
+
323
+ /**
324
+ * Get the private key as a hex string with the 0x prefix.
325
+ *
326
+ * @returns string representation of the private key.
327
+ */
328
+ toHexString(): string {
320
329
  return this.signingKey.toString();
321
330
  }
322
331
 
332
+ /**
333
+ * Get the private key as a AIP-80 compliant hex string.
334
+ *
335
+ * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
336
+ *
337
+ * @returns AIP-80 compliant string representation of the private key.
338
+ */
339
+ toAIP80String(): string {
340
+ return PrivateKey.formatPrivateKey(this.signingKey.toString(), PrivateKeyVariants.Ed25519);
341
+ }
342
+
323
343
  // endregion
324
344
 
325
345
  // region Serializable
@@ -330,7 +350,7 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
330
350
 
331
351
  static deserialize(deserializer: Deserializer): Ed25519PrivateKey {
332
352
  const bytes = deserializer.deserializeBytes();
333
- return new Ed25519PrivateKey(bytes);
353
+ return new Ed25519PrivateKey(bytes, false);
334
354
  }
335
355
 
336
356
  // endregion
@@ -350,12 +370,12 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
350
370
 
351
371
  /**
352
372
  * Represents a signature of a message signed using an Ed25519 private key.
353
- *
354
- * @static LENGTH - Length of an Ed25519 signature, which is 64 bytes.
355
373
  */
356
374
  export class Ed25519Signature extends Signature {
357
375
  /**
358
- * Length of an Ed25519 signature
376
+ * Length of an Ed25519 signature, which is 64 bytes.
377
+ *
378
+ * @readonly
359
379
  */
360
380
  static readonly LENGTH = 64;
361
381
 
@@ -75,7 +75,6 @@ export const deriveKey = (hashSeed: Uint8Array | string, data: Uint8Array | stri
75
75
  * @param key
76
76
  * @param chainCode
77
77
  * @param index
78
- * @constructor
79
78
  */
80
79
  export const CKDPriv = ({ key, chainCode }: DerivedKeys, index: number): DerivedKeys => {
81
80
  const buffer = new ArrayBuffer(4);
@@ -1,11 +1,13 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ // eslint-disable-next-line max-classes-per-file
4
5
  import { JwtPayload, jwtDecode } from "jwt-decode";
6
+ import { sha3_256 } from "@noble/hashes/sha3";
5
7
  import { AccountPublicKey, PublicKey } from "./publicKey";
6
8
  import { Signature } from "./signature";
7
9
  import { Deserializer, Serializable, Serializer } from "../../bcs";
8
- import { Hex } from "../hex";
10
+ import { Hex, hexToAsciiString } from "../hex";
9
11
  import {
10
12
  HexInput,
11
13
  EphemeralCertificateVariant,
@@ -20,11 +22,18 @@ import { bigIntToBytesLE, bytesToBigIntLE, hashStrToField, poseidonHash } from "
20
22
  import { AuthenticationKey } from "../authenticationKey";
21
23
  import { Proof } from "./proof";
22
24
  import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
23
- import { Groth16VerificationKeyResponse, KeylessConfigurationResponse } from "../../types/keyless";
25
+ import {
26
+ Groth16VerificationKeyResponse,
27
+ KeylessConfigurationResponse,
28
+ MoveAnyStruct,
29
+ PatchedJWKsResponse,
30
+ } from "../../types/keyless";
24
31
  import { AptosConfig } from "../../api/aptosConfig";
25
32
  import { getAptosFullNode } from "../../client";
26
33
  import { memoizeAsync } from "../../utils/memoize";
27
- import { AccountAddress } from "../accountAddress";
34
+ import { AccountAddress, AccountAddressInput } from "../accountAddress";
35
+ import { getErrorMessage } from "../../utils";
36
+ import { KeylessError, KeylessErrorType } from "../../errors";
28
37
 
29
38
  export const EPK_HORIZON_SECS = 10000000;
30
39
  export const MAX_AUD_VAL_BYTES = 120;
@@ -282,6 +291,15 @@ export class KeylessSignature extends Signature {
282
291
  this.ephemeralSignature = ephemeralSignature;
283
292
  }
284
293
 
294
+ /**
295
+ * Get the kid of the JWT used to derive the Keyless Account used to sign.
296
+ *
297
+ * @returns the kid as a string
298
+ */
299
+ getJwkKid(): string {
300
+ return parseJwtHeader(this.jwtHeader).kid;
301
+ }
302
+
285
303
  serialize(serializer: Serializer): void {
286
304
  this.ephemeralCertificate.serialize(serializer);
287
305
  serializer.serializeStr(this.jwtHeader);
@@ -568,16 +586,16 @@ export class ZeroKnowledgeSig extends Signature {
568
586
  serialize(serializer: Serializer): void {
569
587
  this.proof.serialize(serializer);
570
588
  serializer.serializeU64(this.expHorizonSecs);
571
- serializer.serializeOptionStr(this.extraField);
572
- serializer.serializeOptionStr(this.overrideAudVal);
589
+ serializer.serializeOption(this.extraField);
590
+ serializer.serializeOption(this.overrideAudVal);
573
591
  serializer.serializeOption(this.trainingWheelsSignature);
574
592
  }
575
593
 
576
594
  static deserialize(deserializer: Deserializer): ZeroKnowledgeSig {
577
595
  const proof = ZkProof.deserialize(deserializer);
578
596
  const expHorizonSecs = Number(deserializer.deserializeU64());
579
- const extraField = deserializer.deserializeOptionStr();
580
- const overrideAudVal = deserializer.deserializeOptionStr();
597
+ const extraField = deserializer.deserializeOption("string");
598
+ const overrideAudVal = deserializer.deserializeOption("string");
581
599
  const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);
582
600
  return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });
583
601
  }
@@ -594,16 +612,15 @@ export class KeylessConfiguration {
594
612
  /**
595
613
  * The verification key used to verify Groth16 proofs on chain
596
614
  */
597
- // TODO: Rename to verificationKey
598
- readonly verficationKey: Groth16VerificationKey;
615
+ readonly verificationKey: Groth16VerificationKey;
599
616
 
600
617
  /**
601
618
  * The maximum lifespan of an ephemeral key pair. This is configured on chain.
602
619
  */
603
620
  readonly maxExpHorizonSecs: number;
604
621
 
605
- constructor(verficationKey: Groth16VerificationKey, maxExpHorizonSecs: number) {
606
- this.verficationKey = verficationKey;
622
+ constructor(verificationKey: Groth16VerificationKey, maxExpHorizonSecs: number) {
623
+ this.verificationKey = verificationKey;
607
624
  this.maxExpHorizonSecs = maxExpHorizonSecs;
608
625
  }
609
626
 
@@ -624,7 +641,7 @@ export class KeylessConfiguration {
624
641
  /**
625
642
  * Represents the verification key stored on-chain used to verify Groth16 proofs.
626
643
  */
627
- class Groth16VerificationKey {
644
+ export class Groth16VerificationKey {
628
645
  // The docstrings below are borrowed from ark-groth16
629
646
 
630
647
  /**
@@ -645,7 +662,7 @@ class Groth16VerificationKey {
645
662
  /**
646
663
  * The `gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H`, where H is the generator of G1
647
664
  */
648
- readonly gammaAbcG1: G1Bytes[];
665
+ readonly gammaAbcG1: [G1Bytes, G1Bytes];
649
666
 
650
667
  /**
651
668
  * The `gamma * H`, where `H` is the generator of G2
@@ -667,6 +684,27 @@ class Groth16VerificationKey {
667
684
  this.gammaG2 = new G2Bytes(gammaG2);
668
685
  }
669
686
 
687
+ /**
688
+ * Calculates the hash of the serialized form of the verification key.
689
+ * This is useful for comparing verification keys or using them as unique identifiers.
690
+ *
691
+ * @returns The SHA3-256 hash of the serialized verification key as a Uint8Array
692
+ */
693
+ public hash(): Uint8Array {
694
+ const serializer = new Serializer();
695
+ this.serialize(serializer);
696
+ return sha3_256.create().update(serializer.toUint8Array()).digest();
697
+ }
698
+
699
+ serialize(serializer: Serializer): void {
700
+ this.alphaG1.serialize(serializer);
701
+ this.betaG2.serialize(serializer);
702
+ this.deltaG2.serialize(serializer);
703
+ this.gammaAbcG1[0].serialize(serializer);
704
+ this.gammaAbcG1[1].serialize(serializer);
705
+ this.gammaG2.serialize(serializer);
706
+ }
707
+
670
708
  /**
671
709
  * Converts a Groth16VerificationKeyResponse object into a Groth16VerificationKey instance.
672
710
  *
@@ -704,15 +742,64 @@ export async function getKeylessConfig(args: {
704
742
  options?: LedgerVersionArg;
705
743
  }): Promise<KeylessConfiguration> {
706
744
  const { aptosConfig } = args;
707
- return memoizeAsync(
708
- async () => {
709
- const config = await getKeylessConfigurationResource(args);
710
- const vk = await getGroth16VerificationKeyResource(args);
711
- return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));
712
- },
713
- `keyless-configuration-${aptosConfig.network}`,
714
- 1000 * 60 * 5, // 5 minutes
715
- )();
745
+ try {
746
+ return await memoizeAsync(
747
+ async () => {
748
+ const config = await getKeylessConfigurationResource(args);
749
+ const vk = await getGroth16VerificationKeyResource(args);
750
+ return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));
751
+ },
752
+ `keyless-configuration-${aptosConfig.network}`,
753
+ 1000 * 60 * 5, // 5 minutes
754
+ )();
755
+ } catch (error) {
756
+ if (error instanceof KeylessError) {
757
+ throw error;
758
+ }
759
+ throw KeylessError.fromErrorType({
760
+ type: KeylessErrorType.FULL_NODE_OTHER,
761
+ error,
762
+ });
763
+ }
764
+ }
765
+
766
+ /**
767
+ * Parses a JWT and returns the 'iss', 'aud', and 'uid' values.
768
+ *
769
+ * @param args - The arguments for parsing the JWT.
770
+ * @param args.jwt - The JWT to parse.
771
+ * @param args.uidKey - The key to use for the 'uid' value; defaults to 'sub'.
772
+ * @returns The 'iss', 'aud', and 'uid' values from the JWT.
773
+ */
774
+ export function getIssAudAndUidVal(args: { jwt: string; uidKey?: string }): {
775
+ iss: string;
776
+ aud: string;
777
+ uidVal: string;
778
+ } {
779
+ const { jwt, uidKey = "sub" } = args;
780
+ let jwtPayload: JwtPayload & { [key: string]: string };
781
+ try {
782
+ jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);
783
+ } catch (error) {
784
+ throw KeylessError.fromErrorType({
785
+ type: KeylessErrorType.JWT_PARSING_ERROR,
786
+ details: `Failed to parse JWT - ${getErrorMessage(error)}`,
787
+ });
788
+ }
789
+ if (typeof jwtPayload.iss !== "string") {
790
+ throw KeylessError.fromErrorType({
791
+ type: KeylessErrorType.JWT_PARSING_ERROR,
792
+ details: "JWT is missing 'iss' in the payload. This should never happen.",
793
+ });
794
+ }
795
+ if (typeof jwtPayload.aud !== "string") {
796
+ throw KeylessError.fromErrorType({
797
+ type: KeylessErrorType.JWT_PARSING_ERROR,
798
+ details: "JWT is missing 'aud' in the payload or 'aud' is an array of values.",
799
+ });
800
+ }
801
+ const uidVal = jwtPayload[uidKey];
802
+ return { iss: jwtPayload.iss, aud: jwtPayload.aud, uidVal };
716
803
  }
717
804
 
718
805
  /**
@@ -730,14 +817,20 @@ async function getKeylessConfigurationResource(args: {
730
817
  }): Promise<KeylessConfigurationResponse> {
731
818
  const { aptosConfig, options } = args;
732
819
  const resourceType = "0x1::keyless_account::Configuration";
733
- const { data } = await getAptosFullNode<{}, MoveResource<KeylessConfigurationResponse>>({
734
- aptosConfig,
735
- originMethod: "getKeylessConfigurationResource",
736
- path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
737
- params: { ledger_version: options?.ledgerVersion },
738
- });
739
-
740
- return data.data;
820
+ try {
821
+ const { data } = await getAptosFullNode<{}, MoveResource<KeylessConfigurationResponse>>({
822
+ aptosConfig,
823
+ originMethod: "getKeylessConfigurationResource",
824
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
825
+ params: { ledger_version: options?.ledgerVersion },
826
+ });
827
+ return data.data;
828
+ } catch (error) {
829
+ throw KeylessError.fromErrorType({
830
+ type: KeylessErrorType.FULL_NODE_CONFIG_LOOKUP_ERROR,
831
+ error,
832
+ });
833
+ }
741
834
  }
742
835
 
743
836
  /**
@@ -755,12 +848,126 @@ async function getGroth16VerificationKeyResource(args: {
755
848
  }): Promise<Groth16VerificationKeyResponse> {
756
849
  const { aptosConfig, options } = args;
757
850
  const resourceType = "0x1::keyless_account::Groth16VerificationKey";
758
- const { data } = await getAptosFullNode<{}, MoveResource<Groth16VerificationKeyResponse>>({
759
- aptosConfig,
760
- originMethod: "getGroth16VerificationKeyResource",
761
- path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
762
- params: { ledger_version: options?.ledgerVersion },
763
- });
764
-
765
- return data.data;
851
+ try {
852
+ const { data } = await getAptosFullNode<{}, MoveResource<Groth16VerificationKeyResponse>>({
853
+ aptosConfig,
854
+ originMethod: "getGroth16VerificationKeyResource",
855
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
856
+ params: { ledger_version: options?.ledgerVersion },
857
+ });
858
+ return data.data;
859
+ } catch (error) {
860
+ throw KeylessError.fromErrorType({
861
+ type: KeylessErrorType.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR,
862
+ error,
863
+ });
864
+ }
865
+ }
866
+
867
+ export async function getKeylessJWKs(args: {
868
+ aptosConfig: AptosConfig;
869
+ jwkAddr?: AccountAddressInput;
870
+ options?: LedgerVersionArg;
871
+ }): Promise<Map<string, MoveJWK[]>> {
872
+ const { aptosConfig, jwkAddr, options } = args;
873
+ let resource: MoveResource<PatchedJWKsResponse>;
874
+ if (!jwkAddr) {
875
+ const resourceType = "0x1::jwks::PatchedJWKs";
876
+ const { data } = await getAptosFullNode<{}, MoveResource<PatchedJWKsResponse>>({
877
+ aptosConfig,
878
+ originMethod: "getKeylessJWKs",
879
+ path: `accounts/0x1/resource/${resourceType}`,
880
+ params: { ledger_version: options?.ledgerVersion },
881
+ });
882
+ resource = data;
883
+ } else {
884
+ const resourceType = "0x1::jwks::FederatedJWKs";
885
+ const { data } = await getAptosFullNode<{}, MoveResource<PatchedJWKsResponse>>({
886
+ aptosConfig,
887
+ originMethod: "getKeylessJWKs",
888
+ path: `accounts/${AccountAddress.from(jwkAddr).toString()}/resource/${resourceType}`,
889
+ params: { ledger_version: options?.ledgerVersion },
890
+ });
891
+ resource = data;
892
+ }
893
+
894
+ // Create a map of issuer to JWK arrays
895
+ const jwkMap = new Map<string, MoveJWK[]>();
896
+ for (const entry of resource.data.jwks.entries) {
897
+ const jwks: MoveJWK[] = [];
898
+ for (const jwkStruct of entry.jwks) {
899
+ const { data: jwkData } = jwkStruct.variant;
900
+ const deserializer = new Deserializer(Hex.fromHexInput(jwkData).toUint8Array());
901
+ const jwk = MoveJWK.deserialize(deserializer);
902
+ jwks.push(jwk);
903
+ }
904
+ jwkMap.set(hexToAsciiString(entry.issuer), jwks);
905
+ }
906
+
907
+ return jwkMap;
908
+ }
909
+
910
+ export class MoveJWK extends Serializable {
911
+ public kid: string;
912
+
913
+ public kty: string;
914
+
915
+ public alg: string;
916
+
917
+ public e: string;
918
+
919
+ public n: string;
920
+
921
+ constructor(args: { kid: string; kty: string; alg: string; e: string; n: string }) {
922
+ super();
923
+ const { kid, kty, alg, e, n } = args;
924
+ this.kid = kid;
925
+ this.kty = kty;
926
+ this.alg = alg;
927
+ this.e = e;
928
+ this.n = n;
929
+ }
930
+
931
+ serialize(serializer: Serializer): void {
932
+ serializer.serializeStr(this.kid);
933
+ serializer.serializeStr(this.kty);
934
+ serializer.serializeStr(this.alg);
935
+ serializer.serializeStr(this.e);
936
+ serializer.serializeStr(this.n);
937
+ }
938
+
939
+ static fromMoveStruct(struct: MoveAnyStruct): MoveJWK {
940
+ const { data } = struct.variant;
941
+ const deserializer = new Deserializer(Hex.fromHexInput(data).toUint8Array());
942
+ return MoveJWK.deserialize(deserializer);
943
+ }
944
+
945
+ static deserialize(deserializer: Deserializer): MoveJWK {
946
+ const kid = deserializer.deserializeStr();
947
+ const kty = deserializer.deserializeStr();
948
+ const alg = deserializer.deserializeStr();
949
+ const n = deserializer.deserializeStr();
950
+ const e = deserializer.deserializeStr();
951
+ return new MoveJWK({ kid, kty, alg, n, e });
952
+ }
953
+ }
954
+
955
+ interface JwtHeader {
956
+ kid: string; // Key ID
957
+ }
958
+ /**
959
+ * Safely parses the JWT header.
960
+ * @param jwtHeader The JWT header string
961
+ * @returns Parsed JWT header as an object.
962
+ */
963
+ export function parseJwtHeader(jwtHeader: string): JwtHeader {
964
+ try {
965
+ const header = JSON.parse(jwtHeader);
966
+ if (header.kid === undefined) {
967
+ throw new Error("JWT header missing kid");
968
+ }
969
+ return header;
970
+ } catch (error) {
971
+ throw new Error("Failed to parse JWT header.");
972
+ }
766
973
  }