@aptos-labs/ts-sdk 6.3.1 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1405) hide show
  1. package/README.md +125 -24
  2. package/dist/account/AbstractKeylessAccount.d.ts +326 -0
  3. package/dist/account/AbstractKeylessAccount.d.ts.map +1 -0
  4. package/dist/account/AbstractKeylessAccount.js +440 -0
  5. package/dist/account/AbstractKeylessAccount.js.map +1 -0
  6. package/dist/account/AbstractedAccount.d.ts +61 -0
  7. package/dist/account/AbstractedAccount.d.ts.map +1 -0
  8. package/dist/account/AbstractedAccount.js +71 -0
  9. package/dist/account/AbstractedAccount.js.map +1 -0
  10. package/dist/account/Account.d.ts +302 -0
  11. package/dist/account/Account.d.ts.map +1 -0
  12. package/dist/account/Account.js +104 -0
  13. package/dist/account/Account.js.map +1 -0
  14. package/dist/account/AccountUtils.d.ts +25 -0
  15. package/dist/account/AccountUtils.d.ts.map +1 -0
  16. package/dist/account/AccountUtils.js +202 -0
  17. package/dist/account/AccountUtils.js.map +1 -0
  18. package/dist/account/DerivableAbstractedAccount.d.ts +51 -0
  19. package/dist/account/DerivableAbstractedAccount.d.ts.map +1 -0
  20. package/dist/account/DerivableAbstractedAccount.js +61 -0
  21. package/dist/account/DerivableAbstractedAccount.js.map +1 -0
  22. package/dist/account/Ed25519Account.d.ts +161 -0
  23. package/dist/account/Ed25519Account.d.ts.map +1 -0
  24. package/dist/account/Ed25519Account.js +149 -0
  25. package/dist/account/Ed25519Account.js.map +1 -0
  26. package/dist/account/EphemeralKeyPair.d.ts +159 -0
  27. package/dist/account/EphemeralKeyPair.d.ts.map +1 -0
  28. package/dist/account/EphemeralKeyPair.js +246 -0
  29. package/dist/account/EphemeralKeyPair.js.map +1 -0
  30. package/dist/account/FederatedKeylessAccount.d.ts +107 -0
  31. package/dist/account/FederatedKeylessAccount.d.ts.map +1 -0
  32. package/dist/account/FederatedKeylessAccount.js +129 -0
  33. package/dist/account/FederatedKeylessAccount.js.map +1 -0
  34. package/dist/account/KeylessAccount.d.ts +112 -0
  35. package/dist/account/KeylessAccount.d.ts.map +1 -0
  36. package/dist/account/KeylessAccount.js +133 -0
  37. package/dist/account/KeylessAccount.js.map +1 -0
  38. package/dist/account/MultiEd25519Account.d.ts +100 -0
  39. package/dist/account/MultiEd25519Account.d.ts.map +1 -0
  40. package/dist/account/MultiEd25519Account.js +134 -0
  41. package/dist/account/MultiEd25519Account.js.map +1 -0
  42. package/dist/account/MultiKeyAccount.d.ts +197 -0
  43. package/dist/account/MultiKeyAccount.d.ts.map +1 -0
  44. package/dist/account/MultiKeyAccount.js +233 -0
  45. package/dist/account/MultiKeyAccount.js.map +1 -0
  46. package/dist/account/SingleKeyAccount.d.ts +189 -0
  47. package/dist/account/SingleKeyAccount.d.ts.map +1 -0
  48. package/dist/account/SingleKeyAccount.js +182 -0
  49. package/dist/account/SingleKeyAccount.js.map +1 -0
  50. package/dist/account/index.d.ts +9 -0
  51. package/dist/account/index.d.ts.map +1 -0
  52. package/dist/account/index.js +17 -0
  53. package/dist/account/index.js.map +1 -0
  54. package/dist/account/keylessSigner.d.ts +22 -0
  55. package/dist/account/keylessSigner.d.ts.map +1 -0
  56. package/dist/account/keylessSigner.js +9 -0
  57. package/dist/account/keylessSigner.js.map +1 -0
  58. package/dist/account/utils.d.ts +8 -0
  59. package/dist/account/utils.d.ts.map +1 -0
  60. package/dist/account/utils.js +12 -0
  61. package/dist/account/utils.js.map +1 -0
  62. package/dist/api/account/abstraction.d.ts +176 -0
  63. package/dist/api/account/abstraction.d.ts.map +1 -0
  64. package/dist/api/account/abstraction.js +203 -0
  65. package/dist/api/account/abstraction.js.map +1 -0
  66. package/dist/api/account.d.ts +845 -0
  67. package/dist/api/account.d.ts.map +1 -0
  68. package/dist/api/account.js +965 -0
  69. package/dist/api/account.js.map +1 -0
  70. package/dist/api/ans.d.ts +565 -0
  71. package/dist/api/ans.d.ts.map +1 -0
  72. package/dist/api/ans.js +537 -0
  73. package/dist/api/ans.js.map +1 -0
  74. package/dist/api/aptos.d.ts +73 -0
  75. package/dist/api/aptos.d.ts.map +1 -0
  76. package/dist/api/aptos.js +162 -0
  77. package/dist/api/aptos.js.map +1 -0
  78. package/dist/api/aptosConfig.d.ts +215 -0
  79. package/dist/api/aptosConfig.d.ts.map +1 -0
  80. package/dist/api/aptosConfig.js +316 -0
  81. package/dist/api/aptosConfig.js.map +1 -0
  82. package/dist/api/coin.d.ts +77 -0
  83. package/dist/api/coin.d.ts.map +1 -0
  84. package/dist/api/coin.js +73 -0
  85. package/dist/api/coin.js.map +1 -0
  86. package/dist/api/digitalAsset.d.ts +1026 -0
  87. package/dist/api/digitalAsset.d.ts.map +1 -0
  88. package/dist/api/digitalAsset.js +987 -0
  89. package/dist/api/digitalAsset.js.map +1 -0
  90. package/dist/api/faucet.d.ts +74 -0
  91. package/dist/api/faucet.d.ts.map +1 -0
  92. package/dist/api/faucet.js +86 -0
  93. package/dist/api/faucet.js.map +1 -0
  94. package/dist/api/fungibleAsset.d.ts +285 -0
  95. package/dist/api/fungibleAsset.d.ts.map +1 -0
  96. package/dist/api/fungibleAsset.js +314 -0
  97. package/dist/api/fungibleAsset.js.map +1 -0
  98. package/dist/api/general.d.ts +298 -0
  99. package/dist/api/general.d.ts.map +1 -0
  100. package/dist/api/general.js +311 -0
  101. package/dist/api/general.js.map +1 -0
  102. package/dist/api/index.d.ts +3 -0
  103. package/dist/api/index.d.ts.map +1 -0
  104. package/dist/api/index.js +5 -0
  105. package/dist/api/index.js.map +1 -0
  106. package/dist/api/keyless.d.ts +160 -0
  107. package/dist/api/keyless.d.ts.map +1 -0
  108. package/dist/api/keyless.js +176 -0
  109. package/dist/api/keyless.js.map +1 -0
  110. package/dist/api/object.d.ts +74 -0
  111. package/dist/api/object.d.ts.map +1 -0
  112. package/dist/api/object.js +84 -0
  113. package/dist/api/object.js.map +1 -0
  114. package/dist/api/staking.d.ts +128 -0
  115. package/dist/api/staking.d.ts.map +1 -0
  116. package/dist/api/staking.js +143 -0
  117. package/dist/api/staking.js.map +1 -0
  118. package/dist/api/table.d.ts +163 -0
  119. package/dist/api/table.d.ts.map +1 -0
  120. package/dist/api/table.js +171 -0
  121. package/dist/api/table.js.map +1 -0
  122. package/dist/api/transaction.d.ts +672 -0
  123. package/dist/api/transaction.d.ts.map +1 -0
  124. package/dist/api/transaction.js +694 -0
  125. package/dist/api/transaction.js.map +1 -0
  126. package/dist/api/transactionSubmission/build.d.ts +137 -0
  127. package/dist/api/transactionSubmission/build.d.ts.map +1 -0
  128. package/dist/api/transactionSubmission/build.js +130 -0
  129. package/dist/api/transactionSubmission/build.js.map +1 -0
  130. package/dist/api/transactionSubmission/helpers.d.ts +91 -0
  131. package/dist/api/transactionSubmission/helpers.d.ts.map +1 -0
  132. package/dist/api/transactionSubmission/helpers.js +99 -0
  133. package/dist/api/transactionSubmission/helpers.js.map +1 -0
  134. package/dist/api/transactionSubmission/management.d.ts +159 -0
  135. package/dist/api/transactionSubmission/management.d.ts.map +1 -0
  136. package/dist/api/transactionSubmission/management.js +192 -0
  137. package/dist/api/transactionSubmission/management.js.map +1 -0
  138. package/dist/api/transactionSubmission/sign.d.ts +117 -0
  139. package/dist/api/transactionSubmission/sign.d.ts.map +1 -0
  140. package/dist/api/transactionSubmission/sign.js +130 -0
  141. package/dist/api/transactionSubmission/sign.js.map +1 -0
  142. package/dist/api/transactionSubmission/simulate.d.ts +176 -0
  143. package/dist/api/transactionSubmission/simulate.d.ts.map +1 -0
  144. package/dist/api/transactionSubmission/simulate.js +183 -0
  145. package/dist/api/transactionSubmission/simulate.js.map +1 -0
  146. package/dist/api/transactionSubmission/submit.d.ts +136 -0
  147. package/dist/api/transactionSubmission/submit.d.ts.map +1 -0
  148. package/dist/api/transactionSubmission/submit.js +136 -0
  149. package/dist/api/transactionSubmission/submit.js.map +1 -0
  150. package/dist/api/utils.d.ts +39 -0
  151. package/dist/api/utils.d.ts.map +1 -0
  152. package/dist/api/utils.js +41 -0
  153. package/dist/api/utils.js.map +1 -0
  154. package/dist/bcs/consts.d.ts +20 -0
  155. package/dist/bcs/consts.d.ts.map +1 -0
  156. package/dist/bcs/consts.js +24 -0
  157. package/dist/bcs/consts.js.map +1 -0
  158. package/dist/bcs/deserializer.d.ts +365 -0
  159. package/dist/bcs/deserializer.d.ts.map +1 -0
  160. package/dist/bcs/deserializer.js +470 -0
  161. package/dist/bcs/deserializer.js.map +1 -0
  162. package/dist/bcs/index.d.ts +7 -0
  163. package/dist/bcs/index.d.ts.map +1 -0
  164. package/dist/bcs/index.js +9 -0
  165. package/dist/bcs/index.js.map +1 -0
  166. package/dist/bcs/serializable/entryFunctionBytes.d.ts +60 -0
  167. package/dist/bcs/serializable/entryFunctionBytes.d.ts.map +1 -0
  168. package/dist/bcs/serializable/entryFunctionBytes.js +82 -0
  169. package/dist/bcs/serializable/entryFunctionBytes.js.map +1 -0
  170. package/dist/bcs/serializable/fixedBytes.d.ts +86 -0
  171. package/dist/bcs/serializable/fixedBytes.d.ts.map +1 -0
  172. package/dist/bcs/serializable/fixedBytes.js +98 -0
  173. package/dist/bcs/serializable/fixedBytes.js.map +1 -0
  174. package/dist/bcs/serializable/movePrimitives.d.ts +267 -0
  175. package/dist/bcs/serializable/movePrimitives.d.ts.map +1 -0
  176. package/dist/bcs/serializable/movePrimitives.js +448 -0
  177. package/dist/bcs/serializable/movePrimitives.js.map +1 -0
  178. package/dist/bcs/serializable/moveStructs.d.ts +596 -0
  179. package/dist/bcs/serializable/moveStructs.d.ts.map +1 -0
  180. package/dist/bcs/serializable/moveStructs.js +748 -0
  181. package/dist/bcs/serializable/moveStructs.js.map +1 -0
  182. package/dist/bcs/serializer.d.ts +442 -0
  183. package/dist/bcs/serializer.d.ts.map +1 -0
  184. package/dist/bcs/serializer.js +747 -0
  185. package/dist/bcs/serializer.js.map +1 -0
  186. package/dist/cli/index.d.ts +3 -0
  187. package/dist/cli/index.d.ts.map +1 -0
  188. package/dist/cli/index.js +3 -0
  189. package/dist/cli/index.js.map +1 -0
  190. package/dist/cli/localNode.d.ts +65 -0
  191. package/dist/cli/localNode.d.ts.map +1 -0
  192. package/dist/cli/localNode.js +149 -0
  193. package/dist/cli/localNode.js.map +1 -0
  194. package/dist/cli/move.d.ts +250 -0
  195. package/dist/cli/move.d.ts.map +1 -0
  196. package/dist/cli/move.js +364 -0
  197. package/dist/cli/move.js.map +1 -0
  198. package/dist/client/core.d.ts +37 -0
  199. package/dist/client/core.d.ts.map +1 -0
  200. package/dist/client/core.js +116 -0
  201. package/dist/client/core.js.map +1 -0
  202. package/dist/client/get.d.ts +119 -0
  203. package/dist/client/get.d.ts.map +1 -0
  204. package/dist/client/get.js +165 -0
  205. package/dist/client/get.js.map +1 -0
  206. package/dist/client/index.d.ts +4 -0
  207. package/dist/client/index.d.ts.map +1 -0
  208. package/dist/client/index.js +6 -0
  209. package/dist/client/index.js.map +1 -0
  210. package/dist/client/post.d.ts +155 -0
  211. package/dist/client/post.d.ts.map +1 -0
  212. package/dist/client/post.js +151 -0
  213. package/dist/client/post.js.map +1 -0
  214. package/dist/core/account/index.d.ts +2 -0
  215. package/dist/core/account/index.d.ts.map +1 -0
  216. package/dist/core/account/index.js +2 -0
  217. package/dist/core/account/index.js.map +1 -0
  218. package/dist/core/account/utils/address.d.ts +47 -0
  219. package/dist/core/account/utils/address.d.ts.map +1 -0
  220. package/dist/core/account/utils/address.js +68 -0
  221. package/dist/core/account/utils/address.js.map +1 -0
  222. package/dist/core/account/utils/index.d.ts +2 -0
  223. package/dist/core/account/utils/index.d.ts.map +1 -0
  224. package/dist/core/account/utils/index.js +2 -0
  225. package/dist/core/account/utils/index.js.map +1 -0
  226. package/dist/core/accountAddress.d.ts +327 -0
  227. package/dist/core/accountAddress.d.ts.map +1 -0
  228. package/dist/core/accountAddress.js +457 -0
  229. package/dist/core/accountAddress.js.map +1 -0
  230. package/dist/core/authenticationKey.d.ts +129 -0
  231. package/dist/core/authenticationKey.d.ts.map +1 -0
  232. package/dist/core/authenticationKey.js +155 -0
  233. package/dist/core/authenticationKey.js.map +1 -0
  234. package/dist/core/common.d.ts +51 -0
  235. package/dist/core/common.d.ts.map +1 -0
  236. package/dist/core/common.js +30 -0
  237. package/dist/core/common.js.map +1 -0
  238. package/dist/core/crypto/abstraction.d.ts +21 -0
  239. package/dist/core/crypto/abstraction.d.ts.map +1 -0
  240. package/dist/core/crypto/abstraction.js +37 -0
  241. package/dist/core/crypto/abstraction.js.map +1 -0
  242. package/dist/core/crypto/anyKeyRegistry.d.ts +45 -0
  243. package/dist/core/crypto/anyKeyRegistry.d.ts.map +1 -0
  244. package/dist/core/crypto/anyKeyRegistry.js +59 -0
  245. package/dist/core/crypto/anyKeyRegistry.js.map +1 -0
  246. package/dist/core/crypto/deserializationUtils.d.ts +22 -0
  247. package/dist/core/crypto/deserializationUtils.d.ts.map +1 -0
  248. package/dist/core/crypto/deserializationUtils.js +89 -0
  249. package/dist/core/crypto/deserializationUtils.js.map +1 -0
  250. package/dist/core/crypto/ed25519.d.ts +330 -0
  251. package/dist/core/crypto/ed25519.d.ts.map +1 -0
  252. package/dist/core/crypto/ed25519.js +502 -0
  253. package/dist/core/crypto/ed25519.js.map +1 -0
  254. package/dist/core/crypto/encryption/ciphertext.d.ts +49 -0
  255. package/dist/core/crypto/encryption/ciphertext.d.ts.map +1 -0
  256. package/dist/core/crypto/encryption/ciphertext.js +166 -0
  257. package/dist/core/crypto/encryption/ciphertext.js.map +1 -0
  258. package/dist/core/crypto/encryption/curveSerialization.d.ts +17 -0
  259. package/dist/core/crypto/encryption/curveSerialization.d.ts.map +1 -0
  260. package/dist/core/crypto/encryption/curveSerialization.js +38 -0
  261. package/dist/core/crypto/encryption/curveSerialization.js.map +1 -0
  262. package/dist/core/crypto/encryption/fieldSerialization.d.ts +12 -0
  263. package/dist/core/crypto/encryption/fieldSerialization.d.ts.map +1 -0
  264. package/dist/core/crypto/encryption/fieldSerialization.js +70 -0
  265. package/dist/core/crypto/encryption/fieldSerialization.js.map +1 -0
  266. package/dist/core/crypto/encryption/index.d.ts +11 -0
  267. package/dist/core/crypto/encryption/index.d.ts.map +1 -0
  268. package/dist/core/crypto/encryption/index.js +13 -0
  269. package/dist/core/crypto/encryption/index.js.map +1 -0
  270. package/dist/core/crypto/encryption/symmetric.d.ts +38 -0
  271. package/dist/core/crypto/encryption/symmetric.d.ts.map +1 -0
  272. package/dist/core/crypto/encryption/symmetric.js +124 -0
  273. package/dist/core/crypto/encryption/symmetric.js.map +1 -0
  274. package/dist/core/crypto/ephemeral.d.ts +112 -0
  275. package/dist/core/crypto/ephemeral.d.ts.map +1 -0
  276. package/dist/core/crypto/ephemeral.js +170 -0
  277. package/dist/core/crypto/ephemeral.js.map +1 -0
  278. package/dist/core/crypto/federatedKeyless.d.ts +106 -0
  279. package/dist/core/crypto/federatedKeyless.d.ts.map +1 -0
  280. package/dist/core/crypto/federatedKeyless.js +125 -0
  281. package/dist/core/crypto/federatedKeyless.js.map +1 -0
  282. package/dist/core/crypto/hdKey.d.ts +90 -0
  283. package/dist/core/crypto/hdKey.d.ts.map +1 -0
  284. package/dist/core/crypto/hdKey.js +118 -0
  285. package/dist/core/crypto/hdKey.js.map +1 -0
  286. package/dist/core/crypto/index.d.ts +13 -0
  287. package/dist/core/crypto/index.d.ts.map +1 -0
  288. package/dist/core/crypto/index.js +26 -0
  289. package/dist/core/crypto/index.js.map +1 -0
  290. package/dist/core/crypto/keyless.d.ts +788 -0
  291. package/dist/core/crypto/keyless.d.ts.map +1 -0
  292. package/dist/core/crypto/keyless.js +1482 -0
  293. package/dist/core/crypto/keyless.js.map +1 -0
  294. package/dist/core/crypto/keylessRegistration.d.ts +2 -0
  295. package/dist/core/crypto/keylessRegistration.d.ts.map +1 -0
  296. package/dist/core/crypto/keylessRegistration.js +16 -0
  297. package/dist/core/crypto/keylessRegistration.js.map +1 -0
  298. package/dist/core/crypto/multiEd25519.d.ts +228 -0
  299. package/dist/core/crypto/multiEd25519.d.ts.map +1 -0
  300. package/dist/core/crypto/multiEd25519.js +361 -0
  301. package/dist/core/crypto/multiEd25519.js.map +1 -0
  302. package/dist/core/crypto/multiKey.d.ts +248 -0
  303. package/dist/core/crypto/multiKey.d.ts.map +1 -0
  304. package/dist/core/crypto/multiKey.js +417 -0
  305. package/dist/core/crypto/multiKey.js.map +1 -0
  306. package/dist/core/crypto/poseidon.d.ts +58 -0
  307. package/dist/core/crypto/poseidon.d.ts.map +1 -0
  308. package/dist/core/crypto/poseidon.js +196 -0
  309. package/dist/core/crypto/poseidon.js.map +1 -0
  310. package/dist/core/crypto/privateKey.d.ts +64 -0
  311. package/dist/core/crypto/privateKey.d.ts.map +1 -0
  312. package/dist/core/crypto/privateKey.js +74 -0
  313. package/dist/core/crypto/privateKey.js.map +1 -0
  314. package/dist/core/crypto/proof.d.ts +10 -0
  315. package/dist/core/crypto/proof.d.ts.map +1 -0
  316. package/dist/core/crypto/proof.js +10 -0
  317. package/dist/core/crypto/proof.js.map +1 -0
  318. package/dist/core/crypto/publicKey.d.ts +92 -0
  319. package/dist/core/crypto/publicKey.d.ts.map +1 -0
  320. package/dist/core/crypto/publicKey.js +54 -0
  321. package/dist/core/crypto/publicKey.js.map +1 -0
  322. package/dist/core/crypto/secp256k1.d.ts +303 -0
  323. package/dist/core/crypto/secp256k1.d.ts.map +1 -0
  324. package/dist/core/crypto/secp256k1.js +455 -0
  325. package/dist/core/crypto/secp256k1.js.map +1 -0
  326. package/dist/core/crypto/secp256r1.d.ts +304 -0
  327. package/dist/core/crypto/secp256r1.d.ts.map +1 -0
  328. package/dist/core/crypto/secp256r1.js +444 -0
  329. package/dist/core/crypto/secp256r1.js.map +1 -0
  330. package/dist/core/crypto/signature.d.ts +35 -0
  331. package/dist/core/crypto/signature.d.ts.map +1 -0
  332. package/dist/core/crypto/signature.js +55 -0
  333. package/dist/core/crypto/signature.js.map +1 -0
  334. package/dist/core/crypto/singleKey.d.ts +175 -0
  335. package/dist/core/crypto/singleKey.d.ts.map +1 -0
  336. package/dist/core/crypto/singleKey.js +324 -0
  337. package/dist/core/crypto/singleKey.js.map +1 -0
  338. package/dist/core/crypto/types.d.ts +6 -0
  339. package/dist/core/crypto/types.d.ts.map +1 -0
  340. package/dist/core/crypto/types.js +2 -0
  341. package/dist/core/crypto/types.js.map +1 -0
  342. package/dist/core/crypto/utils.d.ts +16 -0
  343. package/dist/core/crypto/utils.d.ts.map +1 -0
  344. package/dist/core/crypto/utils.js +64 -0
  345. package/dist/core/crypto/utils.js.map +1 -0
  346. package/dist/core/hex.d.ts +154 -0
  347. package/dist/core/hex.d.ts.map +1 -0
  348. package/dist/core/hex.js +219 -0
  349. package/dist/core/hex.js.map +1 -0
  350. package/dist/core/index.d.ts +7 -0
  351. package/dist/core/index.d.ts.map +1 -0
  352. package/dist/core/index.js +9 -0
  353. package/dist/core/index.js.map +1 -0
  354. package/dist/errors/index.d.ts +125 -0
  355. package/dist/errors/index.d.ts.map +1 -0
  356. package/dist/errors/index.js +367 -0
  357. package/dist/errors/index.js.map +1 -0
  358. package/dist/functions/abstraction.d.ts +4 -0
  359. package/dist/functions/abstraction.d.ts.map +1 -0
  360. package/dist/functions/abstraction.js +6 -0
  361. package/dist/functions/abstraction.js.map +1 -0
  362. package/dist/functions/account.d.ts +8 -0
  363. package/dist/functions/account.d.ts.map +1 -0
  364. package/dist/functions/account.js +10 -0
  365. package/dist/functions/account.js.map +1 -0
  366. package/dist/functions/ans.d.ts +4 -0
  367. package/dist/functions/ans.d.ts.map +1 -0
  368. package/dist/functions/ans.js +6 -0
  369. package/dist/functions/ans.js.map +1 -0
  370. package/dist/functions/coin.d.ts +4 -0
  371. package/dist/functions/coin.d.ts.map +1 -0
  372. package/dist/functions/coin.js +6 -0
  373. package/dist/functions/coin.js.map +1 -0
  374. package/dist/functions/digitalAsset.d.ts +4 -0
  375. package/dist/functions/digitalAsset.d.ts.map +1 -0
  376. package/dist/functions/digitalAsset.js +6 -0
  377. package/dist/functions/digitalAsset.js.map +1 -0
  378. package/dist/functions/faucet.d.ts +4 -0
  379. package/dist/functions/faucet.d.ts.map +1 -0
  380. package/dist/functions/faucet.js +6 -0
  381. package/dist/functions/faucet.js.map +1 -0
  382. package/dist/functions/fungibleAsset.d.ts +4 -0
  383. package/dist/functions/fungibleAsset.d.ts.map +1 -0
  384. package/dist/functions/fungibleAsset.js +6 -0
  385. package/dist/functions/fungibleAsset.js.map +1 -0
  386. package/dist/functions/general.d.ts +4 -0
  387. package/dist/functions/general.d.ts.map +1 -0
  388. package/dist/functions/general.js +6 -0
  389. package/dist/functions/general.js.map +1 -0
  390. package/dist/functions/index.d.ts +18 -0
  391. package/dist/functions/index.d.ts.map +1 -0
  392. package/dist/functions/index.js +20 -0
  393. package/dist/functions/index.js.map +1 -0
  394. package/dist/functions/keyless.d.ts +16 -0
  395. package/dist/functions/keyless.d.ts.map +1 -0
  396. package/dist/functions/keyless.js +23 -0
  397. package/dist/functions/keyless.js.map +1 -0
  398. package/dist/functions/object.d.ts +4 -0
  399. package/dist/functions/object.d.ts.map +1 -0
  400. package/dist/functions/object.js +6 -0
  401. package/dist/functions/object.js.map +1 -0
  402. package/dist/functions/staking.d.ts +4 -0
  403. package/dist/functions/staking.d.ts.map +1 -0
  404. package/dist/functions/staking.js +6 -0
  405. package/dist/functions/staking.js.map +1 -0
  406. package/dist/functions/table.d.ts +4 -0
  407. package/dist/functions/table.d.ts.map +1 -0
  408. package/dist/functions/table.js +6 -0
  409. package/dist/functions/table.js.map +1 -0
  410. package/dist/functions/transaction.d.ts +5 -0
  411. package/dist/functions/transaction.d.ts.map +1 -0
  412. package/dist/functions/transaction.js +7 -0
  413. package/dist/functions/transaction.js.map +1 -0
  414. package/dist/functions/view.d.ts +3 -0
  415. package/dist/functions/view.d.ts.map +1 -0
  416. package/dist/functions/view.js +5 -0
  417. package/dist/functions/view.js.map +1 -0
  418. package/dist/index.d.ts +12 -0
  419. package/dist/index.d.ts.map +1 -0
  420. package/dist/index.js +29 -0
  421. package/dist/index.js.map +1 -0
  422. package/dist/internal/abstraction.d.ts +22 -0
  423. package/dist/internal/abstraction.d.ts.map +1 -0
  424. package/dist/internal/abstraction.js +54 -0
  425. package/dist/internal/abstraction.js.map +1 -0
  426. package/dist/internal/account.d.ts +457 -0
  427. package/dist/internal/account.d.ts.map +1 -0
  428. package/dist/internal/account.js +1164 -0
  429. package/dist/internal/account.js.map +1 -0
  430. package/dist/internal/ans.d.ts +414 -0
  431. package/dist/internal/ans.d.ts.map +1 -0
  432. package/dist/internal/ans.js +769 -0
  433. package/dist/internal/ans.js.map +1 -0
  434. package/dist/internal/coin.d.ts +27 -0
  435. package/dist/internal/coin.d.ts.map +1 -0
  436. package/dist/internal/coin.js +36 -0
  437. package/dist/internal/coin.js.map +1 -0
  438. package/dist/internal/digitalAsset.d.ts +577 -0
  439. package/dist/internal/digitalAsset.d.ts.map +1 -0
  440. package/dist/internal/digitalAsset.js +900 -0
  441. package/dist/internal/digitalAsset.js.map +1 -0
  442. package/dist/internal/encryptionKey.d.ts +20 -0
  443. package/dist/internal/encryptionKey.d.ts.map +1 -0
  444. package/dist/internal/encryptionKey.js +33 -0
  445. package/dist/internal/encryptionKey.js.map +1 -0
  446. package/dist/internal/faucet.d.ts +35 -0
  447. package/dist/internal/faucet.d.ts.map +1 -0
  448. package/dist/internal/faucet.js +53 -0
  449. package/dist/internal/faucet.js.map +1 -0
  450. package/dist/internal/fungibleAsset.d.ts +108 -0
  451. package/dist/internal/fungibleAsset.d.ts.map +1 -0
  452. package/dist/internal/fungibleAsset.js +155 -0
  453. package/dist/internal/fungibleAsset.js.map +1 -0
  454. package/dist/internal/general.d.ts +87 -0
  455. package/dist/internal/general.d.ts.map +1 -0
  456. package/dist/internal/general.js +136 -0
  457. package/dist/internal/general.js.map +1 -0
  458. package/dist/internal/keyless.d.ts +101 -0
  459. package/dist/internal/keyless.d.ts.map +1 -0
  460. package/dist/internal/keyless.js +191 -0
  461. package/dist/internal/keyless.js.map +1 -0
  462. package/dist/internal/object.d.ts +37 -0
  463. package/dist/internal/object.d.ts.map +1 -0
  464. package/dist/internal/object.js +53 -0
  465. package/dist/internal/object.js.map +1 -0
  466. package/dist/internal/staking.d.ts +53 -0
  467. package/dist/internal/staking.d.ts.map +1 -0
  468. package/dist/internal/staking.js +71 -0
  469. package/dist/internal/staking.js.map +1 -0
  470. package/dist/internal/table.d.ts +60 -0
  471. package/dist/internal/table.d.ts.map +1 -0
  472. package/dist/internal/table.js +86 -0
  473. package/dist/internal/table.js.map +1 -0
  474. package/dist/internal/transaction.d.ts +192 -0
  475. package/dist/internal/transaction.d.ts.map +1 -0
  476. package/dist/internal/transaction.js +399 -0
  477. package/dist/internal/transaction.js.map +1 -0
  478. package/dist/internal/transactionSubmission.d.ts +177 -0
  479. package/dist/internal/transactionSubmission.d.ts.map +1 -0
  480. package/dist/internal/transactionSubmission.js +411 -0
  481. package/dist/internal/transactionSubmission.js.map +1 -0
  482. package/dist/internal/utils/index.d.ts +2 -0
  483. package/dist/internal/utils/index.d.ts.map +1 -0
  484. package/dist/internal/utils/index.js +4 -0
  485. package/dist/internal/utils/index.js.map +1 -0
  486. package/dist/internal/utils/utils.d.ts +35 -0
  487. package/dist/internal/utils/utils.d.ts.map +1 -0
  488. package/dist/internal/utils/utils.js +63 -0
  489. package/dist/internal/utils/utils.js.map +1 -0
  490. package/dist/internal/view.d.ts +14 -0
  491. package/dist/internal/view.d.ts.map +1 -0
  492. package/dist/internal/view.js +41 -0
  493. package/dist/internal/view.js.map +1 -0
  494. package/dist/transactions/authenticator/account.d.ts +193 -0
  495. package/dist/transactions/authenticator/account.d.ts.map +1 -0
  496. package/dist/transactions/authenticator/account.js +346 -0
  497. package/dist/transactions/authenticator/account.js.map +1 -0
  498. package/dist/transactions/authenticator/index.d.ts +3 -0
  499. package/dist/transactions/authenticator/index.d.ts.map +1 -0
  500. package/dist/transactions/authenticator/index.js +5 -0
  501. package/dist/transactions/authenticator/index.js.map +1 -0
  502. package/dist/transactions/authenticator/transaction.d.ts +148 -0
  503. package/dist/transactions/authenticator/transaction.d.ts.map +1 -0
  504. package/dist/transactions/authenticator/transaction.js +239 -0
  505. package/dist/transactions/authenticator/transaction.js.map +1 -0
  506. package/dist/transactions/index.d.ts +7 -0
  507. package/dist/transactions/index.d.ts.map +1 -0
  508. package/dist/transactions/index.js +9 -0
  509. package/dist/transactions/index.js.map +1 -0
  510. package/dist/transactions/instances/chainId.d.ts +39 -0
  511. package/dist/transactions/instances/chainId.d.ts.map +1 -0
  512. package/dist/transactions/instances/chainId.js +48 -0
  513. package/dist/transactions/instances/chainId.js.map +1 -0
  514. package/dist/transactions/instances/encryptedPayload.d.ts +65 -0
  515. package/dist/transactions/instances/encryptedPayload.d.ts.map +1 -0
  516. package/dist/transactions/instances/encryptedPayload.js +122 -0
  517. package/dist/transactions/instances/encryptedPayload.js.map +1 -0
  518. package/dist/transactions/instances/identifier.d.ts +40 -0
  519. package/dist/transactions/instances/identifier.d.ts.map +1 -0
  520. package/dist/transactions/instances/identifier.js +49 -0
  521. package/dist/transactions/instances/identifier.js.map +1 -0
  522. package/dist/transactions/instances/index.d.ts +12 -0
  523. package/dist/transactions/instances/index.d.ts.map +1 -0
  524. package/dist/transactions/instances/index.js +14 -0
  525. package/dist/transactions/instances/index.js.map +1 -0
  526. package/dist/transactions/instances/moduleId.d.ts +52 -0
  527. package/dist/transactions/instances/moduleId.d.ts.map +1 -0
  528. package/dist/transactions/instances/moduleId.js +69 -0
  529. package/dist/transactions/instances/moduleId.js.map +1 -0
  530. package/dist/transactions/instances/multiAgentTransaction.d.ts +50 -0
  531. package/dist/transactions/instances/multiAgentTransaction.d.ts.map +1 -0
  532. package/dist/transactions/instances/multiAgentTransaction.js +75 -0
  533. package/dist/transactions/instances/multiAgentTransaction.js.map +1 -0
  534. package/dist/transactions/instances/rawTransaction.d.ts +142 -0
  535. package/dist/transactions/instances/rawTransaction.d.ts.map +1 -0
  536. package/dist/transactions/instances/rawTransaction.js +202 -0
  537. package/dist/transactions/instances/rawTransaction.js.map +1 -0
  538. package/dist/transactions/instances/rotationProofChallenge.d.ts +54 -0
  539. package/dist/transactions/instances/rotationProofChallenge.d.ts.map +1 -0
  540. package/dist/transactions/instances/rotationProofChallenge.js +70 -0
  541. package/dist/transactions/instances/rotationProofChallenge.js.map +1 -0
  542. package/dist/transactions/instances/signedTransaction.d.ts +53 -0
  543. package/dist/transactions/instances/signedTransaction.d.ts.map +1 -0
  544. package/dist/transactions/instances/signedTransaction.js +65 -0
  545. package/dist/transactions/instances/signedTransaction.js.map +1 -0
  546. package/dist/transactions/instances/simpleTransaction.d.ts +49 -0
  547. package/dist/transactions/instances/simpleTransaction.d.ts.map +1 -0
  548. package/dist/transactions/instances/simpleTransaction.js +73 -0
  549. package/dist/transactions/instances/simpleTransaction.js.map +1 -0
  550. package/dist/transactions/instances/transactionArgument.d.ts +71 -0
  551. package/dist/transactions/instances/transactionArgument.d.ts.map +1 -0
  552. package/dist/transactions/instances/transactionArgument.js +4 -0
  553. package/dist/transactions/instances/transactionArgument.js.map +1 -0
  554. package/dist/transactions/instances/transactionPayload.d.ts +369 -0
  555. package/dist/transactions/instances/transactionPayload.d.ts.map +1 -0
  556. package/dist/transactions/instances/transactionPayload.js +668 -0
  557. package/dist/transactions/instances/transactionPayload.js.map +1 -0
  558. package/dist/transactions/management/accountSequenceNumber.d.ts +114 -0
  559. package/dist/transactions/management/accountSequenceNumber.d.ts.map +1 -0
  560. package/dist/transactions/management/accountSequenceNumber.js +197 -0
  561. package/dist/transactions/management/accountSequenceNumber.js.map +1 -0
  562. package/dist/transactions/management/asyncQueue.d.ts +76 -0
  563. package/dist/transactions/management/asyncQueue.d.ts.map +1 -0
  564. package/dist/transactions/management/asyncQueue.js +105 -0
  565. package/dist/transactions/management/asyncQueue.js.map +1 -0
  566. package/dist/transactions/management/index.d.ts +3 -0
  567. package/dist/transactions/management/index.d.ts.map +1 -0
  568. package/dist/transactions/management/index.js +3 -0
  569. package/dist/transactions/management/index.js.map +1 -0
  570. package/dist/transactions/management/transactionWorker.d.ts +213 -0
  571. package/dist/transactions/management/transactionWorker.d.ts.map +1 -0
  572. package/dist/transactions/management/transactionWorker.js +347 -0
  573. package/dist/transactions/management/transactionWorker.js.map +1 -0
  574. package/dist/transactions/transactionBuilder/encryptPayload.d.ts +21 -0
  575. package/dist/transactions/transactionBuilder/encryptPayload.d.ts.map +1 -0
  576. package/dist/transactions/transactionBuilder/encryptPayload.js +159 -0
  577. package/dist/transactions/transactionBuilder/encryptPayload.js.map +1 -0
  578. package/dist/transactions/transactionBuilder/helpers.d.ts +184 -0
  579. package/dist/transactions/transactionBuilder/helpers.d.ts.map +1 -0
  580. package/dist/transactions/transactionBuilder/helpers.js +344 -0
  581. package/dist/transactions/transactionBuilder/helpers.js.map +1 -0
  582. package/dist/transactions/transactionBuilder/index.d.ts +6 -0
  583. package/dist/transactions/transactionBuilder/index.d.ts.map +1 -0
  584. package/dist/transactions/transactionBuilder/index.js +8 -0
  585. package/dist/transactions/transactionBuilder/index.js.map +1 -0
  586. package/dist/transactions/transactionBuilder/remoteAbi.d.ts +167 -0
  587. package/dist/transactions/transactionBuilder/remoteAbi.d.ts.map +1 -0
  588. package/dist/transactions/transactionBuilder/remoteAbi.js +1088 -0
  589. package/dist/transactions/transactionBuilder/remoteAbi.js.map +1 -0
  590. package/dist/transactions/transactionBuilder/signingMessage.d.ts +55 -0
  591. package/dist/transactions/transactionBuilder/signingMessage.d.ts.map +1 -0
  592. package/dist/transactions/transactionBuilder/signingMessage.js +94 -0
  593. package/dist/transactions/transactionBuilder/signingMessage.js.map +1 -0
  594. package/dist/transactions/transactionBuilder/structEnumParser.d.ts +225 -0
  595. package/dist/transactions/transactionBuilder/structEnumParser.d.ts.map +1 -0
  596. package/dist/transactions/transactionBuilder/structEnumParser.js +690 -0
  597. package/dist/transactions/transactionBuilder/structEnumParser.js.map +1 -0
  598. package/dist/transactions/transactionBuilder/transactionBuilder.d.ts +198 -0
  599. package/dist/transactions/transactionBuilder/transactionBuilder.d.ts.map +1 -0
  600. package/dist/transactions/transactionBuilder/transactionBuilder.js +586 -0
  601. package/dist/transactions/transactionBuilder/transactionBuilder.js.map +1 -0
  602. package/dist/transactions/typeTag/index.d.ts +544 -0
  603. package/dist/transactions/typeTag/index.d.ts.map +1 -0
  604. package/dist/transactions/typeTag/index.js +826 -0
  605. package/dist/transactions/typeTag/index.js.map +1 -0
  606. package/dist/transactions/typeTag/parser.d.ts +73 -0
  607. package/dist/transactions/typeTag/parser.d.ts.map +1 -0
  608. package/dist/transactions/typeTag/parser.js +368 -0
  609. package/dist/transactions/typeTag/parser.js.map +1 -0
  610. package/dist/transactions/types.d.ts +477 -0
  611. package/dist/transactions/types.d.ts.map +1 -0
  612. package/dist/transactions/types.js +4 -0
  613. package/dist/transactions/types.js.map +1 -0
  614. package/dist/types/abstraction.d.ts +14 -0
  615. package/dist/types/abstraction.d.ts.map +1 -0
  616. package/dist/types/abstraction.js +16 -0
  617. package/dist/types/abstraction.js.map +1 -0
  618. package/dist/types/ans.d.ts +113 -0
  619. package/dist/types/ans.d.ts.map +1 -0
  620. package/dist/types/ans.js +36 -0
  621. package/dist/types/ans.js.map +1 -0
  622. package/dist/types/generated/operations.d.ts +702 -0
  623. package/dist/types/generated/operations.d.ts.map +1 -0
  624. package/dist/types/generated/operations.js +2 -0
  625. package/dist/types/generated/operations.js.map +1 -0
  626. package/dist/types/generated/queries.d.ts +64 -0
  627. package/dist/types/generated/queries.d.ts.map +1 -0
  628. package/dist/types/generated/queries.js +729 -0
  629. package/dist/types/generated/queries.js.map +1 -0
  630. package/dist/types/generated/types.d.ts +9678 -0
  631. package/dist/types/generated/types.d.ts.map +1 -0
  632. package/dist/types/generated/types.js +1265 -0
  633. package/dist/types/generated/types.js.map +1 -0
  634. package/dist/types/index.d.ts +4 -0
  635. package/dist/types/index.d.ts.map +1 -0
  636. package/dist/types/index.js +4 -0
  637. package/dist/types/index.js.map +1 -0
  638. package/dist/types/indexer.d.ts +182 -0
  639. package/dist/types/indexer.d.ts.map +1 -0
  640. package/dist/types/indexer.js +4 -0
  641. package/dist/types/indexer.js.map +1 -0
  642. package/dist/types/keyless.d.ts +101 -0
  643. package/dist/types/keyless.d.ts.map +1 -0
  644. package/dist/types/keyless.js +2 -0
  645. package/dist/types/keyless.js.map +1 -0
  646. package/dist/types/types.d.ts +1572 -0
  647. package/dist/types/types.d.ts.map +1 -0
  648. package/dist/types/types.js +464 -0
  649. package/dist/types/types.js.map +1 -0
  650. package/dist/utils/apiEndpoints.d.ts +50 -0
  651. package/dist/utils/apiEndpoints.d.ts.map +1 -0
  652. package/dist/utils/apiEndpoints.js +100 -0
  653. package/dist/utils/apiEndpoints.js.map +1 -0
  654. package/dist/utils/const.d.ts +117 -0
  655. package/dist/utils/const.d.ts.map +1 -0
  656. package/dist/utils/const.js +121 -0
  657. package/dist/utils/const.js.map +1 -0
  658. package/dist/utils/helpers.d.ts +203 -0
  659. package/dist/utils/helpers.d.ts.map +1 -0
  660. package/dist/utils/helpers.js +330 -0
  661. package/dist/utils/helpers.js.map +1 -0
  662. package/dist/utils/index.d.ts +5 -0
  663. package/dist/utils/index.d.ts.map +1 -0
  664. package/dist/utils/index.js +5 -0
  665. package/dist/utils/index.js.map +1 -0
  666. package/dist/utils/memoize.d.ts +47 -0
  667. package/dist/utils/memoize.d.ts.map +1 -0
  668. package/dist/utils/memoize.js +195 -0
  669. package/dist/utils/memoize.js.map +1 -0
  670. package/dist/utils/normalizeBundle.d.ts +27 -0
  671. package/dist/utils/normalizeBundle.d.ts.map +1 -0
  672. package/dist/utils/normalizeBundle.js +18 -0
  673. package/dist/utils/normalizeBundle.js.map +1 -0
  674. package/dist/utils/runtime.d.ts +44 -0
  675. package/dist/utils/runtime.d.ts.map +1 -0
  676. package/dist/utils/runtime.js +71 -0
  677. package/dist/utils/runtime.js.map +1 -0
  678. package/dist/version.d.ts +7 -0
  679. package/dist/version.d.ts.map +1 -0
  680. package/dist/version.js +9 -0
  681. package/dist/version.js.map +1 -0
  682. package/package.json +107 -47
  683. package/src/account/AbstractKeylessAccount.ts +24 -30
  684. package/src/account/AbstractedAccount.ts +18 -16
  685. package/src/account/Account.ts +12 -9
  686. package/src/account/AccountUtils.ts +17 -20
  687. package/src/account/DerivableAbstractedAccount.ts +12 -10
  688. package/src/account/Ed25519Account.ts +8 -8
  689. package/src/account/EphemeralKeyPair.ts +9 -14
  690. package/src/account/FederatedKeylessAccount.ts +7 -7
  691. package/src/account/KeylessAccount.ts +12 -7
  692. package/src/account/MultiEd25519Account.ts +9 -9
  693. package/src/account/MultiKeyAccount.ts +15 -16
  694. package/src/account/SingleKeyAccount.ts +10 -13
  695. package/src/account/index.ts +17 -12
  696. package/src/account/keylessSigner.ts +34 -0
  697. package/src/account/utils.ts +3 -3
  698. package/src/api/account/abstraction.ts +12 -12
  699. package/src/api/account.ts +12 -12
  700. package/src/api/ans.ts +6 -6
  701. package/src/api/aptos.ts +115 -88
  702. package/src/api/aptosConfig.ts +6 -4
  703. package/src/api/coin.ts +6 -6
  704. package/src/api/digitalAsset.ts +9 -9
  705. package/src/api/faucet.ts +6 -6
  706. package/src/api/fungibleAsset.ts +10 -10
  707. package/src/api/general.ts +7 -7
  708. package/src/api/index.ts +2 -2
  709. package/src/api/keyless.ts +11 -7
  710. package/src/api/object.ts +6 -6
  711. package/src/api/staking.ts +11 -6
  712. package/src/api/table.ts +6 -6
  713. package/src/api/transaction.ts +13 -13
  714. package/src/api/transactionSubmission/build.ts +6 -6
  715. package/src/api/transactionSubmission/helpers.ts +2 -2
  716. package/src/api/transactionSubmission/management.ts +9 -5
  717. package/src/api/transactionSubmission/sign.ts +4 -4
  718. package/src/api/transactionSubmission/simulate.ts +6 -6
  719. package/src/api/transactionSubmission/submit.ts +5 -5
  720. package/src/api/utils.ts +4 -4
  721. package/src/bcs/consts.ts +14 -1
  722. package/src/bcs/deserializer.ts +3 -3
  723. package/src/bcs/index.ts +6 -6
  724. package/src/bcs/serializable/entryFunctionBytes.ts +5 -5
  725. package/src/bcs/serializable/fixedBytes.ts +5 -5
  726. package/src/bcs/serializable/movePrimitives.ts +14 -5
  727. package/src/bcs/serializable/moveStructs.ts +8 -8
  728. package/src/bcs/serializer.ts +6 -6
  729. package/src/cli/index.ts +2 -2
  730. package/src/cli/localNode.ts +1 -1
  731. package/src/cli/move.ts +6 -10
  732. package/src/client/core.ts +30 -15
  733. package/src/client/get.ts +6 -8
  734. package/src/client/index.ts +3 -3
  735. package/src/client/post.ts +4 -4
  736. package/src/core/account/index.ts +1 -1
  737. package/src/core/account/utils/address.ts +4 -4
  738. package/src/core/account/utils/index.ts +1 -1
  739. package/src/core/accountAddress.ts +6 -6
  740. package/src/core/authenticationKey.ts +22 -10
  741. package/src/core/crypto/abstraction.ts +7 -7
  742. package/src/core/crypto/anyKeyRegistry.ts +90 -0
  743. package/src/core/crypto/deserializationUtils.ts +11 -19
  744. package/src/core/crypto/ed25519.ts +22 -13
  745. package/src/core/crypto/encryption/ciphertext.ts +210 -0
  746. package/src/core/crypto/encryption/curveSerialization.ts +46 -0
  747. package/src/core/crypto/encryption/fieldSerialization.ts +82 -0
  748. package/src/core/crypto/encryption/index.ts +14 -0
  749. package/src/core/crypto/encryption/symmetric.ts +148 -0
  750. package/src/core/crypto/ephemeral.ts +7 -7
  751. package/src/core/crypto/federatedKeyless.ts +8 -8
  752. package/src/core/crypto/hdKey.ts +7 -3
  753. package/src/core/crypto/index.ts +24 -17
  754. package/src/core/crypto/keyless.ts +33 -33
  755. package/src/core/crypto/keylessRegistration.ts +34 -0
  756. package/src/core/crypto/multiEd25519.ts +7 -7
  757. package/src/core/crypto/multiKey.ts +8 -8
  758. package/src/core/crypto/poseidon.ts +2 -2
  759. package/src/core/crypto/privateKey.ts +5 -5
  760. package/src/core/crypto/proof.ts +1 -1
  761. package/src/core/crypto/publicKey.ts +6 -6
  762. package/src/core/crypto/secp256k1.ts +26 -19
  763. package/src/core/crypto/secp256r1.ts +26 -19
  764. package/src/core/crypto/signature.ts +2 -2
  765. package/src/core/crypto/singleKey.ts +58 -39
  766. package/src/core/crypto/types.ts +4 -4
  767. package/src/core/crypto/utils.ts +16 -12
  768. package/src/core/hex.ts +3 -3
  769. package/src/core/index.ts +6 -6
  770. package/src/errors/index.ts +3 -3
  771. package/src/functions/abstraction.ts +11 -0
  772. package/src/functions/account.ts +38 -0
  773. package/src/functions/ans.ts +26 -0
  774. package/src/functions/coin.ts +7 -0
  775. package/src/functions/digitalAsset.ts +32 -0
  776. package/src/functions/faucet.ts +7 -0
  777. package/src/functions/fungibleAsset.ts +13 -0
  778. package/src/functions/general.ts +14 -0
  779. package/src/functions/index.ts +21 -0
  780. package/src/functions/keyless.ts +42 -0
  781. package/src/functions/object.ts +10 -0
  782. package/src/functions/staking.ts +11 -0
  783. package/src/functions/table.ts +11 -0
  784. package/src/functions/transaction.ts +32 -0
  785. package/src/functions/view.ts +6 -0
  786. package/src/index.ts +36 -10
  787. package/src/internal/abstraction.ts +10 -10
  788. package/src/internal/account.ts +79 -51
  789. package/src/internal/ans.ts +31 -24
  790. package/src/internal/coin.ts +8 -8
  791. package/src/internal/digitalAsset.ts +14 -15
  792. package/src/internal/encryptionKey.ts +53 -0
  793. package/src/internal/faucet.ts +6 -6
  794. package/src/internal/fungibleAsset.ts +11 -11
  795. package/src/internal/general.ts +12 -7
  796. package/src/internal/keyless.ts +21 -18
  797. package/src/internal/object.ts +7 -7
  798. package/src/internal/staking.ts +6 -6
  799. package/src/internal/table.ts +7 -7
  800. package/src/internal/transaction.ts +11 -10
  801. package/src/internal/transactionSubmission.ts +92 -32
  802. package/src/internal/utils/index.ts +1 -1
  803. package/src/internal/utils/utils.ts +5 -5
  804. package/src/internal/view.ts +5 -5
  805. package/src/transactions/authenticator/account.ts +12 -12
  806. package/src/transactions/authenticator/index.ts +2 -2
  807. package/src/transactions/authenticator/transaction.ts +6 -6
  808. package/src/transactions/index.ts +6 -6
  809. package/src/transactions/instances/chainId.ts +2 -2
  810. package/src/transactions/instances/encryptedPayload.ts +149 -0
  811. package/src/transactions/instances/identifier.ts +2 -2
  812. package/src/transactions/instances/index.ts +11 -10
  813. package/src/transactions/instances/moduleId.ts +5 -5
  814. package/src/transactions/instances/multiAgentTransaction.ts +4 -4
  815. package/src/transactions/instances/rawTransaction.ts +6 -6
  816. package/src/transactions/instances/rotationProofChallenge.ts +5 -5
  817. package/src/transactions/instances/signedTransaction.ts +4 -4
  818. package/src/transactions/instances/simpleTransaction.ts +4 -4
  819. package/src/transactions/instances/transactionArgument.ts +2 -2
  820. package/src/transactions/instances/transactionPayload.ts +127 -28
  821. package/src/transactions/management/accountSequenceNumber.ts +13 -14
  822. package/src/transactions/management/index.ts +2 -2
  823. package/src/transactions/management/transactionWorker.ts +10 -10
  824. package/src/transactions/transactionBuilder/encryptPayload.ts +236 -0
  825. package/src/transactions/transactionBuilder/helpers.ts +8 -5
  826. package/src/transactions/transactionBuilder/index.ts +5 -4
  827. package/src/transactions/transactionBuilder/remoteAbi.ts +664 -25
  828. package/src/transactions/transactionBuilder/signingMessage.ts +6 -6
  829. package/src/transactions/transactionBuilder/structEnumParser.ts +848 -0
  830. package/src/transactions/transactionBuilder/transactionBuilder.ts +130 -72
  831. package/src/transactions/typeTag/index.ts +5 -5
  832. package/src/transactions/typeTag/parser.ts +3 -3
  833. package/src/transactions/types.ts +103 -19
  834. package/src/types/ans.ts +13 -5
  835. package/src/types/generated/operations.ts +4 -3
  836. package/src/types/generated/queries.ts +1 -1
  837. package/src/types/index.ts +3 -3
  838. package/src/types/indexer.ts +1 -1
  839. package/src/types/types.ts +74 -6
  840. package/src/utils/const.ts +14 -1
  841. package/src/utils/helpers.ts +58 -18
  842. package/src/utils/index.ts +4 -4
  843. package/src/utils/normalizeBundle.ts +1 -1
  844. package/src/utils/runtime.ts +86 -0
  845. package/src/version.ts +1 -1
  846. package/dist/common/account-2FUAPVPW.d.ts +0 -8167
  847. package/dist/common/chunk-L5DUJTE3.js +0 -4
  848. package/dist/common/chunk-L5DUJTE3.js.map +0 -1
  849. package/dist/common/cli/index.d.ts +0 -316
  850. package/dist/common/cli/index.js +0 -2
  851. package/dist/common/cli/index.js.map +0 -1
  852. package/dist/common/index.d.ts +0 -10912
  853. package/dist/common/index.js +0 -476
  854. package/dist/common/index.js.map +0 -1
  855. package/dist/esm/Ed25519Account-DpZh3fRy.d.mts +0 -628
  856. package/dist/esm/account/AbstractKeylessAccount.d.mts +0 -336
  857. package/dist/esm/account/AbstractKeylessAccount.mjs +0 -2
  858. package/dist/esm/account/AbstractKeylessAccount.mjs.map +0 -1
  859. package/dist/esm/account/AbstractedAccount.d.mts +0 -64
  860. package/dist/esm/account/AbstractedAccount.mjs +0 -2
  861. package/dist/esm/account/AbstractedAccount.mjs.map +0 -1
  862. package/dist/esm/account/Account.d.mts +0 -8
  863. package/dist/esm/account/Account.mjs +0 -2
  864. package/dist/esm/account/Account.mjs.map +0 -1
  865. package/dist/esm/account/AccountUtils.d.mts +0 -38
  866. package/dist/esm/account/AccountUtils.mjs +0 -2
  867. package/dist/esm/account/AccountUtils.mjs.map +0 -1
  868. package/dist/esm/account/DerivableAbstractedAccount.d.mts +0 -59
  869. package/dist/esm/account/DerivableAbstractedAccount.mjs +0 -2
  870. package/dist/esm/account/DerivableAbstractedAccount.mjs.map +0 -1
  871. package/dist/esm/account/Ed25519Account.d.mts +0 -8
  872. package/dist/esm/account/Ed25519Account.mjs +0 -2
  873. package/dist/esm/account/Ed25519Account.mjs.map +0 -1
  874. package/dist/esm/account/EphemeralKeyPair.d.mts +0 -165
  875. package/dist/esm/account/EphemeralKeyPair.mjs +0 -2
  876. package/dist/esm/account/EphemeralKeyPair.mjs.map +0 -1
  877. package/dist/esm/account/FederatedKeylessAccount.d.mts +0 -118
  878. package/dist/esm/account/FederatedKeylessAccount.mjs +0 -2
  879. package/dist/esm/account/FederatedKeylessAccount.mjs.map +0 -1
  880. package/dist/esm/account/KeylessAccount.d.mts +0 -124
  881. package/dist/esm/account/KeylessAccount.mjs +0 -2
  882. package/dist/esm/account/KeylessAccount.mjs.map +0 -1
  883. package/dist/esm/account/MultiEd25519Account.d.mts +0 -102
  884. package/dist/esm/account/MultiEd25519Account.mjs +0 -2
  885. package/dist/esm/account/MultiEd25519Account.mjs.map +0 -1
  886. package/dist/esm/account/MultiKeyAccount.d.mts +0 -206
  887. package/dist/esm/account/MultiKeyAccount.mjs +0 -2
  888. package/dist/esm/account/MultiKeyAccount.mjs.map +0 -1
  889. package/dist/esm/account/SingleKeyAccount.d.mts +0 -8
  890. package/dist/esm/account/SingleKeyAccount.mjs +0 -2
  891. package/dist/esm/account/SingleKeyAccount.mjs.map +0 -1
  892. package/dist/esm/account/index.d.mts +0 -24
  893. package/dist/esm/account/index.mjs +0 -2
  894. package/dist/esm/account/index.mjs.map +0 -1
  895. package/dist/esm/account/utils.d.mts +0 -14
  896. package/dist/esm/account/utils.mjs +0 -2
  897. package/dist/esm/account/utils.mjs.map +0 -1
  898. package/dist/esm/account-sIOs_9XJ.d.mts +0 -7369
  899. package/dist/esm/api/account/abstraction.d.mts +0 -181
  900. package/dist/esm/api/account/abstraction.mjs +0 -2
  901. package/dist/esm/api/account/abstraction.mjs.map +0 -1
  902. package/dist/esm/api/account.d.mts +0 -852
  903. package/dist/esm/api/account.mjs +0 -2
  904. package/dist/esm/api/account.mjs.map +0 -1
  905. package/dist/esm/api/ans.d.mts +0 -570
  906. package/dist/esm/api/ans.mjs +0 -2
  907. package/dist/esm/api/ans.mjs.map +0 -1
  908. package/dist/esm/api/aptos.d.mts +0 -114
  909. package/dist/esm/api/aptos.mjs +0 -2
  910. package/dist/esm/api/aptos.mjs.map +0 -1
  911. package/dist/esm/api/aptosConfig.d.mts +0 -7
  912. package/dist/esm/api/aptosConfig.mjs +0 -2
  913. package/dist/esm/api/aptosConfig.mjs.map +0 -1
  914. package/dist/esm/api/coin.d.mts +0 -81
  915. package/dist/esm/api/coin.mjs +0 -2
  916. package/dist/esm/api/coin.mjs.map +0 -1
  917. package/dist/esm/api/digitalAsset.d.mts +0 -1030
  918. package/dist/esm/api/digitalAsset.mjs +0 -2
  919. package/dist/esm/api/digitalAsset.mjs.map +0 -1
  920. package/dist/esm/api/faucet.d.mts +0 -80
  921. package/dist/esm/api/faucet.mjs +0 -2
  922. package/dist/esm/api/faucet.mjs.map +0 -1
  923. package/dist/esm/api/fungibleAsset.d.mts +0 -288
  924. package/dist/esm/api/fungibleAsset.mjs +0 -2
  925. package/dist/esm/api/fungibleAsset.mjs.map +0 -1
  926. package/dist/esm/api/general.d.mts +0 -303
  927. package/dist/esm/api/general.mjs +0 -2
  928. package/dist/esm/api/general.mjs.map +0 -1
  929. package/dist/esm/api/index.d.mts +0 -47
  930. package/dist/esm/api/index.mjs +0 -2
  931. package/dist/esm/api/index.mjs.map +0 -1
  932. package/dist/esm/api/keyless.d.mts +0 -170
  933. package/dist/esm/api/keyless.mjs +0 -2
  934. package/dist/esm/api/keyless.mjs.map +0 -1
  935. package/dist/esm/api/object.d.mts +0 -80
  936. package/dist/esm/api/object.mjs +0 -2
  937. package/dist/esm/api/object.mjs.map +0 -1
  938. package/dist/esm/api/staking.d.mts +0 -134
  939. package/dist/esm/api/staking.mjs +0 -2
  940. package/dist/esm/api/staking.mjs.map +0 -1
  941. package/dist/esm/api/table.d.mts +0 -169
  942. package/dist/esm/api/table.mjs +0 -2
  943. package/dist/esm/api/table.mjs.map +0 -1
  944. package/dist/esm/api/transaction.d.mts +0 -681
  945. package/dist/esm/api/transaction.mjs +0 -2
  946. package/dist/esm/api/transaction.mjs.map +0 -1
  947. package/dist/esm/api/transactionSubmission/build.d.mts +0 -141
  948. package/dist/esm/api/transactionSubmission/build.mjs +0 -2
  949. package/dist/esm/api/transactionSubmission/build.mjs.map +0 -1
  950. package/dist/esm/api/transactionSubmission/helpers.d.mts +0 -98
  951. package/dist/esm/api/transactionSubmission/helpers.mjs +0 -2
  952. package/dist/esm/api/transactionSubmission/helpers.mjs.map +0 -1
  953. package/dist/esm/api/transactionSubmission/management.d.mts +0 -168
  954. package/dist/esm/api/transactionSubmission/management.mjs +0 -2
  955. package/dist/esm/api/transactionSubmission/management.mjs.map +0 -1
  956. package/dist/esm/api/transactionSubmission/sign.d.mts +0 -124
  957. package/dist/esm/api/transactionSubmission/sign.mjs +0 -2
  958. package/dist/esm/api/transactionSubmission/sign.mjs.map +0 -1
  959. package/dist/esm/api/transactionSubmission/simulate.d.mts +0 -181
  960. package/dist/esm/api/transactionSubmission/simulate.mjs +0 -2
  961. package/dist/esm/api/transactionSubmission/simulate.mjs.map +0 -1
  962. package/dist/esm/api/transactionSubmission/submit.d.mts +0 -142
  963. package/dist/esm/api/transactionSubmission/submit.mjs +0 -2
  964. package/dist/esm/api/transactionSubmission/submit.mjs.map +0 -1
  965. package/dist/esm/api/utils.d.mts +0 -45
  966. package/dist/esm/api/utils.mjs +0 -2
  967. package/dist/esm/api/utils.mjs.map +0 -1
  968. package/dist/esm/bcs/consts.d.mts +0 -28
  969. package/dist/esm/bcs/consts.mjs +0 -2
  970. package/dist/esm/bcs/consts.mjs.map +0 -1
  971. package/dist/esm/bcs/deserializer.d.mts +0 -7
  972. package/dist/esm/bcs/deserializer.mjs +0 -2
  973. package/dist/esm/bcs/deserializer.mjs.map +0 -1
  974. package/dist/esm/bcs/index.d.mts +0 -8
  975. package/dist/esm/bcs/index.mjs +0 -2
  976. package/dist/esm/bcs/index.mjs.map +0 -1
  977. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +0 -65
  978. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +0 -2
  979. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +0 -1
  980. package/dist/esm/bcs/serializable/fixedBytes.d.mts +0 -7
  981. package/dist/esm/bcs/serializable/fixedBytes.mjs +0 -2
  982. package/dist/esm/bcs/serializable/fixedBytes.mjs.map +0 -1
  983. package/dist/esm/bcs/serializable/movePrimitives.d.mts +0 -7
  984. package/dist/esm/bcs/serializable/movePrimitives.mjs +0 -2
  985. package/dist/esm/bcs/serializable/movePrimitives.mjs.map +0 -1
  986. package/dist/esm/bcs/serializable/moveStructs.d.mts +0 -7
  987. package/dist/esm/bcs/serializable/moveStructs.mjs +0 -2
  988. package/dist/esm/bcs/serializable/moveStructs.mjs.map +0 -1
  989. package/dist/esm/bcs/serializer.d.mts +0 -7
  990. package/dist/esm/bcs/serializer.mjs +0 -2
  991. package/dist/esm/bcs/serializer.mjs.map +0 -1
  992. package/dist/esm/chunk-226FBOWQ.mjs +0 -2
  993. package/dist/esm/chunk-226FBOWQ.mjs.map +0 -1
  994. package/dist/esm/chunk-2DQRUJUC.mjs +0 -2
  995. package/dist/esm/chunk-2DQRUJUC.mjs.map +0 -1
  996. package/dist/esm/chunk-2EBXCCLB.mjs +0 -2
  997. package/dist/esm/chunk-2EBXCCLB.mjs.map +0 -1
  998. package/dist/esm/chunk-2YA4KQUV.mjs +0 -2
  999. package/dist/esm/chunk-2YA4KQUV.mjs.map +0 -1
  1000. package/dist/esm/chunk-3ZC6F5SJ.mjs +0 -2
  1001. package/dist/esm/chunk-3ZC6F5SJ.mjs.map +0 -1
  1002. package/dist/esm/chunk-44MMFX5F.mjs +0 -2
  1003. package/dist/esm/chunk-44MMFX5F.mjs.map +0 -1
  1004. package/dist/esm/chunk-4KEZEYCV.mjs +0 -2
  1005. package/dist/esm/chunk-4KEZEYCV.mjs.map +0 -1
  1006. package/dist/esm/chunk-4QMXOWHP.mjs +0 -1
  1007. package/dist/esm/chunk-4QMXOWHP.mjs.map +0 -1
  1008. package/dist/esm/chunk-4WPQQPUF.mjs +0 -1
  1009. package/dist/esm/chunk-4WPQQPUF.mjs.map +0 -1
  1010. package/dist/esm/chunk-5HXLZHDW.mjs +0 -1
  1011. package/dist/esm/chunk-5HXLZHDW.mjs.map +0 -1
  1012. package/dist/esm/chunk-6T2OBPIF.mjs +0 -4
  1013. package/dist/esm/chunk-6T2OBPIF.mjs.map +0 -1
  1014. package/dist/esm/chunk-7ECCT6PK.mjs +0 -1
  1015. package/dist/esm/chunk-7ECCT6PK.mjs.map +0 -1
  1016. package/dist/esm/chunk-A5H5VKUI.mjs +0 -2
  1017. package/dist/esm/chunk-A5H5VKUI.mjs.map +0 -1
  1018. package/dist/esm/chunk-A5L76YP7.mjs +0 -2
  1019. package/dist/esm/chunk-A5L76YP7.mjs.map +0 -1
  1020. package/dist/esm/chunk-C3Q23D22.mjs +0 -2
  1021. package/dist/esm/chunk-C3Q23D22.mjs.map +0 -1
  1022. package/dist/esm/chunk-DE5K76I2.mjs +0 -1
  1023. package/dist/esm/chunk-DE5K76I2.mjs.map +0 -1
  1024. package/dist/esm/chunk-DPHBSAZQ.mjs +0 -2
  1025. package/dist/esm/chunk-DPHBSAZQ.mjs.map +0 -1
  1026. package/dist/esm/chunk-F45HI7LU.mjs +0 -2
  1027. package/dist/esm/chunk-F45HI7LU.mjs.map +0 -1
  1028. package/dist/esm/chunk-F4RJMSAW.mjs +0 -2
  1029. package/dist/esm/chunk-F4RJMSAW.mjs.map +0 -1
  1030. package/dist/esm/chunk-FAOLAKLJ.mjs +0 -2
  1031. package/dist/esm/chunk-FAOLAKLJ.mjs.map +0 -1
  1032. package/dist/esm/chunk-FZY4PMEE.mjs +0 -1
  1033. package/dist/esm/chunk-FZY4PMEE.mjs.map +0 -1
  1034. package/dist/esm/chunk-G3MHXDYA.mjs +0 -1
  1035. package/dist/esm/chunk-G3MHXDYA.mjs.map +0 -1
  1036. package/dist/esm/chunk-G5OONGWS.mjs +0 -488
  1037. package/dist/esm/chunk-G5OONGWS.mjs.map +0 -1
  1038. package/dist/esm/chunk-GJYLYE6R.mjs +0 -2
  1039. package/dist/esm/chunk-GJYLYE6R.mjs.map +0 -1
  1040. package/dist/esm/chunk-GYYSHYO5.mjs +0 -2
  1041. package/dist/esm/chunk-GYYSHYO5.mjs.map +0 -1
  1042. package/dist/esm/chunk-HGLO5LDS.mjs +0 -1
  1043. package/dist/esm/chunk-HGLO5LDS.mjs.map +0 -1
  1044. package/dist/esm/chunk-IEW452EO.mjs +0 -7
  1045. package/dist/esm/chunk-IEW452EO.mjs.map +0 -1
  1046. package/dist/esm/chunk-IF4UU2MT.mjs +0 -2
  1047. package/dist/esm/chunk-IF4UU2MT.mjs.map +0 -1
  1048. package/dist/esm/chunk-ITZN23GU.mjs +0 -2
  1049. package/dist/esm/chunk-ITZN23GU.mjs.map +0 -1
  1050. package/dist/esm/chunk-IZF6POVR.mjs +0 -4
  1051. package/dist/esm/chunk-IZF6POVR.mjs.map +0 -1
  1052. package/dist/esm/chunk-KDMSOCZY.mjs +0 -2
  1053. package/dist/esm/chunk-KDMSOCZY.mjs.map +0 -1
  1054. package/dist/esm/chunk-KKPH2JUV.mjs +0 -2
  1055. package/dist/esm/chunk-KKPH2JUV.mjs.map +0 -1
  1056. package/dist/esm/chunk-LVZ7QMUH.mjs +0 -2
  1057. package/dist/esm/chunk-LVZ7QMUH.mjs.map +0 -1
  1058. package/dist/esm/chunk-M65PXVDO.mjs +0 -2
  1059. package/dist/esm/chunk-M65PXVDO.mjs.map +0 -1
  1060. package/dist/esm/chunk-MKTR4U2R.mjs +0 -2
  1061. package/dist/esm/chunk-MKTR4U2R.mjs.map +0 -1
  1062. package/dist/esm/chunk-NECL5FCQ.mjs +0 -1
  1063. package/dist/esm/chunk-NECL5FCQ.mjs.map +0 -1
  1064. package/dist/esm/chunk-NHRPXEUE.mjs +0 -2
  1065. package/dist/esm/chunk-NHRPXEUE.mjs.map +0 -1
  1066. package/dist/esm/chunk-NNXTS2GB.mjs +0 -2
  1067. package/dist/esm/chunk-NNXTS2GB.mjs.map +0 -1
  1068. package/dist/esm/chunk-NP2IAUME.mjs +0 -2
  1069. package/dist/esm/chunk-NP2IAUME.mjs.map +0 -1
  1070. package/dist/esm/chunk-NPWYZVHE.mjs +0 -2
  1071. package/dist/esm/chunk-NPWYZVHE.mjs.map +0 -1
  1072. package/dist/esm/chunk-NTMFADQ7.mjs +0 -2
  1073. package/dist/esm/chunk-NTMFADQ7.mjs.map +0 -1
  1074. package/dist/esm/chunk-ODNZJSOC.mjs +0 -2
  1075. package/dist/esm/chunk-ODNZJSOC.mjs.map +0 -1
  1076. package/dist/esm/chunk-P5HCJN3A.mjs +0 -2
  1077. package/dist/esm/chunk-P5HCJN3A.mjs.map +0 -1
  1078. package/dist/esm/chunk-Q5ESW36C.mjs +0 -2
  1079. package/dist/esm/chunk-Q5ESW36C.mjs.map +0 -1
  1080. package/dist/esm/chunk-QE5MOGUI.mjs +0 -2
  1081. package/dist/esm/chunk-QE5MOGUI.mjs.map +0 -1
  1082. package/dist/esm/chunk-RB2GC7FW.mjs +0 -2
  1083. package/dist/esm/chunk-RB2GC7FW.mjs.map +0 -1
  1084. package/dist/esm/chunk-RUKFK3OC.mjs +0 -2
  1085. package/dist/esm/chunk-RUKFK3OC.mjs.map +0 -1
  1086. package/dist/esm/chunk-RYCI4VKO.mjs +0 -2
  1087. package/dist/esm/chunk-RYCI4VKO.mjs.map +0 -1
  1088. package/dist/esm/chunk-RZNP3WG4.mjs +0 -2
  1089. package/dist/esm/chunk-RZNP3WG4.mjs.map +0 -1
  1090. package/dist/esm/chunk-STY74NUA.mjs +0 -2
  1091. package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
  1092. package/dist/esm/chunk-TAHLOBRG.mjs +0 -2
  1093. package/dist/esm/chunk-TAHLOBRG.mjs.map +0 -1
  1094. package/dist/esm/chunk-TBIK7DML.mjs +0 -2
  1095. package/dist/esm/chunk-TBIK7DML.mjs.map +0 -1
  1096. package/dist/esm/chunk-UVJW4DPP.mjs +0 -2
  1097. package/dist/esm/chunk-UVJW4DPP.mjs.map +0 -1
  1098. package/dist/esm/chunk-UVNAHETD.mjs +0 -2
  1099. package/dist/esm/chunk-UVNAHETD.mjs.map +0 -1
  1100. package/dist/esm/chunk-UYVPNUH3.mjs +0 -1
  1101. package/dist/esm/chunk-UYVPNUH3.mjs.map +0 -1
  1102. package/dist/esm/chunk-V3MBJJTL.mjs +0 -1
  1103. package/dist/esm/chunk-V3MBJJTL.mjs.map +0 -1
  1104. package/dist/esm/chunk-WOPHK7LB.mjs +0 -2
  1105. package/dist/esm/chunk-WOPHK7LB.mjs.map +0 -1
  1106. package/dist/esm/chunk-WZZ7PJ3X.mjs +0 -2
  1107. package/dist/esm/chunk-WZZ7PJ3X.mjs.map +0 -1
  1108. package/dist/esm/chunk-X2TPNKLV.mjs +0 -2
  1109. package/dist/esm/chunk-X2TPNKLV.mjs.map +0 -1
  1110. package/dist/esm/chunk-ZOSOF6ST.mjs +0 -2
  1111. package/dist/esm/chunk-ZOSOF6ST.mjs.map +0 -1
  1112. package/dist/esm/chunk-ZP4DWSQA.mjs +0 -2
  1113. package/dist/esm/chunk-ZP4DWSQA.mjs.map +0 -1
  1114. package/dist/esm/cli/index.d.mts +0 -10
  1115. package/dist/esm/cli/index.mjs +0 -2
  1116. package/dist/esm/cli/index.mjs.map +0 -1
  1117. package/dist/esm/cli/localNode.d.mts +0 -67
  1118. package/dist/esm/cli/localNode.mjs +0 -2
  1119. package/dist/esm/cli/localNode.mjs.map +0 -1
  1120. package/dist/esm/cli/move.d.mts +0 -257
  1121. package/dist/esm/cli/move.mjs +0 -2
  1122. package/dist/esm/cli/move.mjs.map +0 -1
  1123. package/dist/esm/client/core.d.mts +0 -43
  1124. package/dist/esm/client/core.mjs +0 -2
  1125. package/dist/esm/client/core.mjs.map +0 -1
  1126. package/dist/esm/client/get.d.mts +0 -125
  1127. package/dist/esm/client/get.mjs +0 -2
  1128. package/dist/esm/client/get.mjs.map +0 -1
  1129. package/dist/esm/client/index.d.mts +0 -10
  1130. package/dist/esm/client/index.mjs +0 -2
  1131. package/dist/esm/client/index.mjs.map +0 -1
  1132. package/dist/esm/client/post.d.mts +0 -161
  1133. package/dist/esm/client/post.mjs +0 -2
  1134. package/dist/esm/client/post.mjs.map +0 -1
  1135. package/dist/esm/core/account/index.d.mts +0 -8
  1136. package/dist/esm/core/account/index.mjs +0 -2
  1137. package/dist/esm/core/account/index.mjs.map +0 -1
  1138. package/dist/esm/core/account/utils/address.d.mts +0 -55
  1139. package/dist/esm/core/account/utils/address.mjs +0 -2
  1140. package/dist/esm/core/account/utils/address.mjs.map +0 -1
  1141. package/dist/esm/core/account/utils/index.d.mts +0 -8
  1142. package/dist/esm/core/account/utils/index.mjs +0 -2
  1143. package/dist/esm/core/account/utils/index.mjs.map +0 -1
  1144. package/dist/esm/core/accountAddress.d.mts +0 -7
  1145. package/dist/esm/core/accountAddress.mjs +0 -2
  1146. package/dist/esm/core/accountAddress.mjs.map +0 -1
  1147. package/dist/esm/core/authenticationKey.d.mts +0 -7
  1148. package/dist/esm/core/authenticationKey.mjs +0 -2
  1149. package/dist/esm/core/authenticationKey.mjs.map +0 -1
  1150. package/dist/esm/core/common.d.mts +0 -52
  1151. package/dist/esm/core/common.mjs +0 -2
  1152. package/dist/esm/core/common.mjs.map +0 -1
  1153. package/dist/esm/core/crypto/abstraction.d.mts +0 -24
  1154. package/dist/esm/core/crypto/abstraction.mjs +0 -2
  1155. package/dist/esm/core/crypto/abstraction.mjs.map +0 -1
  1156. package/dist/esm/core/crypto/deserializationUtils.d.mts +0 -28
  1157. package/dist/esm/core/crypto/deserializationUtils.mjs +0 -2
  1158. package/dist/esm/core/crypto/deserializationUtils.mjs.map +0 -1
  1159. package/dist/esm/core/crypto/ed25519.d.mts +0 -7
  1160. package/dist/esm/core/crypto/ed25519.mjs +0 -2
  1161. package/dist/esm/core/crypto/ed25519.mjs.map +0 -1
  1162. package/dist/esm/core/crypto/ephemeral.d.mts +0 -116
  1163. package/dist/esm/core/crypto/ephemeral.mjs +0 -2
  1164. package/dist/esm/core/crypto/ephemeral.mjs.map +0 -1
  1165. package/dist/esm/core/crypto/federatedKeyless.d.mts +0 -13
  1166. package/dist/esm/core/crypto/federatedKeyless.mjs +0 -2
  1167. package/dist/esm/core/crypto/federatedKeyless.mjs.map +0 -1
  1168. package/dist/esm/core/crypto/hdKey.d.mts +0 -95
  1169. package/dist/esm/core/crypto/hdKey.mjs +0 -2
  1170. package/dist/esm/core/crypto/hdKey.mjs.map +0 -1
  1171. package/dist/esm/core/crypto/index.d.mts +0 -19
  1172. package/dist/esm/core/crypto/index.mjs +0 -2
  1173. package/dist/esm/core/crypto/index.mjs.map +0 -1
  1174. package/dist/esm/core/crypto/keyless.d.mts +0 -13
  1175. package/dist/esm/core/crypto/keyless.mjs +0 -2
  1176. package/dist/esm/core/crypto/keyless.mjs.map +0 -1
  1177. package/dist/esm/core/crypto/multiEd25519.d.mts +0 -7
  1178. package/dist/esm/core/crypto/multiEd25519.mjs +0 -2
  1179. package/dist/esm/core/crypto/multiEd25519.mjs.map +0 -1
  1180. package/dist/esm/core/crypto/multiKey.d.mts +0 -7
  1181. package/dist/esm/core/crypto/multiKey.mjs +0 -2
  1182. package/dist/esm/core/crypto/multiKey.mjs.map +0 -1
  1183. package/dist/esm/core/crypto/poseidon.d.mts +0 -59
  1184. package/dist/esm/core/crypto/poseidon.mjs +0 -2
  1185. package/dist/esm/core/crypto/poseidon.mjs.map +0 -1
  1186. package/dist/esm/core/crypto/privateKey.d.mts +0 -7
  1187. package/dist/esm/core/crypto/privateKey.mjs +0 -2
  1188. package/dist/esm/core/crypto/privateKey.mjs.map +0 -1
  1189. package/dist/esm/core/crypto/proof.d.mts +0 -18
  1190. package/dist/esm/core/crypto/proof.mjs +0 -2
  1191. package/dist/esm/core/crypto/proof.mjs.map +0 -1
  1192. package/dist/esm/core/crypto/publicKey.d.mts +0 -7
  1193. package/dist/esm/core/crypto/publicKey.mjs +0 -2
  1194. package/dist/esm/core/crypto/publicKey.mjs.map +0 -1
  1195. package/dist/esm/core/crypto/secp256k1.d.mts +0 -7
  1196. package/dist/esm/core/crypto/secp256k1.mjs +0 -2
  1197. package/dist/esm/core/crypto/secp256k1.mjs.map +0 -1
  1198. package/dist/esm/core/crypto/secp256r1.d.mts +0 -306
  1199. package/dist/esm/core/crypto/secp256r1.mjs +0 -2
  1200. package/dist/esm/core/crypto/secp256r1.mjs.map +0 -1
  1201. package/dist/esm/core/crypto/signature.d.mts +0 -7
  1202. package/dist/esm/core/crypto/signature.mjs +0 -2
  1203. package/dist/esm/core/crypto/signature.mjs.map +0 -1
  1204. package/dist/esm/core/crypto/singleKey.d.mts +0 -7
  1205. package/dist/esm/core/crypto/singleKey.mjs +0 -2
  1206. package/dist/esm/core/crypto/singleKey.mjs.map +0 -1
  1207. package/dist/esm/core/crypto/types.d.mts +0 -11
  1208. package/dist/esm/core/crypto/types.mjs +0 -2
  1209. package/dist/esm/core/crypto/types.mjs.map +0 -1
  1210. package/dist/esm/core/crypto/utils.d.mts +0 -23
  1211. package/dist/esm/core/crypto/utils.mjs +0 -2
  1212. package/dist/esm/core/crypto/utils.mjs.map +0 -1
  1213. package/dist/esm/core/hex.d.mts +0 -7
  1214. package/dist/esm/core/hex.mjs +0 -2
  1215. package/dist/esm/core/hex.mjs.map +0 -1
  1216. package/dist/esm/core/index.d.mts +0 -20
  1217. package/dist/esm/core/index.mjs +0 -2
  1218. package/dist/esm/core/index.mjs.map +0 -1
  1219. package/dist/esm/errors/index.d.mts +0 -131
  1220. package/dist/esm/errors/index.mjs +0 -2
  1221. package/dist/esm/errors/index.mjs.map +0 -1
  1222. package/dist/esm/federatedKeyless-Cuo0IGJ6.d.mts +0 -880
  1223. package/dist/esm/index.d.mts +0 -72
  1224. package/dist/esm/index.mjs +0 -2
  1225. package/dist/esm/index.mjs.map +0 -1
  1226. package/dist/esm/internal/abstraction.d.mts +0 -27
  1227. package/dist/esm/internal/abstraction.mjs +0 -2
  1228. package/dist/esm/internal/abstraction.mjs.map +0 -1
  1229. package/dist/esm/internal/account.d.mts +0 -453
  1230. package/dist/esm/internal/account.mjs +0 -2
  1231. package/dist/esm/internal/account.mjs.map +0 -1
  1232. package/dist/esm/internal/ans.d.mts +0 -417
  1233. package/dist/esm/internal/ans.mjs +0 -2
  1234. package/dist/esm/internal/ans.mjs.map +0 -1
  1235. package/dist/esm/internal/coin.d.mts +0 -31
  1236. package/dist/esm/internal/coin.mjs +0 -2
  1237. package/dist/esm/internal/coin.mjs.map +0 -1
  1238. package/dist/esm/internal/digitalAsset.d.mts +0 -580
  1239. package/dist/esm/internal/digitalAsset.mjs +0 -2
  1240. package/dist/esm/internal/digitalAsset.mjs.map +0 -1
  1241. package/dist/esm/internal/faucet.d.mts +0 -42
  1242. package/dist/esm/internal/faucet.mjs +0 -2
  1243. package/dist/esm/internal/faucet.mjs.map +0 -1
  1244. package/dist/esm/internal/fungibleAsset.d.mts +0 -112
  1245. package/dist/esm/internal/fungibleAsset.mjs +0 -2
  1246. package/dist/esm/internal/fungibleAsset.mjs.map +0 -1
  1247. package/dist/esm/internal/general.d.mts +0 -94
  1248. package/dist/esm/internal/general.mjs +0 -2
  1249. package/dist/esm/internal/general.mjs.map +0 -1
  1250. package/dist/esm/internal/keyless.d.mts +0 -111
  1251. package/dist/esm/internal/keyless.mjs +0 -2
  1252. package/dist/esm/internal/keyless.mjs.map +0 -1
  1253. package/dist/esm/internal/object.d.mts +0 -42
  1254. package/dist/esm/internal/object.mjs +0 -2
  1255. package/dist/esm/internal/object.mjs.map +0 -1
  1256. package/dist/esm/internal/staking.d.mts +0 -60
  1257. package/dist/esm/internal/staking.mjs +0 -2
  1258. package/dist/esm/internal/staking.mjs.map +0 -1
  1259. package/dist/esm/internal/table.d.mts +0 -66
  1260. package/dist/esm/internal/table.mjs +0 -2
  1261. package/dist/esm/internal/table.mjs.map +0 -1
  1262. package/dist/esm/internal/transaction.d.mts +0 -199
  1263. package/dist/esm/internal/transaction.mjs +0 -2
  1264. package/dist/esm/internal/transaction.mjs.map +0 -1
  1265. package/dist/esm/internal/transactionSubmission.d.mts +0 -165
  1266. package/dist/esm/internal/transactionSubmission.mjs +0 -2
  1267. package/dist/esm/internal/transactionSubmission.mjs.map +0 -1
  1268. package/dist/esm/internal/utils/index.d.mts +0 -8
  1269. package/dist/esm/internal/utils/index.mjs +0 -2
  1270. package/dist/esm/internal/utils/index.mjs.map +0 -1
  1271. package/dist/esm/internal/utils/utils.d.mts +0 -41
  1272. package/dist/esm/internal/utils/utils.mjs +0 -2
  1273. package/dist/esm/internal/utils/utils.mjs.map +0 -1
  1274. package/dist/esm/internal/view.d.mts +0 -20
  1275. package/dist/esm/internal/view.mjs +0 -2
  1276. package/dist/esm/internal/view.mjs.map +0 -1
  1277. package/dist/esm/transactions/authenticator/account.d.mts +0 -7
  1278. package/dist/esm/transactions/authenticator/account.mjs +0 -2
  1279. package/dist/esm/transactions/authenticator/account.mjs.map +0 -1
  1280. package/dist/esm/transactions/authenticator/index.d.mts +0 -8
  1281. package/dist/esm/transactions/authenticator/index.mjs +0 -2
  1282. package/dist/esm/transactions/authenticator/index.mjs.map +0 -1
  1283. package/dist/esm/transactions/authenticator/transaction.d.mts +0 -152
  1284. package/dist/esm/transactions/authenticator/transaction.mjs +0 -2
  1285. package/dist/esm/transactions/authenticator/transaction.mjs.map +0 -1
  1286. package/dist/esm/transactions/index.d.mts +0 -15
  1287. package/dist/esm/transactions/index.mjs +0 -2
  1288. package/dist/esm/transactions/index.mjs.map +0 -1
  1289. package/dist/esm/transactions/instances/chainId.d.mts +0 -7
  1290. package/dist/esm/transactions/instances/chainId.mjs +0 -2
  1291. package/dist/esm/transactions/instances/chainId.mjs.map +0 -1
  1292. package/dist/esm/transactions/instances/identifier.d.mts +0 -7
  1293. package/dist/esm/transactions/instances/identifier.mjs +0 -2
  1294. package/dist/esm/transactions/instances/identifier.mjs.map +0 -1
  1295. package/dist/esm/transactions/instances/index.d.mts +0 -10
  1296. package/dist/esm/transactions/instances/index.mjs +0 -2
  1297. package/dist/esm/transactions/instances/index.mjs.map +0 -1
  1298. package/dist/esm/transactions/instances/moduleId.d.mts +0 -7
  1299. package/dist/esm/transactions/instances/moduleId.mjs +0 -2
  1300. package/dist/esm/transactions/instances/moduleId.mjs.map +0 -1
  1301. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +0 -7
  1302. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +0 -2
  1303. package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +0 -1
  1304. package/dist/esm/transactions/instances/rawTransaction.d.mts +0 -7
  1305. package/dist/esm/transactions/instances/rawTransaction.mjs +0 -2
  1306. package/dist/esm/transactions/instances/rawTransaction.mjs.map +0 -1
  1307. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +0 -58
  1308. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +0 -2
  1309. package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +0 -1
  1310. package/dist/esm/transactions/instances/signedTransaction.d.mts +0 -59
  1311. package/dist/esm/transactions/instances/signedTransaction.mjs +0 -2
  1312. package/dist/esm/transactions/instances/signedTransaction.mjs.map +0 -1
  1313. package/dist/esm/transactions/instances/simpleTransaction.d.mts +0 -7
  1314. package/dist/esm/transactions/instances/simpleTransaction.mjs +0 -2
  1315. package/dist/esm/transactions/instances/simpleTransaction.mjs.map +0 -1
  1316. package/dist/esm/transactions/instances/transactionArgument.d.mts +0 -7
  1317. package/dist/esm/transactions/instances/transactionArgument.mjs +0 -2
  1318. package/dist/esm/transactions/instances/transactionArgument.mjs.map +0 -1
  1319. package/dist/esm/transactions/instances/transactionPayload.d.mts +0 -7
  1320. package/dist/esm/transactions/instances/transactionPayload.mjs +0 -2
  1321. package/dist/esm/transactions/instances/transactionPayload.mjs.map +0 -1
  1322. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +0 -123
  1323. package/dist/esm/transactions/management/accountSequenceNumber.mjs +0 -2
  1324. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +0 -1
  1325. package/dist/esm/transactions/management/asyncQueue.d.mts +0 -77
  1326. package/dist/esm/transactions/management/asyncQueue.mjs +0 -2
  1327. package/dist/esm/transactions/management/asyncQueue.mjs.map +0 -1
  1328. package/dist/esm/transactions/management/index.d.mts +0 -12
  1329. package/dist/esm/transactions/management/index.mjs +0 -2
  1330. package/dist/esm/transactions/management/index.mjs.map +0 -1
  1331. package/dist/esm/transactions/management/transactionWorker.d.mts +0 -218
  1332. package/dist/esm/transactions/management/transactionWorker.mjs +0 -2
  1333. package/dist/esm/transactions/management/transactionWorker.mjs.map +0 -1
  1334. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +0 -189
  1335. package/dist/esm/transactions/transactionBuilder/helpers.mjs +0 -2
  1336. package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +0 -1
  1337. package/dist/esm/transactions/transactionBuilder/index.d.mts +0 -11
  1338. package/dist/esm/transactions/transactionBuilder/index.mjs +0 -2
  1339. package/dist/esm/transactions/transactionBuilder/index.mjs.map +0 -1
  1340. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +0 -105
  1341. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +0 -2
  1342. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +0 -1
  1343. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +0 -62
  1344. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +0 -2
  1345. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +0 -1
  1346. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +0 -192
  1347. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +0 -2
  1348. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +0 -1
  1349. package/dist/esm/transactions/typeTag/index.d.mts +0 -7
  1350. package/dist/esm/transactions/typeTag/index.mjs +0 -2
  1351. package/dist/esm/transactions/typeTag/index.mjs.map +0 -1
  1352. package/dist/esm/transactions/typeTag/parser.d.mts +0 -81
  1353. package/dist/esm/transactions/typeTag/parser.mjs +0 -2
  1354. package/dist/esm/transactions/typeTag/parser.mjs.map +0 -1
  1355. package/dist/esm/transactions/types.d.mts +0 -7
  1356. package/dist/esm/transactions/types.mjs +0 -2
  1357. package/dist/esm/transactions/types.mjs.map +0 -1
  1358. package/dist/esm/types/abstraction.d.mts +0 -15
  1359. package/dist/esm/types/abstraction.mjs +0 -2
  1360. package/dist/esm/types/abstraction.mjs.map +0 -1
  1361. package/dist/esm/types/ans.d.mts +0 -109
  1362. package/dist/esm/types/ans.mjs +0 -2
  1363. package/dist/esm/types/ans.mjs.map +0 -1
  1364. package/dist/esm/types/generated/operations.d.mts +0 -703
  1365. package/dist/esm/types/generated/operations.mjs +0 -1
  1366. package/dist/esm/types/generated/operations.mjs.map +0 -1
  1367. package/dist/esm/types/generated/queries.d.mts +0 -66
  1368. package/dist/esm/types/generated/queries.mjs +0 -2
  1369. package/dist/esm/types/generated/queries.mjs.map +0 -1
  1370. package/dist/esm/types/generated/types.d.mts +0 -9679
  1371. package/dist/esm/types/generated/types.mjs +0 -2
  1372. package/dist/esm/types/generated/types.mjs.map +0 -1
  1373. package/dist/esm/types/index.d.mts +0 -8
  1374. package/dist/esm/types/index.mjs +0 -2
  1375. package/dist/esm/types/index.mjs.map +0 -1
  1376. package/dist/esm/types/indexer.d.mts +0 -186
  1377. package/dist/esm/types/indexer.mjs +0 -2
  1378. package/dist/esm/types/indexer.mjs.map +0 -1
  1379. package/dist/esm/types/keyless.d.mts +0 -102
  1380. package/dist/esm/types/keyless.mjs +0 -1
  1381. package/dist/esm/types/keyless.mjs.map +0 -1
  1382. package/dist/esm/types/types.d.mts +0 -7
  1383. package/dist/esm/types/types.mjs +0 -2
  1384. package/dist/esm/types/types.mjs.map +0 -1
  1385. package/dist/esm/utils/apiEndpoints.d.mts +0 -51
  1386. package/dist/esm/utils/apiEndpoints.mjs +0 -2
  1387. package/dist/esm/utils/apiEndpoints.mjs.map +0 -1
  1388. package/dist/esm/utils/const.d.mts +0 -104
  1389. package/dist/esm/utils/const.mjs +0 -2
  1390. package/dist/esm/utils/const.mjs.map +0 -1
  1391. package/dist/esm/utils/helpers.d.mts +0 -193
  1392. package/dist/esm/utils/helpers.mjs +0 -2
  1393. package/dist/esm/utils/helpers.mjs.map +0 -1
  1394. package/dist/esm/utils/index.d.mts +0 -9
  1395. package/dist/esm/utils/index.mjs +0 -2
  1396. package/dist/esm/utils/index.mjs.map +0 -1
  1397. package/dist/esm/utils/memoize.d.mts +0 -48
  1398. package/dist/esm/utils/memoize.mjs +0 -2
  1399. package/dist/esm/utils/memoize.mjs.map +0 -1
  1400. package/dist/esm/utils/normalizeBundle.d.mts +0 -35
  1401. package/dist/esm/utils/normalizeBundle.mjs +0 -2
  1402. package/dist/esm/utils/normalizeBundle.mjs.map +0 -1
  1403. package/dist/esm/version.d.mts +0 -8
  1404. package/dist/esm/version.mjs +0 -2
  1405. package/dist/esm/version.mjs.map +0 -1
