@aptos-labs/ts-sdk 1.16.0-zeta.0 → 1.16.0-zeta.2

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 (366) hide show
  1. package/dist/common/{accountAddress-BtD_TE5q.d.ts → accountAddress-YfW6h4Ja.d.ts} +57 -11
  2. package/dist/common/{chunk-VLEH6QBR.js → chunk-HPZUSDYP.js} +1 -1
  3. package/dist/common/{chunk-VLEH6QBR.js.map → chunk-HPZUSDYP.js.map} +1 -1
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/index.d.ts +199 -87
  7. package/dist/common/index.js +27 -27
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/account/Account.mjs +1 -1
  10. package/dist/esm/account/Ed25519Account.mjs +1 -1
  11. package/dist/esm/account/EphemeralKeyPair.d.mts +4 -4
  12. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  13. package/dist/esm/account/KeylessAccount.d.mts +69 -23
  14. package/dist/esm/account/KeylessAccount.mjs +1 -1
  15. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  16. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  17. package/dist/esm/account/index.d.mts +3 -4
  18. package/dist/esm/account/index.mjs +1 -1
  19. package/dist/esm/api/account.mjs +1 -1
  20. package/dist/esm/api/ans.mjs +1 -1
  21. package/dist/esm/api/aptos.d.mts +5 -5
  22. package/dist/esm/api/aptos.mjs +1 -1
  23. package/dist/esm/api/aptosConfig.mjs +1 -1
  24. package/dist/esm/api/coin.mjs +1 -1
  25. package/dist/esm/api/digitalAsset.mjs +1 -1
  26. package/dist/esm/api/event.mjs +1 -1
  27. package/dist/esm/api/faucet.mjs +1 -1
  28. package/dist/esm/api/fungibleAsset.mjs +1 -1
  29. package/dist/esm/api/general.mjs +1 -1
  30. package/dist/esm/api/index.d.mts +5 -5
  31. package/dist/esm/api/index.mjs +1 -1
  32. package/dist/esm/api/keyless.d.mts +15 -11
  33. package/dist/esm/api/keyless.mjs +1 -1
  34. package/dist/esm/api/staking.mjs +1 -1
  35. package/dist/esm/api/table.mjs +1 -1
  36. package/dist/esm/api/transaction.mjs +1 -1
  37. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  39. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  40. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  41. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  42. package/dist/esm/api/utils.mjs +1 -1
  43. package/dist/esm/bcs/deserializer.d.mts +14 -8
  44. package/dist/esm/bcs/deserializer.mjs +1 -1
  45. package/dist/esm/bcs/index.mjs +1 -1
  46. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  47. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  48. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  49. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  50. package/dist/esm/bcs/serializer.d.mts +40 -0
  51. package/dist/esm/bcs/serializer.mjs +1 -1
  52. package/dist/esm/{chunk-4KEEUDZA.mjs → chunk-27PC47S7.mjs} +2 -2
  53. package/dist/esm/{chunk-W36IQO5K.mjs → chunk-2NGHKNUS.mjs} +2 -2
  54. package/dist/esm/{chunk-N466X3S6.mjs → chunk-37FFZSIM.mjs} +2 -2
  55. package/dist/esm/{chunk-VT6XJSRO.mjs → chunk-3IFR6T3V.mjs} +1 -1
  56. package/dist/esm/chunk-3IFR6T3V.mjs.map +1 -0
  57. package/dist/esm/chunk-3RJZNUCQ.mjs +2 -0
  58. package/dist/esm/{chunk-Z2ZR4PTF.mjs → chunk-472OGHMG.mjs} +2 -2
  59. package/dist/esm/chunk-4TDMJQOJ.mjs +2 -0
  60. package/dist/esm/chunk-4TDMJQOJ.mjs.map +1 -0
  61. package/dist/esm/{chunk-STYDBDYL.mjs → chunk-4VPCPASN.mjs} +2 -2
  62. package/dist/esm/{chunk-M7HZOQ6A.mjs → chunk-5YH2YL3L.mjs} +2 -2
  63. package/dist/esm/{chunk-EPTCPBVW.mjs → chunk-6DFVM2W6.mjs} +2 -2
  64. package/dist/esm/{chunk-LEBJNW6Y.mjs → chunk-6FK6OA37.mjs} +2 -2
  65. package/dist/esm/{chunk-FBLSW5TB.mjs → chunk-6GGHUBUA.mjs} +2 -2
  66. package/dist/esm/{chunk-3FVRXELT.mjs → chunk-7BW2N4IE.mjs} +2 -2
  67. package/dist/esm/{chunk-NCDP26DV.mjs → chunk-7JLHN655.mjs} +2 -2
  68. package/dist/esm/{chunk-SBQRBBRS.mjs → chunk-7XRUPEQ4.mjs} +2 -2
  69. package/dist/esm/{chunk-Q3AUNZDW.mjs → chunk-B76XCRLH.mjs} +2 -2
  70. package/dist/esm/{chunk-MTLETLKV.mjs → chunk-BO44HPGU.mjs} +2 -2
  71. package/dist/esm/{chunk-QZRWRX6P.mjs → chunk-CVCM46UN.mjs} +2 -2
  72. package/dist/esm/{chunk-QZRWRX6P.mjs.map → chunk-CVCM46UN.mjs.map} +1 -1
  73. package/dist/esm/{chunk-HGZGTBA4.mjs → chunk-DPWEHSHH.mjs} +2 -2
  74. package/dist/esm/{chunk-LQH7T3TE.mjs → chunk-E4XMEVB7.mjs} +2 -2
  75. package/dist/esm/{chunk-7STYQ5ZE.mjs → chunk-EFMAZTIM.mjs} +2 -2
  76. package/dist/esm/{chunk-NQMF46E5.mjs → chunk-EQN6FVO7.mjs} +2 -2
  77. package/dist/esm/{chunk-T23OVRNF.mjs → chunk-F3ZVWLDH.mjs} +2 -2
  78. package/dist/esm/{chunk-F5C4SZZ7.mjs → chunk-FF4L66LJ.mjs} +2 -2
  79. package/dist/esm/{chunk-EB7AI4B4.mjs → chunk-FGGRPEQ3.mjs} +2 -2
  80. package/dist/esm/{chunk-IEZO4PIG.mjs → chunk-FIG65OJD.mjs} +2 -2
  81. package/dist/esm/chunk-FLALKQIK.mjs +2 -0
  82. package/dist/esm/{chunk-JKZHPY24.mjs.map → chunk-FLALKQIK.mjs.map} +1 -1
  83. package/dist/esm/{chunk-UDU5L4XH.mjs → chunk-FUKWM4HL.mjs} +2 -2
  84. package/dist/esm/{chunk-C3L4ETUF.mjs → chunk-GRHLQDHF.mjs} +2 -2
  85. package/dist/esm/{chunk-MGOHPDX4.mjs → chunk-GSCM444Z.mjs} +2 -2
  86. package/dist/esm/{chunk-T6OEZ4KP.mjs → chunk-GTUBZWAF.mjs} +2 -2
  87. package/dist/esm/chunk-GY6LFCB2.mjs +2 -0
  88. package/dist/esm/chunk-GY6LFCB2.mjs.map +1 -0
  89. package/dist/esm/{chunk-UWI5D7FD.mjs → chunk-H4AGIUGI.mjs} +2 -2
  90. package/dist/esm/{chunk-3Y6JNFPD.mjs → chunk-HZOBRRQP.mjs} +2 -2
  91. package/dist/esm/chunk-I7GRECEJ.mjs +2 -0
  92. package/dist/esm/{chunk-CNH2RAJQ.mjs.map → chunk-I7GRECEJ.mjs.map} +1 -1
  93. package/dist/esm/{chunk-6RBUXB5I.mjs → chunk-IBN7ETCB.mjs} +2 -2
  94. package/dist/esm/{chunk-KFUOOBMJ.mjs → chunk-IGMXAPHY.mjs} +2 -2
  95. package/dist/esm/{chunk-TEJ7BXJK.mjs → chunk-IPSITJFX.mjs} +2 -2
  96. package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
  97. package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
  98. package/dist/esm/{chunk-NC5HHEEM.mjs → chunk-IXFYYWAC.mjs} +2 -2
  99. package/dist/esm/{chunk-REBMGDZ5.mjs → chunk-J6VDYVNB.mjs} +2 -2
  100. package/dist/esm/{chunk-Y5BON557.mjs → chunk-JKRWCFUQ.mjs} +2 -2
  101. package/dist/esm/{chunk-I5JWDZIP.mjs → chunk-JOXU5RWH.mjs} +2 -2
  102. package/dist/esm/chunk-JOXU5RWH.mjs.map +1 -0
  103. package/dist/esm/{chunk-IJE5YSXW.mjs → chunk-JWGG6XFS.mjs} +2 -2
  104. package/dist/esm/{chunk-MWN63XBE.mjs → chunk-K2KJX32L.mjs} +2 -2
  105. package/dist/esm/chunk-KCRCX6BL.mjs +2 -0
  106. package/dist/esm/chunk-KCRCX6BL.mjs.map +1 -0
  107. package/dist/esm/chunk-KGHBTSDR.mjs +2 -0
  108. package/dist/esm/chunk-KGHBTSDR.mjs.map +1 -0
  109. package/dist/esm/{chunk-6KNAIXZ3.mjs → chunk-KMVSI4PC.mjs} +2 -2
  110. package/dist/esm/chunk-KNMQU2TA.mjs +2 -0
  111. package/dist/esm/chunk-KNMQU2TA.mjs.map +1 -0
  112. package/dist/esm/{chunk-Y33VGXNI.mjs → chunk-KSSJ3CT5.mjs} +2 -2
  113. package/dist/esm/{chunk-EIRSA5UU.mjs → chunk-KUMZXNMD.mjs} +2 -2
  114. package/dist/esm/{chunk-NWWXZ7EW.mjs → chunk-L5CPAOUM.mjs} +2 -2
  115. package/dist/esm/{chunk-EADBYPUD.mjs → chunk-LMEJ5K6B.mjs} +2 -2
  116. package/dist/esm/chunk-LYOUEPDG.mjs +2 -0
  117. package/dist/esm/chunk-LYOUEPDG.mjs.map +1 -0
  118. package/dist/esm/{chunk-WAXCU6D6.mjs → chunk-MEOGVBMZ.mjs} +2 -2
  119. package/dist/esm/{chunk-3VGX3TXH.mjs → chunk-MLX6DFMR.mjs} +2 -2
  120. package/dist/esm/{chunk-KKP4FBWZ.mjs → chunk-MX5Z3EHG.mjs} +2 -2
  121. package/dist/esm/{chunk-MWUJCP27.mjs → chunk-NW3WUTTD.mjs} +2 -2
  122. package/dist/esm/{chunk-YHO2EBXH.mjs → chunk-NW6LGHE7.mjs} +2 -2
  123. package/dist/esm/{chunk-ZCCYHFPK.mjs → chunk-OJL36Q4H.mjs} +2 -2
  124. package/dist/esm/{chunk-LO7B3CWN.mjs → chunk-OJUFU5TJ.mjs} +2 -2
  125. package/dist/esm/{chunk-ONIYM7IU.mjs → chunk-PAY7N36H.mjs} +2 -2
  126. package/dist/esm/{chunk-RUSWW265.mjs → chunk-PHEA3NOJ.mjs} +2 -2
  127. package/dist/esm/{chunk-OX5GWFHX.mjs → chunk-PUP6XMAV.mjs} +2 -2
  128. package/dist/esm/{chunk-A3UVZHDJ.mjs → chunk-PWYL5QZP.mjs} +2 -2
  129. package/dist/esm/{chunk-JM2B5E2I.mjs → chunk-Q6LFIZ3L.mjs} +1 -1
  130. package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
  131. package/dist/esm/{chunk-JCDZ2WXX.mjs → chunk-QHB5A5YP.mjs} +1 -1
  132. package/dist/esm/chunk-QHB5A5YP.mjs.map +1 -0
  133. package/dist/esm/{chunk-UFJGYMEB.mjs → chunk-R4KIZ2FK.mjs} +2 -2
  134. package/dist/esm/{chunk-6M53MDWB.mjs → chunk-RTO3YBWQ.mjs} +2 -2
  135. package/dist/esm/{chunk-OT37OTT7.mjs → chunk-RURI53PG.mjs} +2 -2
  136. package/dist/esm/{chunk-5RRZMXND.mjs → chunk-RX5SPT5S.mjs} +2 -2
  137. package/dist/esm/{chunk-4USAUOCE.mjs → chunk-RYRID5HT.mjs} +2 -2
  138. package/dist/esm/{chunk-Z6JERVLX.mjs → chunk-SBEZ64HG.mjs} +2 -2
  139. package/dist/esm/{chunk-C34M4T77.mjs → chunk-SNDFJWYM.mjs} +2 -2
  140. package/dist/esm/chunk-T4HO5JMQ.mjs +2 -0
  141. package/dist/esm/chunk-T4HO5JMQ.mjs.map +1 -0
  142. package/dist/esm/{chunk-7H3HRFVM.mjs → chunk-T5YEMU53.mjs} +2 -2
  143. package/dist/esm/{chunk-ZNEBMSNC.mjs → chunk-TUCCV62K.mjs} +2 -2
  144. package/dist/esm/{chunk-7QGIAVW4.mjs → chunk-UBON2G6Y.mjs} +2 -2
  145. package/dist/esm/{chunk-TVRJ3M7B.mjs → chunk-UMLUOYFK.mjs} +1 -1
  146. package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-UMLUOYFK.mjs.map} +1 -1
  147. package/dist/esm/chunk-VCAURUJ3.mjs +2 -0
  148. package/dist/esm/chunk-VCAURUJ3.mjs.map +1 -0
  149. package/dist/esm/chunk-VJ3OBIFQ.mjs +2 -0
  150. package/dist/esm/chunk-VJ3OBIFQ.mjs.map +1 -0
  151. package/dist/esm/{chunk-COW5IGYC.mjs → chunk-WA2NTBYY.mjs} +2 -2
  152. package/dist/esm/{chunk-UO5LUYGO.mjs → chunk-XGDLSWBF.mjs} +2 -2
  153. package/dist/esm/{chunk-EU6CX56Q.mjs → chunk-XH33BXEY.mjs} +2 -2
  154. package/dist/esm/{chunk-PYUU4OEL.mjs → chunk-XVZBWW46.mjs} +2 -2
  155. package/dist/esm/chunk-YBXQVY7N.mjs +2 -0
  156. package/dist/esm/{chunk-N7CE244N.mjs.map → chunk-YBXQVY7N.mjs.map} +1 -1
  157. package/dist/esm/{chunk-MKUAW7KW.mjs → chunk-YDNOKWV3.mjs} +2 -2
  158. package/dist/esm/{chunk-W637YAND.mjs → chunk-YRUF6N3U.mjs} +2 -2
  159. package/dist/esm/cli/index.mjs +1 -1
  160. package/dist/esm/cli/localNode.mjs +1 -1
  161. package/dist/esm/client/core.mjs +1 -1
  162. package/dist/esm/client/get.d.mts +6 -0
  163. package/dist/esm/client/get.mjs +1 -1
  164. package/dist/esm/client/index.mjs +1 -1
  165. package/dist/esm/client/post.d.mts +6 -0
  166. package/dist/esm/client/post.mjs +1 -1
  167. package/dist/esm/core/account/index.mjs +1 -1
  168. package/dist/esm/core/account/utils/address.mjs +1 -1
  169. package/dist/esm/core/account/utils/index.mjs +1 -1
  170. package/dist/esm/core/accountAddress.mjs +1 -1
  171. package/dist/esm/core/authenticationKey.mjs +1 -1
  172. package/dist/esm/core/crypto/cryptoHasher.d.mts +21 -0
  173. package/dist/esm/core/crypto/cryptoHasher.mjs +2 -0
  174. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  175. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  176. package/dist/esm/core/crypto/index.d.mts +2 -1
  177. package/dist/esm/core/crypto/index.mjs +1 -1
  178. package/dist/esm/core/crypto/keyless.d.mts +52 -8
  179. package/dist/esm/core/crypto/keyless.mjs +1 -1
  180. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  181. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  182. package/dist/esm/core/crypto/poseidon.d.mts +14 -2
  183. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  184. package/dist/esm/core/crypto/proof.mjs +1 -1
  185. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  186. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  187. package/dist/esm/core/crypto/signature.mjs +1 -1
  188. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  189. package/dist/esm/core/index.d.mts +2 -1
  190. package/dist/esm/core/index.mjs +1 -1
  191. package/dist/esm/index.d.mts +6 -5
  192. package/dist/esm/index.mjs +1 -1
  193. package/dist/esm/internal/account.mjs +1 -1
  194. package/dist/esm/internal/ans.mjs +1 -1
  195. package/dist/esm/internal/coin.mjs +1 -1
  196. package/dist/esm/internal/digitalAsset.mjs +1 -1
  197. package/dist/esm/internal/event.mjs +1 -1
  198. package/dist/esm/internal/faucet.mjs +1 -1
  199. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  200. package/dist/esm/internal/general.mjs +1 -1
  201. package/dist/esm/internal/keyless.d.mts +10 -9
  202. package/dist/esm/internal/keyless.mjs +1 -1
  203. package/dist/esm/internal/staking.mjs +1 -1
  204. package/dist/esm/internal/table.mjs +1 -1
  205. package/dist/esm/internal/transaction.mjs +1 -1
  206. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  207. package/dist/esm/internal/view.mjs +1 -1
  208. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  209. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  210. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  211. package/dist/esm/transactions/index.d.mts +1 -2
  212. package/dist/esm/transactions/index.mjs +1 -1
  213. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  214. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  215. package/dist/esm/transactions/instances/index.mjs +1 -1
  216. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  217. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  218. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  219. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  220. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  221. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  222. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  223. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  224. package/dist/esm/transactions/management/index.mjs +1 -1
  225. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  226. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  227. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -2
  228. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  229. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  230. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -11
  231. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  232. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  233. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  234. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  235. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  236. package/dist/esm/types/index.d.mts +2 -2
  237. package/dist/esm/types/index.mjs +1 -1
  238. package/dist/esm/types/keyless.d.mts +37 -1
  239. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  240. package/dist/esm/utils/helpers.mjs +1 -1
  241. package/dist/esm/utils/index.mjs +1 -1
  242. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  243. package/dist/esm/version.d.mts +1 -1
  244. package/dist/esm/version.mjs +1 -1
  245. package/package.json +1 -2
  246. package/src/account/EphemeralKeyPair.ts +6 -6
  247. package/src/account/KeylessAccount.ts +72 -66
  248. package/src/api/keyless.ts +13 -4
  249. package/src/bcs/deserializer.ts +14 -8
  250. package/src/bcs/serializer.ts +40 -0
  251. package/src/client/core.ts +4 -8
  252. package/src/client/get.ts +6 -0
  253. package/src/client/post.ts +6 -0
  254. package/src/core/crypto/cryptoHasher.ts +16 -0
  255. package/src/core/crypto/keyless.ts +155 -23
  256. package/src/core/crypto/poseidon.ts +19 -8
  257. package/src/internal/keyless.ts +83 -15
  258. package/src/internal/transactionSubmission.ts +2 -2
  259. package/src/transactions/transactionBuilder/signingMessage.ts +0 -13
  260. package/src/transactions/transactionBuilder/transactionBuilder.ts +4 -2
  261. package/src/types/index.ts +2 -2
  262. package/src/types/keyless.ts +36 -0
  263. package/src/utils/apiEndpoints.ts +5 -3
  264. package/src/utils/helpers.ts +0 -1
  265. package/src/version.ts +1 -1
  266. package/dist/esm/bcs/cryptoHasher.d.mts +0 -15
  267. package/dist/esm/bcs/cryptoHasher.mjs +0 -2
  268. package/dist/esm/chunk-5ADNWXP2.mjs +0 -2
  269. package/dist/esm/chunk-5ADNWXP2.mjs.map +0 -1
  270. package/dist/esm/chunk-5V2RGYYK.mjs +0 -2
  271. package/dist/esm/chunk-5V2RGYYK.mjs.map +0 -1
  272. package/dist/esm/chunk-5YI2GEG5.mjs +0 -2
  273. package/dist/esm/chunk-5YI2GEG5.mjs.map +0 -1
  274. package/dist/esm/chunk-CNH2RAJQ.mjs +0 -2
  275. package/dist/esm/chunk-I5JWDZIP.mjs.map +0 -1
  276. package/dist/esm/chunk-JCDZ2WXX.mjs.map +0 -1
  277. package/dist/esm/chunk-JKZHPY24.mjs +0 -2
  278. package/dist/esm/chunk-JM2B5E2I.mjs.map +0 -1
  279. package/dist/esm/chunk-KPZDC5ZE.mjs +0 -2
  280. package/dist/esm/chunk-KPZDC5ZE.mjs.map +0 -1
  281. package/dist/esm/chunk-LECNIPW7.mjs +0 -2
  282. package/dist/esm/chunk-LECNIPW7.mjs.map +0 -1
  283. package/dist/esm/chunk-N7CE244N.mjs +0 -2
  284. package/dist/esm/chunk-R2P2XANA.mjs +0 -2
  285. package/dist/esm/chunk-R2P2XANA.mjs.map +0 -1
  286. package/dist/esm/chunk-UTXJOB3O.mjs +0 -2
  287. package/dist/esm/chunk-VT6XJSRO.mjs.map +0 -1
  288. package/dist/esm/chunk-W4IWORPF.mjs +0 -2
  289. package/dist/esm/chunk-W4IWORPF.mjs.map +0 -1
  290. package/dist/esm/chunk-WDE54GRQ.mjs +0 -2
  291. package/dist/esm/chunk-WDE54GRQ.mjs.map +0 -1
  292. package/dist/esm/chunk-YZPQVZ7S.mjs +0 -2
  293. package/dist/esm/chunk-YZPQVZ7S.mjs.map +0 -1
  294. package/dist/esm/chunk-ZUQJLFR2.mjs +0 -2
  295. package/dist/esm/chunk-ZUQJLFR2.mjs.map +0 -1
  296. package/src/bcs/cryptoHasher.ts +0 -6
  297. /package/dist/esm/{chunk-4KEEUDZA.mjs.map → chunk-27PC47S7.mjs.map} +0 -0
  298. /package/dist/esm/{chunk-W36IQO5K.mjs.map → chunk-2NGHKNUS.mjs.map} +0 -0
  299. /package/dist/esm/{chunk-N466X3S6.mjs.map → chunk-37FFZSIM.mjs.map} +0 -0
  300. /package/dist/esm/{chunk-UTXJOB3O.mjs.map → chunk-3RJZNUCQ.mjs.map} +0 -0
  301. /package/dist/esm/{chunk-Z2ZR4PTF.mjs.map → chunk-472OGHMG.mjs.map} +0 -0
  302. /package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-4VPCPASN.mjs.map} +0 -0
  303. /package/dist/esm/{chunk-M7HZOQ6A.mjs.map → chunk-5YH2YL3L.mjs.map} +0 -0
  304. /package/dist/esm/{chunk-EPTCPBVW.mjs.map → chunk-6DFVM2W6.mjs.map} +0 -0
  305. /package/dist/esm/{chunk-LEBJNW6Y.mjs.map → chunk-6FK6OA37.mjs.map} +0 -0
  306. /package/dist/esm/{chunk-FBLSW5TB.mjs.map → chunk-6GGHUBUA.mjs.map} +0 -0
  307. /package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-7BW2N4IE.mjs.map} +0 -0
  308. /package/dist/esm/{chunk-NCDP26DV.mjs.map → chunk-7JLHN655.mjs.map} +0 -0
  309. /package/dist/esm/{chunk-SBQRBBRS.mjs.map → chunk-7XRUPEQ4.mjs.map} +0 -0
  310. /package/dist/esm/{chunk-Q3AUNZDW.mjs.map → chunk-B76XCRLH.mjs.map} +0 -0
  311. /package/dist/esm/{chunk-MTLETLKV.mjs.map → chunk-BO44HPGU.mjs.map} +0 -0
  312. /package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-DPWEHSHH.mjs.map} +0 -0
  313. /package/dist/esm/{chunk-LQH7T3TE.mjs.map → chunk-E4XMEVB7.mjs.map} +0 -0
  314. /package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-EFMAZTIM.mjs.map} +0 -0
  315. /package/dist/esm/{chunk-NQMF46E5.mjs.map → chunk-EQN6FVO7.mjs.map} +0 -0
  316. /package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-F3ZVWLDH.mjs.map} +0 -0
  317. /package/dist/esm/{chunk-F5C4SZZ7.mjs.map → chunk-FF4L66LJ.mjs.map} +0 -0
  318. /package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-FGGRPEQ3.mjs.map} +0 -0
  319. /package/dist/esm/{chunk-IEZO4PIG.mjs.map → chunk-FIG65OJD.mjs.map} +0 -0
  320. /package/dist/esm/{chunk-UDU5L4XH.mjs.map → chunk-FUKWM4HL.mjs.map} +0 -0
  321. /package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-GRHLQDHF.mjs.map} +0 -0
  322. /package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-GSCM444Z.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-T6OEZ4KP.mjs.map → chunk-GTUBZWAF.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-UWI5D7FD.mjs.map → chunk-H4AGIUGI.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-3Y6JNFPD.mjs.map → chunk-HZOBRRQP.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-IBN7ETCB.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-KFUOOBMJ.mjs.map → chunk-IGMXAPHY.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-TEJ7BXJK.mjs.map → chunk-IPSITJFX.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-IXFYYWAC.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-REBMGDZ5.mjs.map → chunk-J6VDYVNB.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-Y5BON557.mjs.map → chunk-JKRWCFUQ.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-IJE5YSXW.mjs.map → chunk-JWGG6XFS.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-MWN63XBE.mjs.map → chunk-K2KJX32L.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-6KNAIXZ3.mjs.map → chunk-KMVSI4PC.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-Y33VGXNI.mjs.map → chunk-KSSJ3CT5.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-EIRSA5UU.mjs.map → chunk-KUMZXNMD.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-NWWXZ7EW.mjs.map → chunk-L5CPAOUM.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-EADBYPUD.mjs.map → chunk-LMEJ5K6B.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-WAXCU6D6.mjs.map → chunk-MEOGVBMZ.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-MLX6DFMR.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-KKP4FBWZ.mjs.map → chunk-MX5Z3EHG.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-NW3WUTTD.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-YHO2EBXH.mjs.map → chunk-NW6LGHE7.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-ZCCYHFPK.mjs.map → chunk-OJL36Q4H.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-LO7B3CWN.mjs.map → chunk-OJUFU5TJ.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-ONIYM7IU.mjs.map → chunk-PAY7N36H.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-RUSWW265.mjs.map → chunk-PHEA3NOJ.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-OX5GWFHX.mjs.map → chunk-PUP6XMAV.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-A3UVZHDJ.mjs.map → chunk-PWYL5QZP.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-UFJGYMEB.mjs.map → chunk-R4KIZ2FK.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-6M53MDWB.mjs.map → chunk-RTO3YBWQ.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-OT37OTT7.mjs.map → chunk-RURI53PG.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-5RRZMXND.mjs.map → chunk-RX5SPT5S.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-4USAUOCE.mjs.map → chunk-RYRID5HT.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-Z6JERVLX.mjs.map → chunk-SBEZ64HG.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-C34M4T77.mjs.map → chunk-SNDFJWYM.mjs.map} +0 -0
  357. /package/dist/esm/{chunk-7H3HRFVM.mjs.map → chunk-T5YEMU53.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-TUCCV62K.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-7QGIAVW4.mjs.map → chunk-UBON2G6Y.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-WA2NTBYY.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-UO5LUYGO.mjs.map → chunk-XGDLSWBF.mjs.map} +0 -0
  362. /package/dist/esm/{chunk-EU6CX56Q.mjs.map → chunk-XH33BXEY.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-PYUU4OEL.mjs.map → chunk-XVZBWW46.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-MKUAW7KW.mjs.map → chunk-YDNOKWV3.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-W637YAND.mjs.map → chunk-YRUF6N3U.mjs.map} +0 -0
  366. /package/dist/esm/{bcs → core/crypto}/cryptoHasher.mjs.map +0 -0
