@aptos-labs/ts-sdk 1.35.0-zeta.2 → 1.36.0-zeta.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/dist/common/{accountAddress-Ce4Cv60D.d.ts → accountAddress-C685VEzA.d.ts} +11 -99
- package/dist/common/chunk-5GUWOXQG.js +4 -0
- package/dist/common/chunk-5GUWOXQG.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -486
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +9105 -8699
- package/dist/common/index.js +436 -18333
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-D4j3_WIS.d.mts → Ed25519Account-6KGApCPu.d.mts} +3 -3
- package/dist/esm/account/AbstractKeylessAccount.d.mts +23 -13
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -75
- package/dist/esm/account/AbstractedAccount.d.mts +10 -10
- package/dist/esm/account/AbstractedAccount.mjs +1 -74
- package/dist/esm/account/Account.d.mts +6 -6
- package/dist/esm/account/Account.mjs +1 -72
- package/dist/esm/account/AccountUtils.d.mts +11 -10
- package/dist/esm/account/AccountUtils.mjs +1 -78
- package/dist/esm/account/Ed25519Account.d.mts +5 -5
- package/dist/esm/account/Ed25519Account.mjs +1 -70
- package/dist/esm/account/EphemeralKeyPair.d.mts +3 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -50
- package/dist/esm/account/FederatedKeylessAccount.d.mts +12 -11
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -72
- package/dist/esm/account/KeylessAccount.d.mts +12 -11
- package/dist/esm/account/KeylessAccount.mjs +1 -72
- package/dist/esm/account/MultiEd25519Account.d.mts +9 -9
- package/dist/esm/account/MultiEd25519Account.mjs +1 -70
- package/dist/esm/account/MultiKeyAccount.d.mts +34 -12
- package/dist/esm/account/MultiKeyAccount.mjs +1 -74
- package/dist/esm/account/SingleKeyAccount.d.mts +5 -5
- package/dist/esm/account/SingleKeyAccount.mjs +1 -72
- package/dist/esm/account/index.d.mts +7 -6
- package/dist/esm/account/index.mjs +1 -119
- package/dist/esm/account/utils.mjs +1 -54
- package/dist/esm/api/account/abstraction.d.mts +9 -9
- package/dist/esm/api/account/abstraction.mjs +1 -101
- package/dist/esm/api/account.d.mts +4 -20
- package/dist/esm/api/account.mjs +1 -105
- package/dist/esm/api/ans.d.mts +13 -13
- package/dist/esm/api/ans.mjs +1 -101
- package/dist/esm/api/aptos.d.mts +6 -5
- package/dist/esm/api/aptos.mjs +1 -139
- package/dist/esm/api/aptosConfig.mjs +1 -9
- package/dist/esm/api/coin.d.mts +9 -9
- package/dist/esm/api/coin.mjs +1 -100
- package/dist/esm/api/digitalAsset.d.mts +5 -5
- package/dist/esm/api/digitalAsset.mjs +1 -101
- package/dist/esm/api/event.mjs +1 -59
- package/dist/esm/api/experimental.d.mts +7 -7
- package/dist/esm/api/experimental.mjs +1 -85
- package/dist/esm/api/faucet.mjs +1 -58
- package/dist/esm/api/fungibleAsset.d.mts +13 -13
- package/dist/esm/api/fungibleAsset.mjs +1 -101
- package/dist/esm/api/general.d.mts +7 -7
- package/dist/esm/api/general.mjs +1 -85
- package/dist/esm/api/index.d.mts +6 -5
- package/dist/esm/api/index.mjs +1 -143
- package/dist/esm/api/keyless.d.mts +20 -19
- package/dist/esm/api/keyless.mjs +1 -102
- package/dist/esm/api/object.mjs +1 -59
- package/dist/esm/api/staking.mjs +1 -59
- package/dist/esm/api/table.mjs +1 -38
- package/dist/esm/api/transaction.d.mts +4 -4
- package/dist/esm/api/transaction.mjs +1 -110
- package/dist/esm/api/transactionSubmission/build.d.mts +9 -9
- package/dist/esm/api/transactionSubmission/build.mjs +1 -99
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -9
- package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/management.mjs +1 -105
- package/dist/esm/api/transactionSubmission/sign.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -218
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +9 -9
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -100
- package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -100
- package/dist/esm/api/utils.mjs +1 -36
- package/dist/esm/bcs/consts.mjs +1 -17
- package/dist/esm/bcs/deserializer.mjs +1 -10
- package/dist/esm/bcs/index.mjs +1 -60
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -12
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -11
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -26
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -22
- package/dist/esm/bcs/serializer.mjs +1 -18
- package/dist/esm/chunk-2V636AYW.mjs +2 -0
- package/dist/esm/{chunk-3IWV2Q3K.mjs.map → chunk-2V636AYW.mjs.map} +1 -1
- package/dist/esm/chunk-35CO4BP4.mjs +2 -0
- package/dist/esm/chunk-35CO4BP4.mjs.map +1 -0
- package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
- package/dist/esm/{chunk-GUA5YTIK.mjs.map → chunk-35DKMW7Q.mjs.map} +1 -1
- package/dist/esm/chunk-3EUHEZND.mjs +2 -0
- package/dist/esm/{chunk-G34CJDST.mjs.map → chunk-3EUHEZND.mjs.map} +1 -1
- package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
- package/dist/esm/{chunk-G4NBRMZ2.mjs.map → chunk-3OLFJ65O.mjs.map} +1 -1
- package/dist/esm/chunk-3RVAGHAA.mjs +2 -0
- package/dist/esm/{chunk-XQFUKBY7.mjs.map → chunk-3RVAGHAA.mjs.map} +1 -1
- package/dist/esm/chunk-4RXKALLC.mjs +2 -0
- package/dist/esm/{chunk-SFLQPB72.mjs.map → chunk-4RXKALLC.mjs.map} +1 -1
- package/dist/esm/chunk-56CNRT2K.mjs +2 -0
- package/dist/esm/{chunk-SBB4YEPT.mjs.map → chunk-56CNRT2K.mjs.map} +1 -1
- package/dist/esm/chunk-6KE4JZD6.mjs +2 -0
- package/dist/esm/chunk-6KE4JZD6.mjs.map +1 -0
- package/dist/esm/chunk-7CRQNXR5.mjs +2 -0
- package/dist/esm/{chunk-YU65LNIC.mjs.map → chunk-7CRQNXR5.mjs.map} +1 -1
- package/dist/esm/chunk-7YTGBTWH.mjs +2 -0
- package/dist/esm/chunk-7YTGBTWH.mjs.map +1 -0
- package/dist/esm/chunk-A3VO773Q.mjs +2 -0
- package/dist/esm/{chunk-KLUO6XPE.mjs.map → chunk-A3VO773Q.mjs.map} +1 -1
- package/dist/esm/chunk-A5L76YP7.mjs +2 -0
- package/dist/esm/{chunk-PT2QHUB6.mjs.map → chunk-A5L76YP7.mjs.map} +1 -1
- package/dist/esm/chunk-AEGA5N2W.mjs +2 -0
- package/dist/esm/{chunk-QJ6CGH7N.mjs.map → chunk-AEGA5N2W.mjs.map} +1 -1
- package/dist/esm/chunk-AIPHJFJL.mjs +2 -0
- package/dist/esm/{chunk-6I37A76G.mjs.map → chunk-AIPHJFJL.mjs.map} +1 -1
- package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
- package/dist/esm/{chunk-MWXBQ6HR.mjs.map → chunk-BMPHQ3E7.mjs.map} +1 -1
- package/dist/esm/chunk-C3Q23D22.mjs +2 -0
- package/dist/esm/{chunk-F7W7KS5C.mjs.map → chunk-C3Q23D22.mjs.map} +1 -1
- package/dist/esm/chunk-CWL7ZA3P.mjs +2 -0
- package/dist/esm/{chunk-6T3V5LXK.mjs.map → chunk-CWL7ZA3P.mjs.map} +1 -1
- package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
- package/dist/esm/{chunk-THWEBWUC.mjs.map → chunk-DOVH6HPL.mjs.map} +1 -1
- package/dist/esm/chunk-EODSU3YN.mjs +2 -0
- package/dist/esm/{chunk-WXQUBQK4.mjs.map → chunk-EODSU3YN.mjs.map} +1 -1
- package/dist/esm/chunk-ERLDXTIY.mjs +2 -0
- package/dist/esm/{chunk-6ASWESA2.mjs.map → chunk-ERLDXTIY.mjs.map} +1 -1
- package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
- package/dist/esm/{chunk-APM7OSLS.mjs.map → chunk-GOXRBEIJ.mjs.map} +1 -1
- package/dist/esm/chunk-HHWJHOFZ.mjs +2 -0
- package/dist/esm/{chunk-KSK3XIGF.mjs.map → chunk-HHWJHOFZ.mjs.map} +1 -1
- package/dist/esm/chunk-IF4UU2MT.mjs +2 -0
- package/dist/esm/{chunk-QPT4BSAB.mjs.map → chunk-IF4UU2MT.mjs.map} +1 -1
- package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
- package/dist/esm/{chunk-LJRNGZMY.mjs.map → chunk-IMTC3J2M.mjs.map} +1 -1
- package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
- package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
- package/dist/esm/{chunk-OFUNBTK4.mjs.map → chunk-KSLLV3ZC.mjs.map} +1 -1
- package/dist/esm/chunk-KXVD52Y6.mjs +2 -0
- package/dist/esm/{chunk-YT7V6AVJ.mjs.map → chunk-KXVD52Y6.mjs.map} +1 -1
- package/dist/esm/chunk-LGC2JORV.mjs +2 -0
- package/dist/esm/chunk-LGC2JORV.mjs.map +1 -0
- package/dist/esm/chunk-LQOSHBB7.mjs +4 -0
- package/dist/esm/{chunk-CXLXUSCG.mjs.map → chunk-LQOSHBB7.mjs.map} +1 -1
- package/dist/esm/chunk-LS3IDL2N.mjs +2 -0
- package/dist/esm/{chunk-MYEYZ7PF.mjs.map → chunk-LS3IDL2N.mjs.map} +1 -1
- package/dist/esm/chunk-MIW45ADL.mjs +2 -0
- package/dist/esm/chunk-MIW45ADL.mjs.map +1 -0
- package/dist/esm/chunk-NFPNWY6Z.mjs +4 -0
- package/dist/esm/chunk-NFPNWY6Z.mjs.map +1 -0
- package/dist/esm/chunk-PDAWVDI7.mjs +2 -0
- package/dist/esm/{chunk-MFFBZ43D.mjs.map → chunk-PDAWVDI7.mjs.map} +1 -1
- package/dist/esm/chunk-PSZYS4RG.mjs +2 -0
- package/dist/esm/{chunk-YK66QBML.mjs.map → chunk-PSZYS4RG.mjs.map} +1 -1
- package/dist/esm/chunk-R6QCPXQG.mjs +2 -0
- package/dist/esm/{chunk-SQNS4SFV.mjs.map → chunk-R6QCPXQG.mjs.map} +1 -1
- package/dist/esm/chunk-RIINVEZA.mjs +2 -0
- package/dist/esm/{chunk-Y3ENAKRC.mjs.map → chunk-RIINVEZA.mjs.map} +1 -1
- package/dist/esm/chunk-RJ7F4JDV.mjs +2 -0
- package/dist/esm/chunk-RJ7F4JDV.mjs.map +1 -0
- package/dist/esm/chunk-RXHER6EA.mjs +2 -0
- package/dist/esm/{chunk-C7T6GW5P.mjs.map → chunk-RXHER6EA.mjs.map} +1 -1
- package/dist/esm/chunk-RXMLONF7.mjs +2 -0
- package/dist/esm/{chunk-BU43ZFDJ.mjs.map → chunk-RXMLONF7.mjs.map} +1 -1
- package/dist/esm/chunk-TBY3VMMV.mjs +2 -0
- package/dist/esm/chunk-TBY3VMMV.mjs.map +1 -0
- package/dist/esm/chunk-TKXEVD7A.mjs +2 -0
- package/dist/esm/{chunk-QSYWLSSN.mjs.map → chunk-TKXEVD7A.mjs.map} +1 -1
- package/dist/esm/chunk-TNWABITK.mjs +2 -0
- package/dist/esm/{chunk-FRLS4GRM.mjs.map → chunk-TNWABITK.mjs.map} +1 -1
- package/dist/esm/chunk-TTY5GFMN.mjs +2 -0
- package/dist/esm/{chunk-PKUXOBIV.mjs.map → chunk-TTY5GFMN.mjs.map} +1 -1
- package/dist/esm/chunk-VHNX2NUR.mjs +473 -0
- package/dist/esm/chunk-VHNX2NUR.mjs.map +1 -0
- package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
- package/dist/esm/{chunk-BDM6FBUO.mjs.map → chunk-VHY6ZATX.mjs.map} +1 -1
- package/dist/esm/chunk-W4BSN6SK.mjs +2 -0
- package/dist/esm/{chunk-ZWCTF3NQ.mjs.map → chunk-W4BSN6SK.mjs.map} +1 -1
- package/dist/esm/chunk-WB26DWOY.mjs +7 -0
- package/dist/esm/chunk-WB26DWOY.mjs.map +1 -0
- package/dist/esm/chunk-X5YB74NB.mjs +2 -0
- package/dist/esm/{chunk-I25AX6PQ.mjs.map → chunk-X5YB74NB.mjs.map} +1 -1
- package/dist/esm/chunk-XLDMPCLF.mjs +2 -0
- package/dist/esm/{chunk-WLTQHGIJ.mjs.map → chunk-XLDMPCLF.mjs.map} +1 -1
- package/dist/esm/chunk-YOZBVVKL.mjs +2 -0
- package/dist/esm/{chunk-BEYIOC2H.mjs.map → chunk-YOZBVVKL.mjs.map} +1 -1
- package/dist/esm/chunk-ZD2TY5N3.mjs +2 -0
- package/dist/esm/{chunk-NUT2VOX2.mjs.map → chunk-ZD2TY5N3.mjs.map} +1 -1
- package/dist/esm/chunk-ZELTLAUN.mjs +2 -0
- package/dist/esm/chunk-ZELTLAUN.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -20
- package/dist/esm/cli/localNode.mjs +1 -16
- package/dist/esm/cli/move.mjs +1 -7
- package/dist/esm/client/core.mjs +1 -34
- package/dist/esm/client/get.mjs +1 -41
- package/dist/esm/client/index.mjs +1 -69
- package/dist/esm/client/post.mjs +1 -43
- package/dist/esm/core/account/index.mjs +1 -21
- package/dist/esm/core/account/utils/address.mjs +1 -19
- package/dist/esm/core/account/utils/index.mjs +1 -20
- package/dist/esm/core/accountAddress.mjs +1 -16
- package/dist/esm/core/authenticationKey.d.mts +3 -1
- package/dist/esm/core/authenticationKey.mjs +1 -15
- package/dist/esm/core/common.mjs +1 -7
- package/dist/esm/core/crypto/abstraction.d.mts +4 -1
- package/dist/esm/core/crypto/abstraction.mjs +1 -26
- package/dist/esm/core/crypto/ed25519.d.mts +18 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -33
- package/dist/esm/core/crypto/ephemeral.d.mts +8 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -30
- package/dist/esm/core/crypto/federatedKeyless.d.mts +11 -87
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -44
- package/dist/esm/core/crypto/hdKey.mjs +1 -25
- package/dist/esm/core/crypto/index.d.mts +8 -6
- package/dist/esm/core/crypto/index.mjs +1 -173
- package/dist/esm/core/crypto/keyless.d.mts +13 -586
- package/dist/esm/core/crypto/keyless.mjs +1 -83
- package/dist/esm/core/crypto/multiEd25519.d.mts +14 -4
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -50
- package/dist/esm/core/crypto/multiKey.d.mts +39 -3
- package/dist/esm/core/crypto/multiKey.mjs +1 -51
- package/dist/esm/core/crypto/poseidon.mjs +1 -15
- package/dist/esm/core/crypto/privateKey.d.mts +3 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -12
- package/dist/esm/core/crypto/proof.mjs +1 -20
- package/dist/esm/core/crypto/publicKey.d.mts +3 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -22
- package/dist/esm/core/crypto/secp256k1.d.mts +26 -2
- package/dist/esm/core/crypto/secp256k1.mjs +1 -29
- package/dist/esm/core/crypto/signature.mjs +1 -20
- package/dist/esm/core/crypto/singleKey.d.mts +27 -5
- package/dist/esm/core/crypto/singleKey.mjs +1 -48
- package/dist/esm/core/crypto/utils.mjs +1 -9
- package/dist/esm/core/hex.mjs +1 -12
- package/dist/esm/core/index.d.mts +8 -6
- package/dist/esm/core/index.mjs +1 -202
- package/dist/esm/errors/index.d.mts +10 -2
- package/dist/esm/errors/index.mjs +1 -25
- package/dist/esm/federatedKeyless-Qe_j8OqV.d.mts +875 -0
- package/dist/esm/index.d.mts +11 -10
- package/dist/esm/index.mjs +1 -798
- package/dist/esm/internal/abstraction.d.mts +9 -9
- package/dist/esm/internal/abstraction.mjs +1 -103
- package/dist/esm/internal/account.d.mts +7 -24
- package/dist/esm/internal/account.mjs +1 -142
- package/dist/esm/internal/ans.d.mts +13 -13
- package/dist/esm/internal/ans.mjs +1 -138
- package/dist/esm/internal/coin.d.mts +7 -7
- package/dist/esm/internal/coin.mjs +1 -99
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -145
- package/dist/esm/internal/event.mjs +1 -62
- package/dist/esm/internal/experimental.d.mts +7 -7
- package/dist/esm/internal/experimental.mjs +1 -84
- package/dist/esm/internal/faucet.mjs +1 -57
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -105
- package/dist/esm/internal/general.mjs +1 -43
- package/dist/esm/internal/keyless.d.mts +10 -20
- package/dist/esm/internal/keyless.mjs +1 -107
- package/dist/esm/internal/object.mjs +1 -58
- package/dist/esm/internal/staking.mjs +1 -60
- package/dist/esm/internal/table.mjs +1 -38
- package/dist/esm/internal/transaction.mjs +1 -57
- package/dist/esm/internal/transactionSubmission.d.mts +6 -6
- package/dist/esm/internal/transactionSubmission.mjs +1 -118
- package/dist/esm/internal/utils/index.mjs +1 -38
- package/dist/esm/internal/utils/utils.mjs +1 -37
- package/dist/esm/internal/view.d.mts +7 -7
- package/dist/esm/internal/view.mjs +1 -86
- package/dist/esm/{publicKey-BMtGNNLg.d.mts → publicKey-pDHBAZlT.d.mts} +27 -1
- package/dist/esm/transactions/authenticator/account.d.mts +3 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -67
- package/dist/esm/transactions/authenticator/index.d.mts +3 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -82
- package/dist/esm/transactions/authenticator/transaction.d.mts +4 -2
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -66
- package/dist/esm/transactions/index.d.mts +4 -4
- package/dist/esm/transactions/index.mjs +1 -296
- package/dist/esm/transactions/instances/chainId.mjs +1 -11
- package/dist/esm/transactions/instances/identifier.mjs +1 -11
- package/dist/esm/transactions/instances/index.d.mts +4 -2
- package/dist/esm/transactions/instances/index.mjs +1 -114
- package/dist/esm/transactions/instances/moduleId.mjs +1 -55
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -60
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -65
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +3 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -21
- package/dist/esm/transactions/instances/signedTransaction.d.mts +3 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -63
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -60
- package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -73
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -101
- package/dist/esm/transactions/management/asyncQueue.mjs +1 -9
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -111
- package/dist/esm/transactions/management/transactionWorker.d.mts +3 -3
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -107
- package/dist/esm/transactions/scriptComposer/index.d.mts +7 -7
- package/dist/esm/transactions/scriptComposer/index.mjs +1 -80
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -92
- package/dist/esm/transactions/transactionBuilder/index.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -166
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +34 -23
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -74
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +7 -7
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -75
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -97
- package/dist/esm/transactions/typeTag/index.d.mts +16 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -91
- package/dist/esm/transactions/typeTag/parser.mjs +1 -60
- package/dist/esm/transactions/types.d.mts +5 -5
- package/dist/esm/transactions/types.mjs +1 -1
- package/dist/esm/types/abstraction.mjs +1 -7
- package/dist/esm/types/generated/operations.d.mts +10 -63
- package/dist/esm/types/generated/queries.d.mts +2 -10
- package/dist/esm/types/generated/queries.mjs +1 -69
- package/dist/esm/types/generated/types.d.mts +1054 -824
- package/dist/esm/types/generated/types.mjs +1 -774
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +2 -2
- package/dist/esm/types/index.mjs +1 -82
- package/dist/esm/types/indexer.d.mts +2 -14
- package/dist/esm/types/indexer.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +1 -1
- package/dist/esm/types/types.d.mts +3 -58
- package/dist/esm/types/types.mjs +1 -77
- package/dist/esm/utils/apiEndpoints.mjs +1 -21
- package/dist/esm/utils/const.d.mts +1 -1
- package/dist/esm/utils/const.mjs +1 -25
- package/dist/esm/utils/helpers.d.mts +2 -1
- package/dist/esm/utils/helpers.mjs +1 -37
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -88
- package/dist/esm/utils/memoize.mjs +1 -9
- package/dist/esm/utils/normalizeBundle.mjs +1 -20
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -7
- package/package.json +3 -3
- package/src/account/AbstractKeylessAccount.ts +33 -49
- package/src/account/MultiKeyAccount.ts +23 -16
- package/src/api/account.ts +2 -56
- package/src/cli/localNode.ts +6 -15
- package/src/core/crypto/abstraction.ts +6 -1
- package/src/core/crypto/ed25519.ts +19 -1
- package/src/core/crypto/ephemeral.ts +9 -0
- package/src/core/crypto/federatedKeyless.ts +40 -4
- package/src/core/crypto/index.ts +4 -3
- package/src/core/crypto/keyless.ts +577 -17
- package/src/core/crypto/multiEd25519.ts +11 -3
- package/src/core/crypto/multiKey.ts +74 -4
- package/src/core/crypto/publicKey.ts +28 -0
- package/src/core/crypto/secp256k1.ts +25 -2
- package/src/core/crypto/singleKey.ts +32 -7
- package/src/errors/index.ts +50 -0
- package/src/internal/account.ts +2 -395
- package/src/internal/keyless.ts +9 -17
- package/src/transactions/scriptComposer/index.ts +19 -6
- package/src/transactions/transactionBuilder/remoteAbi.ts +107 -35
- package/src/transactions/typeTag/index.ts +22 -0
- package/src/types/codegen.yaml +1 -1
- package/src/types/generated/operations.ts +8 -69
- package/src/types/generated/queries.ts +0 -111
- package/src/types/generated/types.ts +1159 -951
- package/src/types/indexer.ts +0 -16
- package/src/types/keyless.ts +1 -1
- package/src/types/types.ts +3 -62
- package/src/utils/const.ts +1 -1
- package/src/utils/helpers.ts +11 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-JMOQXLED.js +0 -1305
- package/dist/common/chunk-JMOQXLED.js.map +0 -1
- package/dist/esm/chunk-2FTF6J7F.mjs +0 -97
- package/dist/esm/chunk-2FTF6J7F.mjs.map +0 -1
- package/dist/esm/chunk-2HL7JEFC.mjs +0 -829
- package/dist/esm/chunk-2HL7JEFC.mjs.map +0 -1
- package/dist/esm/chunk-2WBJAKBO.mjs +0 -53
- package/dist/esm/chunk-2WBJAKBO.mjs.map +0 -1
- package/dist/esm/chunk-32UQAST6.mjs +0 -296
- package/dist/esm/chunk-32UQAST6.mjs.map +0 -1
- package/dist/esm/chunk-3DAVHDK4.mjs +0 -195
- package/dist/esm/chunk-3DAVHDK4.mjs.map +0 -1
- package/dist/esm/chunk-3IWV2Q3K.mjs +0 -12
- package/dist/esm/chunk-3TUV6YMI.mjs +0 -305
- package/dist/esm/chunk-3TUV6YMI.mjs.map +0 -1
- package/dist/esm/chunk-4NMDYPUD.mjs +0 -1
- package/dist/esm/chunk-56UCIGTO.mjs +0 -21
- package/dist/esm/chunk-56UCIGTO.mjs.map +0 -1
- package/dist/esm/chunk-5ORUQZAR.mjs +0 -100
- package/dist/esm/chunk-5ORUQZAR.mjs.map +0 -1
- package/dist/esm/chunk-5QHMFYVL.mjs +0 -42
- package/dist/esm/chunk-5QHMFYVL.mjs.map +0 -1
- package/dist/esm/chunk-62LC4PPC.mjs +0 -128
- package/dist/esm/chunk-62LC4PPC.mjs.map +0 -1
- package/dist/esm/chunk-6ASWESA2.mjs +0 -77
- package/dist/esm/chunk-6I37A76G.mjs +0 -29
- package/dist/esm/chunk-6OFCIXWS.mjs +0 -379
- package/dist/esm/chunk-6OFCIXWS.mjs.map +0 -1
- package/dist/esm/chunk-6SNGKTWE.mjs +0 -91
- package/dist/esm/chunk-6SNGKTWE.mjs.map +0 -1
- package/dist/esm/chunk-6T3V5LXK.mjs +0 -119
- package/dist/esm/chunk-7F32C225.mjs +0 -219
- package/dist/esm/chunk-7F32C225.mjs.map +0 -1
- package/dist/esm/chunk-7WW735TU.mjs +0 -276
- package/dist/esm/chunk-7WW735TU.mjs.map +0 -1
- package/dist/esm/chunk-A33OBGVN.mjs +0 -1014
- package/dist/esm/chunk-A33OBGVN.mjs.map +0 -1
- package/dist/esm/chunk-A7LYGPFL.mjs +0 -208
- package/dist/esm/chunk-A7LYGPFL.mjs.map +0 -1
- package/dist/esm/chunk-AGKEC2IM.mjs +0 -250
- package/dist/esm/chunk-AGKEC2IM.mjs.map +0 -1
- package/dist/esm/chunk-AKXCFBYF.mjs +0 -49
- package/dist/esm/chunk-AKXCFBYF.mjs.map +0 -1
- package/dist/esm/chunk-APM7OSLS.mjs +0 -122
- package/dist/esm/chunk-BDM6FBUO.mjs +0 -198
- package/dist/esm/chunk-BEYIOC2H.mjs +0 -34
- package/dist/esm/chunk-BMM72IIP.mjs +0 -250
- package/dist/esm/chunk-BMM72IIP.mjs.map +0 -1
- package/dist/esm/chunk-BSCOVLWS.mjs +0 -1
- package/dist/esm/chunk-BSCOVLWS.mjs.map +0 -1
- package/dist/esm/chunk-BU43ZFDJ.mjs +0 -281
- package/dist/esm/chunk-C7EEG6SW.mjs +0 -689
- package/dist/esm/chunk-C7EEG6SW.mjs.map +0 -1
- package/dist/esm/chunk-C7T6GW5P.mjs +0 -376
- package/dist/esm/chunk-CXLXUSCG.mjs +0 -417
- package/dist/esm/chunk-D4MW64RH.mjs +0 -188
- package/dist/esm/chunk-D4MW64RH.mjs.map +0 -1
- package/dist/esm/chunk-D6RXVCE3.mjs +0 -86
- package/dist/esm/chunk-D6RXVCE3.mjs.map +0 -1
- package/dist/esm/chunk-DDZGHA66.mjs +0 -495
- package/dist/esm/chunk-DDZGHA66.mjs.map +0 -1
- package/dist/esm/chunk-DGDZNHUJ.mjs +0 -72
- package/dist/esm/chunk-DGDZNHUJ.mjs.map +0 -1
- package/dist/esm/chunk-DMFRIING.mjs +0 -286
- package/dist/esm/chunk-DMFRIING.mjs.map +0 -1
- package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
- package/dist/esm/chunk-E7FWVXGX.mjs.map +0 -1
- package/dist/esm/chunk-EBFKT35C.mjs +0 -66
- package/dist/esm/chunk-EBFKT35C.mjs.map +0 -1
- package/dist/esm/chunk-ECTX2FGD.mjs +0 -355
- package/dist/esm/chunk-ECTX2FGD.mjs.map +0 -1
- package/dist/esm/chunk-EPTUAWRA.mjs +0 -895
- package/dist/esm/chunk-EPTUAWRA.mjs.map +0 -1
- package/dist/esm/chunk-F4VI7BNX.mjs +0 -58
- package/dist/esm/chunk-F4VI7BNX.mjs.map +0 -1
- package/dist/esm/chunk-F7W7KS5C.mjs +0 -52
- package/dist/esm/chunk-FDMI4BUL.mjs +0 -611
- package/dist/esm/chunk-FDMI4BUL.mjs.map +0 -1
- package/dist/esm/chunk-FMNMYKYH.mjs +0 -71
- package/dist/esm/chunk-FMNMYKYH.mjs.map +0 -1
- package/dist/esm/chunk-FRLS4GRM.mjs +0 -62
- package/dist/esm/chunk-G34CJDST.mjs +0 -139
- package/dist/esm/chunk-G4NBRMZ2.mjs +0 -7
- package/dist/esm/chunk-G6R77JKO.mjs +0 -121
- package/dist/esm/chunk-G6R77JKO.mjs.map +0 -1
- package/dist/esm/chunk-G7BB6K4B.mjs +0 -167
- package/dist/esm/chunk-G7BB6K4B.mjs.map +0 -1
- package/dist/esm/chunk-GCQK2S5Q.mjs +0 -43
- package/dist/esm/chunk-GCQK2S5Q.mjs.map +0 -1
- package/dist/esm/chunk-GFPEB22G.mjs +0 -1
- package/dist/esm/chunk-GFPEB22G.mjs.map +0 -1
- package/dist/esm/chunk-GUA5YTIK.mjs +0 -362
- package/dist/esm/chunk-HBXBODME.mjs +0 -84
- package/dist/esm/chunk-HBXBODME.mjs.map +0 -1
- package/dist/esm/chunk-HEZ2ZYZA.mjs +0 -1
- package/dist/esm/chunk-HEZ2ZYZA.mjs.map +0 -1
- package/dist/esm/chunk-HKQY5GXT.mjs +0 -231
- package/dist/esm/chunk-HKQY5GXT.mjs.map +0 -1
- package/dist/esm/chunk-HL337SEM.mjs +0 -219
- package/dist/esm/chunk-HL337SEM.mjs.map +0 -1
- package/dist/esm/chunk-HQDHSKVS.mjs +0 -74
- package/dist/esm/chunk-HQDHSKVS.mjs.map +0 -1
- package/dist/esm/chunk-I25AX6PQ.mjs +0 -7
- package/dist/esm/chunk-I5G7XFGT.mjs +0 -86
- package/dist/esm/chunk-I5G7XFGT.mjs.map +0 -1
- package/dist/esm/chunk-IHYTP2EW.mjs +0 -1
- package/dist/esm/chunk-IHYTP2EW.mjs.map +0 -1
- package/dist/esm/chunk-IJ7XCPP3.mjs +0 -480
- package/dist/esm/chunk-IJ7XCPP3.mjs.map +0 -1
- package/dist/esm/chunk-ILTEOGFF.mjs +0 -407
- package/dist/esm/chunk-ILTEOGFF.mjs.map +0 -1
- package/dist/esm/chunk-IP7GATDH.mjs +0 -322
- package/dist/esm/chunk-IP7GATDH.mjs.map +0 -1
- package/dist/esm/chunk-IPUAVRGL.mjs +0 -248
- package/dist/esm/chunk-IPUAVRGL.mjs.map +0 -1
- package/dist/esm/chunk-IQVHXOD3.mjs +0 -192
- package/dist/esm/chunk-IQVHXOD3.mjs.map +0 -1
- package/dist/esm/chunk-JAZJE3OR.mjs +0 -45
- package/dist/esm/chunk-JAZJE3OR.mjs.map +0 -1
- package/dist/esm/chunk-JEVGHYEP.mjs +0 -162
- package/dist/esm/chunk-JEVGHYEP.mjs.map +0 -1
- package/dist/esm/chunk-JFMFZ2IL.mjs +0 -147
- package/dist/esm/chunk-JFMFZ2IL.mjs.map +0 -1
- package/dist/esm/chunk-JQIRRM7G.mjs +0 -195
- package/dist/esm/chunk-JQIRRM7G.mjs.map +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs.map +0 -1
- package/dist/esm/chunk-K5OCDM3W.mjs +0 -207
- package/dist/esm/chunk-K5OCDM3W.mjs.map +0 -1
- package/dist/esm/chunk-KLUO6XPE.mjs +0 -33
- package/dist/esm/chunk-KSK3XIGF.mjs +0 -502
- package/dist/esm/chunk-KW64NP2F.mjs +0 -71
- package/dist/esm/chunk-KW64NP2F.mjs.map +0 -1
- package/dist/esm/chunk-LJRNGZMY.mjs +0 -10
- package/dist/esm/chunk-MFFBZ43D.mjs +0 -45
- package/dist/esm/chunk-MWXBQ6HR.mjs +0 -15
- package/dist/esm/chunk-MYEYZ7PF.mjs +0 -46
- package/dist/esm/chunk-NUT2VOX2.mjs +0 -317
- package/dist/esm/chunk-OFUNBTK4.mjs +0 -169
- package/dist/esm/chunk-ORCQEMJL.mjs +0 -51
- package/dist/esm/chunk-ORCQEMJL.mjs.map +0 -1
- package/dist/esm/chunk-PGFEUN7K.mjs +0 -129
- package/dist/esm/chunk-PGFEUN7K.mjs.map +0 -1
- package/dist/esm/chunk-PKUXOBIV.mjs +0 -138
- package/dist/esm/chunk-PT2QHUB6.mjs +0 -96
- package/dist/esm/chunk-QJ6CGH7N.mjs +0 -71
- package/dist/esm/chunk-QPT4BSAB.mjs +0 -20
- package/dist/esm/chunk-QSYWLSSN.mjs +0 -216
- package/dist/esm/chunk-QYNYDQE3.mjs +0 -288
- package/dist/esm/chunk-QYNYDQE3.mjs.map +0 -1
- package/dist/esm/chunk-R45SPK6Q.mjs +0 -61
- package/dist/esm/chunk-R45SPK6Q.mjs.map +0 -1
- package/dist/esm/chunk-R4JTQQBX.mjs +0 -37
- package/dist/esm/chunk-R4JTQQBX.mjs.map +0 -1
- package/dist/esm/chunk-RCXGTN36.mjs +0 -58
- package/dist/esm/chunk-RCXGTN36.mjs.map +0 -1
- package/dist/esm/chunk-RMMOF53Q.mjs +0 -1
- package/dist/esm/chunk-RMMOF53Q.mjs.map +0 -1
- package/dist/esm/chunk-RQS33JAS.mjs +0 -77
- package/dist/esm/chunk-RQS33JAS.mjs.map +0 -1
- package/dist/esm/chunk-SAWN7RJP.mjs +0 -15
- package/dist/esm/chunk-SAWN7RJP.mjs.map +0 -1
- package/dist/esm/chunk-SBB4YEPT.mjs +0 -17
- package/dist/esm/chunk-SFLQPB72.mjs +0 -63
- package/dist/esm/chunk-SPI2HO3E.mjs +0 -177
- package/dist/esm/chunk-SPI2HO3E.mjs.map +0 -1
- package/dist/esm/chunk-SPVJXZL5.mjs +0 -865
- package/dist/esm/chunk-SPVJXZL5.mjs.map +0 -1
- package/dist/esm/chunk-SQNS4SFV.mjs +0 -232
- package/dist/esm/chunk-SRXIHVZE.mjs +0 -50
- package/dist/esm/chunk-SRXIHVZE.mjs.map +0 -1
- package/dist/esm/chunk-T4BFWV46.mjs +0 -63
- package/dist/esm/chunk-T4BFWV46.mjs.map +0 -1
- package/dist/esm/chunk-T573PCIR.mjs +0 -700
- package/dist/esm/chunk-T573PCIR.mjs.map +0 -1
- package/dist/esm/chunk-TDLL7QX5.mjs +0 -239
- package/dist/esm/chunk-TDLL7QX5.mjs.map +0 -1
- package/dist/esm/chunk-TFW6N66T.mjs +0 -415
- package/dist/esm/chunk-TFW6N66T.mjs.map +0 -1
- package/dist/esm/chunk-THWEBWUC.mjs +0 -20
- package/dist/esm/chunk-TJDF4CXI.mjs +0 -513
- package/dist/esm/chunk-TJDF4CXI.mjs.map +0 -1
- package/dist/esm/chunk-TL4Z4KHK.mjs +0 -70
- package/dist/esm/chunk-TL4Z4KHK.mjs.map +0 -1
- package/dist/esm/chunk-UGFIWCJQ.mjs +0 -130
- package/dist/esm/chunk-UGFIWCJQ.mjs.map +0 -1
- package/dist/esm/chunk-UGKZQUGE.mjs +0 -367
- package/dist/esm/chunk-UGKZQUGE.mjs.map +0 -1
- package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
- package/dist/esm/chunk-UIRAXHDH.mjs.map +0 -1
- package/dist/esm/chunk-UK7SPHIE.mjs +0 -420
- package/dist/esm/chunk-UK7SPHIE.mjs.map +0 -1
- package/dist/esm/chunk-UOHCJOXI.mjs +0 -150
- package/dist/esm/chunk-UOHCJOXI.mjs.map +0 -1
- package/dist/esm/chunk-WHSS6I7T.mjs +0 -90
- package/dist/esm/chunk-WHSS6I7T.mjs.map +0 -1
- package/dist/esm/chunk-WLTQHGIJ.mjs +0 -177
- package/dist/esm/chunk-WUM247HF.mjs +0 -125
- package/dist/esm/chunk-WUM247HF.mjs.map +0 -1
- package/dist/esm/chunk-WXQUBQK4.mjs +0 -19
- package/dist/esm/chunk-X4N5BN3S.mjs +0 -40
- package/dist/esm/chunk-X4N5BN3S.mjs.map +0 -1
- package/dist/esm/chunk-XIBOO3WF.mjs +0 -168
- package/dist/esm/chunk-XIBOO3WF.mjs.map +0 -1
- package/dist/esm/chunk-XQFUKBY7.mjs +0 -136
- package/dist/esm/chunk-XX6C2QGI.mjs +0 -160
- package/dist/esm/chunk-XX6C2QGI.mjs.map +0 -1
- package/dist/esm/chunk-Y3ENAKRC.mjs +0 -73
- package/dist/esm/chunk-Y3M32DIB.mjs +0 -79
- package/dist/esm/chunk-Y3M32DIB.mjs.map +0 -1
- package/dist/esm/chunk-YK66QBML.mjs +0 -89
- package/dist/esm/chunk-YT7V6AVJ.mjs +0 -66
- package/dist/esm/chunk-YU65LNIC.mjs +0 -72
- package/dist/esm/chunk-ZRBUAZZD.mjs +0 -36
- package/dist/esm/chunk-ZRBUAZZD.mjs.map +0 -1
- package/dist/esm/chunk-ZWCTF3NQ.mjs +0 -25
- package/src/internal/queries/getAccountAddressForAuthKey.graphql +0 -8
- package/src/internal/queries/getAuthKeysForPublicKey.graphql +0 -9
- package/src/internal/queries/getMultiKeyForAuthKey.graphql +0 -9
- package/src/internal/queries/getSignatures.graphql +0 -13
- /package/dist/esm/{chunk-4NMDYPUD.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
convertSigningMessage
|
|
3
|
-
} from "./chunk-THWEBWUC.mjs";
|
|
4
|
-
import {
|
|
5
|
-
CKDPriv,
|
|
6
|
-
HARDENED_OFFSET,
|
|
7
|
-
deriveKey,
|
|
8
|
-
isValidHardenedPath,
|
|
9
|
-
mnemonicToSeed,
|
|
10
|
-
splitPath
|
|
11
|
-
} from "./chunk-F7W7KS5C.mjs";
|
|
12
|
-
import {
|
|
13
|
-
PrivateKey
|
|
14
|
-
} from "./chunk-YU65LNIC.mjs";
|
|
15
|
-
import {
|
|
16
|
-
AccountPublicKey
|
|
17
|
-
} from "./chunk-R4JTQQBX.mjs";
|
|
18
|
-
import {
|
|
19
|
-
Signature
|
|
20
|
-
} from "./chunk-KLUO6XPE.mjs";
|
|
21
|
-
import {
|
|
22
|
-
AuthenticationKey
|
|
23
|
-
} from "./chunk-PKUXOBIV.mjs";
|
|
24
|
-
import {
|
|
25
|
-
Serializable
|
|
26
|
-
} from "./chunk-C7T6GW5P.mjs";
|
|
27
|
-
import {
|
|
28
|
-
Hex
|
|
29
|
-
} from "./chunk-BDM6FBUO.mjs";
|
|
30
|
-
|
|
31
|
-
// src/core/crypto/ed25519.ts
|
|
32
|
-
import { ed25519 } from "@noble/curves/ed25519";
|
|
33
|
-
var L = [
|
|
34
|
-
237,
|
|
35
|
-
211,
|
|
36
|
-
245,
|
|
37
|
-
92,
|
|
38
|
-
26,
|
|
39
|
-
99,
|
|
40
|
-
18,
|
|
41
|
-
88,
|
|
42
|
-
214,
|
|
43
|
-
156,
|
|
44
|
-
247,
|
|
45
|
-
162,
|
|
46
|
-
222,
|
|
47
|
-
249,
|
|
48
|
-
222,
|
|
49
|
-
20,
|
|
50
|
-
0,
|
|
51
|
-
0,
|
|
52
|
-
0,
|
|
53
|
-
0,
|
|
54
|
-
0,
|
|
55
|
-
0,
|
|
56
|
-
0,
|
|
57
|
-
0,
|
|
58
|
-
0,
|
|
59
|
-
0,
|
|
60
|
-
0,
|
|
61
|
-
0,
|
|
62
|
-
0,
|
|
63
|
-
0,
|
|
64
|
-
0,
|
|
65
|
-
16
|
|
66
|
-
];
|
|
67
|
-
function isCanonicalEd25519Signature(signature) {
|
|
68
|
-
const s = signature.toUint8Array().slice(32);
|
|
69
|
-
for (let i = L.length - 1; i >= 0; i -= 1) {
|
|
70
|
-
if (s[i] < L[i]) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
if (s[i] > L[i]) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
var _Ed25519PublicKey = class _Ed25519PublicKey extends AccountPublicKey {
|
|
80
|
-
/**
|
|
81
|
-
* Creates an instance of the Ed25519Signature class from a hex input.
|
|
82
|
-
* This constructor validates the length of the signature to ensure it meets the required specifications.
|
|
83
|
-
*
|
|
84
|
-
* @param hexInput - The hex input representing the Ed25519 signature.
|
|
85
|
-
* @throws Error if the signature length is not equal to Ed25519Signature.LENGTH.
|
|
86
|
-
* @group Implementation
|
|
87
|
-
* @category Serialization
|
|
88
|
-
*/
|
|
89
|
-
constructor(hexInput) {
|
|
90
|
-
super();
|
|
91
|
-
const hex = Hex.fromHexInput(hexInput);
|
|
92
|
-
if (hex.toUint8Array().length !== _Ed25519PublicKey.LENGTH) {
|
|
93
|
-
throw new Error(`PublicKey length should be ${_Ed25519PublicKey.LENGTH}`);
|
|
94
|
-
}
|
|
95
|
-
this.key = hex;
|
|
96
|
-
}
|
|
97
|
-
// region AccountPublicKey
|
|
98
|
-
/**
|
|
99
|
-
* Verifies a signed message using a public key.
|
|
100
|
-
*
|
|
101
|
-
* @param args - The arguments for verification.
|
|
102
|
-
* @param args.message - A signed message as a Hex string or Uint8Array.
|
|
103
|
-
* @param args.signature - The signature of the message.
|
|
104
|
-
* @group Implementation
|
|
105
|
-
* @category Serialization
|
|
106
|
-
*/
|
|
107
|
-
verifySignature(args) {
|
|
108
|
-
const { message, signature } = args;
|
|
109
|
-
if (!isCanonicalEd25519Signature(signature)) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
const messageToVerify = convertSigningMessage(message);
|
|
113
|
-
const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();
|
|
114
|
-
const signatureBytes = signature.toUint8Array();
|
|
115
|
-
const publicKeyBytes = this.key.toUint8Array();
|
|
116
|
-
return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Generates an authentication key from the public key using the Ed25519 scheme.
|
|
120
|
-
* This function is essential for creating a secure authentication key that can be used for further cryptographic operations.
|
|
121
|
-
*
|
|
122
|
-
* @returns {AuthenticationKey} The generated authentication key.
|
|
123
|
-
* @group Implementation
|
|
124
|
-
* @category Serialization
|
|
125
|
-
*/
|
|
126
|
-
authKey() {
|
|
127
|
-
return AuthenticationKey.fromSchemeAndBytes({
|
|
128
|
-
scheme: 0 /* Ed25519 */,
|
|
129
|
-
input: this.toUint8Array()
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Convert the internal data representation to a Uint8Array.
|
|
134
|
-
*
|
|
135
|
-
* @returns Uint8Array representation of the data.
|
|
136
|
-
* @group Implementation
|
|
137
|
-
* @category Serialization
|
|
138
|
-
*/
|
|
139
|
-
toUint8Array() {
|
|
140
|
-
return this.key.toUint8Array();
|
|
141
|
-
}
|
|
142
|
-
// endregion
|
|
143
|
-
// region Serializable
|
|
144
|
-
/**
|
|
145
|
-
* Serializes the data into a byte array using the provided serializer.
|
|
146
|
-
* This allows for the conversion of data into a format suitable for transmission or storage.
|
|
147
|
-
*
|
|
148
|
-
* @param serializer - The serializer instance used to perform the serialization.
|
|
149
|
-
* @group Implementation
|
|
150
|
-
* @category Serialization
|
|
151
|
-
*/
|
|
152
|
-
serialize(serializer) {
|
|
153
|
-
serializer.serializeBytes(this.key.toUint8Array());
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Deserialize bytes into an Ed25519Signature object.
|
|
157
|
-
* This function is used to convert serialized byte data into a usable Ed25519Signature instance.
|
|
158
|
-
*
|
|
159
|
-
* @param deserializer - The deserializer instance used to read the byte data.
|
|
160
|
-
* @group Implementation
|
|
161
|
-
* @category Serialization
|
|
162
|
-
*/
|
|
163
|
-
static deserialize(deserializer) {
|
|
164
|
-
const bytes = deserializer.deserializeBytes();
|
|
165
|
-
return new _Ed25519PublicKey(bytes);
|
|
166
|
-
}
|
|
167
|
-
// endregion
|
|
168
|
-
/**
|
|
169
|
-
* Determine if the provided public key is an instance of Ed25519PublicKey.
|
|
170
|
-
*
|
|
171
|
-
* @param publicKey - The public key to check.
|
|
172
|
-
* @returns True if the public key is an instance of Ed25519PublicKey, otherwise false.
|
|
173
|
-
* @deprecated use `instanceof Ed25519PublicKey` instead.
|
|
174
|
-
* @group Implementation
|
|
175
|
-
* @category Serialization
|
|
176
|
-
*/
|
|
177
|
-
static isPublicKey(publicKey) {
|
|
178
|
-
return publicKey instanceof _Ed25519PublicKey;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Determines if the provided public key is a valid Ed25519 public key.
|
|
182
|
-
* This function checks for the presence of the "key" property and verifies that its data length matches the expected length
|
|
183
|
-
* for Ed25519 public keys.
|
|
184
|
-
*
|
|
185
|
-
* @param publicKey - The public key to validate.
|
|
186
|
-
* @returns A boolean indicating whether the public key is a valid Ed25519 public key.
|
|
187
|
-
* @group Implementation
|
|
188
|
-
* @category Serialization
|
|
189
|
-
*/
|
|
190
|
-
static isInstance(publicKey) {
|
|
191
|
-
return "key" in publicKey && publicKey.key?.data?.length === _Ed25519PublicKey.LENGTH;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
/**
|
|
195
|
-
* Length of an Ed25519 public key
|
|
196
|
-
* @group Implementation
|
|
197
|
-
* @category Serialization
|
|
198
|
-
*/
|
|
199
|
-
_Ed25519PublicKey.LENGTH = 32;
|
|
200
|
-
var Ed25519PublicKey = _Ed25519PublicKey;
|
|
201
|
-
var _Ed25519PrivateKey = class _Ed25519PrivateKey extends Serializable {
|
|
202
|
-
// region Constructors
|
|
203
|
-
/**
|
|
204
|
-
* Create a new PrivateKey instance from a Uint8Array or String.
|
|
205
|
-
*
|
|
206
|
-
* [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
|
|
207
|
-
*
|
|
208
|
-
* @param hexInput HexInput (string or Uint8Array)
|
|
209
|
-
* @param strict If true, private key must AIP-80 compliant.
|
|
210
|
-
* @group Implementation
|
|
211
|
-
* @category Serialization
|
|
212
|
-
*/
|
|
213
|
-
constructor(hexInput, strict) {
|
|
214
|
-
super();
|
|
215
|
-
const privateKeyHex = PrivateKey.parseHexInput(hexInput, "ed25519" /* Ed25519 */, strict);
|
|
216
|
-
if (privateKeyHex.toUint8Array().length !== _Ed25519PrivateKey.LENGTH) {
|
|
217
|
-
throw new Error(`PrivateKey length should be ${_Ed25519PrivateKey.LENGTH}`);
|
|
218
|
-
}
|
|
219
|
-
this.signingKey = privateKeyHex;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Generate a new random private key.
|
|
223
|
-
*
|
|
224
|
-
* @returns Ed25519PrivateKey A newly generated Ed25519 private key.
|
|
225
|
-
* @group Implementation
|
|
226
|
-
* @category Serialization
|
|
227
|
-
*/
|
|
228
|
-
static generate() {
|
|
229
|
-
const keyPair = ed25519.utils.randomPrivateKey();
|
|
230
|
-
return new _Ed25519PrivateKey(keyPair, false);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Derives a private key from a mnemonic seed phrase using a specified BIP44 path.
|
|
234
|
-
* To derive multiple keys from the same phrase, change the path
|
|
235
|
-
*
|
|
236
|
-
* IMPORTANT: Ed25519 supports hardened derivation only, as it lacks a key homomorphism, making non-hardened derivation impossible.
|
|
237
|
-
*
|
|
238
|
-
* @param path - The BIP44 path used for key derivation.
|
|
239
|
-
* @param mnemonics - The mnemonic seed phrase from which the key will be derived.
|
|
240
|
-
* @throws Error if the provided path is not a valid hardened path.
|
|
241
|
-
* @group Implementation
|
|
242
|
-
* @category Serialization
|
|
243
|
-
*/
|
|
244
|
-
static fromDerivationPath(path, mnemonics) {
|
|
245
|
-
if (!isValidHardenedPath(path)) {
|
|
246
|
-
throw new Error(`Invalid derivation path ${path}`);
|
|
247
|
-
}
|
|
248
|
-
return _Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Derives a child private key from a given BIP44 path and seed.
|
|
252
|
-
* A private inner function so we can separate from the main fromDerivationPath() method
|
|
253
|
-
* to add tests to verify we create the keys correctly.
|
|
254
|
-
*
|
|
255
|
-
* @param path - The BIP44 path used for key derivation.
|
|
256
|
-
* @param seed - The seed phrase created by the mnemonics, represented as a Uint8Array.
|
|
257
|
-
* @param offset - The offset used for key derivation, defaults to HARDENED_OFFSET.
|
|
258
|
-
* @returns An instance of Ed25519PrivateKey derived from the specified path and seed.
|
|
259
|
-
* @group Implementation
|
|
260
|
-
* @category Serialization
|
|
261
|
-
*/
|
|
262
|
-
static fromDerivationPathInner(path, seed, offset = HARDENED_OFFSET) {
|
|
263
|
-
const { key, chainCode } = deriveKey(_Ed25519PrivateKey.SLIP_0010_SEED, seed);
|
|
264
|
-
const segments = splitPath(path).map((el) => parseInt(el, 10));
|
|
265
|
-
const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
|
|
266
|
-
key,
|
|
267
|
-
chainCode
|
|
268
|
-
});
|
|
269
|
-
return new _Ed25519PrivateKey(privateKey, false);
|
|
270
|
-
}
|
|
271
|
-
// endregion
|
|
272
|
-
// region PrivateKey
|
|
273
|
-
/**
|
|
274
|
-
* Derive the Ed25519PublicKey for this private key.
|
|
275
|
-
*
|
|
276
|
-
* @returns Ed25519PublicKey - The derived public key corresponding to the private key.
|
|
277
|
-
* @group Implementation
|
|
278
|
-
* @category Serialization
|
|
279
|
-
*/
|
|
280
|
-
publicKey() {
|
|
281
|
-
const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());
|
|
282
|
-
return new Ed25519PublicKey(bytes);
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Sign the given message with the private key.
|
|
286
|
-
* This function generates a digital signature for the specified message, ensuring its authenticity and integrity.
|
|
287
|
-
*
|
|
288
|
-
* @param message - A message as a string or Uint8Array in HexInput format.
|
|
289
|
-
* @returns A digital signature for the provided message.
|
|
290
|
-
* @group Implementation
|
|
291
|
-
* @category Serialization
|
|
292
|
-
*/
|
|
293
|
-
sign(message) {
|
|
294
|
-
const messageToSign = convertSigningMessage(message);
|
|
295
|
-
const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();
|
|
296
|
-
const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());
|
|
297
|
-
return new Ed25519Signature(signatureBytes);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Get the private key in bytes (Uint8Array).
|
|
301
|
-
*
|
|
302
|
-
* @returns Uint8Array representation of the private key
|
|
303
|
-
* @group Implementation
|
|
304
|
-
* @category Serialization
|
|
305
|
-
*/
|
|
306
|
-
toUint8Array() {
|
|
307
|
-
return this.signingKey.toUint8Array();
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Get the private key as a hex string with the 0x prefix.
|
|
311
|
-
*
|
|
312
|
-
* @returns string representation of the private key.
|
|
313
|
-
* @group Implementation
|
|
314
|
-
* @category Serialization
|
|
315
|
-
*/
|
|
316
|
-
toString() {
|
|
317
|
-
return this.toHexString();
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Get the private key as a hex string with the 0x prefix.
|
|
321
|
-
*
|
|
322
|
-
* @returns string representation of the private key.
|
|
323
|
-
*/
|
|
324
|
-
toHexString() {
|
|
325
|
-
return this.signingKey.toString();
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Get the private key as a AIP-80 compliant hex string.
|
|
329
|
-
*
|
|
330
|
-
* [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)
|
|
331
|
-
*
|
|
332
|
-
* @returns AIP-80 compliant string representation of the private key.
|
|
333
|
-
*/
|
|
334
|
-
toAIP80String() {
|
|
335
|
-
return PrivateKey.formatPrivateKey(this.signingKey.toString(), "ed25519" /* Ed25519 */);
|
|
336
|
-
}
|
|
337
|
-
// endregion
|
|
338
|
-
// region Serializable
|
|
339
|
-
serialize(serializer) {
|
|
340
|
-
serializer.serializeBytes(this.toUint8Array());
|
|
341
|
-
}
|
|
342
|
-
static deserialize(deserializer) {
|
|
343
|
-
const bytes = deserializer.deserializeBytes();
|
|
344
|
-
return new _Ed25519PrivateKey(bytes, false);
|
|
345
|
-
}
|
|
346
|
-
// endregion
|
|
347
|
-
/**
|
|
348
|
-
* Determines if the provided private key is an instance of Ed25519PrivateKey.
|
|
349
|
-
*
|
|
350
|
-
* @param privateKey - The private key to check.
|
|
351
|
-
* @returns A boolean indicating whether the private key is an Ed25519PrivateKey.
|
|
352
|
-
*
|
|
353
|
-
* @deprecated Use `instanceof Ed25519PrivateKey` instead.
|
|
354
|
-
* @group Implementation
|
|
355
|
-
* @category Serialization
|
|
356
|
-
*/
|
|
357
|
-
static isPrivateKey(privateKey) {
|
|
358
|
-
return privateKey instanceof _Ed25519PrivateKey;
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
/**
|
|
362
|
-
* Length of an Ed25519 private key
|
|
363
|
-
* @group Implementation
|
|
364
|
-
* @category Serialization
|
|
365
|
-
*/
|
|
366
|
-
_Ed25519PrivateKey.LENGTH = 32;
|
|
367
|
-
/**
|
|
368
|
-
* The Ed25519 key seed to use for BIP-32 compatibility
|
|
369
|
-
* See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}
|
|
370
|
-
* @group Implementation
|
|
371
|
-
* @category Serialization
|
|
372
|
-
*/
|
|
373
|
-
_Ed25519PrivateKey.SLIP_0010_SEED = "ed25519 seed";
|
|
374
|
-
var Ed25519PrivateKey = _Ed25519PrivateKey;
|
|
375
|
-
var _Ed25519Signature = class _Ed25519Signature extends Signature {
|
|
376
|
-
// region Constructors
|
|
377
|
-
constructor(hexInput) {
|
|
378
|
-
super();
|
|
379
|
-
const data = Hex.fromHexInput(hexInput);
|
|
380
|
-
if (data.toUint8Array().length !== _Ed25519Signature.LENGTH) {
|
|
381
|
-
throw new Error(`Signature length should be ${_Ed25519Signature.LENGTH}`);
|
|
382
|
-
}
|
|
383
|
-
this.data = data;
|
|
384
|
-
}
|
|
385
|
-
// endregion
|
|
386
|
-
// region Signature
|
|
387
|
-
toUint8Array() {
|
|
388
|
-
return this.data.toUint8Array();
|
|
389
|
-
}
|
|
390
|
-
// endregion
|
|
391
|
-
// region Serializable
|
|
392
|
-
serialize(serializer) {
|
|
393
|
-
serializer.serializeBytes(this.data.toUint8Array());
|
|
394
|
-
}
|
|
395
|
-
static deserialize(deserializer) {
|
|
396
|
-
const bytes = deserializer.deserializeBytes();
|
|
397
|
-
return new _Ed25519Signature(bytes);
|
|
398
|
-
}
|
|
399
|
-
// endregion
|
|
400
|
-
};
|
|
401
|
-
/**
|
|
402
|
-
* Length of an Ed25519 signature, which is 64 bytes.
|
|
403
|
-
* @group Implementation
|
|
404
|
-
* @category Serialization
|
|
405
|
-
*/
|
|
406
|
-
_Ed25519Signature.LENGTH = 64;
|
|
407
|
-
var Ed25519Signature = _Ed25519Signature;
|
|
408
|
-
|
|
409
|
-
export {
|
|
410
|
-
isCanonicalEd25519Signature,
|
|
411
|
-
Ed25519PublicKey,
|
|
412
|
-
Ed25519PrivateKey,
|
|
413
|
-
Ed25519Signature
|
|
414
|
-
};
|
|
415
|
-
//# sourceMappingURL=chunk-TFW6N66T.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/ed25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ed25519 } from \"@noble/curves/ed25519\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { HexInput, SigningScheme as AuthenticationKeyScheme, PrivateKeyVariants } from \"../../types\";\nimport { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * L is the value that greater than or equal to will produce a non-canonical signature, and must be rejected\n * @group Implementation\n * @category Serialization\n */\nconst L: number[] = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\n];\n\n/**\n * Checks if an ED25519 signature is non-canonical.\n * This function helps determine the validity of a signature by verifying its canonical form.\n *\n * @param signature - The signature to be checked for canonicality.\n * @returns A boolean indicating whether the signature is non-canonical.\n *\n * Comes from Aptos Core\n * https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85\n * @group Implementation\n * @category Serialization\n */\nexport function isCanonicalEd25519Signature(signature: Signature): boolean {\n const s = signature.toUint8Array().slice(32);\n for (let i = L.length - 1; i >= 0; i -= 1) {\n if (s[i] < L[i]) {\n return true;\n }\n if (s[i] > L[i]) {\n return false;\n }\n }\n // As this stage S == L which implies a non-canonical S.\n return false;\n}\n\n/**\n * Represents the public key of an Ed25519 key pair.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also\n * as `AnyPublicKey` that represents any `Unified authentication key`.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519PublicKey extends AccountPublicKey {\n /**\n * Length of an Ed25519 public key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * Bytes of the public key\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly key: Hex;\n\n /**\n * Creates an instance of the Ed25519Signature class from a hex input.\n * This constructor validates the length of the signature to ensure it meets the required specifications.\n *\n * @param hexInput - The hex input representing the Ed25519 signature.\n * @throws Error if the signature length is not equal to Ed25519Signature.LENGTH.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Ed25519PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Ed25519PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a signed message using a public key.\n *\n * @param args - The arguments for verification.\n * @param args.message - A signed message as a Hex string or Uint8Array.\n * @param args.signature - The signature of the message.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n // Verify malleability\n if (!isCanonicalEd25519Signature(signature)) {\n return false;\n }\n\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const signatureBytes = signature.toUint8Array();\n const publicKeyBytes = this.key.toUint8Array();\n return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);\n }\n\n /**\n * Generates an authentication key from the public key using the Ed25519 scheme.\n * This function is essential for creating a secure authentication key that can be used for further cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.Ed25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Convert the internal data representation to a Uint8Array.\n *\n * @returns Uint8Array representation of the data.\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This allows for the conversion of data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserialize bytes into an Ed25519Signature object.\n * This function is used to convert serialized byte data into a usable Ed25519Signature instance.\n *\n * @param deserializer - The deserializer instance used to read the byte data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Ed25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * Determine if the provided public key is an instance of Ed25519PublicKey.\n *\n * @param publicKey - The public key to check.\n * @returns True if the public key is an instance of Ed25519PublicKey, otherwise false.\n * @deprecated use `instanceof Ed25519PublicKey` instead.\n * @group Implementation\n * @category Serialization\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey {\n return publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * Determines if the provided public key is a valid Ed25519 public key.\n * This function checks for the presence of the \"key\" property and verifies that its data length matches the expected length\n * for Ed25519 public keys.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Ed25519 public key.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is Ed25519PublicKey {\n return \"key\" in publicKey && (publicKey.key as any)?.data?.length === Ed25519PublicKey.LENGTH;\n }\n}\n\n/**\n * Represents the private key of an Ed25519 key pair.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of an Ed25519 private key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The Ed25519 key seed to use for BIP-32 compatibility\n * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}\n * @group Implementation\n * @category Serialization\n */\n static readonly SLIP_0010_SEED = \"ed25519 seed\";\n\n /**\n * The Ed25519 signing key\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly signingKey: Hex;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param hexInput HexInput (string or Uint8Array)\n * @param strict If true, private key must AIP-80 compliant.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput, strict?: boolean) {\n super();\n\n const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Ed25519, strict);\n if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);\n }\n\n // Create keyPair from Private key in Uint8Array format\n this.signingKey = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Ed25519PrivateKey A newly generated Ed25519 private key.\n * @group Implementation\n * @category Serialization\n */\n static generate(): Ed25519PrivateKey {\n const keyPair = ed25519.utils.randomPrivateKey();\n return new Ed25519PrivateKey(keyPair, false);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase using a specified BIP44 path.\n * To derive multiple keys from the same phrase, change the path\n *\n * IMPORTANT: Ed25519 supports hardened derivation only, as it lacks a key homomorphism, making non-hardened derivation impossible.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param mnemonics - The mnemonic seed phrase from which the key will be derived.\n * @throws Error if the provided path is not a valid hardened path.\n * @group Implementation\n * @category Serialization\n */\n static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {\n if (!isValidHardenedPath(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * Derives a child private key from a given BIP44 path and seed.\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param seed - The seed phrase created by the mnemonics, represented as a Uint8Array.\n * @param offset - The offset used for key derivation, defaults to HARDENED_OFFSET.\n * @returns An instance of Ed25519PrivateKey derived from the specified path and seed.\n * @group Implementation\n * @category Serialization\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {\n const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return new Ed25519PrivateKey(privateKey, false);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Derive the Ed25519PublicKey for this private key.\n *\n * @returns Ed25519PublicKey - The derived public key corresponding to the private key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): Ed25519PublicKey {\n const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());\n return new Ed25519PublicKey(bytes);\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a digital signature for the specified message, ensuring its authenticity and integrity.\n *\n * @param message - A message as a string or Uint8Array in HexInput format.\n * @returns A digital signature for the provided message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Ed25519Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();\n const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());\n return new Ed25519Signature(signatureBytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the private key\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.signingKey.toUint8Array();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.toHexString();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toHexString(): string {\n return this.signingKey.toString();\n }\n\n /**\n * Get the private key as a AIP-80 compliant hex string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @returns AIP-80 compliant string representation of the private key.\n */\n toAIP80String(): string {\n return PrivateKey.formatPrivateKey(this.signingKey.toString(), PrivateKeyVariants.Ed25519);\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PrivateKey(bytes, false);\n }\n\n // endregion\n\n /**\n * Determines if the provided private key is an instance of Ed25519PrivateKey.\n *\n * @param privateKey - The private key to check.\n * @returns A boolean indicating whether the private key is an Ed25519PrivateKey.\n *\n * @deprecated Use `instanceof Ed25519PrivateKey` instead.\n * @group Implementation\n * @category Serialization\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey {\n return privateKey instanceof Ed25519PrivateKey;\n }\n}\n\n/**\n * Represents a signature of a message signed using an Ed25519 private key.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519Signature extends Signature {\n /**\n * Length of an Ed25519 signature, which is 64 bytes.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly data: Hex;\n\n // region Constructors\n\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Ed25519Signature.LENGTH) {\n throw new Error(`Signature length should be ${Ed25519Signature.LENGTH}`);\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519Signature {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519Signature(bytes);\n }\n\n // endregion\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,eAAe;AAiBxB,IAAM,IAAc;AAAA,EAClB;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAC5G;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAC1E;AAcO,SAAS,4BAA4B,WAA+B;AACzE,QAAM,IAAI,UAAU,aAAa,EAAE,MAAM,EAAE;AAC3C,WAAS,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG;AACzC,QAAI,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG;AACf,aAAO;AAAA,IACT;AACA,QAAI,EAA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S;AANpB,IAAM,mBAAN;","names":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Hex
|
|
3
|
-
} from "./chunk-BDM6FBUO.mjs";
|
|
4
|
-
|
|
5
|
-
// src/core/crypto/utils.ts
|
|
6
|
-
var convertSigningMessage = (message) => {
|
|
7
|
-
if (typeof message === "string") {
|
|
8
|
-
const isValid = Hex.isValid(message);
|
|
9
|
-
if (!isValid.valid) {
|
|
10
|
-
return new TextEncoder().encode(message);
|
|
11
|
-
}
|
|
12
|
-
return message;
|
|
13
|
-
}
|
|
14
|
-
return message;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export {
|
|
18
|
-
convertSigningMessage
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=chunk-THWEBWUC.mjs.map
|