@@ -0,0 +1,1482 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { jwtDecode } from "jwt-decode";
4
+ import { sha3_256 } from "@noble/hashes/sha3.js";
5
+ import { AccountPublicKey } from "./publicKey.js";
6
+ import { Signature } from "./signature.js";
7
+ import { Deserializer, Serializable, Serializer } from "../../bcs/index.js";
8
+ import { Hex, hexToAsciiString } from "../hex.js";
9
+ import { EphemeralCertificateVariant, AnyPublicKeyVariant, SigningScheme, ZkpVariant, } from "../../types/index.js";
10
+ import { EphemeralPublicKey, EphemeralSignature } from "./ephemeral.js";
11
+ import { bigIntToBytesLE, bytesToBigIntLE, hashStrToField, padAndPackBytesWithLen, poseidonHash } from "./poseidon.js";
12
+ import { AuthenticationKey } from "../authenticationKey.js";
13
+ import { Proof } from "./proof.js";
14
+ import { Ed25519PublicKey, Ed25519Signature } from "./ed25519.js";
15
+ import { getAptosFullNode } from "../../client/index.js";
16
+ import { memoizeAsync } from "../../utils/memoize.js";
17
+ import { AccountAddress } from "../accountAddress.js";
18
+ import { base64UrlEncode, base64UrlToBytes, nowInSeconds } from "../../utils/index.js";
19
+ import { KeylessError, KeylessErrorType } from "../../errors/index.js";
20
+ import { bn254 } from "@noble/curves/bn254.js";
21
+ import { bytesToNumberBE } from "@noble/curves/utils.js";
22
+ import { FederatedKeylessPublicKey } from "./federatedKeyless.js";
23
+ import { generateSigningMessage } from "../../transactions/transactionBuilder/signingMessage.js";
24
+ /**
25
+ * @group Implementation
26
+ * @category Serialization
27
+ */
28
+ export const EPK_HORIZON_SECS = 10000000;
29
+ /**
30
+ * @group Implementation
31
+ * @category Serialization
32
+ */
33
+ export const MAX_AUD_VAL_BYTES = 120;
34
+ /**
35
+ * @group Implementation
36
+ * @category Serialization
37
+ */
38
+ export const MAX_UID_KEY_BYTES = 30;
39
+ /**
40
+ * @group Implementation
41
+ * @category Serialization
42
+ */
43
+ export const MAX_UID_VAL_BYTES = 330;
44
+ /**
45
+ * @group Implementation
46
+ * @category Serialization
47
+ */
48
+ export const MAX_ISS_VAL_BYTES = 120;
49
+ /**
50
+ * @group Implementation
51
+ * @category Serialization
52
+ */
53
+ export const MAX_EXTRA_FIELD_BYTES = 350;
54
+ /**
55
+ * @group Implementation
56
+ * @category Serialization
57
+ */
58
+ export const MAX_JWT_HEADER_B64_BYTES = 300;
59
+ /**
60
+ * @group Implementation
61
+ * @category Serialization
62
+ */
63
+ export const MAX_COMMITED_EPK_BYTES = 93;
64
+ /**
65
+ * Represents a Keyless Public Key used for authentication.
66
+ *
67
+ * This class encapsulates the public key functionality for keyless authentication,
68
+ * including methods for generating and verifying signatures, as well as serialization
69
+ * and deserialization of the key. The KeylessPublicKey is represented in the SDK
70
+ * as `AnyPublicKey`.
71
+ * @group Implementation
72
+ * @category Serialization
73
+ */
74
+ export class KeylessPublicKey extends AccountPublicKey {
75
+ /**
76
+ * The number of bytes that `idCommitment` should be
77
+ * @group Implementation
78
+ * @category Serialization
79
+ */
80
+ static ID_COMMITMENT_LENGTH = 32;
81
+ /**
82
+ * The value of the 'iss' claim on the JWT which identifies the OIDC provider.
83
+ * @group Implementation
84
+ * @category Serialization
85
+ */
86
+ iss;
87
+ /**
88
+ * A value representing a cryptographic commitment to a user identity.
89
+ *
90
+ * It is calculated from the aud, uidKey, uidVal, pepper.
91
+ * @group Implementation
92
+ * @category Serialization
93
+ */
94
+ idCommitment;
95
+ /**
96
+ * Constructs an instance with the specified parameters for cryptographic operations.
97
+ *
98
+ * @param args - The parameters required to initialize the instance.
99
+ * @param args.alphaG1 - The hex representation of the alpha G1 value.
100
+ * @param args.betaG2 - The hex representation of the beta G2 value.
101
+ * @param args.deltaG2 - The hex representation of the delta G2 value.
102
+ * @param args.gammaAbcG1 - An array containing two hex representations for gamma ABC G1 values.
103
+ * @param args.gammaG2 - The hex representation of the gamma G2 value.
104
+ * @group Implementation
105
+ * @category Serialization
106
+ */
107
+ // TODO: Fix the JSDoc for the below values
108
+ constructor(iss, idCommitment) {
109
+ super();
110
+ const idcBytes = Hex.fromHexInput(idCommitment).toUint8Array();
111
+ if (idcBytes.length !== KeylessPublicKey.ID_COMMITMENT_LENGTH) {
112
+ throw new Error(`Id Commitment length in bytes should be ${KeylessPublicKey.ID_COMMITMENT_LENGTH}`);
113
+ }
114
+ this.iss = iss;
115
+ this.idCommitment = idcBytes;
116
+ }
117
+ /**
118
+ * Get the authentication key for the keyless public key.
119
+ *
120
+ * @returns AuthenticationKey - The authentication key derived from the keyless public key.
121
+ * @group Implementation
122
+ * @category Serialization
123
+ */
124
+ authKey() {
125
+ const serializer = new Serializer();
126
+ serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Keyless);
127
+ serializer.serializeFixedBytes(this.bcsToBytes());
128
+ return AuthenticationKey.fromSchemeAndBytes({
129
+ scheme: SigningScheme.SingleKey,
130
+ input: serializer.toUint8Array(),
131
+ });
132
+ }
133
+ /**
134
+ * Verifies the validity of a signature for a given message.
135
+ *
136
+ * @param args - The arguments for signature verification.
137
+ * @param args.message - The message that was signed.
138
+ * @param args.signature - The signature to verify against the message.
139
+ * @param args.jwk - The JWK to use for verification.
140
+ * @param args.keylessConfig - The keyless configuration to use for verification.
141
+ * @returns true if the signature is valid; otherwise, false.
142
+ * @group Implementation
143
+ * @category Serialization
144
+ */
145
+ verifySignature(args) {
146
+ try {
147
+ verifyKeylessSignatureWithJwkAndConfig({ ...args, publicKey: this });
148
+ return true;
149
+ }
150
+ catch (error) {
151
+ if (error instanceof KeylessError) {
152
+ return false;
153
+ }
154
+ throw error;
155
+ }
156
+ }
157
+ /**
158
+ * Verifies a keyless signature for a given message. It will fetch the keyless configuration and the JWK to
159
+ * use for verification from the appropriate network as defined by the aptosConfig.
160
+ *
161
+ * @param args.aptosConfig The aptos config to use for fetching the keyless configuration.
162
+ * @param args.message The message to verify the signature against.
163
+ * @param args.signature The signature to verify.
164
+ * @param args.options.throwErrorWithReason Whether to throw an error with the reason for the failure instead of returning false.
165
+ * @returns true if the signature is valid
166
+ */
167
+ async verifySignatureAsync(args) {
168
+ return verifyKeylessSignature({
169
+ ...args,
170
+ publicKey: this,
171
+ });
172
+ }
173
+ /**
174
+ * Serializes the current instance into a format suitable for transmission or storage.
175
+ * This function ensures that all relevant fields are properly serialized, including the proof and optional fields.
176
+ *
177
+ * @param serializer - The serializer instance used to perform the serialization.
178
+ * @param serializer.proof - The proof to be serialized.
179
+ * @param serializer.expHorizonSecs - The expiration horizon in seconds.
180
+ * @param serializer.extraField - An optional additional field for serialization.
181
+ * @param serializer.overrideAudVal - An optional override value for auditing.
182
+ * @param serializer.trainingWheelsSignature - An optional signature for training wheels.
183
+ * @group Implementation
184
+ * @category Serialization
185
+ */
186
+ serialize(serializer) {
187
+ serializer.serializeStr(this.iss);
188
+ serializer.serializeBytes(this.idCommitment);
189
+ }
190
+ /**
191
+ * Deserializes a ZeroKnowledgeSig object from the provided deserializer.
192
+ * This function allows you to reconstruct a ZeroKnowledgeSig instance from its serialized form.
193
+ *
194
+ * @param deserializer - The deserializer instance used to read the serialized data.
195
+ * @returns A new instance of ZeroKnowledgeSig.
196
+ * @group Implementation
197
+ * @category Serialization
198
+ */
199
+ static deserialize(deserializer) {
200
+ const iss = deserializer.deserializeStr();
201
+ const addressSeed = deserializer.deserializeBytes();
202
+ return new KeylessPublicKey(iss, addressSeed);
203
+ }
204
+ /**
205
+ * Loads a KeylessPublicKey instance from the provided deserializer.
206
+ * This function is used to deserialize the necessary components to create a KeylessPublicKey.
207
+ *
208
+ * @param deserializer - The deserializer used to extract the string and byte data.
209
+ * @param deserializer.deserializeStr - A method to deserialize a string value.
210
+ * @param deserializer.deserializeBytes - A method to deserialize byte data.
211
+ * @returns A new instance of KeylessPublicKey.
212
+ * @group Implementation
213
+ * @category Serialization
214
+ */
215
+ static load(deserializer) {
216
+ const iss = deserializer.deserializeStr();
217
+ const addressSeed = deserializer.deserializeBytes();
218
+ return new KeylessPublicKey(iss, addressSeed);
219
+ }
220
+ /**
221
+ * Determines if the provided public key is an instance of KeylessPublicKey.
222
+ *
223
+ * @param publicKey - The public key to check.
224
+ * @returns A boolean indicating whether the public key is a KeylessPublicKey instance.
225
+ * @group Implementation
226
+ * @category Serialization
227
+ */
228
+ static isPublicKey(publicKey) {
229
+ return publicKey instanceof KeylessPublicKey;
230
+ }
231
+ /**
232
+ * Creates a KeylessPublicKey from the JWT components plus pepper
233
+ *
234
+ * @param args.iss the iss of the identity
235
+ * @param args.uidKey the key to use to get the uidVal in the JWT token
236
+ * @param args.uidVal the value of the uidKey in the JWT token
237
+ * @param args.aud the client ID of the application
238
+ * @param args.pepper The pepper used to maintain privacy of the account
239
+ * @returns KeylessPublicKey
240
+ * @group Implementation
241
+ * @category Serialization
242
+ */
243
+ static create(args) {
244
+ computeIdCommitment(args);
245
+ return new KeylessPublicKey(args.iss, computeIdCommitment(args));
246
+ }
247
+ /**
248
+ * Creates a KeylessPublicKey instance from a JWT and a pepper value.
249
+ * This function is useful for generating a public key that can be used for authentication based on the provided JWT claims and pepper.
250
+ *
251
+ * @param args - The arguments for creating the KeylessPublicKey.
252
+ * @param args.jwt - The JSON Web Token to decode.
253
+ * @param args.pepper - The pepper value used in the key creation process.
254
+ * @param args.uidKey - An optional key to retrieve the unique identifier from the JWT payload, defaults to "sub".
255
+ * @returns A KeylessPublicKey instance created from the provided JWT and pepper.
256
+ * @group Implementation
257
+ * @category Serialization
258
+ */
259
+ static fromJwtAndPepper(args) {
260
+ const { jwt, pepper, uidKey = "sub" } = args;
261
+ const jwtPayload = jwtDecode(jwt);
262
+ if (typeof jwtPayload.iss !== "string") {
263
+ throw new Error("iss was not found");
264
+ }
265
+ if (typeof jwtPayload.aud !== "string") {
266
+ throw new Error("aud was not found or an array of values");
267
+ }
268
+ const uidVal = jwtPayload[uidKey];
269
+ return KeylessPublicKey.create({ iss: jwtPayload.iss, uidKey, uidVal, aud: jwtPayload.aud, pepper });
270
+ }
271
+ /**
272
+ * Checks if the provided public key is a valid instance by verifying its structure and types.
273
+ *
274
+ * @param publicKey - The public key to validate.
275
+ * @returns A boolean indicating whether the public key is a valid instance.
276
+ * @group Implementation
277
+ * @category Serialization
278
+ */
279
+ static isInstance(publicKey) {
280
+ return ("iss" in publicKey &&
281
+ typeof publicKey.iss === "string" &&
282
+ "idCommitment" in publicKey &&
283
+ publicKey.idCommitment instanceof Uint8Array);
284
+ }
285
+ }
286
+ export async function verifyKeylessSignature(args) {
287
+ const { aptosConfig, publicKey, message, signature, jwk, keylessConfig = await getKeylessConfig({ aptosConfig }), options, } = args;
288
+ try {
289
+ if (!(signature instanceof KeylessSignature)) {
290
+ throw KeylessError.fromErrorType({
291
+ type: KeylessErrorType.SIGNATURE_TYPE_INVALID,
292
+ details: "Not a keyless signature",
293
+ });
294
+ }
295
+ verifyKeylessSignatureWithJwkAndConfig({
296
+ message,
297
+ publicKey,
298
+ signature,
299
+ jwk: jwk || (await fetchJWK({ aptosConfig, publicKey, kid: signature.getJwkKid() })),
300
+ keylessConfig,
301
+ });
302
+ return true;
303
+ }
304
+ catch (error) {
305
+ if (options?.throwErrorWithReason) {
306
+ throw error;
307
+ }
308
+ return false;
309
+ }
310
+ }
311
+ /**
312
+ * Syncronously verifies a keyless signature for a given message. You need to provide the keyless configuration and the
313
+ * JWK to use for verification.
314
+ *
315
+ * @param args.message The message to verify the signature against.
316
+ * @param args.signature The signature to verify.
317
+ * @param args.keylessConfig The keyless configuration.
318
+ * @param args.jwk The JWK to use for verification.
319
+ * @returns true if the signature is valid
320
+ * @throws KeylessError if the signature is invalid
321
+ */
322
+ export function verifyKeylessSignatureWithJwkAndConfig(args) {
323
+ const { publicKey, message, signature, keylessConfig, jwk } = args;
324
+ const { verificationKey, maxExpHorizonSecs, trainingWheelsPubkey } = keylessConfig;
325
+ if (!(signature instanceof KeylessSignature)) {
326
+ throw KeylessError.fromErrorType({
327
+ type: KeylessErrorType.SIGNATURE_TYPE_INVALID,
328
+ details: "Not a keyless signature",
329
+ });
330
+ }
331
+ if (!(signature.ephemeralCertificate.signature instanceof ZeroKnowledgeSig)) {
332
+ throw KeylessError.fromErrorType({
333
+ type: KeylessErrorType.SIGNATURE_TYPE_INVALID,
334
+ details: "Unsupported ephemeral certificate variant",
335
+ });
336
+ }
337
+ const zkSig = signature.ephemeralCertificate.signature;
338
+ if (!(zkSig.proof.proof instanceof Groth16Zkp)) {
339
+ throw KeylessError.fromErrorType({
340
+ type: KeylessErrorType.SIGNATURE_TYPE_INVALID,
341
+ details: "Unsupported proof variant for ZeroKnowledgeSig",
342
+ });
343
+ }
344
+ const groth16Proof = zkSig.proof.proof;
345
+ if (signature.expiryDateSecs < nowInSeconds()) {
346
+ throw KeylessError.fromErrorType({
347
+ type: KeylessErrorType.SIGNATURE_EXPIRED,
348
+ details: "The expiryDateSecs is in the past",
349
+ });
350
+ }
351
+ if (zkSig.expHorizonSecs > maxExpHorizonSecs) {
352
+ throw KeylessError.fromErrorType({
353
+ type: KeylessErrorType.MAX_EXPIRY_HORIZON_EXCEEDED,
354
+ });
355
+ }
356
+ if (!signature.ephemeralPublicKey.verifySignature({ message, signature: signature.ephemeralSignature })) {
357
+ throw KeylessError.fromErrorType({
358
+ type: KeylessErrorType.EPHEMERAL_SIGNATURE_VERIFICATION_FAILED,
359
+ });
360
+ }
361
+ const publicInputsHash = getPublicInputsHash({ publicKey, signature, jwk, keylessConfig });
362
+ if (!verificationKey.verifyProof({ publicInputsHash, groth16Proof })) {
363
+ throw KeylessError.fromErrorType({
364
+ type: KeylessErrorType.PROOF_VERIFICATION_FAILED,
365
+ });
366
+ }
367
+ if (trainingWheelsPubkey) {
368
+ if (!zkSig.trainingWheelsSignature) {
369
+ throw KeylessError.fromErrorType({
370
+ type: KeylessErrorType.TRAINING_WHEELS_SIGNATURE_MISSING,
371
+ });
372
+ }
373
+ const proofAndStatement = new Groth16ProofAndStatement(groth16Proof, publicInputsHash);
374
+ if (!trainingWheelsPubkey.verifySignature({
375
+ message: proofAndStatement.hash(),
376
+ signature: zkSig.trainingWheelsSignature,
377
+ })) {
378
+ throw KeylessError.fromErrorType({
379
+ type: KeylessErrorType.TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED,
380
+ });
381
+ }
382
+ }
383
+ }
384
+ /**
385
+ * Get the public inputs hash for the keyless signature.
386
+ *
387
+ * @param args.signature The signature
388
+ * @param args.jwk The JWK to use for the public inputs hash
389
+ * @param args.keylessConfig The keyless configuration which defines the byte lengths to use when hashing fields.
390
+ * @returns The public inputs hash
391
+ */
392
+ function getPublicInputsHash(args) {
393
+ const { publicKey, signature, jwk, keylessConfig } = args;
394
+ const innerKeylessPublicKey = publicKey instanceof KeylessPublicKey ? publicKey : publicKey.keylessPublicKey;
395
+ if (!(signature.ephemeralCertificate.signature instanceof ZeroKnowledgeSig)) {
396
+ throw new Error("Signature is not a ZeroKnowledgeSig");
397
+ }
398
+ const proof = signature.ephemeralCertificate.signature;
399
+ const fields = [];
400
+ fields.push(...padAndPackBytesWithLen(signature.ephemeralPublicKey.toUint8Array(), keylessConfig.maxCommitedEpkBytes));
401
+ fields.push(bytesToBigIntLE(innerKeylessPublicKey.idCommitment));
402
+ fields.push(signature.expiryDateSecs);
403
+ fields.push(proof.expHorizonSecs);
404
+ fields.push(hashStrToField(innerKeylessPublicKey.iss, keylessConfig.maxIssValBytes));
405
+ if (!proof.extraField) {
406
+ fields.push(0n);
407
+ fields.push(hashStrToField(" ", keylessConfig.maxExtraFieldBytes));
408
+ }
409
+ else {
410
+ fields.push(1n);
411
+ fields.push(hashStrToField(proof.extraField, keylessConfig.maxExtraFieldBytes));
412
+ }
413
+ const jwtHeaderB64Url = base64UrlEncode(signature.jwtHeader);
414
+ fields.push(hashStrToField(`${jwtHeaderB64Url}.`, keylessConfig.maxJwtHeaderB64Bytes));
415
+ fields.push(jwk.toScalar());
416
+ if (!proof.overrideAudVal) {
417
+ fields.push(hashStrToField("", MAX_AUD_VAL_BYTES));
418
+ fields.push(0n);
419
+ }
420
+ else {
421
+ fields.push(hashStrToField(proof.overrideAudVal, MAX_AUD_VAL_BYTES));
422
+ fields.push(1n);
423
+ }
424
+ return poseidonHash(fields);
425
+ }
426
+ /**
427
+ * Fetches the JWK from the issuer's well-known JWKS endpoint.
428
+ *
429
+ * @param args.publicKey The keyless public key which contains the issuer the address to fetch the JWK from (0x1 if not federated).
430
+ * @param args.kid The kid of the JWK to fetch
431
+ * @returns A JWK matching the `kid` in the JWT header.
432
+ * @throws {KeylessError} If the JWK cannot be fetched
433
+ */
434
+ export async function fetchJWK(args) {
435
+ const { aptosConfig, publicKey, kid } = args;
436
+ const keylessPubKey = publicKey instanceof KeylessPublicKey ? publicKey : publicKey.keylessPublicKey;
437
+ const { iss } = keylessPubKey;
438
+ let allJWKs;
439
+ const jwkAddr = publicKey instanceof FederatedKeylessPublicKey ? publicKey.jwkAddress : undefined;
440
+ try {
441
+ allJWKs = await getKeylessJWKs({ aptosConfig, jwkAddr });
442
+ }
443
+ catch (error) {
444
+ throw KeylessError.fromErrorType({
445
+ type: KeylessErrorType.FULL_NODE_JWKS_LOOKUP_ERROR,
446
+ error,
447
+ details: `Failed to fetch ${jwkAddr ? "Federated" : "Patched"}JWKs ${jwkAddr ? `for address ${jwkAddr}` : "0x1"}`,
448
+ });
449
+ }
450
+ // Find the corresponding JWK set by `iss`
451
+ const jwksForIssuer = allJWKs.get(iss);
452
+ if (jwksForIssuer === undefined) {
453
+ throw KeylessError.fromErrorType({
454
+ type: KeylessErrorType.INVALID_JWT_ISS_NOT_RECOGNIZED,
455
+ details: `JWKs for issuer ${iss} not found.`,
456
+ });
457
+ }
458
+ // Find the corresponding JWK by `kid`
459
+ const jwk = jwksForIssuer.find((key) => key.kid === kid);
460
+ if (jwk === undefined) {
461
+ throw KeylessError.fromErrorType({
462
+ type: KeylessErrorType.INVALID_JWT_JWK_NOT_FOUND,
463
+ details: `JWK with kid '${kid}' for issuer '${iss}' not found.`,
464
+ });
465
+ }
466
+ return jwk;
467
+ }
468
+ function computeIdCommitment(args) {
469
+ const { uidKey, uidVal, aud, pepper } = args;
470
+ const fields = [
471
+ bytesToBigIntLE(Hex.fromHexInput(pepper).toUint8Array()),
472
+ hashStrToField(aud, MAX_AUD_VAL_BYTES),
473
+ hashStrToField(uidVal, MAX_UID_VAL_BYTES),
474
+ hashStrToField(uidKey, MAX_UID_KEY_BYTES),
475
+ ];
476
+ return bigIntToBytesLE(poseidonHash(fields), KeylessPublicKey.ID_COMMITMENT_LENGTH);
477
+ }
478
+ /**
479
+ * Represents a signature of a message signed via a Keyless Account, utilizing proofs or a JWT token for authentication.
480
+ * @group Implementation
481
+ * @category Serialization
482
+ */
483
+ export class KeylessSignature extends Signature {
484
+ /**
485
+ * The inner signature ZeroKnowledgeSignature or OpenIdSignature
486
+ * @group Implementation
487
+ * @category Serialization
488
+ */
489
+ ephemeralCertificate;
490
+ /**
491
+ * The jwt header in the token used to create the proof/signature. In json string representation.
492
+ * @group Implementation
493
+ * @category Serialization
494
+ */
495
+ jwtHeader;
496
+ /**
497
+ * The expiry timestamp in seconds of the EphemeralKeyPair used to sign
498
+ * @group Implementation
499
+ * @category Serialization
500
+ */
501
+ expiryDateSecs;
502
+ /**
503
+ * The ephemeral public key used to verify the signature
504
+ * @group Implementation
505
+ * @category Serialization
506
+ */
507
+ ephemeralPublicKey;
508
+ /**
509
+ * The signature resulting from signing with the private key of the EphemeralKeyPair
510
+ * @group Implementation
511
+ * @category Serialization
512
+ */
513
+ ephemeralSignature;
514
+ constructor(args) {
515
+ super();
516
+ const { jwtHeader, ephemeralCertificate, expiryDateSecs, ephemeralPublicKey, ephemeralSignature } = args;
517
+ this.jwtHeader = jwtHeader;
518
+ this.ephemeralCertificate = ephemeralCertificate;
519
+ this.expiryDateSecs = expiryDateSecs;
520
+ this.ephemeralPublicKey = ephemeralPublicKey;
521
+ this.ephemeralSignature = ephemeralSignature;
522
+ }
523
+ /**
524
+ * Get the kid of the JWT used to derive the Keyless Account used to sign.
525
+ *
526
+ * @returns the kid as a string
527
+ */
528
+ getJwkKid() {
529
+ return parseJwtHeader(this.jwtHeader).kid;
530
+ }
531
+ serialize(serializer) {
532
+ this.ephemeralCertificate.serialize(serializer);
533
+ serializer.serializeStr(this.jwtHeader);
534
+ serializer.serializeU64(this.expiryDateSecs);
535
+ this.ephemeralPublicKey.serialize(serializer);
536
+ this.ephemeralSignature.serialize(serializer);
537
+ }
538
+ static deserialize(deserializer) {
539
+ const ephemeralCertificate = EphemeralCertificate.deserialize(deserializer);
540
+ const jwtHeader = deserializer.deserializeStr();
541
+ const expiryDateSecs = deserializer.deserializeU64();
542
+ const ephemeralPublicKey = EphemeralPublicKey.deserialize(deserializer);
543
+ const ephemeralSignature = EphemeralSignature.deserialize(deserializer);
544
+ return new KeylessSignature({
545
+ jwtHeader,
546
+ expiryDateSecs: Number(expiryDateSecs),
547
+ ephemeralCertificate,
548
+ ephemeralPublicKey,
549
+ ephemeralSignature,
550
+ });
551
+ }
552
+ static getSimulationSignature() {
553
+ return new KeylessSignature({
554
+ jwtHeader: "{}",
555
+ ephemeralCertificate: new EphemeralCertificate(new ZeroKnowledgeSig({
556
+ proof: new ZkProof(new Groth16Zkp({ a: new Uint8Array(32), b: new Uint8Array(64), c: new Uint8Array(32) }), ZkpVariant.Groth16),
557
+ expHorizonSecs: 0,
558
+ }), EphemeralCertificateVariant.ZkProof),
559
+ expiryDateSecs: 0,
560
+ ephemeralPublicKey: new EphemeralPublicKey(new Ed25519PublicKey(new Uint8Array(32))),
561
+ ephemeralSignature: new EphemeralSignature(new Ed25519Signature(new Uint8Array(64))),
562
+ });
563
+ }
564
+ static isSignature(signature) {
565
+ return signature instanceof KeylessSignature;
566
+ }
567
+ }
568
+ /**
569
+ * Represents an ephemeral certificate containing a signature, specifically a ZeroKnowledgeSig.
570
+ * This class can be extended to support additional signature types, such as OpenIdSignature.
571
+ *
572
+ * @extends Signature
573
+ * @group Implementation
574
+ * @category Serialization
575
+ */
576
+ export class EphemeralCertificate extends Signature {
577
+ signature;
578
+ /**
579
+ * Index of the underlying enum variant
580
+ * @group Implementation
581
+ * @category Serialization
582
+ */
583
+ variant;
584
+ constructor(signature, variant) {
585
+ super();
586
+ this.signature = signature;
587
+ this.variant = variant;
588
+ }
589
+ /**
590
+ * Get the public key in bytes (Uint8Array).
591
+ *
592
+ * @returns Uint8Array representation of the public key
593
+ * @group Implementation
594
+ * @category Serialization
595
+ */
596
+ toUint8Array() {
597
+ return this.signature.toUint8Array();
598
+ }
599
+ serialize(serializer) {
600
+ serializer.serializeU32AsUleb128(this.variant);
601
+ this.signature.serialize(serializer);
602
+ }
603
+ static deserialize(deserializer) {
604
+ const variant = deserializer.deserializeUleb128AsU32();
605
+ switch (variant) {
606
+ case EphemeralCertificateVariant.ZkProof:
607
+ return new EphemeralCertificate(ZeroKnowledgeSig.deserialize(deserializer), variant);
608
+ default:
609
+ throw new Error(`Unknown variant index for EphemeralCertificate: ${variant}`);
610
+ }
611
+ }
612
+ }
613
+ /**
614
+ * Represents a fixed-size byte array of 32 bytes, extending the Serializable class.
615
+ * This class is used for handling and serializing G1 bytes in cryptographic operations.
616
+ *
617
+ * @extends Serializable
618
+ * @group Implementation
619
+ * @category Serialization
620
+ */
621
+ class G1Bytes extends Serializable {
622
+ static B = bn254.fields.Fp.create(3n);
623
+ data;
624
+ constructor(data) {
625
+ super();
626
+ this.data = Hex.fromHexInput(data).toUint8Array();
627
+ if (this.data.length !== 32) {
628
+ throw new Error("Input needs to be 32 bytes");
629
+ }
630
+ }
631
+ serialize(serializer) {
632
+ serializer.serializeFixedBytes(this.data);
633
+ }
634
+ static deserialize(deserializer) {
635
+ const bytes = deserializer.deserializeFixedBytes(32);
636
+ return new G1Bytes(bytes);
637
+ }
638
+ // Convert the projective coordinates to strings
639
+ toArray() {
640
+ const point = this.toProjectivePoint();
641
+ return [point.x.toString(), point.y.toString(), point.Z.toString()];
642
+ }
643
+ /**
644
+ * Converts the G1 bytes to a projective point.
645
+ * @returns The projective point.
646
+ */
647
+ toProjectivePoint() {
648
+ const bytes = new Uint8Array(this.data);
649
+ // Reverse the bytes to convert from little-endian to big-endian.
650
+ bytes.reverse();
651
+ // This gets the flag bit to determine which y to use.
652
+ const yFlag = (bytes[0] & 0x80) >> 7;
653
+ const { Fp } = bn254.fields;
654
+ const x = Fp.create(bytesToBn254FpBE(bytes));
655
+ const y = Fp.sqrt(Fp.add(Fp.pow(x, 3n), G1Bytes.B));
656
+ const negY = Fp.neg(y);
657
+ const yToUse = y > negY === (yFlag === 1) ? y : negY;
658
+ return bn254.G1.Point.fromAffine({
659
+ x,
660
+ y: yToUse,
661
+ });
662
+ }
663
+ }
664
+ function bytesToBn254FpBE(bytes) {
665
+ if (bytes.length !== 32) {
666
+ throw new Error("Input should be 32 bytes");
667
+ }
668
+ // Clear the first two bits of the first byte which removes any flags.
669
+ const result = new Uint8Array(bytes);
670
+ result[0] &= 0x3f; // 0x3F = 00111111 in binary
671
+ return bytesToNumberBE(result);
672
+ }
673
+ /**
674
+ * Represents a 64-byte G2 element in a cryptographic context.
675
+ * This class provides methods for serialization and deserialization of G2 bytes.
676
+ *
677
+ * @extends Serializable
678
+ * @group Implementation
679
+ * @category Serialization
680
+ */
681
+ class G2Bytes extends Serializable {
682
+ /**
683
+ * The constant b value used in G2 point calculations
684
+ */
685
+ static B = bn254.fields.Fp2.fromBigTuple([
686
+ 19485874751759354771024239261021720505790618469301721065564631296452457478373n,
687
+ 266929791119991161246907387137283842545076965332900288569378510910307636690n,
688
+ ]);
689
+ data;
690
+ constructor(data) {
691
+ super();
692
+ this.data = Hex.fromHexInput(data).toUint8Array();
693
+ if (this.data.length !== 64) {
694
+ throw new Error("Input needs to be 64 bytes");
695
+ }
696
+ }
697
+ serialize(serializer) {
698
+ serializer.serializeFixedBytes(this.data);
699
+ }
700
+ static deserialize(deserializer) {
701
+ const bytes = deserializer.deserializeFixedBytes(64);
702
+ return new G2Bytes(bytes);
703
+ }
704
+ // Convert the projective coordinates to strings
705
+ toArray() {
706
+ const point = this.toProjectivePoint();
707
+ return [
708
+ [
709
+ point.x.c0.toString(), // x real part
710
+ point.x.c1.toString(),
711
+ ], // x imaginary part
712
+ [
713
+ point.y.c0.toString(), // y real part
714
+ point.y.c1.toString(),
715
+ ], // y imaginary part
716
+ [
717
+ point.Z.c0.toString(), // z real part
718
+ point.Z.c1.toString(),
719
+ ], // z imaginary part
720
+ ];
721
+ }
722
+ toProjectivePoint() {
723
+ const bytes = new Uint8Array(this.data);
724
+ // Reverse the bytes to convert from little-endian to big-endian for each part of x.
725
+ const x0 = bytes.slice(0, 32).reverse();
726
+ const x1 = bytes.slice(32, 64).reverse();
727
+ // This gets the flag bit to determine which y to use.
728
+ const yFlag = (x1[0] & 0x80) >> 7;
729
+ const { Fp2 } = bn254.fields;
730
+ const x = Fp2.fromBigTuple([bytesToBn254FpBE(x0), bytesToBn254FpBE(x1)]);
731
+ const y = Fp2.sqrt(Fp2.add(Fp2.pow(x, 3n), G2Bytes.B));
732
+ const negY = Fp2.neg(y);
733
+ const isYGreaterThanNegY = y.c1 > negY.c1 || (y.c1 === negY.c1 && y.c0 > negY.c0);
734
+ const yToUse = isYGreaterThanNegY === (yFlag === 1) ? y : negY;
735
+ return bn254.G2.Point.fromAffine({
736
+ x,
737
+ y: yToUse,
738
+ });
739
+ }
740
+ }
741
+ /**
742
+ * Represents a Groth16 zero-knowledge proof, consisting of three proof points in compressed serialization format.
743
+ * The points are the compressed serialization of affine representation of the proof.
744
+ *
745
+ * @extends Proof
746
+ * @group Implementation
747
+ * @category Serialization
748
+ */
749
+ export class Groth16Zkp extends Proof {
750
+ /**
751
+ * The bytes of G1 proof point a
752
+ * @group Implementation
753
+ * @category Serialization
754
+ */
755
+ a;
756
+ /**
757
+ * The bytes of G2 proof point b
758
+ * @group Implementation
759
+ * @category Serialization
760
+ */
761
+ b;
762
+ /**
763
+ * The bytes of G1 proof point c
764
+ * @group Implementation
765
+ * @category Serialization
766
+ */
767
+ c;
768
+ constructor(args) {
769
+ super();
770
+ const { a, b, c } = args;
771
+ this.a = new G1Bytes(a);
772
+ this.b = new G2Bytes(b);
773
+ this.c = new G1Bytes(c);
774
+ }
775
+ serialize(serializer) {
776
+ this.a.serialize(serializer);
777
+ this.b.serialize(serializer);
778
+ this.c.serialize(serializer);
779
+ }
780
+ static deserialize(deserializer) {
781
+ const a = G1Bytes.deserialize(deserializer).bcsToBytes();
782
+ const b = G2Bytes.deserialize(deserializer).bcsToBytes();
783
+ const c = G1Bytes.deserialize(deserializer).bcsToBytes();
784
+ return new Groth16Zkp({ a, b, c });
785
+ }
786
+ toSnarkJsJson() {
787
+ return {
788
+ protocol: "groth16",
789
+ curve: "bn128",
790
+ pi_a: this.a.toArray(),
791
+ pi_b: this.b.toArray(),
792
+ pi_c: this.c.toArray(),
793
+ };
794
+ }
795
+ }
796
+ /**
797
+ * Represents a Groth16 proof and statement, consisting of a Groth16 proof and a public inputs hash.
798
+ * This is used to generate the signing message for the training wheels signature.
799
+ *
800
+ * @extends Serializable
801
+ * @group Implementation
802
+ * @category Serialization
803
+ */
804
+ export class Groth16ProofAndStatement extends Serializable {
805
+ /**
806
+ * The Groth16 proof
807
+ * @group Implementation
808
+ * @category Serialization
809
+ */
810
+ proof;
811
+ /**
812
+ * The public inputs hash as a 32 byte Uint8Array
813
+ * @group Implementation
814
+ * @category Serialization
815
+ */
816
+ publicInputsHash;
817
+ /**
818
+ * The domain separator prefix used when hashing.
819
+ * @group Implementation
820
+ * @category Account (On-Chain Model)
821
+ */
822
+ domainSeparator = "APTOS::Groth16ProofAndStatement";
823
+ constructor(proof, publicInputsHash) {
824
+ super();
825
+ this.proof = proof;
826
+ this.publicInputsHash =
827
+ typeof publicInputsHash === "bigint"
828
+ ? bigIntToBytesLE(publicInputsHash, 32)
829
+ : Hex.fromHexInput(publicInputsHash).toUint8Array();
830
+ if (this.publicInputsHash.length !== 32) {
831
+ throw new Error("Invalid public inputs hash");
832
+ }
833
+ }
834
+ serialize(serializer) {
835
+ this.proof.serialize(serializer);
836
+ serializer.serializeFixedBytes(this.publicInputsHash);
837
+ }
838
+ static deserialize(deserializer) {
839
+ return new Groth16ProofAndStatement(Groth16Zkp.deserialize(deserializer), deserializer.deserializeFixedBytes(32));
840
+ }
841
+ hash() {
842
+ return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);
843
+ }
844
+ }
845
+ /**
846
+ * Represents a container for different types of zero-knowledge proofs.
847
+ *
848
+ * @extends Serializable
849
+ * @group Implementation
850
+ * @category Serialization
851
+ */
852
+ export class ZkProof extends Serializable {
853
+ proof;
854
+ /**
855
+ * Index of the underlying enum variant
856
+ * @group Implementation
857
+ * @category Serialization
858
+ */
859
+ variant;
860
+ constructor(proof, variant) {
861
+ super();
862
+ this.proof = proof;
863
+ this.variant = variant;
864
+ }
865
+ serialize(serializer) {
866
+ serializer.serializeU32AsUleb128(this.variant);
867
+ this.proof.serialize(serializer);
868
+ }
869
+ static deserialize(deserializer) {
870
+ const variant = deserializer.deserializeUleb128AsU32();
871
+ switch (variant) {
872
+ case ZkpVariant.Groth16:
873
+ return new ZkProof(Groth16Zkp.deserialize(deserializer), variant);
874
+ default:
875
+ throw new Error(`Unknown variant index for ZkProof: ${variant}`);
876
+ }
877
+ }
878
+ }
879
+ /**
880
+ * Represents a zero-knowledge signature, encapsulating the proof and its associated metadata.
881
+ *
882
+ * @extends Signature
883
+ * @group Implementation
884
+ * @category Serialization
885
+ */
886
+ export class ZeroKnowledgeSig extends Signature {
887
+ /**
888
+ * The proof
889
+ * @group Implementation
890
+ * @category Serialization
891
+ */
892
+ proof;
893
+ /**
894
+ * The max lifespan of the proof
895
+ * @group Implementation
896
+ * @category Serialization
897
+ */
898
+ expHorizonSecs;
899
+ /**
900
+ * A key value pair on the JWT token that can be specified on the signature which would reveal the value on chain.
901
+ * Can be used to assert identity or other attributes.
902
+ * @group Implementation
903
+ * @category Serialization
904
+ */
905
+ extraField;
906
+ /**
907
+ * The 'aud' value of the recovery service which is set when recovering an account.
908
+ * @group Implementation
909
+ * @category Serialization
910
+ */
911
+ overrideAudVal;
912
+ /**
913
+ * The training wheels signature
914
+ * @group Implementation
915
+ * @category Serialization
916
+ */
917
+ trainingWheelsSignature;
918
+ constructor(args) {
919
+ super();
920
+ const { proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal } = args;
921
+ this.proof = proof;
922
+ this.expHorizonSecs = expHorizonSecs;
923
+ this.trainingWheelsSignature = trainingWheelsSignature;
924
+ this.extraField = extraField;
925
+ this.overrideAudVal = overrideAudVal;
926
+ }
927
+ /**
928
+ * Deserialize a ZeroKnowledgeSig object from its BCS serialization in bytes.
929
+ *
930
+ * @param bytes - The bytes representing the serialized ZeroKnowledgeSig.
931
+ * @returns ZeroKnowledgeSig - The deserialized ZeroKnowledgeSig object.
932
+ * @group Implementation
933
+ * @category Serialization
934
+ */
935
+ static fromBytes(bytes) {
936
+ return ZeroKnowledgeSig.deserialize(new Deserializer(bytes));
937
+ }
938
+ serialize(serializer) {
939
+ this.proof.serialize(serializer);
940
+ serializer.serializeU64(this.expHorizonSecs);
941
+ serializer.serializeOption(this.extraField);
942
+ serializer.serializeOption(this.overrideAudVal);
943
+ serializer.serializeOption(this.trainingWheelsSignature);
944
+ }
945
+ static deserialize(deserializer) {
946
+ const proof = ZkProof.deserialize(deserializer);
947
+ const expHorizonSecs = Number(deserializer.deserializeU64());
948
+ const extraField = deserializer.deserializeOption("string");
949
+ const overrideAudVal = deserializer.deserializeOption("string");
950
+ const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);
951
+ return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });
952
+ }
953
+ }
954
+ /**
955
+ * Represents the on-chain configuration for how Keyless accounts operate.
956
+ *
957
+ * @remarks
958
+ * This class encapsulates the verification key and the maximum lifespan of ephemeral key pairs,
959
+ * which are essential for the functionality of Keyless accounts.
960
+ * @group Implementation
961
+ * @category Serialization
962
+ */
963
+ export class KeylessConfiguration {
964
+ /**
965
+ * The verification key used to verify Groth16 proofs on chain
966
+ * @group Implementation
967
+ * @category Serialization
968
+ */
969
+ verificationKey;
970
+ /**
971
+ * The maximum lifespan of an ephemeral key pair. This is configured on chain.
972
+ * @group Implementation
973
+ * @category Serialization
974
+ */
975
+ maxExpHorizonSecs;
976
+ /**
977
+ * The public key of the training wheels account.
978
+ * @group Implementation
979
+ * @category Serialization
980
+ */
981
+ trainingWheelsPubkey;
982
+ /**
983
+ * The maximum number of bytes that can be used for the extra field.
984
+ * @group Implementation
985
+ * @category Serialization
986
+ */
987
+ maxExtraFieldBytes;
988
+ /**
989
+ * The maximum number of bytes that can be used for the JWT header.
990
+ * @group Implementation
991
+ * @category Serialization
992
+ */
993
+ maxJwtHeaderB64Bytes;
994
+ /**
995
+ * The maximum number of bytes that can be used for the issuer value.
996
+ * @group Implementation
997
+ * @category Serialization
998
+ */
999
+ maxIssValBytes;
1000
+ /**
1001
+ * The maximum number of bytes that can be used for the committed ephemeral public key.
1002
+ * @group Implementation
1003
+ * @category Serialization
1004
+ */
1005
+ maxCommitedEpkBytes;
1006
+ constructor(args) {
1007
+ const { verificationKey, trainingWheelsPubkey, maxExpHorizonSecs = EPK_HORIZON_SECS, maxExtraFieldBytes = MAX_EXTRA_FIELD_BYTES, maxJwtHeaderB64Bytes = MAX_JWT_HEADER_B64_BYTES, maxIssValBytes = MAX_ISS_VAL_BYTES, maxCommitedEpkBytes = MAX_COMMITED_EPK_BYTES, } = args;
1008
+ this.verificationKey = verificationKey;
1009
+ this.maxExpHorizonSecs = maxExpHorizonSecs;
1010
+ if (trainingWheelsPubkey) {
1011
+ this.trainingWheelsPubkey = new EphemeralPublicKey(new Ed25519PublicKey(trainingWheelsPubkey));
1012
+ }
1013
+ this.maxExtraFieldBytes = maxExtraFieldBytes;
1014
+ this.maxJwtHeaderB64Bytes = maxJwtHeaderB64Bytes;
1015
+ this.maxIssValBytes = maxIssValBytes;
1016
+ this.maxCommitedEpkBytes = maxCommitedEpkBytes;
1017
+ }
1018
+ /**
1019
+ * Creates a new KeylessConfiguration instance from a Groth16VerificationKeyResponse and a KeylessConfigurationResponse.
1020
+ * @param res - The Groth16VerificationKeyResponse object containing the verification key data.
1021
+ * @param config - The KeylessConfigurationResponse object containing the configuration data.
1022
+ * @returns A new KeylessConfiguration instance.
1023
+ */
1024
+ static create(res, config) {
1025
+ return new KeylessConfiguration({
1026
+ verificationKey: new Groth16VerificationKey({
1027
+ alphaG1: res.alpha_g1,
1028
+ betaG2: res.beta_g2,
1029
+ deltaG2: res.delta_g2,
1030
+ gammaAbcG1: res.gamma_abc_g1,
1031
+ gammaG2: res.gamma_g2,
1032
+ }),
1033
+ maxExpHorizonSecs: Number(config.max_exp_horizon_secs),
1034
+ trainingWheelsPubkey: config.training_wheels_pubkey.vec[0],
1035
+ maxExtraFieldBytes: config.max_extra_field_bytes,
1036
+ maxJwtHeaderB64Bytes: config.max_jwt_header_b64_bytes,
1037
+ maxIssValBytes: config.max_iss_val_bytes,
1038
+ maxCommitedEpkBytes: config.max_commited_epk_bytes,
1039
+ });
1040
+ }
1041
+ }
1042
+ /**
1043
+ * Represents the verification key stored on-chain used to verify Groth16 proofs.
1044
+ * @group Implementation
1045
+ * @category Serialization
1046
+ */
1047
+ export class Groth16VerificationKey {
1048
+ // The docstrings below are borrowed from ark-groth16
1049
+ /**
1050
+ * The `alpha * G`, where `G` is the generator of G1
1051
+ * @group Implementation
1052
+ * @category Serialization
1053
+ */
1054
+ alphaG1;
1055
+ /**
1056
+ * The `alpha * H`, where `H` is the generator of G2
1057
+ * @group Implementation
1058
+ * @category Serialization
1059
+ */
1060
+ betaG2;
1061
+ /**
1062
+ * The `delta * H`, where `H` is the generator of G2
1063
+ * @group Implementation
1064
+ * @category Serialization
1065
+ */
1066
+ deltaG2;
1067
+ /**
1068
+ * The `gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H`, where H is the generator of G1
1069
+ * @group Implementation
1070
+ * @category Serialization
1071
+ */
1072
+ gammaAbcG1;
1073
+ /**
1074
+ * The `gamma * H`, where `H` is the generator of G2
1075
+ * @group Implementation
1076
+ * @category Serialization
1077
+ */
1078
+ gammaG2;
1079
+ constructor(args) {
1080
+ const { alphaG1, betaG2, deltaG2, gammaAbcG1, gammaG2 } = args;
1081
+ this.alphaG1 = new G1Bytes(alphaG1);
1082
+ this.betaG2 = new G2Bytes(betaG2);
1083
+ this.deltaG2 = new G2Bytes(deltaG2);
1084
+ this.gammaAbcG1 = [new G1Bytes(gammaAbcG1[0]), new G1Bytes(gammaAbcG1[1])];
1085
+ this.gammaG2 = new G2Bytes(gammaG2);
1086
+ }
1087
+ /**
1088
+ * Calculates the hash of the serialized form of the verification key.
1089
+ * This is useful for comparing verification keys or using them as unique identifiers.
1090
+ *
1091
+ * @returns The SHA3-256 hash of the serialized verification key as a Uint8Array
1092
+ */
1093
+ hash() {
1094
+ const serializer = new Serializer();
1095
+ this.serialize(serializer);
1096
+ return sha3_256.create().update(serializer.toUint8Array()).digest();
1097
+ }
1098
+ serialize(serializer) {
1099
+ this.alphaG1.serialize(serializer);
1100
+ this.betaG2.serialize(serializer);
1101
+ this.deltaG2.serialize(serializer);
1102
+ this.gammaAbcG1[0].serialize(serializer);
1103
+ this.gammaAbcG1[1].serialize(serializer);
1104
+ this.gammaG2.serialize(serializer);
1105
+ }
1106
+ /**
1107
+ * Converts a Groth16VerificationKeyResponse object into a Groth16VerificationKey instance.
1108
+ *
1109
+ * @param res - The Groth16VerificationKeyResponse object containing the verification key data.
1110
+ * @param res.alpha_g1 - The alpha G1 value from the response.
1111
+ * @param res.beta_g2 - The beta G2 value from the response.
1112
+ * @param res.delta_g2 - The delta G2 value from the response.
1113
+ * @param res.gamma_abc_g1 - The gamma ABC G1 value from the response.
1114
+ * @param res.gamma_g2 - The gamma G2 value from the response.
1115
+ * @returns A Groth16VerificationKey instance constructed from the provided response data.
1116
+ * @group Implementation
1117
+ * @category Serialization
1118
+ */
1119
+ static fromGroth16VerificationKeyResponse(res) {
1120
+ return new Groth16VerificationKey({
1121
+ alphaG1: res.alpha_g1,
1122
+ betaG2: res.beta_g2,
1123
+ deltaG2: res.delta_g2,
1124
+ gammaAbcG1: res.gamma_abc_g1,
1125
+ gammaG2: res.gamma_g2,
1126
+ });
1127
+ }
1128
+ /**
1129
+ * Verifies a Groth16 proof using the verification key given the public inputs hash and the proof.
1130
+ *
1131
+ * @param args.publicInputsHash The public inputs hash
1132
+ * @param args.groth16Proof The Groth16 proof
1133
+ * @returns true if the proof is valid
1134
+ */
1135
+ verifyProof(args) {
1136
+ const { publicInputsHash, groth16Proof } = args;
1137
+ try {
1138
+ // Get proof points
1139
+ const proofA = groth16Proof.a.toProjectivePoint();
1140
+ const proofB = groth16Proof.b.toProjectivePoint();
1141
+ const proofC = groth16Proof.c.toProjectivePoint();
1142
+ // Get verification key points
1143
+ const vkAlpha1 = this.alphaG1.toProjectivePoint();
1144
+ const vkBeta2 = this.betaG2.toProjectivePoint();
1145
+ const vkGamma2 = this.gammaG2.toProjectivePoint();
1146
+ const vkDelta2 = this.deltaG2.toProjectivePoint();
1147
+ const vkIC = this.gammaAbcG1.map((g1) => g1.toProjectivePoint());
1148
+ const { Fp12 } = bn254.fields;
1149
+ // Check that the following pairing equation holds:
1150
+ // e(A_1, B_2) = e(\alpha_1, \beta_2) + e(\ic_0 + public_inputs_hash \ic_1, \gamma_2) + e(C_1, \delta_2)
1151
+ // Where A_1, B_2, C_1 are the proof points and \alpha_1, \beta_2, \gamma_2, \delta_2, \ic_0, \ic_1
1152
+ // are the verification key points
1153
+ // \ic_0 + public_inputs_hash \ic_1
1154
+ const accum = vkIC[0].add(vkIC[1].multiply(publicInputsHash));
1155
+ // e(\ic_0 + public_inputs_hash \ic_1, \gamma_2)
1156
+ const pairingAccumGamma = bn254.pairing(accum, vkGamma2);
1157
+ // e(A_1, B_2)
1158
+ const pairingAB = bn254.pairing(proofA, proofB);
1159
+ // e(\alpha_1, \beta_2)
1160
+ const pairingAlphaBeta = bn254.pairing(vkAlpha1, vkBeta2);
1161
+ // e(C_1, \delta_2)
1162
+ const pairingCDelta = bn254.pairing(proofC, vkDelta2);
1163
+ // Get the result of the right hand side of the pairing equation
1164
+ const product = Fp12.mul(pairingAlphaBeta, Fp12.mul(pairingAccumGamma, pairingCDelta));
1165
+ // Check if the left hand side equals the right hand side
1166
+ return Fp12.eql(pairingAB, product);
1167
+ }
1168
+ catch (error) {
1169
+ throw KeylessError.fromErrorType({
1170
+ type: KeylessErrorType.PROOF_VERIFICATION_FAILED,
1171
+ error,
1172
+ details: "Error encountered when checking zero knowledge relation",
1173
+ });
1174
+ }
1175
+ }
1176
+ /**
1177
+ * Converts the verification key to a JSON format compatible with snarkjs groth16.verify
1178
+ *
1179
+ * @returns An object containing the verification key in snarkjs format
1180
+ * @group Implementation
1181
+ * @category Serialization
1182
+ */
1183
+ toSnarkJsJson() {
1184
+ return {
1185
+ protocol: "groth16",
1186
+ curve: "bn128",
1187
+ nPublic: 1,
1188
+ vk_alpha_1: this.alphaG1.toArray(),
1189
+ vk_beta_2: this.betaG2.toArray(),
1190
+ vk_gamma_2: this.gammaG2.toArray(),
1191
+ vk_delta_2: this.deltaG2.toArray(),
1192
+ IC: this.gammaAbcG1.map((g1) => g1.toArray()),
1193
+ };
1194
+ }
1195
+ }
1196
+ /**
1197
+ * Retrieves the configuration parameters for Keyless Accounts on the blockchain, including the verifying key and the maximum
1198
+ * expiry horizon.
1199
+ *
1200
+ * @param args - The arguments for retrieving the keyless configuration.
1201
+ * @param args.aptosConfig - The Aptos configuration object containing network details.
1202
+ * @param args.options - Optional parameters for the request.
1203
+ * @param args.options.ledgerVersion - The ledger version to query; if not provided, the latest version will be used.
1204
+ * @returns KeylessConfiguration - The configuration object containing the verifying key and maximum expiry horizon.
1205
+ * @group Implementation
1206
+ * @category Serialization
1207
+ */
1208
+ export async function getKeylessConfig(args) {
1209
+ const { aptosConfig } = args;
1210
+ try {
1211
+ return await memoizeAsync(async () => {
1212
+ const [config, vk] = await Promise.all([
1213
+ getKeylessConfigurationResource(args),
1214
+ getGroth16VerificationKeyResource(args),
1215
+ ]);
1216
+ return KeylessConfiguration.create(vk, config);
1217
+ }, `keyless-configuration-${aptosConfig.network}`, 1000 * 60 * 5)();
1218
+ }
1219
+ catch (error) {
1220
+ if (error instanceof KeylessError) {
1221
+ throw error;
1222
+ }
1223
+ throw KeylessError.fromErrorType({
1224
+ type: KeylessErrorType.FULL_NODE_OTHER,
1225
+ error,
1226
+ });
1227
+ }
1228
+ }
1229
+ /**
1230
+ * Parses a JWT and returns the 'iss', 'aud', and 'uid' values.
1231
+ *
1232
+ * @param args - The arguments for parsing the JWT.
1233
+ * @param args.jwt - The JWT to parse.
1234
+ * @param args.uidKey - The key to use for the 'uid' value; defaults to 'sub'.
1235
+ * @returns The 'iss', 'aud', and 'uid' values from the JWT.
1236
+ */
1237
+ export function getIssAudAndUidVal(args) {
1238
+ const { jwt, uidKey = "sub" } = args;
1239
+ let jwtPayload;
1240
+ try {
1241
+ jwtPayload = jwtDecode(jwt);
1242
+ }
1243
+ catch {
1244
+ throw KeylessError.fromErrorType({
1245
+ type: KeylessErrorType.JWT_PARSING_ERROR,
1246
+ // Sanitized error message - don't expose parsing details
1247
+ details: "Invalid JWT format",
1248
+ });
1249
+ }
1250
+ if (typeof jwtPayload.iss !== "string") {
1251
+ throw KeylessError.fromErrorType({
1252
+ type: KeylessErrorType.JWT_PARSING_ERROR,
1253
+ // Sanitized error message - don't expose internal structure
1254
+ details: "Invalid JWT: missing required claim",
1255
+ });
1256
+ }
1257
+ if (typeof jwtPayload.aud !== "string") {
1258
+ throw KeylessError.fromErrorType({
1259
+ type: KeylessErrorType.JWT_PARSING_ERROR,
1260
+ // Sanitized error message - don't expose internal structure
1261
+ details: "Invalid JWT: missing or malformed required claim",
1262
+ });
1263
+ }
1264
+ const uidVal = jwtPayload[uidKey];
1265
+ return { iss: jwtPayload.iss, aud: jwtPayload.aud, uidVal };
1266
+ }
1267
+ /**
1268
+ * Retrieves the KeylessConfiguration set on chain.
1269
+ *
1270
+ * @param args - The arguments for retrieving the configuration.
1271
+ * @param args.aptosConfig - The configuration for connecting to the Aptos network.
1272
+ * @param args.options - Optional parameters for the request.
1273
+ * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.
1274
+ * @returns KeylessConfigurationResponse - The response containing the keyless configuration data.
1275
+ * @group Implementation
1276
+ * @category Serialization
1277
+ */
1278
+ async function getKeylessConfigurationResource(args) {
1279
+ const { aptosConfig, options } = args;
1280
+ const resourceType = "0x1::keyless_account::Configuration";
1281
+ try {
1282
+ const { data } = await getAptosFullNode({
1283
+ aptosConfig,
1284
+ originMethod: "getKeylessConfigurationResource",
1285
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
1286
+ params: { ledger_version: options?.ledgerVersion },
1287
+ });
1288
+ return data.data;
1289
+ }
1290
+ catch (error) {
1291
+ throw KeylessError.fromErrorType({
1292
+ type: KeylessErrorType.FULL_NODE_CONFIG_LOOKUP_ERROR,
1293
+ error,
1294
+ });
1295
+ }
1296
+ }
1297
+ /**
1298
+ * Retrieves the Groth16VerificationKey set on the blockchain.
1299
+ *
1300
+ * @param args - The arguments for retrieving the verification key.
1301
+ * @param args.aptosConfig - The Aptos configuration object.
1302
+ * @param args.options - Optional parameters for the request.
1303
+ * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.
1304
+ * @returns Groth16VerificationKeyResponse - The response containing the Groth16 verification key data.
1305
+ * @group Implementation
1306
+ * @category Serialization
1307
+ */
1308
+ async function getGroth16VerificationKeyResource(args) {
1309
+ const { aptosConfig, options } = args;
1310
+ const resourceType = "0x1::keyless_account::Groth16VerificationKey";
1311
+ try {
1312
+ const { data } = await getAptosFullNode({
1313
+ aptosConfig,
1314
+ originMethod: "getGroth16VerificationKeyResource",
1315
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
1316
+ params: { ledger_version: options?.ledgerVersion },
1317
+ });
1318
+ return data.data;
1319
+ }
1320
+ catch (error) {
1321
+ throw KeylessError.fromErrorType({
1322
+ type: KeylessErrorType.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR,
1323
+ error,
1324
+ });
1325
+ }
1326
+ }
1327
+ /**
1328
+ * Fetches JWKs from the blockchain with optional caching.
1329
+ *
1330
+ * @param args.aptosConfig - The Aptos configuration object.
1331
+ * @param args.jwkAddr - Optional. The address to fetch JWKs from (for federated keyless).
1332
+ * @param args.options - Optional. Ledger version options.
1333
+ * @param args.useCache - Optional. Whether to use cached JWKs. Defaults to true.
1334
+ * @returns A map of issuer to JWK arrays.
1335
+ */
1336
+ export async function getKeylessJWKs(args) {
1337
+ const { aptosConfig, jwkAddr, options, useCache = true } = args;
1338
+ // Generate a cache key based on network and address
1339
+ const addrString = jwkAddr ? AccountAddress.from(jwkAddr).toString() : "0x1";
1340
+ const cacheKey = `keyless-jwks-${aptosConfig.network}-${addrString}`;
1341
+ // If caching is enabled and we have a ledger version, don't use cache
1342
+ // (specific ledger versions should always fetch fresh data)
1343
+ if (useCache && !options?.ledgerVersion) {
1344
+ return memoizeAsync(async () => fetchKeylessJWKsInternal({ aptosConfig, jwkAddr, options }), cacheKey, 1000 * 60 * 5)();
1345
+ }
1346
+ return fetchKeylessJWKsInternal({ aptosConfig, jwkAddr, options });
1347
+ }
1348
+ /**
1349
+ * Internal function to fetch JWKs from the blockchain.
1350
+ */
1351
+ async function fetchKeylessJWKsInternal(args) {
1352
+ const { aptosConfig, jwkAddr, options } = args;
1353
+ let resource;
1354
+ if (!jwkAddr) {
1355
+ const resourceType = "0x1::jwks::PatchedJWKs";
1356
+ const { data } = await getAptosFullNode({
1357
+ aptosConfig,
1358
+ originMethod: "getKeylessJWKs",
1359
+ path: `accounts/0x1/resource/${resourceType}`,
1360
+ params: { ledger_version: options?.ledgerVersion },
1361
+ });
1362
+ resource = data;
1363
+ }
1364
+ else {
1365
+ const resourceType = "0x1::jwks::FederatedJWKs";
1366
+ const { data } = await getAptosFullNode({
1367
+ aptosConfig,
1368
+ originMethod: "getKeylessJWKs",
1369
+ path: `accounts/${AccountAddress.from(jwkAddr).toString()}/resource/${resourceType}`,
1370
+ params: { ledger_version: options?.ledgerVersion },
1371
+ });
1372
+ resource = data;
1373
+ }
1374
+ // Create a map of issuer to JWK arrays
1375
+ const jwkMap = new Map();
1376
+ for (const entry of resource.data.jwks.entries) {
1377
+ const jwks = [];
1378
+ for (const jwkStruct of entry.jwks) {
1379
+ const { data: jwkData } = jwkStruct.variant;
1380
+ const deserializer = new Deserializer(Hex.fromHexInput(jwkData).toUint8Array());
1381
+ const jwk = MoveJWK.deserialize(deserializer);
1382
+ jwks.push(jwk);
1383
+ }
1384
+ jwkMap.set(hexToAsciiString(entry.issuer), jwks);
1385
+ }
1386
+ return jwkMap;
1387
+ }
1388
+ export class MoveJWK extends Serializable {
1389
+ kid;
1390
+ kty;
1391
+ alg;
1392
+ e;
1393
+ n;
1394
+ constructor(args) {
1395
+ super();
1396
+ const { kid, kty, alg, e, n } = args;
1397
+ this.kid = kid;
1398
+ this.kty = kty;
1399
+ this.alg = alg;
1400
+ this.e = e;
1401
+ this.n = n;
1402
+ }
1403
+ serialize(serializer) {
1404
+ serializer.serializeStr(this.kid);
1405
+ serializer.serializeStr(this.kty);
1406
+ serializer.serializeStr(this.alg);
1407
+ serializer.serializeStr(this.e);
1408
+ serializer.serializeStr(this.n);
1409
+ }
1410
+ static fromMoveStruct(struct) {
1411
+ const { data } = struct.variant;
1412
+ const deserializer = new Deserializer(Hex.fromHexInput(data).toUint8Array());
1413
+ return MoveJWK.deserialize(deserializer);
1414
+ }
1415
+ toScalar() {
1416
+ if (this.alg !== "RS256") {
1417
+ throw KeylessError.fromErrorType({
1418
+ type: KeylessErrorType.PROOF_VERIFICATION_FAILED,
1419
+ details: "Failed to convert JWK to scalar when calculating the public inputs hash. Only RSA 256 is supported currently",
1420
+ });
1421
+ }
1422
+ const uint8Array = base64UrlToBytes(this.n);
1423
+ const chunks = chunkInto24Bytes(uint8Array.reverse());
1424
+ const scalars = chunks.map((chunk) => bytesToBigIntLE(chunk));
1425
+ scalars.push(256n); // Add the modulus size
1426
+ return poseidonHash(scalars);
1427
+ }
1428
+ static deserialize(deserializer) {
1429
+ const kid = deserializer.deserializeStr();
1430
+ const kty = deserializer.deserializeStr();
1431
+ const alg = deserializer.deserializeStr();
1432
+ const e = deserializer.deserializeStr();
1433
+ const n = deserializer.deserializeStr();
1434
+ return new MoveJWK({ kid, kty, alg, n, e });
1435
+ }
1436
+ }
1437
+ function chunkInto24Bytes(data) {
1438
+ const chunks = [];
1439
+ for (let i = 0; i < data.length; i += 24) {
1440
+ const chunk = data.slice(i, Math.min(i + 24, data.length));
1441
+ // Pad last chunk with zeros if needed
1442
+ if (chunk.length < 24) {
1443
+ const paddedChunk = new Uint8Array(24);
1444
+ paddedChunk.set(chunk);
1445
+ chunks.push(paddedChunk);
1446
+ }
1447
+ else {
1448
+ chunks.push(chunk);
1449
+ }
1450
+ }
1451
+ return chunks;
1452
+ }
1453
+ /**
1454
+ * Safely parses the JWT header.
1455
+ * @param jwtHeader The JWT header string
1456
+ * @returns Parsed JWT header as an object.
1457
+ * @throws KeylessError if the header is invalid or missing required fields
1458
+ */
1459
+ export function parseJwtHeader(jwtHeader) {
1460
+ try {
1461
+ const header = JSON.parse(jwtHeader);
1462
+ if (header.kid === undefined) {
1463
+ throw KeylessError.fromErrorType({
1464
+ type: KeylessErrorType.JWT_PARSING_ERROR,
1465
+ // Sanitized error message - don't expose internal structure
1466
+ details: "Invalid JWT header: missing required field",
1467
+ });
1468
+ }
1469
+ return header;
1470
+ }
1471
+ catch (error) {
1472
+ if (error instanceof KeylessError) {
1473
+ throw error;
1474
+ }
1475
+ throw KeylessError.fromErrorType({
1476
+ type: KeylessErrorType.JWT_PARSING_ERROR,
1477
+ // Sanitized error message - don't expose parsing details
1478
+ details: "Invalid JWT header format",
1479
+ });
1480
+ }
1481
+ }
1482
+ //# sourceMappingURL=keyless.js.map