@aptos-labs/ts-sdk 5.1.1-side-effect-free.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/chunk-A2XB7TVI.js +4 -0
- package/dist/common/chunk-A2XB7TVI.js.map +1 -0
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +1 -12
- package/dist/common/index.js +34 -34
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs.map +1 -1
- package/dist/esm/account/AbstractedAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.mjs.map +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Account.mjs.map +1 -1
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/AccountUtils.mjs.map +1 -1
- package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
- package/dist/esm/account/DerivableAbstractedAccount.mjs.map +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs.map +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs.map +1 -1
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.mjs.map +1 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs.map +1 -1
- package/dist/esm/account/MultiEd25519Account.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.mjs.map +1 -1
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.mjs.map +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs.map +1 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/index.mjs.map +1 -1
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/account/utils.mjs.map +1 -1
- package/dist/esm/api/account/abstraction.mjs +1 -1
- package/dist/esm/api/account/abstraction.mjs.map +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/account.mjs.map +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/ans.mjs.map +1 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptos.mjs.map +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs.map +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/coin.mjs.map +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs.map +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/faucet.mjs.map +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs.map +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/general.mjs.map +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/index.mjs.map +1 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/keyless.mjs.map +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/object.mjs.map +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/staking.mjs.map +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/table.mjs.map +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transaction.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/api/utils.mjs.map +1 -1
- package/dist/esm/bcs/consts.mjs +1 -1
- package/dist/esm/bcs/consts.mjs.map +1 -1
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/deserializer.mjs.map +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/index.mjs.map +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -1
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/bcs/serializer.mjs.map +1 -1
- package/dist/esm/chunk-2PASUPUO.mjs +2 -0
- package/dist/esm/chunk-2PASUPUO.mjs.map +1 -0
- package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
- package/dist/esm/chunk-35DKMW7Q.mjs.map +1 -0
- package/dist/esm/chunk-3LJVXUPB.mjs +2 -0
- package/dist/esm/chunk-3LJVXUPB.mjs.map +1 -0
- package/dist/esm/chunk-4QMXOWHP.mjs +1 -0
- package/dist/esm/chunk-4QMXOWHP.mjs.map +1 -0
- package/dist/esm/chunk-4WPQQPUF.mjs +1 -0
- package/dist/esm/chunk-4WPQQPUF.mjs.map +1 -0
- package/dist/esm/chunk-56CNRT2K.mjs +2 -0
- package/dist/esm/chunk-56CNRT2K.mjs.map +1 -0
- package/dist/esm/chunk-57YZ7I7V.mjs +2 -0
- package/dist/esm/chunk-57YZ7I7V.mjs.map +1 -0
- package/dist/esm/chunk-5HXLZHDW.mjs +1 -0
- package/dist/esm/chunk-5HXLZHDW.mjs.map +1 -0
- package/dist/esm/chunk-6WDVDEQZ.mjs +7 -0
- package/dist/esm/chunk-6WDVDEQZ.mjs.map +1 -0
- package/dist/esm/chunk-7DQDJ2SA.mjs +2 -0
- package/dist/esm/chunk-7DQDJ2SA.mjs.map +1 -0
- package/dist/esm/chunk-7ECCT6PK.mjs +1 -0
- package/dist/esm/chunk-7ECCT6PK.mjs.map +1 -0
- package/dist/esm/chunk-7ZESTCBD.mjs +2 -0
- package/dist/esm/chunk-7ZESTCBD.mjs.map +1 -0
- package/dist/esm/chunk-A5L76YP7.mjs +2 -0
- package/dist/esm/chunk-A5L76YP7.mjs.map +1 -0
- package/dist/esm/chunk-ADJMFL73.mjs +2 -0
- package/dist/esm/chunk-ADJMFL73.mjs.map +1 -0
- package/dist/esm/chunk-B563XRSZ.mjs +2 -0
- package/dist/esm/chunk-B563XRSZ.mjs.map +1 -0
- package/dist/esm/chunk-C3Q23D22.mjs +2 -0
- package/dist/esm/chunk-C3Q23D22.mjs.map +1 -0
- package/dist/esm/chunk-CW35YAMN.mjs +2 -0
- package/dist/esm/chunk-CW35YAMN.mjs.map +1 -0
- package/dist/esm/chunk-CZDNBI5K.mjs +2 -0
- package/dist/esm/chunk-CZDNBI5K.mjs.map +1 -0
- package/dist/esm/chunk-DHCGYW3W.mjs +2 -0
- package/dist/esm/chunk-DHCGYW3W.mjs.map +1 -0
- package/dist/esm/chunk-EBMEXURY.mjs +2 -0
- package/dist/esm/chunk-EBMEXURY.mjs.map +1 -0
- package/dist/esm/chunk-EF4FA5I6.mjs +2 -0
- package/dist/esm/chunk-EF4FA5I6.mjs.map +1 -0
- package/dist/esm/chunk-EMR3S3VO.mjs +2 -0
- package/dist/esm/chunk-EMR3S3VO.mjs.map +1 -0
- package/dist/esm/chunk-FD6FGKYY.mjs +1 -0
- package/dist/esm/chunk-FD6FGKYY.mjs.map +1 -0
- package/dist/esm/chunk-FGFLPH5K.mjs +2 -0
- package/dist/esm/chunk-FGFLPH5K.mjs.map +1 -0
- package/dist/esm/chunk-FLZPUYXQ.mjs +2 -0
- package/dist/esm/chunk-FLZPUYXQ.mjs.map +1 -0
- package/dist/esm/chunk-FZY4PMEE.mjs +1 -0
- package/dist/esm/chunk-FZY4PMEE.mjs.map +1 -0
- package/dist/esm/chunk-G3MHXDYA.mjs +1 -0
- package/dist/esm/chunk-G3MHXDYA.mjs.map +1 -0
- package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
- package/dist/esm/chunk-GOXRBEIJ.mjs.map +1 -0
- package/dist/esm/chunk-GUPVZIYS.mjs +2 -0
- package/dist/esm/chunk-GUPVZIYS.mjs.map +1 -0
- package/dist/esm/chunk-HGLO5LDS.mjs +1 -0
- package/dist/esm/chunk-HGLO5LDS.mjs.map +1 -0
- package/dist/esm/chunk-HNBVYE3N.mjs +2 -0
- package/dist/esm/chunk-HNBVYE3N.mjs.map +1 -0
- package/dist/esm/chunk-I7XT6L7S.mjs +2 -0
- package/dist/esm/chunk-I7XT6L7S.mjs.map +1 -0
- package/dist/esm/chunk-IF4UU2MT.mjs +2 -0
- package/dist/esm/chunk-IF4UU2MT.mjs.map +1 -0
- package/dist/esm/chunk-KB4XOTCR.mjs +2 -0
- package/dist/esm/chunk-KB4XOTCR.mjs.map +1 -0
- package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
- package/dist/esm/chunk-KDMSOCZY.mjs.map +1 -0
- package/dist/esm/chunk-MCFQE4GC.mjs +2 -0
- package/dist/esm/chunk-MCFQE4GC.mjs.map +1 -0
- package/dist/esm/chunk-MT2RJ7H3.mjs +2 -0
- package/dist/esm/chunk-MT2RJ7H3.mjs.map +1 -0
- package/dist/esm/chunk-N6YTF76Q.mjs +2 -0
- package/dist/esm/chunk-N6YTF76Q.mjs.map +1 -0
- package/dist/esm/chunk-NECL5FCQ.mjs +1 -0
- package/dist/esm/chunk-NECL5FCQ.mjs.map +1 -0
- package/dist/esm/chunk-O26BHE5H.mjs +2 -0
- package/dist/esm/chunk-O26BHE5H.mjs.map +1 -0
- package/dist/esm/chunk-OLILO7VD.mjs +2 -0
- package/dist/esm/chunk-OLILO7VD.mjs.map +1 -0
- package/dist/esm/chunk-ORMOQWWH.mjs +2 -0
- package/dist/esm/chunk-ORMOQWWH.mjs.map +1 -0
- package/dist/esm/chunk-PGUSBALH.mjs +4 -0
- package/dist/esm/chunk-PGUSBALH.mjs.map +1 -0
- package/dist/esm/chunk-Q4W3WJ2U.mjs +2 -0
- package/dist/esm/chunk-Q4W3WJ2U.mjs.map +1 -0
- package/dist/esm/chunk-QREVMGQZ.mjs +2 -0
- package/dist/esm/chunk-QREVMGQZ.mjs.map +1 -0
- package/dist/esm/chunk-RGKRCZ36.mjs +4 -0
- package/dist/esm/chunk-RGKRCZ36.mjs.map +1 -0
- package/dist/esm/chunk-STY74NUA.mjs +2 -0
- package/dist/esm/chunk-STY74NUA.mjs.map +1 -0
- package/dist/esm/chunk-TOBQ5UE6.mjs +2 -0
- package/dist/esm/chunk-TOBQ5UE6.mjs.map +1 -0
- package/dist/esm/chunk-TSEAIF34.mjs +2 -0
- package/dist/esm/chunk-TSEAIF34.mjs.map +1 -0
- package/dist/esm/chunk-TT3MPSBB.mjs +2 -0
- package/dist/esm/chunk-TT3MPSBB.mjs.map +1 -0
- package/dist/esm/chunk-UL777LTI.mjs +494 -0
- package/dist/esm/chunk-UL777LTI.mjs.map +1 -0
- package/dist/esm/chunk-UYVPNUH3.mjs +1 -0
- package/dist/esm/chunk-UYVPNUH3.mjs.map +1 -0
- package/dist/esm/chunk-V3MBJJTL.mjs +1 -0
- package/dist/esm/chunk-V3MBJJTL.mjs.map +1 -0
- package/dist/esm/chunk-V74WPKSY.mjs +2 -0
- package/dist/esm/chunk-V74WPKSY.mjs.map +1 -0
- package/dist/esm/chunk-WCMW2L3P.mjs +2 -0
- package/dist/esm/chunk-WCMW2L3P.mjs.map +1 -0
- package/dist/esm/chunk-WSR5EBJM.mjs +2 -0
- package/dist/esm/chunk-WSR5EBJM.mjs.map +1 -0
- package/dist/esm/chunk-XJJVJOX5.mjs +2 -0
- package/dist/esm/chunk-XJJVJOX5.mjs.map +1 -0
- package/dist/esm/chunk-XKUIMGKU.mjs +2 -0
- package/dist/esm/chunk-XKUIMGKU.mjs.map +1 -0
- package/dist/esm/chunk-YOZBVVKL.mjs +2 -0
- package/dist/esm/chunk-YOZBVVKL.mjs.map +1 -0
- package/dist/esm/chunk-ZP4DWSQA.mjs +2 -0
- package/dist/esm/chunk-ZP4DWSQA.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/index.mjs.map +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/localNode.mjs.map +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/cli/move.mjs.map +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/core.mjs.map +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/get.mjs.map +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/post.mjs.map +1 -1
- package/dist/esm/core/account/index.d.mts +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/index.mjs.map +1 -1
- package/dist/esm/core/account/utils/address.d.mts +1 -12
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs.map +1 -1
- package/dist/esm/core/account/utils/index.d.mts +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs.map +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -3
- package/dist/esm/core/accountAddress.mjs.map +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs.map +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/common.mjs.map +1 -1
- package/dist/esm/core/crypto/abstraction.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.mjs.map +1 -1
- package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
- package/dist/esm/core/crypto/deserializationUtils.mjs.map +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs.map +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -1
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -1
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/hdKey.mjs.map +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs.map +1 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/keyless.mjs.map +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -3
- package/dist/esm/core/crypto/multiKey.mjs.map +1 -1
- package/dist/esm/core/crypto/poseidon.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.mjs.map +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs.map +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs.map +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs.map +1 -1
- package/dist/esm/core/crypto/secp256r1.mjs +1 -1
- package/dist/esm/core/crypto/secp256r1.mjs.map +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs.map +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.mjs.map +1 -1
- package/dist/esm/core/crypto/types.mjs +1 -0
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs.map +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/hex.mjs.map +1 -1
- package/dist/esm/core/index.d.mts +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/core/index.mjs.map +1 -1
- package/dist/esm/errors/index.mjs +1 -6
- package/dist/esm/errors/index.mjs.map +1 -1
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/internal/abstraction.mjs +1 -1
- package/dist/esm/internal/abstraction.mjs.map +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/account.mjs.map +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/ans.mjs.map +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/coin.mjs.map +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs.map +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/faucet.mjs.map +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs.map +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/general.mjs.map +1 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/keyless.mjs.map +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/object.mjs.map +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/staking.mjs.map +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/table.mjs.map +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transaction.mjs.map +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs.map +1 -1
- package/dist/esm/internal/utils/index.mjs +1 -1
- package/dist/esm/internal/utils/index.mjs.map +1 -1
- package/dist/esm/internal/utils/utils.mjs +1 -1
- package/dist/esm/internal/utils/utils.mjs.map +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/internal/view.mjs.map +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs.map +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs.map +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/index.mjs.map +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs.map +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs.map +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs.map +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs.map +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/transactionArgument.mjs +1 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -1
- package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
- package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs.map +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs.map +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs.map +1 -1
- package/dist/esm/transactions/types.mjs +1 -0
- package/dist/esm/types/abstraction.mjs +1 -1
- package/dist/esm/types/abstraction.mjs.map +1 -1
- package/dist/esm/types/generated/queries.mjs +1 -493
- package/dist/esm/types/generated/queries.mjs.map +1 -1
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/index.mjs.map +1 -1
- package/dist/esm/types/indexer.mjs +1 -0
- package/dist/esm/types/types.mjs +1 -1
- package/dist/esm/types/types.mjs.map +1 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/apiEndpoints.mjs.map +1 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/const.mjs.map +1 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/helpers.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/index.mjs.map +1 -1
- package/dist/esm/utils/memoize.mjs +1 -1
- package/dist/esm/utils/memoize.mjs.map +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs.map +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/version.mjs.map +1 -1
- package/package.json +20 -39
- package/src/api/aptos.ts +14 -25
- package/src/core/account/utils/address.ts +0 -22
- package/dist/common/chunk-AWFAHZSB.js +0 -4
- package/dist/common/chunk-AWFAHZSB.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/crypto/multiKey.ts"],"sourcesContent":["import { AnyPublicKeyVariant, SigningScheme as AuthenticationKeyScheme, HexInput } from \"../../types\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureAsyncArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { AnyPublicKey, AnySignature } from \"./singleKey\";\nimport { AptosConfig } from \"../../api\";\n\n/**\n * Counts the number of set bits (1s) in a byte.\n * This function can help you determine the population count of a given byte value.\n *\n * @param byte - The byte value for which to count the number of set bits.\n * @group Implementation\n * @category Serialization\n */\n/* eslint-disable no-bitwise */\nfunction bitCount(byte: number) {\n let n = byte;\n n -= (n >> 1) & 0x55555555;\n n = (n & 0x33333333) + ((n >> 2) & 0x33333333);\n return (((n + (n >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;\n}\n/* eslint-enable no-bitwise */\n\nconst MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY = 3;\nexport abstract class AbstractMultiKey extends AccountPublicKey {\n publicKeys: PublicKey[];\n\n constructor(args: { publicKeys: PublicKey[] }) {\n super();\n this.publicKeys = args.publicKeys;\n }\n\n /**\n * Create a bitmap that holds the mapping from the original public keys\n * to the signatures passed in\n *\n * @param args.bits array of the index mapping to the matching public keys\n * @returns Uint8array bit map\n * @group Implementation\n * @category Serialization\n */\n createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, idx: number) => {\n if (idx + 1 > this.publicKeys.length) {\n throw new Error(`Signature index ${idx + 1} is out of public keys range, ${this.publicKeys.length}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(`Duplicate bit ${bit} detected.`);\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n /**\n * Get the index of the provided public key.\n *\n * This function retrieves the index of a specified public key within the MultiKey.\n * If the public key does not exist, it throws an error.\n *\n * @param publicKey - The public key to find the index for.\n * @returns The corresponding index of the public key, if it exists.\n * @throws Error - If the public key is not found in the MultiKey.\n * @group Implementation\n * @category Serialization\n */\n getIndex(publicKey: PublicKey): number {\n const index = this.publicKeys.findIndex((pk) => pk.toString() === publicKey.toString());\n\n if (index !== -1) {\n return index;\n }\n throw new Error(`Public key ${publicKey} not found in multi key set ${this.publicKeys}`);\n }\n\n abstract getSignaturesRequired(): number;\n}\n\n/**\n * Represents a multi-key authentication scheme for accounts, allowing multiple public keys\n * to be associated with a single account. This class enforces a minimum number of valid signatures\n * required to authorize actions, ensuring enhanced security for multi-agent accounts.\n *\n * The public keys of each individual agent can be any type of public key supported by Aptos.\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263), Aptos supports\n * `Legacy` and `Unified` authentication keys.\n * @group Implementation\n * @category Serialization\n */\nexport class MultiKey extends AbstractMultiKey {\n /**\n * List of any public keys\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKeys: AnyPublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n * @group Implementation\n * @category Serialization\n */\n public readonly signaturesRequired: number;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n * This constructor initializes a multi-signature transaction with the provided signatures and bitmap.\n *\n * @param args An object containing the parameters for the multi-signature transaction.\n * @param args.signatures A list of signatures.\n * @param args.bitmap A bitmap represented as a Uint8Array or an array of numbers, where each bit indicates whether a\n * corresponding signature is present. A maximum of 32 signatures is supported, and the length of the bitmap must be 4 bytes.\n *\n * @throws Error if the number of signatures exceeds the maximum supported, if the bitmap length is incorrect, or if the number\n * of signatures does not match the bitmap.\n * @group Implementation\n * @category Serialization\n */\n // region Constructors\n constructor(args: { publicKeys: Array<PublicKey>; signaturesRequired: number }) {\n const { publicKeys, signaturesRequired } = args;\n super({ publicKeys });\n\n // Validate number of public keys is greater than signature required\n if (signaturesRequired < 1) {\n throw new Error(\"The number of required signatures needs to be greater than 0\");\n }\n\n // Validate number of public keys is greater than signature required\n if (publicKeys.length < signaturesRequired) {\n throw new Error(\n `Provided ${publicKeys.length} public keys is smaller than the ${signaturesRequired} required signatures`,\n );\n }\n\n // Make sure that all keys are normalized to the SingleKey authentication scheme\n this.publicKeys = publicKeys.map((publicKey) =>\n publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey),\n );\n if (signaturesRequired > MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY) {\n const keylessCount = this.publicKeys.filter(\n (pk) => pk.variant === AnyPublicKeyVariant.Keyless || pk.variant === AnyPublicKeyVariant.FederatedKeyless,\n ).length;\n if (keylessCount > MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY) {\n throw new Error(\n `Construction of MultiKey with more than ${MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY} keyless public keys is not allowed when signaturesRequired \n is greater than ${MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY}. This is because a maximum of 3 keyless signatures are supported for a \n K-of-N MultiKey transaction.`,\n );\n }\n }\n\n this.signaturesRequired = signaturesRequired;\n }\n\n getSignaturesRequired(): number {\n return this.signaturesRequired;\n }\n\n // endregion\n\n // region AccountPublicKey\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by checking if the signature is valid.\n *\n * Note: This function will fail if a keyless signature is used. Use `verifySignatureAsync` instead.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: MultiKeySignature }): boolean {\n const { message, signature } = args;\n if (signature.signatures.length !== this.signaturesRequired) {\n throw new Error(\"The number of signatures does not match the number of required signatures\");\n }\n const signerIndices = signature.bitMapToSignerIndices();\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKeys[signerIndices[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by checking if the signature is valid.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.aptosConfig - The Aptos configuration to use\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: {\n aptosConfig: AptosConfig;\n message: HexInput;\n signature: Signature;\n options?: { throwErrorWithReason?: boolean };\n }): Promise<boolean> {\n const { signature } = args;\n try {\n if (!(signature instanceof MultiKeySignature)) {\n throw new Error(\"Signature is not a MultiKeySignature\");\n }\n if (signature.signatures.length !== this.signaturesRequired) {\n throw new Error(\"The number of signatures does not match the number of required signatures\");\n }\n const signerIndices = signature.bitMapToSignerIndices();\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKeys[signerIndices[i]];\n if (!(await publicKey.verifySignatureAsync({ ...args, signature: singleSignature }))) {\n return false;\n }\n }\n return true;\n } catch (error) {\n if (args.options?.throwErrorWithReason) {\n throw error;\n }\n return false;\n }\n }\n\n /**\n * Generates an authentication key based on the current instance's byte representation.\n * This key can be used for secure authentication processes within the system.\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.MultiKey,\n input: this.toUint8Array(),\n });\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the object by writing its signatures and bitmap to the provided serializer.\n * This allows the object to be converted 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.serializeVector(this.publicKeys);\n serializer.serializeU8(this.signaturesRequired);\n }\n\n /**\n * Deserializes a MultiKeySignature from the provided deserializer.\n * This function retrieves the signatures and bitmap necessary for creating a MultiKeySignature object.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): MultiKey {\n const keys = deserializer.deserializeVector(AnyPublicKey);\n const signaturesRequired = deserializer.deserializeU8();\n\n return new MultiKey({ publicKeys: keys, signaturesRequired });\n }\n\n // endregion\n\n /**\n * Get the index of the provided public key.\n *\n * This function retrieves the index of a specified public key within the MultiKey.\n * If the public key does not exist, it throws an error.\n *\n * @param publicKey - The public key to find the index for.\n * @returns The corresponding index of the public key, if it exists.\n * @throws Error - If the public key is not found in the MultiKey.\n * @group Implementation\n */\n getIndex(publicKey: PublicKey): number {\n const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);\n return super.getIndex(anyPublicKey);\n }\n\n public static isInstance(value: PublicKey): value is MultiKey {\n return \"publicKeys\" in value && \"signaturesRequired\" in value;\n }\n}\n\n/**\n * Represents a multi-signature transaction using Ed25519 signatures.\n * This class allows for the creation and management of a K-of-N multi-signature scheme,\n * where a specified number of signatures are required to authorize a transaction.\n *\n * It includes functionality to validate the number of signatures against a bitmap,\n * which indicates which public keys have signed the transaction.\n * @group Implementation\n * @category Serialization\n */\nexport class MultiKeySignature extends Signature {\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n * @group Implementation\n * @category Serialization\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * Maximum number of Ed25519 signatures supported\n * @group Implementation\n * @category Serialization\n */\n static MAX_SIGNATURES_SUPPORTED = MultiKeySignature.BITMAP_LEN * 8;\n\n /**\n * The list of underlying Ed25519 signatures\n * @group Implementation\n * @category Serialization\n */\n public readonly signatures: AnySignature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n * @group Implementation\n * @category Serialization\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { signatures: Array<Signature | AnySignature>; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`The number of signatures cannot be greater than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED}`);\n }\n\n // Make sure that all signatures are normalized to the SingleKey authentication scheme\n this.signatures = signatures.map((signature) =>\n signature instanceof AnySignature ? signature : new AnySignature(signature),\n );\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiKeySignature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiKeySignature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiKeySignature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n\n const nSignatures = this.bitmap.reduce((acc, byte) => acc + bitCount(byte), 0);\n if (nSignatures !== this.signatures.length) {\n throw new Error(`Expecting ${nSignatures} signatures from the bitmap, but got ${this.signatures.length}`);\n }\n }\n\n /**\n * Helper method to create a bitmap out of the specified bit positions\n * @param args.bits The bitmap positions that should be set. A position starts at index 0.\n * Valid position should range between 0 and 31.\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32bit long\n * @group Implementation\n * @category Serialization\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number) => {\n if (bit >= MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n /**\n * Converts the bitmap to an array of signer indices.\n *\n * Example:\n *\n * bitmap: [0b10001000, 0b01000000, 0b00000000, 0b00000000]\n * signerIndices: [0, 4, 9]\n *\n * @returns An array of signer indices.\n * @group Implementation\n * @category Serialization\n */\n bitMapToSignerIndices(): number[] {\n const signerIndices: number[] = [];\n for (let i = 0; i < this.bitmap.length; i += 1) {\n const byte = this.bitmap[i];\n for (let bit = 0; bit < 8; bit += 1) {\n if ((byte & (128 >> bit)) !== 0) {\n signerIndices.push(i * 8 + bit);\n }\n }\n }\n return signerIndices;\n }\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n // Note: we should not need to serialize the vector length, as it can be derived from the bitmap\n serializer.serializeVector(this.signatures);\n serializer.serializeBytes(this.bitmap);\n }\n\n static deserialize(deserializer: Deserializer): MultiKeySignature {\n const signatures = deserializer.deserializeVector(AnySignature);\n const bitmap = deserializer.deserializeBytes();\n return new MultiKeySignature({ signatures, bitmap });\n }\n\n // endregion\n}\n"],"mappings":"AAAA,OAAS,uBAAAA,EAAqB,iBAAiBC,MAAyC,cAGxF,OAAS,qBAAAC,MAAyB,uBAClC,OAAS,oBAAAC,MAA6D,cACtE,OAAS,aAAAC,MAAiB,cAC1B,OAAS,gBAAAC,EAAc,gBAAAC,MAAoB,cAY3C,SAASC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C,CAEA,OAAO,YAAYC,EAA+C,CAChE,MAAMK,EAAaL,EAAa,kBAAkB5B,CAAY,EACxDS,EAASmB,EAAa,iBAAiB,EAC7C,OAAO,IAAII,EAAkB,CAAE,WAAAC,EAAY,OAAAxB,CAAO,CAAC,CACrD,CAGF,EAhKauB,EAMJ,WAAqB,EANjBA,EAaJ,yBAA2BA,EAAkB,WAAa,EAb5D,IAAMP,EAANO","names":["AnyPublicKeyVariant","AuthenticationKeyScheme","AuthenticationKey","AccountPublicKey","Signature","AnyPublicKey","AnySignature","bitCount","byte","n","MAX_NUM_KEYLESS_PUBLIC_FOR_MULTI_KEY","AbstractMultiKey","args","bits","firstBitInByte","bitmap","dupCheckSet","bit","idx","byteOffset","publicKey","index","pk","MultiKey","publicKeys","signaturesRequired","message","signature","signerIndices","i","singleSignature","MultiKeySignature","error","serializer","deserializer","keys","anyPublicKey","value","_MultiKeySignature","signatures","nSignatures","acc"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b,c,d,e}from"../../chunk-GOXRBEIJ.mjs";import"../../chunk-KDMSOCZY.mjs";export{d as bigIntToBytesLE,c as bytesToBigIntLE,a as hashStrToField,b as padAndPackBytesWithLen,e as poseidonHash};
|
|
2
2
|
//# sourceMappingURL=poseidon.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/crypto/poseidon.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\nimport {\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n} from \"poseidon-lite\";\n\nconst numInputsToPoseidonFunc = [\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n];\n\nconst BYTES_PACKED_PER_SCALAR = 31;\nconst MAX_NUM_INPUT_SCALARS = 16;\nconst MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALAR;\n\n/**\n * Hashes a string to a field element via Poseidon hashing.\n * This function is useful for converting a string into a fixed-size hash that can be used in cryptographic applications.\n *\n * @param str - The string to be hashed.\n * @param maxSizeBytes - The maximum size in bytes for the resulting hash.\n * @returns bigint - The result of the hash.\n * @group Implementation\n * @category Serialization\n */\nexport function hashStrToField(str: string, maxSizeBytes: number): bigint {\n const textEncoder = new TextEncoder();\n const strBytes = textEncoder.encode(str);\n return hashBytesWithLen(strBytes, maxSizeBytes);\n}\n\n/**\n * Computes a Poseidon hash of the provided byte array, ensuring that the byte array does not exceed the specified maximum size.\n * This function is useful for generating a hash from a byte array while enforcing size constraints.\n *\n * @param bytes - The byte array to be hashed.\n * @param maxSizeBytes - The maximum allowed size for the byte array.\n * @throws Error if the length of the inputted bytes exceeds the specified maximum size.\n * @group Implementation\n * @category Serialization\n */\nfunction hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const packed = padAndPackBytesWithLen(bytes, maxSizeBytes);\n return poseidonHash(packed);\n}\n\n/**\n * Pads the input byte array with zeros to a specified maximum size and then packs the bytes.\n * This function ensures that the byte array does not exceed the specified maximum size, throwing an error if it does.\n *\n * @param bytes - The byte array to be padded and packed.\n * @param maxSizeBytes - The maximum size in bytes that the input array can have.\n * @throws Error if the input byte array exceeds the specified maximum size.\n * @group Implementation\n * @category Serialization\n */\nfunction padAndPackBytesNoLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const paddedStrBytes = padUint8ArrayWithZeros(bytes, maxSizeBytes);\n return packBytes(paddedStrBytes);\n}\n\n/**\n * Pads and packs the given byte array to a specified maximum size and appends its length.\n * This function ensures that the byte array does not exceed the maximum size, throwing an error if it does.\n * It is useful for preparing byte data for further processing or transmission by ensuring a consistent format.\n *\n * @param bytes - The byte array to be padded and packed.\n * @param maxSizeBytes - The maximum allowed size for the byte array.\n * @throws Error if the length of the input bytes exceeds the maximum size.\n * @returns A new Uint8Array that contains the padded and packed bytes along with the length of the original byte array.\n * @group Implementation\n * @category Serialization\n */\nexport function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n return padAndPackBytesNoLen(bytes, maxSizeBytes).concat([BigInt(bytes.length)]);\n}\n\n/**\n * Packs a Uint8Array into an array of BigInts, ensuring the input does not exceed the maximum allowed bytes.\n * @param bytes - The Uint8Array to be packed.\n * @throws {Error} Throws an error if the input exceeds the maximum number of bytes allowed.\n * @group Implementation\n * @category Serialization\n */\nfunction packBytes(bytes: Uint8Array): bigint[] {\n if (bytes.length > MAX_NUM_INPUT_BYTES) {\n throw new Error(`Can't pack more than ${MAX_NUM_INPUT_BYTES}. Was given ${bytes.length} bytes`);\n }\n return chunkUint8Array(bytes, BYTES_PACKED_PER_SCALAR).map((chunk) => bytesToBigIntLE(chunk));\n}\n\n/**\n * Splits a Uint8Array into smaller chunks of the specified size.\n * This function is useful for processing large arrays in manageable segments.\n *\n * @param array - The Uint8Array to be split into chunks.\n * @param chunkSize - The size of each chunk.\n * @returns An array of Uint8Array chunks.\n * @group Implementation\n * @category Serialization\n */\nfunction chunkUint8Array(array: Uint8Array, chunkSize: number): Uint8Array[] {\n const result: Uint8Array[] = [];\n for (let i = 0; i < array.length; i += chunkSize) {\n result.push(array.subarray(i, i + chunkSize));\n }\n return result;\n}\n\n/**\n * Converts a little-endian byte array into a BigInt.\n * This function is useful for interpreting byte data as a numerical value in a way that respects the little-endian format.\n *\n * @param bytes - The byte array to convert.\n * @returns The resulting BigInt representation of the byte array.\n * @group Implementation\n * @category Serialization\n */\nexport function bytesToBigIntLE(bytes: Uint8Array): bigint {\n let result = BigInt(0);\n for (let i = bytes.length - 1; i >= 0; i -= 1) {\n result = (result << BigInt(8)) | BigInt(bytes[i]);\n }\n return result;\n}\n\n/**\n * Converts a bigint value into a little-endian byte array of a specified length.\n * This function is useful for representing large integers in a byte format, which is often required for cryptographic operations\n * or binary data manipulation.\n *\n * @param value - The number to convert into bytes.\n * @param length - The desired length of the resulting byte array.\n * @returns A Uint8Array containing the little-endian representation of the bigint value.\n * @group Implementation\n * @category Serialization\n */\nexport function bigIntToBytesLE(value: bigint | number, length: number): Uint8Array {\n let val = BigInt(value);\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; i += 1) {\n bytes[i] = Number(val & BigInt(0xff));\n val >>= BigInt(8);\n }\n return bytes;\n}\n\n/**\n * Pads the input Uint8Array with zeros to achieve the specified size.\n * This function is useful for ensuring that a byte array meets a required length for further processing.\n *\n * @param inputArray - The Uint8Array to be padded.\n * @param paddedSize - The desired size of the padded array, which must be greater than or equal to the input array size.\n * @throws Error if paddedSize is less than the length of inputArray.\n * @group Implementation\n * @category Serialization\n */\nfunction padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uint8Array {\n if (paddedSize < inputArray.length) {\n throw new Error(\"Padded size must be greater than or equal to the input array size.\");\n }\n\n // Create a new Uint8Array with the padded size\n const paddedArray = new Uint8Array(paddedSize);\n\n // Copy the content of the input array to the new array\n paddedArray.set(inputArray);\n\n // Fill the remaining space with zeros\n for (let i = inputArray.length; i < paddedSize; i += 1) {\n paddedArray[i] = 0;\n }\n\n return paddedArray;\n}\n\n/**\n * Hashes up to 16 scalar elements via the Poseidon hashing algorithm.\n * Each element must be scalar fields of the BN254 elliptic curve group.\n *\n * @param inputs - An array of elements to be hashed, which can be of type number, bigint, or string.\n * @returns bigint - The result of the hash.\n * @throws Error - Throws an error if the input length exceeds the maximum allowed.\n * @group Implementation\n * @category Serialization\n */\nexport function poseidonHash(inputs: (number | bigint | string)[]): bigint {\n if (inputs.length > numInputsToPoseidonFunc.length) {\n throw new Error(\n `Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`,\n );\n }\n return numInputsToPoseidonFunc[inputs.length - 1](inputs);\n}\n"],"mappings":"AACA,OACE,aAAAA,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,MACK,gBAEP,MAAMC,EAA0B,CAC9BhB,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CACF,EAEME,EAA0B,GAC1BC,EAAwB,GACxBC,GAAuBD,EAAwB,GAAKD,EAYnD,SAASG,EAAeC,EAAaC,EAA8B,CAExE,MAAMC,EADc,IAAI,YAAY,EACP,OAAOF,CAAG,EACvC,OAAOG,EAAiBD,EAAUD,CAAY,CAChD,CAYA,SAASE,EAAiBC,EAAmBH,EAA8B,CACzE,GAAIG,EAAM,OAASH,EACjB,MAAM,IAAI,MAAM,4BAA4BG,CAAK,mBAAmBH,CAAY,EAAE,EAEpF,MAAMI,EAASC,EAAuBF,EAAOH,CAAY,EACzD,OAAOM,EAAaF,CAAM,CAC5B,CAYA,SAASG,EAAqBJ,EAAmBH,EAAgC,CAC/E,GAAIG,EAAM,OAASH,EACjB,MAAM,IAAI,MAAM,yBAAyBG,CAAK,mBAAmBH,CAAY,EAAE,EAEjF,MAAMQ,EAAiBC,EAAuBN,EAAOH,CAAY,EACjE,OAAOU,E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U,EAG7CC,EAAY,IAAIF,CAAU,EAG1B,QAASL,EAAIK,EAAW,OAAQL,EAAIM,EAAYN,GAAK,EACnDO,EAAYP,CAAC,EAAI,EAGnB,OAAOO,CACT,CAYO,SAASlB,EAAamB,EAA8C,CACzE,GAAIA,EAAO,OAAS/B,EAAwB,OAC1C,MAAM,IAAI,MACR,kCAAkC+B,EAAO,MAAM,0BAA0B/B,EAAwB,MAAM,EACzG,EAEF,OAAOA,EAAwB+B,EAAO,OAAS,CAAC,EAAEA,CAAM,CAC1D","names":["poseidon1","poseidon2","poseidon3","poseidon4","poseidon5","poseidon6","poseidon7","poseidon8","poseidon9","poseidon10","poseidon11","poseidon12","poseidon13","poseidon14","poseidon15","poseidon16","numInputsToPoseidonFunc","BYTES_PACKED_PER_SCALAR","MAX_NUM_INPUT_SCALARS","MAX_NUM_INPUT_BYTES","hashStrToField","str","maxSizeBytes","strBytes","hashBytesWithLen","bytes","packed","padAndPackBytesWithLen","poseidonHash","padAndPackBytesNoLen","paddedStrBytes","padUint8ArrayWithZeros","packBytes","chunkUint8Array","chunk","bytesToBigIntLE","array","chunkSize","result","i","bigIntToBytesLE","value","length","val","inputArray","paddedSize","paddedArray","inputs"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../../chunk-2PASUPUO.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as PrivateKey};
|
|
2
2
|
//# sourceMappingURL=privateKey.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../../chunk-XJJVJOX5.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Proof};
|
|
2
2
|
//# sourceMappingURL=proof.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b}from"../../chunk-WSR5EBJM.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{b as AccountPublicKey,a as PublicKey};
|
|
2
2
|
//# sourceMappingURL=publicKey.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{C as a,D as b,E as c}from"../../chunk-PGUSBALH.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-V74WPKSY.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-O26BHE5H.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-I7XT6L7S.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-2PASUPUO.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ZP4DWSQA.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-ADJMFL73.mjs";import"../../chunk-TT3MPSBB.mjs";import"../../chunk-TSEAIF34.mjs";import"../../chunk-57YZ7I7V.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-DHCGYW3W.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-KB4XOTCR.mjs";import"../../chunk-3LJVXUPB.mjs";import"../../chunk-CZDNBI5K.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-7ZESTCBD.mjs";import"../../chunk-EMR3S3VO.mjs";import"../../chunk-OLILO7VD.mjs";import"../../chunk-GUPVZIYS.mjs";import"../../chunk-KDMSOCZY.mjs";export{b as Secp256k1PrivateKey,a as Secp256k1PublicKey,c as Secp256k1Signature};
|
|
2
2
|
//# sourceMappingURL=secp256k1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/crypto/secp256k1.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 } from \"@noble/hashes/sha3\";\nimport { secp256k1 } from \"@noble/curves/secp256k1\";\nimport { HDKey } from \"@scure/bip32\";\nimport { Serializable, Deserializer, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport { HexInput, PrivateKeyVariants } from \"../../types\";\nimport { isValidBIP44Path, mnemonicToSeed } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\nimport { AptosConfig } from \"../../api\";\n\n/**\n * Represents a Secp256k1 ECDSA public key.\n *\n * @extends PublicKey\n * @property LENGTH - The length of the Secp256k1 public key in bytes.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256k1PublicKey extends PublicKey {\n // Secp256k1 ecdsa public keys contain a prefix indicating compression and two 32-byte coordinates.\n static readonly LENGTH: number = 65;\n\n // If it's compressed, it is only 33 bytes\n static readonly COMPRESSED_LENGTH: number = 33;\n\n // Hex value of the public key\n private readonly key: Hex;\n\n // Identifier to distinguish from Secp256k1PublicKey\n public readonly keyType: string = \"secp256k1\";\n\n /**\n * Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array.\n * This constructor validates the length of the provided signature data.\n *\n * @param hexInput - A HexInput (string or Uint8Array) representing the signature data.\n * @throws Error if the length of the signature data is not equal to Secp256k1Signature.LENGTH.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n const { length } = hex.toUint8Array();\n if (length === Secp256k1PublicKey.LENGTH) {\n this.key = hex;\n } else if (length === Secp256k1PublicKey.COMPRESSED_LENGTH) {\n const point = secp256k1.ProjectivePoint.fromHex(hex.toUint8Array());\n this.key = Hex.fromHexInput(point.toRawBytes(false));\n } else {\n throw new Error(\n `PublicKey length should be ${Secp256k1PublicKey.LENGTH} or ${Secp256k1PublicKey.COMPRESSED_LENGTH}, received ${length}`,\n );\n }\n }\n\n // region PublicKey\n /**\n * Verifies a Secp256k1 signature against the public key.\n *\n * This function checks the validity of a signature for a given message, ensuring that the signature is canonical as a malleability check.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify against the public key.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: Secp256k1Signature }): boolean {\n const { message, signature } = args;\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const messageSha3Bytes = sha3_256(messageBytes);\n const signatureBytes = signature.toUint8Array();\n return secp256k1.verify(signatureBytes, messageSha3Bytes, this.key.toUint8Array(), { lowS: true });\n }\n\n /**\n * Note: Secp256k1Signatures can be verified syncronously.\n *\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.aptosConfig - The configuration object for connecting to the Aptos network\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of Secp256k1Signature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: {\n aptosConfig: AptosConfig;\n message: HexInput;\n signature: Secp256k1Signature;\n }): Promise<boolean> {\n return this.verifySignature(args);\n }\n\n /**\n * Get the data as a Uint8Array representation.\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 function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256k1Signature from the provided deserializer.\n * This function allows you to reconstruct a Secp256k1Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n // eslint-disable-next-line class-methods-use-this\n deserialize(deserializer: Deserializer) {\n const hex = deserializer.deserializeBytes();\n return new Secp256k1Signature(hex);\n }\n\n static deserialize(deserializer: Deserializer): Secp256k1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256k1PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * Determine if the provided public key is an instance of Secp256k1PublicKey.\n *\n * @deprecated use `instanceof Secp256k1PublicKey` instead\n * @param publicKey - The public key to check.\n * @group Implementation\n * @category Serialization\n */\n static isPublicKey(publicKey: PublicKey): publicKey is Secp256k1PublicKey {\n return publicKey instanceof Secp256k1PublicKey;\n }\n\n /**\n * Determines if the provided public key is a valid instance of a Secp256k1 public key.\n * This function checks for the presence of a \"key\" property and validates the length of the key data.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Secp256k1 public key.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is Secp256k1PublicKey {\n return (\n \"key\" in publicKey &&\n (publicKey.key as any)?.data?.length === Secp256k1PublicKey.LENGTH &&\n \"keyType\" in publicKey &&\n (publicKey as any).keyType === \"secp256k1\"\n );\n }\n}\n\n/**\n * Represents a Secp256k1 ECDSA private key, providing functionality to create, sign messages,\n * derive public keys, and serialize/deserialize the key.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256k1PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of Secp256k1 ecdsa private key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The private key bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly key: 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 A 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.Secp256k1, strict);\n if (privateKeyHex.toUint8Array().length !== Secp256k1PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Secp256k1PrivateKey.LENGTH}`);\n }\n\n this.key = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Secp256k1PrivateKey - A newly generated Secp256k1 private key.\n * @group Implementation\n * @category Serialization\n */\n static generate(): Secp256k1PrivateKey {\n const hexInput = secp256k1.utils.randomPrivateKey();\n return new Secp256k1PrivateKey(hexInput, false);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase using a specified BIP44 path.\n *\n * @param path - The BIP44 path to derive the key from.\n * @param mnemonics - The mnemonic seed phrase used for key generation.\n *\n * @returns The generated private key.\n *\n * @throws Error if the provided path is not a valid BIP44 path.\n * @group Implementation\n * @category Serialization\n */\n static fromDerivationPath(path: string, mnemonics: string): Secp256k1PrivateKey {\n if (!isValidBIP44Path(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Secp256k1PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * Derives a private key from a specified BIP44 path using a given seed.\n * This function is essential for generating keys that follow the hierarchical deterministic (HD) wallet structure.\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 * @returns The generated private key as an instance of Secp256k1PrivateKey.\n * @throws Error if the derived private key is invalid.\n * @group Implementation\n * @category Serialization\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array): Secp256k1PrivateKey {\n const { privateKey } = HDKey.fromMasterSeed(seed).derive(path);\n // library returns privateKey as Uint8Array | null\n if (privateKey === null) {\n throw new Error(\"Invalid key\");\n }\n\n return new Secp256k1PrivateKey(privateKey, false);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Sign the given message with the private key.\n * This function generates a cryptographic signature for the provided message, ensuring the signature is canonical and non-malleable.\n *\n * @param message - A message in HexInput format to be signed.\n * @returns Signature - The generated signature for the provided message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Secp256k1Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign);\n const messageHashBytes = sha3_256(messageBytes.toUint8Array());\n const signature = secp256k1.sign(messageHashBytes, this.key.toUint8Array(), { lowS: true });\n return new Secp256k1Signature(signature.toCompactRawBytes());\n }\n\n /**\n * Derive the Secp256k1PublicKey from this private key.\n *\n * @returns Secp256k1PublicKey The derived public key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): Secp256k1PublicKey {\n const bytes = secp256k1.getPublicKey(this.key.toUint8Array(), false);\n return new Secp256k1PublicKey(bytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the private key as a string representation.\n *\n * @returns string representation of the private key\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.toAIP80String();\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.key.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.key.toString(), PrivateKeyVariants.Secp256k1);\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): Secp256k1PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256k1PrivateKey(bytes, false);\n }\n\n // endregion\n\n /**\n * Determines if the provided private key is an instance of Secp256k1PrivateKey.\n *\n * @param privateKey - The private key to be checked.\n *\n * @deprecated use `instanceof Secp256k1PrivateKey` instead\n * @group Implementation\n * @category Serialization\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Secp256k1PrivateKey {\n return privateKey instanceof Secp256k1PrivateKey;\n }\n}\n\n/**\n * Represents a signature of a message signed using a Secp256k1 ECDSA private key.\n *\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256k1Signature extends Signature {\n /**\n * Secp256k1 ecdsa signatures are 256-bit.\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 /**\n * Create a new Signature instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Secp256k1Signature.LENGTH) {\n throw new Error(\n `Signature length should be ${Secp256k1Signature.LENGTH}, received ${data.toUint8Array().length}`,\n );\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): Secp256k1Signature {\n const hex = deserializer.deserializeBytes();\n return new Secp256k1Signature(hex);\n }\n\n // endregion\n}\n"],"mappings":"AAGA,OAAS,YAAAA,MAAgB,qBACzB,OAAS,aAAAC,MAAiB,0BAC1B,OAAS,SAAAC,MAAa,eACtB,OAAS,gBAAAC,MAA8C,YACvD,OAAS,OAAAC,MAAW,SACpB,OAAmB,sBAAAC,MAA0B,cAC7C,OAAS,oBAAAC,EAAkB,kBAAAC,MAAsB,UACjD,OAAS,cAAAC,MAAkB,eAC3B,OAAS,aAAAC,MAAiB,cAC1B,OAAS,aAAAC,MAAiB,cAC1B,OAAS,yBAAAC,MAA6B,UAW/B,MAAMC,EAAN,MAAMA,UAA2BH,CAAU,CAsBhD,YAAYI,EAAoB,CAC9B,MAAM,EAZR,KAAgB,QAAkB,YAchC,MAAMC,EAAMV,EAAI,aAAaS,CAAQ,EAC/B,CAAE,OAAAE,CAAO,EAAID,EAAI,aAAa,EACpC,GAAIC,IAAWH,EAAmB,OAChC,KAAK,IAAME,UACFC,IAAWH,EAAmB,kBAAmB,CAC1D,MAAMI,EAAQf,EAAU,gBAAgB,QAAQa,EAAI,aAAa,CAAC,EAClE,KAAK,IAAMV,EAAI,aAAaY,EAAM,WAAW,EAAK,CAAC,CACrD,KACE,OAAM,IAAI,MACR,8BAA8BJ,EAAmB,MAAM,OAAOA,EAAmB,iBAAiB,cAAcG,CAAM,EACxH,CAEJ,CAcA,gBAAgBE,EAAqE,CACnF,KAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EACzBG,EAAkBT,EAAsBO,CAAO,EAC/CG,EAAejB,EAAI,aAAagB,CAAe,EAAE,aAAa,EAC9DE,EAAmBtB,EAASqB,CAAY,EACxCE,EAAiBJ,EAAU,aAAa,EAC9C,OAAOlB,EAAU,OAAOsB,EAAgBD,EAAkB,KAAK,IAAI,aAAa,EAAG,CAAE,KAAM,EAAK,C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,CAAQ,EACtC,GAAI4B,EAAK,aAAa,EAAE,SAAWD,EAAmB,OACpD,MAAM,IAAI,MACR,8BAA8BA,EAAmB,MAAM,cAAcC,EAAK,aAAa,EAAE,MAAM,EACjG,EAEF,KAAK,KAAOA,CACd,CAMA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CAMA,UAAUjB,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CAEA,OAAO,YAAYC,EAAgD,CACjE,MAAMX,EAAMW,EAAa,iBAAiB,EAC1C,OAAO,IAAIe,EAAmB1B,CAAG,CACnC,CAGF,EA1Da0B,EAMK,OAAS,GANpB,IAAMd,EAANc","names":["sha3_256","secp256k1","HDKey","Serializable","Hex","PrivateKeyVariants","isValidBIP44Path","mnemonicToSeed","PrivateKey","PublicKey","Signature","convertSigningMessage","_Secp256k1PublicKey","hexInput","hex","length","point","args","message","signature","messageToVerify","messageBytes","messageSha3Bytes","signatureBytes","serializer","deserializer","Secp256k1Signature","bytes","publicKey","Secp256k1PublicKey","_Secp256k1PrivateKey","strict","privateKeyHex","path","mnemonics","seed","privateKey","messageToSign","messageHashBytes","Secp256k1PrivateKey","_Secp256k1Signature","data"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b,c,d}from"../../chunk-I7XT6L7S.mjs";import"../../chunk-2PASUPUO.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{b as Secp256r1PrivateKey,a as Secp256r1PublicKey,d as Secp256r1Signature,c as WebAuthnSignature};
|
|
2
2
|
//# sourceMappingURL=secp256r1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/crypto/secp256r1.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 } from \"@noble/hashes/sha3\";\nimport { p256 } from \"@noble/curves/nist.js\";\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport {\n HexInput,\n PrivateKeyVariants,\n SigningScheme as AuthenticationKeyScheme,\n AnyPublicKeyVariant,\n} from \"../../types\";\nimport { PublicKey, VerifySignatureAsyncArgs } from \"./publicKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { Signature } from \"./signature\";\nimport { AuthenticationKey } from \"../authenticationKey\";\n\n/**\n * Represents a Secp256r1 ECDSA public key.\n *\n * @extends PublicKey\n * @property LENGTH - The length of the Secp256r1 public key in bytes.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1PublicKey extends PublicKey {\n // Secp256r1 ecdsa public keys contain a prefix indicating compression and two 32-byte coordinates.\n static readonly LENGTH: number = 65;\n\n // If it's compressed, it is only 33 bytes\n static readonly COMPRESSED_LENGTH: number = 33;\n\n // Hex value of the public key\n private readonly key: Hex;\n\n // Identifier to distinguish from Secp256k1PublicKey\n public readonly keyType: string = \"secp256r1\";\n\n /**\n * Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array.\n * This constructor validates the length of the provided public key data.\n *\n * @param hexInput - A HexInput (string or Uint8Array) representing the public key data.\n * @throws Error if the length of the public key data is not equal to Secp256r1PublicKey.LENGTH or COMPRESSED_LENGTH.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n const keyLength = hex.toUint8Array().length;\n if (keyLength !== Secp256r1PublicKey.LENGTH && keyLength !== Secp256r1PublicKey.COMPRESSED_LENGTH) {\n throw new Error(\n `PublicKey length should be ${Secp256r1PublicKey.LENGTH} or ${Secp256r1PublicKey.COMPRESSED_LENGTH}, received ${keyLength}`,\n );\n }\n\n if (keyLength === Secp256r1PublicKey.COMPRESSED_LENGTH) {\n const point = p256.ProjectivePoint.fromHex(hex.toUint8Array());\n this.key = Hex.fromHexInput(point.toRawBytes(false));\n } else {\n this.key = hex;\n }\n }\n\n /**\n * Get the data as a Uint8Array representation.\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 /**\n * Get the public key as a hex string with the 0x prefix.\n *\n * @returns string representation of the public key.\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.key.toString();\n }\n\n /**\n * Converts the public key to BCS (Binary Canonical Serialization) bytes.\n * This function serializes the public key data into a byte array format suitable for transmission or storage.\n *\n * @returns Uint8Array representation of the serialized public key.\n * @group Implementation\n * @category Serialization\n */\n bcsToBytes() {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n /**\n * Verifies a Secp256r1 signature against the public key.\n *\n * This function checks the validity of a signature for a given message.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify against the public key.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n const { message, signature } = args;\n\n const msgHex = Hex.fromHexInput(message).toUint8Array();\n const sha3Message = sha3_256(msgHex);\n const rawSignature = signature.toUint8Array();\n\n return p256.verify(rawSignature, sha3Message, this.toUint8Array());\n }\n\n /**\n * Note: Secp256r1Signatures can be verified synchronously.\n *\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of Secp256r1Signature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise<boolean> {\n return this.verifySignature({ message: args.message, signature: args.signature });\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1PublicKey from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1PublicKey object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PublicKey(bytes);\n }\n\n /**\n * Loads a Secp256r1PublicKey from the provided deserializer.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static load(deserializer: Deserializer): Secp256r1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PublicKey(bytes);\n }\n\n /**\n * Determines if the provided public key is a valid instance of a Secp256r1 public key.\n * This function checks for the presence of a \"key\" property and validates the length of the key data.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Secp256r1 public key.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is Secp256r1PublicKey {\n return (\n \"key\" in publicKey &&\n (publicKey.key as any)?.data?.length === Secp256r1PublicKey.LENGTH &&\n \"keyType\" in publicKey &&\n (publicKey as any).keyType === \"secp256r1\"\n );\n }\n\n /**\n * Generates an authentication key from the public key using the Secp256r1 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 const serializer = new Serializer();\n serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Secp256r1);\n serializer.serializeFixedBytes(this.bcsToBytes());\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: serializer.toUint8Array(),\n });\n }\n}\n\n/**\n * Represents a Secp256r1 ECDSA private key, providing functionality to create, sign messages,\n * derive public keys, and serialize/deserialize the key.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1PrivateKey extends PrivateKey {\n /**\n * Length of Secp256r1 ecdsa private key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The private key bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly key: Hex;\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 A 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.Secp256r1, strict);\n const keyLength = privateKeyHex.toUint8Array().length;\n if (keyLength !== Secp256r1PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Secp256r1PrivateKey.LENGTH}, received ${keyLength}`);\n }\n\n this.key = privateKeyHex;\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the private key as a string representation.\n *\n * @returns string representation of the private key\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return PrivateKey.formatPrivateKey(this.key.toString(), PrivateKeyVariants.Secp256r1);\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.key.toString();\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a cryptographic signature for the provided message.\n *\n * @param message - A message in HexInput format to be signed.\n * @returns Signature - The generated signature for the provided message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Secp256r1Signature {\n const msgHex = Hex.fromHexInput(message);\n const sha3Message = sha3_256(msgHex.toUint8Array());\n const signature = p256.sign(sha3Message, this.key.toUint8Array());\n return new Secp256r1Signature(signature.toCompactRawBytes());\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1PrivateKey from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1PrivateKey object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PrivateKey(bytes);\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Secp256r1PrivateKey - A newly generated Secp256r1 private key.\n * @group Implementation\n * @category Serialization\n */\n static generate(): Secp256r1PrivateKey {\n const hexInput = p256.utils.randomPrivateKey();\n return new Secp256r1PrivateKey(hexInput);\n }\n\n /**\n * Derive the Secp256r1PublicKey from this private key.\n *\n * @returns Secp256r1PublicKey The derived public key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): Secp256r1PublicKey {\n const bytes = p256.getPublicKey(this.key.toUint8Array(), false);\n return new Secp256r1PublicKey(bytes);\n }\n}\n\nexport class WebAuthnSignature extends Signature {\n signature: Hex;\n\n authenticatorData: Hex;\n\n clientDataJSON: Hex;\n\n constructor(signature: HexInput, authenticatorData: HexInput, clientDataJSON: HexInput) {\n super();\n this.signature = Hex.fromHexInput(signature);\n this.authenticatorData = Hex.fromHexInput(authenticatorData);\n this.clientDataJSON = Hex.fromHexInput(clientDataJSON);\n }\n\n toUint8Array() {\n return this.signature.toUint8Array();\n }\n\n serialize(serializer: Serializer) {\n serializer.serializeU32AsUleb128(0);\n serializer.serializeBytes(this.signature.toUint8Array());\n serializer.serializeBytes(this.authenticatorData.toUint8Array());\n serializer.serializeBytes(this.clientDataJSON.toUint8Array());\n }\n\n bcsToBytes() {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n bcsToHex() {\n return Hex.fromHexInput(this.bcsToBytes());\n }\n\n toStringWithoutPrefix() {\n return Hex.fromHexInput(this.bcsToBytes()).toString();\n }\n\n static deserialize(deserializer: Deserializer) {\n const id = deserializer.deserializeUleb128AsU32();\n if (id !== 0) {\n throw new Error(`Invalid id for WebAuthnSignature: ${id}`);\n }\n const signature = deserializer.deserializeBytes();\n const authenticatorData = deserializer.deserializeBytes();\n const clientDataJSON = deserializer.deserializeBytes();\n return new WebAuthnSignature(signature, authenticatorData, clientDataJSON);\n }\n}\n\n/**\n * Represents a signature of a message signed using a Secp256r1 ECDSA private key.\n *\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1Signature extends Signature {\n /**\n * Secp256r1 ecdsa signatures are 256-bit.\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 /**\n * Create a new Signature instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n const signatureLength = hex.toUint8Array().length;\n if (signatureLength !== Secp256r1Signature.LENGTH) {\n throw new Error(`Signature length should be ${Secp256r1Signature.LENGTH}, received ${signatureLength}`);\n }\n const signature = p256.Signature.fromCompact(hex.toUint8Array()).normalizeS().toCompactRawBytes();\n this.data = Hex.fromHexInput(signature);\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the signature\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n /**\n * Get the signature as a hex string with the 0x prefix.\n *\n * @returns string representation of the signature\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.data.toString();\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1Signature from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1Signature {\n const hex = deserializer.deserializeBytes();\n return new Secp256r1Signature(hex);\n }\n}\n"],"mappings":"AAGA,OAAS,YAAAA,MAAgB,qBACzB,OAAS,QAAAC,MAAY,wBACrB,OAAuB,cAAAC,MAAkB,YACzC,OAAS,OAAAC,MAAW,SACpB,OAEE,sBAAAC,EACA,iBAAiBC,EACjB,uBAAAC,MACK,cACP,OAAS,aAAAC,MAA2C,cACpD,OAAS,cAAAC,MAAkB,eAC3B,OAAS,aAAAC,MAAiB,cAC1B,OAAS,qBAAAC,MAAyB,uBAU3B,MAAMC,EAAN,MAAMA,UAA2BJ,CAAU,CAsBhD,YAAYK,EAAoB,CAC9B,MAAM,EAZR,KAAgB,QAAkB,YAchC,MAAMC,EAAMV,EAAI,aAAaS,CAAQ,EAC/BE,EAAYD,EAAI,aAAa,EAAE,OACrC,GAAIC,IAAcH,EAAmB,QAAUG,IAA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,MAAMC,EAAMV,EAAI,aAAaS,CAAQ,EAC/ByB,EAAkBxB,EAAI,aAAa,EAAE,OAC3C,GAAIwB,IAAoBD,EAAmB,OACzC,MAAM,IAAI,MAAM,8BAA8BA,EAAmB,MAAM,cAAcC,CAAe,EAAE,EAExG,MAAMlB,EAAYlB,EAAK,UAAU,YAAYY,EAAI,aAAa,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAChG,KAAK,KAAOV,EAAI,aAAagB,CAAS,CACxC,CASA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CASA,UAAmB,CACjB,OAAO,KAAK,KAAK,SAAS,CAC5B,CAUA,UAAUH,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CAUA,OAAO,YAAYO,EAAgD,CACjE,MAAMV,EAAMU,EAAa,iBAAiB,EAC1C,OAAO,IAAIa,EAAmBvB,CAAG,CACnC,CACF,EAjFauB,EAMK,OAAS,GANpB,IAAMN,EAANM","names":["sha3_256","p256","Serializer","Hex","PrivateKeyVariants","AuthenticationKeyScheme","AnyPublicKeyVariant","PublicKey","PrivateKey","Signature","AuthenticationKey","_Secp256r1PublicKey","hexInput","hex","keyLength","point","serializer","args","message","signature","msgHex","sha3Message","rawSignature","deserializer","bytes","publicKey","Secp256r1PublicKey","_Secp256r1PrivateKey","strict","privateKeyHex","Secp256r1Signature","Secp256r1PrivateKey","WebAuthnSignature","authenticatorData","clientDataJSON","id","_Secp256r1Signature","signatureLength"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a}from"../../chunk-WCMW2L3P.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Signature};
|
|
2
2
|
//# sourceMappingURL=signature.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{F as a,G as b}from"../../chunk-PGUSBALH.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-V74WPKSY.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-O26BHE5H.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-I7XT6L7S.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-2PASUPUO.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ZP4DWSQA.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-ADJMFL73.mjs";import"../../chunk-TT3MPSBB.mjs";import"../../chunk-TSEAIF34.mjs";import"../../chunk-57YZ7I7V.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-DHCGYW3W.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-KB4XOTCR.mjs";import"../../chunk-3LJVXUPB.mjs";import"../../chunk-CZDNBI5K.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-7ZESTCBD.mjs";import"../../chunk-EMR3S3VO.mjs";import"../../chunk-OLILO7VD.mjs";import"../../chunk-GUPVZIYS.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as AnyPublicKey,b as AnySignature};
|
|
2
2
|
//# sourceMappingURL=singleKey.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/core/crypto/singleKey.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../../bcs\";\nimport {\n AnyPublicKeyVariant,\n AnySignatureVariant,\n SigningScheme as AuthenticationKeyScheme,\n HexInput,\n} from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, PublicKey } from \"./publicKey\";\nimport { Secp256k1PrivateKey, Secp256k1PublicKey, Secp256k1Signature } from \"./secp256k1\";\nimport { KeylessPublicKey, KeylessSignature } from \"./keyless\";\nimport { Signature } from \"./signature\";\nimport { FederatedKeylessPublicKey } from \"./federatedKeyless\";\nimport { AptosConfig } from \"../../api\";\nimport { Secp256r1PublicKey, WebAuthnSignature } from \"./secp256r1\";\n\nexport type PrivateKeyInput = Ed25519PrivateKey | Secp256k1PrivateKey;\n\n/**\n * Represents any public key supported by Aptos.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Any unified authentication key is represented in the SDK as `AnyPublicKey`.\n * @group Implementation\n * @category Serialization\n */\nexport class AnyPublicKey extends AccountPublicKey {\n /**\n * Reference to the inner public key\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKey: PublicKey;\n\n /**\n * Index of the underlying enum variant\n * @group Implementation\n * @category Serialization\n */\n public readonly variant: AnyPublicKeyVariant;\n\n // region Constructors\n\n /**\n * Creates an instance of the signature class based on the provided signature type.\n * This allows for the handling of different signature variants such as Ed25519, Secp256k1, and Keyless.\n *\n * @param publicKey - The publicKey object which determines the variant to be used.\n * @throws Error if the provided signature type is unsupported.\n * @group Implementation\n * @category Serialization\n */\n constructor(publicKey: PublicKey) {\n super();\n this.publicKey = publicKey;\n if (publicKey instanceof Ed25519PublicKey) {\n this.variant = AnyPublicKeyVariant.Ed25519;\n } else if (publicKey instanceof Secp256k1PublicKey) {\n this.variant = AnyPublicKeyVariant.Secp256k1;\n } else if (publicKey instanceof Secp256r1PublicKey) {\n this.variant = AnyPublicKeyVariant.Secp256r1;\n } else if (publicKey instanceof KeylessPublicKey) {\n this.variant = AnyPublicKeyVariant.Keyless;\n } else if (publicKey instanceof FederatedKeylessPublicKey) {\n this.variant = AnyPublicKeyVariant.FederatedKeyless;\n } else {\n throw new Error(\"Unsupported public key type\");\n }\n }\n\n // endregion\n\n // region AccountPublicKey\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of AnySignature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: AnySignature }): boolean {\n const { message, signature } = args;\n if (this.publicKey instanceof KeylessPublicKey) {\n throw new Error(\"Use verifySignatureAsync to verify Keyless signatures\");\n }\n return this.publicKey.verifySignature({\n message,\n signature: signature.signature,\n });\n }\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.aptosConfig - The configuration object for connecting to the Aptos network\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of AnySignature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: {\n aptosConfig: AptosConfig;\n message: HexInput;\n signature: Signature;\n options?: { throwErrorWithReason?: boolean };\n }): Promise<boolean> {\n if (!(args.signature instanceof AnySignature)) {\n if (args.options?.throwErrorWithReason) {\n throw new Error(\"Signature must be an instance of AnySignature\");\n }\n return false;\n }\n return await this.publicKey.verifySignatureAsync({\n ...args,\n signature: args.signature.signature,\n });\n }\n\n /**\n * Generates an authentication key from the current instance's byte representation.\n * This function is essential for creating a unique identifier for authentication purposes.\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.SingleKey,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * This function is a warning that it will soon return the underlying signature bytes directly.\n * Use AnySignature.bcsToBytes() instead.\n *\n * @returns Uint8Array representation of the signature.\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the current object using the provided serializer.\n * This function helps in converting the object 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.serializeU32AsUleb128(this.variant);\n this.publicKey.serialize(serializer);\n }\n\n /**\n * Deserializes an AnySignature from the provided deserializer.\n * This function helps in reconstructing the AnySignature object from its serialized form, allowing for further processing or validation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): AnyPublicKey {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let publicKey: PublicKey;\n switch (variantIndex) {\n case AnyPublicKeyVariant.Ed25519:\n publicKey = Ed25519PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Secp256k1:\n publicKey = Secp256k1PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Secp256r1:\n publicKey = Secp256r1PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Keyless:\n publicKey = KeylessPublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.FederatedKeyless:\n publicKey = FederatedKeylessPublicKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);\n }\n return new AnyPublicKey(publicKey);\n }\n // endregion\n\n /**\n * Determines if the provided public key is an instance of AnyPublicKey.\n *\n * @param publicKey - The public key to check.\n * @deprecated Use `instanceof AnyPublicKey` instead.\n * @group Implementation\n * @category Serialization\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey {\n return publicKey instanceof AnyPublicKey;\n }\n\n /**\n * Determines if the current public key is an instance of Ed25519PublicKey.\n *\n * @deprecated use `publicKey instanceof Ed25519PublicKey` instead.\n * @group Implementation\n * @category Serialization\n */\n isEd25519(): boolean {\n return this.publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * Checks if the public key is an instance of Secp256k1PublicKey.\n *\n * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.\n * @group Implementation\n * @category Serialization\n */\n isSecp256k1PublicKey(): boolean {\n return this.publicKey instanceof Secp256k1PublicKey;\n }\n\n /**\n * Determines if the provided publicKey is an instance of a valid PublicKey object.\n *\n * @param publicKey - The publicKey to be checked for validity.\n * @param publicKey.publicKey - The actual publicKey object that needs to be validated.\n * @returns True if the signature is a valid instance; otherwise, false.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is AnyPublicKey {\n return \"publicKey\" in publicKey && \"variant\" in publicKey;\n }\n}\n\n/**\n * Represents a signature that utilizes the SingleKey authentication scheme.\n * This class is designed to encapsulate various types of signatures, which can\n * only be generated by a `SingleKeySigner` due to the shared authentication mechanism.\n *\n * @extends Signature\n * @group Implementation\n * @category Serialization\n */\nexport class AnySignature extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n * @group Implementation\n * @category Serialization\n */\n private readonly variant: AnySignatureVariant;\n\n // region Constructors\n\n constructor(signature: Signature) {\n super();\n this.signature = signature;\n\n if (signature instanceof Ed25519Signature) {\n this.variant = AnySignatureVariant.Ed25519;\n } else if (signature instanceof Secp256k1Signature) {\n this.variant = AnySignatureVariant.Secp256k1;\n } else if (signature instanceof WebAuthnSignature) {\n this.variant = AnySignatureVariant.WebAuthn;\n } else if (signature instanceof KeylessSignature) {\n this.variant = AnySignatureVariant.Keyless;\n } else {\n throw new Error(\"Unsupported signature type\");\n }\n }\n\n // endregion\n\n // region AccountSignature\n\n toUint8Array(): Uint8Array {\n // TODO: keep this warning around for a bit, and eventually change this to return `this.signature.toUint8Array()`.\n // eslint-disable-next-line no-console\n console.warn(\n \"[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. \" +\n \"Use AnySignature.bcsToBytes() instead.\",\n );\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnySignature {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let signature: Signature;\n switch (variantIndex) {\n case AnySignatureVariant.Ed25519:\n signature = Ed25519Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Secp256k1:\n signature = Secp256k1Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.WebAuthn:\n signature = WebAuthnSignature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Keyless:\n signature = KeylessSignature.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);\n }\n return new AnySignature(signature);\n }\n\n // endregion\n\n static isInstance(signature: Signature): signature is AnySignature {\n return (\n \"signature\" in signature &&\n typeof signature.signature === \"object\" &&\n signature.signature !== null &&\n \"toUint8Array\" in signature.signature\n );\n }\n}\n"],"mappings":"AACA,OACE,uBAAAA,EACA,uBAAAC,EACA,iBAAiBC,MAEZ,cACP,OAAS,qBAAAC,MAAyB,uBAClC,OAA4B,oBAAAC,EAAkB,oBAAAC,MAAwB,YACtE,OAAS,oBAAAC,MAAmC,cAC5C,OAA8B,sBAAAC,EAAoB,sBAAAC,MAA0B,cAC5E,OAAS,oBAAAC,EAAkB,oBAAAC,MAAwB,YACnD,OAAS,aAAAC,MAAiB,cAC1B,OAAS,6BAAAC,MAAiC,qBAE1C,OAAS,sBAAAC,EAAoB,qBAAAC,MAAyB,cAc/C,MAAMC,UAAqBT,CAAiB,CA0BjD,YAAYU,EAAsB,CAGhC,GAFA,MAAM,EACN,KAAK,UAAYA,EACbA,aAAqBZ,EACvB,KAAK,QAAUJ,EAAoB,gBAC1BgB,aAAqBT,EAC9B,KAAK,QAAUP,EAAoB,kBAC1BgB,aAAqBH,EAC9B,KAAK,QAAUb,EAAoB,kBAC1BgB,aAAqBP,EAC9B,KAAK,QAAUT,EAAoB,gBAC1BgB,aAAqBJ,EAC9B,KAAK,QAAUZ,EAAoB,qBAEnC,OAAM,IAAI,MAAM,6BAA6B,CAEjD,CAiBA,gBAAgBiB,EAA+D,CAC7E,KAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,GAAI,KAAK,qBAAqBR,EAC5B,MA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K,qBAAqBG,CACnC,CAWA,OAAO,WAAWS,EAAiD,CACjE,MAAO,cAAeA,GAAa,YAAaA,CAClD,CACF,CAWO,MAAMI,UAAqBT,CAAU,CAY1C,YAAYQ,EAAsB,CAIhC,GAHA,MAAM,EACN,KAAK,UAAYA,EAEbA,aAAqBd,EACvB,KAAK,QAAUJ,EAAoB,gBAC1BkB,aAAqBX,EAC9B,KAAK,QAAUP,EAAoB,kBAC1BkB,aAAqBL,EAC9B,KAAK,QAAUb,EAAoB,iBAC1BkB,aAAqBT,EAC9B,KAAK,QAAUT,EAAoB,YAEnC,OAAM,IAAI,MAAM,4BAA4B,CAEhD,CAMA,cAA2B,CAGzB,eAAQ,KACN,0IAEF,EACO,KAAK,WAAW,CACzB,CAMA,UAAUoB,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,OAAO,EAC7C,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,YAAYC,EAA0C,CAC3D,MAAMC,EAAeD,EAAa,wBAAwB,EAC1D,IAAIH,EACJ,OAAQI,EAAc,CACpB,KAAKtB,EAAoB,QACvBkB,EAAYd,EAAiB,YAAYiB,CAAY,EACrD,MACF,KAAKrB,EAAoB,UACvBkB,EAAYX,EAAmB,YAAYc,CAAY,EACvD,MACF,KAAKrB,EAAoB,SACvBkB,EAAYL,EAAkB,YAAYQ,CAAY,EACtD,MACF,KAAKrB,EAAoB,QACvBkB,EAAYT,EAAiB,YAAYY,CAAY,EACrD,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAIH,EAAaD,CAAS,CACnC,CAIA,OAAO,WAAWA,EAAiD,CACjE,MACE,cAAeA,GACf,OAAOA,EAAU,WAAc,UAC/BA,EAAU,YAAc,MACxB,iBAAkBA,EAAU,SAEhC,CACF","names":["AnyPublicKeyVariant","AnySignatureVariant","AuthenticationKeyScheme","AuthenticationKey","Ed25519PublicKey","Ed25519Signature","AccountPublicKey","Secp256k1PublicKey","Secp256k1Signature","KeylessPublicKey","KeylessSignature","Signature","FederatedKeylessPublicKey","Secp256r1PublicKey","WebAuthnSignature","AnyPublicKey","publicKey","args","message","signature","AnySignature","serializer","deserializer","variantIndex"]}
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{M as a,N as b,O as c}from"../../chunk-PGUSBALH.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-V74WPKSY.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-O26BHE5H.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-I7XT6L7S.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-2PASUPUO.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ZP4DWSQA.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-ADJMFL73.mjs";import"../../chunk-TT3MPSBB.mjs";import"../../chunk-TSEAIF34.mjs";import"../../chunk-57YZ7I7V.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-DHCGYW3W.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-KB4XOTCR.mjs";import"../../chunk-3LJVXUPB.mjs";import"../../chunk-CZDNBI5K.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-7ZESTCBD.mjs";import"../../chunk-EMR3S3VO.mjs";import"../../chunk-OLILO7VD.mjs";import"../../chunk-GUPVZIYS.mjs";import"../../chunk-KDMSOCZY.mjs";export{b as accountPublicKeyToBaseAccountPublicKey,c as accountPublicKeyToSigningScheme,a as convertSigningMessage};
|
|
2
2
|
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/esm/core/hex.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a,b,c}from"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-KDMSOCZY.mjs";export{b as Hex,a as HexInvalidReason,c as hexToAsciiString};
|
|
2
2
|
//# sourceMappingURL=hex.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createObjectAddress, createResourceAddress, createTokenAddress
|
|
1
|
+
export { createObjectAddress, createResourceAddress, createTokenAddress } from './account/utils/address.mjs';
|
|
2
2
|
export { w as AbstractMultiKey, n as AccountAddress, m as AccountAddressInput, G as AccountPublicKey, l as AddressInvalidReason, N as AnyPublicKey, O as AnySignature, p as AuthenticationKey, r as Ed25519PrivateKey, E as Ed25519PublicKey, s as Ed25519Signature, R as Hex, Q as HexInvalidReason, t as MultiEd25519PublicKey, u as MultiEd25519Signature, x as MultiKey, y as MultiKeySignature, P as PrivateKey, L as PrivateKeyInput, C as PublicKey, I as Secp256k1PrivateKey, H as Secp256k1PublicKey, J as Secp256k1Signature, K as Signature, V as VerifySignatureArgs, z as VerifySignatureAsyncArgs, T as hexToAsciiString, q as isCanonicalEd25519Signature } from '../account-BortO8g2.mjs';
|
|
3
3
|
export { ParsingError, ParsingResult } from './common.mjs';
|
|
4
4
|
export { AbstractPublicKey, AbstractSignature } from './crypto/abstraction.mjs';
|
package/dist/esm/core/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{A as da,B as ea,C as fa,D as ga,E as ha,F as ma,G as na,H as oa,I as pa,J as qa,K as ra,L as sa,P as ta,Q as ua,R as va,S as wa,T as xa,U as ya,a as x,b as y,c as H,d as I,e as J,f as K,g as L,h as M,i as N,j as O,k as P,l as Q,m as R,n as S,o as T,p as U,q as V,r as W,s as X,t as Y,u as Z,v as _,w as $,x as aa,y as ba,z as ca}from"../chunk-PGUSBALH.mjs";import"../chunk-UYVPNUH3.mjs";import"../chunk-XKUIMGKU.mjs";import"../chunk-N6YTF76Q.mjs";import"../chunk-V74WPKSY.mjs";import"../chunk-G3MHXDYA.mjs";import"../chunk-O26BHE5H.mjs";import"../chunk-A5L76YP7.mjs";import{a as ia,b as ja,c as ka,d as la}from"../chunk-I7XT6L7S.mjs";import"../chunk-5HXLZHDW.mjs";import{a as z,b as A,c as B,d as C,e as D}from"../chunk-GOXRBEIJ.mjs";import{a as w}from"../chunk-2PASUPUO.mjs";import"../chunk-XJJVJOX5.mjs";import"../chunk-NECL5FCQ.mjs";import"../chunk-4QMXOWHP.mjs";import{a as k,b as l}from"../chunk-EF4FA5I6.mjs";import{a as j}from"../chunk-WCMW2L3P.mjs";import{a as h,b as i}from"../chunk-WSR5EBJM.mjs";import{a as m,b as n,c as o,d as p,e as q,f as r,g as s,h as t,i as u,j as v}from"../chunk-C3Q23D22.mjs";import"../chunk-ZP4DWSQA.mjs";import"../chunk-QREVMGQZ.mjs";import"../chunk-V3MBJJTL.mjs";import{a as g}from"../chunk-FGFLPH5K.mjs";import"../chunk-ADJMFL73.mjs";import"../chunk-TT3MPSBB.mjs";import"../chunk-TSEAIF34.mjs";import"../chunk-57YZ7I7V.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-DHCGYW3W.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-KB4XOTCR.mjs";import"../chunk-3LJVXUPB.mjs";import"../chunk-CZDNBI5K.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-7DQDJ2SA.mjs";import{a as E,b as F,c as G}from"../chunk-HNBVYE3N.mjs";import{a as e,b as f}from"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import{a as b,b as c,c as d}from"../chunk-STY74NUA.mjs";import{a}from"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-7ZESTCBD.mjs";import"../chunk-EMR3S3VO.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-GUPVZIYS.mjs";import"../chunk-KDMSOCZY.mjs";export{n as APTOS_BIP44_REGEX,m as APTOS_HARDENED_REGEX,oa as AbstractMultiKey,l as AbstractPublicKey,k as AbstractSignature,f as AccountAddress,i as AccountPublicKey,e as AddressInvalidReason,ma as AnyPublicKey,na as AnySignature,g as AuthenticationKey,t as CKDPriv,H as EPK_HORIZON_SECS,va as Ed25519PrivateKey,ua as Ed25519PublicKey,wa as Ed25519Signature,U as EphemeralCertificate,x as EphemeralPublicKey,y as EphemeralSignature,ea as FederatedKeylessPublicKey,W as Groth16ProofAndStatement,_ as Groth16VerificationKey,V as Groth16Zkp,p as HARDENED_OFFSET,c as Hex,b as HexInvalidReason,o as KeyType,Z as KeylessConfiguration,P as KeylessPublicKey,T as KeylessSignature,I as MAX_AUD_VAL_BYTES,O as MAX_COMMITED_EPK_BYTES,M as MAX_EXTRA_FIELD_BYTES,L as MAX_ISS_VAL_BYTES,N as MAX_JWT_HEADER_B64_BYTES,J as MAX_UID_KEY_BYTES,K as MAX_UID_VAL_BYTES,ca as MoveJWK,ra as MultiEd25519PublicKey,sa as MultiEd25519Signature,pa as MultiKey,qa as MultiKeySignature,a as ParsingError,w as PrivateKey,h as PublicKey,ga as Secp256k1PrivateKey,fa as Secp256k1PublicKey,ha as Secp256k1Signature,ja as Secp256r1PrivateKey,ia as Secp256r1PublicKey,la as Secp256r1Signature,j as Signature,ka as WebAuthnSignature,Y as ZeroKnowledgeSig,X as ZkProof,C as bigIntToBytesLE,B as bytesToBigIntLE,E as createObjectAddress,F as createResourceAddress,G as createTokenAddress,s as deriveKey,xa as deserializePublicKey,ya as deserializeSignature,S as fetchJWK,aa as getIssAudAndUidVal,$ as getKeylessConfig,ba as getKeylessJWKs,z as hashStrToField,d as hexToAsciiString,ta as isCanonicalEd25519Signature,q as isValidBIP44Path,r as isValidHardenedPath,v as mnemonicToSeed,A as padAndPackBytesWithLen,da as parseJwtHeader,D as poseidonHash,u as splitPath,Q as verifyKeylessSignature,R as verifyKeylessSignatureWithJwkAndConfig};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Message: ${o}`;return i&&(R+=`
|
|
3
|
-
Details: ${i}`),E instanceof S?R+=`
|
|
4
|
-
AptosApiError: ${E.message}`:E!==void 0&&(R+=`
|
|
5
|
-
Error: ${N(E)}`),R+=`
|
|
6
|
-
KeylessErrorResolutionTip: ${r}`,R}static fromErrorType(o){const{error:r,type:E,details:i}=o,[R,t,I]=a[E];return new T({message:R,details:i,innerError:r,category:t,resolutionTip:I,type:E})}}class S extends Error{constructor({apiType:o,aptosRequest:r,aptosResponse:E}){super(P({apiType:o,aptosRequest:r,aptosResponse:E})),this.name="AptosApiError",this.url=E.url,this.status=E.status,this.statusText=E.statusText,this.data=E.data,this.request=r}}function P({apiType:_,aptosRequest:o,aptosResponse:r}){const E=r.headers?.traceparent?.split("-")[1],i=E?`(trace_id:${E}) `:"",R=`Request to [${_}]: ${o.method} ${r.url??o.url} ${i}failed with`;return _===A.INDEXER&&r.data?.errors?.[0]?.message!=null?`${R}: ${r.data.errors[0].message}`:r.data?.message!=null&&r.data?.error_code!=null?`${R}: ${JSON.stringify(r.data)}`:`${R} status: ${r.statusText}(code:${r.status}) and response body: ${h(r.data)}`}const n=400;function h(_){const o=JSON.stringify(_);return o.length<=n?o:`truncated(original_size:${o.length}): ${o.slice(0,n/2)}...${o.slice(-n/2)}`}export{S as AptosApiError,T as KeylessError,l as KeylessErrorCategory,O as KeylessErrorResolutionTip,u as KeylessErrorType};
|
|
1
|
+
import{a,b,c,d,e}from"../chunk-6WDVDEQZ.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-KDMSOCZY.mjs";export{e as AptosApiError,d as KeylessError,a as KeylessErrorCategory,b as KeylessErrorResolutionTip,c as KeylessErrorType};
|
|
7
2
|
//# sourceMappingURL=index.mjs.map
|