@aptos-labs/ts-sdk 1.16.0 → 1.17.0-zeta.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.
- package/dist/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-jP2Ua0t9.d.ts} +97 -5
- package/dist/common/chunk-BHKSQXUZ.js +2 -0
- package/dist/common/chunk-BHKSQXUZ.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/index.d.ts +857 -122
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +90 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +206 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +13 -7
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +9 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +4 -4
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +4 -4
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +12 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +20 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +5 -5
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +6 -6
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +3 -3
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +3 -3
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +10 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +85 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/keyless.mjs.map +1 -0
- package/dist/esm/api/staking.d.mts +2 -2
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +3 -3
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +4 -4
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +32 -0
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +42 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/chunk-2G4IGSGM.mjs +2 -0
- package/dist/esm/{chunk-XHEZAVN3.mjs.map → chunk-2G4IGSGM.mjs.map} +1 -1
- package/dist/esm/{chunk-BCLP2ENK.mjs → chunk-2H24BEJI.mjs} +2 -2
- package/dist/esm/chunk-37FFZSIM.mjs +2 -0
- package/dist/esm/chunk-37FFZSIM.mjs.map +1 -0
- package/dist/esm/{chunk-DO444YYD.mjs → chunk-3AIEYUPP.mjs} +2 -2
- package/dist/esm/chunk-3IFR6T3V.mjs +2 -0
- package/dist/esm/chunk-3IFR6T3V.mjs.map +1 -0
- package/dist/esm/chunk-3RJZNUCQ.mjs +2 -0
- package/dist/esm/chunk-3SACE4I2.mjs +2 -0
- package/dist/esm/{chunk-T2WZWN6W.mjs.map → chunk-3SACE4I2.mjs.map} +1 -1
- package/dist/esm/chunk-472OGHMG.mjs +2 -0
- package/dist/esm/chunk-474YDCFP.mjs +2 -0
- package/dist/esm/chunk-474YDCFP.mjs.map +1 -0
- package/dist/esm/chunk-4BJA3QUQ.mjs +2 -0
- package/dist/esm/{chunk-NYXLPBKE.mjs.map → chunk-4BJA3QUQ.mjs.map} +1 -1
- package/dist/esm/chunk-4CUDBBTC.mjs +2 -0
- package/dist/esm/chunk-4CUDBBTC.mjs.map +1 -0
- package/dist/esm/chunk-4VPCPASN.mjs +2 -0
- package/dist/esm/chunk-4W7T4HRZ.mjs +2 -0
- package/dist/esm/chunk-4W7T4HRZ.mjs.map +1 -0
- package/dist/esm/chunk-54LCK6EN.mjs +2 -0
- package/dist/esm/chunk-54LCK6EN.mjs.map +1 -0
- package/dist/esm/{chunk-DBC2JY65.mjs → chunk-5C5GZJ57.mjs} +2 -2
- package/dist/esm/chunk-5SEAQESO.mjs +2 -0
- package/dist/esm/chunk-5SEAQESO.mjs.map +1 -0
- package/dist/esm/{chunk-HZ3YB6TN.mjs → chunk-5UXARGTJ.mjs} +2 -2
- package/dist/esm/{chunk-I3MG3W4J.mjs → chunk-5X5GQF3E.mjs} +2 -2
- package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-6FBKUTGF.mjs} +2 -2
- package/dist/esm/chunk-7BW2N4IE.mjs +2 -0
- package/dist/esm/{chunk-MEXWNZY6.mjs → chunk-7M6OCGHL.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
- package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
- package/dist/esm/{chunk-VJL6AF64.mjs → chunk-ASK3DESW.mjs} +2 -2
- package/dist/esm/{chunk-JWTZDA6A.mjs → chunk-BO44HPGU.mjs} +2 -2
- package/dist/esm/chunk-CKQ74DYE.mjs +2 -0
- package/dist/esm/chunk-CKQ74DYE.mjs.map +1 -0
- package/dist/esm/chunk-DJPYZIJY.mjs +2 -0
- package/dist/esm/chunk-DJPYZIJY.mjs.map +1 -0
- package/dist/esm/{chunk-JNDRFTEA.mjs → chunk-DPWEHSHH.mjs} +2 -2
- package/dist/esm/{chunk-WNVUG2UF.mjs → chunk-EFMAZTIM.mjs} +2 -2
- package/dist/esm/chunk-EQF5MW2W.mjs +2 -0
- package/dist/esm/chunk-EQF5MW2W.mjs.map +1 -0
- package/dist/esm/{chunk-UF5B4XMN.mjs → chunk-ET4WC6TJ.mjs} +2 -2
- package/dist/esm/{chunk-UEI62FBQ.mjs → chunk-F3ZVWLDH.mjs} +2 -2
- package/dist/esm/{chunk-UEI62FBQ.mjs.map → chunk-F3ZVWLDH.mjs.map} +1 -1
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/{chunk-YJIRT3GJ.mjs → chunk-FGGRPEQ3.mjs} +2 -2
- package/dist/esm/chunk-FIG65OJD.mjs +2 -0
- package/dist/esm/{chunk-ISIUQQMV.mjs → chunk-FNFQA7NS.mjs} +2 -2
- package/dist/esm/{chunk-XXBMHWNV.mjs → chunk-FR6UGCOX.mjs} +2 -2
- package/dist/esm/chunk-FR6UGCOX.mjs.map +1 -0
- package/dist/esm/chunk-GRHLQDHF.mjs +2 -0
- package/dist/esm/chunk-GSCM444Z.mjs +2 -0
- package/dist/esm/{chunk-QKV2H27T.mjs → chunk-HJAB473N.mjs} +2 -2
- package/dist/esm/chunk-HP6YVTTT.mjs +2 -0
- package/dist/esm/{chunk-LGOZUIGE.mjs.map → chunk-HP6YVTTT.mjs.map} +1 -1
- package/dist/esm/chunk-IBDBKQMF.mjs +2 -0
- package/dist/esm/chunk-IBDBKQMF.mjs.map +1 -0
- package/dist/esm/chunk-IBN7ETCB.mjs +2 -0
- package/dist/esm/{chunk-5NSXEM3O.mjs.map → chunk-IBN7ETCB.mjs.map} +1 -1
- package/dist/esm/chunk-IEVABWIO.mjs +2 -0
- package/dist/esm/chunk-IEVABWIO.mjs.map +1 -0
- package/dist/esm/{chunk-YTJ73ZX3.mjs → chunk-IFAWCHUG.mjs} +2 -2
- package/dist/esm/chunk-IT7YNITU.mjs +2 -0
- package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
- package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
- package/dist/esm/{chunk-TZCETTAW.mjs → chunk-IXFYYWAC.mjs} +2 -2
- package/dist/esm/{chunk-FW6TF3O2.mjs → chunk-J7HG6SQO.mjs} +2 -2
- package/dist/esm/{chunk-HMTYASEZ.mjs → chunk-JLXE5JF6.mjs} +2 -2
- package/dist/esm/{chunk-AKJZL3HT.mjs → chunk-KDLQ2V3L.mjs} +2 -2
- package/dist/esm/{chunk-OOH7MH2H.mjs → chunk-KGKEU2WI.mjs} +2 -2
- package/dist/esm/chunk-L5CPAOUM.mjs +2 -0
- package/dist/esm/chunk-L5CPAOUM.mjs.map +1 -0
- package/dist/esm/{chunk-FLUCRNGU.mjs → chunk-L5ZHZWHI.mjs} +2 -2
- package/dist/esm/chunk-M3KFXIQ6.mjs +2 -0
- package/dist/esm/chunk-M3KFXIQ6.mjs.map +1 -0
- package/dist/esm/{chunk-S5AGI7RQ.mjs → chunk-MLX6DFMR.mjs} +2 -2
- package/dist/esm/chunk-MNTLX37G.mjs +2 -0
- package/dist/esm/chunk-MNTLX37G.mjs.map +1 -0
- package/dist/esm/{chunk-RC6B45PP.mjs → chunk-MRUDDEJ3.mjs} +2 -2
- package/dist/esm/chunk-NMD45OTM.mjs +2 -0
- package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
- package/dist/esm/chunk-NW3WUTTD.mjs +2 -0
- package/dist/esm/{chunk-LVYNEPH4.mjs → chunk-O6QLAP7N.mjs} +2 -2
- package/dist/esm/{chunk-LKVJZTBM.mjs → chunk-OHZHYL3E.mjs} +2 -2
- package/dist/esm/chunk-OHZHYL3E.mjs.map +1 -0
- package/dist/esm/{chunk-QIELBIZW.mjs → chunk-P67NJHS5.mjs} +2 -2
- package/dist/esm/{chunk-TAVPFLW5.mjs → chunk-PBMSO6WI.mjs} +2 -2
- package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
- package/dist/esm/{chunk-43HKFNUB.mjs → chunk-QFVQSFBZ.mjs} +2 -2
- package/dist/esm/{chunk-YMHX6GC2.mjs → chunk-R5THMTSP.mjs} +2 -2
- package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
- package/dist/esm/{chunk-AR3GW64L.mjs → chunk-SNDFJWYM.mjs} +2 -2
- package/dist/esm/{chunk-JHBMHOSV.mjs → chunk-T5YEMU53.mjs} +2 -2
- package/dist/esm/{chunk-DPWXEJP6.mjs → chunk-TAT3K5M7.mjs} +2 -2
- package/dist/esm/{chunk-LM7CN4LT.mjs → chunk-TCK35M7E.mjs} +2 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/{chunk-LF6IQT54.mjs → chunk-TUCCV62K.mjs} +2 -2
- package/dist/esm/{chunk-OLKEU7WZ.mjs → chunk-U2R36WTE.mjs} +2 -2
- package/dist/esm/chunk-U5F4NL24.mjs +2 -0
- package/dist/esm/{chunk-4KMISR2H.mjs → chunk-UMLUOYFK.mjs} +2 -2
- package/dist/esm/{chunk-4KMISR2H.mjs.map → chunk-UMLUOYFK.mjs.map} +1 -1
- package/dist/esm/chunk-VAKWRPVP.mjs +2 -0
- package/dist/esm/chunk-VAKWRPVP.mjs.map +1 -0
- package/dist/esm/chunk-VJFCEX7W.mjs +2 -0
- package/dist/esm/chunk-VJFCEX7W.mjs.map +1 -0
- package/dist/esm/chunk-WA2NTBYY.mjs +2 -0
- package/dist/esm/{chunk-X6BYF2UD.mjs → chunk-WIYDJE6F.mjs} +2 -2
- package/dist/esm/chunk-XBVVP7O2.mjs +2 -0
- package/dist/esm/chunk-XBVVP7O2.mjs.map +1 -0
- package/dist/esm/chunk-XH33BXEY.mjs +2 -0
- package/dist/esm/chunk-XH33BXEY.mjs.map +1 -0
- package/dist/esm/{chunk-CX4BEIQT.mjs → chunk-XVZBWW46.mjs} +2 -2
- package/dist/esm/{chunk-V367QLY3.mjs → chunk-Y4E6NTAS.mjs} +2 -2
- package/dist/esm/{chunk-6SK246YU.mjs → chunk-YA4XTZNZ.mjs} +2 -2
- package/dist/esm/chunk-YD5IB4TH.mjs +2 -0
- package/dist/esm/chunk-YD5IB4TH.mjs.map +1 -0
- package/dist/esm/{chunk-A7J2UMLS.mjs → chunk-YDNOKWV3.mjs} +2 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/{chunk-4D42AAH3.mjs → chunk-YRUF6N3U.mjs} +2 -2
- package/dist/esm/chunk-YTQVMLFD.mjs +2 -0
- package/dist/esm/chunk-YTQVMLFD.mjs.map +1 -0
- package/dist/esm/{chunk-ZMXURV35.mjs → chunk-ZIDLP5MI.mjs} +2 -2
- package/dist/esm/{chunk-OO5EJW3B.mjs → chunk-ZMHGGT4E.mjs} +2 -2
- package/dist/esm/{chunk-AWPRGMUP.mjs → chunk-ZV5MKFV7.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +8 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +2 -2
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +9 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/cryptoHashable.d.mts +21 -0
- package/dist/esm/core/crypto/cryptoHashable.mjs +2 -0
- package/dist/esm/core/crypto/cryptoHashable.mjs.map +1 -0
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +73 -0
- package/dist/esm/core/crypto/ephemeral.mjs +2 -0
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.mts +7 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +321 -0
- package/dist/esm/core/crypto/keyless.mjs +2 -0
- package/dist/esm/core/crypto/keyless.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +19 -0
- package/dist/esm/core/crypto/poseidon.mjs +2 -0
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/proof.d.mts +21 -0
- package/dist/esm/core/crypto/proof.mjs +2 -0
- package/dist/esm/core/crypto/proof.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +7 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +15 -7
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +3 -3
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +4 -4
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +3 -3
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +3 -3
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +2 -16
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +73 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/staking.d.mts +2 -2
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +16 -2
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +6 -6
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +2 -2
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -3
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +3 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +23 -5
- package/dist/esm/types/index.d.mts +21 -5
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +52 -0
- package/dist/esm/types/keyless.mjs +1 -0
- package/dist/esm/types/keyless.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.mts +3 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +3 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +4 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +11 -4
- package/src/account/EphemeralKeyPair.ts +158 -0
- package/src/account/KeylessAccount.ts +360 -0
- package/src/account/MultiKeyAccount.ts +11 -0
- package/src/account/index.ts +2 -0
- package/src/api/aptos.ts +6 -0
- package/src/api/aptosConfig.ts +46 -1
- package/src/api/general.ts +1 -2
- package/src/api/keyless.ts +51 -0
- package/src/bcs/deserializer.ts +46 -0
- package/src/bcs/serializer.ts +58 -0
- package/src/client/core.ts +4 -0
- package/src/client/get.ts +12 -0
- package/src/client/post.ts +18 -0
- package/src/core/crypto/cryptoHashable.ts +16 -0
- package/src/core/crypto/ephemeral.ts +138 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +679 -0
- package/src/core/crypto/poseidon.ts +144 -0
- package/src/core/crypto/proof.ts +16 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/internal/general.ts +1 -38
- package/src/internal/keyless.ts +121 -0
- package/src/internal/transaction.ts +92 -0
- package/src/internal/transactionSubmission.ts +6 -1
- package/src/transactions/management/accountSequenceNumber.ts +5 -8
- package/src/transactions/transactionBuilder/remoteAbi.ts +3 -2
- package/src/transactions/transactionBuilder/signingMessage.ts +4 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +22 -2
- package/src/transactions/typeTag/parser.ts +98 -52
- package/src/transactions/types.ts +22 -3
- package/src/types/index.ts +24 -2
- package/src/types/keyless.ts +42 -0
- package/src/utils/apiEndpoints.ts +16 -0
- package/src/utils/const.ts +2 -0
- package/src/utils/helpers.ts +22 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-KSEUZTKY.js +0 -2
- package/dist/common/chunk-KSEUZTKY.js.map +0 -1
- package/dist/esm/chunk-2XVDVF5C.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
- package/dist/esm/chunk-43YYG5VO.mjs +0 -2
- package/dist/esm/chunk-43YYG5VO.mjs.map +0 -1
- package/dist/esm/chunk-5NSXEM3O.mjs +0 -2
- package/dist/esm/chunk-5SQAHWDI.mjs +0 -2
- package/dist/esm/chunk-5TTCAW72.mjs +0 -2
- package/dist/esm/chunk-5TTCAW72.mjs.map +0 -1
- package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
- package/dist/esm/chunk-6JFZZLRC.mjs +0 -2
- package/dist/esm/chunk-6JFZZLRC.mjs.map +0 -1
- package/dist/esm/chunk-AFTMLXYT.mjs +0 -2
- package/dist/esm/chunk-CCQRMKD2.mjs +0 -2
- package/dist/esm/chunk-CCQRMKD2.mjs.map +0 -1
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-EUUIYMYC.mjs +0 -2
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-F7J7ZW4H.mjs +0 -2
- package/dist/esm/chunk-FNKDXPPQ.mjs +0 -2
- package/dist/esm/chunk-FVN6MJTH.mjs +0 -2
- package/dist/esm/chunk-FVN6MJTH.mjs.map +0 -1
- package/dist/esm/chunk-FWPK5KC2.mjs +0 -2
- package/dist/esm/chunk-FWPK5KC2.mjs.map +0 -1
- package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
- package/dist/esm/chunk-JE7INUQ2.mjs +0 -2
- package/dist/esm/chunk-JE7INUQ2.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
- package/dist/esm/chunk-LGOZUIGE.mjs +0 -2
- package/dist/esm/chunk-LKVJZTBM.mjs.map +0 -1
- package/dist/esm/chunk-LX53BIRN.mjs +0 -2
- package/dist/esm/chunk-NYXLPBKE.mjs +0 -2
- package/dist/esm/chunk-OIH4KBXW.mjs +0 -2
- package/dist/esm/chunk-OIH4KBXW.mjs.map +0 -1
- package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
- package/dist/esm/chunk-P2CIREOD.mjs +0 -2
- package/dist/esm/chunk-R5NNAF5B.mjs +0 -2
- package/dist/esm/chunk-R5NNAF5B.mjs.map +0 -1
- package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs.map +0 -1
- package/dist/esm/chunk-T2WZWN6W.mjs +0 -2
- package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-V3DEJBS6.mjs +0 -2
- package/dist/esm/chunk-V6J6AW5T.mjs +0 -2
- package/dist/esm/chunk-V6J6AW5T.mjs.map +0 -1
- package/dist/esm/chunk-VEB6NALT.mjs +0 -2
- package/dist/esm/chunk-VEB6NALT.mjs.map +0 -1
- package/dist/esm/chunk-WZSVQBPA.mjs +0 -2
- package/dist/esm/chunk-XHEZAVN3.mjs +0 -2
- package/dist/esm/chunk-XXBMHWNV.mjs.map +0 -1
- /package/dist/esm/{chunk-UO3NZ5AH.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
- /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/KeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCLP2ENK.mjs.map → chunk-2H24BEJI.mjs.map} +0 -0
- /package/dist/esm/{chunk-DO444YYD.mjs.map → chunk-3AIEYUPP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-3RJZNUCQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LX53BIRN.mjs.map → chunk-472OGHMG.mjs.map} +0 -0
- /package/dist/esm/{chunk-AFTMLXYT.mjs.map → chunk-4VPCPASN.mjs.map} +0 -0
- /package/dist/esm/{chunk-DBC2JY65.mjs.map → chunk-5C5GZJ57.mjs.map} +0 -0
- /package/dist/esm/{chunk-HZ3YB6TN.mjs.map → chunk-5UXARGTJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-I3MG3W4J.mjs.map → chunk-5X5GQF3E.mjs.map} +0 -0
- /package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-6FBKUTGF.mjs.map} +0 -0
- /package/dist/esm/{chunk-2XVDVF5C.mjs.map → chunk-7BW2N4IE.mjs.map} +0 -0
- /package/dist/esm/{chunk-MEXWNZY6.mjs.map → chunk-7M6OCGHL.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-VJL6AF64.mjs.map → chunk-ASK3DESW.mjs.map} +0 -0
- /package/dist/esm/{chunk-JWTZDA6A.mjs.map → chunk-BO44HPGU.mjs.map} +0 -0
- /package/dist/esm/{chunk-JNDRFTEA.mjs.map → chunk-DPWEHSHH.mjs.map} +0 -0
- /package/dist/esm/{chunk-WNVUG2UF.mjs.map → chunk-EFMAZTIM.mjs.map} +0 -0
- /package/dist/esm/{chunk-UF5B4XMN.mjs.map → chunk-ET4WC6TJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
- /package/dist/esm/{chunk-YJIRT3GJ.mjs.map → chunk-FGGRPEQ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-5SQAHWDI.mjs.map → chunk-FIG65OJD.mjs.map} +0 -0
- /package/dist/esm/{chunk-ISIUQQMV.mjs.map → chunk-FNFQA7NS.mjs.map} +0 -0
- /package/dist/esm/{chunk-FNKDXPPQ.mjs.map → chunk-GRHLQDHF.mjs.map} +0 -0
- /package/dist/esm/{chunk-WZSVQBPA.mjs.map → chunk-GSCM444Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-QKV2H27T.mjs.map → chunk-HJAB473N.mjs.map} +0 -0
- /package/dist/esm/{chunk-YTJ73ZX3.mjs.map → chunk-IFAWCHUG.mjs.map} +0 -0
- /package/dist/esm/{chunk-EUUIYMYC.mjs.map → chunk-IT7YNITU.mjs.map} +0 -0
- /package/dist/esm/{chunk-TZCETTAW.mjs.map → chunk-IXFYYWAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-FW6TF3O2.mjs.map → chunk-J7HG6SQO.mjs.map} +0 -0
- /package/dist/esm/{chunk-HMTYASEZ.mjs.map → chunk-JLXE5JF6.mjs.map} +0 -0
- /package/dist/esm/{chunk-AKJZL3HT.mjs.map → chunk-KDLQ2V3L.mjs.map} +0 -0
- /package/dist/esm/{chunk-OOH7MH2H.mjs.map → chunk-KGKEU2WI.mjs.map} +0 -0
- /package/dist/esm/{chunk-FLUCRNGU.mjs.map → chunk-L5ZHZWHI.mjs.map} +0 -0
- /package/dist/esm/{chunk-S5AGI7RQ.mjs.map → chunk-MLX6DFMR.mjs.map} +0 -0
- /package/dist/esm/{chunk-RC6B45PP.mjs.map → chunk-MRUDDEJ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-P2CIREOD.mjs.map → chunk-NW3WUTTD.mjs.map} +0 -0
- /package/dist/esm/{chunk-LVYNEPH4.mjs.map → chunk-O6QLAP7N.mjs.map} +0 -0
- /package/dist/esm/{chunk-QIELBIZW.mjs.map → chunk-P67NJHS5.mjs.map} +0 -0
- /package/dist/esm/{chunk-TAVPFLW5.mjs.map → chunk-PBMSO6WI.mjs.map} +0 -0
- /package/dist/esm/{chunk-43HKFNUB.mjs.map → chunk-QFVQSFBZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-YMHX6GC2.mjs.map → chunk-R5THMTSP.mjs.map} +0 -0
- /package/dist/esm/{chunk-AR3GW64L.mjs.map → chunk-SNDFJWYM.mjs.map} +0 -0
- /package/dist/esm/{chunk-JHBMHOSV.mjs.map → chunk-T5YEMU53.mjs.map} +0 -0
- /package/dist/esm/{chunk-DPWXEJP6.mjs.map → chunk-TAT3K5M7.mjs.map} +0 -0
- /package/dist/esm/{chunk-LM7CN4LT.mjs.map → chunk-TCK35M7E.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-LF6IQT54.mjs.map → chunk-TUCCV62K.mjs.map} +0 -0
- /package/dist/esm/{chunk-OLKEU7WZ.mjs.map → chunk-U2R36WTE.mjs.map} +0 -0
- /package/dist/esm/{chunk-V3DEJBS6.mjs.map → chunk-U5F4NL24.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7J7ZW4H.mjs.map → chunk-WA2NTBYY.mjs.map} +0 -0
- /package/dist/esm/{chunk-X6BYF2UD.mjs.map → chunk-WIYDJE6F.mjs.map} +0 -0
- /package/dist/esm/{chunk-CX4BEIQT.mjs.map → chunk-XVZBWW46.mjs.map} +0 -0
- /package/dist/esm/{chunk-V367QLY3.mjs.map → chunk-Y4E6NTAS.mjs.map} +0 -0
- /package/dist/esm/{chunk-6SK246YU.mjs.map → chunk-YA4XTZNZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-A7J2UMLS.mjs.map → chunk-YDNOKWV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-4D42AAH3.mjs.map → chunk-YRUF6N3U.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZMXURV35.mjs.map → chunk-ZIDLP5MI.mjs.map} +0 -0
- /package/dist/esm/{chunk-OO5EJW3B.mjs.map → chunk-ZMHGGT4E.mjs.map} +0 -0
- /package/dist/esm/{chunk-AWPRGMUP.mjs.map → chunk-ZV5MKFV7.mjs.map} +0 -0
- /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
declare const NetworkToIndexerAPI: Record<string, string>;
|
|
2
2
|
declare const NetworkToNodeAPI: Record<string, string>;
|
|
3
3
|
declare const NetworkToFaucetAPI: Record<string, string>;
|
|
4
|
+
declare const NetworkToPepperAPI: Record<string, string>;
|
|
5
|
+
declare const NetworkToProverAPI: Record<string, string>;
|
|
4
6
|
declare enum Network {
|
|
5
7
|
MAINNET = "mainnet",
|
|
6
8
|
TESTNET = "testnet",
|
|
@@ -11,4 +13,4 @@ declare enum Network {
|
|
|
11
13
|
declare const NetworkToChainId: Record<string, number>;
|
|
12
14
|
declare const NetworkToNetworkName: Record<string, Network>;
|
|
13
15
|
|
|
14
|
-
export { Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToNetworkName, NetworkToNodeAPI };
|
|
16
|
+
export { Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToNetworkName, NetworkToNodeAPI, NetworkToPepperAPI, NetworkToProverAPI };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"../chunk-SCHZ67F3.mjs";import"../chunk-FVA2OPG4.mjs";export{f as Network,g as NetworkToChainId,c as NetworkToFaucetAPI,a as NetworkToIndexerAPI,h as NetworkToNetworkName,b as NetworkToNodeAPI,d as NetworkToPepperAPI,e as NetworkToProverAPI};
|
|
2
2
|
//# sourceMappingURL=apiEndpoints.mjs.map
|
package/dist/esm/utils/const.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h}from"../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"../chunk-YE5B2S5L.mjs";import"../chunk-FVA2OPG4.mjs";export{e as APTOS_COIN,a as AptosApiType,b as DEFAULT_MAX_GAS_AMOUNT,c as DEFAULT_TXN_EXP_SEC_FROM_NOW,d as DEFAULT_TXN_TIMEOUT_SEC,h as ProcessorType,f as RAW_TRANSACTION_SALT,g as RAW_TRANSACTION_WITH_DATA_SALT};
|
|
2
2
|
//# sourceMappingURL=const.mjs.map
|
|
@@ -3,5 +3,8 @@
|
|
|
3
3
|
* @param timeMs time in milliseconds to sleep
|
|
4
4
|
*/
|
|
5
5
|
declare function sleep(timeMs: number): Promise<null>;
|
|
6
|
+
declare const nowInSeconds: () => number;
|
|
7
|
+
declare function floorToWholeHour(timestampInSeconds: number): number;
|
|
8
|
+
declare function base64UrlDecode(base64Url: string): string;
|
|
6
9
|
|
|
7
|
-
export { sleep };
|
|
10
|
+
export { base64UrlDecode, floorToWholeHour, nowInSeconds, sleep };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a,b,c,d}from"../chunk-YTQVMLFD.mjs";import"../chunk-FVA2OPG4.mjs";export{d as base64UrlDecode,c as floorToWholeHour,b as nowInSeconds,a as sleep};
|
|
2
2
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToNetworkName, NetworkToNodeAPI } from './apiEndpoints.mjs';
|
|
1
|
+
export { Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToNetworkName, NetworkToNodeAPI, NetworkToPepperAPI, NetworkToProverAPI } from './apiEndpoints.mjs';
|
|
2
2
|
export { APTOS_COIN, AptosApiType, DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW, DEFAULT_TXN_TIMEOUT_SEC, ProcessorType, RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from './const.mjs';
|
|
3
3
|
export { DeserializableClass, normalizeBundle } from './normalizeBundle.mjs';
|
|
4
4
|
import '../bcs/deserializer.mjs';
|
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunk-GED6IT3S.mjs";import{a as
|
|
1
|
+
import"../chunk-GED6IT3S.mjs";import{a as q}from"../chunk-3RJZNUCQ.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-GRHLQDHF.mjs";import"../chunk-7BW2N4IE.mjs";import"../chunk-FGGRPEQ3.mjs";import"../chunk-IBN7ETCB.mjs";import"../chunk-Q6LFIZ3L.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-3IFR6T3V.mjs";import"../chunk-UMLUOYFK.mjs";import"../chunk-AOCNYMMX.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-56CNRT2K.mjs";import{a,b,c,d,e,f,g,h}from"../chunk-SCHZ67F3.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n,g as o,h as p}from"../chunk-YE5B2S5L.mjs";import"../chunk-FVA2OPG4.mjs";export{m as APTOS_COIN,i as AptosApiType,j as DEFAULT_MAX_GAS_AMOUNT,k as DEFAULT_TXN_EXP_SEC_FROM_NOW,l as DEFAULT_TXN_TIMEOUT_SEC,f as Network,g as NetworkToChainId,c as NetworkToFaucetAPI,a as NetworkToIndexerAPI,h as NetworkToNetworkName,b as NetworkToNodeAPI,d as NetworkToPepperAPI,e as NetworkToProverAPI,p as ProcessorType,n as RAW_TRANSACTION_SALT,o as RAW_TRANSACTION_WITH_DATA_SALT,q as normalizeBundle};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-3RJZNUCQ.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-GRHLQDHF.mjs";import"../chunk-7BW2N4IE.mjs";import"../chunk-FGGRPEQ3.mjs";import"../chunk-IBN7ETCB.mjs";import"../chunk-Q6LFIZ3L.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-3IFR6T3V.mjs";import"../chunk-UMLUOYFK.mjs";import"../chunk-AOCNYMMX.mjs";import"../chunk-FBPNHF54.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{a as normalizeBundle};
|
|
2
2
|
//# sourceMappingURL=normalizeBundle.mjs.map
|
package/dist/esm/version.d.mts
CHANGED
package/dist/esm/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-4BJA3QUQ.mjs";import"./chunk-FVA2OPG4.mjs";export{a as VERSION};
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/ts-sdk",
|
|
3
3
|
"description": "Aptos TypeScript SDK",
|
|
4
|
-
"packageManager": "pnpm@
|
|
4
|
+
"packageManager": "pnpm@9.1.4",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=11.0.0"
|
|
@@ -48,13 +48,17 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@aptos-labs/aptos-client": "^0.1.0",
|
|
51
|
-
"@aptos-labs/aptos-cli": "^0.1.
|
|
51
|
+
"@aptos-labs/aptos-cli": "^0.1.2",
|
|
52
52
|
"@noble/curves": "^1.4.0",
|
|
53
53
|
"@noble/hashes": "^1.4.0",
|
|
54
54
|
"@scure/bip32": "^1.4.0",
|
|
55
55
|
"@scure/bip39": "^1.3.0",
|
|
56
|
+
"eventemitter3": "^5.0.1",
|
|
56
57
|
"form-data": "^4.0.0",
|
|
57
|
-
"
|
|
58
|
+
"jose": "^5.1.3",
|
|
59
|
+
"js-base64": "^3.7.7",
|
|
60
|
+
"jwt-decode": "^4.0.0",
|
|
61
|
+
"poseidon-lite": "^0.2.0"
|
|
58
62
|
},
|
|
59
63
|
"devDependencies": {
|
|
60
64
|
"@babel/traverse": "^7.23.6",
|
|
@@ -63,7 +67,9 @@
|
|
|
63
67
|
"@graphql-codegen/typescript": "^4.0.1",
|
|
64
68
|
"@graphql-codegen/typescript-graphql-request": "^6.0.1",
|
|
65
69
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
70
|
+
"@types/base-64": "^1.0.2",
|
|
66
71
|
"@types/jest": "^29.5.11",
|
|
72
|
+
"@types/jsonwebtoken": "^9.0.6",
|
|
67
73
|
"@types/node": "^20.10.4",
|
|
68
74
|
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
|
69
75
|
"@typescript-eslint/parser": "^6.14.0",
|
|
@@ -76,6 +82,7 @@
|
|
|
76
82
|
"graphql": "^16.8.1",
|
|
77
83
|
"graphql-request": "^6.1.0",
|
|
78
84
|
"jest": "^29.7.0",
|
|
85
|
+
"jsonwebtoken": "^9.0.2",
|
|
79
86
|
"prettier": "^3.1.1",
|
|
80
87
|
"tree-kill": "^1.2.2",
|
|
81
88
|
"ts-jest": "^29.1.1",
|
|
@@ -85,5 +92,5 @@
|
|
|
85
92
|
"typedoc": "^0.25.4",
|
|
86
93
|
"typescript": "^5.3.3"
|
|
87
94
|
},
|
|
88
|
-
"version": "1.
|
|
95
|
+
"version": "1.17.0-zeta.1"
|
|
89
96
|
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { randomBytes } from "@noble/hashes/utils";
|
|
5
|
+
|
|
6
|
+
import { Ed25519PrivateKey, EphemeralPublicKey, EphemeralSignature, PrivateKey } from "../core/crypto";
|
|
7
|
+
import { Hex } from "../core/hex";
|
|
8
|
+
import { bytesToBigIntLE, padAndPackBytesWithLen, poseidonHash } from "../core/crypto/poseidon";
|
|
9
|
+
import { EphemeralPublicKeyVariant, HexInput } from "../types";
|
|
10
|
+
import { Deserializer, Serializable, Serializer } from "../bcs";
|
|
11
|
+
import { floorToWholeHour, nowInSeconds } from "../utils/helpers";
|
|
12
|
+
|
|
13
|
+
const TWO_WEEKS_IN_SECONDS = 1_209_600;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A class which contains a key pair that is used in signing transactions via the Keyless authentication scheme. This key pair
|
|
17
|
+
* is ephemeral and has an expiration time. For more details on how this class is used -
|
|
18
|
+
* https://aptos.dev/guides/keyless-accounts/#1-present-the-user-with-a-sign-in-with-idp-button-on-the-ui
|
|
19
|
+
*/
|
|
20
|
+
export class EphemeralKeyPair extends Serializable {
|
|
21
|
+
static readonly BLINDER_LENGTH: number = 31;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP.
|
|
25
|
+
* Used in calculating the nonce passed to the IdP and as a secret witness in proof generation.
|
|
26
|
+
*/
|
|
27
|
+
readonly blinder: Uint8Array;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new
|
|
31
|
+
* EphemeralKeyPair must be generated and a new JWT needs to be created.
|
|
32
|
+
*/
|
|
33
|
+
readonly expiryDateSecs: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The value passed to the IdP when the user authenticates. It comprises of a hash of the
|
|
37
|
+
* ephermeral public key, expiry date, and blinder.
|
|
38
|
+
*/
|
|
39
|
+
readonly nonce: string;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A private key used to sign transactions. This private key is not tied to any account on the chain as it
|
|
43
|
+
* is ephemeral (not permanent) in nature.
|
|
44
|
+
*/
|
|
45
|
+
private privateKey: PrivateKey;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A public key used to verify transactions. This public key is not tied to any account on the chain as it
|
|
49
|
+
* is ephemeral (not permanent) in nature.
|
|
50
|
+
*/
|
|
51
|
+
private publicKey: EphemeralPublicKey;
|
|
52
|
+
|
|
53
|
+
constructor(args: { privateKey: PrivateKey; expiryDateSecs?: number; blinder?: HexInput }) {
|
|
54
|
+
super();
|
|
55
|
+
const { privateKey, expiryDateSecs, blinder } = args;
|
|
56
|
+
this.privateKey = privateKey;
|
|
57
|
+
this.publicKey = new EphemeralPublicKey(privateKey.publicKey());
|
|
58
|
+
// By default, we set the expiry date to be two weeks in the future floored to the nearest hour
|
|
59
|
+
this.expiryDateSecs = expiryDateSecs || floorToWholeHour(nowInSeconds() + TWO_WEEKS_IN_SECONDS);
|
|
60
|
+
// Generate the blinder if not provided
|
|
61
|
+
this.blinder = blinder !== undefined ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();
|
|
62
|
+
// Calculate the nonce
|
|
63
|
+
this.nonce = this.generateNonce();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Returns the public key of the key pair.
|
|
68
|
+
* @return EphemeralPublicKey
|
|
69
|
+
*/
|
|
70
|
+
getPublicKey(): EphemeralPublicKey {
|
|
71
|
+
return this.publicKey;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns the public key of the key pair.
|
|
76
|
+
* @return boolean
|
|
77
|
+
*/
|
|
78
|
+
isExpired(): boolean {
|
|
79
|
+
const currentTimeSecs: number = Math.floor(Date.now() / 1000);
|
|
80
|
+
return currentTimeSecs > this.expiryDateSecs;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
serialize(serializer: Serializer): void {
|
|
84
|
+
serializer.serializeU32AsUleb128(this.publicKey.variant);
|
|
85
|
+
serializer.serializeBytes(this.privateKey.toUint8Array());
|
|
86
|
+
serializer.serializeU64(this.expiryDateSecs);
|
|
87
|
+
serializer.serializeFixedBytes(this.blinder);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static deserialize(deserializer: Deserializer): EphemeralKeyPair {
|
|
91
|
+
const variantIndex = deserializer.deserializeUleb128AsU32();
|
|
92
|
+
let privateKey: PrivateKey;
|
|
93
|
+
switch (variantIndex) {
|
|
94
|
+
case EphemeralPublicKeyVariant.Ed25519:
|
|
95
|
+
privateKey = Ed25519PrivateKey.deserialize(deserializer);
|
|
96
|
+
break;
|
|
97
|
+
default:
|
|
98
|
+
throw new Error(`Unknown variant index for EphemeralPublicKey: ${variantIndex}`);
|
|
99
|
+
}
|
|
100
|
+
const expiryDateSecs = deserializer.deserializeU64();
|
|
101
|
+
const blinder = deserializer.deserializeFixedBytes(31);
|
|
102
|
+
return new EphemeralKeyPair({ privateKey, expiryDateSecs: Number(expiryDateSecs), blinder });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static fromBytes(bytes: Uint8Array): EphemeralKeyPair {
|
|
106
|
+
return EphemeralKeyPair.deserialize(new Deserializer(bytes));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns the public key of the key pair.
|
|
111
|
+
* @param scheme the type of keypair to use for the EphemeralKeyPair. Only Ed25519 supported for now.
|
|
112
|
+
* @param expiryDateSecs the date of expiry.
|
|
113
|
+
* @return boolean
|
|
114
|
+
*/
|
|
115
|
+
static generate(args?: { scheme?: EphemeralPublicKeyVariant; expiryDateSecs?: number }): EphemeralKeyPair {
|
|
116
|
+
let privateKey: PrivateKey;
|
|
117
|
+
|
|
118
|
+
switch (args?.scheme) {
|
|
119
|
+
case EphemeralPublicKeyVariant.Ed25519:
|
|
120
|
+
default:
|
|
121
|
+
privateKey = Ed25519PrivateKey.generate();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return new EphemeralKeyPair({ privateKey, expiryDateSecs: args?.expiryDateSecs });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* From the ephemeral public key, expiry timestamp, and blinder, calculate the nonce to be used at authentication via OIDC.
|
|
129
|
+
* @returns string
|
|
130
|
+
*/
|
|
131
|
+
private generateNonce(): string {
|
|
132
|
+
const fields = padAndPackBytesWithLen(this.publicKey.bcsToBytes(), 93);
|
|
133
|
+
fields.push(BigInt(this.expiryDateSecs));
|
|
134
|
+
fields.push(bytesToBigIntLE(this.blinder));
|
|
135
|
+
const nonceHash = poseidonHash(fields);
|
|
136
|
+
return nonceHash.toString();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Sign the given message with the private key.
|
|
141
|
+
* @param data in HexInput format
|
|
142
|
+
* @returns EphemeralSignature
|
|
143
|
+
*/
|
|
144
|
+
sign(data: HexInput): EphemeralSignature {
|
|
145
|
+
if (this.isExpired()) {
|
|
146
|
+
throw new Error("EphemeralKeyPair has expired");
|
|
147
|
+
}
|
|
148
|
+
return new EphemeralSignature(this.privateKey.sign(data));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Generates a random byte array of length EphemeralKeyPair.BLINDER_LENGTH
|
|
154
|
+
* @returns Uint8Array
|
|
155
|
+
*/
|
|
156
|
+
function generateBlinder(): Uint8Array {
|
|
157
|
+
return randomBytes(EphemeralKeyPair.BLINDER_LENGTH);
|
|
158
|
+
}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { JwtPayload, jwtDecode } from "jwt-decode";
|
|
5
|
+
import EventEmitter from "eventemitter3";
|
|
6
|
+
import { EphemeralCertificateVariant, HexInput, SigningScheme } from "../types";
|
|
7
|
+
import { AccountAddress } from "../core/accountAddress";
|
|
8
|
+
import {
|
|
9
|
+
AnyPublicKey,
|
|
10
|
+
AnySignature,
|
|
11
|
+
KeylessPublicKey,
|
|
12
|
+
KeylessSignature,
|
|
13
|
+
EphemeralCertificate,
|
|
14
|
+
Signature,
|
|
15
|
+
ZeroKnowledgeSig,
|
|
16
|
+
ZkProof,
|
|
17
|
+
} from "../core/crypto";
|
|
18
|
+
|
|
19
|
+
import { Account } from "./Account";
|
|
20
|
+
import { EphemeralKeyPair } from "./EphemeralKeyPair";
|
|
21
|
+
import { Hex } from "../core/hex";
|
|
22
|
+
import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
|
|
23
|
+
import { Deserializer, Serializable, Serializer } from "../bcs";
|
|
24
|
+
import { deriveTransactionType } from "../transactions/transactionBuilder/signingMessage";
|
|
25
|
+
import { AnyRawTransaction, AnyRawTransactionInstance } from "../transactions/types";
|
|
26
|
+
import { AptsoDomainSeparator, CryptoHashable } from "../core/crypto/cryptoHashable";
|
|
27
|
+
import { base64UrlDecode } from "../utils/helpers";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Account implementation for the Keyless authentication scheme.
|
|
31
|
+
*
|
|
32
|
+
* Used to represent a Keyless based account and sign transactions with it.
|
|
33
|
+
*
|
|
34
|
+
* Use KeylessAccount.fromJWTAndProof to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair.
|
|
35
|
+
*
|
|
36
|
+
* When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,
|
|
37
|
+
* EphemeralKeyPair, and corresponding proof.
|
|
38
|
+
*/
|
|
39
|
+
export class KeylessAccount extends Serializable implements Account {
|
|
40
|
+
static readonly PEPPER_LENGTH: number = 31;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The KeylessPublicKey associated with the account
|
|
44
|
+
*/
|
|
45
|
+
readonly publicKey: KeylessPublicKey;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The EphemeralKeyPair used to generate sign.
|
|
49
|
+
*/
|
|
50
|
+
readonly ephemeralKeyPair: EphemeralKeyPair;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The claim on the JWT to identify a user. This is typically 'sub' or 'email'.
|
|
54
|
+
*/
|
|
55
|
+
readonly uidKey: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The value of the uidKey claim on the JWT. This intended to be a stable user identifier.
|
|
59
|
+
*/
|
|
60
|
+
readonly uidVal: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's
|
|
64
|
+
* OIDC registration with the identity provider.
|
|
65
|
+
*/
|
|
66
|
+
readonly aud: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
|
|
70
|
+
*/
|
|
71
|
+
readonly pepper: Uint8Array;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Account address associated with the account
|
|
75
|
+
*/
|
|
76
|
+
readonly accountAddress: AccountAddress;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
|
|
80
|
+
*/
|
|
81
|
+
proof: ZeroKnowledgeSig | undefined;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on
|
|
85
|
+
* fetching the proof.
|
|
86
|
+
*/
|
|
87
|
+
readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Signing scheme used to sign transactions
|
|
91
|
+
*/
|
|
92
|
+
readonly signingScheme: SigningScheme;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The JWT token used to derive the account
|
|
96
|
+
*/
|
|
97
|
+
readonly jwt: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* An event emitter used to assist in handling asycronous proof fetching.
|
|
101
|
+
*/
|
|
102
|
+
private readonly emitter: EventEmitter<ProofFetchEvents>;
|
|
103
|
+
|
|
104
|
+
constructor(args: {
|
|
105
|
+
address?: AccountAddress;
|
|
106
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
107
|
+
iss: string;
|
|
108
|
+
uidKey: string;
|
|
109
|
+
uidVal: string;
|
|
110
|
+
aud: string;
|
|
111
|
+
pepper: HexInput;
|
|
112
|
+
proofOrFetcher: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
113
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
114
|
+
jwt: string;
|
|
115
|
+
}) {
|
|
116
|
+
super();
|
|
117
|
+
const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;
|
|
118
|
+
this.ephemeralKeyPair = ephemeralKeyPair;
|
|
119
|
+
this.publicKey = KeylessPublicKey.create(args);
|
|
120
|
+
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
121
|
+
this.uidKey = uidKey;
|
|
122
|
+
this.uidVal = uidVal;
|
|
123
|
+
this.aud = aud;
|
|
124
|
+
this.jwt = jwt;
|
|
125
|
+
this.emitter = new EventEmitter<ProofFetchEvents>();
|
|
126
|
+
this.proofOrPromise = proofOrFetcher;
|
|
127
|
+
if (proofOrFetcher instanceof ZeroKnowledgeSig) {
|
|
128
|
+
this.proof = proofOrFetcher;
|
|
129
|
+
} else {
|
|
130
|
+
if (proofFetchCallback === undefined) {
|
|
131
|
+
throw new Error("Must provide callback for async proof fetch");
|
|
132
|
+
}
|
|
133
|
+
this.emitter.on("proofFetchFinish", async (status) => {
|
|
134
|
+
await proofFetchCallback(status);
|
|
135
|
+
this.emitter.removeAllListeners();
|
|
136
|
+
});
|
|
137
|
+
this.init(proofOrFetcher);
|
|
138
|
+
}
|
|
139
|
+
this.signingScheme = SigningScheme.SingleKey;
|
|
140
|
+
const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
|
|
141
|
+
if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {
|
|
142
|
+
throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);
|
|
143
|
+
}
|
|
144
|
+
this.pepper = pepperBytes;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* This initializes the asyncronous proof fetch
|
|
149
|
+
* @return
|
|
150
|
+
*/
|
|
151
|
+
async init(promise: Promise<ZeroKnowledgeSig>) {
|
|
152
|
+
try {
|
|
153
|
+
this.proof = await promise;
|
|
154
|
+
this.emitter.emit("proofFetchFinish", { status: "Success" });
|
|
155
|
+
} catch (error) {
|
|
156
|
+
if (error instanceof Error) {
|
|
157
|
+
this.emitter.emit("proofFetchFinish", { status: "Failed", error: error.toString() });
|
|
158
|
+
} else {
|
|
159
|
+
this.emitter.emit("proofFetchFinish", { status: "Failed", error: "Unknown" });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
serialize(serializer: Serializer): void {
|
|
165
|
+
serializer.serializeStr(this.jwt);
|
|
166
|
+
serializer.serializeStr(this.uidKey);
|
|
167
|
+
serializer.serializeFixedBytes(this.pepper);
|
|
168
|
+
this.ephemeralKeyPair.serialize(serializer);
|
|
169
|
+
if (this.proof === undefined) {
|
|
170
|
+
throw new Error("Connot serialize - proof undefined");
|
|
171
|
+
}
|
|
172
|
+
this.proof.serialize(serializer);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static deserialize(deserializer: Deserializer): KeylessAccount {
|
|
176
|
+
const jwt = deserializer.deserializeStr();
|
|
177
|
+
const uidKey = deserializer.deserializeStr();
|
|
178
|
+
const pepper = deserializer.deserializeFixedBytes(31);
|
|
179
|
+
const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);
|
|
180
|
+
const proof = ZeroKnowledgeSig.deserialize(deserializer);
|
|
181
|
+
return KeylessAccount.create({
|
|
182
|
+
proof,
|
|
183
|
+
pepper,
|
|
184
|
+
uidKey,
|
|
185
|
+
jwt,
|
|
186
|
+
ephemeralKeyPair,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair
|
|
192
|
+
* and JWT token.
|
|
193
|
+
* @return boolean
|
|
194
|
+
*/
|
|
195
|
+
isExpired(): boolean {
|
|
196
|
+
return this.ephemeralKeyPair.isExpired();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Sign a message using Keyless.
|
|
201
|
+
* @param message the message to sign, as binary input
|
|
202
|
+
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
203
|
+
*/
|
|
204
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
|
|
205
|
+
const signature = new AnySignature(this.sign(message));
|
|
206
|
+
const publicKey = new AnyPublicKey(this.publicKey);
|
|
207
|
+
return new AccountAuthenticatorSingleKey(publicKey, signature);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Sign a transaction using Keyless.
|
|
212
|
+
* @param transaction the raw transaction
|
|
213
|
+
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
|
|
214
|
+
*/
|
|
215
|
+
signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
|
|
216
|
+
const signature = new AnySignature(this.signTransaction(transaction));
|
|
217
|
+
const publicKey = new AnyPublicKey(this.publicKey);
|
|
218
|
+
return new AccountAuthenticatorSingleKey(publicKey, signature);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Waits for asyncronous proof fetching to finish.
|
|
223
|
+
* @return
|
|
224
|
+
*/
|
|
225
|
+
async waitForProofFetch() {
|
|
226
|
+
if (this.proofOrPromise instanceof Promise) {
|
|
227
|
+
await this.proofOrPromise;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Sign the given message using Keyless.
|
|
233
|
+
* @param message in HexInput format
|
|
234
|
+
* @returns Signature
|
|
235
|
+
*/
|
|
236
|
+
sign(data: HexInput): KeylessSignature {
|
|
237
|
+
const { expiryDateSecs } = this.ephemeralKeyPair;
|
|
238
|
+
if (this.isExpired()) {
|
|
239
|
+
throw new Error("EphemeralKeyPair is expired");
|
|
240
|
+
}
|
|
241
|
+
if (this.proof === undefined) {
|
|
242
|
+
throw new Error("Proof not defined");
|
|
243
|
+
}
|
|
244
|
+
const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
|
|
245
|
+
const ephemeralSignature = this.ephemeralKeyPair.sign(data);
|
|
246
|
+
|
|
247
|
+
return new KeylessSignature({
|
|
248
|
+
jwtHeader: base64UrlDecode(this.jwt.split(".")[0]),
|
|
249
|
+
ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),
|
|
250
|
+
expiryDateSecs,
|
|
251
|
+
ephemeralPublicKey,
|
|
252
|
+
ephemeralSignature,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Sign the given transaction with Keyless.
|
|
258
|
+
* Signs the transaction and proof to guard against proof malleability.
|
|
259
|
+
* @param transaction the transaction to be signed
|
|
260
|
+
* @returns KeylessSignature
|
|
261
|
+
*/
|
|
262
|
+
signTransaction(transaction: AnyRawTransaction): KeylessSignature {
|
|
263
|
+
if (this.proof === undefined) {
|
|
264
|
+
throw new Error("Proof not found");
|
|
265
|
+
}
|
|
266
|
+
const raw = deriveTransactionType(transaction);
|
|
267
|
+
const txnAndProof = new TransactionAndProof(raw, this.proof.proof);
|
|
268
|
+
const signMess = txnAndProof.hash();
|
|
269
|
+
return this.sign(signMess);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
|
|
273
|
+
verifySignature(args: { message: HexInput; signature: Signature }): boolean {
|
|
274
|
+
throw new Error("Not implemented");
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
static fromBytes(bytes: Uint8Array): KeylessAccount {
|
|
278
|
+
return KeylessAccount.deserialize(new Deserializer(bytes));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
static create(args: {
|
|
282
|
+
proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
283
|
+
jwt: string;
|
|
284
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
285
|
+
pepper: HexInput;
|
|
286
|
+
uidKey?: string;
|
|
287
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
288
|
+
}): KeylessAccount {
|
|
289
|
+
const { proof, jwt, ephemeralKeyPair, pepper, uidKey = "sub", proofFetchCallback } = args;
|
|
290
|
+
|
|
291
|
+
const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);
|
|
292
|
+
const iss = jwtPayload.iss!;
|
|
293
|
+
if (typeof jwtPayload.aud !== "string") {
|
|
294
|
+
throw new Error("aud was not found or an array of values");
|
|
295
|
+
}
|
|
296
|
+
const aud = jwtPayload.aud!;
|
|
297
|
+
const uidVal = jwtPayload[uidKey];
|
|
298
|
+
return new KeylessAccount({
|
|
299
|
+
proofOrFetcher: proof,
|
|
300
|
+
ephemeralKeyPair,
|
|
301
|
+
iss,
|
|
302
|
+
uidKey,
|
|
303
|
+
uidVal,
|
|
304
|
+
aud,
|
|
305
|
+
pepper,
|
|
306
|
+
jwt,
|
|
307
|
+
proofFetchCallback,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create
|
|
314
|
+
* the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.
|
|
315
|
+
*/
|
|
316
|
+
export class TransactionAndProof extends CryptoHashable {
|
|
317
|
+
/**
|
|
318
|
+
* The transaction to sign.
|
|
319
|
+
*/
|
|
320
|
+
transaction: AnyRawTransactionInstance;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* The zero knowledge proof used in signing the transaction.
|
|
324
|
+
*/
|
|
325
|
+
proof?: ZkProof;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* The domain separator prefix used when hashing.
|
|
329
|
+
*/
|
|
330
|
+
domainSeparator: AptsoDomainSeparator;
|
|
331
|
+
|
|
332
|
+
constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {
|
|
333
|
+
super();
|
|
334
|
+
this.transaction = transaction;
|
|
335
|
+
this.proof = proof;
|
|
336
|
+
this.domainSeparator = "APTOS::TransactionAndProof";
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
serialize(serializer: Serializer): void {
|
|
340
|
+
serializer.serializeFixedBytes(this.transaction.bcsToBytes());
|
|
341
|
+
serializer.serializeOption(this.proof);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export type ProofFetchSuccess = {
|
|
346
|
+
status: "Success";
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export type ProofFetchFailure = {
|
|
350
|
+
status: "Failed";
|
|
351
|
+
error: string;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
export type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;
|
|
355
|
+
|
|
356
|
+
export type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;
|
|
357
|
+
|
|
358
|
+
export interface ProofFetchEvents {
|
|
359
|
+
proofFetchFinish: (status: ProofFetchStatus) => void;
|
|
360
|
+
}
|