@aptos-labs/ts-sdk 1.16.0-zeta.0 → 1.16.0-zeta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-BtD_TE5q.d.ts → accountAddress-YfW6h4Ja.d.ts} +57 -11
- package/dist/common/{chunk-VLEH6QBR.js → chunk-HPZUSDYP.js} +1 -1
- package/dist/common/{chunk-VLEH6QBR.js.map → chunk-HPZUSDYP.js.map} +1 -1
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/index.d.ts +199 -87
- package/dist/common/index.js +27 -27
- 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 +69 -23
- 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 +3 -4
- 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 -5
- 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 -5
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +15 -11
- 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-4KEEUDZA.mjs → chunk-27PC47S7.mjs} +2 -2
- package/dist/esm/{chunk-W36IQO5K.mjs → chunk-2NGHKNUS.mjs} +2 -2
- package/dist/esm/{chunk-N466X3S6.mjs → chunk-37FFZSIM.mjs} +2 -2
- package/dist/esm/{chunk-VT6XJSRO.mjs → chunk-3IFR6T3V.mjs} +1 -1
- package/dist/esm/chunk-3IFR6T3V.mjs.map +1 -0
- package/dist/esm/chunk-3RJZNUCQ.mjs +2 -0
- package/dist/esm/{chunk-Z2ZR4PTF.mjs → chunk-472OGHMG.mjs} +2 -2
- package/dist/esm/chunk-4TDMJQOJ.mjs +2 -0
- package/dist/esm/chunk-4TDMJQOJ.mjs.map +1 -0
- package/dist/esm/{chunk-STYDBDYL.mjs → chunk-4VPCPASN.mjs} +2 -2
- package/dist/esm/{chunk-M7HZOQ6A.mjs → chunk-5YH2YL3L.mjs} +2 -2
- package/dist/esm/{chunk-EPTCPBVW.mjs → chunk-6DFVM2W6.mjs} +2 -2
- package/dist/esm/{chunk-LEBJNW6Y.mjs → chunk-6FK6OA37.mjs} +2 -2
- package/dist/esm/{chunk-FBLSW5TB.mjs → chunk-6GGHUBUA.mjs} +2 -2
- package/dist/esm/{chunk-3FVRXELT.mjs → chunk-7BW2N4IE.mjs} +2 -2
- package/dist/esm/{chunk-NCDP26DV.mjs → chunk-7JLHN655.mjs} +2 -2
- package/dist/esm/{chunk-SBQRBBRS.mjs → chunk-7XRUPEQ4.mjs} +2 -2
- package/dist/esm/{chunk-Q3AUNZDW.mjs → chunk-B76XCRLH.mjs} +2 -2
- package/dist/esm/{chunk-MTLETLKV.mjs → chunk-BO44HPGU.mjs} +2 -2
- package/dist/esm/{chunk-QZRWRX6P.mjs → chunk-CVCM46UN.mjs} +2 -2
- package/dist/esm/{chunk-QZRWRX6P.mjs.map → chunk-CVCM46UN.mjs.map} +1 -1
- package/dist/esm/{chunk-HGZGTBA4.mjs → chunk-DPWEHSHH.mjs} +2 -2
- package/dist/esm/{chunk-LQH7T3TE.mjs → chunk-E4XMEVB7.mjs} +2 -2
- package/dist/esm/{chunk-7STYQ5ZE.mjs → chunk-EFMAZTIM.mjs} +2 -2
- package/dist/esm/{chunk-NQMF46E5.mjs → chunk-EQN6FVO7.mjs} +2 -2
- package/dist/esm/{chunk-T23OVRNF.mjs → chunk-F3ZVWLDH.mjs} +2 -2
- package/dist/esm/{chunk-F5C4SZZ7.mjs → chunk-FF4L66LJ.mjs} +2 -2
- package/dist/esm/{chunk-EB7AI4B4.mjs → chunk-FGGRPEQ3.mjs} +2 -2
- package/dist/esm/{chunk-IEZO4PIG.mjs → chunk-FIG65OJD.mjs} +2 -2
- package/dist/esm/chunk-FLALKQIK.mjs +2 -0
- package/dist/esm/{chunk-JKZHPY24.mjs.map → chunk-FLALKQIK.mjs.map} +1 -1
- package/dist/esm/{chunk-UDU5L4XH.mjs → chunk-FUKWM4HL.mjs} +2 -2
- package/dist/esm/{chunk-C3L4ETUF.mjs → chunk-GRHLQDHF.mjs} +2 -2
- package/dist/esm/{chunk-MGOHPDX4.mjs → chunk-GSCM444Z.mjs} +2 -2
- package/dist/esm/{chunk-T6OEZ4KP.mjs → chunk-GTUBZWAF.mjs} +2 -2
- package/dist/esm/chunk-GY6LFCB2.mjs +2 -0
- package/dist/esm/chunk-GY6LFCB2.mjs.map +1 -0
- package/dist/esm/{chunk-UWI5D7FD.mjs → chunk-H4AGIUGI.mjs} +2 -2
- package/dist/esm/{chunk-3Y6JNFPD.mjs → chunk-HZOBRRQP.mjs} +2 -2
- package/dist/esm/chunk-I7GRECEJ.mjs +2 -0
- package/dist/esm/{chunk-CNH2RAJQ.mjs.map → chunk-I7GRECEJ.mjs.map} +1 -1
- package/dist/esm/{chunk-6RBUXB5I.mjs → chunk-IBN7ETCB.mjs} +2 -2
- package/dist/esm/{chunk-KFUOOBMJ.mjs → chunk-IGMXAPHY.mjs} +2 -2
- package/dist/esm/{chunk-TEJ7BXJK.mjs → chunk-IPSITJFX.mjs} +2 -2
- package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
- package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
- package/dist/esm/{chunk-NC5HHEEM.mjs → chunk-IXFYYWAC.mjs} +2 -2
- package/dist/esm/{chunk-REBMGDZ5.mjs → chunk-J6VDYVNB.mjs} +2 -2
- package/dist/esm/{chunk-Y5BON557.mjs → chunk-JKRWCFUQ.mjs} +2 -2
- package/dist/esm/{chunk-I5JWDZIP.mjs → chunk-JOXU5RWH.mjs} +2 -2
- package/dist/esm/chunk-JOXU5RWH.mjs.map +1 -0
- package/dist/esm/{chunk-IJE5YSXW.mjs → chunk-JWGG6XFS.mjs} +2 -2
- package/dist/esm/{chunk-MWN63XBE.mjs → chunk-K2KJX32L.mjs} +2 -2
- package/dist/esm/chunk-KCRCX6BL.mjs +2 -0
- package/dist/esm/chunk-KCRCX6BL.mjs.map +1 -0
- package/dist/esm/chunk-KGHBTSDR.mjs +2 -0
- package/dist/esm/chunk-KGHBTSDR.mjs.map +1 -0
- package/dist/esm/{chunk-6KNAIXZ3.mjs → chunk-KMVSI4PC.mjs} +2 -2
- package/dist/esm/chunk-KNMQU2TA.mjs +2 -0
- package/dist/esm/chunk-KNMQU2TA.mjs.map +1 -0
- package/dist/esm/{chunk-Y33VGXNI.mjs → chunk-KSSJ3CT5.mjs} +2 -2
- package/dist/esm/{chunk-EIRSA5UU.mjs → chunk-KUMZXNMD.mjs} +2 -2
- package/dist/esm/{chunk-NWWXZ7EW.mjs → chunk-L5CPAOUM.mjs} +2 -2
- package/dist/esm/{chunk-EADBYPUD.mjs → chunk-LMEJ5K6B.mjs} +2 -2
- package/dist/esm/chunk-LYOUEPDG.mjs +2 -0
- package/dist/esm/chunk-LYOUEPDG.mjs.map +1 -0
- package/dist/esm/{chunk-WAXCU6D6.mjs → chunk-MEOGVBMZ.mjs} +2 -2
- package/dist/esm/{chunk-3VGX3TXH.mjs → chunk-MLX6DFMR.mjs} +2 -2
- package/dist/esm/{chunk-KKP4FBWZ.mjs → chunk-MX5Z3EHG.mjs} +2 -2
- package/dist/esm/{chunk-MWUJCP27.mjs → chunk-NW3WUTTD.mjs} +2 -2
- package/dist/esm/{chunk-YHO2EBXH.mjs → chunk-NW6LGHE7.mjs} +2 -2
- package/dist/esm/{chunk-ZCCYHFPK.mjs → chunk-OJL36Q4H.mjs} +2 -2
- package/dist/esm/{chunk-LO7B3CWN.mjs → chunk-OJUFU5TJ.mjs} +2 -2
- package/dist/esm/{chunk-ONIYM7IU.mjs → chunk-PAY7N36H.mjs} +2 -2
- package/dist/esm/{chunk-RUSWW265.mjs → chunk-PHEA3NOJ.mjs} +2 -2
- package/dist/esm/{chunk-OX5GWFHX.mjs → chunk-PUP6XMAV.mjs} +2 -2
- package/dist/esm/{chunk-A3UVZHDJ.mjs → chunk-PWYL5QZP.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-JCDZ2WXX.mjs → chunk-QHB5A5YP.mjs} +1 -1
- package/dist/esm/chunk-QHB5A5YP.mjs.map +1 -0
- package/dist/esm/{chunk-UFJGYMEB.mjs → chunk-R4KIZ2FK.mjs} +2 -2
- package/dist/esm/{chunk-6M53MDWB.mjs → chunk-RTO3YBWQ.mjs} +2 -2
- package/dist/esm/{chunk-OT37OTT7.mjs → chunk-RURI53PG.mjs} +2 -2
- package/dist/esm/{chunk-5RRZMXND.mjs → chunk-RX5SPT5S.mjs} +2 -2
- package/dist/esm/{chunk-4USAUOCE.mjs → chunk-RYRID5HT.mjs} +2 -2
- package/dist/esm/{chunk-Z6JERVLX.mjs → chunk-SBEZ64HG.mjs} +2 -2
- package/dist/esm/{chunk-C34M4T77.mjs → chunk-SNDFJWYM.mjs} +2 -2
- package/dist/esm/chunk-T4HO5JMQ.mjs +2 -0
- package/dist/esm/chunk-T4HO5JMQ.mjs.map +1 -0
- package/dist/esm/{chunk-7H3HRFVM.mjs → chunk-T5YEMU53.mjs} +2 -2
- package/dist/esm/{chunk-ZNEBMSNC.mjs → chunk-TUCCV62K.mjs} +2 -2
- package/dist/esm/{chunk-7QGIAVW4.mjs → chunk-UBON2G6Y.mjs} +2 -2
- package/dist/esm/{chunk-TVRJ3M7B.mjs → chunk-UMLUOYFK.mjs} +1 -1
- package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-UMLUOYFK.mjs.map} +1 -1
- package/dist/esm/chunk-VCAURUJ3.mjs +2 -0
- package/dist/esm/chunk-VCAURUJ3.mjs.map +1 -0
- package/dist/esm/chunk-VJ3OBIFQ.mjs +2 -0
- package/dist/esm/chunk-VJ3OBIFQ.mjs.map +1 -0
- package/dist/esm/{chunk-COW5IGYC.mjs → chunk-WA2NTBYY.mjs} +2 -2
- package/dist/esm/{chunk-UO5LUYGO.mjs → chunk-XGDLSWBF.mjs} +2 -2
- package/dist/esm/{chunk-EU6CX56Q.mjs → chunk-XH33BXEY.mjs} +2 -2
- package/dist/esm/{chunk-PYUU4OEL.mjs → chunk-XVZBWW46.mjs} +2 -2
- package/dist/esm/chunk-YBXQVY7N.mjs +2 -0
- package/dist/esm/{chunk-N7CE244N.mjs.map → chunk-YBXQVY7N.mjs.map} +1 -1
- package/dist/esm/{chunk-MKUAW7KW.mjs → chunk-YDNOKWV3.mjs} +2 -2
- package/dist/esm/{chunk-W637YAND.mjs → chunk-YRUF6N3U.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +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 +6 -5
- 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 -9
- 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/helpers.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 -2
- package/src/account/EphemeralKeyPair.ts +6 -6
- package/src/account/KeylessAccount.ts +72 -66
- package/src/api/keyless.ts +13 -4
- package/src/bcs/deserializer.ts +14 -8
- package/src/bcs/serializer.ts +40 -0
- package/src/client/core.ts +4 -8
- 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 +155 -23
- package/src/core/crypto/poseidon.ts +19 -8
- package/src/internal/keyless.ts +83 -15
- package/src/internal/transactionSubmission.ts +2 -2
- 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 +5 -3
- package/src/utils/helpers.ts +0 -1
- 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-5V2RGYYK.mjs +0 -2
- package/dist/esm/chunk-5V2RGYYK.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-JCDZ2WXX.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-4KEEUDZA.mjs.map → chunk-27PC47S7.mjs.map} +0 -0
- /package/dist/esm/{chunk-W36IQO5K.mjs.map → chunk-2NGHKNUS.mjs.map} +0 -0
- /package/dist/esm/{chunk-N466X3S6.mjs.map → chunk-37FFZSIM.mjs.map} +0 -0
- /package/dist/esm/{chunk-UTXJOB3O.mjs.map → chunk-3RJZNUCQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z2ZR4PTF.mjs.map → chunk-472OGHMG.mjs.map} +0 -0
- /package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-4VPCPASN.mjs.map} +0 -0
- /package/dist/esm/{chunk-M7HZOQ6A.mjs.map → chunk-5YH2YL3L.mjs.map} +0 -0
- /package/dist/esm/{chunk-EPTCPBVW.mjs.map → chunk-6DFVM2W6.mjs.map} +0 -0
- /package/dist/esm/{chunk-LEBJNW6Y.mjs.map → chunk-6FK6OA37.mjs.map} +0 -0
- /package/dist/esm/{chunk-FBLSW5TB.mjs.map → chunk-6GGHUBUA.mjs.map} +0 -0
- /package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-7BW2N4IE.mjs.map} +0 -0
- /package/dist/esm/{chunk-NCDP26DV.mjs.map → chunk-7JLHN655.mjs.map} +0 -0
- /package/dist/esm/{chunk-SBQRBBRS.mjs.map → chunk-7XRUPEQ4.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q3AUNZDW.mjs.map → chunk-B76XCRLH.mjs.map} +0 -0
- /package/dist/esm/{chunk-MTLETLKV.mjs.map → chunk-BO44HPGU.mjs.map} +0 -0
- /package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-DPWEHSHH.mjs.map} +0 -0
- /package/dist/esm/{chunk-LQH7T3TE.mjs.map → chunk-E4XMEVB7.mjs.map} +0 -0
- /package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-EFMAZTIM.mjs.map} +0 -0
- /package/dist/esm/{chunk-NQMF46E5.mjs.map → chunk-EQN6FVO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-F3ZVWLDH.mjs.map} +0 -0
- /package/dist/esm/{chunk-F5C4SZZ7.mjs.map → chunk-FF4L66LJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-FGGRPEQ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-IEZO4PIG.mjs.map → chunk-FIG65OJD.mjs.map} +0 -0
- /package/dist/esm/{chunk-UDU5L4XH.mjs.map → chunk-FUKWM4HL.mjs.map} +0 -0
- /package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-GRHLQDHF.mjs.map} +0 -0
- /package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-GSCM444Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-T6OEZ4KP.mjs.map → chunk-GTUBZWAF.mjs.map} +0 -0
- /package/dist/esm/{chunk-UWI5D7FD.mjs.map → chunk-H4AGIUGI.mjs.map} +0 -0
- /package/dist/esm/{chunk-3Y6JNFPD.mjs.map → chunk-HZOBRRQP.mjs.map} +0 -0
- /package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-IBN7ETCB.mjs.map} +0 -0
- /package/dist/esm/{chunk-KFUOOBMJ.mjs.map → chunk-IGMXAPHY.mjs.map} +0 -0
- /package/dist/esm/{chunk-TEJ7BXJK.mjs.map → chunk-IPSITJFX.mjs.map} +0 -0
- /package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-IXFYYWAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-REBMGDZ5.mjs.map → chunk-J6VDYVNB.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y5BON557.mjs.map → chunk-JKRWCFUQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-IJE5YSXW.mjs.map → chunk-JWGG6XFS.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWN63XBE.mjs.map → chunk-K2KJX32L.mjs.map} +0 -0
- /package/dist/esm/{chunk-6KNAIXZ3.mjs.map → chunk-KMVSI4PC.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y33VGXNI.mjs.map → chunk-KSSJ3CT5.mjs.map} +0 -0
- /package/dist/esm/{chunk-EIRSA5UU.mjs.map → chunk-KUMZXNMD.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWWXZ7EW.mjs.map → chunk-L5CPAOUM.mjs.map} +0 -0
- /package/dist/esm/{chunk-EADBYPUD.mjs.map → chunk-LMEJ5K6B.mjs.map} +0 -0
- /package/dist/esm/{chunk-WAXCU6D6.mjs.map → chunk-MEOGVBMZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-MLX6DFMR.mjs.map} +0 -0
- /package/dist/esm/{chunk-KKP4FBWZ.mjs.map → chunk-MX5Z3EHG.mjs.map} +0 -0
- /package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-NW3WUTTD.mjs.map} +0 -0
- /package/dist/esm/{chunk-YHO2EBXH.mjs.map → chunk-NW6LGHE7.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZCCYHFPK.mjs.map → chunk-OJL36Q4H.mjs.map} +0 -0
- /package/dist/esm/{chunk-LO7B3CWN.mjs.map → chunk-OJUFU5TJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONIYM7IU.mjs.map → chunk-PAY7N36H.mjs.map} +0 -0
- /package/dist/esm/{chunk-RUSWW265.mjs.map → chunk-PHEA3NOJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OX5GWFHX.mjs.map → chunk-PUP6XMAV.mjs.map} +0 -0
- /package/dist/esm/{chunk-A3UVZHDJ.mjs.map → chunk-PWYL5QZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-UFJGYMEB.mjs.map → chunk-R4KIZ2FK.mjs.map} +0 -0
- /package/dist/esm/{chunk-6M53MDWB.mjs.map → chunk-RTO3YBWQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OT37OTT7.mjs.map → chunk-RURI53PG.mjs.map} +0 -0
- /package/dist/esm/{chunk-5RRZMXND.mjs.map → chunk-RX5SPT5S.mjs.map} +0 -0
- /package/dist/esm/{chunk-4USAUOCE.mjs.map → chunk-RYRID5HT.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z6JERVLX.mjs.map → chunk-SBEZ64HG.mjs.map} +0 -0
- /package/dist/esm/{chunk-C34M4T77.mjs.map → chunk-SNDFJWYM.mjs.map} +0 -0
- /package/dist/esm/{chunk-7H3HRFVM.mjs.map → chunk-T5YEMU53.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-TUCCV62K.mjs.map} +0 -0
- /package/dist/esm/{chunk-7QGIAVW4.mjs.map → chunk-UBON2G6Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-WA2NTBYY.mjs.map} +0 -0
- /package/dist/esm/{chunk-UO5LUYGO.mjs.map → chunk-XGDLSWBF.mjs.map} +0 -0
- /package/dist/esm/{chunk-EU6CX56Q.mjs.map → chunk-XH33BXEY.mjs.map} +0 -0
- /package/dist/esm/{chunk-PYUU4OEL.mjs.map → chunk-XVZBWW46.mjs.map} +0 -0
- /package/dist/esm/{chunk-MKUAW7KW.mjs.map → chunk-YDNOKWV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-W637YAND.mjs.map → chunk-YRUF6N3U.mjs.map} +0 -0
- /package/dist/esm/{bcs → core/crypto}/cryptoHasher.mjs.map +0 -0
package/package.json
CHANGED
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
"form-data": "^4.0.0",
|
|
58
58
|
"jose": "^5.1.3",
|
|
59
59
|
"js-base64": "^3.7.7",
|
|
60
|
-
"jwks-rsa": "^3.1.0",
|
|
61
60
|
"jwt-decode": "^4.0.0",
|
|
62
61
|
"poseidon-lite": "^0.2.0"
|
|
63
62
|
},
|
|
@@ -93,5 +92,5 @@
|
|
|
93
92
|
"typedoc": "^0.25.4",
|
|
94
93
|
"typescript": "^5.3.3"
|
|
95
94
|
},
|
|
96
|
-
"version": "1.16.0-zeta.
|
|
95
|
+
"version": "1.16.0-zeta.2"
|
|
97
96
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "../core/crypto";
|
|
13
13
|
import { Hex } from "../core/hex";
|
|
14
14
|
import { bytesToBigIntLE, padAndPackBytesWithLen, poseidonHash } from "../core/crypto/poseidon";
|
|
15
|
-
import {
|
|
15
|
+
import { EphemeralPublicKeyVariant, HexInput } from "../types";
|
|
16
16
|
import { Deserializer, Serializable, Serializer } from "../bcs";
|
|
17
17
|
import { currentTimeInSeconds, floorToWholeHour } from "../utils/helpers";
|
|
18
18
|
|
|
@@ -29,7 +29,7 @@ export class EphemeralKeyPair extends Serializable {
|
|
|
29
29
|
* A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new
|
|
30
30
|
* EphemeralKeyPair must be generated and a new JWT needs to be created.
|
|
31
31
|
*/
|
|
32
|
-
readonly expiryDateSecs:
|
|
32
|
+
readonly expiryDateSecs: number;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* The value passed to the IdP when the user authenticates. It comprises of a hash of the
|
|
@@ -49,13 +49,13 @@ export class EphemeralKeyPair extends Serializable {
|
|
|
49
49
|
*/
|
|
50
50
|
private publicKey: EphemeralPublicKey;
|
|
51
51
|
|
|
52
|
-
constructor(args: { privateKey: PrivateKey; expiryDateSecs?:
|
|
52
|
+
constructor(args: { privateKey: PrivateKey; expiryDateSecs?: number; blinder?: HexInput }) {
|
|
53
53
|
super();
|
|
54
54
|
const { privateKey, expiryDateSecs, blinder } = args;
|
|
55
55
|
this.privateKey = privateKey;
|
|
56
56
|
this.publicKey = new EphemeralPublicKey(privateKey.publicKey());
|
|
57
57
|
// We set the expiry date to be the nearest floored hour
|
|
58
|
-
this.expiryDateSecs = expiryDateSecs ||
|
|
58
|
+
this.expiryDateSecs = expiryDateSecs || floorToWholeHour(currentTimeInSeconds() + EPK_HORIZON_SECS);
|
|
59
59
|
// Generate the blinder if not provided
|
|
60
60
|
this.blinder = blinder !== undefined ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();
|
|
61
61
|
// Calculate the nonce
|
|
@@ -98,7 +98,7 @@ export class EphemeralKeyPair extends Serializable {
|
|
|
98
98
|
}
|
|
99
99
|
const expiryDateSecs = deserializer.deserializeU64();
|
|
100
100
|
const blinder = deserializer.deserializeFixedBytes(31);
|
|
101
|
-
return new EphemeralKeyPair({ privateKey, expiryDateSecs, blinder });
|
|
101
|
+
return new EphemeralKeyPair({ privateKey, expiryDateSecs: Number(expiryDateSecs), blinder });
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
static fromBytes(bytes: Uint8Array): EphemeralKeyPair {
|
|
@@ -111,7 +111,7 @@ export class EphemeralKeyPair extends Serializable {
|
|
|
111
111
|
* @param expiryDateSecs the date of expiry.
|
|
112
112
|
* @return boolean
|
|
113
113
|
*/
|
|
114
|
-
static generate(args?: { scheme: EphemeralPublicKeyVariant; expiryDateSecs?:
|
|
114
|
+
static generate(args?: { scheme: EphemeralPublicKeyVariant; expiryDateSecs?: number }): EphemeralKeyPair {
|
|
115
115
|
let privateKey: PrivateKey;
|
|
116
116
|
|
|
117
117
|
switch (args?.scheme) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { JwtPayload, jwtDecode } from "jwt-decode";
|
|
5
|
-
import { JwksClient } from "jwks-rsa";
|
|
6
5
|
import EventEmitter from "eventemitter3";
|
|
7
6
|
import { EphemeralCertificateVariant, HexInput, SigningScheme } from "../types";
|
|
8
7
|
import { AccountAddress } from "../core/accountAddress";
|
|
@@ -22,76 +21,95 @@ import { EphemeralKeyPair } from "./EphemeralKeyPair";
|
|
|
22
21
|
import { Hex } from "../core/hex";
|
|
23
22
|
import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
|
|
24
23
|
import { Deserializer, Serializable, Serializer } from "../bcs";
|
|
25
|
-
import {
|
|
26
|
-
deriveTransactionType,
|
|
27
|
-
generateSigningMessageForBcsCryptoHashable,
|
|
28
|
-
} from "../transactions/transactionBuilder/signingMessage";
|
|
24
|
+
import { deriveTransactionType } from "../transactions/transactionBuilder/signingMessage";
|
|
29
25
|
import { AnyRawTransaction, AnyRawTransactionInstance } from "../transactions/types";
|
|
30
|
-
import {
|
|
31
|
-
import { AptsoDomainSeparator, CryptoHashable } from "../bcs/cryptoHasher";
|
|
26
|
+
import { AptsoDomainSeparator, CryptoHashable } from "../core/crypto/cryptoHasher";
|
|
32
27
|
import { base64UrlDecode } from "../utils/helpers";
|
|
33
28
|
|
|
34
29
|
export const IssuerToJwkEndpoint: Record<string, string> = {
|
|
35
30
|
"https://accounts.google.com": "https://www.googleapis.com/oauth2/v3/certs",
|
|
36
31
|
};
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
constructor(type: KeylessErrorType) {
|
|
49
|
-
super();
|
|
50
|
-
this.type = type;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static async fromAptosApiError(error: AptosApiError, signer: KeylessAccount): Promise<KeylessError> {
|
|
54
|
-
if (!error.data.message.includes("INVALID_SIGNATURE")) {
|
|
55
|
-
return new KeylessError(KeylessErrorType.UNKNOWN);
|
|
56
|
-
}
|
|
57
|
-
if (signer.isExpired()) {
|
|
58
|
-
return new KeylessError(KeylessErrorType.EPK_EXPIRED);
|
|
59
|
-
}
|
|
60
|
-
if (!(await signer.checkJwkValidity())) {
|
|
61
|
-
return new KeylessError(KeylessErrorType.JWK_EXPIRED);
|
|
62
|
-
}
|
|
63
|
-
return new KeylessError(KeylessErrorType.UNKNOWN_INVALID_SIGNATURE);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Account implementation for the Keyless authentication scheme.
|
|
35
|
+
*
|
|
36
|
+
* Used to represent a Keyless based account and sign transactions with it.
|
|
37
|
+
*
|
|
38
|
+
* Use KeylessAccount.fromJWTAndProof to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair.
|
|
39
|
+
*
|
|
40
|
+
* When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,
|
|
41
|
+
* EphemeralKeyPair, and corresponding proof.
|
|
42
|
+
*/
|
|
67
43
|
export class KeylessAccount extends Serializable implements Account {
|
|
68
44
|
static readonly PEPPER_LENGTH: number = 31;
|
|
69
45
|
|
|
46
|
+
/**
|
|
47
|
+
* The KeylessPublicKey associated with the account
|
|
48
|
+
*/
|
|
70
49
|
readonly publicKey: KeylessPublicKey;
|
|
71
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The EphemeralKeyPair used to generate sign.
|
|
53
|
+
*/
|
|
72
54
|
readonly ephemeralKeyPair: EphemeralKeyPair;
|
|
73
55
|
|
|
56
|
+
/**
|
|
57
|
+
* The claim on the JWT to identify a user. This is typically 'sub' or 'email'.
|
|
58
|
+
*/
|
|
74
59
|
readonly uidKey: string;
|
|
75
60
|
|
|
61
|
+
/**
|
|
62
|
+
* The value of the uidKey claim on the JWT. This intended to be a stable user identifier.
|
|
63
|
+
*/
|
|
76
64
|
readonly uidVal: string;
|
|
77
65
|
|
|
66
|
+
/**
|
|
67
|
+
* The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's
|
|
68
|
+
* OIDC registration with the identity provider.
|
|
69
|
+
*/
|
|
78
70
|
readonly aud: string;
|
|
79
71
|
|
|
72
|
+
/**
|
|
73
|
+
* A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
|
|
74
|
+
*/
|
|
80
75
|
readonly pepper: Uint8Array;
|
|
81
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Account address associated with the account
|
|
79
|
+
*/
|
|
82
80
|
readonly accountAddress: AccountAddress;
|
|
83
81
|
|
|
82
|
+
/**
|
|
83
|
+
* The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
|
|
84
|
+
*/
|
|
84
85
|
proof: ZeroKnowledgeSig | undefined;
|
|
85
86
|
|
|
87
|
+
/**
|
|
88
|
+
* The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on
|
|
89
|
+
* fetching the proof.
|
|
90
|
+
*/
|
|
86
91
|
readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
87
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Signing scheme used to sign transactions
|
|
95
|
+
*/
|
|
88
96
|
readonly signingScheme: SigningScheme;
|
|
89
97
|
|
|
98
|
+
/**
|
|
99
|
+
* The JWT token used to derive the account
|
|
100
|
+
*/
|
|
90
101
|
private jwt: string;
|
|
91
102
|
|
|
103
|
+
/**
|
|
104
|
+
* A value that caches the JWT's validity. A JWT becomes invalid when it's corresponding JWK is rotated from the
|
|
105
|
+
* identity provider's JWK keyset.
|
|
106
|
+
*/
|
|
92
107
|
private isJwtValid: boolean;
|
|
93
108
|
|
|
94
|
-
|
|
109
|
+
/**
|
|
110
|
+
* An event emitter used to assist in handling asycronous proof fetching.
|
|
111
|
+
*/
|
|
112
|
+
private readonly emitter: EventEmitter<ProofFetchEvents>;
|
|
95
113
|
|
|
96
114
|
constructor(args: {
|
|
97
115
|
address?: AccountAddress;
|
|
@@ -189,28 +207,6 @@ export class KeylessAccount extends Serializable implements Account {
|
|
|
189
207
|
return this.ephemeralKeyPair.isExpired();
|
|
190
208
|
}
|
|
191
209
|
|
|
192
|
-
/**
|
|
193
|
-
* Checks if the the JWK used to verify the token still exists on the issuer's JWK uri.
|
|
194
|
-
* Caches the result.
|
|
195
|
-
* @return boolean
|
|
196
|
-
*/
|
|
197
|
-
async checkJwkValidity(): Promise<boolean> {
|
|
198
|
-
if (!this.isJwtValid) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
const jwtHeader = jwtDecode(this.jwt, { header: true });
|
|
202
|
-
const client = new JwksClient({
|
|
203
|
-
jwksUri: IssuerToJwkEndpoint[this.publicKey.iss],
|
|
204
|
-
});
|
|
205
|
-
try {
|
|
206
|
-
await client.getSigningKey(jwtHeader.kid);
|
|
207
|
-
return true;
|
|
208
|
-
} catch (error) {
|
|
209
|
-
this.isJwtValid = false;
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
210
|
/**
|
|
215
211
|
* Sign a message using Keyless.
|
|
216
212
|
* @param message the message to sign, as binary input
|
|
@@ -251,13 +247,10 @@ export class KeylessAccount extends Serializable implements Account {
|
|
|
251
247
|
sign(data: HexInput): KeylessSignature {
|
|
252
248
|
const { expiryDateSecs } = this.ephemeralKeyPair;
|
|
253
249
|
if (this.isExpired()) {
|
|
254
|
-
throw new
|
|
250
|
+
throw new Error("EphemeralKeyPair is expired");
|
|
255
251
|
}
|
|
256
252
|
if (this.proof === undefined) {
|
|
257
|
-
throw new
|
|
258
|
-
}
|
|
259
|
-
if (!this.isJwtValid) {
|
|
260
|
-
throw new KeylessError(KeylessErrorType.JWK_EXPIRED);
|
|
253
|
+
throw new Error("Proof not defined");
|
|
261
254
|
}
|
|
262
255
|
const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
|
|
263
256
|
const ephemeralSignature = this.ephemeralKeyPair.sign(data);
|
|
@@ -283,7 +276,7 @@ export class KeylessAccount extends Serializable implements Account {
|
|
|
283
276
|
}
|
|
284
277
|
const raw = deriveTransactionType(transaction);
|
|
285
278
|
const txnAndProof = new TransactionAndProof(raw, this.proof.proof);
|
|
286
|
-
const signMess =
|
|
279
|
+
const signMess = txnAndProof.hash();
|
|
287
280
|
return this.sign(signMess);
|
|
288
281
|
}
|
|
289
282
|
|
|
@@ -328,18 +321,31 @@ export class KeylessAccount extends Serializable implements Account {
|
|
|
328
321
|
}
|
|
329
322
|
}
|
|
330
323
|
|
|
324
|
+
/**
|
|
325
|
+
* A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create
|
|
326
|
+
* the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.
|
|
327
|
+
*/
|
|
331
328
|
export class TransactionAndProof extends CryptoHashable {
|
|
329
|
+
/**
|
|
330
|
+
* The transaction to sign.
|
|
331
|
+
*/
|
|
332
332
|
transaction: AnyRawTransactionInstance;
|
|
333
333
|
|
|
334
|
+
/**
|
|
335
|
+
* The zero knowledge proof used in signing the transaction.
|
|
336
|
+
*/
|
|
334
337
|
proof?: ZkProof;
|
|
335
338
|
|
|
339
|
+
/**
|
|
340
|
+
* The domain separator prefix used when hashing.
|
|
341
|
+
*/
|
|
336
342
|
domainSeparator: AptsoDomainSeparator;
|
|
337
343
|
|
|
338
344
|
constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {
|
|
339
345
|
super();
|
|
340
346
|
this.transaction = transaction;
|
|
341
347
|
this.proof = proof;
|
|
342
|
-
this.domainSeparator = "APTOS::TransactionAndProof"
|
|
348
|
+
this.domainSeparator = "APTOS::TransactionAndProof";
|
|
343
349
|
}
|
|
344
350
|
|
|
345
351
|
serialize(serializer: Serializer): void {
|
package/src/api/keyless.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { KeylessConfiguration } from "../core";
|
|
6
|
+
import { deriveKeylessAccount, getKeylessConfig, getPepper } from "../internal/keyless";
|
|
7
|
+
import { HexInput, LedgerVersionArg } from "../types";
|
|
7
8
|
import { AptosConfig } from "./aptosConfig";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -12,6 +13,16 @@ import { AptosConfig } from "./aptosConfig";
|
|
|
12
13
|
export class Keyless {
|
|
13
14
|
constructor(readonly config: AptosConfig) {}
|
|
14
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Gets the parameters of how Keyless Accounts are configured on chain.
|
|
18
|
+
*
|
|
19
|
+
* @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version
|
|
20
|
+
* @returns KeylessConfiguration
|
|
21
|
+
*/
|
|
22
|
+
async getKeylessConfig(options?: LedgerVersionArg): Promise<KeylessConfiguration> {
|
|
23
|
+
return getKeylessConfig({ aptosConfig: this.config, options });
|
|
24
|
+
}
|
|
25
|
+
|
|
15
26
|
/**
|
|
16
27
|
* Fetches the pepper from the Aptos pepper service API.
|
|
17
28
|
*
|
|
@@ -30,7 +41,6 @@ export class Keyless {
|
|
|
30
41
|
* @param args.ephemeralKeyPair the EphemeralKeyPair used to generate the nonce in the JWT token
|
|
31
42
|
* @param args.uidKey a key in the JWT token to use to set the uidVal in the IdCommitment
|
|
32
43
|
* @param args.pepper the pepper
|
|
33
|
-
* @param args.extraFieldKey a key in the JWT token used to reveal a value on chain
|
|
34
44
|
* @param args.proofFetchCallback a callback function that if set, the fetch of the proof will be done asyncronously. Once
|
|
35
45
|
* if finishes the callback function will be called.
|
|
36
46
|
* @returns A KeylessAccount that can be used to sign transactions
|
|
@@ -40,7 +50,6 @@ export class Keyless {
|
|
|
40
50
|
ephemeralKeyPair: EphemeralKeyPair;
|
|
41
51
|
uidKey?: string;
|
|
42
52
|
pepper?: HexInput;
|
|
43
|
-
extraFieldKey?: string;
|
|
44
53
|
proofFetchCallback?: ProofFetchCallback;
|
|
45
54
|
}): Promise<KeylessAccount> {
|
|
46
55
|
return deriveKeylessAccount({ aptosConfig: this.config, ...args });
|
package/src/bcs/deserializer.ts
CHANGED
|
@@ -77,16 +77,22 @@ export class Deserializer {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Deserializes a an optional
|
|
80
|
+
* Deserializes a an optional deserializable class.
|
|
81
|
+
*
|
|
82
|
+
* BCS layout for Optional<T>: 0 if none, else 1 | bcs representation of class
|
|
81
83
|
*
|
|
82
|
-
* BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content
|
|
83
84
|
* @example
|
|
84
|
-
*
|
|
85
|
-
* const
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
85
|
+
* const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
86
|
+
* const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function
|
|
87
|
+
* // value is now an instance of MyClass
|
|
88
|
+
*
|
|
89
|
+
* const deserializer = new Deserializer(new Uint8Array([0]));
|
|
90
|
+
* const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function
|
|
91
|
+
* // value is undefined
|
|
92
|
+
*
|
|
93
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
94
|
+
*
|
|
95
|
+
* @returns the deserialized value of class type T
|
|
90
96
|
*/
|
|
91
97
|
deserializeOption<T>(cls: Deserializable<T>): T | undefined {
|
|
92
98
|
const exists = this.deserializeUleb128AsU32();
|
package/src/bcs/serializer.ts
CHANGED
|
@@ -317,6 +317,24 @@ export class Serializer {
|
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
+
/**
|
|
321
|
+
* Serializes a BCS Serializable values into a serializer instance or undefined.
|
|
322
|
+
* Note that this does not return anything. The bytes are added to the serializer instance's byte buffer.
|
|
323
|
+
*
|
|
324
|
+
* @param values The array of BCS Serializable values
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```ts
|
|
328
|
+
* const serializer = new Serializer();
|
|
329
|
+
* serializer.serializeOption(new AccountAddress(...));
|
|
330
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
331
|
+
* // serializedBytes is now the BCS-serialized byte representation of AccountAddress
|
|
332
|
+
*
|
|
333
|
+
* const serializer = new Serializer();
|
|
334
|
+
* serializer.serializeOption(undefined);
|
|
335
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0x00]));
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
320
338
|
serializeOption<T extends Serializable>(value?: T): void {
|
|
321
339
|
if (value === undefined) {
|
|
322
340
|
this.serializeU32AsUleb128(0);
|
|
@@ -326,6 +344,28 @@ export class Serializer {
|
|
|
326
344
|
}
|
|
327
345
|
}
|
|
328
346
|
|
|
347
|
+
/**
|
|
348
|
+
* Serializes an optional string. UTF8 string is supported.
|
|
349
|
+
*
|
|
350
|
+
* The existence of the string is encoded first, 0 if undefined and 1 if it exists.
|
|
351
|
+
* Them the number of bytes in the string content is serialized, as a uleb128-encoded u32 integer.
|
|
352
|
+
* Then the string content is serialized as UTF8 encoded bytes.
|
|
353
|
+
*
|
|
354
|
+
* BCS layout for optional "string": 1 | string_length | string_content
|
|
355
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
356
|
+
*
|
|
357
|
+
* BCS layout for undefined: 0
|
|
358
|
+
* @example
|
|
359
|
+
* ```ts
|
|
360
|
+
* const serializer = new Serializer();
|
|
361
|
+
* serializer.serializeOptionStr("1234abcd");
|
|
362
|
+
* assert(serializer.toUint8Array() === new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
363
|
+
*
|
|
364
|
+
* const serializer = new Serializer();
|
|
365
|
+
* serializer.serializeOptionStr(undefined);
|
|
366
|
+
* assert(serializer.toUint8Array() === new Uint8Array([0]));
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
329
369
|
serializeOptionStr(value?: string): void {
|
|
330
370
|
if (value === undefined) {
|
|
331
371
|
this.serializeU32AsUleb128(0);
|
package/src/client/core.ts
CHANGED
|
@@ -100,20 +100,16 @@ export async function aptosRequest<Req extends {}, Res extends {}>(
|
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
102
|
result.data = indexerResponse.data as Res;
|
|
103
|
+
} else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {
|
|
104
|
+
if (result.status >= 500) {
|
|
105
|
+
throw new AptosApiError(options, result, `${response.data}`);
|
|
106
|
+
}
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
if (result.status >= 200 && result.status < 300) {
|
|
106
110
|
return result;
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
if (result.status >= 500) {
|
|
110
|
-
throw new AptosApiError(options, result, `${response.data}`);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (aptosConfig.isPepperServiceRequest(url) || aptosConfig.isProverServiceRequest(url)) {
|
|
114
|
-
throw new AptosApiError(options, result, `${response.data}`);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
113
|
let errorMessage: string;
|
|
118
114
|
|
|
119
115
|
if (result && result.data && "message" in result.data && "error_code" in result.data) {
|
package/src/client/get.ts
CHANGED
|
@@ -89,6 +89,12 @@ export async function getAptosFullNode<Req extends {}, Res extends {}>(
|
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Makes a get request to the pepper service
|
|
94
|
+
*
|
|
95
|
+
* @param options GetAptosRequestOptions
|
|
96
|
+
* @returns AptosResponse
|
|
97
|
+
*/
|
|
92
98
|
export async function getAptosPepperService<Req extends {}, Res extends {}>(
|
|
93
99
|
options: GetAptosRequestOptions,
|
|
94
100
|
): Promise<AptosResponse<Req, Res>> {
|
package/src/client/post.ts
CHANGED
|
@@ -136,6 +136,12 @@ export async function postAptosFaucet<Req extends {}, Res extends {}>(
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Makes a post request to the pepper service
|
|
141
|
+
*
|
|
142
|
+
* @param options GetAptosRequestOptions
|
|
143
|
+
* @returns AptosResponse
|
|
144
|
+
*/
|
|
139
145
|
export async function postAptosPepperService<Req extends {}, Res extends {}>(
|
|
140
146
|
options: PostAptosRequestOptions,
|
|
141
147
|
): Promise<AptosResponse<Req, Res>> {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { generateSigningMessage } from "../../transactions/transactionBuilder/signingMessage";
|
|
2
|
+
import { Serializable } from "../../bcs/serializer";
|
|
3
|
+
|
|
4
|
+
export type AptsoDomainSeparator = `APTOS::${string}`;
|
|
5
|
+
export abstract class CryptoHashable extends Serializable {
|
|
6
|
+
abstract readonly domainSeparator: AptsoDomainSeparator;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core.
|
|
10
|
+
*
|
|
11
|
+
* @returns Uint8Array
|
|
12
|
+
*/
|
|
13
|
+
hash(): Uint8Array {
|
|
14
|
+
return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);
|
|
15
|
+
}
|
|
16
|
+
}
|