@aptos-labs/ts-sdk 1.13.2 → 1.13.3-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/index.d.ts +1800 -1346
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account--qjfup2u.d.mts → Ed25519Account-8gJF5t3F.d.mts} +10 -12
- package/dist/esm/account/Account.d.mts +34 -0
- package/dist/esm/account/Account.mjs +2 -0
- package/dist/esm/account/Ed25519Account.d.mts +34 -0
- package/dist/esm/account/Ed25519Account.mjs +2 -0
- package/dist/esm/account/EphemeralKeyPair.d.mts +47 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +106 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +99 -0
- package/dist/esm/account/MultiKeyAccount.mjs +2 -0
- package/dist/esm/account/SingleKeyAccount.d.mts +34 -0
- package/dist/esm/account/SingleKeyAccount.mjs +2 -0
- package/dist/esm/account/index.d.mts +40 -0
- package/dist/esm/account/index.mjs +2 -0
- package/dist/esm/api/account.d.mts +13 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +14 -8
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +20 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +7 -7
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +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.d.mts +5 -5
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +7 -7
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +13 -8
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +67 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +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.d.mts +6 -6
- 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/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 +2 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/chunk-2Q6K4CLJ.mjs +2 -0
- package/dist/esm/chunk-2Q6K4CLJ.mjs.map +1 -0
- package/dist/esm/chunk-2YDIOWRJ.mjs +2 -0
- package/dist/esm/chunk-2YDIOWRJ.mjs.map +1 -0
- package/dist/esm/{chunk-2PFN7LYP.mjs → chunk-33WBJV5U.mjs} +2 -2
- package/dist/esm/{chunk-PIOHC246.mjs → chunk-37CYBCWS.mjs} +2 -2
- package/dist/esm/chunk-37CYBCWS.mjs.map +1 -0
- package/dist/esm/{chunk-TBMAJ6AW.mjs → chunk-3FVRXELT.mjs} +2 -2
- package/dist/esm/{chunk-GS5J57UA.mjs → chunk-3QHRPREO.mjs} +2 -2
- package/dist/esm/chunk-3QHRPREO.mjs.map +1 -0
- package/dist/esm/{chunk-DMKUAQB7.mjs → chunk-3VGX3TXH.mjs} +2 -2
- package/dist/esm/{chunk-PJLCPRYJ.mjs → chunk-3YNRBMPS.mjs} +2 -2
- package/dist/esm/chunk-4NMDYPUD.mjs +1 -0
- package/dist/esm/chunk-4NMDYPUD.mjs.map +1 -0
- package/dist/esm/chunk-4XB3D2ZD.mjs +2 -0
- package/dist/esm/chunk-4XB3D2ZD.mjs.map +1 -0
- package/dist/esm/chunk-5QBTBH64.mjs +2 -0
- package/dist/esm/chunk-5VSMDXZ6.mjs +2 -0
- package/dist/esm/chunk-5VSMDXZ6.mjs.map +1 -0
- package/dist/esm/{chunk-A556OVZY.mjs → chunk-6CQH7JPF.mjs} +2 -2
- package/dist/esm/chunk-6GQAHQGW.mjs +2 -0
- package/dist/esm/chunk-6GQAHQGW.mjs.map +1 -0
- package/dist/esm/chunk-6J3CB3DN.mjs +2 -0
- package/dist/esm/chunk-6J3CB3DN.mjs.map +1 -0
- package/dist/esm/chunk-6M6XXPQQ.mjs +2 -0
- package/dist/esm/chunk-6M6XXPQQ.mjs.map +1 -0
- package/dist/esm/{chunk-QIAHBEEW.mjs → chunk-6RBUXB5I.mjs} +2 -2
- package/dist/esm/{chunk-FXNFWLQC.mjs → chunk-7H3HRFVM.mjs} +2 -2
- package/dist/esm/chunk-7JNPSNL6.mjs +2 -0
- package/dist/esm/chunk-7JNPSNL6.mjs.map +1 -0
- package/dist/esm/{chunk-NPFNYP75.mjs → chunk-7STYQ5ZE.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- package/dist/esm/{chunk-4LMAVPA4.mjs → chunk-A7L2Z5DW.mjs} +2 -2
- package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
- package/dist/esm/{chunk-ZYYK3UXP.mjs → chunk-C3L4ETUF.mjs} +2 -2
- package/dist/esm/chunk-CHQ6IKE3.mjs +2 -0
- package/dist/esm/{chunk-MNBYKY5P.mjs.map → chunk-CHQ6IKE3.mjs.map} +1 -1
- package/dist/esm/{chunk-WFZDFFBM.mjs → chunk-COW5IGYC.mjs} +2 -2
- package/dist/esm/{chunk-RQEWIZ67.mjs → chunk-DIBNAYZ2.mjs} +2 -2
- package/dist/esm/chunk-DMKFITUM.mjs +2 -0
- package/dist/esm/chunk-DMKFITUM.mjs.map +1 -0
- package/dist/esm/{chunk-TORRTLWV.mjs → chunk-DOCYCNXV.mjs} +2 -2
- package/dist/esm/chunk-DOCYCNXV.mjs.map +1 -0
- package/dist/esm/{chunk-TGG7SWBO.mjs → chunk-DX62SMGM.mjs} +2 -2
- package/dist/esm/chunk-DX62SMGM.mjs.map +1 -0
- package/dist/esm/{chunk-FS3NSGBF.mjs → chunk-EB7AI4B4.mjs} +2 -2
- package/dist/esm/chunk-EFRNRARV.mjs +2 -0
- package/dist/esm/chunk-EFRNRARV.mjs.map +1 -0
- package/dist/esm/chunk-EKOIHFAW.mjs +2 -0
- package/dist/esm/{chunk-B252RJCU.mjs.map → chunk-EKOIHFAW.mjs.map} +1 -1
- package/dist/esm/chunk-FLYEALDB.mjs +2 -0
- package/dist/esm/chunk-FLYEALDB.mjs.map +1 -0
- package/dist/esm/{chunk-YKVKSNH4.mjs → chunk-GI52SX32.mjs} +2 -2
- package/dist/esm/{chunk-3RUY5FQK.mjs → chunk-GKCO5PQJ.mjs} +2 -2
- package/dist/esm/chunk-GKCO5PQJ.mjs.map +1 -0
- package/dist/esm/{chunk-UML2VQZT.mjs → chunk-HGZGTBA4.mjs} +2 -2
- package/dist/esm/chunk-HJULFJXF.mjs +2 -0
- package/dist/esm/chunk-HJULFJXF.mjs.map +1 -0
- package/dist/esm/{chunk-TGXZVNR5.mjs → chunk-IEZO4PIG.mjs} +2 -2
- package/dist/esm/{chunk-UMFJDDYI.mjs → chunk-IM32PZOD.mjs} +2 -2
- package/dist/esm/chunk-IM32PZOD.mjs.map +1 -0
- package/dist/esm/chunk-IOVRZ2CA.mjs +2 -0
- package/dist/esm/chunk-IOVRZ2CA.mjs.map +1 -0
- package/dist/esm/chunk-ITEV72BZ.mjs +2 -0
- package/dist/esm/chunk-ITEV72BZ.mjs.map +1 -0
- package/dist/esm/chunk-JXCZTOYC.mjs +1 -0
- package/dist/esm/chunk-JXCZTOYC.mjs.map +1 -0
- package/dist/esm/{chunk-KDCHX7BI.mjs → chunk-KFJMLLOA.mjs} +2 -2
- package/dist/esm/chunk-KGJITNRZ.mjs +2 -0
- package/dist/esm/chunk-KGJITNRZ.mjs.map +1 -0
- package/dist/esm/chunk-KOCKKI4F.mjs +2 -0
- package/dist/esm/{chunk-YBEF3UR3.mjs → chunk-LV7OW245.mjs} +2 -2
- package/dist/esm/{chunk-DSTKXJMA.mjs → chunk-MGOHPDX4.mjs} +2 -2
- package/dist/esm/{chunk-BBU2EE6D.mjs → chunk-MJGZJL3W.mjs} +2 -2
- package/dist/esm/{chunk-UPIN5AIO.mjs → chunk-MKUAW7KW.mjs} +2 -2
- package/dist/esm/{chunk-BWFJHFBQ.mjs → chunk-MWUJCP27.mjs} +2 -2
- package/dist/esm/{chunk-QTRYMRYK.mjs → chunk-NC5HHEEM.mjs} +2 -2
- package/dist/esm/{chunk-6MG4JAYB.mjs → chunk-NPNAKSCR.mjs} +2 -2
- package/dist/esm/chunk-NWLZDI2I.mjs +2 -0
- package/dist/esm/chunk-NWLZDI2I.mjs.map +1 -0
- package/dist/esm/{chunk-6IGEUEER.mjs → chunk-ODTNF2YP.mjs} +2 -2
- package/dist/esm/{chunk-LV2V23Z6.mjs → chunk-OKG6X5TX.mjs} +2 -2
- package/dist/esm/chunk-OKG6X5TX.mjs.map +1 -0
- package/dist/esm/chunk-OKRUEVF3.mjs +2 -0
- package/dist/esm/chunk-OKRUEVF3.mjs.map +1 -0
- package/dist/esm/chunk-OYTLWUQT.mjs +2 -0
- package/dist/esm/chunk-OYTLWUQT.mjs.map +1 -0
- package/dist/esm/chunk-P5VCS2F5.mjs +2 -0
- package/dist/esm/chunk-P5VCS2F5.mjs.map +1 -0
- package/dist/esm/{chunk-U43IJHQN.mjs → chunk-PFFAQZHT.mjs} +2 -2
- package/dist/esm/{chunk-3HV2C4SS.mjs → chunk-PTIZKRON.mjs} +2 -2
- package/dist/esm/chunk-R4UIPTBH.mjs +2 -0
- package/dist/esm/chunk-R4UIPTBH.mjs.map +1 -0
- package/dist/esm/chunk-R7BAM2G6.mjs +2 -0
- package/dist/esm/chunk-R7BAM2G6.mjs.map +1 -0
- package/dist/esm/{chunk-GXYS45Y5.mjs → chunk-RDNPWCZ4.mjs} +2 -2
- package/dist/esm/chunk-RFSO3JRG.mjs +1 -0
- package/dist/esm/chunk-RFSO3JRG.mjs.map +1 -0
- package/dist/esm/chunk-S5HG2QUD.mjs +2 -0
- package/dist/esm/chunk-S5HG2QUD.mjs.map +1 -0
- package/dist/esm/chunk-SA7MZPM3.mjs +2 -0
- package/dist/esm/chunk-SA7MZPM3.mjs.map +1 -0
- package/dist/esm/{chunk-R5QUBEH6.mjs → chunk-STYDBDYL.mjs} +2 -2
- package/dist/esm/{chunk-IOSQVDZI.mjs → chunk-T23OVRNF.mjs} +2 -2
- package/dist/esm/{chunk-BRQYARQ3.mjs → chunk-T7JIGO3O.mjs} +2 -2
- package/dist/esm/{chunk-4DNVCOW7.mjs → chunk-TFJCMFKE.mjs} +2 -2
- package/dist/esm/chunk-TFJCMFKE.mjs.map +1 -0
- package/dist/esm/{chunk-3QBZU5ZD.mjs → chunk-TV64AINP.mjs} +2 -2
- package/dist/esm/chunk-TV64AINP.mjs.map +1 -0
- package/dist/esm/{chunk-52C73T26.mjs → chunk-TVRJ3M7B.mjs} +2 -2
- package/dist/esm/{chunk-52C73T26.mjs.map → chunk-TVRJ3M7B.mjs.map} +1 -1
- package/dist/esm/{chunk-GRT5PHL6.mjs → chunk-UKJUHLZW.mjs} +2 -2
- package/dist/esm/chunk-VTX77UM3.mjs +2 -0
- package/dist/esm/chunk-VTX77UM3.mjs.map +1 -0
- package/dist/esm/{chunk-BAV4XY7C.mjs → chunk-W637YAND.mjs} +2 -2
- package/dist/esm/chunk-WPVBC4JS.mjs +2 -0
- package/dist/esm/chunk-WPVBC4JS.mjs.map +1 -0
- package/dist/esm/chunk-WTVN3XGK.mjs +2 -0
- package/dist/esm/chunk-WTVN3XGK.mjs.map +1 -0
- package/dist/esm/chunk-X7GVXVT4.mjs +2 -0
- package/dist/esm/{chunk-IZT6OX3R.mjs.map → chunk-X7GVXVT4.mjs.map} +1 -1
- package/dist/esm/{chunk-XLPVG4XR.mjs → chunk-XHPLLMR5.mjs} +2 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/{chunk-QWRH22H4.mjs → chunk-YGB7MEH3.mjs} +2 -2
- package/dist/esm/chunk-YH6UKGIX.mjs +2 -0
- package/dist/esm/chunk-YH6UKGIX.mjs.map +1 -0
- package/dist/esm/{chunk-EJCKCYYI.mjs → chunk-YI7FZPIK.mjs} +2 -2
- package/dist/esm/{chunk-OGHE4AQA.mjs → chunk-Z2ZR4PTF.mjs} +2 -2
- package/dist/esm/{chunk-TC3VVMPY.mjs → chunk-ZGTJMNZG.mjs} +2 -2
- package/dist/esm/{chunk-RHBCVCOS.mjs → chunk-ZNEBMSNC.mjs} +2 -2
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +2 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +2 -2
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +3 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +5 -14
- 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.d.mts +0 -10
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +77 -0
- package/dist/esm/core/crypto/ephemeral.mjs +2 -0
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
- package/dist/esm/core/crypto/hdKey.d.mts +15 -1
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +7 -5
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +217 -0
- package/dist/esm/core/crypto/keyless.mjs +2 -0
- package/dist/esm/core/crypto/keyless.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +4 -3
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +7 -0
- package/dist/esm/core/crypto/poseidon.mjs +2 -0
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
- package/dist/esm/core/crypto/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 +6 -7
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +17 -11
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +14 -2
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +7 -7
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +5 -5
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +67 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/staking.d.mts +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +7 -7
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +3 -4
- 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 +3 -3
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +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.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +13 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +47 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +13 -25
- 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/transactions/types.d.mts +7 -7
- package/dist/esm/types/index.d.mts +17 -3
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +14 -0
- package/dist/esm/types/keyless.mjs +1 -0
- package/dist/esm/types/keyless.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.mts +3 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +3 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +7 -2
- package/src/{core/account → account}/Account.ts +12 -16
- package/src/{core/account → account}/Ed25519Account.ts +13 -7
- package/src/account/EphemeralKeyPair.ts +123 -0
- package/src/account/KeylessAccount.ts +299 -0
- package/src/account/MultiKeyAccount.ts +119 -0
- package/src/{core/account → account}/SingleKeyAccount.ts +13 -8
- package/src/account/index.ts +6 -0
- package/src/api/account.ts +2 -1
- package/src/api/ans.ts +2 -1
- package/src/api/aptos.ts +6 -0
- package/src/api/aptosConfig.ts +46 -1
- package/src/api/digitalAsset.ts +2 -1
- package/src/api/fungibleAsset.ts +2 -1
- package/src/api/keyless.ts +35 -0
- package/src/api/transaction.ts +2 -1
- package/src/api/transactionSubmission/management.ts +1 -1
- package/src/api/transactionSubmission/sign.ts +1 -1
- package/src/bcs/serializer.ts +18 -0
- package/src/client/core.ts +8 -0
- package/src/client/get.ts +6 -0
- package/src/client/post.ts +12 -0
- package/src/core/account/index.ts +1 -3
- package/src/core/crypto/ed25519.ts +4 -24
- package/src/core/crypto/ephemeral.ts +149 -0
- package/src/core/crypto/hdKey.ts +31 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +508 -0
- package/src/core/crypto/multiKey.ts +21 -11
- package/src/core/crypto/poseidon.ts +134 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/core/index.ts +0 -1
- package/src/index.ts +1 -0
- package/src/internal/account.ts +1 -1
- package/src/internal/ans.ts +2 -1
- package/src/internal/digitalAsset.ts +2 -1
- package/src/internal/fungibleAsset.ts +2 -1
- package/src/internal/keyless.ts +188 -0
- package/src/internal/transactionSubmission.ts +8 -7
- package/src/transactions/authenticator/account.ts +6 -11
- package/src/transactions/instances/index.ts +1 -0
- package/src/transactions/management/accountSequenceNumber.ts +1 -1
- package/src/transactions/management/transactionWorker.ts +8 -2
- package/src/transactions/transactionBuilder/index.ts +1 -0
- package/src/transactions/transactionBuilder/signingMessage.ts +70 -0
- package/src/transactions/transactionBuilder/transactionBuilder.ts +41 -70
- package/src/types/index.ts +19 -0
- package/src/types/keyless.ts +6 -0
- package/src/utils/apiEndpoints.ts +14 -0
- package/src/utils/const.ts +2 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-3426VLAZ.mjs +0 -2
- package/dist/esm/chunk-3426VLAZ.mjs.map +0 -1
- package/dist/esm/chunk-3OCTOB2E.mjs +0 -2
- package/dist/esm/chunk-3OCTOB2E.mjs.map +0 -1
- package/dist/esm/chunk-3QBZU5ZD.mjs.map +0 -1
- package/dist/esm/chunk-3RUY5FQK.mjs.map +0 -1
- package/dist/esm/chunk-4DNVCOW7.mjs.map +0 -1
- package/dist/esm/chunk-5HALZ6JC.mjs +0 -2
- package/dist/esm/chunk-5HALZ6JC.mjs.map +0 -1
- package/dist/esm/chunk-5OM4V4DR.mjs +0 -2
- package/dist/esm/chunk-5TMLAKSH.mjs +0 -2
- package/dist/esm/chunk-5TMLAKSH.mjs.map +0 -1
- package/dist/esm/chunk-B252RJCU.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
- package/dist/esm/chunk-FO6ZKE7A.mjs +0 -2
- package/dist/esm/chunk-FO6ZKE7A.mjs.map +0 -1
- package/dist/esm/chunk-GMQQSSEO.mjs +0 -2
- package/dist/esm/chunk-GMQQSSEO.mjs.map +0 -1
- package/dist/esm/chunk-GNQXMS53.mjs +0 -2
- package/dist/esm/chunk-GNQXMS53.mjs.map +0 -1
- package/dist/esm/chunk-GS5J57UA.mjs.map +0 -1
- package/dist/esm/chunk-HLVMEUWD.mjs +0 -2
- package/dist/esm/chunk-HLVMEUWD.mjs.map +0 -1
- package/dist/esm/chunk-HQSLBTW5.mjs +0 -2
- package/dist/esm/chunk-HQSLBTW5.mjs.map +0 -1
- package/dist/esm/chunk-ICXA3DZH.mjs +0 -1
- package/dist/esm/chunk-IZT6OX3R.mjs +0 -2
- package/dist/esm/chunk-KHOHRD2B.mjs +0 -2
- package/dist/esm/chunk-KHOHRD2B.mjs.map +0 -1
- package/dist/esm/chunk-L6PGWGFF.mjs +0 -2
- package/dist/esm/chunk-LR65XHSF.mjs +0 -2
- package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
- package/dist/esm/chunk-LV2V23Z6.mjs.map +0 -1
- package/dist/esm/chunk-MLWIHWNH.mjs +0 -1
- package/dist/esm/chunk-MNBYKY5P.mjs +0 -2
- package/dist/esm/chunk-OVJQWQ2N.mjs +0 -2
- package/dist/esm/chunk-OVJQWQ2N.mjs.map +0 -1
- package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
- package/dist/esm/chunk-PIOHC246.mjs.map +0 -1
- package/dist/esm/chunk-R7G3CLRI.mjs +0 -1
- package/dist/esm/chunk-TGG7SWBO.mjs.map +0 -1
- package/dist/esm/chunk-TORRTLWV.mjs.map +0 -1
- package/dist/esm/chunk-TQR7M73S.mjs +0 -2
- package/dist/esm/chunk-TQR7M73S.mjs.map +0 -1
- package/dist/esm/chunk-UMFJDDYI.mjs.map +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-VNO4VHJN.mjs +0 -2
- package/dist/esm/chunk-VNO4VHJN.mjs.map +0 -1
- package/dist/esm/chunk-WBOLHLPX.mjs +0 -2
- package/dist/esm/chunk-WBOLHLPX.mjs.map +0 -1
- package/dist/esm/chunk-XDGQTMDV.mjs +0 -2
- package/dist/esm/chunk-XDGQTMDV.mjs.map +0 -1
- package/dist/esm/chunk-YVSU6GOA.mjs +0 -2
- package/dist/esm/chunk-YVSU6GOA.mjs.map +0 -1
- package/dist/esm/core/account/Account.d.mts +0 -20
- package/dist/esm/core/account/Account.mjs +0 -2
- package/dist/esm/core/account/Ed25519Account.d.mts +0 -20
- package/dist/esm/core/account/Ed25519Account.mjs +0 -2
- package/dist/esm/core/account/SingleKeyAccount.d.mts +0 -20
- package/dist/esm/core/account/SingleKeyAccount.mjs +0 -2
- /package/dist/esm/{core/account → account}/Account.mjs.map +0 -0
- /package/dist/esm/{core/account → account}/Ed25519Account.mjs.map +0 -0
- /package/dist/esm/{chunk-E7FWVXGX.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
- /package/dist/esm/{chunk-ICXA3DZH.mjs.map → account/KeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-MLWIHWNH.mjs.map → account/MultiKeyAccount.mjs.map} +0 -0
- /package/dist/esm/{core/account → account}/SingleKeyAccount.mjs.map +0 -0
- /package/dist/esm/{chunk-R7G3CLRI.mjs.map → account/index.mjs.map} +0 -0
- /package/dist/esm/{chunk-UVSRX4SV.mjs.map → api/keyless.mjs.map} +0 -0
- /package/dist/esm/{chunk-2PFN7LYP.mjs.map → chunk-33WBJV5U.mjs.map} +0 -0
- /package/dist/esm/{chunk-TBMAJ6AW.mjs.map → chunk-3FVRXELT.mjs.map} +0 -0
- /package/dist/esm/{chunk-DMKUAQB7.mjs.map → chunk-3VGX3TXH.mjs.map} +0 -0
- /package/dist/esm/{chunk-PJLCPRYJ.mjs.map → chunk-3YNRBMPS.mjs.map} +0 -0
- /package/dist/esm/{chunk-5OM4V4DR.mjs.map → chunk-5QBTBH64.mjs.map} +0 -0
- /package/dist/esm/{chunk-A556OVZY.mjs.map → chunk-6CQH7JPF.mjs.map} +0 -0
- /package/dist/esm/{chunk-QIAHBEEW.mjs.map → chunk-6RBUXB5I.mjs.map} +0 -0
- /package/dist/esm/{chunk-FXNFWLQC.mjs.map → chunk-7H3HRFVM.mjs.map} +0 -0
- /package/dist/esm/{chunk-NPFNYP75.mjs.map → chunk-7STYQ5ZE.mjs.map} +0 -0
- /package/dist/esm/{chunk-4LMAVPA4.mjs.map → chunk-A7L2Z5DW.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZYYK3UXP.mjs.map → chunk-C3L4ETUF.mjs.map} +0 -0
- /package/dist/esm/{chunk-WFZDFFBM.mjs.map → chunk-COW5IGYC.mjs.map} +0 -0
- /package/dist/esm/{chunk-RQEWIZ67.mjs.map → chunk-DIBNAYZ2.mjs.map} +0 -0
- /package/dist/esm/{chunk-FS3NSGBF.mjs.map → chunk-EB7AI4B4.mjs.map} +0 -0
- /package/dist/esm/{chunk-YKVKSNH4.mjs.map → chunk-GI52SX32.mjs.map} +0 -0
- /package/dist/esm/{chunk-UML2VQZT.mjs.map → chunk-HGZGTBA4.mjs.map} +0 -0
- /package/dist/esm/{chunk-TGXZVNR5.mjs.map → chunk-IEZO4PIG.mjs.map} +0 -0
- /package/dist/esm/{chunk-KDCHX7BI.mjs.map → chunk-KFJMLLOA.mjs.map} +0 -0
- /package/dist/esm/{chunk-L6PGWGFF.mjs.map → chunk-KOCKKI4F.mjs.map} +0 -0
- /package/dist/esm/{chunk-YBEF3UR3.mjs.map → chunk-LV7OW245.mjs.map} +0 -0
- /package/dist/esm/{chunk-DSTKXJMA.mjs.map → chunk-MGOHPDX4.mjs.map} +0 -0
- /package/dist/esm/{chunk-BBU2EE6D.mjs.map → chunk-MJGZJL3W.mjs.map} +0 -0
- /package/dist/esm/{chunk-UPIN5AIO.mjs.map → chunk-MKUAW7KW.mjs.map} +0 -0
- /package/dist/esm/{chunk-BWFJHFBQ.mjs.map → chunk-MWUJCP27.mjs.map} +0 -0
- /package/dist/esm/{chunk-QTRYMRYK.mjs.map → chunk-NC5HHEEM.mjs.map} +0 -0
- /package/dist/esm/{chunk-6MG4JAYB.mjs.map → chunk-NPNAKSCR.mjs.map} +0 -0
- /package/dist/esm/{chunk-6IGEUEER.mjs.map → chunk-ODTNF2YP.mjs.map} +0 -0
- /package/dist/esm/{chunk-U43IJHQN.mjs.map → chunk-PFFAQZHT.mjs.map} +0 -0
- /package/dist/esm/{chunk-3HV2C4SS.mjs.map → chunk-PTIZKRON.mjs.map} +0 -0
- /package/dist/esm/{chunk-GXYS45Y5.mjs.map → chunk-RDNPWCZ4.mjs.map} +0 -0
- /package/dist/esm/{chunk-R5QUBEH6.mjs.map → chunk-STYDBDYL.mjs.map} +0 -0
- /package/dist/esm/{chunk-IOSQVDZI.mjs.map → chunk-T23OVRNF.mjs.map} +0 -0
- /package/dist/esm/{chunk-BRQYARQ3.mjs.map → chunk-T7JIGO3O.mjs.map} +0 -0
- /package/dist/esm/{chunk-GRT5PHL6.mjs.map → chunk-UKJUHLZW.mjs.map} +0 -0
- /package/dist/esm/{chunk-BAV4XY7C.mjs.map → chunk-W637YAND.mjs.map} +0 -0
- /package/dist/esm/{chunk-XLPVG4XR.mjs.map → chunk-XHPLLMR5.mjs.map} +0 -0
- /package/dist/esm/{chunk-QWRH22H4.mjs.map → chunk-YGB7MEH3.mjs.map} +0 -0
- /package/dist/esm/{chunk-EJCKCYYI.mjs.map → chunk-YI7FZPIK.mjs.map} +0 -0
- /package/dist/esm/{chunk-OGHE4AQA.mjs.map → chunk-Z2ZR4PTF.mjs.map} +0 -0
- /package/dist/esm/{chunk-TC3VVMPY.mjs.map → chunk-ZGTJMNZG.mjs.map} +0 -0
- /package/dist/esm/{chunk-RHBCVCOS.mjs.map → chunk-ZNEBMSNC.mjs.map} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { AccountAuthenticator } from "
|
|
2
|
-
import { HexInput, SigningScheme, SigningSchemeInput } from "
|
|
3
|
-
import type { AccountAddress, AccountAddressInput } from "../accountAddress";
|
|
4
|
-
import { AuthenticationKey } from "../authenticationKey";
|
|
5
|
-
import { AccountPublicKey, Ed25519PrivateKey, PrivateKey, Signature, VerifySignatureArgs } from "../crypto";
|
|
1
|
+
import type { AccountAuthenticator } from "../transactions/authenticator/account";
|
|
2
|
+
import { HexInput, SigningScheme, SigningSchemeInput } from "../types";
|
|
3
|
+
import type { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
4
|
+
import { AuthenticationKey } from "../core/authenticationKey";
|
|
5
|
+
import { AccountPublicKey, Ed25519PrivateKey, PrivateKey, Signature, VerifySignatureArgs } from "../core/crypto";
|
|
6
6
|
import { Ed25519Account } from "./Ed25519Account";
|
|
7
7
|
import { SingleKeyAccount } from "./SingleKeyAccount";
|
|
8
|
+
import { AnyRawTransaction } from "../transactions/types";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Arguments for creating an `Ed25519Account` from an `Ed25519PrivateKey`.
|
|
@@ -106,13 +107,6 @@ export interface PrivateKeyFromDerivationPathArgs {
|
|
|
106
107
|
* Note: Generating an account instance does not create the account on-chain.
|
|
107
108
|
*/
|
|
108
109
|
export abstract class Account {
|
|
109
|
-
/**
|
|
110
|
-
* Private key associated with the account.
|
|
111
|
-
* Note: this will be removed in the next major release,
|
|
112
|
-
* as not all accounts have a private key.
|
|
113
|
-
*/
|
|
114
|
-
abstract readonly privateKey: PrivateKey;
|
|
115
|
-
|
|
116
110
|
/**
|
|
117
111
|
* Public key associated with the account
|
|
118
112
|
*/
|
|
@@ -222,11 +216,11 @@ export abstract class Account {
|
|
|
222
216
|
}
|
|
223
217
|
|
|
224
218
|
/**
|
|
225
|
-
* Sign a
|
|
226
|
-
* @param
|
|
227
|
-
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
219
|
+
* Sign a transaction using the available signing capabilities.
|
|
220
|
+
* @param transaction the raw transaction
|
|
221
|
+
* @return the AccountAuthenticator containing the signature og the transaction, together with the account's public key
|
|
228
222
|
*/
|
|
229
|
-
abstract signWithAuthenticator(
|
|
223
|
+
abstract signWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticator;
|
|
230
224
|
|
|
231
225
|
/**
|
|
232
226
|
* Sign the given message with the private key.
|
|
@@ -235,6 +229,8 @@ export abstract class Account {
|
|
|
235
229
|
*/
|
|
236
230
|
abstract sign(message: HexInput): Signature;
|
|
237
231
|
|
|
232
|
+
abstract signTransaction(transaction: AnyRawTransaction): Signature;
|
|
233
|
+
|
|
238
234
|
/**
|
|
239
235
|
* @param args.message raw message data in HexInput format
|
|
240
236
|
* @param args.signature signed message signature
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { AccountAuthenticatorEd25519 } from "
|
|
2
|
-
import { HexInput, SigningScheme } from "
|
|
3
|
-
import { AccountAddress, AccountAddressInput } from "../accountAddress";
|
|
4
|
-
import { Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature } from "../crypto";
|
|
1
|
+
import { AccountAuthenticatorEd25519 } from "../transactions/authenticator/account";
|
|
2
|
+
import { HexInput, SigningScheme } from "../types";
|
|
3
|
+
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
4
|
+
import { Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature } from "../core/crypto";
|
|
5
5
|
import type { Account } from "./Account";
|
|
6
|
+
import { AnyRawTransaction } from "../transactions/types";
|
|
7
|
+
import { generateSigningMessageForTransaction } from "../transactions/transactionBuilder/signingMessage";
|
|
6
8
|
|
|
7
9
|
export interface Ed25519SignerConstructorArgs {
|
|
8
10
|
privateKey: Ed25519PrivateKey;
|
|
@@ -75,13 +77,17 @@ export class Ed25519Account implements Account {
|
|
|
75
77
|
return this.publicKey.verifySignature(args);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
signWithAuthenticator(
|
|
79
|
-
const signature = this.privateKey.sign(
|
|
80
|
+
signWithAuthenticator(transaction: AnyRawTransaction) {
|
|
81
|
+
const signature = this.privateKey.sign(generateSigningMessageForTransaction(transaction));
|
|
80
82
|
return new AccountAuthenticatorEd25519(this.publicKey, signature);
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
sign(message: HexInput) {
|
|
84
|
-
return this.
|
|
86
|
+
return this.privateKey.sign(message);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
signTransaction(transaction: AnyRawTransaction) {
|
|
90
|
+
return this.sign(generateSigningMessageForTransaction(transaction));
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
// endregion
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { randomBytes } from "@noble/hashes/utils";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
EPK_HORIZON_SECS,
|
|
8
|
+
Ed25519PrivateKey,
|
|
9
|
+
EphemeralPublicKey,
|
|
10
|
+
EphemeralSignature,
|
|
11
|
+
PrivateKey,
|
|
12
|
+
} from "../core/crypto";
|
|
13
|
+
import { Hex } from "../core/hex";
|
|
14
|
+
import { bytesToBigIntLE, padAndPackBytesWithLen, poseidonHash } from "../core/crypto/poseidon";
|
|
15
|
+
import { EphemeralPublicKeyVariant, HexInput, SigningSchemeInput } from "../types";
|
|
16
|
+
import { Deserializer, Serializable, Serializer } from "../bcs";
|
|
17
|
+
|
|
18
|
+
export class EphemeralKeyPair extends Serializable {
|
|
19
|
+
readonly blinder: Uint8Array;
|
|
20
|
+
|
|
21
|
+
readonly expiryDateSecs: bigint | number;
|
|
22
|
+
|
|
23
|
+
readonly nonce: string;
|
|
24
|
+
|
|
25
|
+
private privateKey: PrivateKey;
|
|
26
|
+
|
|
27
|
+
private publicKey: EphemeralPublicKey;
|
|
28
|
+
|
|
29
|
+
constructor(args: { privateKey: PrivateKey; expiryDateSecs?: bigint | number; blinder?: HexInput }) {
|
|
30
|
+
super();
|
|
31
|
+
const { privateKey, expiryDateSecs, blinder } = args;
|
|
32
|
+
this.privateKey = privateKey;
|
|
33
|
+
this.publicKey = new EphemeralPublicKey(privateKey.publicKey());
|
|
34
|
+
this.expiryDateSecs = expiryDateSecs || BigInt(floorToWholeHour(currentTimeInSeconds() + EPK_HORIZON_SECS));
|
|
35
|
+
this.blinder = blinder !== undefined ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();
|
|
36
|
+
this.nonce = this.generateNonce();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getPublicKey(): EphemeralPublicKey {
|
|
40
|
+
return this.publicKey;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
isExpired(): boolean {
|
|
44
|
+
const currentTimeSecs: number = Math.floor(Date.now() / 1000);
|
|
45
|
+
return currentTimeSecs > this.expiryDateSecs;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
serialize(serializer: Serializer): void {
|
|
49
|
+
serializer.serializeU32AsUleb128(this.publicKey.variant);
|
|
50
|
+
serializer.serializeBytes(this.privateKey.toUint8Array());
|
|
51
|
+
serializer.serializeU64(this.expiryDateSecs);
|
|
52
|
+
serializer.serializeFixedBytes(this.blinder);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static deserialize(deserializer: Deserializer): EphemeralKeyPair {
|
|
56
|
+
const variantIndex = deserializer.deserializeUleb128AsU32();
|
|
57
|
+
let privateKey: PrivateKey;
|
|
58
|
+
switch (variantIndex) {
|
|
59
|
+
case EphemeralPublicKeyVariant.Ed25519:
|
|
60
|
+
privateKey = Ed25519PrivateKey.deserialize(deserializer);
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
throw new Error(`Unknown variant index for EphemeralPublicKey: ${variantIndex}`);
|
|
64
|
+
}
|
|
65
|
+
const expiryDateSecs = deserializer.deserializeU64();
|
|
66
|
+
const blinder = deserializer.deserializeFixedBytes(31);
|
|
67
|
+
return new EphemeralKeyPair({ privateKey, expiryDateSecs, blinder });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static fromBytes(bytes: Uint8Array): EphemeralKeyPair {
|
|
71
|
+
return EphemeralKeyPair.deserialize(new Deserializer(bytes));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static generate(args?: { scheme: SigningSchemeInput }): EphemeralKeyPair {
|
|
75
|
+
let privateKey: PrivateKey;
|
|
76
|
+
|
|
77
|
+
switch (args?.scheme) {
|
|
78
|
+
case SigningSchemeInput.Ed25519:
|
|
79
|
+
default:
|
|
80
|
+
privateKey = Ed25519PrivateKey.generate();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return new EphemeralKeyPair({ privateKey });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
generateNonce(): string {
|
|
87
|
+
const fields = padAndPackBytesWithLen(this.publicKey.bcsToBytes(), 93);
|
|
88
|
+
fields.push(BigInt(this.expiryDateSecs));
|
|
89
|
+
fields.push(bytesToBigIntLE(this.blinder));
|
|
90
|
+
const nonceHash = poseidonHash(fields);
|
|
91
|
+
return nonceHash.toString();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Sign the given message with the private key.
|
|
96
|
+
* *
|
|
97
|
+
* @param data in HexInput format
|
|
98
|
+
* @returns EphemeralSignature
|
|
99
|
+
*/
|
|
100
|
+
sign(data: HexInput): EphemeralSignature {
|
|
101
|
+
if (this.isExpired()) {
|
|
102
|
+
throw new Error("EphemeralKeyPair has expired")
|
|
103
|
+
}
|
|
104
|
+
return new EphemeralSignature(this.privateKey.sign(data));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function generateBlinder(): Uint8Array {
|
|
109
|
+
return randomBytes(31);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function currentTimeInSeconds(): number {
|
|
113
|
+
return Math.floor(new Date().getTime() / 1000);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function floorToWholeHour(timestampInSeconds: number): number {
|
|
117
|
+
const date = new Date(timestampInSeconds * 1000);
|
|
118
|
+
// Reset minutes and seconds to zero
|
|
119
|
+
date.setMinutes(0);
|
|
120
|
+
date.setSeconds(0);
|
|
121
|
+
date.setMilliseconds(0);
|
|
122
|
+
return Math.floor(date.getTime() / 1000);
|
|
123
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { JwtPayload, jwtDecode } from "jwt-decode";
|
|
5
|
+
import { decode } from "base-64";
|
|
6
|
+
import EventEmitter from "eventemitter3";
|
|
7
|
+
import { HexInput, SigningScheme } from "../types";
|
|
8
|
+
import { AccountAddress } from "../core/accountAddress";
|
|
9
|
+
import {
|
|
10
|
+
AnyPublicKey,
|
|
11
|
+
AnySignature,
|
|
12
|
+
KeylessPublicKey,
|
|
13
|
+
KeylessSignature,
|
|
14
|
+
OpenIdSignature,
|
|
15
|
+
OpenIdSignatureOrZkProof,
|
|
16
|
+
Signature,
|
|
17
|
+
SignedGroth16Signature,
|
|
18
|
+
computeAddressSeed,
|
|
19
|
+
fromDerivationPath as fromDerivationPathInner,
|
|
20
|
+
} from "../core/crypto";
|
|
21
|
+
|
|
22
|
+
import { Account } from "./Account";
|
|
23
|
+
import { EphemeralKeyPair } from "./EphemeralKeyPair";
|
|
24
|
+
import { Hex } from "../core/hex";
|
|
25
|
+
import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
|
|
26
|
+
import { Deserializer, Serializer } from "../bcs";
|
|
27
|
+
import { deriveTransactionType, generateSigningMessage } from "../transactions/transactionBuilder/signingMessage";
|
|
28
|
+
import { AnyRawTransaction } from "../transactions/types";
|
|
29
|
+
|
|
30
|
+
function base64UrlDecode(base64Url: string): string {
|
|
31
|
+
// Replace base64url-specific characters
|
|
32
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
33
|
+
|
|
34
|
+
// Pad the string with '=' characters if needed
|
|
35
|
+
const paddedBase64 = base64 + "==".substring(0, (3 - (base64.length % 3)) % 3);
|
|
36
|
+
|
|
37
|
+
// Decode the base64 string using the base-64 library
|
|
38
|
+
const decodedString = decode(paddedBase64);
|
|
39
|
+
|
|
40
|
+
return decodedString;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ProofFetchSuccess = {
|
|
44
|
+
status: "Success";
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type ProofFetchFailure = {
|
|
48
|
+
status: "Failed";
|
|
49
|
+
error: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure
|
|
53
|
+
|
|
54
|
+
export type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;
|
|
55
|
+
|
|
56
|
+
export interface ProofFetchEvents {
|
|
57
|
+
proofFetchFinish: (status: ProofFetchStatus) => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class KeylessAccount implements Account {
|
|
61
|
+
static readonly PEPPER_LENGTH: number = 31;
|
|
62
|
+
|
|
63
|
+
static readonly SLIP_0010_SEED: string = "32 bytes";
|
|
64
|
+
|
|
65
|
+
publicKey: KeylessPublicKey;
|
|
66
|
+
|
|
67
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
68
|
+
|
|
69
|
+
uidKey: string;
|
|
70
|
+
|
|
71
|
+
uidVal: string;
|
|
72
|
+
|
|
73
|
+
aud: string;
|
|
74
|
+
|
|
75
|
+
pepper: Uint8Array;
|
|
76
|
+
|
|
77
|
+
accountAddress: AccountAddress;
|
|
78
|
+
|
|
79
|
+
proof: SignedGroth16Signature | undefined;
|
|
80
|
+
|
|
81
|
+
proofOrPromise: SignedGroth16Signature | Promise<SignedGroth16Signature>;
|
|
82
|
+
|
|
83
|
+
signingScheme: SigningScheme;
|
|
84
|
+
|
|
85
|
+
jwt: string;
|
|
86
|
+
|
|
87
|
+
emitter: EventEmitter<ProofFetchEvents>;
|
|
88
|
+
|
|
89
|
+
constructor(args: {
|
|
90
|
+
address?: AccountAddress;
|
|
91
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
92
|
+
iss: string;
|
|
93
|
+
uidKey: string;
|
|
94
|
+
uidVal: string;
|
|
95
|
+
aud: string;
|
|
96
|
+
pepper: HexInput;
|
|
97
|
+
proofOrFetcher: SignedGroth16Signature | Promise<SignedGroth16Signature>;
|
|
98
|
+
proofFetchCallback?: ProofFetchCallback
|
|
99
|
+
jwt: string;
|
|
100
|
+
}) {
|
|
101
|
+
const { address, ephemeralKeyPair, iss, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;
|
|
102
|
+
this.ephemeralKeyPair = ephemeralKeyPair;
|
|
103
|
+
const addressSeed = computeAddressSeed(args);
|
|
104
|
+
this.publicKey = new KeylessPublicKey(iss, addressSeed);
|
|
105
|
+
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
106
|
+
this.uidKey = uidKey;
|
|
107
|
+
this.uidVal = uidVal;
|
|
108
|
+
this.aud = aud;
|
|
109
|
+
this.jwt = jwt;
|
|
110
|
+
this.emitter = new EventEmitter<ProofFetchEvents>();
|
|
111
|
+
this.proofOrPromise = proofOrFetcher;
|
|
112
|
+
if (proofOrFetcher instanceof SignedGroth16Signature) {
|
|
113
|
+
this.proof = proofOrFetcher;
|
|
114
|
+
} else {
|
|
115
|
+
if (proofFetchCallback === undefined) {
|
|
116
|
+
throw new Error("Must provide callback")
|
|
117
|
+
}
|
|
118
|
+
this.emitter.on("proofFetchFinish", async (status) => {
|
|
119
|
+
await proofFetchCallback(status);
|
|
120
|
+
this.emitter.removeAllListeners();
|
|
121
|
+
});
|
|
122
|
+
this.init(proofOrFetcher);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
this.signingScheme = SigningScheme.SingleKey;
|
|
127
|
+
const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
|
|
128
|
+
if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {
|
|
129
|
+
throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);
|
|
130
|
+
}
|
|
131
|
+
this.pepper = pepperBytes;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
async init(promise: Promise<SignedGroth16Signature>) {
|
|
135
|
+
try {
|
|
136
|
+
this.proof = await promise;
|
|
137
|
+
this.emitter.emit("proofFetchFinish", {status: "Success"});
|
|
138
|
+
} catch (error) {
|
|
139
|
+
if (error instanceof Error) {
|
|
140
|
+
this.emitter.emit("proofFetchFinish", {status: "Failed", error: error.toString()});
|
|
141
|
+
} else {
|
|
142
|
+
this.emitter.emit("proofFetchFinish", {status: "Failed", error: "Unknown"});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
serialize(serializer: Serializer): void {
|
|
148
|
+
serializer.serializeStr(this.jwt);
|
|
149
|
+
serializer.serializeStr(this.uidKey);
|
|
150
|
+
serializer.serializeFixedBytes(this.pepper);
|
|
151
|
+
this.ephemeralKeyPair.serialize(serializer);
|
|
152
|
+
if (this.proof === undefined) {
|
|
153
|
+
throw new Error("Connot serialize - proof undefined")
|
|
154
|
+
}
|
|
155
|
+
this.proof.serialize(serializer);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
static deserialize(deserializer: Deserializer): KeylessAccount {
|
|
159
|
+
const jwt = deserializer.deserializeStr();
|
|
160
|
+
const uidKey = deserializer.deserializeStr();
|
|
161
|
+
const pepper = deserializer.deserializeFixedBytes(31);
|
|
162
|
+
const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);
|
|
163
|
+
const proof = SignedGroth16Signature.deserialize(deserializer);
|
|
164
|
+
return KeylessAccount.fromJWTAndProof({
|
|
165
|
+
proof,
|
|
166
|
+
pepper,
|
|
167
|
+
uidKey,
|
|
168
|
+
jwt,
|
|
169
|
+
ephemeralKeyPair,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
isExpired(): boolean {
|
|
174
|
+
return this.ephemeralKeyPair.isExpired();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
bcsToBytes(): Uint8Array {
|
|
178
|
+
const serializer = new Serializer();
|
|
179
|
+
this.serialize(serializer);
|
|
180
|
+
return serializer.toUint8Array();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
bcsToHex(): Hex {
|
|
184
|
+
const bcsBytes = this.bcsToBytes();
|
|
185
|
+
return Hex.fromHexInput(bcsBytes);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
signWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
|
|
189
|
+
const raw = deriveTransactionType(transaction);
|
|
190
|
+
const signature = new AnySignature(this.sign(raw.bcsToBytes()));
|
|
191
|
+
const publicKey = new AnyPublicKey(this.publicKey);
|
|
192
|
+
return new AccountAuthenticatorSingleKey(publicKey, signature);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async waitForProofFetch() {
|
|
196
|
+
if (this.proofOrPromise instanceof Promise) {
|
|
197
|
+
await this.proofOrPromise;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
sign(data: HexInput): Signature {
|
|
202
|
+
const { expiryDateSecs } = this.ephemeralKeyPair;
|
|
203
|
+
const currentTimeInSeconds = Math.floor(new Date().getTime() / 1000);
|
|
204
|
+
if (expiryDateSecs < currentTimeInSeconds) {
|
|
205
|
+
throw new Error("Ephemeral key pair is expired.");
|
|
206
|
+
}
|
|
207
|
+
if (this.proof === undefined) {
|
|
208
|
+
throw new Error("Proof not found");
|
|
209
|
+
}
|
|
210
|
+
const jwtHeader = this.jwt.split(".")[0];
|
|
211
|
+
const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
|
|
212
|
+
|
|
213
|
+
const serializer = new Serializer();
|
|
214
|
+
serializer.serializeFixedBytes(Hex.fromHexInput(data).toUint8Array());
|
|
215
|
+
serializer.serializeOption(this.proof.proof);
|
|
216
|
+
const signMess = generateSigningMessage(serializer.toUint8Array(), "APTOS::TransactionAndProof");
|
|
217
|
+
|
|
218
|
+
const ephemeralSignature = this.ephemeralKeyPair.sign(signMess);
|
|
219
|
+
|
|
220
|
+
return new KeylessSignature({
|
|
221
|
+
jwtHeader: base64UrlDecode(jwtHeader),
|
|
222
|
+
openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(this.proof),
|
|
223
|
+
expiryDateSecs,
|
|
224
|
+
ephemeralPublicKey,
|
|
225
|
+
ephemeralSignature,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
signTransaction(transaction: AnyRawTransaction): Signature {
|
|
230
|
+
const raw = deriveTransactionType(transaction);
|
|
231
|
+
return this.sign(raw.bcsToBytes());
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
signWithOpenIdSignature(data: HexInput): Signature {
|
|
235
|
+
const [jwtHeader, jwtPayload, jwtSignature] = this.jwt.split(".");
|
|
236
|
+
const openIdSig = new OpenIdSignature({
|
|
237
|
+
jwtSignature,
|
|
238
|
+
jwtPayloadJson: jwtPayload,
|
|
239
|
+
uidKey: this.uidKey,
|
|
240
|
+
epkBlinder: this.ephemeralKeyPair.blinder,
|
|
241
|
+
pepper: this.pepper,
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const { expiryDateSecs } = this.ephemeralKeyPair;
|
|
245
|
+
const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
|
|
246
|
+
const ephemeralSignature = this.ephemeralKeyPair.sign(data);
|
|
247
|
+
return new KeylessSignature({
|
|
248
|
+
jwtHeader,
|
|
249
|
+
openIdSignatureOrZkProof: new OpenIdSignatureOrZkProof(openIdSig),
|
|
250
|
+
expiryDateSecs,
|
|
251
|
+
ephemeralPublicKey,
|
|
252
|
+
ephemeralSignature,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
|
|
257
|
+
verifySignature(args: { message: HexInput; signature: Signature }): boolean {
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
static fromBytes(bytes: Uint8Array): KeylessAccount {
|
|
262
|
+
return KeylessAccount.deserialize(new Deserializer(bytes));
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
static fromJWTAndProof(args: {
|
|
266
|
+
proof: SignedGroth16Signature | Promise<SignedGroth16Signature>;
|
|
267
|
+
jwt: string;
|
|
268
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
269
|
+
pepper: HexInput;
|
|
270
|
+
uidKey?: string;
|
|
271
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
272
|
+
}): KeylessAccount {
|
|
273
|
+
const { proof, jwt, ephemeralKeyPair, pepper, proofFetchCallback } = args;
|
|
274
|
+
const uidKey = args.uidKey ?? "sub";
|
|
275
|
+
|
|
276
|
+
const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);
|
|
277
|
+
const iss = jwtPayload.iss!;
|
|
278
|
+
if (typeof jwtPayload.aud !== "string") {
|
|
279
|
+
throw new Error("aud was not found or an array of values");
|
|
280
|
+
}
|
|
281
|
+
const aud = jwtPayload.aud!;
|
|
282
|
+
const uidVal = jwtPayload[uidKey];
|
|
283
|
+
return new KeylessAccount({
|
|
284
|
+
proofOrFetcher: proof,
|
|
285
|
+
ephemeralKeyPair,
|
|
286
|
+
iss,
|
|
287
|
+
uidKey,
|
|
288
|
+
uidVal,
|
|
289
|
+
aud,
|
|
290
|
+
pepper,
|
|
291
|
+
jwt,
|
|
292
|
+
proofFetchCallback,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
static fromDerivationPath(path: string, seed: Uint8Array): Uint8Array {
|
|
297
|
+
return fromDerivationPathInner(path, KeylessAccount.SLIP_0010_SEED, seed);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Account } from "./Account";
|
|
5
|
+
import { MultiKey, MultiSignature, PublicKey, Signature } from "../core/crypto";
|
|
6
|
+
import { AccountAddress } from "../core/accountAddress";
|
|
7
|
+
import { HexInput, SigningScheme } from "../types";
|
|
8
|
+
import { AccountAuthenticatorMultiKey } from "../transactions/authenticator/account";
|
|
9
|
+
import { AnyRawTransaction } from "../transactions/types";
|
|
10
|
+
import { KeylessAccount } from "./KeylessAccount";
|
|
11
|
+
|
|
12
|
+
export class MultiKeyAccount implements Account {
|
|
13
|
+
/**
|
|
14
|
+
* Public key associated with the account
|
|
15
|
+
*/
|
|
16
|
+
readonly publicKey: MultiKey;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Account address associated with the account
|
|
20
|
+
*/
|
|
21
|
+
readonly accountAddress: AccountAddress;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Signing scheme used to sign transactions
|
|
25
|
+
*/
|
|
26
|
+
readonly signingScheme: SigningScheme;
|
|
27
|
+
|
|
28
|
+
signers: Account[];
|
|
29
|
+
|
|
30
|
+
signaturesBitmap: Uint8Array;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* constructor for Account
|
|
34
|
+
*
|
|
35
|
+
* Need to update this to use the new crypto library if new schemes are added.
|
|
36
|
+
*
|
|
37
|
+
* @param args.privateKey PrivateKey - private key of the account
|
|
38
|
+
* @param args.address AccountAddress - address of the account
|
|
39
|
+
* @param args.legacy optional. If set to false, the keypair authentication keys will be derived with a unified scheme.
|
|
40
|
+
* Defaults to deriving an authentication key with the legacy scheme.
|
|
41
|
+
*
|
|
42
|
+
* This method is private because it should only be called by the factory static methods.
|
|
43
|
+
* @returns Account
|
|
44
|
+
*/
|
|
45
|
+
constructor(args: { multiKey: MultiKey; signers: Account[] }) {
|
|
46
|
+
const { multiKey, signers } = args;
|
|
47
|
+
|
|
48
|
+
this.publicKey = multiKey;
|
|
49
|
+
this.signers = signers;
|
|
50
|
+
this.signingScheme = SigningScheme.MultiKey;
|
|
51
|
+
|
|
52
|
+
this.accountAddress = this.publicKey.authKey().derivedAddress();
|
|
53
|
+
|
|
54
|
+
const bits: number[] = [];
|
|
55
|
+
for (const signer of signers) {
|
|
56
|
+
bits.push(this.publicKey.getIndex(signer.publicKey));
|
|
57
|
+
}
|
|
58
|
+
this.signaturesBitmap = this.publicKey.createBitmap({ bits });
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static fromPublicKeysAndSigners(args: {
|
|
62
|
+
publicKeys: PublicKey[];
|
|
63
|
+
signaturesRequired: number;
|
|
64
|
+
signers: Account[];
|
|
65
|
+
}): MultiKeyAccount {
|
|
66
|
+
const { publicKeys, signaturesRequired, signers } = args;
|
|
67
|
+
const multiKey = new MultiKey({ publicKeys, signaturesRequired });
|
|
68
|
+
return new MultiKeyAccount({ multiKey, signers });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static isMultiKeySigner(account: Account): account is MultiKeyAccount {
|
|
72
|
+
return account instanceof MultiKeyAccount;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
signWithAuthenticator(transaction: AnyRawTransaction) {
|
|
76
|
+
return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async waitForProofFetch() {
|
|
80
|
+
const keylessSigners = this.signers.filter((signer) => signer instanceof KeylessAccount) as KeylessAccount[];
|
|
81
|
+
await Promise.all(keylessSigners.filter((signer) => signer.proof instanceof Promise).map((signer) => signer.proof));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Sign the given message with the private key.
|
|
86
|
+
*
|
|
87
|
+
* TODO: Add sign transaction or specific types
|
|
88
|
+
*
|
|
89
|
+
* @param data in HexInput format
|
|
90
|
+
* @returns Signature
|
|
91
|
+
*/
|
|
92
|
+
sign(data: HexInput): MultiSignature {
|
|
93
|
+
const signatures = [];
|
|
94
|
+
for (const signer of this.signers) {
|
|
95
|
+
signatures.push(signer.sign(data));
|
|
96
|
+
}
|
|
97
|
+
return new MultiSignature({ signatures, bitmap: this.signaturesBitmap });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
signTransaction(transaction: AnyRawTransaction) {
|
|
101
|
+
const signatures = [];
|
|
102
|
+
for (const signer of this.signers) {
|
|
103
|
+
signatures.push(signer.signTransaction(transaction));
|
|
104
|
+
}
|
|
105
|
+
return new MultiSignature({ signatures, bitmap: this.signaturesBitmap });
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Verify the given message and signature with the public key.
|
|
110
|
+
*
|
|
111
|
+
* @param args.message raw message data in HexInput format
|
|
112
|
+
* @param args.signature signed message Signature
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
|
|
116
|
+
verifySignature(args: { message: HexInput; signature: Signature }): boolean {
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { AccountAuthenticatorSingleKey } from "
|
|
2
|
-
import { type HexInput, SigningScheme, SigningSchemeInput } from "
|
|
3
|
-
import { AccountAddress, AccountAddressInput } from "../accountAddress";
|
|
4
|
-
import { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from "../crypto";
|
|
1
|
+
import { AccountAuthenticatorSingleKey } from "../transactions/authenticator/account";
|
|
2
|
+
import { type HexInput, SigningScheme, SigningSchemeInput } from "../types";
|
|
3
|
+
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
4
|
+
import { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from "../core/crypto";
|
|
5
5
|
import type { Account } from "./Account";
|
|
6
|
+
import { generateSigningMessageForTransaction } from "../transactions/transactionBuilder/signingMessage";
|
|
7
|
+
import { AnyRawTransaction } from "../transactions/types";
|
|
6
8
|
|
|
7
9
|
export interface SingleKeySignerConstructorArgs {
|
|
8
10
|
privateKey: PrivateKey;
|
|
@@ -106,14 +108,17 @@ export class SingleKeyAccount implements Account {
|
|
|
106
108
|
return this.publicKey.verifySignature(args);
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
signWithAuthenticator(
|
|
110
|
-
const
|
|
111
|
-
const signature = new AnySignature(innerSignature);
|
|
111
|
+
signWithAuthenticator(transaction: AnyRawTransaction) {
|
|
112
|
+
const signature = this.sign(generateSigningMessageForTransaction(transaction));
|
|
112
113
|
return new AccountAuthenticatorSingleKey(this.publicKey, signature);
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
sign(message: HexInput) {
|
|
116
|
-
return this.
|
|
117
|
+
return new AnySignature(this.privateKey.sign(message));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
signTransaction(transaction: AnyRawTransaction) {
|
|
121
|
+
return this.sign(generateSigningMessageForTransaction(transaction));
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
// endregion
|
package/src/api/account.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Account as AccountModule } from "../account";
|
|
5
|
+
import { AccountAddress, PrivateKey, AccountAddressInput } from "../core";
|
|
5
6
|
import {
|
|
6
7
|
AccountData,
|
|
7
8
|
AnyNumber,
|