@aptos-labs/ts-sdk 1.28.0 → 1.29.0
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/README.md +103 -82
- package/dist/common/{accountAddress-OVl7-qVN.d.ts → accountAddress-DUCC2ffJ.d.ts} +9 -2
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/index.d.ts +266 -42
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.d.mts +207 -0
- package/dist/esm/account/AbstractKeylessAccount.mjs +2 -0
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +75 -0
- package/dist/esm/account/FederatedKeylessAccount.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +13 -130
- 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 +4 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +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 +4 -0
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/coin.d.mts +2 -2
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +2 -2
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +4 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +34 -20
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +2 -2
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +2 -2
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +33 -9
- 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/sign.mjs.map +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/index.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-OTNGLTKS.mjs → chunk-2BTTX2KO.mjs} +2 -2
- package/dist/esm/{chunk-NPFW6ZFY.mjs → chunk-2F7Z7RMW.mjs} +2 -2
- package/dist/esm/{chunk-P2EKDA7R.mjs → chunk-367OG3DB.mjs} +2 -2
- package/dist/esm/{chunk-5L3UXSQI.mjs → chunk-3W2DHZXK.mjs} +2 -2
- package/dist/esm/chunk-44GYWUSH.mjs +2 -0
- package/dist/esm/chunk-44GYWUSH.mjs.map +1 -0
- package/dist/esm/{chunk-UWPO7WWS.mjs → chunk-45IUUCAV.mjs} +2 -2
- package/dist/esm/{chunk-YFMFXRJX.mjs → chunk-4HR32TSY.mjs} +2 -2
- package/dist/esm/chunk-4TB3AWQE.mjs +2 -0
- package/dist/esm/chunk-4TB3AWQE.mjs.map +1 -0
- package/dist/esm/{chunk-3HTSCV3R.mjs → chunk-53RB2PRH.mjs} +2 -2
- package/dist/esm/{chunk-GKERWKMB.mjs → chunk-5PCNWXRN.mjs} +2 -2
- package/dist/esm/{chunk-OPTI3MH2.mjs → chunk-5VD4MHB3.mjs} +2 -2
- package/dist/esm/{chunk-VTEZ6TBO.mjs → chunk-6UZ3VI5Y.mjs} +2 -2
- package/dist/esm/{chunk-Z2AJWV6D.mjs → chunk-7VKFXX5Q.mjs} +2 -2
- package/dist/esm/{chunk-GR4PHW7K.mjs → chunk-A42BPAD4.mjs} +2 -2
- package/dist/esm/{chunk-QQHA2Y46.mjs → chunk-ADE6MVXC.mjs} +2 -2
- package/dist/esm/chunk-ADE6MVXC.mjs.map +1 -0
- package/dist/esm/{chunk-2CAGPXCX.mjs → chunk-APN6AV5Q.mjs} +2 -2
- package/dist/esm/chunk-BA4RBST6.mjs +2 -0
- package/dist/esm/chunk-BA4RBST6.mjs.map +1 -0
- package/dist/esm/{chunk-4ENUSVZB.mjs → chunk-BSAHPS6E.mjs} +2 -2
- package/dist/esm/{chunk-NDJKEFNU.mjs → chunk-BWNTSJOC.mjs} +2 -2
- package/dist/esm/chunk-CB6H4VMZ.mjs +2 -0
- package/dist/esm/chunk-CB6H4VMZ.mjs.map +1 -0
- package/dist/esm/{chunk-LS6G4DZV.mjs → chunk-CRA2MFJC.mjs} +2 -2
- package/dist/esm/{chunk-VQVNUN5Y.mjs → chunk-D3Q4BC3I.mjs} +2 -2
- package/dist/esm/chunk-E4O26ZJB.mjs +2 -0
- package/dist/esm/chunk-E4O26ZJB.mjs.map +1 -0
- package/dist/esm/{chunk-5TBIWC7N.mjs → chunk-ELYS7CWV.mjs} +2 -2
- package/dist/esm/chunk-F3M2UQA4.mjs +2 -0
- package/dist/esm/chunk-F3M2UQA4.mjs.map +1 -0
- package/dist/esm/{chunk-ZXYTLPP6.mjs → chunk-F63E4CR7.mjs} +2 -2
- package/dist/esm/{chunk-JOROI7FE.mjs → chunk-F76N4MQO.mjs} +2 -2
- package/dist/esm/{chunk-F5PNGH44.mjs → chunk-FZ5EYP3D.mjs} +2 -2
- package/dist/esm/chunk-G5XLMQ5E.mjs +2 -0
- package/dist/esm/chunk-G5XLMQ5E.mjs.map +1 -0
- package/dist/esm/chunk-GAEAYY44.mjs +1 -0
- package/dist/esm/chunk-GAEAYY44.mjs.map +1 -0
- package/dist/esm/{chunk-O4BBULNE.mjs → chunk-GDO6Q2FI.mjs} +2 -2
- package/dist/esm/{chunk-WYQLUB4H.mjs → chunk-GDUAFXIQ.mjs} +2 -2
- package/dist/esm/chunk-GMBSQDPO.mjs +2 -0
- package/dist/esm/chunk-GMBSQDPO.mjs.map +1 -0
- package/dist/esm/{chunk-Q7MD4V7H.mjs → chunk-GWSDIX6C.mjs} +2 -2
- package/dist/esm/chunk-HEZ2ZYZA.mjs +1 -0
- package/dist/esm/chunk-HEZ2ZYZA.mjs.map +1 -0
- package/dist/esm/{chunk-WX6P3Q4I.mjs → chunk-HHGJXVAE.mjs} +2 -2
- package/dist/esm/{chunk-AVSM2BJR.mjs → chunk-HKBBA653.mjs} +2 -2
- package/dist/esm/{chunk-6CHBLB3V.mjs → chunk-HVMFZF6P.mjs} +2 -2
- package/dist/esm/{chunk-ZNC3FRSK.mjs → chunk-IR4SLC2M.mjs} +2 -2
- package/dist/esm/{chunk-GGPA6QTN.mjs → chunk-J64ARI4E.mjs} +2 -2
- package/dist/esm/{chunk-3F3FCWT5.mjs → chunk-JH6VLTMS.mjs} +2 -2
- package/dist/esm/{chunk-ORGMRM5K.mjs → chunk-KUOB4DDE.mjs} +2 -2
- package/dist/esm/{chunk-2XYA7NOU.mjs → chunk-KUZ2YTJH.mjs} +2 -2
- package/dist/esm/{chunk-HBQLX5QF.mjs → chunk-L2QXU6F4.mjs} +2 -2
- package/dist/esm/{chunk-QQU4IQ27.mjs → chunk-LNEZEYYE.mjs} +2 -2
- package/dist/esm/{chunk-53DBMWMU.mjs → chunk-MAMPMCO7.mjs} +2 -2
- package/dist/esm/chunk-MDJ66AA3.mjs +2 -0
- package/dist/esm/chunk-MDJ66AA3.mjs.map +1 -0
- package/dist/esm/{chunk-56F7EYFE.mjs → chunk-MNVUSJEK.mjs} +2 -2
- package/dist/esm/{chunk-SUAA25UP.mjs → chunk-O2BPA6TS.mjs} +2 -2
- package/dist/esm/{chunk-NKDHR2DA.mjs → chunk-OKAQO57B.mjs} +2 -2
- package/dist/esm/chunk-OMV7445F.mjs +2 -0
- package/dist/esm/chunk-OMV7445F.mjs.map +1 -0
- package/dist/esm/chunk-P2EIZ7WL.mjs +2 -0
- package/dist/esm/chunk-P2EIZ7WL.mjs.map +1 -0
- package/dist/esm/{chunk-PDNA4H34.mjs → chunk-P3TAY5PP.mjs} +2 -2
- package/dist/esm/{chunk-EJMPY5MF.mjs → chunk-Q3TAEOH5.mjs} +2 -2
- package/dist/esm/chunk-Q4XR6QOZ.mjs +2 -0
- package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-Q4XR6QOZ.mjs.map} +1 -1
- package/dist/esm/{chunk-MNVDBUF3.mjs → chunk-QBSU3L5Q.mjs} +2 -2
- package/dist/esm/{chunk-3GOJQ5JD.mjs → chunk-QPB6EJVM.mjs} +2 -2
- package/dist/esm/{chunk-KRIIRH5L.mjs → chunk-R76DHMGR.mjs} +2 -2
- package/dist/esm/{chunk-52HZTDBB.mjs → chunk-RXE6NNOL.mjs} +2 -2
- package/dist/esm/chunk-RXE6NNOL.mjs.map +1 -0
- package/dist/esm/{chunk-JUNVPIW4.mjs → chunk-S2KDCIZN.mjs} +2 -2
- package/dist/esm/{chunk-YPQZJ72F.mjs → chunk-S2W4D6NZ.mjs} +2 -2
- package/dist/esm/{chunk-5P7MXLZA.mjs → chunk-SDWE6WMM.mjs} +2 -2
- package/dist/esm/chunk-SRPI2FFA.mjs +2 -0
- package/dist/esm/chunk-SRPI2FFA.mjs.map +1 -0
- package/dist/esm/chunk-STUXKQVZ.mjs +2 -0
- package/dist/esm/chunk-STUXKQVZ.mjs.map +1 -0
- package/dist/esm/{chunk-WLZYSLHP.mjs → chunk-SWNFKKRE.mjs} +2 -2
- package/dist/esm/{chunk-DVIRUFCY.mjs → chunk-TQWGQLM6.mjs} +2 -2
- package/dist/esm/chunk-UAEODDZS.mjs +2 -0
- package/dist/esm/{chunk-ZXVQ2OBJ.mjs.map → chunk-UAEODDZS.mjs.map} +1 -1
- package/dist/esm/{chunk-VYXJ7FUF.mjs → chunk-WJRZWAIS.mjs} +2 -2
- package/dist/esm/{chunk-LFUBUXHD.mjs → chunk-X34JJPW5.mjs} +2 -2
- package/dist/esm/{chunk-EXMQBH3I.mjs → chunk-XMW65WCQ.mjs} +2 -2
- package/dist/esm/chunk-Y2GWUE7C.mjs +2 -0
- package/dist/esm/chunk-Y2GWUE7C.mjs.map +1 -0
- package/dist/esm/chunk-Y3BATGHX.mjs +2 -0
- package/dist/esm/chunk-Y3BATGHX.mjs.map +1 -0
- package/dist/esm/{chunk-54QUDAAC.mjs → chunk-YU3IYJRL.mjs} +2 -2
- package/dist/esm/{chunk-NBO2BDDZ.mjs → chunk-ZROQH5YL.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- 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/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +97 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs +2 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.mts +4 -2
- package/dist/esm/core/crypto/index.mjs +1 -1
- 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 +1 -1
- 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/crypto/utils.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -0
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +6 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +1 -7
- 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 +25 -14
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.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.d.mts +22 -2
- 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.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.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +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 +8 -1
- package/dist/esm/types/index.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/AbstractKeylessAccount.ts +329 -0
- package/src/account/EphemeralKeyPair.ts +9 -2
- package/src/account/FederatedKeylessAccount.ts +116 -0
- package/src/account/KeylessAccount.ts +13 -297
- package/src/account/MultiKeyAccount.ts +4 -2
- package/src/account/index.ts +2 -0
- package/src/api/account.ts +68 -22
- package/src/api/keyless.ts +50 -4
- package/src/api/transaction.ts +40 -20
- package/src/core/crypto/federatedKeyless.ts +134 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +4 -3
- package/src/core/crypto/poseidon.ts +4 -4
- package/src/core/crypto/singleKey.ts +6 -0
- package/src/core/crypto/utils.ts +2 -2
- package/src/internal/account.ts +1 -54
- package/src/internal/keyless.ts +86 -8
- package/src/internal/transactionSubmission.ts +63 -10
- package/src/transactions/transactionBuilder/transactionBuilder.ts +25 -14
- package/src/types/index.ts +7 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-52HZTDBB.mjs.map +0 -1
- package/dist/esm/chunk-7Z6DYLCA.mjs +0 -1
- package/dist/esm/chunk-AQ4I7VVB.mjs +0 -1
- package/dist/esm/chunk-BIGX2RJL.mjs +0 -2
- package/dist/esm/chunk-BIGX2RJL.mjs.map +0 -1
- package/dist/esm/chunk-DCNBMUKN.mjs +0 -2
- package/dist/esm/chunk-DCNBMUKN.mjs.map +0 -1
- package/dist/esm/chunk-EQSON7Y5.mjs +0 -2
- package/dist/esm/chunk-EQSON7Y5.mjs.map +0 -1
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-G773HST5.mjs +0 -2
- package/dist/esm/chunk-G773HST5.mjs.map +0 -1
- package/dist/esm/chunk-IVOEXGOG.mjs +0 -2
- package/dist/esm/chunk-IVOEXGOG.mjs.map +0 -1
- package/dist/esm/chunk-IVVWQKCF.mjs +0 -2
- package/dist/esm/chunk-IVVWQKCF.mjs.map +0 -1
- package/dist/esm/chunk-LJZPPBTH.mjs +0 -2
- package/dist/esm/chunk-LJZPPBTH.mjs.map +0 -1
- package/dist/esm/chunk-QQHA2Y46.mjs.map +0 -1
- package/dist/esm/chunk-SCYGW3VV.mjs +0 -2
- package/dist/esm/chunk-SCYGW3VV.mjs.map +0 -1
- package/dist/esm/chunk-T53MZO2U.mjs +0 -2
- package/dist/esm/chunk-T53MZO2U.mjs.map +0 -1
- package/dist/esm/chunk-VYXS7TLB.mjs +0 -2
- package/dist/esm/chunk-VYXS7TLB.mjs.map +0 -1
- package/dist/esm/chunk-XSTCHOUI.mjs +0 -2
- package/dist/esm/chunk-XSTCHOUI.mjs.map +0 -1
- package/dist/esm/chunk-ZWX3NHGU.mjs +0 -2
- package/dist/esm/chunk-ZWX3NHGU.mjs.map +0 -1
- package/dist/esm/chunk-ZXVQ2OBJ.mjs +0 -2
- /package/dist/esm/{chunk-7Z6DYLCA.mjs.map → account/AbstractKeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-AQ4I7VVB.mjs.map → account/FederatedKeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-OTNGLTKS.mjs.map → chunk-2BTTX2KO.mjs.map} +0 -0
- /package/dist/esm/{chunk-NPFW6ZFY.mjs.map → chunk-2F7Z7RMW.mjs.map} +0 -0
- /package/dist/esm/{chunk-P2EKDA7R.mjs.map → chunk-367OG3DB.mjs.map} +0 -0
- /package/dist/esm/{chunk-5L3UXSQI.mjs.map → chunk-3W2DHZXK.mjs.map} +0 -0
- /package/dist/esm/{chunk-UWPO7WWS.mjs.map → chunk-45IUUCAV.mjs.map} +0 -0
- /package/dist/esm/{chunk-YFMFXRJX.mjs.map → chunk-4HR32TSY.mjs.map} +0 -0
- /package/dist/esm/{chunk-3HTSCV3R.mjs.map → chunk-53RB2PRH.mjs.map} +0 -0
- /package/dist/esm/{chunk-GKERWKMB.mjs.map → chunk-5PCNWXRN.mjs.map} +0 -0
- /package/dist/esm/{chunk-OPTI3MH2.mjs.map → chunk-5VD4MHB3.mjs.map} +0 -0
- /package/dist/esm/{chunk-VTEZ6TBO.mjs.map → chunk-6UZ3VI5Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z2AJWV6D.mjs.map → chunk-7VKFXX5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-GR4PHW7K.mjs.map → chunk-A42BPAD4.mjs.map} +0 -0
- /package/dist/esm/{chunk-2CAGPXCX.mjs.map → chunk-APN6AV5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ENUSVZB.mjs.map → chunk-BSAHPS6E.mjs.map} +0 -0
- /package/dist/esm/{chunk-NDJKEFNU.mjs.map → chunk-BWNTSJOC.mjs.map} +0 -0
- /package/dist/esm/{chunk-LS6G4DZV.mjs.map → chunk-CRA2MFJC.mjs.map} +0 -0
- /package/dist/esm/{chunk-VQVNUN5Y.mjs.map → chunk-D3Q4BC3I.mjs.map} +0 -0
- /package/dist/esm/{chunk-5TBIWC7N.mjs.map → chunk-ELYS7CWV.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZXYTLPP6.mjs.map → chunk-F63E4CR7.mjs.map} +0 -0
- /package/dist/esm/{chunk-JOROI7FE.mjs.map → chunk-F76N4MQO.mjs.map} +0 -0
- /package/dist/esm/{chunk-F5PNGH44.mjs.map → chunk-FZ5EYP3D.mjs.map} +0 -0
- /package/dist/esm/{chunk-O4BBULNE.mjs.map → chunk-GDO6Q2FI.mjs.map} +0 -0
- /package/dist/esm/{chunk-WYQLUB4H.mjs.map → chunk-GDUAFXIQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q7MD4V7H.mjs.map → chunk-GWSDIX6C.mjs.map} +0 -0
- /package/dist/esm/{chunk-WX6P3Q4I.mjs.map → chunk-HHGJXVAE.mjs.map} +0 -0
- /package/dist/esm/{chunk-AVSM2BJR.mjs.map → chunk-HKBBA653.mjs.map} +0 -0
- /package/dist/esm/{chunk-6CHBLB3V.mjs.map → chunk-HVMFZF6P.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNC3FRSK.mjs.map → chunk-IR4SLC2M.mjs.map} +0 -0
- /package/dist/esm/{chunk-GGPA6QTN.mjs.map → chunk-J64ARI4E.mjs.map} +0 -0
- /package/dist/esm/{chunk-3F3FCWT5.mjs.map → chunk-JH6VLTMS.mjs.map} +0 -0
- /package/dist/esm/{chunk-ORGMRM5K.mjs.map → chunk-KUOB4DDE.mjs.map} +0 -0
- /package/dist/esm/{chunk-2XYA7NOU.mjs.map → chunk-KUZ2YTJH.mjs.map} +0 -0
- /package/dist/esm/{chunk-HBQLX5QF.mjs.map → chunk-L2QXU6F4.mjs.map} +0 -0
- /package/dist/esm/{chunk-QQU4IQ27.mjs.map → chunk-LNEZEYYE.mjs.map} +0 -0
- /package/dist/esm/{chunk-53DBMWMU.mjs.map → chunk-MAMPMCO7.mjs.map} +0 -0
- /package/dist/esm/{chunk-56F7EYFE.mjs.map → chunk-MNVUSJEK.mjs.map} +0 -0
- /package/dist/esm/{chunk-SUAA25UP.mjs.map → chunk-O2BPA6TS.mjs.map} +0 -0
- /package/dist/esm/{chunk-NKDHR2DA.mjs.map → chunk-OKAQO57B.mjs.map} +0 -0
- /package/dist/esm/{chunk-PDNA4H34.mjs.map → chunk-P3TAY5PP.mjs.map} +0 -0
- /package/dist/esm/{chunk-EJMPY5MF.mjs.map → chunk-Q3TAEOH5.mjs.map} +0 -0
- /package/dist/esm/{chunk-MNVDBUF3.mjs.map → chunk-QBSU3L5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-3GOJQ5JD.mjs.map → chunk-QPB6EJVM.mjs.map} +0 -0
- /package/dist/esm/{chunk-KRIIRH5L.mjs.map → chunk-R76DHMGR.mjs.map} +0 -0
- /package/dist/esm/{chunk-JUNVPIW4.mjs.map → chunk-S2KDCIZN.mjs.map} +0 -0
- /package/dist/esm/{chunk-YPQZJ72F.mjs.map → chunk-S2W4D6NZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-5P7MXLZA.mjs.map → chunk-SDWE6WMM.mjs.map} +0 -0
- /package/dist/esm/{chunk-WLZYSLHP.mjs.map → chunk-SWNFKKRE.mjs.map} +0 -0
- /package/dist/esm/{chunk-DVIRUFCY.mjs.map → chunk-TQWGQLM6.mjs.map} +0 -0
- /package/dist/esm/{chunk-VYXJ7FUF.mjs.map → chunk-WJRZWAIS.mjs.map} +0 -0
- /package/dist/esm/{chunk-LFUBUXHD.mjs.map → chunk-X34JJPW5.mjs.map} +0 -0
- /package/dist/esm/{chunk-EXMQBH3I.mjs.map → chunk-XMW65WCQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-54QUDAAC.mjs.map → chunk-YU3IYJRL.mjs.map} +0 -0
- /package/dist/esm/{chunk-NBO2BDDZ.mjs.map → chunk-ZROQH5YL.mjs.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s}from"../../chunk-SUJLWCRN.mjs";import"../../chunk-YUNDX5I7.mjs";import"../../chunk-E7FWVXGX.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-WRRQ7L5K.mjs";import"../../chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s}from"../../chunk-SUJLWCRN.mjs";import"../../chunk-YUNDX5I7.mjs";import"../../chunk-E7FWVXGX.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-WRRQ7L5K.mjs";import"../../chunk-HEZ2ZYZA.mjs";import"../../chunk-45IUUCAV.mjs";import"../../chunk-HHGJXVAE.mjs";import"../../chunk-GMBSQDPO.mjs";import"../../chunk-KUX6GQ2E.mjs";import"../../chunk-GDO6Q2FI.mjs";import"../../chunk-BA4RBST6.mjs";import"../../chunk-G5XLMQ5E.mjs";import"../../chunk-SRPI2FFA.mjs";import"../../chunk-MQGW234H.mjs";import"../../chunk-F63E4CR7.mjs";import"../../chunk-GWSDIX6C.mjs";import"../../chunk-MLDQ2TY2.mjs";import"../../chunk-Q4XR6QOZ.mjs";import"../../chunk-76OH2Z4Q.mjs";import"../../chunk-LR65XHSF.mjs";import"../../chunk-G5MGSV7Y.mjs";import"../../chunk-OHRL766V.mjs";import"../../chunk-AH44UPM4.mjs";import"../../chunk-N2FKVZ4D.mjs";import"../../chunk-YU3IYJRL.mjs";import"../../chunk-CRA2MFJC.mjs";import"../../chunk-XMW65WCQ.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-BSUYPXRD.mjs";import"../../chunk-SCHZ67F3.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-LNEZEYYE.mjs";import"../../chunk-YPHH6CAO.mjs";import"../../chunk-P5V7OZNN.mjs";import"../../chunk-H6YNXJNF.mjs";import"../../chunk-44GYWUSH.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-A63SMUOU.mjs";import"../../chunk-BCUSI3N6.mjs";import"../../chunk-LG7RJQ57.mjs";import"../../chunk-TDGQGILY.mjs";import"../../chunk-EXP5STXZ.mjs";import"../../chunk-UAL27G6B.mjs";import"../../chunk-KEYAPEAX.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-UAEODDZS.mjs";import"../../chunk-FVA2OPG4.mjs";export{o as StructTag,a as TypeTag,i as TypeTagAddress,b as TypeTagBool,l as TypeTagGeneric,k as TypeTagReference,j as TypeTagSigner,n as TypeTagStruct,g as TypeTagU128,d as TypeTagU16,h as TypeTagU256,e as TypeTagU32,f as TypeTagU64,c as TypeTagU8,m as TypeTagVector,p as aptosCoinStructTag,s as objectStructTag,r as optionStructTag,q as stringStructTag};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b,c}from"../../chunk-NWOMSL6K.mjs";import"../../chunk-SUJLWCRN.mjs";import"../../chunk-YUNDX5I7.mjs";import"../../chunk-E7FWVXGX.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-WRRQ7L5K.mjs";import"../../chunk-
|
|
1
|
+
import{a,b,c}from"../../chunk-NWOMSL6K.mjs";import"../../chunk-SUJLWCRN.mjs";import"../../chunk-YUNDX5I7.mjs";import"../../chunk-E7FWVXGX.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-WRRQ7L5K.mjs";import"../../chunk-HEZ2ZYZA.mjs";import"../../chunk-45IUUCAV.mjs";import"../../chunk-HHGJXVAE.mjs";import"../../chunk-GMBSQDPO.mjs";import"../../chunk-KUX6GQ2E.mjs";import"../../chunk-GDO6Q2FI.mjs";import"../../chunk-BA4RBST6.mjs";import"../../chunk-G5XLMQ5E.mjs";import"../../chunk-SRPI2FFA.mjs";import"../../chunk-MQGW234H.mjs";import"../../chunk-F63E4CR7.mjs";import"../../chunk-GWSDIX6C.mjs";import"../../chunk-MLDQ2TY2.mjs";import"../../chunk-Q4XR6QOZ.mjs";import"../../chunk-76OH2Z4Q.mjs";import"../../chunk-LR65XHSF.mjs";import"../../chunk-G5MGSV7Y.mjs";import"../../chunk-OHRL766V.mjs";import"../../chunk-AH44UPM4.mjs";import"../../chunk-N2FKVZ4D.mjs";import"../../chunk-YU3IYJRL.mjs";import"../../chunk-CRA2MFJC.mjs";import"../../chunk-XMW65WCQ.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-BSUYPXRD.mjs";import"../../chunk-SCHZ67F3.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-LNEZEYYE.mjs";import"../../chunk-YPHH6CAO.mjs";import"../../chunk-P5V7OZNN.mjs";import"../../chunk-H6YNXJNF.mjs";import"../../chunk-44GYWUSH.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-A63SMUOU.mjs";import"../../chunk-BCUSI3N6.mjs";import"../../chunk-LG7RJQ57.mjs";import"../../chunk-TDGQGILY.mjs";import"../../chunk-EXP5STXZ.mjs";import"../../chunk-UAL27G6B.mjs";import"../../chunk-KEYAPEAX.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-UAEODDZS.mjs";import"../../chunk-FVA2OPG4.mjs";export{b as TypeTagParserError,a as TypeTagParserErrorType,c as parseTypeTag};
|
|
2
2
|
//# sourceMappingURL=parser.mjs.map
|
|
@@ -99,7 +99,8 @@ declare enum AccountAuthenticatorVariant {
|
|
|
99
99
|
declare enum AnyPublicKeyVariant {
|
|
100
100
|
Ed25519 = 0,
|
|
101
101
|
Secp256k1 = 1,
|
|
102
|
-
Keyless = 3
|
|
102
|
+
Keyless = 3,
|
|
103
|
+
FederatedKeyless = 4
|
|
103
104
|
}
|
|
104
105
|
declare enum AnySignatureVariant {
|
|
105
106
|
Ed25519 = 0,
|
|
@@ -822,6 +823,12 @@ type MoveStruct = {
|
|
|
822
823
|
* Whether the struct is a native struct of Move
|
|
823
824
|
*/
|
|
824
825
|
is_native: boolean;
|
|
826
|
+
/**
|
|
827
|
+
* Whether the struct is a module event (aka v2 event). This will be false for v1
|
|
828
|
+
* events because the value is derived from the #[event] attribute on the struct in
|
|
829
|
+
* the Move source code. This attribute is only relevant for v2 events.
|
|
830
|
+
*/
|
|
831
|
+
is_event: boolean;
|
|
825
832
|
/**
|
|
826
833
|
* Abilities associated with the struct
|
|
827
834
|
*/
|
package/dist/esm/types/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A,B,C,D,E,F,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-
|
|
1
|
+
import{A,B,C,D,E,F,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"../chunk-44GYWUSH.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-FVA2OPG4.mjs";export{g as AccountAuthenticatorVariant,h as AnyPublicKeyVariant,i as AnySignatureVariant,F as DeriveScheme,l as EphemeralCertificateVariant,j as EphemeralPublicKeyVariant,k as EphemeralSignatureVariant,a as MimeType,B as MoveAbility,A as MoveFunctionVisibility,C as RoleType,c as ScriptTransactionArgumentVariants,D as SigningScheme,E as SigningSchemeInput,f as TransactionAuthenticatorVariant,d as TransactionPayloadVariants,n as TransactionResponseType,e as TransactionVariants,b as TypeTagVariants,m as ZkpVariant,u as isBlockEpilogueTransactionResponse,r as isBlockMetadataTransactionResponse,v as isEd25519Signature,y as isFeePayerSignature,q as isGenesisTransactionResponse,x as isMultiAgentSignature,z as isMultiEd25519Signature,o as isPendingTransactionResponse,w as isSecp256k1Signature,s as isStateCheckpointTransactionResponse,p as isUserTransactionResponse,t as isValidatorTransactionResponse};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/utils/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunk-HGLO5LDS.mjs";import{a as r}from"../chunk-BSUYPXRD.mjs";import"../chunk-
|
|
1
|
+
import"../chunk-HGLO5LDS.mjs";import{a as r}from"../chunk-BSUYPXRD.mjs";import{a as j,b as k,c as l,d as m,e as n,f as o,g as p,h as q}from"../chunk-SCHZ67F3.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-LNEZEYYE.mjs";import"../chunk-YPHH6CAO.mjs";import"../chunk-P5V7OZNN.mjs";import"../chunk-H6YNXJNF.mjs";import"../chunk-44GYWUSH.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-A63SMUOU.mjs";import"../chunk-BCUSI3N6.mjs";import"../chunk-LG7RJQ57.mjs";import{a,b,c,d,e,f,g,h,i}from"../chunk-EXP5STXZ.mjs";import{a as s,b as t,c as u,d as v,e as w,f as x,g as y,h as z}from"../chunk-UAL27G6B.mjs";import"../chunk-KEYAPEAX.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{e as APTOS_COIN,f as APTOS_FA,a as AptosApiType,b as DEFAULT_MAX_GAS_AMOUNT,c as DEFAULT_TXN_EXP_SEC_FROM_NOW,d as DEFAULT_TXN_TIMEOUT_SEC,o as Network,p as NetworkToChainId,l as NetworkToFaucetAPI,j as NetworkToIndexerAPI,q as NetworkToNetworkName,k as NetworkToNodeAPI,m as NetworkToPepperAPI,n as NetworkToProverAPI,i as ProcessorType,g as RAW_TRANSACTION_SALT,h as RAW_TRANSACTION_WITH_DATA_SALT,v as base64UrlDecode,w as convertAmountFromHumanReadableToOnChain,x as convertAmountFromOnChainToHumanReadable,u as floorToWholeHour,z as isEncodedStruct,r as normalizeBundle,t as nowInSeconds,y as parseEncodedStruct,s as sleep};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-BSUYPXRD.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-
|
|
1
|
+
import{a}from"../chunk-BSUYPXRD.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-LNEZEYYE.mjs";import"../chunk-YPHH6CAO.mjs";import"../chunk-P5V7OZNN.mjs";import"../chunk-H6YNXJNF.mjs";import"../chunk-44GYWUSH.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-A63SMUOU.mjs";import"../chunk-BCUSI3N6.mjs";import"../chunk-LG7RJQ57.mjs";import"../chunk-KEYAPEAX.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-FVA2OPG4.mjs";export{a as normalizeBundle};
|
|
2
2
|
//# sourceMappingURL=normalizeBundle.mjs.map
|
package/dist/esm/version.d.mts
CHANGED
package/dist/esm/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"./chunk-
|
|
1
|
+
import{a}from"./chunk-UAEODDZS.mjs";import"./chunk-FVA2OPG4.mjs";export{a as VERSION};
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/package.json
CHANGED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import EventEmitter from "eventemitter3";
|
|
5
|
+
import { EphemeralCertificateVariant, HexInput, SigningScheme } from "../types";
|
|
6
|
+
import { AccountAddress } from "../core/accountAddress";
|
|
7
|
+
import {
|
|
8
|
+
AnyPublicKey,
|
|
9
|
+
AnySignature,
|
|
10
|
+
KeylessPublicKey,
|
|
11
|
+
KeylessSignature,
|
|
12
|
+
EphemeralCertificate,
|
|
13
|
+
ZeroKnowledgeSig,
|
|
14
|
+
ZkProof,
|
|
15
|
+
} from "../core/crypto";
|
|
16
|
+
|
|
17
|
+
import { Account } from "./Account";
|
|
18
|
+
import { EphemeralKeyPair } from "./EphemeralKeyPair";
|
|
19
|
+
import { Hex } from "../core/hex";
|
|
20
|
+
import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
|
|
21
|
+
import { Serializable, Serializer } from "../bcs";
|
|
22
|
+
import { deriveTransactionType, generateSigningMessage } from "../transactions/transactionBuilder/signingMessage";
|
|
23
|
+
import { AnyRawTransaction, AnyRawTransactionInstance } from "../transactions/types";
|
|
24
|
+
import { base64UrlDecode } from "../utils/helpers";
|
|
25
|
+
import { FederatedKeylessPublicKey } from "../core/crypto/federatedKeyless";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Account implementation for the Keyless authentication scheme. This abstract class is used for standard Keyless Accounts
|
|
29
|
+
* and Federated Keyless Accounts.
|
|
30
|
+
*/
|
|
31
|
+
export abstract class AbstractKeylessAccount extends Serializable implements Account {
|
|
32
|
+
static readonly PEPPER_LENGTH: number = 31;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The KeylessPublicKey associated with the account
|
|
36
|
+
*/
|
|
37
|
+
readonly publicKey: KeylessPublicKey | FederatedKeylessPublicKey;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The EphemeralKeyPair used to generate sign.
|
|
41
|
+
*/
|
|
42
|
+
readonly ephemeralKeyPair: EphemeralKeyPair;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The claim on the JWT to identify a user. This is typically 'sub' or 'email'.
|
|
46
|
+
*/
|
|
47
|
+
readonly uidKey: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The value of the uidKey claim on the JWT. This intended to be a stable user identifier.
|
|
51
|
+
*/
|
|
52
|
+
readonly uidVal: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's
|
|
56
|
+
* OIDC registration with the identity provider.
|
|
57
|
+
*/
|
|
58
|
+
readonly aud: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.
|
|
62
|
+
*/
|
|
63
|
+
readonly pepper: Uint8Array;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Account address associated with the account
|
|
67
|
+
*/
|
|
68
|
+
readonly accountAddress: AccountAddress;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.
|
|
72
|
+
*/
|
|
73
|
+
proof: ZeroKnowledgeSig | undefined;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on
|
|
77
|
+
* fetching the proof.
|
|
78
|
+
*/
|
|
79
|
+
readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Signing scheme used to sign transactions
|
|
83
|
+
*/
|
|
84
|
+
readonly signingScheme: SigningScheme;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The JWT token used to derive the account
|
|
88
|
+
*/
|
|
89
|
+
readonly jwt: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* An event emitter used to assist in handling asynchronous proof fetching.
|
|
93
|
+
*/
|
|
94
|
+
private readonly emitter: EventEmitter<ProofFetchEvents>;
|
|
95
|
+
|
|
96
|
+
// Use the static constructor 'create' instead.
|
|
97
|
+
protected constructor(args: {
|
|
98
|
+
address?: AccountAddress;
|
|
99
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
100
|
+
iss: string;
|
|
101
|
+
uidKey: string;
|
|
102
|
+
uidVal: string;
|
|
103
|
+
aud: string;
|
|
104
|
+
pepper: HexInput;
|
|
105
|
+
proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
106
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
107
|
+
jwt: string;
|
|
108
|
+
}) {
|
|
109
|
+
super();
|
|
110
|
+
const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proof, proofFetchCallback, jwt } = args;
|
|
111
|
+
this.ephemeralKeyPair = ephemeralKeyPair;
|
|
112
|
+
this.publicKey = KeylessPublicKey.create(args);
|
|
113
|
+
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
114
|
+
this.uidKey = uidKey;
|
|
115
|
+
this.uidVal = uidVal;
|
|
116
|
+
this.aud = aud;
|
|
117
|
+
this.jwt = jwt;
|
|
118
|
+
this.emitter = new EventEmitter<ProofFetchEvents>();
|
|
119
|
+
this.proofOrPromise = proof;
|
|
120
|
+
if (proof instanceof ZeroKnowledgeSig) {
|
|
121
|
+
this.proof = proof;
|
|
122
|
+
} else {
|
|
123
|
+
if (proofFetchCallback === undefined) {
|
|
124
|
+
throw new Error("Must provide callback for async proof fetch");
|
|
125
|
+
}
|
|
126
|
+
this.emitter.on("proofFetchFinish", async (status) => {
|
|
127
|
+
await proofFetchCallback(status);
|
|
128
|
+
this.emitter.removeAllListeners();
|
|
129
|
+
});
|
|
130
|
+
this.init(proof);
|
|
131
|
+
}
|
|
132
|
+
this.signingScheme = SigningScheme.SingleKey;
|
|
133
|
+
const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
|
|
134
|
+
if (pepperBytes.length !== AbstractKeylessAccount.PEPPER_LENGTH) {
|
|
135
|
+
throw new Error(`Pepper length in bytes should be ${AbstractKeylessAccount.PEPPER_LENGTH}`);
|
|
136
|
+
}
|
|
137
|
+
this.pepper = pepperBytes;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* This initializes the asyncronous proof fetch
|
|
142
|
+
* @return
|
|
143
|
+
*/
|
|
144
|
+
async init(promise: Promise<ZeroKnowledgeSig>) {
|
|
145
|
+
try {
|
|
146
|
+
this.proof = await promise;
|
|
147
|
+
this.emitter.emit("proofFetchFinish", { status: "Success" });
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (error instanceof Error) {
|
|
150
|
+
this.emitter.emit("proofFetchFinish", { status: "Failed", error: error.toString() });
|
|
151
|
+
} else {
|
|
152
|
+
this.emitter.emit("proofFetchFinish", { status: "Failed", error: "Unknown" });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
serialize(serializer: Serializer): void {
|
|
158
|
+
serializer.serializeStr(this.jwt);
|
|
159
|
+
serializer.serializeStr(this.uidKey);
|
|
160
|
+
serializer.serializeFixedBytes(this.pepper);
|
|
161
|
+
this.ephemeralKeyPair.serialize(serializer);
|
|
162
|
+
if (this.proof === undefined) {
|
|
163
|
+
throw new Error("Cannot serialize - proof undefined");
|
|
164
|
+
}
|
|
165
|
+
this.proof.serialize(serializer);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair
|
|
170
|
+
* and JWT token.
|
|
171
|
+
* @return boolean
|
|
172
|
+
*/
|
|
173
|
+
isExpired(): boolean {
|
|
174
|
+
return this.ephemeralKeyPair.isExpired();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Sign a message using Keyless.
|
|
179
|
+
* @param message the message to sign, as binary input
|
|
180
|
+
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
181
|
+
*/
|
|
182
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
|
|
183
|
+
const signature = new AnySignature(this.sign(message));
|
|
184
|
+
const publicKey = new AnyPublicKey(this.publicKey);
|
|
185
|
+
return new AccountAuthenticatorSingleKey(publicKey, signature);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Sign a transaction using Keyless.
|
|
190
|
+
* @param transaction the raw transaction
|
|
191
|
+
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
|
|
192
|
+
*/
|
|
193
|
+
signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
|
|
194
|
+
const signature = new AnySignature(this.signTransaction(transaction));
|
|
195
|
+
const publicKey = new AnyPublicKey(this.publicKey);
|
|
196
|
+
return new AccountAuthenticatorSingleKey(publicKey, signature);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Waits for asyncronous proof fetching to finish.
|
|
201
|
+
* @return
|
|
202
|
+
*/
|
|
203
|
+
async waitForProofFetch() {
|
|
204
|
+
if (this.proofOrPromise instanceof Promise) {
|
|
205
|
+
await this.proofOrPromise;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Sign the given message using Keyless.
|
|
211
|
+
* @param message in HexInput format
|
|
212
|
+
* @returns Signature
|
|
213
|
+
*/
|
|
214
|
+
sign(message: HexInput): KeylessSignature {
|
|
215
|
+
const { expiryDateSecs } = this.ephemeralKeyPair;
|
|
216
|
+
if (this.isExpired()) {
|
|
217
|
+
throw new Error("EphemeralKeyPair is expired");
|
|
218
|
+
}
|
|
219
|
+
if (this.proof === undefined) {
|
|
220
|
+
throw new Error("Proof not found - make sure to call `await account.waitForProofFetch()` before signing.");
|
|
221
|
+
}
|
|
222
|
+
const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
|
|
223
|
+
const ephemeralSignature = this.ephemeralKeyPair.sign(message);
|
|
224
|
+
|
|
225
|
+
return new KeylessSignature({
|
|
226
|
+
jwtHeader: base64UrlDecode(this.jwt.split(".")[0]),
|
|
227
|
+
ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),
|
|
228
|
+
expiryDateSecs,
|
|
229
|
+
ephemeralPublicKey,
|
|
230
|
+
ephemeralSignature,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Sign the given transaction with Keyless.
|
|
236
|
+
* Signs the transaction and proof to guard against proof malleability.
|
|
237
|
+
* @param transaction the transaction to be signed
|
|
238
|
+
* @returns KeylessSignature
|
|
239
|
+
*/
|
|
240
|
+
signTransaction(transaction: AnyRawTransaction): KeylessSignature {
|
|
241
|
+
if (this.proof === undefined) {
|
|
242
|
+
throw new Error("Proof not found - make sure to call `await account.waitForProofFetch()` before signing.");
|
|
243
|
+
}
|
|
244
|
+
const raw = deriveTransactionType(transaction);
|
|
245
|
+
const txnAndProof = new TransactionAndProof(raw, this.proof.proof);
|
|
246
|
+
const signMess = txnAndProof.hash();
|
|
247
|
+
return this.sign(signMess);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount
|
|
252
|
+
*
|
|
253
|
+
* Verifies a signature given the message.
|
|
254
|
+
*
|
|
255
|
+
* TODO: Groth16 proof verification
|
|
256
|
+
*
|
|
257
|
+
* @param args.message the message that was signed.
|
|
258
|
+
* @param args.signature the KeylessSignature to verify
|
|
259
|
+
* @returns boolean
|
|
260
|
+
*/
|
|
261
|
+
verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {
|
|
262
|
+
const { message, signature } = args;
|
|
263
|
+
if (this.isExpired()) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
if (!this.ephemeralKeyPair.getPublicKey().verifySignature({ message, signature: signature.ephemeralSignature })) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create
|
|
275
|
+
* the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.
|
|
276
|
+
*/
|
|
277
|
+
export class TransactionAndProof extends Serializable {
|
|
278
|
+
/**
|
|
279
|
+
* The transaction to sign.
|
|
280
|
+
*/
|
|
281
|
+
transaction: AnyRawTransactionInstance;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* The zero knowledge proof used in signing the transaction.
|
|
285
|
+
*/
|
|
286
|
+
proof?: ZkProof;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* The domain separator prefix used when hashing.
|
|
290
|
+
*/
|
|
291
|
+
readonly domainSeparator = "APTOS::TransactionAndProof";
|
|
292
|
+
|
|
293
|
+
constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {
|
|
294
|
+
super();
|
|
295
|
+
this.transaction = transaction;
|
|
296
|
+
this.proof = proof;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
serialize(serializer: Serializer): void {
|
|
300
|
+
serializer.serializeFixedBytes(this.transaction.bcsToBytes());
|
|
301
|
+
serializer.serializeOption(this.proof);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core.
|
|
306
|
+
*
|
|
307
|
+
* @returns Uint8Array
|
|
308
|
+
*/
|
|
309
|
+
hash(): Uint8Array {
|
|
310
|
+
return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export type ProofFetchSuccess = {
|
|
315
|
+
status: "Success";
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
export type ProofFetchFailure = {
|
|
319
|
+
status: "Failed";
|
|
320
|
+
error: string;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
export type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;
|
|
324
|
+
|
|
325
|
+
export type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;
|
|
326
|
+
|
|
327
|
+
export interface ProofFetchEvents {
|
|
328
|
+
proofFetchFinish: (status: ProofFetchStatus) => void;
|
|
329
|
+
}
|
|
@@ -3,9 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
import { randomBytes } from "@noble/hashes/utils";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
bytesToBigIntLE,
|
|
8
|
+
padAndPackBytesWithLen,
|
|
9
|
+
poseidonHash,
|
|
10
|
+
Ed25519PrivateKey,
|
|
11
|
+
EphemeralPublicKey,
|
|
12
|
+
EphemeralSignature,
|
|
13
|
+
PrivateKey,
|
|
14
|
+
} from "../core/crypto";
|
|
7
15
|
import { Hex } from "../core/hex";
|
|
8
|
-
import { bytesToBigIntLE, padAndPackBytesWithLen, poseidonHash } from "../core/crypto/poseidon";
|
|
9
16
|
import { EphemeralPublicKeyVariant, HexInput } from "../types";
|
|
10
17
|
import { Deserializer, Serializable, Serializer } from "../bcs";
|
|
11
18
|
import { floorToWholeHour, nowInSeconds } from "../utils/helpers";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { JwtPayload, jwtDecode } from "jwt-decode";
|
|
5
|
+
import { HexInput } from "../types";
|
|
6
|
+
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
7
|
+
import { ZeroKnowledgeSig } from "../core/crypto";
|
|
8
|
+
|
|
9
|
+
import { EphemeralKeyPair } from "./EphemeralKeyPair";
|
|
10
|
+
import { Deserializer, Serializer } from "../bcs";
|
|
11
|
+
import { FederatedKeylessPublicKey } from "../core/crypto/federatedKeyless";
|
|
12
|
+
import { AbstractKeylessAccount, ProofFetchCallback } from "./AbstractKeylessAccount";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Account implementation for the FederatedKeyless authentication scheme.
|
|
16
|
+
*
|
|
17
|
+
* Used to represent a FederatedKeyless based account and sign transactions with it.
|
|
18
|
+
*
|
|
19
|
+
* Use FederatedKeylessAccount.create to instantiate a KeylessAccount with a JWT, proof, EphemeralKeyPair and the
|
|
20
|
+
* address the JWKs are installed that will be used to verify the JWT.
|
|
21
|
+
*
|
|
22
|
+
* When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,
|
|
23
|
+
* EphemeralKeyPair, and corresponding proof.
|
|
24
|
+
*/
|
|
25
|
+
export class FederatedKeylessAccount extends AbstractKeylessAccount {
|
|
26
|
+
/**
|
|
27
|
+
* The FederatedKeylessPublicKey associated with the account
|
|
28
|
+
*/
|
|
29
|
+
readonly publicKey: FederatedKeylessPublicKey;
|
|
30
|
+
|
|
31
|
+
// Use the static constructor 'create' instead.
|
|
32
|
+
private constructor(args: {
|
|
33
|
+
address?: AccountAddress;
|
|
34
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
35
|
+
iss: string;
|
|
36
|
+
uidKey: string;
|
|
37
|
+
uidVal: string;
|
|
38
|
+
aud: string;
|
|
39
|
+
pepper: HexInput;
|
|
40
|
+
jwkAddress: AccountAddress;
|
|
41
|
+
proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
42
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
43
|
+
jwt: string;
|
|
44
|
+
}) {
|
|
45
|
+
super(args);
|
|
46
|
+
this.publicKey = FederatedKeylessPublicKey.create(args);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
serialize(serializer: Serializer): void {
|
|
50
|
+
if (this.proof === undefined) {
|
|
51
|
+
throw new Error("Cannot serialize - proof undefined");
|
|
52
|
+
}
|
|
53
|
+
serializer.serializeStr(this.jwt);
|
|
54
|
+
serializer.serializeStr(this.uidKey);
|
|
55
|
+
serializer.serializeFixedBytes(this.pepper);
|
|
56
|
+
this.publicKey.jwkAddress.serialize(serializer);
|
|
57
|
+
this.ephemeralKeyPair.serialize(serializer);
|
|
58
|
+
this.proof.serialize(serializer);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static deserialize(deserializer: Deserializer): FederatedKeylessAccount {
|
|
62
|
+
const jwt = deserializer.deserializeStr();
|
|
63
|
+
const uidKey = deserializer.deserializeStr();
|
|
64
|
+
const pepper = deserializer.deserializeFixedBytes(31);
|
|
65
|
+
const jwkAddress = AccountAddress.deserialize(deserializer);
|
|
66
|
+
const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);
|
|
67
|
+
const proof = ZeroKnowledgeSig.deserialize(deserializer);
|
|
68
|
+
return FederatedKeylessAccount.create({
|
|
69
|
+
proof,
|
|
70
|
+
pepper,
|
|
71
|
+
jwkAddress,
|
|
72
|
+
uidKey,
|
|
73
|
+
jwt,
|
|
74
|
+
ephemeralKeyPair,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static fromBytes(bytes: Uint8Array): FederatedKeylessAccount {
|
|
79
|
+
return FederatedKeylessAccount.deserialize(new Deserializer(bytes));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static create(args: {
|
|
83
|
+
address?: AccountAddress;
|
|
84
|
+
proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
85
|
+
jwt: string;
|
|
86
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
87
|
+
pepper: HexInput;
|
|
88
|
+
jwkAddress: AccountAddressInput;
|
|
89
|
+
uidKey?: string;
|
|
90
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
91
|
+
}): FederatedKeylessAccount {
|
|
92
|
+
const { address, proof, jwt, ephemeralKeyPair, pepper, jwkAddress, uidKey = "sub", proofFetchCallback } = args;
|
|
93
|
+
|
|
94
|
+
const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);
|
|
95
|
+
if (typeof jwtPayload.iss !== "string") {
|
|
96
|
+
throw new Error("iss was not found");
|
|
97
|
+
}
|
|
98
|
+
if (typeof jwtPayload.aud !== "string") {
|
|
99
|
+
throw new Error("aud was not found or an array of values");
|
|
100
|
+
}
|
|
101
|
+
const uidVal = jwtPayload[uidKey];
|
|
102
|
+
return new FederatedKeylessAccount({
|
|
103
|
+
address,
|
|
104
|
+
proof,
|
|
105
|
+
ephemeralKeyPair,
|
|
106
|
+
iss: jwtPayload.iss,
|
|
107
|
+
uidKey,
|
|
108
|
+
uidVal,
|
|
109
|
+
aud: jwtPayload.aud,
|
|
110
|
+
pepper,
|
|
111
|
+
jwkAddress: AccountAddress.from(jwkAddress),
|
|
112
|
+
jwt,
|
|
113
|
+
proofFetchCallback,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|