@aptos-labs/ts-sdk 1.16.0-zeta.0 → 1.16.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-BtD_TE5q.d.ts → accountAddress-OUd5ov6z.d.ts} +56 -10
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/index.d.ts +156 -32
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +4 -4
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +68 -9
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +2 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +5 -4
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +5 -4
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +15 -10
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +14 -8
- 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 +40 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-TVRJ3M7B.mjs → chunk-272NA6H5.mjs} +1 -1
- package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-272NA6H5.mjs.map} +1 -1
- package/dist/esm/{chunk-OT37OTT7.mjs → chunk-34WI7I3Z.mjs} +2 -2
- package/dist/esm/{chunk-Z2ZR4PTF.mjs → chunk-3DP4R3FI.mjs} +2 -2
- package/dist/esm/{chunk-IJE5YSXW.mjs → chunk-3J53BCEQ.mjs} +2 -2
- package/dist/esm/{chunk-NWWXZ7EW.mjs → chunk-3SXTTG2X.mjs} +2 -2
- package/dist/esm/{chunk-7H3HRFVM.mjs → chunk-3YIUOKWW.mjs} +2 -2
- package/dist/esm/{chunk-REBMGDZ5.mjs → chunk-45ESRYGP.mjs} +2 -2
- package/dist/esm/{chunk-5V2RGYYK.mjs → chunk-4RXGVY2H.mjs} +2 -2
- package/dist/esm/{chunk-MWUJCP27.mjs → chunk-4VAYXBD2.mjs} +2 -2
- package/dist/esm/{chunk-6KNAIXZ3.mjs → chunk-5SGIYAB7.mjs} +2 -2
- package/dist/esm/chunk-5VLCYHNJ.mjs +2 -0
- package/dist/esm/chunk-5VLCYHNJ.mjs.map +1 -0
- package/dist/esm/{chunk-Q3AUNZDW.mjs → chunk-6F3HFDL3.mjs} +2 -2
- package/dist/esm/{chunk-FBLSW5TB.mjs → chunk-6MDYCC7P.mjs} +2 -2
- package/dist/esm/{chunk-M7HZOQ6A.mjs → chunk-7CJAEAQZ.mjs} +2 -2
- package/dist/esm/{chunk-Y33VGXNI.mjs → chunk-7Y6AWDBZ.mjs} +2 -2
- package/dist/esm/{chunk-COW5IGYC.mjs → chunk-AUAL3H36.mjs} +2 -2
- package/dist/esm/{chunk-6M53MDWB.mjs → chunk-AUV4VAXK.mjs} +2 -2
- package/dist/esm/{chunk-MTLETLKV.mjs → chunk-AVWAYKNS.mjs} +2 -2
- package/dist/esm/{chunk-EIRSA5UU.mjs → chunk-BNA3SGG6.mjs} +2 -2
- package/dist/esm/{chunk-Y5BON557.mjs → chunk-CEGCSC3T.mjs} +2 -2
- package/dist/esm/chunk-CIPPNT3W.mjs +2 -0
- package/dist/esm/chunk-CIPPNT3W.mjs.map +1 -0
- package/dist/esm/{chunk-UFJGYMEB.mjs → chunk-CZOUSIAD.mjs} +2 -2
- package/dist/esm/chunk-D76FE35G.mjs +2 -0
- package/dist/esm/chunk-D76FE35G.mjs.map +1 -0
- package/dist/esm/{chunk-SBQRBBRS.mjs → chunk-DSVNXD5A.mjs} +2 -2
- package/dist/esm/{chunk-IEZO4PIG.mjs → chunk-EJ7ODMDA.mjs} +2 -2
- package/dist/esm/{chunk-ONIYM7IU.mjs → chunk-EJURLI4L.mjs} +2 -2
- package/dist/esm/chunk-FUQDDIKQ.mjs +2 -0
- package/dist/esm/chunk-FUQDDIKQ.mjs.map +1 -0
- package/dist/esm/chunk-FWTJQHJR.mjs +2 -0
- package/dist/esm/chunk-FWTJQHJR.mjs.map +1 -0
- package/dist/esm/{chunk-W637YAND.mjs → chunk-GHHIUWPP.mjs} +2 -2
- package/dist/esm/{chunk-EB7AI4B4.mjs → chunk-GS5Z3HO7.mjs} +2 -2
- package/dist/esm/{chunk-4USAUOCE.mjs → chunk-HGRU3HWY.mjs} +2 -2
- package/dist/esm/{chunk-TEJ7BXJK.mjs → chunk-HOX6Q6ZP.mjs} +2 -2
- package/dist/esm/chunk-HQK6MF3G.mjs +2 -0
- package/dist/esm/chunk-IMVC2JKU.mjs +2 -0
- package/dist/esm/{chunk-N7CE244N.mjs.map → chunk-IMVC2JKU.mjs.map} +1 -1
- package/dist/esm/{chunk-RUSWW265.mjs → chunk-ISXBJPLD.mjs} +2 -2
- package/dist/esm/{chunk-MKUAW7KW.mjs → chunk-IU6REVKX.mjs} +2 -2
- package/dist/esm/{chunk-Z6JERVLX.mjs → chunk-IWKIZLFW.mjs} +2 -2
- package/dist/esm/{chunk-LQH7T3TE.mjs → chunk-J534ICWA.mjs} +2 -2
- package/dist/esm/{chunk-STYDBDYL.mjs → chunk-J577ODDM.mjs} +2 -2
- package/dist/esm/chunk-JBTLE33X.mjs +2 -0
- package/dist/esm/{chunk-JKZHPY24.mjs.map → chunk-JBTLE33X.mjs.map} +1 -1
- package/dist/esm/{chunk-EPTCPBVW.mjs → chunk-LLRWILVZ.mjs} +2 -2
- package/dist/esm/{chunk-I5JWDZIP.mjs → chunk-M4Q4XDVR.mjs} +2 -2
- package/dist/esm/chunk-M4Q4XDVR.mjs.map +1 -0
- package/dist/esm/chunk-MEOBWD6V.mjs +2 -0
- package/dist/esm/chunk-MEOBWD6V.mjs.map +1 -0
- package/dist/esm/{chunk-ZNEBMSNC.mjs → chunk-MLQT5I6K.mjs} +2 -2
- package/dist/esm/{chunk-C3L4ETUF.mjs → chunk-MSGHGK52.mjs} +2 -2
- package/dist/esm/{chunk-7STYQ5ZE.mjs → chunk-NGTNMV6Q.mjs} +2 -2
- package/dist/esm/{chunk-OX5GWFHX.mjs → chunk-NH466YFP.mjs} +2 -2
- package/dist/esm/{chunk-ZCCYHFPK.mjs → chunk-NMD45OTM.mjs} +2 -2
- package/dist/esm/{chunk-UWI5D7FD.mjs → chunk-NUBYALZP.mjs} +2 -2
- package/dist/esm/{chunk-KKP4FBWZ.mjs → chunk-OFC75EWS.mjs} +2 -2
- package/dist/esm/{chunk-T6OEZ4KP.mjs → chunk-OOYRJQPD.mjs} +2 -2
- package/dist/esm/chunk-OZ3GSAFK.mjs +2 -0
- package/dist/esm/chunk-OZ3GSAFK.mjs.map +1 -0
- package/dist/esm/{chunk-EU6CX56Q.mjs → chunk-PENBUSGL.mjs} +2 -2
- package/dist/esm/{chunk-A3UVZHDJ.mjs → chunk-PG7KSUMN.mjs} +2 -2
- package/dist/esm/{chunk-HGZGTBA4.mjs → chunk-PGP2XMDE.mjs} +2 -2
- package/dist/esm/{chunk-JM2B5E2I.mjs → chunk-Q6LFIZ3L.mjs} +1 -1
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
- package/dist/esm/{chunk-EADBYPUD.mjs → chunk-QJIMZI32.mjs} +2 -2
- package/dist/esm/{chunk-YHO2EBXH.mjs → chunk-QLE5JL4X.mjs} +2 -2
- package/dist/esm/{chunk-KFUOOBMJ.mjs → chunk-QOOHLRRJ.mjs} +2 -2
- package/dist/esm/{chunk-UO5LUYGO.mjs → chunk-QYEJOEWB.mjs} +2 -2
- package/dist/esm/{chunk-NQMF46E5.mjs → chunk-R4HLV32L.mjs} +2 -2
- package/dist/esm/chunk-RAHMGSBW.mjs +2 -0
- package/dist/esm/{chunk-CNH2RAJQ.mjs.map → chunk-RAHMGSBW.mjs.map} +1 -1
- package/dist/esm/{chunk-C34M4T77.mjs → chunk-RWYPGTNL.mjs} +2 -2
- package/dist/esm/{chunk-3FVRXELT.mjs → chunk-SCHMTP4N.mjs} +2 -2
- package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
- package/dist/esm/{chunk-3Y6JNFPD.mjs → chunk-SCRIQQV3.mjs} +2 -2
- package/dist/esm/{chunk-W36IQO5K.mjs → chunk-SNBE5YAC.mjs} +2 -2
- package/dist/esm/{chunk-NCDP26DV.mjs → chunk-SSDWEOF7.mjs} +2 -2
- package/dist/esm/{chunk-N466X3S6.mjs → chunk-SZ6KR73C.mjs} +2 -2
- package/dist/esm/{chunk-F5C4SZZ7.mjs → chunk-THURV6CN.mjs} +2 -2
- package/dist/esm/{chunk-5RRZMXND.mjs → chunk-TU6VKYDC.mjs} +2 -2
- package/dist/esm/{chunk-UDU5L4XH.mjs → chunk-UFMIMN7W.mjs} +2 -2
- package/dist/esm/{chunk-LO7B3CWN.mjs → chunk-ULW5LX5H.mjs} +2 -2
- package/dist/esm/{chunk-4KEEUDZA.mjs → chunk-V6M7FGQT.mjs} +2 -2
- package/dist/esm/{chunk-3VGX3TXH.mjs → chunk-VBODXPT3.mjs} +2 -2
- package/dist/esm/{chunk-MGOHPDX4.mjs → chunk-VMVSUH2K.mjs} +2 -2
- package/dist/esm/{chunk-T23OVRNF.mjs → chunk-WHSN42R2.mjs} +2 -2
- package/dist/esm/{chunk-LEBJNW6Y.mjs → chunk-WJIICWOB.mjs} +2 -2
- package/dist/esm/{chunk-PYUU4OEL.mjs → chunk-WOLLRMXR.mjs} +2 -2
- package/dist/esm/{chunk-QZRWRX6P.mjs → chunk-WSVJNBSJ.mjs} +2 -2
- package/dist/esm/{chunk-QZRWRX6P.mjs.map → chunk-WSVJNBSJ.mjs.map} +1 -1
- package/dist/esm/{chunk-VT6XJSRO.mjs → chunk-WXLSJF4A.mjs} +1 -1
- package/dist/esm/chunk-WXLSJF4A.mjs.map +1 -0
- package/dist/esm/{chunk-NC5HHEEM.mjs → chunk-XQ7I34AL.mjs} +2 -2
- package/dist/esm/{chunk-MWN63XBE.mjs → chunk-Y24BMR2W.mjs} +2 -2
- package/dist/esm/{chunk-WAXCU6D6.mjs → chunk-YLQJBXUF.mjs} +2 -2
- package/dist/esm/chunk-ZAXWW7VW.mjs +2 -0
- package/dist/esm/chunk-ZAXWW7VW.mjs.map +1 -0
- package/dist/esm/{chunk-6RBUXB5I.mjs → chunk-ZV5P2GSJ.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +6 -0
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +6 -0
- package/dist/esm/client/post.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.mjs +1 -1
- package/dist/esm/core/crypto/cryptoHasher.d.mts +21 -0
- package/dist/esm/core/crypto/cryptoHasher.mjs +2 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +52 -8
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +14 -2
- package/dist/esm/core/crypto/poseidon.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +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.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +5 -4
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +10 -8
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +1 -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.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.mjs +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.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -11
- 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.mjs +1 -1
- package/dist/esm/types/index.d.mts +2 -2
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +37 -1
- package/dist/esm/utils/apiEndpoints.mjs +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 +1 -1
- package/src/account/EphemeralKeyPair.ts +6 -6
- package/src/account/KeylessAccount.ts +68 -30
- package/src/api/keyless.ts +15 -4
- package/src/bcs/deserializer.ts +15 -9
- package/src/bcs/serializer.ts +40 -0
- package/src/client/core.ts +4 -7
- package/src/client/get.ts +6 -0
- package/src/client/post.ts +6 -0
- package/src/core/crypto/cryptoHasher.ts +16 -0
- package/src/core/crypto/keyless.ts +159 -23
- package/src/core/crypto/poseidon.ts +17 -8
- package/src/internal/keyless.ts +81 -15
- package/src/transactions/transactionBuilder/signingMessage.ts +0 -13
- package/src/transactions/transactionBuilder/transactionBuilder.ts +4 -2
- package/src/types/index.ts +2 -2
- package/src/types/keyless.ts +36 -0
- package/src/utils/apiEndpoints.ts +4 -2
- package/src/version.ts +1 -1
- package/dist/esm/bcs/cryptoHasher.d.mts +0 -15
- package/dist/esm/bcs/cryptoHasher.mjs +0 -2
- package/dist/esm/chunk-5ADNWXP2.mjs +0 -2
- package/dist/esm/chunk-5ADNWXP2.mjs.map +0 -1
- package/dist/esm/chunk-5YI2GEG5.mjs +0 -2
- package/dist/esm/chunk-5YI2GEG5.mjs.map +0 -1
- package/dist/esm/chunk-CNH2RAJQ.mjs +0 -2
- package/dist/esm/chunk-I5JWDZIP.mjs.map +0 -1
- package/dist/esm/chunk-JKZHPY24.mjs +0 -2
- package/dist/esm/chunk-JM2B5E2I.mjs.map +0 -1
- package/dist/esm/chunk-KPZDC5ZE.mjs +0 -2
- package/dist/esm/chunk-KPZDC5ZE.mjs.map +0 -1
- package/dist/esm/chunk-LECNIPW7.mjs +0 -2
- package/dist/esm/chunk-LECNIPW7.mjs.map +0 -1
- package/dist/esm/chunk-N7CE244N.mjs +0 -2
- package/dist/esm/chunk-R2P2XANA.mjs +0 -2
- package/dist/esm/chunk-R2P2XANA.mjs.map +0 -1
- package/dist/esm/chunk-UTXJOB3O.mjs +0 -2
- package/dist/esm/chunk-VT6XJSRO.mjs.map +0 -1
- package/dist/esm/chunk-W4IWORPF.mjs +0 -2
- package/dist/esm/chunk-W4IWORPF.mjs.map +0 -1
- package/dist/esm/chunk-WDE54GRQ.mjs +0 -2
- package/dist/esm/chunk-WDE54GRQ.mjs.map +0 -1
- package/dist/esm/chunk-YZPQVZ7S.mjs +0 -2
- package/dist/esm/chunk-YZPQVZ7S.mjs.map +0 -1
- package/dist/esm/chunk-ZUQJLFR2.mjs +0 -2
- package/dist/esm/chunk-ZUQJLFR2.mjs.map +0 -1
- package/src/bcs/cryptoHasher.ts +0 -6
- /package/dist/esm/{chunk-OT37OTT7.mjs.map → chunk-34WI7I3Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z2ZR4PTF.mjs.map → chunk-3DP4R3FI.mjs.map} +0 -0
- /package/dist/esm/{chunk-IJE5YSXW.mjs.map → chunk-3J53BCEQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWWXZ7EW.mjs.map → chunk-3SXTTG2X.mjs.map} +0 -0
- /package/dist/esm/{chunk-7H3HRFVM.mjs.map → chunk-3YIUOKWW.mjs.map} +0 -0
- /package/dist/esm/{chunk-REBMGDZ5.mjs.map → chunk-45ESRYGP.mjs.map} +0 -0
- /package/dist/esm/{chunk-5V2RGYYK.mjs.map → chunk-4RXGVY2H.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-4VAYXBD2.mjs.map} +0 -0
- /package/dist/esm/{chunk-6KNAIXZ3.mjs.map → chunk-5SGIYAB7.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q3AUNZDW.mjs.map → chunk-6F3HFDL3.mjs.map} +0 -0
- /package/dist/esm/{chunk-FBLSW5TB.mjs.map → chunk-6MDYCC7P.mjs.map} +0 -0
- /package/dist/esm/{chunk-M7HZOQ6A.mjs.map → chunk-7CJAEAQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y33VGXNI.mjs.map → chunk-7Y6AWDBZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-AUAL3H36.mjs.map} +0 -0
- /package/dist/esm/{chunk-6M53MDWB.mjs.map → chunk-AUV4VAXK.mjs.map} +0 -0
- /package/dist/esm/{chunk-MTLETLKV.mjs.map → chunk-AVWAYKNS.mjs.map} +0 -0
- /package/dist/esm/{chunk-EIRSA5UU.mjs.map → chunk-BNA3SGG6.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y5BON557.mjs.map → chunk-CEGCSC3T.mjs.map} +0 -0
- /package/dist/esm/{chunk-UFJGYMEB.mjs.map → chunk-CZOUSIAD.mjs.map} +0 -0
- /package/dist/esm/{chunk-SBQRBBRS.mjs.map → chunk-DSVNXD5A.mjs.map} +0 -0
- /package/dist/esm/{chunk-IEZO4PIG.mjs.map → chunk-EJ7ODMDA.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONIYM7IU.mjs.map → chunk-EJURLI4L.mjs.map} +0 -0
- /package/dist/esm/{chunk-W637YAND.mjs.map → chunk-GHHIUWPP.mjs.map} +0 -0
- /package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-GS5Z3HO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-4USAUOCE.mjs.map → chunk-HGRU3HWY.mjs.map} +0 -0
- /package/dist/esm/{chunk-TEJ7BXJK.mjs.map → chunk-HOX6Q6ZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-UTXJOB3O.mjs.map → chunk-HQK6MF3G.mjs.map} +0 -0
- /package/dist/esm/{chunk-RUSWW265.mjs.map → chunk-ISXBJPLD.mjs.map} +0 -0
- /package/dist/esm/{chunk-MKUAW7KW.mjs.map → chunk-IU6REVKX.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z6JERVLX.mjs.map → chunk-IWKIZLFW.mjs.map} +0 -0
- /package/dist/esm/{chunk-LQH7T3TE.mjs.map → chunk-J534ICWA.mjs.map} +0 -0
- /package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-J577ODDM.mjs.map} +0 -0
- /package/dist/esm/{chunk-EPTCPBVW.mjs.map → chunk-LLRWILVZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-MLQT5I6K.mjs.map} +0 -0
- /package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-MSGHGK52.mjs.map} +0 -0
- /package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-NGTNMV6Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-OX5GWFHX.mjs.map → chunk-NH466YFP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZCCYHFPK.mjs.map → chunk-NMD45OTM.mjs.map} +0 -0
- /package/dist/esm/{chunk-UWI5D7FD.mjs.map → chunk-NUBYALZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-KKP4FBWZ.mjs.map → chunk-OFC75EWS.mjs.map} +0 -0
- /package/dist/esm/{chunk-T6OEZ4KP.mjs.map → chunk-OOYRJQPD.mjs.map} +0 -0
- /package/dist/esm/{chunk-EU6CX56Q.mjs.map → chunk-PENBUSGL.mjs.map} +0 -0
- /package/dist/esm/{chunk-A3UVZHDJ.mjs.map → chunk-PG7KSUMN.mjs.map} +0 -0
- /package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-PGP2XMDE.mjs.map} +0 -0
- /package/dist/esm/{chunk-EADBYPUD.mjs.map → chunk-QJIMZI32.mjs.map} +0 -0
- /package/dist/esm/{chunk-YHO2EBXH.mjs.map → chunk-QLE5JL4X.mjs.map} +0 -0
- /package/dist/esm/{chunk-KFUOOBMJ.mjs.map → chunk-QOOHLRRJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-UO5LUYGO.mjs.map → chunk-QYEJOEWB.mjs.map} +0 -0
- /package/dist/esm/{chunk-NQMF46E5.mjs.map → chunk-R4HLV32L.mjs.map} +0 -0
- /package/dist/esm/{chunk-C34M4T77.mjs.map → chunk-RWYPGTNL.mjs.map} +0 -0
- /package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-SCHMTP4N.mjs.map} +0 -0
- /package/dist/esm/{chunk-3Y6JNFPD.mjs.map → chunk-SCRIQQV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-W36IQO5K.mjs.map → chunk-SNBE5YAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-NCDP26DV.mjs.map → chunk-SSDWEOF7.mjs.map} +0 -0
- /package/dist/esm/{chunk-N466X3S6.mjs.map → chunk-SZ6KR73C.mjs.map} +0 -0
- /package/dist/esm/{chunk-F5C4SZZ7.mjs.map → chunk-THURV6CN.mjs.map} +0 -0
- /package/dist/esm/{chunk-5RRZMXND.mjs.map → chunk-TU6VKYDC.mjs.map} +0 -0
- /package/dist/esm/{chunk-UDU5L4XH.mjs.map → chunk-UFMIMN7W.mjs.map} +0 -0
- /package/dist/esm/{chunk-LO7B3CWN.mjs.map → chunk-ULW5LX5H.mjs.map} +0 -0
- /package/dist/esm/{chunk-4KEEUDZA.mjs.map → chunk-V6M7FGQT.mjs.map} +0 -0
- /package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-VBODXPT3.mjs.map} +0 -0
- /package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-VMVSUH2K.mjs.map} +0 -0
- /package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-WHSN42R2.mjs.map} +0 -0
- /package/dist/esm/{chunk-LEBJNW6Y.mjs.map → chunk-WJIICWOB.mjs.map} +0 -0
- /package/dist/esm/{chunk-PYUU4OEL.mjs.map → chunk-WOLLRMXR.mjs.map} +0 -0
- /package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-XQ7I34AL.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWN63XBE.mjs.map → chunk-Y24BMR2W.mjs.map} +0 -0
- /package/dist/esm/{chunk-WAXCU6D6.mjs.map → chunk-YLQJBXUF.mjs.map} +0 -0
- /package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-ZV5P2GSJ.mjs.map} +0 -0
- /package/dist/esm/{bcs → core/crypto}/cryptoHasher.mjs.map +0 -0
|
@@ -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(
|
|
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
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -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 = {
|
package/src/types/keyless.ts
CHANGED
|
@@ -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
|
|
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
36
|
devnet: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
|
|
36
|
-
local
|
|
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 {
|
package/src/version.ts
CHANGED
|
@@ -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{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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/poseidon.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\nimport {\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n} from \"poseidon-lite\";\n\nconst numInputsToPoseidonFunc = [\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n];\n\nconst BYTES_PACKED_PER_SCALAR = 31;\nconst MAX_NUM_INPUT_SCALARS = 16;\nconst MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALAR;\n\n// hashes an ASCII string to a field element\nexport function hashASCIIStrToField(str: string, maxSizeBytes: number) {\n const textEncoder = new TextEncoder();\n const strBytes = textEncoder.encode(str);\n return hashBytesWithLen(strBytes, maxSizeBytes);\n}\n\nfunction hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number) {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const packed = padAndPackBytesWithLen(bytes, maxSizeBytes);\n return poseidonHash(packed);\n}\n\nfunction padAndPackBytesNoLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const paddedStrBytes = padUint8ArrayWithZeros(bytes, maxSizeBytes);\n return packBytes(paddedStrBytes);\n}\n\nexport function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n return padAndPackBytesNoLen(bytes, maxSizeBytes).concat([BigInt(bytes.length)]);\n}\n\nfunction packBytes(bytes: Uint8Array): bigint[] {\n if (bytes.length > MAX_NUM_INPUT_BYTES) {\n throw new Error(`Can't pack more than ${MAX_NUM_INPUT_BYTES}. Was given ${bytes.length} bytes`);\n }\n return chunkUint8Array(bytes, BYTES_PACKED_PER_SCALAR).map((chunk) => bytesToBigIntLE(chunk));\n}\n\nfunction chunkUint8Array(array: Uint8Array, chunkSize: number): Uint8Array[] {\n const result: Uint8Array[] = [];\n for (let i = 0; i < array.length; i += chunkSize) {\n result.push(array.subarray(i, i + chunkSize));\n }\n return result;\n}\n\nexport function bytesToBigIntLE(bytes: Uint8Array): bigint {\n let result = BigInt(0);\n for (let i = bytes.length - 1; i >= 0; i -= 1) {\n result = (result << BigInt(8)) | BigInt(bytes[i]);\n }\n return result;\n}\n\nexport function bigIntToBytesLE(value: bigint, length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; i += 1) {\n bytes[i] = Number(value & BigInt(0xff));\n // eslint-disable-next-line no-param-reassign\n value >>= BigInt(8);\n }\n return bytes;\n}\n\nfunction padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uint8Array {\n if (paddedSize < inputArray.length) {\n throw new Error(\"Padded size must be greater than or equal to the input array size.\");\n }\n\n // Create a new Uint8Array with the padded size\n const paddedArray = new Uint8Array(paddedSize);\n\n // Copy the content of the input array to the new array\n paddedArray.set(inputArray);\n\n // Fill the remaining space with zeros\n for (let i = inputArray.length; i < paddedSize; i += 1) {\n paddedArray[i] = 0;\n }\n\n return paddedArray;\n}\n\nexport function poseidonHash(inputs: (number | bigint | string)[]): bigint {\n const poseidonFixedHash = numInputsToPoseidonFunc[inputs.length - 1];\n\n if (poseidonFixedHash) {\n return poseidonFixedHash(inputs);\n }\n throw new Error(`Unable to hash input of length ${inputs.length}`);\n}\n"],"mappings":"AACA,OACE,aAAAA,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,MACK,gBAEP,IAAMC,EAA0B,CAC9BhB,EACAC,EACAC,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,EAAM,SAASG,EAAGA,EAAIF,CAAS,CAAC,EAE9C,OAAOC,CACT,CAEO,SAASH,EAAgBV,EAA2B,CACzD,IAAIa,EAAS,OAAO,CAAC,EACrB,QAASC,EAAId,EAAM,OAAS,EAAGc,GAAK,EAAGA,GAAK,EAC1CD,EAAUA,GAAU,OAAO,CAAC,EAAK,OAAOb,EAAMc,CAAC,CAAC,EAElD,OAAOD,CACT,CAEO,SAASE,EAAgBC,EAAeC,EAA4B,CACzE,IAAMjB,EAAQ,IAAI,WAAWiB,CAAM,EACnC,QAASH,EAAI,EAAGA,EAAIG,EAAQH,GAAK,EAC/Bd,EAAMc,CAAC,EAAI,OAAOE,EAAQ,OAAO,GAAI,CAAC,EAEtCA,IAAU,OAAO,CAAC,EAEpB,OAAOhB,CACT,CAEA,SAASM,EAAuBY,EAAwBC,EAAgC,CACtF,GAAIA,EAAaD,EAAW,OAC1B,MAAM,IAAI,MAAM,oEAAoE,EAItF,IAAME,EAAc,IAAI,WAAWD,CAAU,EAG7CC,EAAY,IAAIF,CAAU,EAG1B,QAASJ,EAAII,EAAW,OAAQJ,EAAIK,EAAYL,GAAK,EACnDM,EAAYN,CAAC,EAAI,EAGnB,OAAOM,CACT,CAEO,SAASjB,EAAakB,EAA8C,CACzE,IAAMC,EAAoB/B,EAAwB8B,EAAO,OAAS,CAAC,EAEnE,GAAIC,EACF,OAAOA,EAAkBD,CAAM,EAEjC,MAAM,IAAI,MAAM,kCAAkCA,EAAO,MAAM,EAAE,CACnE","names":["poseidon1","poseidon2","poseidon3","poseidon4","poseidon5","poseidon6","poseidon7","poseidon8","poseidon9","poseidon10","poseidon11","poseidon12","poseidon13","poseidon14","poseidon15","poseidon16","numInputsToPoseidonFunc","BYTES_PACKED_PER_SCALAR","MAX_NUM_INPUT_SCALARS","MAX_NUM_INPUT_BYTES","hashASCIIStrToField","str","maxSizeBytes","strBytes","hashBytesWithLen","bytes","packed","padAndPackBytesWithLen","poseidonHash","padAndPackBytesNoLen","paddedStrBytes","padUint8ArrayWithZeros","packBytes","chunkUint8Array","chunk","bytesToBigIntLE","array","chunkSize","result","i","bigIntToBytesLE","value","length","inputArray","paddedSize","paddedArray","inputs","poseidonFixedHash"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as y,d as T}from"./chunk-Z2ZR4PTF.mjs";import{f as A,g as a}from"./chunk-YE5B2S5L.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";function c(e){return e.feePayerAddress?new T(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new y(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let o=d.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);o.update(r);let s=o.digest(),i=e,t=new Uint8Array(s.length+i.length);return t.set(s),t.set(i,s.length),t}function p(e){return n(e.bcsToBytes(),e.domainSeparator)}function u(e){let r=c(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{c as a,n as b,p as c,u as d};
|
|
2
|
-
//# sourceMappingURL=chunk-5YI2GEG5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/transactionBuilder/signingMessage.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the generation of the signing message.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from \"../../utils/const\";\nimport { FeePayerRawTransaction, MultiAgentRawTransaction } from \"../instances\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../types\";\nimport { CryptoHashable } from \"../../bcs/cryptoHasher\";\n\n/**\n * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction\n *\n * @param transaction A aptos transaction type\n *\n * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction\n */\nexport function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {\n if (transaction.feePayerAddress) {\n return new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n }\n if (transaction.secondarySignerAddresses) {\n return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);\n }\n\n return transaction.rawTransaction;\n}\n\n/**\n * Generates the 'signing message' form of a message to be signed.\n *\n * @param bytes The byte representation of the message to be signed and sent to the chain\n * @param domainSeparator A domain separator that starts with 'APTOS::'\n *\n * @returns The Uint8Array of the signing message\n */\nexport function generateSigningMessage(bytes: Uint8Array, domainSeparator: string): Uint8Array {\n const hash = sha3Hash.create();\n\n if (!domainSeparator.startsWith(\"APTOS::\")) {\n throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${domainSeparator}`);\n }\n\n hash.update(domainSeparator);\n\n const prefix = hash.digest();\n\n const body = bytes;\n\n const mergedArray = new Uint8Array(prefix.length + body.length);\n mergedArray.set(prefix);\n mergedArray.set(body, prefix.length);\n\n return mergedArray;\n}\n\n/**\n * Generates the 'signing message' form of a serilizable value. It bcs serializes the value and uses the name of\n * its constructor as the domain separator.\n *\n * @param hashable An object that has a bcs serialized form\n *\n * @returns The Uint8Array of the signing message\n */\nexport function generateSigningMessageForBcsCryptoHashable(hashable: CryptoHashable): Uint8Array {\n return generateSigningMessage(hashable.bcsToBytes(), hashable.domainSeparator);\n}\n\n/**\n * Generates the 'signing message' form of a transaction. It derives the type of transaction and\n * applies the appropriate domain separator based on if there is extra data such as a fee payer or\n * secondary signers.\n *\n * @param transaction A transaction that is to be signed\n *\n * @returns The Uint8Array of the signing message\n */\nexport function generateSigningMessageForTransaction(transaction: AnyRawTransaction): Uint8Array {\n const rawTxn = deriveTransactionType(transaction);\n if (transaction.feePayerAddress) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n if (transaction.secondarySignerAddresses) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_SALT);\n}\n"],"mappings":"gGAMA,OAAS,YAAYA,MAAgB,qBAa9B,SAASC,EAAsBC,EAA2D,CAC/F,OAAIA,EAAY,gBACP,IAAIC,EACTD,EAAY,eACZA,EAAY,0BAA4B,CAAC,EACzCA,EAAY,eACd,EAEEA,EAAY,yBACP,IAAIE,EAAyBF,EAAY,eAAgBA,EAAY,wBAAwB,EAG/FA,EAAY,cACrB,CAUO,SAASG,EAAuBC,EAAmBC,EAAqC,CAC7F,IAAMC,EAAOC,EAAS,OAAO,EAE7B,GAAI,CAACF,EAAgB,WAAW,SAAS,EACvC,MAAM,IAAI,MAAM,+DAA+DA,CAAe,EAAE,EAGlGC,EAAK,OAAOD,CAAe,EAE3B,IAAMG,EAASF,EAAK,OAAO,EAErBG,EAAOL,EAEPM,EAAc,IAAI,WAAWF,EAAO,OAASC,EAAK,MAAM,EAC9D,OAAAC,EAAY,IAAIF,CAAM,EACtBE,EAAY,IAAID,EAAMD,EAAO,MAAM,EAE5BE,CACT,CAUO,SAASC,EAA2CC,EAAsC,CAC/F,OAAOT,EAAuBS,EAAS,WAAW,EAAGA,EAAS,eAAe,CAC/E,CAWO,SAASC,EAAqCb,EAA4C,CAC/F,IAAMc,EAASf,EAAsBC,CAAW,EAChD,OAAIA,EAAY,gBACPG,EAAuBW,EAAO,WAAW,EAAGC,CAA8B,EAE/Ef,EAAY,yBACPG,EAAuBW,EAAO,WAAW,EAAGC,CAA8B,EAE5EZ,EAAuBW,EAAO,WAAW,EAAGE,CAAoB,CACzE","names":["sha3Hash","deriveTransactionType","transaction","FeePayerRawTransaction","MultiAgentRawTransaction","generateSigningMessage","bytes","domainSeparator","hash","sha3Hash","prefix","body","mergedArray","generateSigningMessageForBcsCryptoHashable","hashable","generateSigningMessageForTransaction","rawTxn","RAW_TRANSACTION_WITH_DATA_SALT","RAW_TRANSACTION_SALT"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as T,c as en,d as an,e as N}from"./chunk-6KNAIXZ3.mjs";import{q as tn,t as f}from"./chunk-7H3HRFVM.mjs";import{a as Y}from"./chunk-IJE5YSXW.mjs";import{b as nn}from"./chunk-EIRSA5UU.mjs";import{a as Q}from"./chunk-AH44UPM4.mjs";import{a as J}from"./chunk-Y33VGXNI.mjs";import{a as j}from"./chunk-UTXJOB3O.mjs";import{g as M}from"./chunk-WDE54GRQ.mjs";import{a as y}from"./chunk-Y5BON557.mjs";import{a as L}from"./chunk-MKUAW7KW.mjs";import{a as Z}from"./chunk-W637YAND.mjs";import{a as H,c as X,d as z}from"./chunk-Z2ZR4PTF.mjs";import{c as K,d as k,e as O,f as E,g as V,h as q,i as v}from"./chunk-IEZO4PIG.mjs";import{a as _}from"./chunk-MWUJCP27.mjs";import{b as F,d as D,e as R,f as $}from"./chunk-RUSWW265.mjs";import{a as W,b as w,d as m}from"./chunk-4USAUOCE.mjs";import{b as G,c as C}from"./chunk-YE5B2S5L.mjs";import{a as B,b as l}from"./chunk-UO5LUYGO.mjs";import{a as b,c as U}from"./chunk-MTLETLKV.mjs";import{i as x}from"./chunk-LECNIPW7.mjs";import{a as S,c as g}from"./chunk-PYUU4OEL.mjs";import{b as u}from"./chunk-T23OVRNF.mjs";import{b as P}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as dn}from"@noble/hashes/sha3";async function kn(t){if(tn(t))return yn(t);let{moduleAddress:n,moduleName:e,functionName:i}=f(t.function),a=await on({key:"entry-function",moduleAddress:n,moduleName:e,functionName:i,aptosConfig:t.aptosConfig,abi:t.abi,fetch:en});return An({...t,abi:a})}function An(t){let n=t.abi,{moduleAddress:e,moduleName:i,functionName:a}=f(t.function),r=T(t.typeArguments);if(r.length!==n.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${n.typeParameters.length}, received ${r.length}`);let o=t.functionArguments.map((s,d)=>N(t.function,n,s,d,r));if(o.length!==n.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${n.parameters.length} but got ${o.length}`);let c=E.build(`${e}::${i}`,a,r,o);if("multisigAddress"in t){let s=u.from(t.multisigAddress);return new O(new q(s,new v(c)))}return new k(c)}async function On(t){let{moduleAddress:n,moduleName:e,functionName:i}=f(t.function),a=await on({key:"view-function",moduleAddress:n,moduleName:e,functionName:i,aptosConfig:t.aptosConfig,abi:t.abi,fetch:an});return mn({abi:a,...t})}function mn(t){let n=t.abi,{moduleAddress:e,moduleName:i,functionName:a}=f(t.function),r=T(t.typeArguments);if(r.length!==n.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${n.typeParameters.length}, received ${r.length}`);let o=t?.functionArguments?.map((c,s)=>N(t.function,n,c,s,r))??[];if(o.length!==n.parameters.length)throw new Error(`Too few arguments for '${e}::${i}::${a}', expected ${n.parameters.length} but got ${o.length}`);return E.build(`${e}::${i}`,a,r,o)}function yn(t){return new K(new V(P.fromHexInput(t.bytecode).toUint8Array(),T(t.typeArguments),t.functionArguments))}async function fn(t){let{aptosConfig:n,sender:e,payload:i,options:a,feePayerAddress:r}=t,o=async()=>M[n.network]?{chainId:M[n.network]}:{chainId:(await J({aptosConfig:n})).chain_id},c=async()=>a?.gasUnitPrice?{gasEstimate:a.gasUnitPrice}:{gasEstimate:(await nn({aptosConfig:n})).gas_estimate},s=async()=>{let p=async()=>a?.accountSequenceNumber!==void 0?a.accountSequenceNumber:(await Y({aptosConfig:n,accountAddress:e})).sequence_number;if(r&&u.from(r).equals(u.ZERO))try{return await p()}catch{return 0}else return p()},[{chainId:d},{gasEstimate:A},I]=await Promise.all([o(),c(),s()]),{maxGasAmount:sn,gasUnitPrice:cn,expireTimestamp:un}={maxGasAmount:a?.maxGasAmount?BigInt(a.maxGasAmount):BigInt(2e5),gasUnitPrice:a?.gasUnitPrice??BigInt(A),expireTimestamp:a?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+20)};return new H(u.from(e),BigInt(I),i,BigInt(sn),BigInt(cn),BigInt(un),new _(d))}async function Vn(t){let{aptosConfig:n,sender:e,payload:i,options:a,feePayerAddress:r}=t,o=await fn({aptosConfig:n,sender:e,payload:i,options:a,feePayerAddress:r});if("secondarySignerAddresses"in t){let c=t.secondarySignerAddresses?.map(s=>u.from(s))??[];return new Z(o,c,t.feePayerAddress?u.from(t.feePayerAddress):void 0)}return new L(o,t.feePayerAddress?u.from(t.feePayerAddress):void 0)}function qn(t){let{signerPublicKey:n,transaction:e,secondarySignersPublicKeys:i,feePayerPublicKey:a}=t,r=h(n);if(e.feePayerAddress){let c=new z(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),s=[];i&&(s=i.map(I=>h(I)));let d=h(a),A=new R(r,e.secondarySignerAddresses??[],s,{address:e.feePayerAddress,authenticator:d});return new y(c.raw_txn,A).bcsToBytes()}if(e.secondarySignerAddresses){let c=new X(e.rawTransaction,e.secondarySignerAddresses),s=[];s=i.map(A=>h(A));let d=new D(r,e.secondarySignerAddresses,s);return new y(c.raw_txn,d).bcsToBytes()}let o;if(r instanceof w)o=new F(r.public_key,r.signature);else if(r instanceof m)o=new $(r);else throw new Error("Invalid public key");return new y(e.rawTransaction,o).bcsToBytes()}function h(t){let n=t;if((n instanceof x||n instanceof b)&&(n=new B(n)),n instanceof B){if(n.publicKey instanceof S)return new m(n,new l(new g(new Uint8Array(64))));if(n.publicKey instanceof b)return new m(n,new l(new U(new Uint8Array(64))));if(n.publicKey instanceof x)return new m(n,new l(new g(new Uint8Array(64))))}return new w(new S(n.toUint8Array()),new g(new Uint8Array(64)))}function pn(t){let{transaction:n,feePayerAuthenticator:e,additionalSignersAuthenticators:i}=t,a=j(W,t.senderAuthenticator),r;if(n.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");r=new R(a,n.secondarySignerAddresses??[],i??[],{address:n.feePayerAddress,authenticator:e})}else if(n.secondarySignerAddresses){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");r=new D(a,n.secondarySignerAddresses,i)}else a instanceof w?r=new F(a.public_key,a.signature):r=new $(a);return new y(n.rawTransaction,r).bcsToBytes()}function rn(t){let n=dn.create();for(let e of t)n.update(e);return n.digest()}var gn=rn(["APTOS::Transaction"]);function vn(t){let n=pn(t);return new P(rn([gn,new Uint8Array([0]),n])).toString()}async function on({key:t,moduleAddress:n,moduleName:e,functionName:i,aptosConfig:a,abi:r,fetch:o}){return r!==void 0?r:Q(async()=>o(n,e,i,a),`${t}-${a.network}-${n}-${e}-${i}`,1e3*60*5)()}export{kn as a,An as b,On as c,mn as d,fn as e,Vn as f,qn as g,h,pn as i,rn as j,vn as k};
|
|
2
|
-
//# sourceMappingURL=chunk-CNH2RAJQ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/get.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\nexport type GetRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\nexport type GetAptosRequestOptions = Omit<GetRequestOptions, \"type\">;\n\n/**\n * Main function to do a Get request\n *\n * @param options GetRequestOptions\n * @returns\n */\nexport async function get<Req extends {}, Res extends {}>(\n options: GetRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig, overrides, params, contentType, acceptType, path, originMethod, type } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"GET\",\n originMethod,\n path,\n contentType,\n acceptType,\n params,\n overrides: {\n ...aptosConfig.clientConfig,\n ...overrides,\n },\n },\n aptosConfig,\n options.type,\n );\n}\n\nexport async function getAptosFullNode<Req extends {}, Res extends {}>(\n options: GetAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return get<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\nexport async function getAptosPepperService<Req extends {}, Res extends {}>(\n options: GetAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return get<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\n/// This function is a helper for paginating using a function wrapping an API\nexport async function paginateWithCursor<Req extends Record<string, any>, Res extends Array<{}>>(\n options: GetAptosRequestOptions,\n): Promise<Res> {\n const out: any[] = [];\n let cursor: string | undefined;\n const requestParams = options.params as { start?: string; limit?: number };\n do {\n // eslint-disable-next-line no-await-in-loop\n const response = await get<Req, Res>({\n type: AptosApiType.FULLNODE,\n aptosConfig: options.aptosConfig,\n originMethod: options.originMethod,\n path: options.path,\n params: requestParams,\n overrides: options.overrides,\n });\n /**\n * the cursor is a \"state key\" from the API perspective. Client\n * should not need to \"care\" what it represents but just use it\n * to query the next chunk of data.\n */\n cursor = response.headers[\"x-aptos-cursor\"];\n // Now that we have the cursor (if any), we remove the headers before\n // adding these to the output of this function.\n delete response.headers;\n out.push(...response.data);\n requestParams.start = cursor;\n } while (cursor !== null && cursor !== undefined);\n return out as Res;\n}\n"],"mappings":"yCAiDA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,YAAAC,EAAa,UAAAC,EAAW,OAAAC,EAAQ,YAAAC,EAAa,WAAAC,EAAY,KAAAC,EAAM,aAAAC,EAAc,KAAAC,CAAK,EAAIR,EACxFS,EAAMR,EAAY,cAAcO,CAAI,EAE1C,OAAOE,EACL,CACE,IAAAD,EACA,OAAQ,MACR,aAAAF,EACA,KAAAD,EACA,YAAAF,EACA,WAAAC,EACA,OAAAF,EACA,UAAW,CACT,GAAGF,EAAY,aACf,GAAGC,CACL,CACF,EACAD,EACAD,EAAQ,IACV,CACF,CAEA,eAAsBW,EACpBX,EACkC,CAClC,GAAM,CAAE,YAAAC,CAAY,EAAID,EAExB,OAAOD,EAAc,CACnB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGC,EAAY,aACf,GAAGA,EAAY,eACf,GAAGD,EAAQ,UACX,QAAS,CAAE,GAAGC,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAEA,eAAsBW,EACpBZ,EACkC,CAClC,OAAOD,EAAc,CAAE,GAAGC,EAAS,aAA0B,CAAC,CAChE,CAGA,eAAsBa,EACpBb,EACc,CACd,IAAMc,EAAa,CAAC,EAChBC,EACEC,EAAgBhB,EAAQ,OAC9B,EAAG,CAED,IAAMiB,EAAW,MAAMlB,EAAc,CACnC,gBACA,YAAaC,EAAQ,YACrB,aAAcA,EAAQ,aACtB,KAAMA,EAAQ,KACd,OAAQgB,EACR,UAAWhB,EAAQ,SACrB,CAAC,EAMDe,EAASE,EAAS,QAAQ,gBAAgB,EAG1C,OAAOA,EAAS,QAChBH,EAAI,KAAK,GAAGG,EAAS,IAAI,EACzBD,EAAc,MAAQD,CACxB,OAASA,GAAW,MACpB,OAAOD,CACT","names":["get","options","aptosConfig","overrides","params","contentType","acceptType","path","originMethod","type","url","aptosRequest","getAptosFullNode","getAptosPepperService","paginateWithCursor","out","cursor","requestParams","response"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Network } from \"../utils/apiEndpoints\";\nimport { OrderBy, TokenStandard } from \"./indexer\";\n\nexport * from \"./indexer\";\n\nexport enum MimeType {\n /**\n * JSON representation, used for transaction submission and accept type JSON output\n */\n JSON = \"application/json\",\n /**\n * BCS representation, used for accept type BCS output\n */\n BCS = \"application/x-bcs\",\n /**\n * BCS representation, used for transaction submission in BCS input\n */\n BCS_SIGNED_TRANSACTION = \"application/x.aptos.signed_transaction+bcs\",\n BCS_VIEW_FUNCTION = \"application/x.aptos.view_function+bcs\",\n}\n\n/**\n * Hex data as input to a function\n */\nexport type HexInput = string | Uint8Array;\n\n/**\n * TypeTag enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}\n */\nexport enum TypeTagVariants {\n Bool = 0,\n U8 = 1,\n U64 = 2,\n U128 = 3,\n Address = 4,\n Signer = 5,\n Vector = 6,\n Struct = 7,\n U16 = 8,\n U32 = 9,\n U256 = 10,\n Reference = 254, // This is specifically a placeholder and does not represent a real type\n Generic = 255, // This is specifically a placeholder and does not represent a real type\n}\n\n/**\n * Script transaction arguments enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}\n */\nexport enum ScriptTransactionArgumentVariants {\n U8 = 0,\n U64 = 1,\n U128 = 2,\n Address = 3,\n U8Vector = 4,\n Bool = 5,\n U16 = 6,\n U32 = 7,\n U256 = 8,\n}\n\n/**\n * Transaction payload enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}\n */\nexport enum TransactionPayloadVariants {\n Script = 0,\n EntryFunction = 2,\n Multisig = 3,\n}\n\n/**\n * Transaction variants enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}\n */\nexport enum TransactionVariants {\n MultiAgentTransaction = 0,\n FeePayerTransaction = 1,\n}\n\n/**\n * Transaction Authenticator enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}\n */\nexport enum TransactionAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n MultiAgent = 2,\n FeePayer = 3,\n SingleSender = 4,\n}\n\n/**\n * Transaction Authenticator enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}\n */\nexport enum AccountAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n SingleKey = 2,\n MultiKey = 3,\n}\n\nexport enum AnyPublicKeyVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n}\n\nexport enum AnySignatureVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n}\n\nexport enum EphemeralPublicKeyVariant {\n Ed25519 = 0,\n}\n\nexport enum EphemeralSignatureVariant {\n Ed25519 = 0,\n}\n\nexport enum EphemeralCertificateVariant {\n ZkProof = 0,\n}\n\nexport enum ZkpVariant {\n Groth16 = 0,\n}\n\n/**\n * BCS types\n */\nexport type Uint8 = number;\nexport type Uint16 = number;\nexport type Uint32 = number;\nexport type Uint64 = bigint;\nexport type Uint128 = bigint;\nexport type Uint256 = bigint;\nexport type AnyNumber = number | bigint;\n\n/**\n * Set of configuration options that can be provided when initializing the SDK.\n * The purpose of these options is to configure various aspects of the SDK's\n * behavior and interaction with the Aptos network\n */\nexport type AptosSettings = {\n readonly network?: Network;\n\n readonly fullnode?: string;\n\n readonly faucet?: string;\n\n readonly indexer?: string;\n\n readonly pepper?: string;\n\n readonly prover?: string;\n\n readonly clientConfig?: ClientConfig;\n\n readonly client?: Client;\n\n readonly fullnodeConfig?: FullNodeConfig;\n\n readonly indexerConfig?: IndexerConfig;\n\n readonly faucetConfig?: FaucetConfig;\n};\n\n/**\n *\n * Controls the number of results that are returned and the starting position of those results.\n * @param offset parameter specifies the starting position of the query result within the set of data. Default is 0.\n * @param limit specifies the maximum number of items or records to return in a query result. Default is 25.\n */\nexport interface PaginationArgs {\n offset?: AnyNumber;\n limit?: number;\n}\n\nexport interface TokenStandardArg {\n tokenStandard?: TokenStandard;\n}\n\nexport interface OrderByArg<T extends {}> {\n orderBy?: OrderBy<T>;\n}\n\nexport interface WhereArg<T extends {}> {\n where?: T;\n}\n\n/**\n * QUERY TYPES\n */\n\n/**\n * A configuration object we can pass with the request to the server.\n *\n * @param API_KEY - api key generated from developer portal {@link https://developers.aptoslabs.com/manage/api-keys}}\n * @param HEADERS - extra headers we want to send with the request\n * @param WITH_CREDENTIALS - whether to carry cookies. By default, it is set to true and cookies will be sent\n */\nexport type ClientConfig = ClientHeadersType & {\n WITH_CREDENTIALS?: boolean;\n API_KEY?: string;\n};\n\n/**\n * A Fullnode only configuration object\n *\n * @param HEADERS - extra headers we want to send with the request\n */\nexport type FullNodeConfig = ClientHeadersType;\n\n/**\n * An Indexer only configuration object\n *\n * @param HEADERS - extra headers we want to send with the request\n */\nexport type IndexerConfig = ClientHeadersType;\n\n/**\n * A Faucet only configuration object\n *\n * @param HEADERS - extra headers we want to send with the request\n * @param AUTH_TOKEN - an auth token to send with a faucet request\n */\nexport type FaucetConfig = ClientHeadersType & {\n AUTH_TOKEN?: string;\n};\n\n/**\n * General type definition for client HEADERS\n */\nexport type ClientHeadersType = {\n HEADERS?: Record<string, string | number | boolean>;\n};\n\nexport interface ClientRequest<Req> {\n url: string;\n method: \"GET\" | \"POST\";\n originMethod?: string;\n body?: Req;\n contentType?: string;\n params?: any;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n headers?: Record<string, any>;\n}\n\nexport interface ClientResponse<Res> {\n status: number;\n statusText: string;\n data: Res;\n config?: any;\n request?: any;\n response?: any;\n headers?: any;\n}\n\nexport interface Client {\n provider<Req, Res>(requestOptions: ClientRequest<Req>): Promise<ClientResponse<Res>>;\n}\n\n/**\n * The API request type\n *\n * @param url - the url to make the request to, i.e https://fullnode.devnet.aptoslabs.com/v1\n * @param method - the request method \"GET\" | \"POST\"\n * @param endpoint (optional) - the endpoint to make the request to, i.e transactions\n * @param body (optional) - the body of the request\n * @param contentType (optional) - the content type to set the `content-type` header to,\n * by default is set to `application/json`\n * @param params (optional) - query params to add to the request\n * @param originMethod (optional) - the local method the request came from\n * @param overrides (optional) - a `ClientConfig` object type to override request data\n */\nexport type AptosRequest = {\n url: string;\n method: \"GET\" | \"POST\";\n path?: string;\n body?: any;\n contentType?: string;\n acceptType?: string;\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n originMethod?: string;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n};\n\n/**\n * Specifies ledger version of transactions. By default latest version will be used\n */\nexport type LedgerVersionArg = {\n ledgerVersion?: AnyNumber;\n};\n\n/**\n * RESPONSE TYPES\n */\n\n/**\n * Type holding the outputs of the estimate gas API\n */\nexport type GasEstimation = {\n /**\n * The deprioritized estimate for the gas unit price\n */\n deprioritized_gas_estimate?: number;\n /**\n * The current estimate for the gas unit price\n */\n gas_estimate: number;\n /**\n * The prioritized estimate for the gas unit price\n */\n prioritized_gas_estimate?: number;\n};\n\nexport type MoveResource = {\n type: MoveStructId;\n data: {};\n};\n\nexport type AccountData = {\n sequence_number: string;\n authentication_key: string;\n};\n\nexport type MoveModuleBytecode = {\n bytecode: string;\n abi?: MoveModule;\n};\n\n/**\n * TRANSACTION TYPES\n */\n\nexport enum TransactionResponseType {\n Pending = \"pending_transaction\",\n User = \"user_transaction\",\n Genesis = \"genesis_transaction\",\n BlockMetadata = \"block_metadata_transaction\",\n StateCheckpoint = \"state_checkpoint_transaction\",\n Validator = \"validator_transaction\",\n}\n\nexport type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;\nexport type CommittedTransactionResponse =\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse\n | ValidatorTransactionResponse;\n\nexport function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse {\n return response.type === TransactionResponseType.Pending;\n}\n\nexport function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse {\n return response.type === TransactionResponseType.User;\n}\n\nexport function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse {\n return response.type === TransactionResponseType.Genesis;\n}\n\nexport function isBlockMetadataTransactionResponse(\n response: TransactionResponse,\n): response is BlockMetadataTransactionResponse {\n return response.type === TransactionResponseType.BlockMetadata;\n}\n\nexport function isStateCheckpointTransactionResponse(\n response: TransactionResponse,\n): response is StateCheckpointTransactionResponse {\n return response.type === TransactionResponseType.StateCheckpoint;\n}\n\nexport function isValidatorTransactionResponse(\n response: TransactionResponse,\n): response is ValidatorTransactionResponse {\n return response.type === TransactionResponseType.Validator;\n}\n\nexport type PendingTransactionResponse = {\n type: TransactionResponseType.Pending;\n hash: string;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n};\n\nexport type UserTransactionResponse = {\n type: TransactionResponseType.User;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n /**\n * Events generated by the transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\nexport type GenesisTransactionResponse = {\n type: TransactionResponseType.Genesis;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n payload: GenesisPayload;\n /**\n * Events emitted during genesis\n */\n events: Array<Event>;\n};\n\nexport type BlockMetadataTransactionResponse = {\n type: TransactionResponseType.BlockMetadata;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n id: string;\n epoch: string;\n round: string;\n /**\n * The events emitted at the block creation\n */\n events: Array<Event>;\n /**\n * Previous block votes\n */\n previous_block_votes_bitvec: Array<number>;\n proposer: string;\n /**\n * The indices of the proposers who failed to propose\n */\n failed_proposer_indices: Array<number>;\n timestamp: string;\n};\n\nexport type StateCheckpointTransactionResponse = {\n type: TransactionResponseType.StateCheckpoint;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n};\n\nexport type ValidatorTransactionResponse = {\n type: TransactionResponseType.Validator;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n /**\n * The events emitted by the validator transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * WRITESET CHANGE TYPES\n */\n\nexport type WriteSetChange =\n | WriteSetChangeDeleteModule\n | WriteSetChangeDeleteResource\n | WriteSetChangeDeleteTableItem\n | WriteSetChangeWriteModule\n | WriteSetChangeWriteResource\n | WriteSetChangeWriteTableItem;\n\nexport type WriteSetChangeDeleteModule = {\n type: string;\n address: string;\n /**\n * State key hash\n */\n state_key_hash: string;\n module: MoveModuleId;\n};\n\nexport type WriteSetChangeDeleteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n resource: string;\n};\n\nexport type WriteSetChangeDeleteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n data?: DeletedTableData;\n};\n\nexport type WriteSetChangeWriteModule = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveModuleBytecode;\n};\n\nexport type WriteSetChangeWriteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveResource;\n};\n\nexport type WriteSetChangeWriteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n value: string;\n data?: DecodedTableData;\n};\n\nexport type DecodedTableData = {\n /**\n * Key of table in JSON\n */\n key: any;\n /**\n * Type of key\n */\n key_type: string;\n /**\n * Value of table in JSON\n */\n value: any;\n /**\n * Type of value\n */\n value_type: string;\n};\n\n/**\n * Deleted table data\n */\nexport type DeletedTableData = {\n /**\n * Deleted key\n */\n key: any;\n /**\n * Deleted key type\n */\n key_type: string;\n};\n\nexport type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;\n\nexport type EntryFunctionPayloadResponse = {\n type: string;\n function: MoveFunctionId;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\nexport type ScriptPayloadResponse = {\n type: string;\n code: MoveScriptBytecode;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\nexport type MultisigPayloadResponse = {\n type: string;\n multisig_address: string;\n transaction_payload?: EntryFunctionPayloadResponse;\n};\n\nexport type GenesisPayload = {\n type: string;\n write_set: WriteSet;\n};\n\n/**\n * Move script bytecode\n */\nexport type MoveScriptBytecode = {\n bytecode: string;\n abi?: MoveFunction;\n};\n\n/**\n * These are the JSON representations of transaction signatures returned from the node API.\n */\nexport type TransactionSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature\n | TransactionMultiAgentSignature\n | TransactionFeePayerSignature;\n\nexport function isEd25519Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"ed25519_signature\";\n}\n\nexport function isSecp256k1Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"secp256k1_ecdsa_signature\";\n}\n\nexport function isMultiAgentSignature(signature: TransactionSignature): signature is TransactionMultiAgentSignature {\n return signature.type === \"multi_agent_signature\";\n}\n\nexport function isFeePayerSignature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return signature.type === \"fee_payer_signature\";\n}\n\nexport function isMultiEd25519Signature(\n signature: TransactionSignature,\n): signature is TransactionMultiEd25519Signature {\n return signature.type === \"multi_ed25519_signature\";\n}\n\nexport type TransactionEd25519Signature = {\n type: string;\n public_key: string;\n signature: \"ed25519_signature\";\n};\n\nexport type TransactionSecp256k1Signature = {\n type: string;\n public_key: string;\n signature: \"secp256k1_ecdsa_signature\";\n};\n\nexport type TransactionMultiEd25519Signature = {\n type: \"multi_ed25519_signature\";\n /**\n * The public keys for the Ed25519 signature\n */\n public_keys: Array<string>;\n /**\n * Signature associated with the public keys in the same order\n */\n signatures: Array<string>;\n /**\n * The number of signatures required for a successful transaction\n */\n threshold: number;\n bitmap: string;\n};\n\nexport type TransactionMultiAgentSignature = {\n type: \"multi_agent_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n};\n\nexport type TransactionFeePayerSignature = {\n type: \"fee_payer_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n fee_payer_address: string;\n fee_payer_signer: AccountSignature;\n};\n\n/**\n * The union of all single account signatures.\n */\nexport type AccountSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature;\n\nexport type WriteSet = ScriptWriteSet | DirectWriteSet;\n\nexport type ScriptWriteSet = {\n type: string;\n execute_as: string;\n script: ScriptPayloadResponse;\n};\n\nexport type DirectWriteSet = {\n type: string;\n changes: Array<WriteSetChange>;\n events: Array<Event>;\n};\n\nexport type EventGuid = {\n creation_number: string;\n account_address: string;\n};\n\nexport type Event = {\n guid: EventGuid;\n sequence_number: string;\n type: string;\n /**\n * The JSON representation of the event\n */\n data: any;\n};\n\n/**\n * Map of Move types to local TypeScript types\n */\nexport type MoveUint8Type = number;\nexport type MoveUint16Type = number;\nexport type MoveUint32Type = number;\nexport type MoveUint64Type = string;\nexport type MoveUint128Type = string;\nexport type MoveUint256Type = string;\nexport type MoveAddressType = string;\nexport type MoveObjectType = string;\nexport type MoveOptionType = MoveType | null | undefined;\n/**\n * This is the format for a fully qualified struct, resource, or entry function in Move.\n */\nexport type MoveStructId = `${string}::${string}::${string}`;\n// These are the same, unfortunately, it reads really strangely to take a StructId for a Function and there wasn't a\n// good middle ground name.\nexport type MoveFunctionId = MoveStructId;\n\n// TODO: Add support for looking up ABI to add proper typing\nexport type MoveStructType = {};\n\nexport type MoveType =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructType\n | Array<MoveType>;\n\n/**\n * Possible Move values acceptable by move functions (entry, view)\n *\n * Map of a Move value to the corresponding TypeScript value\n *\n * `Bool -> boolean`\n *\n * `u8, u16, u32 -> number`\n *\n * `u64, u128, u256 -> string`\n *\n * `String -> string`\n *\n * `Address -> 0x${string}`\n *\n * `Struct - 0x${string}::${string}::${string}`\n *\n * `Object -> 0x${string}`\n *\n * `Vector -> Array<MoveValue>`\n *\n * `Option -> MoveValue | null | undefined`\n */\nexport type MoveValue =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructId\n | MoveOptionType\n | Array<MoveValue>;\n\n/**\n * Move module id is a string representation of Move module.\n * Module name is case-sensitive.\n */\nexport type MoveModuleId = `${string}::${string}`;\n\n/**\n * Move function visibility\n */\nexport enum MoveFunctionVisibility {\n PRIVATE = \"private\",\n PUBLIC = \"public\",\n FRIEND = \"friend\",\n}\n\n/**\n * Move function ability\n */\nexport enum MoveAbility {\n STORE = \"store\",\n DROP = \"drop\",\n KEY = \"key\",\n COPY = \"copy\",\n}\n\n/**\n * Move abilities tied to the generic type param and associated with the function that uses it\n */\nexport type MoveFunctionGenericTypeParam = {\n constraints: Array<MoveAbility>;\n};\n\n/**\n * Move struct field\n */\nexport type MoveStructField = {\n name: string;\n type: string;\n};\n\n/**\n * A Move module\n */\nexport type MoveModule = {\n address: string;\n name: string;\n /**\n * Friends of the module\n */\n friends: Array<MoveModuleId>;\n /**\n * Public functions of the module\n */\n exposed_functions: Array<MoveFunction>;\n /**\n * Structs of the module\n */\n structs: Array<MoveStruct>;\n};\n\n/**\n * A move struct\n */\nexport type MoveStruct = {\n name: string;\n /**\n * Whether the struct is a native struct of Move\n */\n is_native: boolean;\n /**\n * Abilities associated with the struct\n */\n abilities: Array<MoveAbility>;\n /**\n * Generic types associated with the struct\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Fields associated with the struct\n */\n fields: Array<MoveStructField>;\n};\n\n/**\n * Move function\n */\nexport type MoveFunction = {\n name: string;\n visibility: MoveFunctionVisibility;\n /**\n * Whether the function can be called as an entry function directly in a transaction\n */\n is_entry: boolean;\n /**\n * Whether the function is a view function or not\n */\n is_view: boolean;\n /**\n * Generic type params associated with the Move function\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Parameters associated with the move function\n */\n params: Array<string>;\n /**\n * Return type of the function\n */\n return: Array<string>;\n};\n\nexport enum RoleType {\n VALIDATOR = \"validator\",\n FULL_NODE = \"full_node\",\n}\n\nexport type LedgerInfo = {\n /**\n * Chain ID of the current chain\n */\n chain_id: number;\n epoch: string;\n ledger_version: string;\n oldest_ledger_version: string;\n ledger_timestamp: string;\n node_role: RoleType;\n oldest_block_height: string;\n block_height: string;\n /**\n * Git hash of the build of the API endpoint. Can be used to determine the exact\n * software version used by the API endpoint.\n */\n git_hash?: string;\n};\n\n/**\n * A Block type\n */\nexport type Block = {\n block_height: string;\n block_hash: string;\n block_timestamp: string;\n first_version: string;\n last_version: string;\n /**\n * The transactions in the block in sequential order\n */\n transactions?: Array<TransactionResponse>;\n};\n\n// REQUEST TYPES\n\n/**\n * Table Item request for the GetTableItem API\n */\nexport type TableItemRequest = {\n key_type: MoveValue;\n value_type: MoveValue;\n /**\n * The value of the table item's key\n */\n key: any;\n};\n\n/**\n * A list of Authentication Key schemes that are supported by Aptos.\n *\n * They are combinations of signing schemes and derive schemes.\n */\nexport type AuthenticationKeyScheme = SigningScheme | DeriveScheme;\n\nexport enum SigningScheme {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For MultiEd25519PublicKey\n */\n MultiEd25519 = 1,\n /**\n * For SingleKey ecdsa\n */\n SingleKey = 2,\n\n MultiKey = 3,\n}\n\nexport enum SigningSchemeInput {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For Secp256k1Ecdsa\n */\n Secp256k1Ecdsa = 2,\n}\n\n/**\n * Scheme used for deriving account addresses from other data\n */\nexport enum DeriveScheme {\n /**\n * Derives an address using an AUID, used for objects\n */\n DeriveAuid = 251,\n /**\n * Derives an address from another object address\n */\n DeriveObjectAddressFromObject = 252,\n /**\n * Derives an address from a GUID, used for objects\n */\n DeriveObjectAddressFromGuid = 253,\n /**\n * Derives an address from seed bytes, used for named objects\n */\n DeriveObjectAddressFromSeed = 254,\n /**\n * Derives an address from seed bytes, used for resource accounts\n */\n DeriveResourceAccountAddress = 255,\n}\n\n/**\n * Option properties to pass for waitForTransaction() function\n */\nexport type WaitForTransactionOptions = {\n timeoutSecs?: number;\n checkSuccess?: boolean;\n waitForIndexer?: boolean;\n};\n\n/**\n * Input type to generate an account using Single Signer\n * Ed25519 or Legacy Ed25519\n */\nexport type GenerateAccountWithEd25519 = {\n scheme: SigningSchemeInput.Ed25519;\n legacy: boolean;\n};\n\n/**\n * Input type to generate an account using Single Signer\n * Secp256k1\n */\nexport type GenerateAccountWithSingleSignerSecp256k1Key = {\n scheme: SigningSchemeInput.Secp256k1Ecdsa;\n legacy?: false;\n};\n\nexport type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;\n"],"mappings":"AAQO,IAAKA,OAIVA,EAAA,KAAO,mBAIPA,EAAA,IAAM,oBAINA,EAAA,uBAAyB,6CACzBA,EAAA,kBAAoB,wCAbVA,OAAA,IAyBAC,OACVA,IAAA,KAAO,GAAP,OACAA,IAAA,GAAK,GAAL,KACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,IAAM,GAAN,MACAA,IAAA,IAAM,GAAN,MACAA,IAAA,K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KAA9B,8BAIAA,IAAA,4BAA8B,KAA9B,8BAIAA,IAAA,6BAA+B,KAA/B,+BApBUA,OAAA","names":["MimeType","TypeTagVariants","ScriptTransactionArgumentVariants","TransactionPayloadVariants","TransactionVariants","TransactionAuthenticatorVariant","AccountAuthenticatorVariant","AnyPublicKeyVariant","AnySignatureVariant","EphemeralPublicKeyVariant","EphemeralSignatureVariant","EphemeralCertificateVariant","ZkpVariant","TransactionResponseType","isPendingTransactionResponse","response","isUserTransactionResponse","isGenesisTransactionResponse","isBlockMetadataTransactionResponse","isStateCheckpointTransactionResponse","isValidatorTransactionResponse","isEd25519Signature","signature","isSecp256k1Signature","isMultiAgentSignature","isFeePayerSignature","isMultiEd25519Signature","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bcs/cryptoHasher.ts"],"sourcesContent":["import { Serializable } from \"./serializer\";\n\nexport type AptsoDomainSeparator = `APTOS::${string}`;\nexport abstract class CryptoHashable extends Serializable {\n abstract readonly domainSeparator: AptsoDomainSeparator;\n}\n"],"mappings":"oCAGO,IAAeA,EAAf,cAAsCC,CAAa,CAE1D","names":["CryptoHashable","Serializable"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as I}from"./chunk-N466X3S6.mjs";import{a as S,b as p}from"./chunk-NWWXZ7EW.mjs";import{a as d,c as U,d as H,e as K}from"./chunk-5ADNWXP2.mjs";import{b as E}from"./chunk-COW5IGYC.mjs";import{a as u}from"./chunk-STYDBDYL.mjs";import{a as b}from"./chunk-7STYQ5ZE.mjs";import{a as f}from"./chunk-VT6XJSRO.mjs";import{a as z,b as A}from"./chunk-TVRJ3M7B.mjs";import{b as c}from"./chunk-AOCNYMMX.mjs";var B=1e7,D=120,v=30,P=330,R=120,$=350,J=300,q=93,o=class o extends E{constructor(e,t){super();let i=c.fromHexInput(t).toUint8Array();if(i.length!==o.ID_COMMITMENT_LENGTH)throw new Error(`Address seed length in bytes should be ${o.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new A;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),b.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return c.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new o(t,i)}static load(e){let t=e.deserializeStr(),i=e.deserializeBytes();return new o(t,i)}static isPublicKey(e){return e instanceof o}static create(e){return w(e),new o(e.iss,w(e))}};o.ID_COMMITMENT_LENGTH=32;var m=o;function w(s){let{uidKey:l,uidVal:e,aud:t,pepper:i}=s,r=[U(c.fromHexInput(i).toUint8Array()),d(t,D),d(e,P),d(l,v)];return H(K(r),m.ID_COMMITMENT_LENGTH)}var T=class s extends u{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:i,expiryDateSecs:r,ephemeralPublicKey:a,ephemeralSignature:n}=e;this.jwtHeader=t,this.ephemeralCertificate=i,this.expiryDateSecs=r,this.ephemeralPublicKey=a,this.ephemeralSignature=n}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=h.deserialize(e),i=e.deserializeStr(),r=e.deserializeU64(),a=S.deserialize(e),n=p.deserialize(e);return new s({jwtHeader:i,expiryDateSecs:r,ephemeralCertificate:t,ephemeralPublicKey:a,ephemeralSignature:n})}static load(e){let t=h.deserialize(e),i=e.deserializeStr(),r=e.deserializeU64(),a=S.deserialize(e),n=p.deserialize(e);return new s({jwtHeader:i,expiryDateSecs:r,ephemeralCertificate:t,ephemeralPublicKey:a,ephemeralSignature:n})}static isSignature(e){return e instanceof s}},h=class s extends u{constructor(e,t){super();this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new s(x.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},g=class s extends I{constructor(e){super();let{a:t,b:i,c:r}=e;this.a=c.fromHexInput(t).toUint8Array(),this.b=c.fromHexInput(i).toUint8Array(),this.c=c.fromHexInput(r).toUint8Array()}serialize(e){e.serializeFixedBytes(this.a),e.serializeFixedBytes(this.b),e.serializeFixedBytes(this.c)}static deserialize(e){let t=e.deserializeFixedBytes(32),i=e.deserializeFixedBytes(64),r=e.deserializeFixedBytes(32);return new s({a:t,b:i,c:r})}},y=class s extends z{constructor(e,t){super();this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new s(g.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},x=class s extends u{constructor(e){super();let{proof:t,expHorizonSecs:i=BigInt(B),trainingWheelsSignature:r,extraField:a,overrideAudVal:n}=e;this.proof=t,this.expHorizonSecs=i,this.trainingWheelsSignature=r,this.extraField=a,this.overrideAudVal=n}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return s.deserialize(new f(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=y.deserialize(e),i=e.deserializeU64(),r=e.deserializeOptionStr(),a=e.deserializeOptionStr(),n=e.deserializeOption(p);return new s({proof:t,expHorizonSecs:i,trainingWheelsSignature:n,extraField:r,overrideAudVal:a})}static load(e){let t=y.deserialize(e),i=e.deserializeU64(),r=e.deserializeOptionStr(),a=e.deserializeOptionStr(),n=e.deserializeOption(p);return new s({proof:t,expHorizonSecs:i,trainingWheelsSignature:n,extraField:r,overrideAudVal:a})}};export{B as a,D as b,v as c,P as d,R as e,$ as f,J as g,q as h,m as i,T as j,h as k,g as l,y as m,x as n};
|
|
2
|
-
//# sourceMappingURL=chunk-LECNIPW7.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountPublicKey, PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { Deserializer, Serializable, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport { HexInput, EphemeralCertificateVariant, AnyPublicKeyVariant, SigningScheme, ZkpVariant } from \"../../types\";\nimport { EphemeralPublicKey, EphemeralSignature } from \"./ephemeral\";\nimport { bigIntToBytesLE, bytesToBigIntLE, hashASCIIStrToField, poseidonHash } from \"./poseidon\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Proof } from \"./proof\";\n\nexport const EPK_HORIZON_SECS = 10000000;\nexport const MAX_AUD_VAL_BYTES = 120;\nexport const MAX_UID_KEY_BYTES = 30;\nexport const MAX_UID_VAL_BYTES = 330;\nexport const MAX_ISS_VAL_BYTES = 120;\nexport const MAX_EXTRA_FIELD_BYTES = 350;\nexport const MAX_JWT_HEADER_B64_BYTES = 300;\nexport const MAX_COMMITED_EPK_BYTES = 93;\n\n/**\n * Represents the KeylessPublicKey public key\n *\n * KeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class KeylessPublicKey extends AccountPublicKey {\n static readonly ID_COMMITMENT_LENGTH: number = 32;\n\n readonly iss: string;\n\n readonly idCommitment: Uint8Array;\n\n constructor(iss: string, idCommitment: HexInput) {\n super();\n const idcBytes = Hex.fromHexInput(idCommitment).toUint8Array();\n if (idcBytes.length !== KeylessPublicKey.ID_COMMITMENT_LENGTH) {\n throw new Error(`Address seed length in bytes should be ${KeylessPublicKey.ID_COMMITMENT_LENGTH}`);\n }\n this.iss = iss;\n this.idCommitment = idcBytes;\n }\n\n /**\n * Get the authentication key for the keyless public key\n *\n * @returns AuthenticationKey\n */\n authKey(): AuthenticationKey {\n const serializer = new Serializer();\n serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Keyless);\n serializer.serializeFixedBytes(this.bcsToBytes());\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: SigningScheme.SingleKey,\n input: serializer.toUint8Array(),\n });\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n /**\n * Get the public key as a hex string with the 0x prefix.\n *\n * @returns string representation of the public key\n */\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\n }\n\n /**\n * Verifies a signed data with a public key\n *\n * @param args.message message\n * @param args.signature The signature\n * @returns true if the signature is valid\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {\n throw new Error(\"Not yet implemented\");\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.iss);\n serializer.serializeBytes(this.idCommitment);\n }\n\n static deserialize(deserializer: Deserializer): KeylessPublicKey {\n const iss = deserializer.deserializeStr();\n const addressSeed = deserializer.deserializeBytes();\n return new KeylessPublicKey(iss, addressSeed);\n }\n\n static load(deserializer: Deserializer): KeylessPublicKey {\n const iss = deserializer.deserializeStr();\n const addressSeed = deserializer.deserializeBytes();\n return new KeylessPublicKey(iss, addressSeed);\n }\n\n static isPublicKey(publicKey: PublicKey): publicKey is KeylessPublicKey {\n return publicKey instanceof KeylessPublicKey;\n }\n\n /**\n * Creates a KeylessPublicKey from the JWT components plus pepper\n *\n * @param args.iss the iss of the identity\n * @param args.uidKey the key to use to get the uidVal in the JWT token\n * @param args.uidVal the value of the uidKey in the JWT token\n * @param args.aud the client ID of the application\n * @param args.pepper The pepper used to maintain privacy of the account\n * @returns KeylessPublicKey\n */\n static create(args: {\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n }): KeylessPublicKey {\n computeIdCommitment(args);\n return new KeylessPublicKey(args.iss, computeIdCommitment(args));\n }\n}\n\nfunction computeIdCommitment(args: { uidKey: string; uidVal: string; aud: string; pepper: HexInput }): Uint8Array {\n const { uidKey, uidVal, aud, pepper } = args;\n\n const fields = [\n bytesToBigIntLE(Hex.fromHexInput(pepper).toUint8Array()),\n hashASCIIStrToField(aud, MAX_AUD_VAL_BYTES),\n hashASCIIStrToField(uidVal, MAX_UID_VAL_BYTES),\n hashASCIIStrToField(uidKey, MAX_UID_KEY_BYTES),\n ];\n\n return bigIntToBytesLE(poseidonHash(fields), KeylessPublicKey.ID_COMMITMENT_LENGTH);\n}\n\n/**\n * A signature of a message signed via Keyless Accounnt that uses proofs or the jwt token to authenticate.\n */\nexport class KeylessSignature extends Signature {\n /**\n * The inner signature ZeroKnowledgeSigniature or OpenIdSignature\n */\n readonly ephemeralCertificate: EphemeralCertificate;\n\n /**\n * The jwt header in the token used to create the proof/signature. In json string representation.\n */\n readonly jwtHeader: string;\n\n /**\n * The expiry timestamp in seconds of the EphemeralKeyPair used to sign\n */\n readonly expiryDateSecs: bigint | number;\n\n /**\n * The ephemeral public key used to verify the signature\n */\n readonly ephemeralPublicKey: EphemeralPublicKey;\n\n /**\n * The signature resulting from signing with the private key of the EphemeralKeyPair\n */\n readonly ephemeralSignature: EphemeralSignature;\n\n constructor(args: {\n jwtHeader: string;\n ephemeralCertificate: EphemeralCertificate;\n expiryDateSecs: bigint | number;\n ephemeralPublicKey: EphemeralPublicKey;\n ephemeralSignature: EphemeralSignature;\n }) {\n super();\n const { jwtHeader, ephemeralCertificate, expiryDateSecs, ephemeralPublicKey, ephemeralSignature } = args;\n this.jwtHeader = jwtHeader;\n this.ephemeralCertificate = ephemeralCertificate;\n this.expiryDateSecs = expiryDateSecs;\n this.ephemeralPublicKey = ephemeralPublicKey;\n this.ephemeralSignature = ephemeralSignature;\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the signature\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n serialize(serializer: Serializer): void {\n this.ephemeralCertificate.serialize(serializer);\n serializer.serializeStr(this.jwtHeader);\n serializer.serializeU64(this.expiryDateSecs);\n this.ephemeralPublicKey.serialize(serializer);\n this.ephemeralSignature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): KeylessSignature {\n const ephemeralCertificate = EphemeralCertificate.deserialize(deserializer);\n const jwtHeader = deserializer.deserializeStr();\n const expiryDateSecs = deserializer.deserializeU64();\n const ephemeralPublicKey = EphemeralPublicKey.deserialize(deserializer);\n const ephemeralSignature = EphemeralSignature.deserialize(deserializer);\n return new KeylessSignature({\n jwtHeader,\n expiryDateSecs,\n ephemeralCertificate,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n static load(deserializer: Deserializer): KeylessSignature {\n const ephemeralCertificate = EphemeralCertificate.deserialize(deserializer);\n const jwtHeader = deserializer.deserializeStr();\n const expiryDateSecs = deserializer.deserializeU64();\n const ephemeralPublicKey = EphemeralPublicKey.deserialize(deserializer);\n const ephemeralSignature = EphemeralSignature.deserialize(deserializer);\n return new KeylessSignature({\n jwtHeader,\n expiryDateSecs,\n ephemeralCertificate,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n static isSignature(signature: Signature): signature is KeylessSignature {\n return signature instanceof KeylessSignature;\n }\n}\n\n/**\n * A container for a signature that is a ZeroKnowledgeSig. Can be expanded to support OpenIdSignature.\n */\nexport class EphemeralCertificate extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: EphemeralCertificateVariant;\n\n constructor(signature: Signature, variant: EphemeralCertificateVariant) {\n super();\n this.signature = signature;\n this.variant = variant;\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.signature.toUint8Array();\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): EphemeralCertificate {\n const variant = deserializer.deserializeUleb128AsU32();\n switch (variant) {\n case EphemeralCertificateVariant.ZkProof:\n return new EphemeralCertificate(ZeroKnowledgeSig.deserialize(deserializer), variant);\n default:\n throw new Error(`Unknown variant index for EphemeralCertificate: ${variant}`);\n }\n }\n}\n\n/**\n * A representation of a Groth16 proof. The points are the compressed serialization of affine reprentation of the proof.\n */\nexport class Groth16Zkp extends Proof {\n /**\n * The bytes of G1 proof point a\n */\n a: Uint8Array;\n\n /**\n * The bytes of G2 proof point b\n */\n b: Uint8Array;\n\n /**\n * The bytes of G1 proof point c\n */\n c: Uint8Array;\n\n constructor(args: { a: HexInput; b: HexInput; c: HexInput }) {\n super();\n const { a, b, c } = args;\n this.a = Hex.fromHexInput(a).toUint8Array();\n this.b = Hex.fromHexInput(b).toUint8Array();\n this.c = Hex.fromHexInput(c).toUint8Array();\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.a);\n serializer.serializeFixedBytes(this.b);\n serializer.serializeFixedBytes(this.c);\n }\n\n static deserialize(deserializer: Deserializer): Groth16Zkp {\n const a = deserializer.deserializeFixedBytes(32);\n const b = deserializer.deserializeFixedBytes(64);\n const c = deserializer.deserializeFixedBytes(32);\n return new Groth16Zkp({ a, b, c });\n }\n}\n\n/**\n * A container for a different zero knowledge proof types\n */\nexport class ZkProof extends Serializable {\n public readonly proof: Proof;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: ZkpVariant;\n\n constructor(proof: Proof, variant: ZkpVariant) {\n super();\n this.proof = proof;\n this.variant = variant;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): ZkProof {\n const variant = deserializer.deserializeUleb128AsU32();\n switch (variant) {\n case ZkpVariant.Groth16:\n return new ZkProof(Groth16Zkp.deserialize(deserializer), variant);\n default:\n throw new Error(`Unknown variant index for ZkProof: ${variant}`);\n }\n }\n}\n\n/**\n * The signature representation of a proof\n */\nexport class ZeroKnowledgeSig extends Signature {\n /**\n * The proof\n */\n readonly proof: ZkProof;\n\n /**\n * The max lifespan of the proof\n */\n readonly expHorizonSecs: bigint;\n\n /**\n * A key value pair on the JWT token that can be made public\n */\n readonly extraField?: string;\n\n /**\n * Set in the case of signing by recovery services\n */\n readonly overrideAudVal?: string;\n\n /**\n * The training wheels signature\n */\n readonly trainingWheelsSignature?: EphemeralSignature;\n\n constructor(args: {\n proof: ZkProof;\n expHorizonSecs?: bigint;\n extraField?: string;\n overrideAudVal?: string;\n trainingWheelsSignature?: EphemeralSignature;\n }) {\n super();\n const {\n proof,\n expHorizonSecs = BigInt(EPK_HORIZON_SECS),\n trainingWheelsSignature,\n extraField,\n overrideAudVal,\n } = args;\n this.proof = proof;\n this.expHorizonSecs = expHorizonSecs;\n this.trainingWheelsSignature = trainingWheelsSignature;\n this.extraField = extraField;\n this.overrideAudVal = overrideAudVal;\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the signature\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n /**\n * Return a ZeroKnowledgeSig object from its bcs serialization in bytes.\n *\n * @returns ZeroKnowledgeSig\n */\n static fromBytes(bytes: Uint8Array): ZeroKnowledgeSig {\n return ZeroKnowledgeSig.deserialize(new Deserializer(bytes));\n }\n\n serialize(serializer: Serializer): void {\n this.proof.serialize(serializer);\n serializer.serializeU64(this.expHorizonSecs);\n serializer.serializeOptionStr(this.extraField);\n serializer.serializeOptionStr(this.overrideAudVal);\n serializer.serializeOption(this.trainingWheelsSignature);\n }\n\n static deserialize(deserializer: Deserializer): ZeroKnowledgeSig {\n const proof = ZkProof.deserialize(deserializer);\n const expHorizonSecs = deserializer.deserializeU64();\n const extraField = deserializer.deserializeOptionStr();\n const overrideAudVal = deserializer.deserializeOptionStr();\n const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);\n return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });\n }\n\n static load(deserializer: Deserializer): ZeroKnowledgeSig {\n const proof = ZkProof.deserialize(deserializer);\n const expHorizonSecs = deserializer.deserializeU64();\n const extraField = deserializer.deserializeOptionStr();\n const overrideAudVal = deserializer.deserializeOptionStr();\n const trainingWheelsSignature = deserializer.deserializeOption(EphemeralSignature);\n return new ZeroKnowledgeSig({ proof, expHorizonSecs, trainingWheelsSignature, extraField, overrideAudVal });\n }\n}\n"],"mappings":"oZAaO,IAAMA,EAAmB,IACnBC,EAAoB,IACpBC,EAAoB,GACpBC,EAAoB,IACpBC,EAAoB,IACpBC,EAAwB,IACxBC,EAA2B,IAC3BC,EAAyB,GAOzBC,EAAN,MAAMA,UAAyBC,CAAiB,CAOrD,YAAYC,EAAaC,EAAwB,CAC/C,MAAM,EACN,IAAMC,EAAWC,EAAI,aAAaF,CAAY,EAAE,aAAa,EAC7D,GAAIC,EAAS,SAAWJ,EAAiB,qBACvC,MAAM,IAAI,MAAM,0CAA0CA,EAAiB,oBAAoB,EAAE,EAEnG,KAAK,IAAME,EACX,KAAK,aAAeE,CACtB,CAOA,SAA6B,CAC3B,IAAME,EAAa,IAAIC,EACvB,OAAAD,EAAW,uBAAiD,EAC5DA,EAAW,oBAAoB,KAAK,WAAW,CAAC,EACzCE,EAAkB,mBAAmB,CAC1C,SACA,MAAOF,EAAW,aAAa,CACjC,CAAC,CACH,CAOA,cAA2B,CACzB,OAAO,KAAK,WAAW,CACzB,CAOA,UAAmB,CACjB,OAAOD,EAAI,aAAa,KAAK,aAAa,CAAC,EAAE,SAAS,CACxD,CAUA,gBAAgBI,EAAmE,CACjF,M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AO,IAAIe,EAAiB,CAAE,MAAAD,EAAO,eAAAE,EAAgB,wBAAAC,EAAyB,WAAAC,EAAY,eAAAC,CAAe,CAAC,CAC5G,CACF","names":["EPK_HORIZON_SECS","MAX_AUD_VAL_BYTES","MAX_UID_KEY_BYTES","MAX_UID_VAL_BYTES","MAX_ISS_VAL_BYTES","MAX_EXTRA_FIELD_BYTES","MAX_JWT_HEADER_B64_BYTES","MAX_COMMITED_EPK_BYTES","_KeylessPublicKey","AccountPublicKey","iss","idCommitment","idcBytes","Hex","serializer","Serializer","AuthenticationKey","args","deserializer","addressSeed","publicKey","computeIdCommitment","KeylessPublicKey","uidKey","uidVal","aud","pepper","fields","bytesToBigIntLE","hashASCIIStrToField","bigIntToBytesLE","poseidonHash","KeylessSignature","_KeylessSignature","Signature","jwtHeader","ephemeralCertificate","expiryDateSecs","ephemeralPublicKey","ephemeralSignature","EphemeralCertificate","EphemeralPublicKey","EphemeralSignature","signature","_EphemeralCertificate","variant","ZeroKnowledgeSig","Groth16Zkp","_Groth16Zkp","Proof","a","b","c","ZkProof","_ZkProof","Serializable","proof","_ZeroKnowledgeSig","expHorizonSecs","trainingWheelsSignature","extraField","overrideAudVal","bytes","Deserializer"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-RKHPXZM6.mjs";import{a as R}from"./chunk-JKZHPY24.mjs";var c={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function l(s,i){let{url:u,method:o,body:d,contentType:p,params:t,overrides:e,originMethod:a}=s,r={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${R}`,"content-type":p??"application/json","x-aptos-typescript-sdk-origin-method":a};return e?.AUTH_TOKEN&&(r.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(r.Authorization=`Bearer ${e?.API_KEY}`),i.provider({url:u,method:o,body:d,params:t,headers:r,overrides:e})}async function N(s,i,u){let{url:o,path:d}=s,p=d?`${o}/${d}`:o,t=await l({...s,url:p},i.client),e={status:t.status,statusText:t.statusText,data:t.data,headers:t.headers,config:t.config,request:t.request,url:p};if(e.status===401)throw new n(s,e,`Error: ${e.data}`);if(u==="Indexer"){let r=e.data;if(r.errors)throw new n(s,e,`Indexer error: ${r.errors[0].message}`??`Indexer unhandled Error ${t.status} : ${t.statusText}`);e.data=r.data}if(e.status>=200&&e.status<300)return e;if(e.status>=500)throw new n(s,e,`${t.data}`);if(i.isPepperServiceRequest(o)||i.isProverServiceRequest(o))throw new n(s,e,`${t.data}`);let a;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?a=JSON.stringify(e.data):e.status in c?a=c[e.status]:a=`Unhandled Error ${e.status} : ${e.statusText}`,new n(s,e,`${u} error: ${a}`)}export{l as a,N as b};
|
|
2
|
-
//# sourceMappingURL=chunk-N7CE244N.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b,c as K}from"./chunk-JCDZ2WXX.mjs";import{a as d}from"./chunk-LECNIPW7.mjs";import{a as l,b as p}from"./chunk-NWWXZ7EW.mjs";import{b as u,c as h,e as m}from"./chunk-5ADNWXP2.mjs";import{b as a}from"./chunk-PYUU4OEL.mjs";import{a as o}from"./chunk-VT6XJSRO.mjs";import{a as y}from"./chunk-TVRJ3M7B.mjs";import{b as c}from"./chunk-AOCNYMMX.mjs";import{randomBytes as E}from"@noble/hashes/utils";var i=class i extends y{constructor(e){super();let{privateKey:r,expiryDateSecs:t,blinder:n}=e;this.privateKey=r,this.publicKey=new l(r.publicKey()),this.expiryDateSecs=t||BigInt(K(b()+d)),this.blinder=n!==void 0?c.fromHexInput(n).toUint8Array():S(),this.nonce=this.generateNonce()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),t;switch(r){case 0:t=a.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let n=e.deserializeU64(),x=e.deserializeFixedBytes(31);return new i({privateKey:t,expiryDateSecs:n,blinder:x})}static fromBytes(e){return i.deserialize(new o(e))}static generate(e){let r;switch(e?.scheme){case 0:default:r=a.generate()}return new i({privateKey:r,expiryDateSecs:e?.expiryDateSecs})}generateNonce(){let e=u(this.publicKey.bcsToBytes(),93);return e.push(BigInt(this.expiryDateSecs)),e.push(h(this.blinder)),m(e).toString()}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new p(this.privateKey.sign(e))}};i.BLINDER_LENGTH=31;var s=i;function S(){return E(s.BLINDER_LENGTH)}export{s as a};
|
|
2
|
-
//# sourceMappingURL=chunk-R2P2XANA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/EphemeralKeyPair.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { randomBytes } from \"@noble/hashes/utils\";\n\nimport {\n EPK_HORIZON_SECS,\n Ed25519PrivateKey,\n EphemeralPublicKey,\n EphemeralSignature,\n PrivateKey,\n} from \"../core/crypto\";\nimport { Hex } from \"../core/hex\";\nimport { bytesToBigIntLE, padAndPackBytesWithLen, poseidonHash } from \"../core/crypto/poseidon\";\nimport { AnyNumber, EphemeralPublicKeyVariant, HexInput } from \"../types\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport { currentTimeInSeconds, floorToWholeHour } from \"../utils/helpers\";\n\nexport class EphemeralKeyPair extends Serializable {\n static readonly BLINDER_LENGTH: number = 31;\n\n /**\n * A byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP.\n * Used in calculating the nonce passed to the IdP and as a secret witness in proof generation.\n */\n readonly blinder: Uint8Array;\n\n /**\n * A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new\n * EphemeralKeyPair must be generated and a new JWT needs to be created.\n */\n readonly expiryDateSecs: bigint | number;\n\n /**\n * The value passed to the IdP when the user authenticates. It comprises of a hash of the\n * ephermeral public key, expiry date, and blinder.\n */\n readonly nonce: string;\n\n /**\n * A private key used to sign transactions. This private key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private privateKey: PrivateKey;\n\n /**\n * A public key used to verify transactions. This public key is not tied to any account on the chain as it\n * is ephemeral (not permanent) in nature.\n */\n private publicKey: EphemeralPublicKey;\n\n constructor(args: { privateKey: PrivateKey; expiryDateSecs?: AnyNumber; blinder?: HexInput }) {\n super();\n const { privateKey, expiryDateSecs, blinder } = args;\n this.privateKey = privateKey;\n this.publicKey = new EphemeralPublicKey(privateKey.publicKey());\n // We set the expiry date to be the nearest floored hour\n this.expiryDateSecs = expiryDateSecs || BigInt(floorToWholeHour(currentTimeInSeconds() + EPK_HORIZON_SECS));\n // Generate the blinder if not provided\n this.blinder = blinder !== undefined ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();\n // Calculate the nonce\n this.nonce = this.generateNonce();\n }\n\n /**\n * Returns the public key of the key pair.\n * @return EphemeralPublicKey\n */\n getPublicKey(): EphemeralPublicKey {\n return this.publicKey;\n }\n\n /**\n * Returns the public key of the key pair.\n * @return boolean\n */\n isExpired(): boolean {\n const currentTimeSecs: number = Math.floor(Date.now() / 1000);\n return currentTimeSecs > this.expiryDateSecs;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.publicKey.variant);\n serializer.serializeBytes(this.privateKey.toUint8Array());\n serializer.serializeU64(this.expiryDateSecs);\n serializer.serializeFixedBytes(this.blinder);\n }\n\n static deserialize(deserializer: Deserializer): EphemeralKeyPair {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let privateKey: PrivateKey;\n switch (variantIndex) {\n case EphemeralPublicKeyVariant.Ed25519:\n privateKey = Ed25519PrivateKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${variantIndex}`);\n }\n const expiryDateSecs = deserializer.deserializeU64();\n const blinder = deserializer.deserializeFixedBytes(31);\n return new EphemeralKeyPair({ privateKey, expiryDateSecs, blinder });\n }\n\n static fromBytes(bytes: Uint8Array): EphemeralKeyPair {\n return EphemeralKeyPair.deserialize(new Deserializer(bytes));\n }\n\n /**\n * Returns the public key of the key pair.\n * @param scheme the type of keypair to use for the EphemeralKeyPair. Only Ed25519 supported for now.\n * @param expiryDateSecs the date of expiry.\n * @return boolean\n */\n static generate(args?: { scheme: EphemeralPublicKeyVariant; expiryDateSecs?: bigint | number }): EphemeralKeyPair {\n let privateKey: PrivateKey;\n\n switch (args?.scheme) {\n case EphemeralPublicKeyVariant.Ed25519:\n default:\n privateKey = Ed25519PrivateKey.generate();\n }\n\n return new EphemeralKeyPair({ privateKey, expiryDateSecs: args?.expiryDateSecs });\n }\n\n /**\n * From the ephemeral public key, expiry timestamp, and blinder, calculate the nonce to be used at authentication via OIDC.\n * @returns string\n */\n private generateNonce(): string {\n const fields = padAndPackBytesWithLen(this.publicKey.bcsToBytes(), 93);\n fields.push(BigInt(this.expiryDateSecs));\n fields.push(bytesToBigIntLE(this.blinder));\n const nonceHash = poseidonHash(fields);\n return nonceHash.toString();\n }\n\n /**\n * Sign the given message with the private key.\n * @param data in HexInput format\n * @returns EphemeralSignature\n */\n sign(data: HexInput): EphemeralSignature {\n if (this.isExpired()) {\n throw new Error(\"EphemeralKeyPair has expired\");\n }\n return new EphemeralSignature(this.privateKey.sign(data));\n }\n}\n\n/**\n * Generates a random byte array of length EphemeralKeyPair.BLINDER_LENGTH\n * @returns Uint8Array\n */\nfunction generateBlinder(): Uint8Array {\n return randomBytes(EphemeralKeyPair.BLINDER_LENGTH);\n}\n"],"mappings":"+VAGA,OAAS,eAAAA,MAAmB,sBAerB,IAAMC,EAAN,MAAMA,UAAyBC,CAAa,CAiCjD,YAAYC,EAAkF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BD,GAAM,cAAe,CAAC,CAClF,CAMQ,eAAwB,CAC9B,IAAMgB,EAASC,EAAuB,KAAK,UAAU,WAAW,EAAG,EAAE,EACrE,OAAAD,EAAO,KAAK,OAAO,KAAK,cAAc,CAAC,EACvCA,EAAO,KAAKE,EAAgB,KAAK,OAAO,CAAC,EACvBC,EAAaH,CAAM,EACpB,SAAS,CAC5B,CAOA,KAAKI,EAAoC,CACvC,GAAI,KAAK,UAAU,EACjB,MAAM,IAAI,MAAM,8BAA8B,EAEhD,OAAO,IAAIC,EAAmB,KAAK,WAAW,KAAKD,CAAI,CAAC,CAC1D,CACF,EAlIatB,EACK,eAAyB,GADpC,IAAMwB,EAANxB,EAwIP,SAASW,GAA8B,CACrC,OAAOc,EAAYD,EAAiB,cAAc,CACpD","names":["randomBytes","_EphemeralKeyPair","Serializable","args","privateKey","expiryDateSecs","blinder","EphemeralPublicKey","floorToWholeHour","currentTimeInSeconds","EPK_HORIZON_SECS","Hex","generateBlinder","serializer","deserializer","variantIndex","Ed25519PrivateKey","bytes","Deserializer","fields","padAndPackBytesWithLen","bytesToBigIntLE","poseidonHash","data","EphemeralSignature","EphemeralKeyPair","randomBytes"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bcs/deserializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable no-bitwise */\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from \"../types\";\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n */\nexport interface Deserializable<T> {\n deserialize(deserializer: Deserializer): T;\n}\n\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n private read(length: number): ArrayBuffer {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n const bytes = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Deserializes a string. UTF8 string is supported. Reads the string's bytes length \"l\" first,\n * and then reads \"l\" bytes of content. Decodes the byte array into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n const textDecoder = new TextDecoder();\n return textDecoder.decode(value);\n }\n\n /**\n * Deserializes a an optional string.\n *\n * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOptionStr(): string | undefined {\n const exists = this.deserializeUleb128AsU32();\n if (exists === 1) {\n return this.deserializeStr();\n }\n return undefined;\n }\n\n /**\n * Deserializes a an optional string.\n *\n * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOption<T>(cls: Deserializable<T>): T | undefined {\n const exists = this.deserializeUleb128AsU32();\n if (exists === 1) {\n return this.deserialize(cls);\n }\n return undefined;\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * BCS layout for \"bytes\": bytes_length | bytes\n * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes an array of bytes. The number of bytes to read is already known.\n *\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value.\n *\n * BCS layout for \"boolean\": One byte. \"0x01\" for true and \"0x00\" for false.\n */\n deserializeBool(): boolean {\n const bool = new Uint8Array(this.read(1))[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number.\n *\n * BCS layout for \"uint16\": Two bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n */\n deserializeU16(): Uint16 {\n return new DataView(this.read(2)).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number.\n *\n * BCS layout for \"uint32\": Four bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n */\n deserializeU32(): Uint32 {\n return new DataView(this.read(4)).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * BCS layout for \"uint64\": Eight bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number.\n *\n * BCS layout for \"uint128\": Sixteen bytes. Binary format in little-endian representation.\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number.\n *\n * BCS layout for \"uint256\": Thirty-two bytes. Binary format in little-endian representation.\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n\n while (value < MAX_U32_NUMBER) {\n const byte = this.deserializeU8();\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n if ((byte & 0x80) === 0) {\n break;\n }\n shift += 7;\n }\n\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer\n * instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n * @returns an array of deserialized values of type T\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n"],"mappings":"yCAiBO,IAAMA,EAAN,KAAmB,CAKxB,YAAYC,EAAkB,CAE5B,KAAK,OAAS,IAAI,YAAYA,EAAK,MAAM,EACzC,IAAI,WAAW,KAAK,MAAM,EAAE,IAAIA,EAAM,CAAC,EACvC,KAAK,OAAS,CAChB,CAEQ,KAAKC,EAA6B,CACxC,GAAI,KAAK,OAASA,EAAS,KAAK,OAAO,WACrC,MAAM,IAAI,MAAM,8BAA8B,EAGhD,IAAMC,EAAQ,KAAK,OAAO,MAAM,KAAK,OAAQ,KAAK,OAASD,CAAM,EACjE,YAAK,QAAUA,EACRC,CACT,CAeA,gBAAyB,CACvB,IAAMC,EAAQ,KAAK,iBAAiB,EAEpC,OADoB,IAAI,YAAY,EACjB,OAAOA,CAAK,CACjC,CAcA,sBAA2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AChC,IAAIJ,EAAgB,OAAO,CAAC,EACxBM,EAAQ,EAEZ,KAAON,EAAQO,GAAgB,CAC7B,IAAMC,EAAO,KAAK,cAAc,EAGhC,GAFAR,GAAS,OAAOQ,EAAO,GAAI,GAAK,OAAOF,CAAK,EAEvC,EAAAE,EAAO,KACV,MAEFF,GAAS,CACX,CAEA,GAAIN,EAAQO,EACV,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAO,OAAOP,CAAK,CACrB,CAeA,YAAeC,EAA2B,CAGxC,OAAOA,EAAI,YAAY,IAAI,CAC7B,CAyBA,kBAAqBA,EAAkC,CACrD,IAAMH,EAAS,KAAK,wBAAwB,EACtCW,EAAS,IAAI,MACnB,QAASC,EAAI,EAAGA,EAAIZ,EAAQY,GAAK,EAC/BD,EAAO,KAAK,KAAK,YAAYR,CAAG,CAAC,EAEnC,OAAOQ,CACT,CACF","names":["Deserializer","data","length","bytes","value","cls","len","bool","low","high","shift","MAX_U32_NUMBER","byte","vector","i"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{e as h,f as m}from"./chunk-QZRWRX6P.mjs";import{d as s}from"./chunk-ZUQJLFR2.mjs";import{a as g,l as u,m as y,n as d}from"./chunk-LECNIPW7.mjs";import{b as l}from"./chunk-NWWXZ7EW.mjs";import{b as i}from"./chunk-AOCNYMMX.mjs";async function K(t){let{aptosConfig:r,jwt:o,ephemeralKeyPair:e,uidKey:n,derivationPath:p}=t,a={jwt_b64:o,epk:e.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:Number(e.expiryDateSecs),epk_blinder:i.fromHexInput(e.blinder).toStringWithoutPrefix(),uid_key:n,derivation_path:p},{data:c}=await h({aptosConfig:r,path:"fetch",body:a,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return i.fromHexInput(c.pepper).toUint8Array()}async function b(t){let{aptosConfig:r,jwt:o,ephemeralKeyPair:e,pepper:n,uidKey:p,extraFieldKey:a}=t,c={jwt_b64:o,epk:e.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:i.fromHexInput(e.blinder).toStringWithoutPrefix(),exp_date_secs:Number(e.expiryDateSecs),exp_horizon_secs:g,pepper:i.fromHexInput(n).toStringWithoutPrefix(),extra_field:a,uid_key:p||"sub"},{data:P}=await m({aptosConfig:r,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),f=P.proof,x=new u({a:f.a,b:f.b,c:f.c});return new d({proof:new y(x,0),trainingWheelsSignature:l.fromHex(P.training_wheels_signature)})}async function v(t){let{proofFetchCallback:r}=t,{pepper:o}=t;if(o===void 0)o=await K(t);else if(i.fromHexInput(o).toUint8Array().length!==s.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${s.PEPPER_LENGTH} bytes`);let e=b({...t,pepper:o}),n=r?e:await e;return s.fromJWTAndProof({...t,proof:n,pepper:o,proofFetchCallback:r})}export{K as a,b,v as c};
|
|
2
|
-
//# sourceMappingURL=chunk-W4IWORPF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/keyless}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosPepperService, postAptosProvingService } from \"../client\";\nimport { EPK_HORIZON_SECS, EphemeralSignature, Groth16Zkp, Hex, ZeroKnowledgeSig, ZkProof } from \"../core\";\nimport { HexInput, ZkpVariant } from \"../types\";\nimport { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { PepperFetchResponse, ProverResponse } from \"../types/keyless\";\n\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey, derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n derivation_path: derivationPath,\n };\n const { data } = await postAptosPepperService<any, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n return Hex.fromHexInput(data.pepper).toUint8Array();\n}\n\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n extraFieldKey?: string;\n}): Promise<ZeroKnowledgeSig> {\n const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey, extraFieldKey } = args;\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),\n exp_horizon_secs: EPK_HORIZON_SECS,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n extra_field: extraFieldKey,\n uid_key: uidKey || \"sub\",\n };\n\n const { data } = await postAptosProvingService<any, ProverResponse>({\n aptosConfig,\n path: \"prove\",\n body: json,\n originMethod: \"getProof\",\n overrides: { WITH_CREDENTIALS: false },\n });\n\n const proofPoints = data.proof;\n const groth16Zkp = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new ZeroKnowledgeSig({\n proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n });\n return signedProof;\n}\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n extraFieldKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount> {\n const { proofFetchCallback } = args;\n let { pepper } = args;\n if (pepper === undefined) {\n pepper = await getPepper(args);\n } else if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);\n }\n\n const proofPromise = getProof({ ...args, pepper });\n const proof = proofFetchCallback ? proofPromise : await proofPromise;\n\n const keylessAccount = KeylessAccount.fromJWTAndProof({ ...args, proof, pepper, proofFetchCallback });\n\n return keylessAccount;\n}\n"],"mappings":"yOAgBA,eAAsBA,EAAUC,EAMR,CACtB,GAAM,CAAE,YAAAC,EAAa,IAAAC,EAAK,iBAAAC,EAAkB,OAAAC,EAAQ,eAAAC,CAAe,EAAIL,EAEjEM,EAAO,CACX,QAASJ,EACT,IAAKC,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,cAAe,OAAOA,EAAiB,cAAc,EACrD,YAAaI,EAAI,aAAaJ,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,QAASC,EACT,gBAAiBC,CACnB,EACM,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAiD,CACtE,YAAAR,EACA,KAAM,QACN,KAAAK,EACA,aAAc,YACd,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EACD,OAAOC,EAAI,aAAaC,EAAK,MAAM,EAAE,aAAa,CACpD,CAEA,eAAsBE,EAASV,EAOD,CAC5B,GAAM,CAAE,YAAAC,EAAa,IAAAC,EAAK,iBAAAC,EAAkB,OAAAQ,EAAQ,OAAAP,EAAQ,cAAAQ,CAAc,EAAIZ,EACxEa,EAAO,CACX,QAASX,EACT,IAAKC,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,YAAaI,EAAI,aAAaJ,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,cAAe,OAAOA,EAAiB,cAAc,EACrD,iBAAkBW,EAClB,OAAQP,EAAI,aAAaI,CAAM,EAAE,sBAAsB,EACvD,YAAaC,EACb,QAASR,GAAU,KACrB,EAEM,CAAE,KAAAI,CAAK,EAAI,MAAMO,EAA6C,CAClE,YAAAd,EACA,KAAM,QACN,KAAMY,EACN,aAAc,WACd,UAAW,CAAE,iBAAkB,EAAM,CACvC,CAAC,EAEKG,EAAcR,EAAK,MACnBS,EAAa,IAAIC,EAAW,CAChC,EAAGF,EAAY,EACf,EAAGA,EAAY,EACf,EAAGA,EAAY,CACjB,CAAC,EAMD,OAJoB,IAAIG,EAAiB,CACvC,MAAO,IAAIC,EAAQH,GAA8B,EACjD,wBAAyBI,EAAmB,QAAQb,EAAK,yBAAyB,CACpF,CAAC,CAEH,CAEA,eAAsBc,EAAqBtB,EAQf,CAC1B,GAAM,CAAE,mBAAAuB,CAAmB,EAAIvB,EAC3B,CAAE,OAAAW,CAAO,EAAIX,EACjB,GAAIW,IAAW,OACbA,EAAS,MAAMZ,EAAUC,CAAI,UACpBO,EAAI,aAAaI,CAAM,EAAE,aAAa,EAAE,SAAWa,EAAe,cAC3E,MAAM,IAAI,MAAM,sBAAsBA,EAAe,aAAa,QAAQ,EAG5E,IAAMC,EAAef,EAAS,CAAE,GAAGV,EAAM,OAAAW,CAAO,CAAC,EAC3Ce,EAAQH,EAAqBE,EAAe,MAAMA,EAIxD,OAFuBD,EAAe,gBAAgB,CAAE,GAAGxB,EAAM,MAAA0B,EAAO,OAAAf,EAAQ,mBAAAY,CAAmB,CAAC,CAGtG","names":["getPepper","args","aptosConfig","jwt","ephemeralKeyPair","uidKey","derivationPath","body","Hex","data","postAptosPepperService","getProof","pepper","extraFieldKey","json","EPK_HORIZON_SECS","postAptosProvingService","proofPoints","groth16Zkp","Groth16Zkp","ZeroKnowledgeSig","ZkProof","EphemeralSignature","deriveKeylessAccount","proofFetchCallback","KeylessAccount","proofPromise","proof"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var s={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},o={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},n={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},a={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"http://127.0.0.1:8000/v0"},p={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"http://127.0.0.1:8083/v0"},e=(t=>(t.MAINNET="mainnet",t.TESTNET="testnet",t.DEVNET="devnet",t.LOCAL="local",t.CUSTOM="custom",t))(e||{}),r={mainnet:1,testnet:2,local:4},c={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};export{s as a,o as b,n as c,a as d,p as e,e as f,r as g,c as h};
|
|
2
|
-
//# sourceMappingURL=chunk-WDE54GRQ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/apiEndpoints.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nexport const NetworkToIndexerAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1/graphql\",\n testnet: \"https://api.testnet.aptoslabs.com/v1/graphql\",\n devnet: \"https://api.devnet.aptoslabs.com/v1/graphql\",\n local: \"http://127.0.0.1:8090/v1/graphql\",\n};\n\nexport const NetworkToNodeAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1\",\n testnet: \"https://api.testnet.aptoslabs.com/v1\",\n devnet: \"https://api.devnet.aptoslabs.com/v1\",\n local: \"http://127.0.0.1:8080/v1\",\n};\n\nexport const NetworkToFaucetAPI: Record<string, string> = {\n mainnet: \"https://faucet.mainnet.aptoslabs.com\",\n testnet: \"https://faucet.testnet.aptoslabs.com\",\n devnet: \"https://faucet.devnet.aptoslabs.com\",\n local: \"http://127.0.0.1:8081\",\n};\n\nexport const NetworkToPepperAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/keyless/pepper/v0\",\n testnet: \"https://api.testnet.aptoslabs.com/keyless/pepper/v0\",\n devnet: \"https://api.devnet.aptoslabs.com/keyless/pepper/v0\",\n local: \"http://127.0.0.1:8000/v0\",\n};\n\nexport const NetworkToProverAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/keyless/prover/v0\",\n testnet: \"https://api.testnet.aptoslabs.com/keyless/prover/v0\",\n devnet: \"https://api.devnet.aptoslabs.com/keyless/prover/v0\",\n local: \"http://127.0.0.1:8083/v0\",\n};\n\nexport enum Network {\n MAINNET = \"mainnet\",\n TESTNET = \"testnet\",\n DEVNET = \"devnet\",\n LOCAL = \"local\",\n CUSTOM = \"custom\",\n}\n\nexport const NetworkToChainId: Record<string, number> = {\n mainnet: 1,\n testnet: 2,\n local: 4,\n};\n\nexport const NetworkToNetworkName: Record<string, Network> = {\n mainnet: Network.MAINNET,\n testnet: Network.TESTNET,\n devnet: Network.DEVNET,\n local: Network.LOCAL,\n custom: Network.CUSTOM,\n};\n"],"mappings":"AAGO,IAAMA,EAA8C,CACzD,QAAS,+CACT,QAAS,+CACT,OAAQ,8CACR,MAAO,kCACT,EAEaC,EAA2C,CACtD,QAAS,uCACT,QAAS,uCACT,OAAQ,sCACR,MAAO,0BACT,EAEaC,EAA6C,CACxD,QAAS,uCACT,QAAS,uCACT,OAAQ,sCACR,MAAO,uBACT,EAEaC,EAA6C,CACxD,QAAS,sDACT,QAAS,sDACT,OAAQ,qDACR,MAAO,0BACT,EAEaC,EAA6C,CACxD,QAAS,sDACT,QAAS,sDACT,OAAQ,qDACR,MAAO,0BACT,EAEYC,OACVA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,OAAS,SALCA,OAAA,IAQCC,EAA2C,CACtD,QAAS,EACT,QAAS,EACT,MAAO,CACT,EAEaC,EAAgD,CAC3D,QAAS,UACT,QAAS,UACT,OAAQ,SACR,MAAO,QACP,OAAQ,QACV","names":["NetworkToIndexerAPI","NetworkToNodeAPI","NetworkToFaucetAPI","NetworkToPepperAPI","NetworkToProverAPI","Network","NetworkToChainId","NetworkToNetworkName"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as r,c as o}from"./chunk-W4IWORPF.mjs";var t=class{constructor(e){this.config=e}async getPepper(e){return r({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return o({aptosConfig:this.config,...e})}};export{t as a};
|
|
2
|
-
//# sourceMappingURL=chunk-YZPQVZ7S.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { deriveKeylessAccount, getPepper } from \"../internal/keyless\";\nimport { HexInput } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to query all `Keyless` related queries on Aptos.\n */\nexport class Keyless {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Fetches the pepper from the Aptos pepper service API.\n *\n * @param args.jwt JWT token\n * @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token\n * @returns The pepper which is a Uint8Array of length 31.\n */\n async getPepper(args: { jwt: string; ephemeralKeyPair: EphemeralKeyPair }): Promise<Uint8Array> {\n return getPepper({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches the pepper from the Aptos pepper service API.\n *\n * @param args.jwt JWT token\n * @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token\n * @param args.uidKey a key in the JWT token to use to set the uidVal in the IdCommitment\n * @param args.pepper the pepper\n * @param args.extraFieldKey a key in the JWT token used to reveal a value on chain\n * @param args.proofFetchCallback a callback function that if set, the fetch of the proof will be done asyncronously. Once\n * if finishes the callback function will be called.\n * @returns A KeylessAccount that can be used to sign transactions\n */\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n extraFieldKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<KeylessAccount> {\n return deriveKeylessAccount({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"gDAWO,IAAMA,EAAN,KAAc,CACnB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAS3C,MAAM,UAAUC,EAAgF,CAC9F,OAAOC,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACxD,CAcA,MAAM,qBAAqBA,EAOC,CAC1B,OAAOE,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACnE,CACF","names":["Keyless","config","args","getPepper","deriveKeylessAccount"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as O}from"./chunk-KPZDC5ZE.mjs";import{a as k}from"./chunk-R2P2XANA.mjs";import{d as T}from"./chunk-JCDZ2WXX.mjs";import{a as I,c as N}from"./chunk-5YI2GEG5.mjs";import{d as w}from"./chunk-4USAUOCE.mjs";import{a as y,b as m}from"./chunk-UO5LUYGO.mjs";import{i as F,j as b,k as x,n as f}from"./chunk-LECNIPW7.mjs";import{b as A}from"./chunk-T23OVRNF.mjs";import{a as K}from"./chunk-VT6XJSRO.mjs";import{a as S}from"./chunk-TVRJ3M7B.mjs";import{b as E}from"./chunk-AOCNYMMX.mjs";import{jwtDecode as R}from"jwt-decode";import{JwksClient as J}from"jwks-rsa";import V from"eventemitter3";var j={"https://accounts.google.com":"https://www.googleapis.com/oauth2/v3/certs"},H=(t=>(t[t.JWK_EXPIRED=0]="JWK_EXPIRED",t[t.EPK_EXPIRED=1]="EPK_EXPIRED",t[t.PROOF_NOT_FOUND=2]="PROOF_NOT_FOUND",t[t.UNKNOWN_INVALID_SIGNATURE=3]="UNKNOWN_INVALID_SIGNATURE",t[t.UNKNOWN=4]="UNKNOWN",t))(H||{}),p=class n extends Error{constructor(e){super();this.type=e}static async fromAptosApiError(e,r){return e.data.message.includes("INVALID_SIGNATURE")?r.isExpired()?new n(1):await r.checkJwkValidity()?new n(3):new n(0):new n(4)}},s=class s extends S{constructor(e){super();let{address:r,ephemeralKeyPair:i,uidKey:t,uidVal:a,aud:c,pepper:l,proofOrFetcher:o,proofFetchCallback:h,jwt:d}=e;if(this.ephemeralKeyPair=i,this.publicKey=F.create(e),this.accountAddress=r?A.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=t,this.uidVal=a,this.aud=c,this.jwt=d,this.emitter=new V,this.proofOrPromise=o,o instanceof f)this.proof=o;else{if(h===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async D=>{await h(D),this.emitter.removeAllListeners()}),this.init(o)}this.signingScheme=2;let u=E.fromHexInput(l).toUint8Array();if(u.length!==s.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${s.PEPPER_LENGTH}`);this.pepper=u,this.isJwtValid=!0}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),t=e.deserializeFixedBytes(31),a=k.deserialize(e),c=f.deserialize(e);return s.fromJWTAndProof({proof:c,pepper:t,uidKey:i,jwt:r,ephemeralKeyPair:a})}isExpired(){return this.ephemeralKeyPair.isExpired()}async checkJwkValidity(){if(!this.isJwtValid)return!1;let e=R(this.jwt,{header:!0}),r=new J({jwksUri:j[this.publicKey.iss]});try{return await r.getSigningKey(e.kid),!0}catch{return this.isJwtValid=!1,!1}}signWithAuthenticator(e){let r=new m(this.sign(e)),i=new y(this.publicKey);return new w(i,r)}signTransactionWithAuthenticator(e){let r=new m(this.signTransaction(e)),i=new y(this.publicKey);return new w(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new p(1);if(this.proof===void 0)throw new p(2);if(!this.isJwtValid)throw new p(0);let i=this.ephemeralKeyPair.getPublicKey(),t=this.ephemeralKeyPair.sign(e);return new b({jwtHeader:T(this.jwt.split(".")[0]),ephemeralCertificate:new x(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:t})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=I(e),i=new g(r,this.proof.proof),t=N(i);return this.sign(t)}verifySignature(e){throw new Error("Not implemented")}static fromBytes(e){return s.deserialize(new K(e))}static fromJWTAndProof(e){let{proof:r,jwt:i,ephemeralKeyPair:t,pepper:a,proofFetchCallback:c}=e,l=e.uidKey??"sub",o=R(i),h=o.iss;if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let d=o.aud,u=o[l];return new s({proofOrFetcher:r,ephemeralKeyPair:t,iss:h,uidKey:l,uidVal:u,aud:d,pepper:a,jwt:i,proofFetchCallback:c})}};s.PEPPER_LENGTH=31;var v=s,g=class extends O{constructor(e,r){super();this.transaction=e,this.proof=r,this.domainSeparator="APTOS::TransactionAndProof"}serialize(e){e.serializeFixedBytes(this.transaction.bcsToBytes()),e.serializeOption(this.proof)}};export{j as a,H as b,p as c,v as d,g as e};
|
|
2
|
-
//# sourceMappingURL=chunk-ZUQJLFR2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/KeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport { JwksClient } from \"jwks-rsa\";\nimport EventEmitter from \"eventemitter3\";\nimport { EphemeralCertificateVariant, HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n EphemeralCertificate,\n Signature,\n ZeroKnowledgeSig,\n ZkProof,\n} from \"../core/crypto\";\n\nimport { Account } from \"./Account\";\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Hex } from \"../core/hex\";\nimport { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport {\n deriveTransactionType,\n generateSigningMessageForBcsCryptoHashable,\n} from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../transactions/types\";\nimport { AptosApiError } from \"../client/types\";\nimport { AptsoDomainSeparator, CryptoHashable } from \"../bcs/cryptoHasher\";\nimport { base64UrlDecode } from \"../utils/helpers\";\n\nexport const IssuerToJwkEndpoint: Record<string, string> = {\n \"https://accounts.google.com\": \"https://www.googleapis.com/oauth2/v3/certs\",\n};\n\nexport enum KeylessErrorType {\n JWK_EXPIRED,\n EPK_EXPIRED,\n PROOF_NOT_FOUND,\n UNKNOWN_INVALID_SIGNATURE,\n UNKNOWN,\n}\nexport class KeylessError extends Error {\n readonly type: KeylessErrorType;\n\n constructor(type: KeylessErrorType) {\n super();\n this.type = type;\n }\n\n static async fromAptosApiError(error: AptosApiError, signer: KeylessAccount): Promise<KeylessError> {\n if (!error.data.message.includes(\"INVALID_SIGNATURE\")) {\n return new KeylessError(KeylessErrorType.UNKNOWN);\n }\n if (signer.isExpired()) {\n return new KeylessError(KeylessErrorType.EPK_EXPIRED);\n }\n if (!(await signer.checkJwkValidity())) {\n return new KeylessError(KeylessErrorType.JWK_EXPIRED);\n }\n return new KeylessError(KeylessErrorType.UNKNOWN_INVALID_SIGNATURE);\n }\n}\n\nexport class KeylessAccount extends Serializable implements Account {\n static readonly PEPPER_LENGTH: number = 31;\n\n readonly publicKey: KeylessPublicKey;\n\n readonly ephemeralKeyPair: EphemeralKeyPair;\n\n readonly uidKey: string;\n\n readonly uidVal: string;\n\n readonly aud: string;\n\n readonly pepper: Uint8Array;\n\n readonly accountAddress: AccountAddress;\n\n proof: ZeroKnowledgeSig | undefined;\n\n readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n\n readonly signingScheme: SigningScheme;\n\n private jwt: string;\n\n private isJwtValid: boolean;\n\n readonly emitter: EventEmitter<ProofFetchEvents>;\n\n constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proofOrFetcher: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n proofFetchCallback?: ProofFetchCallback;\n jwt: string;\n }) {\n super();\n const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;\n this.ephemeralKeyPair = ephemeralKeyPair;\n this.publicKey = KeylessPublicKey.create(args);\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n this.uidKey = uidKey;\n this.uidVal = uidVal;\n this.aud = aud;\n this.jwt = jwt;\n this.emitter = new EventEmitter<ProofFetchEvents>();\n this.proofOrPromise = proofOrFetcher;\n if (proofOrFetcher instanceof ZeroKnowledgeSig) {\n this.proof = proofOrFetcher;\n } else {\n if (proofFetchCallback === undefined) {\n throw new Error(\"Must provide callback for async proof fetch\");\n }\n this.emitter.on(\"proofFetchFinish\", async (status) => {\n await proofFetchCallback(status);\n this.emitter.removeAllListeners();\n });\n this.init(proofOrFetcher);\n }\n this.signingScheme = SigningScheme.SingleKey;\n const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();\n if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);\n }\n this.pepper = pepperBytes;\n this.isJwtValid = true;\n }\n\n /**\n * This initializes the asyncronous proof fetch\n * @return\n */\n async init(promise: Promise<ZeroKnowledgeSig>) {\n try {\n this.proof = await promise;\n this.emitter.emit(\"proofFetchFinish\", { status: \"Success\" });\n } catch (error) {\n if (error instanceof Error) {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: error.toString() });\n } else {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: \"Unknown\" });\n }\n }\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.jwt);\n serializer.serializeStr(this.uidKey);\n serializer.serializeFixedBytes(this.pepper);\n this.ephemeralKeyPair.serialize(serializer);\n if (this.proof === undefined) {\n throw new Error(\"Connot serialize - proof undefined\");\n }\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): KeylessAccount {\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n return KeylessAccount.fromJWTAndProof({\n proof,\n pepper,\n uidKey,\n jwt,\n ephemeralKeyPair,\n });\n }\n\n /**\n * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair\n * and JWT token.\n * @return boolean\n */\n isExpired(): boolean {\n return this.ephemeralKeyPair.isExpired();\n }\n\n /**\n * Checks if the the JWK used to verify the token still exists on the issuer's JWK uri.\n * Caches the result.\n * @return boolean\n */\n async checkJwkValidity(): Promise<boolean> {\n if (!this.isJwtValid) {\n return false;\n }\n const jwtHeader = jwtDecode(this.jwt, { header: true });\n const client = new JwksClient({\n jwksUri: IssuerToJwkEndpoint[this.publicKey.iss],\n });\n try {\n await client.getSigningKey(jwtHeader.kid);\n return true;\n } catch (error) {\n this.isJwtValid = false;\n return false;\n }\n }\n\n /**\n * Sign a message using Keyless.\n * @param message the message to sign, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.sign(message));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Sign a transaction using Keyless.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.signTransaction(transaction));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Waits for asyncronous proof fetching to finish.\n * @return\n */\n async waitForProofFetch() {\n if (this.proofOrPromise instanceof Promise) {\n await this.proofOrPromise;\n }\n }\n\n /**\n * Sign the given message using Keyless.\n * @param message in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): KeylessSignature {\n const { expiryDateSecs } = this.ephemeralKeyPair;\n if (this.isExpired()) {\n throw new KeylessError(KeylessErrorType.EPK_EXPIRED);\n }\n if (this.proof === undefined) {\n throw new KeylessError(KeylessErrorType.PROOF_NOT_FOUND);\n }\n if (!this.isJwtValid) {\n throw new KeylessError(KeylessErrorType.JWK_EXPIRED);\n }\n const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();\n const ephemeralSignature = this.ephemeralKeyPair.sign(data);\n\n return new KeylessSignature({\n jwtHeader: base64UrlDecode(this.jwt.split(\".\")[0]),\n ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n /**\n * Sign the given transaction with Keyless.\n * Signs the transaction and proof to guard against proof malleability.\n * @param transaction the transaction to be signed\n * @returns KeylessSignature\n */\n signTransaction(transaction: AnyRawTransaction): KeylessSignature {\n if (this.proof === undefined) {\n throw new Error(\"Proof not found\");\n }\n const raw = deriveTransactionType(transaction);\n const txnAndProof = new TransactionAndProof(raw, this.proof.proof);\n const signMess = generateSigningMessageForBcsCryptoHashable(txnAndProof);\n return this.sign(signMess);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n throw new Error(\"Not implemented\");\n }\n\n static fromBytes(bytes: Uint8Array): KeylessAccount {\n return KeylessAccount.deserialize(new Deserializer(bytes));\n }\n\n static fromJWTAndProof(args: {\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n }): KeylessAccount {\n const { proof, jwt, ephemeralKeyPair, pepper, proofFetchCallback } = args;\n const uidKey = args.uidKey ?? \"sub\";\n\n const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);\n const iss = jwtPayload.iss!;\n if (typeof jwtPayload.aud !== \"string\") {\n throw new Error(\"aud was not found or an array of values\");\n }\n const aud = jwtPayload.aud!;\n const uidVal = jwtPayload[uidKey];\n return new KeylessAccount({\n proofOrFetcher: proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n proofFetchCallback,\n });\n }\n}\n\nexport class TransactionAndProof extends CryptoHashable {\n transaction: AnyRawTransactionInstance;\n\n proof?: ZkProof;\n\n domainSeparator: AptsoDomainSeparator;\n\n constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {\n super();\n this.transaction = transaction;\n this.proof = proof;\n this.domainSeparator = \"APTOS::TransactionAndProof\"\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.transaction.bcsToBytes());\n serializer.serializeOption(this.proof);\n }\n}\n\nexport type ProofFetchSuccess = {\n status: \"Success\";\n};\n\nexport type ProofFetchFailure = {\n status: \"Failed\";\n error: string;\n};\n\nexport type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;\n\nexport type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;\n\nexport interface ProofFetchEvents {\n proofFetchFinish: (status: ProofFetchStatus) => void;\n}\n"],"mappings":"seAGA,OAAqB,aAAAA,MAAiB,aACtC,OAAS,cAAAC,MAAkB,WAC3B,OAAOC,MAAkB,gBA4BlB,IAAMC,EAA8C,CACzD,8BAA+B,4CACjC,EAEYC,OACVA,IAAA,6BACAA,IAAA,6BACAA,IAAA,qCACAA,IAAA,yDACAA,IAAA,qBALUA,OAAA,IAOCC,EAAN,MAAMC,UAAqB,KAAM,CAGtC,YAAYC,EAAwB,CAClC,MAAM,EACN,KAAK,KAAOA,CACd,CAEA,aAAa,kBAAkBC,EAAsBC,EAA+C,CAClG,OAAKD,EAAM,KAAK,QAAQ,SAAS,mBAAmB,EAGhDC,EAAO,UAAU,EACZ,IAAIH,EAAa,CAA4B,EAEhD,MAAMG,EAAO,iBAAiB,EAG7B,IAAIH,EAAa,CAA0C,EAFzD,IAAIA,EAAa,CAA4B,EAN7C,IAAIA,EAAa,CAAwB,CASpD,CACF,EAEaI,EAAN,MAAMA,UAAuBC,CAAgC,CA6BlE,YAAYC,EAWT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3C,EAAM2C,EAAW,IACjB5C,EAAS4C,EAAW7C,CAAM,EAChC,OAAO,IAAIL,EAAe,CACxB,eAAgBuB,EAChB,iBAAAnB,EACA,IAAA+C,EACA,OAAA9C,EACA,OAAAC,EACA,IAAAC,EACA,OAAAC,EACA,IAAAG,EACA,mBAAAD,CACF,CAAC,CACH,CACF,EAtQaV,EACK,cAAwB,GADnC,IAAMoD,EAANpD,EAwQM6C,EAAN,cAAkCQ,CAAe,CAOtD,YAAYnB,EAAwCX,EAAiB,CACnE,MAAM,EACN,KAAK,YAAcW,EACnB,KAAK,MAAQX,EACb,KAAK,gBAAkB,4BACzB,CAEA,UAAUH,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,YAAY,WAAW,CAAC,EAC5DA,EAAW,gBAAgB,KAAK,KAAK,CACvC,CACF","names":["jwtDecode","JwksClient","EventEmitter","IssuerToJwkEndpoint","KeylessErrorType","KeylessError","_KeylessError","type","error","signer","_KeylessAccount","Serializable","args","address","ephemeralKeyPair","uidKey","uidVal","aud","pepper","proofOrFetcher","proofFetchCallback","jwt","KeylessPublicKey","AccountAddress","EventEmitter","ZeroKnowledgeSig","status","pepperBytes","Hex","promise","serializer","deserializer","EphemeralKeyPair","proof","jwtHeader","jwtDecode","client","JwksClient","message","signature","AnySignature","publicKey","AnyPublicKey","AccountAuthenticatorSingleKey","transaction","data","expiryDateSecs","ephemeralPublicKey","ephemeralSignature","KeylessSignature","base64UrlDecode","EphemeralCertificate","raw","deriveTransactionType","txnAndProof","TransactionAndProof","signMess","generateSigningMessageForBcsCryptoHashable","bytes","Deserializer","jwtPayload","iss","KeylessAccount","CryptoHashable"]}
|
package/src/bcs/cryptoHasher.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|