@@ -7,9 +7,11 @@ import { Deserializer, Serializable, Serializer } from "../../bcs";
7
7
  import { Hex } from "../hex";
8
8
  import { HexInput, EphemeralCertificateVariant, AnyPublicKeyVariant, SigningScheme, ZkpVariant } from "../../types";
9
9
  import { EphemeralPublicKey, EphemeralSignature } from "./ephemeral";
10
- import { bigIntToBytesLE, bytesToBigIntLE, hashASCIIStrToField, poseidonHash } from "./poseidon";
10
+ import { bigIntToBytesLE, bytesToBigIntLE, hashStrToField, poseidonHash } from "./poseidon";
11
11
  import { AuthenticationKey } from "../authenticationKey";
12
12
  import { Proof } from "./proof";
13
+ import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
14
+ import { Groth16VerificationKeyResponse } from "../../types/keyless";
13
15
 
14
16
  export const EPK_HORIZON_SECS = 10000000;
15
17
  export const MAX_AUD_VAL_BYTES = 120;
@@ -28,15 +30,23 @@ export const MAX_COMMITED_EPK_BYTES = 93;
28
30
  export class KeylessPublicKey extends AccountPublicKey {
29
31
  static readonly ID_COMMITMENT_LENGTH: number = 32;
30
32
 
33
+ /**
34
+ * The value of the 'iss' claim on the JWT which identifies the OIDC provider.
35
+ */
31
36
  readonly iss: string;
32
37
 
38
+ /**
39
+ * A value representing a cryptographic commitment to a user identity.
40
+ *
41
+ * It is calculated from the aud, uidKey, uidVal, pepper.
42
+ */
33
43
  readonly idCommitment: Uint8Array;
34
44
 
35
45
  constructor(iss: string, idCommitment: HexInput) {
36
46
  super();
37
47
  const idcBytes = Hex.fromHexInput(idCommitment).toUint8Array();
38
48
  if (idcBytes.length !== KeylessPublicKey.ID_COMMITMENT_LENGTH) {
39
- throw new Error(`Address seed length in bytes should be ${KeylessPublicKey.ID_COMMITMENT_LENGTH}`);
49
+ throw new Error(`Id Commitment length in bytes should be ${KeylessPublicKey.ID_COMMITMENT_LENGTH}`);
40
50
  }
41
51
  this.iss = iss;
42
52
  this.idCommitment = idcBytes;
@@ -135,9 +145,9 @@ function computeIdCommitment(args: { uidKey: string; uidVal: string; aud: string
135
145
 
136
146
  const fields = [
137
147
  bytesToBigIntLE(Hex.fromHexInput(pepper).toUint8Array()),
138
- hashASCIIStrToField(aud, MAX_AUD_VAL_BYTES),
139
- hashASCIIStrToField(uidVal, MAX_UID_VAL_BYTES),
140
- hashASCIIStrToField(uidKey, MAX_UID_KEY_BYTES),
148
+ hashStrToField(aud, MAX_AUD_VAL_BYTES),
149
+ hashStrToField(uidVal, MAX_UID_VAL_BYTES),
150
+ hashStrToField(uidKey, MAX_UID_KEY_BYTES),
141
151
  ];
142
152
 
143
153
  return bigIntToBytesLE(poseidonHash(fields), KeylessPublicKey.ID_COMMITMENT_LENGTH);
@@ -160,7 +170,7 @@ export class KeylessSignature extends Signature {
160
170
  /**
161
171
  * The expiry timestamp in seconds of the EphemeralKeyPair used to sign
162
172
  */
163
- readonly expiryDateSecs: bigint | number;
173
+ readonly expiryDateSecs: number;
164
174
 
165
175
  /**
166
176
  * The ephemeral public key used to verify the signature
@@ -175,7 +185,7 @@ export class KeylessSignature extends Signature {
175
185
  constructor(args: {
176
186
  jwtHeader: string;
177
187
  ephemeralCertificate: EphemeralCertificate;
178
- expiryDateSecs: bigint | number;
188
+ expiryDateSecs: number;
179
189
  ephemeralPublicKey: EphemeralPublicKey;
180
190
  ephemeralSignature: EphemeralSignature;
181
191
  }) {
@@ -213,7 +223,7 @@ export class KeylessSignature extends Signature {
213
223
  const ephemeralSignature = EphemeralSignature.deserialize(deserializer);
214
224
  return new KeylessSignature({
215
225
  jwtHeader,
216
- expiryDateSecs,
226
+ expiryDateSecs: Number(expiryDateSecs),
217
227
  ephemeralCertificate,
218
228
  ephemeralPublicKey,
219
229
  ephemeralSignature,
@@ -228,13 +238,31 @@ export class KeylessSignature extends Signature {
228
238
  const ephemeralSignature = EphemeralSignature.deserialize(deserializer);
229
239
  return new KeylessSignature({
230
240
  jwtHeader,
231
- expiryDateSecs,
241
+ expiryDateSecs: Number(expiryDateSecs),
232
242
  ephemeralCertificate,
233
243
  ephemeralPublicKey,
234
244
  ephemeralSignature,
235
245
  });
236
246
  }
237
247
 
248
+ static getSimulationSignature(): KeylessSignature {
249
+ return new KeylessSignature({
250
+ jwtHeader: "{}",
251
+ ephemeralCertificate: new EphemeralCertificate(
252
+ new ZeroKnowledgeSig({
253
+ proof: new ZkProof(
254
+ new Groth16Zkp({ a: new Uint8Array(32), b: new Uint8Array(64), c: new Uint8Array(32) }),
255
+ ZkpVariant.Groth16,
256
+ ),
257
+ }),
258
+ EphemeralCertificateVariant.ZkProof,
259
+ ),
260
+ expiryDateSecs: 0,
261
+ ephemeralPublicKey: new EphemeralPublicKey(new Ed25519PublicKey(new Uint8Array(32))),
262
+ ephemeralSignature: new EphemeralSignature(new Ed25519Signature(new Uint8Array(64))),
263
+ });
264
+ }
265
+
238
266
  static isSignature(signature: Signature): signature is KeylessSignature {
239
267
  return signature instanceof KeylessSignature;
240
268
  }
@@ -282,6 +310,48 @@ export class EphemeralCertificate extends Signature {
282
310
  }
283
311
  }
284
312
 
313
+ class G1Bytes extends Serializable {
314
+ data: Uint8Array;
315
+
316
+ constructor(data: HexInput) {
317
+ super();
318
+ this.data = Hex.fromHexInput(data).toUint8Array();
319
+ if (this.data.length !== 32) {
320
+ throw new Error("Input needs to be 32 bytes");
321
+ }
322
+ }
323
+
324
+ serialize(serializer: Serializer): void {
325
+ serializer.serializeFixedBytes(this.data);
326
+ }
327
+
328
+ static deserialize(deserializer: Deserializer): G1Bytes {
329
+ const bytes = deserializer.deserializeFixedBytes(32);
330
+ return new G1Bytes(bytes);
331
+ }
332
+ }
333
+
334
+ class G2Bytes extends Serializable {
335
+ data: Uint8Array;
336
+
337
+ constructor(data: HexInput) {
338
+ super();
339
+ this.data = Hex.fromHexInput(data).toUint8Array();
340
+ if (this.data.length !== 64) {
341
+ throw new Error("Input needs to be 64 bytes");
342
+ }
343
+ }
344
+
345
+ serialize(serializer: Serializer): void {
346
+ serializer.serializeFixedBytes(this.data);
347
+ }
348
+
349
+ static deserialize(deserializer: Deserializer): G2Bytes {
350
+ const bytes = deserializer.deserializeFixedBytes(64);
351
+ return new G2Bytes(bytes);
352
+ }
353
+ }
354
+
285
355
  /**
286
356
  * A representation of a Groth16 proof. The points are the compressed serialization of affine reprentation of the proof.
287
357
  */
@@ -289,36 +359,36 @@ export class Groth16Zkp extends Proof {
289
359
  /**
290
360
  * The bytes of G1 proof point a
291
361
  */
292
- a: Uint8Array;
362
+ a: G1Bytes;
293
363
 
294
364
  /**
295
365
  * The bytes of G2 proof point b
296
366
  */
297
- b: Uint8Array;
367
+ b: G2Bytes;
298
368
 
299
369
  /**
300
370
  * The bytes of G1 proof point c
301
371
  */
302
- c: Uint8Array;
372
+ c: G1Bytes;
303
373
 
304
374
  constructor(args: { a: HexInput; b: HexInput; c: HexInput }) {
305
375
  super();
306
376
  const { a, b, c } = args;
307
- this.a = Hex.fromHexInput(a).toUint8Array();
308
- this.b = Hex.fromHexInput(b).toUint8Array();
309
- this.c = Hex.fromHexInput(c).toUint8Array();
377
+ this.a = new G1Bytes(a);
378
+ this.b = new G2Bytes(b);
379
+ this.c = new G1Bytes(c);
310
380
  }
311
381
 
312
382
  serialize(serializer: Serializer): void {
313
- serializer.serializeFixedBytes(this.a);
314
- serializer.serializeFixedBytes(this.b);
315
- serializer.serializeFixedBytes(this.c);
383
+ this.a.serialize(serializer);
384
+ this.b.serialize(serializer);
385
+ this.c.serialize(serializer);
316
386
  }
317
387
 
318
388
  static deserialize(deserializer: Deserializer): Groth16Zkp {
319
- const a = deserializer.deserializeFixedBytes(32);
320
- const b = deserializer.deserializeFixedBytes(64);
321
- const c = deserializer.deserializeFixedBytes(32);
389
+ const a = G1Bytes.deserialize(deserializer).bcsToBytes();
390
+ const b = G2Bytes.deserialize(deserializer).bcsToBytes();
391
+ const c = G1Bytes.deserialize(deserializer).bcsToBytes();
322
392
  return new Groth16Zkp({ a, b, c });
323
393
  }
324
394
  }
@@ -371,12 +441,13 @@ export class ZeroKnowledgeSig extends Signature {
371
441
  readonly expHorizonSecs: bigint;
372
442
 
373
443
  /**
374
- * A key value pair on the JWT token that can be made public
444
+ * A key value pair on the JWT token that can be specified on the signature which would reveal the value on chain.
445
+ * Can be used to assert identity or other attributes.
375
446
  */
376
447
  readonly extraField?: string;
377
448
 
378
449
  /**
379
- * Set in the case of signing by recovery services
450
+ * The 'aud' value of the recovery service which is set when recovering an account.
380
451
  */
381
452
  readonly overrideAudVal?: string;
382
453
 
@@ -451,3 +522,64 @@ export class ZeroKnowledgeSig extends Signature {
451
522
  return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });
452
523
  }
453
524
  }
525
+
526
+ export class KeylessConfiguration {
527
+ readonly verficationKey: Groth16VerificationKey;
528
+
529
+ readonly maxExpHorizonSecs: number;
530
+
531
+ constructor(verficationKey: Groth16VerificationKey, maxExpHorizonSecs: number) {
532
+ this.verficationKey = verficationKey;
533
+ this.maxExpHorizonSecs = maxExpHorizonSecs;
534
+ }
535
+
536
+ static create(res: Groth16VerificationKeyResponse, maxExpHorizonSecs: number): KeylessConfiguration {
537
+ return new KeylessConfiguration(
538
+ new Groth16VerificationKey({
539
+ alphaG1: res.alpha_g1,
540
+ betaG2: res.beta_g2,
541
+ deltaG2: res.delta_g2,
542
+ gammaAbcG1: res.gamma_abc_g1,
543
+ gammaG2: res.gamma_g2,
544
+ }),
545
+ maxExpHorizonSecs,
546
+ );
547
+ }
548
+ }
549
+
550
+ class Groth16VerificationKey {
551
+ readonly alphaG1: G1Bytes;
552
+
553
+ readonly betaG2: G2Bytes;
554
+
555
+ readonly deltaG2: G2Bytes;
556
+
557
+ readonly gammaAbcG1: G1Bytes[];
558
+
559
+ readonly gammaG2: G2Bytes;
560
+
561
+ constructor(args: {
562
+ alphaG1: HexInput;
563
+ betaG2: HexInput;
564
+ deltaG2: HexInput;
565
+ gammaAbcG1: [HexInput, HexInput];
566
+ gammaG2: HexInput;
567
+ }) {
568
+ const { alphaG1, betaG2, deltaG2, gammaAbcG1, gammaG2 } = args;
569
+ this.alphaG1 = new G1Bytes(alphaG1);
570
+ this.betaG2 = new G2Bytes(betaG2);
571
+ this.deltaG2 = new G2Bytes(deltaG2);
572
+ this.gammaAbcG1 = [new G1Bytes(gammaAbcG1[0]), new G1Bytes(gammaAbcG1[1])];
573
+ this.gammaG2 = new G2Bytes(gammaG2);
574
+ }
575
+
576
+ static fromGroth16VerificationKeyResponse(res: Groth16VerificationKeyResponse): Groth16VerificationKey {
577
+ return new Groth16VerificationKey({
578
+ alphaG1: res.alpha_g1,
579
+ betaG2: res.beta_g2,
580
+ deltaG2: res.delta_g2,
581
+ gammaAbcG1: res.gamma_abc_g1,
582
+ gammaG2: res.gamma_g2,
583
+ });
584
+ }
585
+ }
@@ -41,14 +41,18 @@ const BYTES_PACKED_PER_SCALAR = 31;
41
41
  const MAX_NUM_INPUT_SCALARS = 16;
42
42
  const MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALAR;
43
43
 
44
- // hashes an ASCII string to a field element
45
- export function hashASCIIStrToField(str: string, maxSizeBytes: number) {
44
+ /**
45
+ * Hashes a string to a field element via poseidon
46
+ *
47
+ * @returns bigint result of the hash
48
+ */
49
+ export function hashStrToField(str: string, maxSizeBytes: number): bigint {
46
50
  const textEncoder = new TextEncoder();
47
51
  const strBytes = textEncoder.encode(str);
48
52
  return hashBytesWithLen(strBytes, maxSizeBytes);
49
53
  }
50
54
 
51
- function hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number) {
55
+ function hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint {
52
56
  if (bytes.length > maxSizeBytes) {
53
57
  throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);
54
58
  }
@@ -123,11 +127,18 @@ function padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uin
123
127
  return paddedArray;
124
128
  }
125
129
 
130
+ /**
131
+ * Hashes up to 16 scalar elements via the poseidon hashing algorithm.
132
+ *
133
+ * Each element must be scalar fields of the BN254 elliptic curve group.
134
+ *
135
+ * @returns bigint result of the hash
136
+ */
126
137
  export function poseidonHash(inputs: (number | bigint | string)[]): bigint {
127
- const poseidonFixedHash = numInputsToPoseidonFunc[inputs.length - 1];
128
-
129
- if (poseidonFixedHash) {
130
- return poseidonFixedHash(inputs);
138
+ if (inputs.length > numInputsToPoseidonFunc.length) {
139
+ throw new Error(
140
+ `Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`,
141
+ );
131
142
  }
132
- throw new Error(`Unable to hash input of length ${inputs.length}`);
143
+ return numInputsToPoseidonFunc[inputs.length - 1](inputs);
133
144
  }
@@ -5,14 +5,79 @@
5
5
  * This file contains the underlying implementations for exposed API surface in
6
6
  * the {@link api/keyless}. By moving the methods out into a separate file,
7
7
  * other namespaces and processes can access these methods without depending on the entire
8
- * faucet namespace and without having a dependency cycle error.
8
+ * keyless namespace and without having a dependency cycle error.
9
9
  */
10
10
  import { AptosConfig } from "../api/aptosConfig";
11
- import { postAptosPepperService, postAptosProvingService } from "../client";
12
- import { EPK_HORIZON_SECS, EphemeralSignature, Groth16Zkp, Hex, ZeroKnowledgeSig, ZkProof } from "../core";
13
- import { HexInput, ZkpVariant } from "../types";
11
+ import { getAptosFullNode, postAptosPepperService, postAptosProvingService } from "../client";
12
+ import {
13
+ AccountAddress,
14
+ EPK_HORIZON_SECS,
15
+ EphemeralSignature,
16
+ Groth16Zkp,
17
+ Hex,
18
+ KeylessConfiguration,
19
+ ZeroKnowledgeSig,
20
+ ZkProof,
21
+ } from "../core";
22
+ import { HexInput, LedgerVersionArg, MoveResource, ZkpVariant } from "../types";
14
23
  import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
15
- import { PepperFetchResponse, ProverResponse } from "../types/keyless";
24
+ import {
25
+ Groth16VerificationKeyResponse,
26
+ KeylessConfigurationResponse,
27
+ PepperFetchRequest,
28
+ PepperFetchResponse,
29
+ ProverRequest,
30
+ ProverResponse,
31
+ } from "../types/keyless";
32
+ import { memoizeAsync } from "../utils/memoize";
33
+
34
+ export async function getKeylessConfig(args: {
35
+ aptosConfig: AptosConfig;
36
+ options?: LedgerVersionArg;
37
+ }): Promise<KeylessConfiguration> {
38
+ const { aptosConfig } = args;
39
+ return memoizeAsync(
40
+ async () => {
41
+ const config = await getKeylessConfiguration(args);
42
+ const vk = await getGroth16VerificationKey(args);
43
+ return KeylessConfiguration.create(vk, Number(config.max_exp_horizon_secs));
44
+ },
45
+ `keyless-configuration-${aptosConfig.network}`,
46
+ 1000 * 60 * 5, // 5 minutes
47
+ )();
48
+ }
49
+
50
+ async function getKeylessConfiguration(args: {
51
+ aptosConfig: AptosConfig;
52
+ options?: LedgerVersionArg;
53
+ }): Promise<KeylessConfigurationResponse> {
54
+ const { aptosConfig, options } = args;
55
+ const resourceType = "0x1::keyless_account::Configuration";
56
+ const { data } = await getAptosFullNode<{}, MoveResource<KeylessConfigurationResponse>>({
57
+ aptosConfig,
58
+ originMethod: "getKeylessConfiguration",
59
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
60
+ params: { ledger_version: options?.ledgerVersion },
61
+ });
62
+
63
+ return data.data;
64
+ }
65
+
66
+ async function getGroth16VerificationKey(args: {
67
+ aptosConfig: AptosConfig;
68
+ options?: LedgerVersionArg;
69
+ }): Promise<Groth16VerificationKeyResponse> {
70
+ const { aptosConfig, options } = args;
71
+ const resourceType = "0x1::keyless_account::Groth16VerificationKey";
72
+ const { data } = await getAptosFullNode<{}, MoveResource<Groth16VerificationKeyResponse>>({
73
+ aptosConfig,
74
+ originMethod: "getGroth16VerificationKey",
75
+ path: `accounts/${AccountAddress.from("0x1").toString()}/resource/${resourceType}`,
76
+ params: { ledger_version: options?.ledgerVersion },
77
+ });
78
+
79
+ return data.data;
80
+ }
16
81
 
17
82
  export async function getPepper(args: {
18
83
  aptosConfig: AptosConfig;
@@ -26,12 +91,12 @@ export async function getPepper(args: {
26
91
  const body = {
27
92
  jwt_b64: jwt,
28
93
  epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
29
- exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),
94
+ exp_date_secs: ephemeralKeyPair.expiryDateSecs,
30
95
  epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
31
- uid_key: uidKey,
96
+ uid_key: uidKey || "sub",
32
97
  derivation_path: derivationPath,
33
98
  };
34
- const { data } = await postAptosPepperService<any, PepperFetchResponse>({
99
+ const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({
35
100
  aptosConfig,
36
101
  path: "fetch",
37
102
  body,
@@ -47,21 +112,21 @@ export async function getProof(args: {
47
112
  ephemeralKeyPair: EphemeralKeyPair;
48
113
  pepper: HexInput;
49
114
  uidKey?: string;
50
- extraFieldKey?: string;
51
115
  }): Promise<ZeroKnowledgeSig> {
52
- const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey, extraFieldKey } = args;
116
+ const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey } = args;
53
117
  const json = {
54
118
  jwt_b64: jwt,
55
119
  epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
56
120
  epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
57
- exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),
121
+ exp_date_secs: ephemeralKeyPair.expiryDateSecs,
58
122
  exp_horizon_secs: EPK_HORIZON_SECS,
59
123
  pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
60
- extra_field: extraFieldKey,
61
124
  uid_key: uidKey || "sub",
62
125
  };
63
126
 
64
- const { data } = await postAptosProvingService<any, ProverResponse>({
127
+ console.log(JSON.stringify(json))
128
+
129
+ const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({
65
130
  aptosConfig,
66
131
  path: "prove",
67
132
  body: json,
@@ -89,14 +154,17 @@ export async function deriveKeylessAccount(args: {
89
154
  ephemeralKeyPair: EphemeralKeyPair;
90
155
  uidKey?: string;
91
156
  pepper?: HexInput;
92
- extraFieldKey?: string;
93
157
  proofFetchCallback?: ProofFetchCallback;
94
158
  }): Promise<KeylessAccount> {
95
159
  const { proofFetchCallback } = args;
96
160
  let { pepper } = args;
97
161
  if (pepper === undefined) {
98
162
  pepper = await getPepper(args);
99
- } else if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {
163
+ } else {
164
+ pepper = Hex.fromHexInput(pepper).toUint8Array();
165
+ }
166
+
167
+ if (pepper.length !== KeylessAccount.PEPPER_LENGTH) {
100
168
  throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);
101
169
  }
102
170
 
@@ -7,8 +7,8 @@
7
7
 
8
8
  import { AptosConfig } from "../api/aptosConfig";
9
9
  import { MoveVector, U8 } from "../bcs";
10
- import { AptosApiError, postAptosFullNode } from "../client";
11
- import { Account, KeylessAccount, KeylessError, MultiKeyAccount } from "../account";
10
+ import { postAptosFullNode } from "../client";
11
+ import { Account, KeylessAccount, MultiKeyAccount } from "../account";
12
12
  import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
13
13
  import { PrivateKey } from "../core/crypto";
14
14
  import { AccountAuthenticator } from "../transactions/authenticator/account";
@@ -8,7 +8,6 @@ import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
8
8
  import { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from "../../utils/const";
9
9
  import { FeePayerRawTransaction, MultiAgentRawTransaction } from "../instances";
10
10
  import { AnyRawTransaction, AnyRawTransactionInstance } from "../types";
11
- import { CryptoHashable } from "../../bcs/cryptoHasher";
12
11
 
13
12
  /**
14
13
  * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction
@@ -60,18 +59,6 @@ export function generateSigningMessage(bytes: Uint8Array, domainSeparator: strin
60
59
  return mergedArray;
61
60
  }
62
61
 
63
- /**
64
- * Generates the 'signing message' form of a serilizable value. It bcs serializes the value and uses the name of
65
- * its constructor as the domain separator.
66
- *
67
- * @param hashable An object that has a bcs serialized form
68
- *
69
- * @returns The Uint8Array of the signing message
70
- */
71
- export function generateSigningMessageForBcsCryptoHashable(hashable: CryptoHashable): Uint8Array {
72
- return generateSigningMessage(hashable.bcsToBytes(), hashable.domainSeparator);
73
- }
74
-
75
62
  /**
76
63
  * Generates the 'signing message' form of a transaction. It derives the type of transaction and
77
64
  * applies the appropriate domain separator based on if there is extra data such as a fee payer or
@@ -450,9 +450,9 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
450
450
  return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();
451
451
  }
452
452
 
453
- export function getAuthenticatorForSimulation(pk: PublicKey) {
454
- let publicKey = pk;
453
+ export function getAuthenticatorForSimulation(publicKey: PublicKey) {
455
454
  if (publicKey instanceof KeylessPublicKey || publicKey instanceof Secp256k1PublicKey) {
455
+ // eslint-disable-next-line no-param-reassign
456
456
  publicKey = new AnyPublicKey(publicKey);
457
457
  }
458
458
 
@@ -465,6 +465,8 @@ export function getAuthenticatorForSimulation(pk: PublicKey) {
465
465
  return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));
466
466
  }
467
467
  if (publicKey.publicKey instanceof KeylessPublicKey) {
468
+ // TODO: Replace with the line below one simulation works properly for Keyless
469
+ // return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(KeylessSignature.getSimulationSignature()));
468
470
  return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));
469
471
  }
470
472
  }
@@ -322,9 +322,9 @@ export type GasEstimation = {
322
322
  prioritized_gas_estimate?: number;
323
323
  };
324
324
 
325
- export type MoveResource = {
325
+ export type MoveResource<T = {}> = {
326
326
  type: MoveStructId;
327
- data: {};
327
+ data: T;
328
328
  };
329
329
 
330
330
  export type AccountData = {
@@ -1,6 +1,42 @@
1
+ export type ProverRequest = {
2
+ jwt_b64: string;
3
+ epk: string;
4
+ exp_date_secs: number;
5
+ exp_horizon_secs: number;
6
+ epk_blinder: string;
7
+ uid_key: string;
8
+ pepper: string;
9
+ };
1
10
  export type ProverResponse = {
2
11
  proof: { a: string; b: string; c: string };
3
12
  public_inputs_hash: string;
4
13
  training_wheels_signature: string;
5
14
  };
15
+ export type PepperFetchRequest = {
16
+ jwt_b64: number;
17
+ epk: string;
18
+ exp_date_secs: number;
19
+ epk_blinder: string;
20
+ uid_key: string;
21
+ derivation_path: string;
22
+ };
6
23
  export type PepperFetchResponse = { signature: string; pepper: string; address: string };
24
+
25
+ export type KeylessConfigurationResponse = {
26
+ max_commited_epk_bytes: number;
27
+ max_exp_horizon_secs: string;
28
+ max_extra_field_bytes: number;
29
+ max_iss_val_bytes: number;
30
+ max_jwt_header_b64_bytes: number;
31
+ max_signatures_per_txn: number;
32
+ override_aud_vals: string[];
33
+ training_wheels_pubkey: { vec: string[] };
34
+ };
35
+
36
+ export type Groth16VerificationKeyResponse = {
37
+ alpha_g1: string;
38
+ beta_g2: string;
39
+ delta_g2: string;
40
+ gamma_abc_g1: [string, string];
41
+ gamma_g2: string;
42
+ };
@@ -26,14 +26,16 @@ export const NetworkToPepperAPI: Record<string, string> = {
26
26
  mainnet: "https://api.mainnet.aptoslabs.com/keyless/pepper/v0",
27
27
  testnet: "https://api.testnet.aptoslabs.com/keyless/pepper/v0",
28
28
  devnet: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
29
- local: "http://127.0.0.1:8000/v0",
29
+ // Use the devnet service for local environment
30
+ local: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
30
31
  };
31
32
 
32
33
  export const NetworkToProverAPI: Record<string, string> = {
33
34
  mainnet: "https://api.mainnet.aptoslabs.com/keyless/prover/v0",
34
35
  testnet: "https://api.testnet.aptoslabs.com/keyless/prover/v0",
35
- devnet: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
36
- local: "http://127.0.0.1:8083/v0",
36
+ devnet: "https://prover.keyless.devnet.aptoslabs.com/v0",
37
+ // Use the devnet service for local environment
38
+ local: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
37
39
  };
38
40
 
39
41
  export enum Network {
@@ -13,7 +13,6 @@ export async function sleep(timeMs: number): Promise<null> {
13
13
  });
14
14
  }
15
15
 
16
-
17
16
  export function currentTimeInSeconds(): number {
18
17
  return Math.floor(new Date().getTime() / 1000);
19
18
  }
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * hardcoded for now, we would want to have it injected dynamically
8
8
  */
9
- export const VERSION = "1.16.0-zeta.0";
9
+ export const VERSION = "1.16.0-zeta.2";
@@ -1,15 +0,0 @@
1
- import { Serializable } from './serializer.mjs';
2
- import '../core/hex.mjs';
3
- import '../core/common.mjs';
4
- import '../types/index.mjs';
5
- import '../utils/apiEndpoints.mjs';
6
- import '../types/indexer.mjs';
7
- import '../types/generated/operations.mjs';
8
- import '../types/generated/types.mjs';
9
-
10
- type AptsoDomainSeparator = `APTOS::${string}`;
11
- declare abstract class CryptoHashable extends Serializable {
12
- abstract readonly domainSeparator: AptsoDomainSeparator;
13
- }
14
-
15
- export { type AptsoDomainSeparator, CryptoHashable };
@@ -1,2 +0,0 @@
1
- import{a}from"../chunk-KPZDC5ZE.mjs";import"../chunk-TVRJ3M7B.mjs";import"../chunk-AOCNYMMX.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{a as CryptoHashable};
2
- //# sourceMappingURL=cryptoHasher.mjs.map
@@ -1,2 +0,0 @@
1
- import{poseidon1 as s,poseidon2 as h,poseidon3 as u,poseidon4 as g,poseidon5 as a,poseidon6 as d,poseidon7 as c,poseidon8 as p,poseidon9 as f,poseidon10 as l,poseidon11 as A,poseidon12 as U,poseidon13 as b,poseidon14 as I,poseidon15 as w,poseidon16 as E}from"poseidon-lite";var y=[s,h,u,g,a,d,c,p,f,l,A,U,b,I,w,E],i=31,B=16,e=(B-1)*i;function x(n,t){let o=new TextEncoder().encode(n);return m(o,t)}function m(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let r=_(n,t);return k(r)}function T(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let r=N(n,t);return $(r)}function _(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return T(n,t).concat([BigInt(n.length)])}function $(n){if(n.length>e)throw new Error(`Can't pack more than ${e}. Was given ${n.length} bytes`);return P(n,i).map(t=>L(t))}function P(n,t){let r=[];for(let o=0;o<n.length;o+=t)r.push(n.subarray(o,o+t));return r}function L(n){let t=BigInt(0);for(let r=n.length-1;r>=0;r-=1)t=t<<BigInt(8)|BigInt(n[r]);return t}function M(n,t){let r=new Uint8Array(t);for(let o=0;o<t;o+=1)r[o]=Number(n&BigInt(255)),n>>=BigInt(8);return r}function N(n,t){if(t<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let r=new Uint8Array(t);r.set(n);for(let o=n.length;o<t;o+=1)r[o]=0;return r}function k(n){let t=y[n.length-1];if(t)return t(n);throw new Error(`Unable to hash input of length ${n.length}`)}export{x as a,_ as b,L as c,M as d,k as e};
2
- //# sourceMappingURL=chunk-5ADNWXP2.mjs.map