@aptos-labs/ts-sdk 1.8.0 → 1.9.1-plugin.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 +1 -1
- package/dist/common/index.d.ts +1204 -969
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.d.mts +12 -6
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +11 -12
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +13 -14
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +7 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +13 -13
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +20 -10
- 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 +9 -10
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +13 -14
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +5 -6
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +11 -12
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +11 -12
- 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 +11 -11
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +6 -6
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/assetUploader/assetUploader.d.mts +109 -0
- package/dist/esm/assetUploader/assetUploader.mjs +2 -0
- package/dist/esm/assetUploader/index.d.mts +24 -0
- package/dist/esm/assetUploader/index.mjs +2 -0
- package/dist/esm/assetUploader/irys.d.mts +64 -0
- package/dist/esm/assetUploader/irys.mjs +2 -0
- 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.mjs +1 -1
- package/dist/esm/chunk-2RRFFRBV.mjs +2 -0
- package/dist/esm/chunk-2RRFFRBV.mjs.map +1 -0
- package/dist/esm/chunk-4LUWUDBX.mjs +2 -0
- package/dist/esm/{chunk-O57QZZF2.mjs → chunk-53UNV6UP.mjs} +2 -2
- package/dist/esm/chunk-53UNV6UP.mjs.map +1 -0
- package/dist/esm/{chunk-7D5LHQNS.mjs → chunk-5PIO6MFF.mjs} +2 -2
- package/dist/esm/{chunk-VKZCIGKY.mjs → chunk-6TUHLGW3.mjs} +2 -2
- package/dist/esm/{chunk-ENDUXRTK.mjs → chunk-7KPEDF2R.mjs} +2 -2
- package/dist/esm/chunk-AJRBTHDS.mjs +2 -0
- package/dist/esm/chunk-AJRBTHDS.mjs.map +1 -0
- package/dist/esm/chunk-AXVVJKE4.mjs +2 -0
- package/dist/esm/chunk-BKWJ4G7T.mjs +2 -0
- package/dist/esm/{chunk-VRSUCKJA.mjs.map → chunk-BKWJ4G7T.mjs.map} +1 -1
- package/dist/esm/{chunk-NL72WE3E.mjs → chunk-BZMO6Q6L.mjs} +2 -2
- package/dist/esm/chunk-CNEVWSWR.mjs +2 -0
- package/dist/esm/chunk-CNEVWSWR.mjs.map +1 -0
- package/dist/esm/chunk-CUWAGKEP.mjs +2 -0
- package/dist/esm/chunk-CUWAGKEP.mjs.map +1 -0
- package/dist/esm/chunk-DQHNZBA5.mjs +2 -0
- package/dist/esm/chunk-DQHNZBA5.mjs.map +1 -0
- package/dist/esm/{chunk-XBVORX5O.mjs → chunk-FAAWSTXC.mjs} +2 -2
- package/dist/esm/{chunk-AFPJ2XXN.mjs → chunk-FHWAJCJR.mjs} +2 -2
- package/dist/esm/{chunk-VPQ46CAO.mjs → chunk-GE7VQ5NZ.mjs} +2 -2
- package/dist/esm/{chunk-6FBKUTGF.mjs → chunk-GHYE26Q5.mjs} +2 -2
- package/dist/esm/chunk-GTCDSGOA.mjs +2 -0
- package/dist/esm/chunk-GTCDSGOA.mjs.map +1 -0
- package/dist/esm/chunk-H2FRCXQ6.mjs +2 -0
- package/dist/esm/chunk-H2FRCXQ6.mjs.map +1 -0
- package/dist/esm/chunk-HEPV52CH.mjs +2 -0
- package/dist/esm/chunk-HEPV52CH.mjs.map +1 -0
- package/dist/esm/chunk-HIUJDWMR.mjs +2 -0
- package/dist/esm/{chunk-MEPX7Z2Z.mjs.map → chunk-HIUJDWMR.mjs.map} +1 -1
- package/dist/esm/{chunk-2H5Z5EHH.mjs → chunk-HKAJ5N25.mjs} +2 -2
- package/dist/esm/chunk-HRKLPZL5.mjs +2 -0
- package/dist/esm/chunk-HRKLPZL5.mjs.map +1 -0
- package/dist/esm/{chunk-PJNPLRPR.mjs → chunk-HWTX3HVX.mjs} +2 -2
- package/dist/esm/chunk-IFVMIUMO.mjs +2 -0
- package/dist/esm/{chunk-6SRENFWH.mjs → chunk-IMYKTNDV.mjs} +2 -2
- package/dist/esm/{chunk-PMWH5IGI.mjs → chunk-ITALFUWD.mjs} +2 -2
- package/dist/esm/chunk-JB7ZOUYL.mjs +2 -0
- package/dist/esm/{chunk-2WFMD6C6.mjs → chunk-JMR7G5DT.mjs} +2 -2
- package/dist/esm/{chunk-S64WKSMI.mjs → chunk-JOIUR5QW.mjs} +2 -2
- package/dist/esm/{chunk-F7CR75CJ.mjs → chunk-JPG25VX2.mjs} +2 -2
- package/dist/esm/{chunk-F7CR75CJ.mjs.map → chunk-JPG25VX2.mjs.map} +1 -1
- package/dist/esm/{chunk-4OI7MPFH.mjs → chunk-K5XJKIFT.mjs} +2 -2
- package/dist/esm/chunk-KUX6GQ2E.mjs +1 -0
- package/dist/esm/{chunk-Q5HK3U64.mjs → chunk-L4PAU62E.mjs} +2 -2
- package/dist/esm/chunk-L7ORFGZ7.mjs +1 -0
- package/dist/esm/chunk-LG7RJQ57.mjs +2 -0
- package/dist/esm/chunk-LKKOIIBF.mjs +2 -0
- package/dist/esm/chunk-LKKOIIBF.mjs.map +1 -0
- package/dist/esm/chunk-M6TKSJ4I.mjs +2 -0
- package/dist/esm/chunk-ML7VTAHR.mjs +2 -0
- package/dist/esm/chunk-ML7VTAHR.mjs.map +1 -0
- package/dist/esm/{chunk-2DNPRIS5.mjs → chunk-MVWTTVQZ.mjs} +2 -2
- package/dist/esm/chunk-NA2H44NE.mjs +2 -0
- package/dist/esm/{chunk-CVEJHRAU.mjs → chunk-NCDLIACO.mjs} +1 -1
- package/dist/esm/chunk-NCDLIACO.mjs.map +1 -0
- package/dist/esm/chunk-NF35PRGD.mjs +2 -0
- package/dist/esm/{chunk-XZYPAQCU.mjs.map → chunk-NF35PRGD.mjs.map} +1 -1
- package/dist/esm/{chunk-R56OJ4XC.mjs → chunk-NYGCJ6EJ.mjs} +2 -2
- package/dist/esm/{chunk-PIXE7MN5.mjs → chunk-NZGON5TY.mjs} +2 -2
- package/dist/esm/chunk-O4EVRHDH.mjs +2 -0
- package/dist/esm/chunk-O4EVRHDH.mjs.map +1 -0
- package/dist/esm/{chunk-Y4AKS4CY.mjs → chunk-O5Q3RSEJ.mjs} +2 -2
- package/dist/esm/chunk-OP4VV2UO.mjs +2 -0
- package/dist/esm/chunk-OP4VV2UO.mjs.map +1 -0
- package/dist/esm/chunk-OYQRQC4Z.mjs +2 -0
- package/dist/esm/chunk-OYQRQC4Z.mjs.map +1 -0
- package/dist/esm/chunk-P3CMSOX6.mjs +2 -0
- package/dist/esm/chunk-P3CMSOX6.mjs.map +1 -0
- package/dist/esm/{chunk-LATJGGVX.mjs → chunk-PATJMQAG.mjs} +2 -2
- package/dist/esm/chunk-PEOCYUOO.mjs +2 -0
- package/dist/esm/chunk-PEOCYUOO.mjs.map +1 -0
- package/dist/esm/chunk-PISONN6H.mjs +2 -0
- package/dist/esm/chunk-PISONN6H.mjs.map +1 -0
- package/dist/esm/chunk-Q6YMSZLY.mjs +2 -0
- package/dist/esm/{chunk-SRZTA6QH.mjs.map → chunk-Q6YMSZLY.mjs.map} +1 -1
- package/dist/esm/chunk-QE4ASJ5K.mjs +1 -0
- package/dist/esm/chunk-QE4ASJ5K.mjs.map +1 -0
- package/dist/esm/{chunk-SXIFL5DQ.mjs → chunk-RC5K63LK.mjs} +2 -2
- package/dist/esm/chunk-RZNFFGTD.mjs +2 -0
- package/dist/esm/chunk-RZNFFGTD.mjs.map +1 -0
- package/dist/esm/{chunk-QGIJNA37.mjs → chunk-SKF6E6X7.mjs} +2 -2
- package/dist/esm/{chunk-ENKMOALS.mjs → chunk-SPKBGDFY.mjs} +2 -2
- package/dist/esm/chunk-SPKBGDFY.mjs.map +1 -0
- package/dist/esm/chunk-TWHTXYMB.mjs +2 -0
- package/dist/esm/{chunk-JQVT2K7G.mjs → chunk-UCFIV5UD.mjs} +2 -2
- package/dist/esm/{chunk-JJ6Y35DF.mjs → chunk-UFD443TT.mjs} +2 -2
- package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
- package/dist/esm/chunk-UVSRX4SV.mjs.map +1 -0
- package/dist/esm/{chunk-M3WNE7MU.mjs → chunk-UVTSJ2KP.mjs} +2 -2
- package/dist/esm/{chunk-KJGQ4ILY.mjs → chunk-UZ3SFWTM.mjs} +2 -2
- package/dist/esm/{chunk-V2FPYAK7.mjs → chunk-VPN3KEVB.mjs} +2 -2
- package/dist/esm/chunk-VQM4LMCW.mjs +2 -0
- package/dist/esm/{chunk-W4UDMBMU.mjs → chunk-VWWR2UAQ.mjs} +2 -2
- package/dist/esm/{chunk-F7MOQC7Z.mjs → chunk-VZJ62XF7.mjs} +2 -2
- package/dist/esm/{chunk-N4RBQZ2B.mjs → chunk-W2XLZW4Y.mjs} +2 -2
- package/dist/esm/{chunk-FRLPX47J.mjs → chunk-XH4B5K6W.mjs} +2 -2
- package/dist/esm/{chunk-4M46AWXX.mjs → chunk-XSCYT6TT.mjs} +2 -2
- package/dist/esm/{chunk-EUHPML5E.mjs → chunk-XSYZX66A.mjs} +2 -2
- package/dist/esm/{chunk-SPOHAEHR.mjs → chunk-YTHL7EKV.mjs} +2 -2
- package/dist/esm/{chunk-Q3HAJVCM.mjs → chunk-YXUOYXGZ.mjs} +2 -2
- package/dist/esm/chunk-ZAMLI7FP.mjs +2 -0
- package/dist/esm/chunk-ZAMLI7FP.mjs.map +1 -0
- 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/client/types.mjs +1 -1
- package/dist/esm/core/account/Account.d.mts +20 -0
- package/dist/esm/core/account/Account.mjs +2 -0
- package/dist/esm/core/account/Account.mjs.map +1 -0
- package/dist/esm/core/account/Ed25519Account.d.mts +20 -0
- package/dist/esm/core/account/Ed25519Account.mjs +2 -0
- package/dist/esm/core/account/Ed25519Account.mjs.map +1 -0
- package/dist/esm/core/account/SingleKeyAccount.d.mts +20 -0
- package/dist/esm/core/account/SingleKeyAccount.mjs +2 -0
- package/dist/esm/core/account/SingleKeyAccount.mjs.map +1 -0
- package/dist/esm/core/account/index.d.mts +305 -0
- package/dist/esm/core/account/index.mjs +2 -0
- package/dist/esm/core/account/index.mjs.map +1 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +7 -68
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +49 -61
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +9 -6
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +17 -14
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +70 -17
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +35 -0
- package/dist/esm/core/crypto/privateKey.mjs +2 -0
- package/dist/esm/core/crypto/privateKey.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +13 -0
- package/dist/esm/core/crypto/publicKey.mjs +2 -0
- package/dist/esm/core/crypto/publicKey.mjs.map +1 -0
- package/dist/esm/core/crypto/secp256k1.d.mts +43 -67
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +28 -0
- package/dist/esm/core/crypto/signature.mjs +2 -0
- package/dist/esm/core/crypto/signature.mjs.map +1 -0
- package/dist/esm/core/crypto/singleKey.d.mts +68 -0
- package/dist/esm/core/crypto/singleKey.mjs +2 -0
- package/dist/esm/core/crypto/singleKey.mjs.map +1 -0
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +9 -8
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +10 -8
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +9 -3
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +10 -11
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +12 -12
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +17 -14
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +2 -2
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +4 -4
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +10 -11
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +3 -3
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +12 -13
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/publicKey-B3XRNhHO.d.mts +113 -0
- package/dist/esm/transactions/authenticator/account.d.mts +6 -4
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +6 -6
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +5 -5
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +6 -7
- 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 +4 -4
- 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/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +2 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +8 -8
- package/dist/esm/transactions/instances/signedTransaction.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 +11 -5
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +11 -12
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +11 -12
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +10 -10
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -10
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +9 -10
- 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 +9 -9
- package/dist/esm/types/index.d.mts +1 -0
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/utils/const.d.mts +1 -2
- 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/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +11 -4
- package/src/api/aptosConfig.ts +11 -2
- package/src/api/digitalAsset.ts +20 -0
- package/src/assetUploader/assetUploader.ts +87 -0
- package/src/assetUploader/index.ts +1 -0
- package/src/assetUploader/irys.ts +102 -0
- package/src/core/account/Account.ts +245 -0
- package/src/core/account/Ed25519Account.ts +88 -0
- package/src/core/account/SingleKeyAccount.ts +120 -0
- package/src/core/account/index.ts +3 -0
- package/src/core/authenticationKey.ts +18 -52
- package/src/core/crypto/ed25519.ts +118 -104
- package/src/core/crypto/index.ts +6 -5
- package/src/core/crypto/multiEd25519.ts +98 -44
- package/src/core/crypto/multiKey.ts +192 -34
- package/src/core/crypto/privateKey.ts +25 -0
- package/src/core/crypto/publicKey.ts +52 -0
- package/src/core/crypto/secp256k1.ts +108 -111
- package/src/core/crypto/signature.ts +46 -0
- package/src/core/crypto/singleKey.ts +180 -0
- package/src/index.ts +1 -0
- package/src/internal/account.ts +5 -3
- package/src/internal/digitalAsset.ts +26 -0
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +0 -1
- package/src/transactions/authenticator/account.ts +1 -2
- package/src/transactions/instances/rotationProofChallenge.ts +1 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +3 -21
- package/src/transactions/types.ts +1 -1
- package/src/types/index.ts +2 -0
- package/src/utils/const.ts +0 -4
- package/src/version.ts +1 -1
- package/dist/browser/index.d.ts +0 -6997
- package/dist/browser/index.global.js +0 -483
- package/dist/browser/index.global.js.map +0 -1
- package/dist/esm/chunk-2QV6HI3M.mjs +0 -2
- package/dist/esm/chunk-2QV6HI3M.mjs.map +0 -1
- package/dist/esm/chunk-7IGH7N52.mjs +0 -2
- package/dist/esm/chunk-7IGH7N52.mjs.map +0 -1
- package/dist/esm/chunk-B2ZKW23W.mjs +0 -2
- package/dist/esm/chunk-CCUD52OF.mjs +0 -2
- package/dist/esm/chunk-CCUD52OF.mjs.map +0 -1
- package/dist/esm/chunk-CVEJHRAU.mjs.map +0 -1
- package/dist/esm/chunk-ENKMOALS.mjs.map +0 -1
- package/dist/esm/chunk-ERWQOVBF.mjs +0 -2
- package/dist/esm/chunk-ERWQOVBF.mjs.map +0 -1
- package/dist/esm/chunk-FBFMQZTM.mjs +0 -2
- package/dist/esm/chunk-FBFMQZTM.mjs.map +0 -1
- package/dist/esm/chunk-FBPNHF54.mjs +0 -2
- package/dist/esm/chunk-FP5DPRYL.mjs +0 -2
- package/dist/esm/chunk-FP5DPRYL.mjs.map +0 -1
- package/dist/esm/chunk-GD4ULEBC.mjs +0 -2
- package/dist/esm/chunk-GD5TZLBF.mjs +0 -2
- package/dist/esm/chunk-HHJBCGAQ.mjs +0 -2
- package/dist/esm/chunk-HHJBCGAQ.mjs.map +0 -1
- package/dist/esm/chunk-I7WRJY7K.mjs +0 -2
- package/dist/esm/chunk-I7WRJY7K.mjs.map +0 -1
- package/dist/esm/chunk-IHCIKE42.mjs +0 -2
- package/dist/esm/chunk-LHJSG5NE.mjs +0 -2
- package/dist/esm/chunk-LHJSG5NE.mjs.map +0 -1
- package/dist/esm/chunk-MEPX7Z2Z.mjs +0 -2
- package/dist/esm/chunk-NWRKJFHV.mjs +0 -2
- package/dist/esm/chunk-O57QZZF2.mjs.map +0 -1
- package/dist/esm/chunk-PPTG6BDV.mjs +0 -2
- package/dist/esm/chunk-QKTV6AZ7.mjs +0 -2
- package/dist/esm/chunk-QRQAR6XO.mjs +0 -2
- package/dist/esm/chunk-S3FBGS3W.mjs +0 -2
- package/dist/esm/chunk-S3FBGS3W.mjs.map +0 -1
- package/dist/esm/chunk-SBMJNU2O.mjs +0 -2
- package/dist/esm/chunk-SBMJNU2O.mjs.map +0 -1
- package/dist/esm/chunk-SRZTA6QH.mjs +0 -2
- package/dist/esm/chunk-UCHGKGCF.mjs +0 -2
- package/dist/esm/chunk-UCHGKGCF.mjs.map +0 -1
- package/dist/esm/chunk-UIVJXLRM.mjs +0 -1
- package/dist/esm/chunk-V6JFR2CB.mjs +0 -2
- package/dist/esm/chunk-V6JFR2CB.mjs.map +0 -1
- package/dist/esm/chunk-VRSUCKJA.mjs +0 -2
- package/dist/esm/chunk-XZYPAQCU.mjs +0 -2
- package/dist/esm/chunk-YL2EDK5M.mjs +0 -2
- package/dist/esm/chunk-YL2EDK5M.mjs.map +0 -1
- package/dist/esm/chunk-ZFIMVSCR.mjs +0 -2
- package/dist/esm/chunk-ZFIMVSCR.mjs.map +0 -1
- package/dist/esm/core/account.d.mts +0 -184
- package/dist/esm/core/account.mjs +0 -2
- package/dist/esm/core/crypto/anyPublicKey.d.mts +0 -59
- package/dist/esm/core/crypto/anyPublicKey.mjs +0 -2
- package/dist/esm/core/crypto/anySignature.d.mts +0 -31
- package/dist/esm/core/crypto/anySignature.mjs +0 -2
- package/dist/esm/core/crypto/asymmetricCrypto.d.mts +0 -74
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +0 -2
- package/src/core/account.ts +0 -282
- package/src/core/crypto/anyPublicKey.ts +0 -92
- package/src/core/crypto/anySignature.ts +0 -56
- package/src/core/crypto/asymmetricCrypto.ts +0 -77
- /package/dist/esm/{chunk-UIVJXLRM.mjs.map → assetUploader/assetUploader.mjs.map} +0 -0
- /package/dist/esm/{core/account.mjs.map → assetUploader/index.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/anyPublicKey.mjs.map → assetUploader/irys.mjs.map} +0 -0
- /package/dist/esm/{chunk-PPTG6BDV.mjs.map → chunk-4LUWUDBX.mjs.map} +0 -0
- /package/dist/esm/{chunk-7D5LHQNS.mjs.map → chunk-5PIO6MFF.mjs.map} +0 -0
- /package/dist/esm/{chunk-VKZCIGKY.mjs.map → chunk-6TUHLGW3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ENDUXRTK.mjs.map → chunk-7KPEDF2R.mjs.map} +0 -0
- /package/dist/esm/{chunk-GD4ULEBC.mjs.map → chunk-AXVVJKE4.mjs.map} +0 -0
- /package/dist/esm/{chunk-NL72WE3E.mjs.map → chunk-BZMO6Q6L.mjs.map} +0 -0
- /package/dist/esm/{chunk-XBVORX5O.mjs.map → chunk-FAAWSTXC.mjs.map} +0 -0
- /package/dist/esm/{chunk-AFPJ2XXN.mjs.map → chunk-FHWAJCJR.mjs.map} +0 -0
- /package/dist/esm/{chunk-VPQ46CAO.mjs.map → chunk-GE7VQ5NZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6FBKUTGF.mjs.map → chunk-GHYE26Q5.mjs.map} +0 -0
- /package/dist/esm/{chunk-2H5Z5EHH.mjs.map → chunk-HKAJ5N25.mjs.map} +0 -0
- /package/dist/esm/{chunk-PJNPLRPR.mjs.map → chunk-HWTX3HVX.mjs.map} +0 -0
- /package/dist/esm/{chunk-B2ZKW23W.mjs.map → chunk-IFVMIUMO.mjs.map} +0 -0
- /package/dist/esm/{chunk-6SRENFWH.mjs.map → chunk-IMYKTNDV.mjs.map} +0 -0
- /package/dist/esm/{chunk-PMWH5IGI.mjs.map → chunk-ITALFUWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-JB7ZOUYL.mjs.map} +0 -0
- /package/dist/esm/{chunk-2WFMD6C6.mjs.map → chunk-JMR7G5DT.mjs.map} +0 -0
- /package/dist/esm/{chunk-S64WKSMI.mjs.map → chunk-JOIUR5QW.mjs.map} +0 -0
- /package/dist/esm/{chunk-4OI7MPFH.mjs.map → chunk-K5XJKIFT.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/anySignature.mjs.map → chunk-KUX6GQ2E.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q5HK3U64.mjs.map → chunk-L4PAU62E.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/asymmetricCrypto.mjs.map → chunk-L7ORFGZ7.mjs.map} +0 -0
- /package/dist/esm/{chunk-FBPNHF54.mjs.map → chunk-LG7RJQ57.mjs.map} +0 -0
- /package/dist/esm/{chunk-IHCIKE42.mjs.map → chunk-M6TKSJ4I.mjs.map} +0 -0
- /package/dist/esm/{chunk-2DNPRIS5.mjs.map → chunk-MVWTTVQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-GD5TZLBF.mjs.map → chunk-NA2H44NE.mjs.map} +0 -0
- /package/dist/esm/{chunk-R56OJ4XC.mjs.map → chunk-NYGCJ6EJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-PIXE7MN5.mjs.map → chunk-NZGON5TY.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y4AKS4CY.mjs.map → chunk-O5Q3RSEJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LATJGGVX.mjs.map → chunk-PATJMQAG.mjs.map} +0 -0
- /package/dist/esm/{chunk-SXIFL5DQ.mjs.map → chunk-RC5K63LK.mjs.map} +0 -0
- /package/dist/esm/{chunk-QGIJNA37.mjs.map → chunk-SKF6E6X7.mjs.map} +0 -0
- /package/dist/esm/{chunk-QKTV6AZ7.mjs.map → chunk-TWHTXYMB.mjs.map} +0 -0
- /package/dist/esm/{chunk-JQVT2K7G.mjs.map → chunk-UCFIV5UD.mjs.map} +0 -0
- /package/dist/esm/{chunk-JJ6Y35DF.mjs.map → chunk-UFD443TT.mjs.map} +0 -0
- /package/dist/esm/{chunk-M3WNE7MU.mjs.map → chunk-UVTSJ2KP.mjs.map} +0 -0
- /package/dist/esm/{chunk-KJGQ4ILY.mjs.map → chunk-UZ3SFWTM.mjs.map} +0 -0
- /package/dist/esm/{chunk-V2FPYAK7.mjs.map → chunk-VPN3KEVB.mjs.map} +0 -0
- /package/dist/esm/{chunk-QRQAR6XO.mjs.map → chunk-VQM4LMCW.mjs.map} +0 -0
- /package/dist/esm/{chunk-W4UDMBMU.mjs.map → chunk-VWWR2UAQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7MOQC7Z.mjs.map → chunk-VZJ62XF7.mjs.map} +0 -0
- /package/dist/esm/{chunk-N4RBQZ2B.mjs.map → chunk-W2XLZW4Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-FRLPX47J.mjs.map → chunk-XH4B5K6W.mjs.map} +0 -0
- /package/dist/esm/{chunk-4M46AWXX.mjs.map → chunk-XSCYT6TT.mjs.map} +0 -0
- /package/dist/esm/{chunk-EUHPML5E.mjs.map → chunk-XSYZX66A.mjs.map} +0 -0
- /package/dist/esm/{chunk-SPOHAEHR.mjs.map → chunk-YTHL7EKV.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q3HAJVCM.mjs.map → chunk-YXUOYXGZ.mjs.map} +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { HexInput } from '../../types/index.mjs';
|
|
2
|
-
import { Serializable, Serializer } from '../../bcs/serializer.mjs';
|
|
3
|
-
import '../../utils/apiEndpoints.mjs';
|
|
4
|
-
import '../../types/indexer.mjs';
|
|
5
|
-
import '../../types/generated/operations.mjs';
|
|
6
|
-
import '../../types/generated/types.mjs';
|
|
7
|
-
import '../hex.mjs';
|
|
8
|
-
import '../common.mjs';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* An abstract representation of a public key. All Asymmetric key pairs will use this to
|
|
12
|
-
* verify signatures and for authentication keys.
|
|
13
|
-
*/
|
|
14
|
-
declare abstract class PublicKey extends Serializable {
|
|
15
|
-
/**
|
|
16
|
-
* Verifies that the private key associated with this public key signed the message with the given signature.
|
|
17
|
-
* @param args.message The message that was signed
|
|
18
|
-
* @param args.signature The signature to verify
|
|
19
|
-
*/
|
|
20
|
-
abstract verifySignature(args: {
|
|
21
|
-
message: HexInput;
|
|
22
|
-
signature: Signature;
|
|
23
|
-
}): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Get the raw public key bytes
|
|
26
|
-
*/
|
|
27
|
-
abstract toUint8Array(): Uint8Array;
|
|
28
|
-
/**
|
|
29
|
-
* Get the public key as a hex string with a 0x prefix e.g. 0x123456...
|
|
30
|
-
*/
|
|
31
|
-
abstract toString(): string;
|
|
32
|
-
abstract serialize(serializer: Serializer): void;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* An abstract representation of a private key. This is used to sign transactions and
|
|
36
|
-
* derive the public key associated.
|
|
37
|
-
*/
|
|
38
|
-
declare abstract class PrivateKey extends Serializable {
|
|
39
|
-
/**
|
|
40
|
-
* Sign a message with the key
|
|
41
|
-
* @param message The message to sign
|
|
42
|
-
*/
|
|
43
|
-
abstract sign(message: HexInput): Signature;
|
|
44
|
-
/**
|
|
45
|
-
* Get the raw private key bytes
|
|
46
|
-
*/
|
|
47
|
-
abstract toUint8Array(): Uint8Array;
|
|
48
|
-
/**
|
|
49
|
-
* Get the private key as a hex string with a 0x prefix e.g. 0x123456...
|
|
50
|
-
*/
|
|
51
|
-
abstract toString(): string;
|
|
52
|
-
abstract serialize(serializer: Serializer): void;
|
|
53
|
-
/**
|
|
54
|
-
* Derives the public key associated with the private key
|
|
55
|
-
*/
|
|
56
|
-
abstract publicKey(): PublicKey;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* An abstract representation of a signature. This is the product of signing a
|
|
60
|
-
* message and can be used with the PublicKey to verify the signature.
|
|
61
|
-
*/
|
|
62
|
-
declare abstract class Signature extends Serializable {
|
|
63
|
-
/**
|
|
64
|
-
* Get the raw signature bytes
|
|
65
|
-
*/
|
|
66
|
-
abstract toUint8Array(): Uint8Array;
|
|
67
|
-
/**
|
|
68
|
-
* Get the signature as a hex string with a 0x prefix e.g. 0x123456...
|
|
69
|
-
*/
|
|
70
|
-
abstract toString(): string;
|
|
71
|
-
abstract serialize(serializer: Serializer): void;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { PrivateKey, PublicKey, Signature };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"../../chunk-V6JFR2CB.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-PPTG6BDV.mjs";import"../../chunk-B2ZKW23W.mjs";import"../../chunk-F7MOQC7Z.mjs";import"../../chunk-VRSUCKJA.mjs";import"../../chunk-6IFMQ5AS.mjs";import"../../chunk-N4RBQZ2B.mjs";import"../../chunk-NL72WE3E.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-CVEJHRAU.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FVA2OPG4.mjs";export{b as PrivateKey,a as PublicKey,c as Signature};
|
|
2
|
-
//# sourceMappingURL=asymmetricCrypto.mjs.map
|
package/src/core/account.ts
DELETED
|
@@ -1,282 +0,0 @@
|
|
|
1
|
-
// Copyright © Aptos Foundation
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { AccountAddress } from "./accountAddress";
|
|
5
|
-
import { AuthenticationKey } from "./authenticationKey";
|
|
6
|
-
import { PrivateKey, PublicKey, Signature } from "./crypto/asymmetricCrypto";
|
|
7
|
-
import { Ed25519PrivateKey, Ed25519PublicKey } from "./crypto/ed25519";
|
|
8
|
-
import { MultiEd25519PublicKey } from "./crypto/multiEd25519";
|
|
9
|
-
import { Secp256k1PrivateKey, Secp256k1PublicKey } from "./crypto/secp256k1";
|
|
10
|
-
import { Hex } from "./hex";
|
|
11
|
-
import { GenerateAccount, HexInput, SigningScheme, SigningSchemeInput } from "../types";
|
|
12
|
-
import { AnyPublicKey } from "./crypto/anyPublicKey";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Class for creating and managing account on Aptos network
|
|
16
|
-
*
|
|
17
|
-
* Use this class to create accounts, sign transactions, and more.
|
|
18
|
-
* Note: Creating an account instance does not create the account on-chain.
|
|
19
|
-
*
|
|
20
|
-
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
21
|
-
* `Legacy` and `Unified` authentications.
|
|
22
|
-
*
|
|
23
|
-
* @Legacy includes `ED25519` and `MultiED25519`
|
|
24
|
-
* @Unified includes `SingleSender` and `MultiSender`, where currently
|
|
25
|
-
* `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports
|
|
26
|
-
* `MultiED25519`.
|
|
27
|
-
*
|
|
28
|
-
* In TypeScript SDK, we support all of these options:
|
|
29
|
-
*
|
|
30
|
-
* @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument
|
|
31
|
-
* that lets you generate new keys conforming to the Unified authentication.
|
|
32
|
-
*
|
|
33
|
-
* @fromPrivateKey derives an account by a provided private key and address, with an optional
|
|
34
|
-
* `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.
|
|
35
|
-
*
|
|
36
|
-
* @fromDerivationPath derives an account with bip44 path and mnemonics,
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
export class Account {
|
|
40
|
-
/**
|
|
41
|
-
* Public key associated with the account
|
|
42
|
-
*/
|
|
43
|
-
readonly publicKey: PublicKey;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Private key associated with the account
|
|
47
|
-
*/
|
|
48
|
-
readonly privateKey: PrivateKey;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Account address associated with the account
|
|
52
|
-
*/
|
|
53
|
-
readonly accountAddress: AccountAddress;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Signing scheme used to sign transactions
|
|
57
|
-
*/
|
|
58
|
-
readonly signingScheme: SigningScheme;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* constructor for Account
|
|
62
|
-
*
|
|
63
|
-
* Need to update this to use the new crypto library if new schemes are added.
|
|
64
|
-
*
|
|
65
|
-
* @param args.privateKey PrivateKey - private key of the account
|
|
66
|
-
* @param args.address AccountAddress - address of the account
|
|
67
|
-
* @param args.legacy optional. If set to false, the keypair authentication keys will be derived with a unified scheme.
|
|
68
|
-
* Defaults to deriving an authentication key with the legacy scheme.
|
|
69
|
-
*
|
|
70
|
-
* This method is private because it should only be called by the factory static methods.
|
|
71
|
-
* @returns Account
|
|
72
|
-
*/
|
|
73
|
-
private constructor(args: { privateKey: PrivateKey; address: AccountAddress; legacy?: boolean }) {
|
|
74
|
-
const { privateKey, address, legacy } = args;
|
|
75
|
-
const useLegacy = legacy ?? true;
|
|
76
|
-
|
|
77
|
-
// Derive the public key from the private key
|
|
78
|
-
this.publicKey = privateKey.publicKey();
|
|
79
|
-
|
|
80
|
-
// Derive the signing scheme from the public key
|
|
81
|
-
if (this.publicKey instanceof Ed25519PublicKey) {
|
|
82
|
-
if (useLegacy) {
|
|
83
|
-
this.signingScheme = SigningScheme.Ed25519;
|
|
84
|
-
} else {
|
|
85
|
-
this.publicKey = new AnyPublicKey(this.publicKey);
|
|
86
|
-
this.signingScheme = SigningScheme.SingleKey;
|
|
87
|
-
}
|
|
88
|
-
} else if (this.publicKey instanceof MultiEd25519PublicKey) {
|
|
89
|
-
this.signingScheme = SigningScheme.MultiEd25519;
|
|
90
|
-
} else if (this.publicKey instanceof Secp256k1PublicKey) {
|
|
91
|
-
this.publicKey = new AnyPublicKey(this.publicKey);
|
|
92
|
-
this.signingScheme = SigningScheme.SingleKey;
|
|
93
|
-
} else {
|
|
94
|
-
throw new Error("Can not create new Account, unsupported public key type");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
this.privateKey = privateKey;
|
|
98
|
-
this.accountAddress = address;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Derives an account with random private key and address.
|
|
103
|
-
*
|
|
104
|
-
* Default generation is using the Legacy ED25519 key
|
|
105
|
-
*
|
|
106
|
-
* @param args optional. Unify GenerateAccount type for Legacy and Unified keys
|
|
107
|
-
*
|
|
108
|
-
* Account input type to generate an account using Legacy
|
|
109
|
-
* Ed25519 or MultiEd25519 keys or without a specified `scheme`.
|
|
110
|
-
* ```
|
|
111
|
-
* GenerateAccountWithLegacyKey = {
|
|
112
|
-
* scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;
|
|
113
|
-
* legacy: true;
|
|
114
|
-
* };
|
|
115
|
-
* ```
|
|
116
|
-
*
|
|
117
|
-
* Account input type to generate an account using Unified
|
|
118
|
-
* Secp256k1Ecdsa key
|
|
119
|
-
* In this case `legacy` is always false
|
|
120
|
-
* ```
|
|
121
|
-
* GenerateAccountWithUnifiedKey = {
|
|
122
|
-
* scheme: SigningSchemeInput.Secp256k1Ecdsa;
|
|
123
|
-
* legacy?: false;
|
|
124
|
-
* };
|
|
125
|
-
* ```
|
|
126
|
-
*
|
|
127
|
-
* @returns Account with the given signing scheme
|
|
128
|
-
*/
|
|
129
|
-
static generate(args?: GenerateAccount): Account {
|
|
130
|
-
const useLegacy = args?.legacy ?? true;
|
|
131
|
-
|
|
132
|
-
let privateKey: PrivateKey;
|
|
133
|
-
let publicKey: PublicKey;
|
|
134
|
-
|
|
135
|
-
switch (args?.scheme) {
|
|
136
|
-
case SigningSchemeInput.Secp256k1Ecdsa:
|
|
137
|
-
privateKey = Secp256k1PrivateKey.generate();
|
|
138
|
-
publicKey = new AnyPublicKey(privateKey.publicKey());
|
|
139
|
-
break;
|
|
140
|
-
default:
|
|
141
|
-
privateKey = Ed25519PrivateKey.generate();
|
|
142
|
-
if (useLegacy === false) {
|
|
143
|
-
publicKey = new AnyPublicKey(privateKey.publicKey());
|
|
144
|
-
} else {
|
|
145
|
-
publicKey = privateKey.publicKey();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
const authKey = AuthenticationKey.fromPublicKey({ publicKey });
|
|
149
|
-
|
|
150
|
-
const address = authKey.derivedAddress();
|
|
151
|
-
return new Account({ privateKey, address, legacy: args?.legacy });
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Instantiates an account given a private key.
|
|
156
|
-
*
|
|
157
|
-
* This is used as a local calculation and therefore is used to instantiate an `Account`
|
|
158
|
-
* that has not had its authentication key rotated.
|
|
159
|
-
*
|
|
160
|
-
* @param privateKey PrivateKey - private key of the account
|
|
161
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
162
|
-
* to generating a Legacy Ed25519 keypair
|
|
163
|
-
*
|
|
164
|
-
* @returns Account
|
|
165
|
-
*/
|
|
166
|
-
static fromPrivateKey(args: { privateKey: PrivateKey; legacy?: boolean }): Account {
|
|
167
|
-
const { privateKey, legacy } = args;
|
|
168
|
-
const useLegacy = legacy ?? true;
|
|
169
|
-
|
|
170
|
-
let publicKey;
|
|
171
|
-
if (privateKey instanceof Secp256k1PrivateKey) {
|
|
172
|
-
// Secp256k1 single sender
|
|
173
|
-
publicKey = new AnyPublicKey(privateKey.publicKey());
|
|
174
|
-
} else if (privateKey instanceof Ed25519PrivateKey) {
|
|
175
|
-
// legacy Ed25519
|
|
176
|
-
if (useLegacy) {
|
|
177
|
-
publicKey = privateKey.publicKey();
|
|
178
|
-
} else {
|
|
179
|
-
// Ed25519 single sender
|
|
180
|
-
publicKey = new AnyPublicKey(privateKey.publicKey());
|
|
181
|
-
}
|
|
182
|
-
} else {
|
|
183
|
-
throw new Error(`Unsupported private key ${privateKey}`);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const authKey = AuthenticationKey.fromPublicKey({ publicKey });
|
|
187
|
-
const address = authKey.derivedAddress();
|
|
188
|
-
return new Account({ privateKey, address, legacy: useLegacy });
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Instantiates an account given a private key and a specified account address.
|
|
193
|
-
* This is primarily used to instantiate an `Account` that has had its authentication key rotated.
|
|
194
|
-
*
|
|
195
|
-
* @param args.privateKey PrivateKey - the underlying private key for the account
|
|
196
|
-
* @param args.address AccountAddress - The account address the `Account` will sign for
|
|
197
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
198
|
-
* to generating a Legacy Ed25519 keypair
|
|
199
|
-
*
|
|
200
|
-
* @returns Account
|
|
201
|
-
*/
|
|
202
|
-
static fromPrivateKeyAndAddress(args: {
|
|
203
|
-
privateKey: PrivateKey;
|
|
204
|
-
address: AccountAddress;
|
|
205
|
-
legacy?: boolean;
|
|
206
|
-
}): Account {
|
|
207
|
-
const { privateKey, address, legacy } = args;
|
|
208
|
-
return new Account({ privateKey, address, legacy });
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Derives an account with bip44 path and mnemonics,
|
|
213
|
-
*
|
|
214
|
-
* @param args.scheme The signing scheme to derive with
|
|
215
|
-
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
|
|
216
|
-
* or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
|
|
217
|
-
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
218
|
-
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
219
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
220
|
-
* to generating a Legacy Ed25519 keypair
|
|
221
|
-
*
|
|
222
|
-
* @returns Account
|
|
223
|
-
*/
|
|
224
|
-
static fromDerivationPath(args: {
|
|
225
|
-
scheme: SigningSchemeInput;
|
|
226
|
-
path: string;
|
|
227
|
-
mnemonic: string;
|
|
228
|
-
legacy?: boolean;
|
|
229
|
-
}): Account {
|
|
230
|
-
const { path, mnemonic, scheme, legacy } = args;
|
|
231
|
-
let privateKey: PrivateKey;
|
|
232
|
-
switch (scheme) {
|
|
233
|
-
case SigningSchemeInput.Secp256k1Ecdsa:
|
|
234
|
-
privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);
|
|
235
|
-
break;
|
|
236
|
-
case SigningSchemeInput.Ed25519:
|
|
237
|
-
privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);
|
|
238
|
-
break;
|
|
239
|
-
default:
|
|
240
|
-
throw new Error(`Unsupported scheme ${scheme}`);
|
|
241
|
-
}
|
|
242
|
-
return Account.fromPrivateKey({ privateKey, legacy });
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* This key enables account owners to rotate their private key(s)
|
|
247
|
-
* associated with the account without changing the address that hosts their account.
|
|
248
|
-
* See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}
|
|
249
|
-
*
|
|
250
|
-
* @param args.publicKey PublicKey - public key of the account
|
|
251
|
-
* @returns The authentication key for the associated account
|
|
252
|
-
*/
|
|
253
|
-
static authKey(args: { publicKey: PublicKey }): AuthenticationKey {
|
|
254
|
-
const { publicKey } = args;
|
|
255
|
-
return AuthenticationKey.fromPublicKey({ publicKey });
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Sign the given message with the private key.
|
|
260
|
-
*
|
|
261
|
-
* TODO: Add sign transaction or specific types
|
|
262
|
-
*
|
|
263
|
-
* @param data in HexInput format
|
|
264
|
-
* @returns Signature
|
|
265
|
-
*/
|
|
266
|
-
sign(data: HexInput): Signature {
|
|
267
|
-
return this.privateKey.sign(data);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Verify the given message and signature with the public key.
|
|
272
|
-
*
|
|
273
|
-
* @param args.message raw message data in HexInput format
|
|
274
|
-
* @param args.signature signed message Signature
|
|
275
|
-
* @returns
|
|
276
|
-
*/
|
|
277
|
-
verifySignature(args: { message: HexInput; signature: Signature }): boolean {
|
|
278
|
-
const { message, signature } = args;
|
|
279
|
-
const rawMessage = Hex.fromHexInput(message).toUint8Array();
|
|
280
|
-
return this.publicKey.verifySignature({ message: rawMessage, signature });
|
|
281
|
-
}
|
|
282
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { Serializer, Deserializer } from "../../bcs";
|
|
2
|
-
import { AnyPublicKeyVariant, HexInput } from "../../types";
|
|
3
|
-
import { AnySignature } from "./anySignature";
|
|
4
|
-
import { PublicKey } from "./asymmetricCrypto";
|
|
5
|
-
import { Ed25519PublicKey } from "./ed25519";
|
|
6
|
-
import { Secp256k1PublicKey } from "./secp256k1";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Represents any public key supported by Aptos.
|
|
10
|
-
*
|
|
11
|
-
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
12
|
-
* `Legacy` and `Unified` authentication keys.
|
|
13
|
-
*
|
|
14
|
-
* Any unified authentication key is represented in the SDK as `AnyPublicKey`.
|
|
15
|
-
*/
|
|
16
|
-
export class AnyPublicKey extends PublicKey {
|
|
17
|
-
/**
|
|
18
|
-
* Reference to the inner public key
|
|
19
|
-
*/
|
|
20
|
-
public readonly publicKey: PublicKey;
|
|
21
|
-
|
|
22
|
-
constructor(publicKey: PublicKey) {
|
|
23
|
-
super();
|
|
24
|
-
this.publicKey = publicKey;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Get the public key in bytes (Uint8Array).
|
|
29
|
-
*
|
|
30
|
-
* @returns Uint8Array representation of the public key
|
|
31
|
-
*/
|
|
32
|
-
toUint8Array(): Uint8Array {
|
|
33
|
-
return this.publicKey.toUint8Array();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get the public key as a hex string with the 0x prefix.
|
|
38
|
-
*
|
|
39
|
-
* @returns string representation of the public key
|
|
40
|
-
*/
|
|
41
|
-
toString(): string {
|
|
42
|
-
return this.publicKey.toString();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Verifies a signed data with a public key
|
|
47
|
-
*
|
|
48
|
-
* @param args.message message
|
|
49
|
-
* @param args.signature The signature
|
|
50
|
-
* @returns true if the signature is valid
|
|
51
|
-
*/
|
|
52
|
-
verifySignature(args: { message: HexInput; signature: AnySignature }): boolean {
|
|
53
|
-
const { message, signature } = args;
|
|
54
|
-
return this.publicKey.verifySignature({ message, signature });
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
serialize(serializer: Serializer): void {
|
|
58
|
-
if (this.publicKey instanceof Ed25519PublicKey) {
|
|
59
|
-
serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Ed25519);
|
|
60
|
-
this.publicKey.serialize(serializer);
|
|
61
|
-
} else if (this.publicKey instanceof Secp256k1PublicKey) {
|
|
62
|
-
serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Secp256k1);
|
|
63
|
-
this.publicKey.serialize(serializer);
|
|
64
|
-
} else {
|
|
65
|
-
throw new Error("Unknown public key type");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static deserialize(deserializer: Deserializer): AnyPublicKey {
|
|
70
|
-
const index = deserializer.deserializeUleb128AsU32();
|
|
71
|
-
switch (index) {
|
|
72
|
-
case AnyPublicKeyVariant.Ed25519:
|
|
73
|
-
return new AnyPublicKey(Ed25519PublicKey.load(deserializer));
|
|
74
|
-
case AnyPublicKeyVariant.Secp256k1:
|
|
75
|
-
return new AnyPublicKey(Secp256k1PublicKey.load(deserializer));
|
|
76
|
-
default:
|
|
77
|
-
throw new Error(`Unknown variant index for AnyPublicKey: ${index}`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
static isPublicKey(publicKey: PublicKey): publicKey is AnyPublicKey {
|
|
82
|
-
return publicKey instanceof AnyPublicKey;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
isEd25519(): this is Ed25519PublicKey {
|
|
86
|
-
return this.publicKey instanceof Ed25519PublicKey;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
isSecp256k1PublicKey(): this is Secp256k1PublicKey {
|
|
90
|
-
return this.publicKey instanceof Secp256k1PublicKey;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Serializer, Deserializer } from "../../bcs";
|
|
2
|
-
import { AnySignatureVariant } from "../../types";
|
|
3
|
-
import { Signature } from "./asymmetricCrypto";
|
|
4
|
-
import { Ed25519Signature } from "./ed25519";
|
|
5
|
-
import { Secp256k1Signature } from "./secp256k1";
|
|
6
|
-
|
|
7
|
-
export class AnySignature extends Signature {
|
|
8
|
-
public readonly signature: Signature;
|
|
9
|
-
|
|
10
|
-
constructor(signature: Signature) {
|
|
11
|
-
super();
|
|
12
|
-
this.signature = signature;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Get the public key in bytes (Uint8Array).
|
|
17
|
-
*
|
|
18
|
-
* @returns Uint8Array representation of the public key
|
|
19
|
-
*/
|
|
20
|
-
toUint8Array(): Uint8Array {
|
|
21
|
-
return this.signature.toUint8Array();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get the public key as a hex string with the 0x prefix.
|
|
26
|
-
*
|
|
27
|
-
* @returns string representation of the public key
|
|
28
|
-
*/
|
|
29
|
-
toString(): string {
|
|
30
|
-
return this.signature.toString();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
serialize(serializer: Serializer): void {
|
|
34
|
-
if (this.signature instanceof Ed25519Signature) {
|
|
35
|
-
serializer.serializeU32AsUleb128(AnySignatureVariant.Ed25519);
|
|
36
|
-
this.signature.serialize(serializer);
|
|
37
|
-
} else if (this.signature instanceof Secp256k1Signature) {
|
|
38
|
-
serializer.serializeU32AsUleb128(AnySignatureVariant.Secp256k1);
|
|
39
|
-
this.signature.serialize(serializer);
|
|
40
|
-
} else {
|
|
41
|
-
throw new Error("Unknown signature type");
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static deserialize(deserializer: Deserializer): AnySignature {
|
|
46
|
-
const index = deserializer.deserializeUleb128AsU32();
|
|
47
|
-
switch (index) {
|
|
48
|
-
case AnySignatureVariant.Ed25519:
|
|
49
|
-
return new AnySignature(Ed25519Signature.load(deserializer));
|
|
50
|
-
case AnySignatureVariant.Secp256k1:
|
|
51
|
-
return new AnySignature(Secp256k1Signature.load(deserializer));
|
|
52
|
-
default:
|
|
53
|
-
throw new Error(`Unknown variant index for AnySignature: ${index}`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
// Copyright © Aptos Foundation
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { Serializable, Serializer } from "../../bcs";
|
|
5
|
-
import { HexInput } from "../../types";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* An abstract representation of a public key. All Asymmetric key pairs will use this to
|
|
9
|
-
* verify signatures and for authentication keys.
|
|
10
|
-
*/
|
|
11
|
-
export abstract class PublicKey extends Serializable {
|
|
12
|
-
/**
|
|
13
|
-
* Verifies that the private key associated with this public key signed the message with the given signature.
|
|
14
|
-
* @param args.message The message that was signed
|
|
15
|
-
* @param args.signature The signature to verify
|
|
16
|
-
*/
|
|
17
|
-
abstract verifySignature(args: { message: HexInput; signature: Signature }): boolean;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Get the raw public key bytes
|
|
21
|
-
*/
|
|
22
|
-
abstract toUint8Array(): Uint8Array;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get the public key as a hex string with a 0x prefix e.g. 0x123456...
|
|
26
|
-
*/
|
|
27
|
-
abstract toString(): string;
|
|
28
|
-
|
|
29
|
-
abstract serialize(serializer: Serializer): void;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* An abstract representation of a private key. This is used to sign transactions and
|
|
34
|
-
* derive the public key associated.
|
|
35
|
-
*/
|
|
36
|
-
export abstract class PrivateKey extends Serializable {
|
|
37
|
-
/**
|
|
38
|
-
* Sign a message with the key
|
|
39
|
-
* @param message The message to sign
|
|
40
|
-
*/
|
|
41
|
-
abstract sign(message: HexInput): Signature;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Get the raw private key bytes
|
|
45
|
-
*/
|
|
46
|
-
abstract toUint8Array(): Uint8Array;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get the private key as a hex string with a 0x prefix e.g. 0x123456...
|
|
50
|
-
*/
|
|
51
|
-
abstract toString(): string;
|
|
52
|
-
|
|
53
|
-
abstract serialize(serializer: Serializer): void;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Derives the public key associated with the private key
|
|
57
|
-
*/
|
|
58
|
-
abstract publicKey(): PublicKey;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* An abstract representation of a signature. This is the product of signing a
|
|
63
|
-
* message and can be used with the PublicKey to verify the signature.
|
|
64
|
-
*/
|
|
65
|
-
export abstract class Signature extends Serializable {
|
|
66
|
-
/**
|
|
67
|
-
* Get the raw signature bytes
|
|
68
|
-
*/
|
|
69
|
-
abstract toUint8Array(): Uint8Array;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Get the signature as a hex string with a 0x prefix e.g. 0x123456...
|
|
73
|
-
*/
|
|
74
|
-
abstract toString(): string;
|
|
75
|
-
|
|
76
|
-
abstract serialize(serializer: Serializer): void;
|
|
77
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|