@hiero-ledger/sdk 2.77.0 → 2.78.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/umd.js +592 -592
- package/dist/umd.min.js +2 -2
- package/lib/Cache.cjs +6 -6
- package/lib/Cache.d.ts +12 -12
- package/lib/Cache.js.map +1 -1
- package/lib/Duration.cjs +1 -1
- package/lib/Duration.d.ts +2 -2
- package/lib/Duration.js.map +1 -1
- package/lib/EntityIdHelper.cjs +1 -1
- package/lib/EntityIdHelper.js +1 -1
- package/lib/EntityIdHelper.js.map +1 -1
- package/lib/EthereumFlow.cjs +7 -7
- package/lib/EthereumFlow.d.ts +14 -14
- package/lib/EthereumFlow.js.map +1 -1
- package/lib/EthereumTransaction.cjs +7 -7
- package/lib/EthereumTransaction.d.ts +14 -14
- package/lib/EthereumTransaction.js.map +1 -1
- package/lib/EvmAddress.cjs +1 -1
- package/lib/EvmAddress.d.ts +2 -2
- package/lib/EvmAddress.js.map +1 -1
- package/lib/ExchangeRate.cjs +2 -2
- package/lib/ExchangeRate.d.ts +4 -4
- package/lib/ExchangeRate.js.map +1 -1
- package/lib/ExchangeRates.cjs +1 -1
- package/lib/ExchangeRates.d.ts +1 -1
- package/lib/ExchangeRates.js +1 -1
- package/lib/ExchangeRates.js.map +1 -1
- package/lib/FeeComponents.cjs +1 -1
- package/lib/FeeComponents.d.ts +1 -1
- package/lib/FeeComponents.js +1 -1
- package/lib/FeeComponents.js.map +1 -1
- package/lib/FeeData.cjs +1 -1
- package/lib/FeeData.d.ts +1 -1
- package/lib/FeeData.js +1 -1
- package/lib/FeeData.js.map +1 -1
- package/lib/FeeDataType.cjs +1 -1
- package/lib/FeeDataType.d.ts +2 -2
- package/lib/FeeDataType.js.map +1 -1
- package/lib/FeeSchedule.cjs +1 -1
- package/lib/FeeSchedule.d.ts +1 -1
- package/lib/FeeSchedule.js +1 -1
- package/lib/FeeSchedule.js.map +1 -1
- package/lib/FeeSchedules.cjs +1 -1
- package/lib/FeeSchedules.d.ts +1 -1
- package/lib/FeeSchedules.js +1 -1
- package/lib/FeeSchedules.js.map +1 -1
- package/lib/FreezeType.cjs +1 -1
- package/lib/FreezeType.d.ts +2 -2
- package/lib/FreezeType.js.map +1 -1
- package/lib/Key.cjs +1 -1
- package/lib/Key.d.ts +2 -2
- package/lib/Key.js.map +1 -1
- package/lib/KeyList.cjs +3 -3
- package/lib/KeyList.d.ts +6 -6
- package/lib/KeyList.js.map +1 -1
- package/lib/Mnemonic.cjs +1 -1
- package/lib/Mnemonic.d.ts +1 -1
- package/lib/Mnemonic.js +1 -1
- package/lib/Mnemonic.js.map +1 -1
- package/lib/PrivateKey.cjs +7 -7
- package/lib/PrivateKey.d.ts +11 -11
- package/lib/PrivateKey.js +1 -1
- package/lib/PrivateKey.js.map +1 -1
- package/lib/PrngTransaction.cjs +9 -9
- package/lib/PrngTransaction.d.ts +18 -18
- package/lib/PrngTransaction.js.map +1 -1
- package/lib/PublicKey.cjs +5 -5
- package/lib/PublicKey.d.ts +9 -9
- package/lib/PublicKey.js +1 -1
- package/lib/PublicKey.js.map +1 -1
- package/lib/RequestType.cjs +1 -1
- package/lib/RequestType.d.ts +2 -2
- package/lib/RequestType.js.map +1 -1
- package/lib/StakingInfo.cjs +1 -1
- package/lib/StakingInfo.d.ts +1 -1
- package/lib/StakingInfo.js +1 -1
- package/lib/StakingInfo.js.map +1 -1
- package/lib/Status.cjs +1 -1
- package/lib/Status.d.ts +2 -2
- package/lib/Status.js.map +1 -1
- package/lib/Timestamp.cjs +1 -1
- package/lib/Timestamp.d.ts +1 -1
- package/lib/Timestamp.js.map +1 -1
- package/lib/TransactionFeeSchedule.cjs +1 -1
- package/lib/TransactionFeeSchedule.d.ts +1 -1
- package/lib/TransactionFeeSchedule.js +1 -1
- package/lib/TransactionFeeSchedule.js.map +1 -1
- package/lib/Transfer.cjs +2 -2
- package/lib/Transfer.d.ts +4 -4
- package/lib/Transfer.js.map +1 -1
- package/lib/account/AccountAllowanceAdjustTransaction.cjs +7 -7
- package/lib/account/AccountAllowanceAdjustTransaction.d.ts +14 -14
- package/lib/account/AccountAllowanceAdjustTransaction.js.map +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.cjs +8 -8
- package/lib/account/AccountAllowanceApproveTransaction.d.ts +16 -16
- package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -1
- package/lib/account/AccountAllowanceDeleteTransaction.cjs +7 -7
- package/lib/account/AccountAllowanceDeleteTransaction.d.ts +14 -14
- package/lib/account/AccountAllowanceDeleteTransaction.js.map +1 -1
- package/lib/account/AccountBalance.cjs +1 -1
- package/lib/account/AccountBalance.d.ts +1 -1
- package/lib/account/AccountBalance.js +1 -1
- package/lib/account/AccountBalance.js.map +1 -1
- package/lib/account/AccountBalanceQuery.cjs +6 -6
- package/lib/account/AccountBalanceQuery.d.ts +12 -12
- package/lib/account/AccountBalanceQuery.js.map +1 -1
- package/lib/account/AccountCreateTransaction.cjs +1 -1
- package/lib/account/AccountCreateTransaction.d.ts +1 -1
- package/lib/account/AccountCreateTransaction.js +1 -1
- package/lib/account/AccountCreateTransaction.js.map +1 -1
- package/lib/account/AccountDeleteTransaction.cjs +7 -7
- package/lib/account/AccountDeleteTransaction.d.ts +14 -14
- package/lib/account/AccountDeleteTransaction.js.map +1 -1
- package/lib/account/AccountId.cjs +1 -1
- package/lib/account/AccountId.d.ts +1 -1
- package/lib/account/AccountId.js +1 -1
- package/lib/account/AccountId.js.map +1 -1
- package/lib/account/AccountInfo.cjs +1 -1
- package/lib/account/AccountInfo.d.ts +1 -1
- package/lib/account/AccountInfo.js +1 -1
- package/lib/account/AccountInfo.js.map +1 -1
- package/lib/account/AccountInfoQuery.cjs +7 -7
- package/lib/account/AccountInfoQuery.d.ts +14 -14
- package/lib/account/AccountInfoQuery.js.map +1 -1
- package/lib/account/AccountRecordsQuery.cjs +7 -7
- package/lib/account/AccountRecordsQuery.d.ts +14 -14
- package/lib/account/AccountRecordsQuery.js.map +1 -1
- package/lib/account/AccountUpdateTransaction.cjs +7 -7
- package/lib/account/AccountUpdateTransaction.d.ts +14 -14
- package/lib/account/AccountUpdateTransaction.js.map +1 -1
- package/lib/account/HbarAllowance.cjs +3 -3
- package/lib/account/HbarAllowance.d.ts +6 -6
- package/lib/account/HbarAllowance.js.map +1 -1
- package/lib/account/HbarTransferMap.cjs +2 -2
- package/lib/account/HbarTransferMap.d.ts +4 -4
- package/lib/account/HbarTransferMap.js.map +1 -1
- package/lib/account/LiveHash.cjs +3 -3
- package/lib/account/LiveHash.d.ts +6 -6
- package/lib/account/LiveHash.js.map +1 -1
- package/lib/account/LiveHashAddTransaction.cjs +7 -7
- package/lib/account/LiveHashAddTransaction.d.ts +14 -14
- package/lib/account/LiveHashAddTransaction.js.map +1 -1
- package/lib/account/LiveHashDeleteTransaction.cjs +6 -6
- package/lib/account/LiveHashDeleteTransaction.d.ts +12 -12
- package/lib/account/LiveHashDeleteTransaction.js.map +1 -1
- package/lib/account/LiveHashQuery.cjs +7 -7
- package/lib/account/LiveHashQuery.d.ts +14 -14
- package/lib/account/LiveHashQuery.js.map +1 -1
- package/lib/account/NullableTokenDecimalMap.cjs +2 -2
- package/lib/account/NullableTokenDecimalMap.d.ts +4 -4
- package/lib/account/NullableTokenDecimalMap.js.map +1 -1
- package/lib/account/ProxyStaker.cjs +2 -2
- package/lib/account/ProxyStaker.d.ts +4 -4
- package/lib/account/ProxyStaker.js.map +1 -1
- package/lib/account/TokenAllowance.cjs +4 -4
- package/lib/account/TokenAllowance.d.ts +8 -8
- package/lib/account/TokenAllowance.js.map +1 -1
- package/lib/account/TokenBalanceMap.cjs +2 -2
- package/lib/account/TokenBalanceMap.d.ts +4 -4
- package/lib/account/TokenBalanceMap.js.map +1 -1
- package/lib/account/TokenDecimalMap.cjs +2 -2
- package/lib/account/TokenDecimalMap.d.ts +4 -4
- package/lib/account/TokenDecimalMap.js.map +1 -1
- package/lib/account/TokenNftAllowance.cjs +5 -5
- package/lib/account/TokenNftAllowance.d.ts +10 -10
- package/lib/account/TokenNftAllowance.js.map +1 -1
- package/lib/account/TokenNftTransferMap.cjs +5 -5
- package/lib/account/TokenNftTransferMap.d.ts +10 -10
- package/lib/account/TokenNftTransferMap.js.map +1 -1
- package/lib/account/TokenRelationship.cjs +4 -4
- package/lib/account/TokenRelationship.d.ts +8 -8
- package/lib/account/TokenRelationship.js.map +1 -1
- package/lib/account/TokenRelationshipMap.cjs +2 -2
- package/lib/account/TokenRelationshipMap.d.ts +4 -4
- package/lib/account/TokenRelationshipMap.js.map +1 -1
- package/lib/account/TokenTransferMap.cjs +4 -4
- package/lib/account/TokenTransferMap.d.ts +8 -8
- package/lib/account/TokenTransferMap.js.map +1 -1
- package/lib/account/TransferTransaction.cjs +6 -6
- package/lib/account/TransferTransaction.d.ts +12 -12
- package/lib/account/TransferTransaction.js.map +1 -1
- package/lib/address_book/AddressBooks.cjs +1 -1
- package/lib/address_book/AddressBooks.js +1 -1
- package/lib/address_book/AddressBooks.js.map +1 -1
- package/lib/address_book/Endpoint.cjs +1 -1
- package/lib/address_book/Endpoint.d.ts +2 -2
- package/lib/address_book/Endpoint.js.map +1 -1
- package/lib/address_book/NodeAddress.cjs +1 -1
- package/lib/address_book/NodeAddress.d.ts +2 -2
- package/lib/address_book/NodeAddress.js.map +1 -1
- package/lib/address_book/NodeAddressBook.cjs +1 -1
- package/lib/address_book/NodeAddressBook.d.ts +1 -1
- package/lib/address_book/NodeAddressBook.js +1 -1
- package/lib/address_book/NodeAddressBook.js.map +1 -1
- package/lib/browser.js +1 -1
- package/lib/channel/Channel.cjs +1 -1
- package/lib/channel/Channel.d.ts +1 -1
- package/lib/channel/Channel.js +1 -1
- package/lib/channel/Channel.js.map +1 -1
- package/lib/contract/ContractByteCodeQuery.cjs +6 -6
- package/lib/contract/ContractByteCodeQuery.d.ts +12 -12
- package/lib/contract/ContractByteCodeQuery.js.map +1 -1
- package/lib/contract/ContractCallQuery.cjs +1 -1
- package/lib/contract/ContractCallQuery.d.ts +1 -1
- package/lib/contract/ContractCallQuery.js +1 -1
- package/lib/contract/ContractCallQuery.js.map +1 -1
- package/lib/contract/ContractCreateTransaction.cjs +8 -8
- package/lib/contract/ContractCreateTransaction.d.ts +16 -16
- package/lib/contract/ContractCreateTransaction.js.map +1 -1
- package/lib/contract/ContractDeleteTransaction.cjs +8 -8
- package/lib/contract/ContractDeleteTransaction.d.ts +16 -16
- package/lib/contract/ContractDeleteTransaction.js.map +1 -1
- package/lib/contract/ContractExecuteTransaction.cjs +9 -9
- package/lib/contract/ContractExecuteTransaction.d.ts +18 -18
- package/lib/contract/ContractExecuteTransaction.js.map +1 -1
- package/lib/contract/ContractFunctionResult.cjs +2 -2
- package/lib/contract/ContractFunctionResult.d.ts +4 -4
- package/lib/contract/ContractFunctionResult.js.map +1 -1
- package/lib/contract/ContractId.cjs +1 -1
- package/lib/contract/ContractId.d.ts +1 -1
- package/lib/contract/ContractId.js +1 -1
- package/lib/contract/ContractId.js.map +1 -1
- package/lib/contract/ContractInfo.cjs +1 -1
- package/lib/contract/ContractInfo.d.ts +1 -1
- package/lib/contract/ContractInfo.js +1 -1
- package/lib/contract/ContractInfo.js.map +1 -1
- package/lib/contract/ContractInfoQuery.cjs +7 -7
- package/lib/contract/ContractInfoQuery.d.ts +14 -14
- package/lib/contract/ContractInfoQuery.js.map +1 -1
- package/lib/contract/ContractLogInfo.cjs +2 -2
- package/lib/contract/ContractLogInfo.d.ts +4 -4
- package/lib/contract/ContractLogInfo.js.map +1 -1
- package/lib/contract/ContractNonceInfo.cjs +3 -3
- package/lib/contract/ContractNonceInfo.d.ts +4 -4
- package/lib/contract/ContractNonceInfo.js +1 -1
- package/lib/contract/ContractNonceInfo.js.map +1 -1
- package/lib/contract/ContractStateChange.cjs +1 -1
- package/lib/contract/ContractStateChange.d.ts +1 -1
- package/lib/contract/ContractUpdateTransaction.cjs +10 -10
- package/lib/contract/ContractUpdateTransaction.d.ts +18 -18
- package/lib/contract/ContractUpdateTransaction.js +1 -1
- package/lib/contract/ContractUpdateTransaction.js.map +1 -1
- package/lib/contract/DelegateContractId.cjs +2 -2
- package/lib/contract/DelegateContractId.d.ts +4 -4
- package/lib/contract/DelegateContractId.js.map +1 -1
- package/lib/contract/StorageChange.cjs +1 -1
- package/lib/contract/StorageChange.d.ts +1 -1
- package/lib/exports.cjs +1 -1
- package/lib/exports.d.ts +1 -1
- package/lib/exports.js +1 -1
- package/lib/exports.js.map +1 -1
- package/lib/file/FileAppendTransaction.cjs +7 -7
- package/lib/file/FileAppendTransaction.d.ts +14 -14
- package/lib/file/FileAppendTransaction.js.map +1 -1
- package/lib/file/FileContentsQuery.cjs +7 -7
- package/lib/file/FileContentsQuery.d.ts +14 -14
- package/lib/file/FileContentsQuery.js.map +1 -1
- package/lib/file/FileCreateTransaction.cjs +6 -6
- package/lib/file/FileCreateTransaction.d.ts +12 -12
- package/lib/file/FileCreateTransaction.js.map +1 -1
- package/lib/file/FileDeleteTransaction.cjs +7 -7
- package/lib/file/FileDeleteTransaction.d.ts +14 -14
- package/lib/file/FileDeleteTransaction.js.map +1 -1
- package/lib/file/FileId.cjs +1 -1
- package/lib/file/FileId.d.ts +1 -1
- package/lib/file/FileId.js +1 -1
- package/lib/file/FileId.js.map +1 -1
- package/lib/file/FileInfo.cjs +1 -1
- package/lib/file/FileInfo.d.ts +1 -1
- package/lib/file/FileInfo.js +1 -1
- package/lib/file/FileInfo.js.map +1 -1
- package/lib/file/FileInfoQuery.cjs +7 -7
- package/lib/file/FileInfoQuery.d.ts +14 -14
- package/lib/file/FileInfoQuery.js.map +1 -1
- package/lib/file/FileUpdateTransaction.cjs +6 -6
- package/lib/file/FileUpdateTransaction.d.ts +12 -12
- package/lib/file/FileUpdateTransaction.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/native.js +1 -1
- package/lib/network/AddressBookQuery.cjs +1 -1
- package/lib/network/AddressBookQuery.js +1 -1
- package/lib/network/AddressBookQuery.js.map +1 -1
- package/lib/network/NetworkVersionInfo.cjs +1 -1
- package/lib/network/NetworkVersionInfo.d.ts +1 -1
- package/lib/network/NetworkVersionInfo.js +1 -1
- package/lib/network/NetworkVersionInfo.js.map +1 -1
- package/lib/network/NetworkVersionInfoQuery.cjs +6 -6
- package/lib/network/NetworkVersionInfoQuery.d.ts +12 -12
- package/lib/network/NetworkVersionInfoQuery.js.map +1 -1
- package/lib/network/SemanticVersion.cjs +1 -1
- package/lib/network/SemanticVersion.d.ts +1 -1
- package/lib/network/SemanticVersion.js +1 -1
- package/lib/network/SemanticVersion.js.map +1 -1
- package/lib/node/NodeCreateTransaction.cjs +6 -6
- package/lib/node/NodeCreateTransaction.d.ts +12 -12
- package/lib/node/NodeCreateTransaction.js.map +1 -1
- package/lib/node/NodeDeleteTransaction.cjs +6 -6
- package/lib/node/NodeDeleteTransaction.d.ts +12 -12
- package/lib/node/NodeDeleteTransaction.js.map +1 -1
- package/lib/node/NodeUpdateTransaction.cjs +6 -6
- package/lib/node/NodeUpdateTransaction.d.ts +12 -12
- package/lib/node/NodeUpdateTransaction.js.map +1 -1
- package/lib/node/ServiceEndpoint.cjs +1 -1
- package/lib/node/ServiceEndpoint.d.ts +2 -2
- package/lib/node/ServiceEndpoint.js.map +1 -1
- package/lib/query/CostQuery.cjs +1 -1
- package/lib/query/CostQuery.d.ts +1 -1
- package/lib/query/CostQuery.js +1 -1
- package/lib/query/CostQuery.js.map +1 -1
- package/lib/query/Query.cjs +1 -1
- package/lib/query/Query.d.ts +1 -1
- package/lib/query/Query.js +1 -1
- package/lib/query/Query.js.map +1 -1
- package/lib/query/QueryBase.cjs +1 -1
- package/lib/query/QueryBase.d.ts +1 -1
- package/lib/query/QueryBase.js +1 -1
- package/lib/query/QueryBase.js.map +1 -1
- package/lib/schedule/ScheduleCreateTransaction.cjs +1 -1
- package/lib/schedule/ScheduleCreateTransaction.d.ts +1 -1
- package/lib/schedule/ScheduleCreateTransaction.js +1 -1
- package/lib/schedule/ScheduleCreateTransaction.js.map +1 -1
- package/lib/schedule/ScheduleDeleteTransaction.cjs +8 -8
- package/lib/schedule/ScheduleDeleteTransaction.d.ts +16 -16
- package/lib/schedule/ScheduleDeleteTransaction.js.map +1 -1
- package/lib/schedule/ScheduleId.cjs +1 -1
- package/lib/schedule/ScheduleId.d.ts +1 -1
- package/lib/schedule/ScheduleId.js +1 -1
- package/lib/schedule/ScheduleId.js.map +1 -1
- package/lib/schedule/ScheduleInfo.cjs +1 -1
- package/lib/schedule/ScheduleInfo.d.ts +1 -1
- package/lib/schedule/ScheduleInfo.js +1 -1
- package/lib/schedule/ScheduleInfo.js.map +1 -1
- package/lib/schedule/ScheduleInfoQuery.cjs +7 -7
- package/lib/schedule/ScheduleInfoQuery.d.ts +14 -14
- package/lib/schedule/ScheduleInfoQuery.js.map +1 -1
- package/lib/schedule/ScheduleSignTransaction.cjs +10 -10
- package/lib/schedule/ScheduleSignTransaction.d.ts +20 -20
- package/lib/schedule/ScheduleSignTransaction.js.map +1 -1
- package/lib/system/FreezeTransaction.cjs +6 -6
- package/lib/system/FreezeTransaction.d.ts +12 -12
- package/lib/system/FreezeTransaction.js.map +1 -1
- package/lib/system/SystemDeleteTransaction.cjs +8 -8
- package/lib/system/SystemDeleteTransaction.d.ts +16 -16
- package/lib/system/SystemDeleteTransaction.js.map +1 -1
- package/lib/system/SystemUndeleteTransaction.cjs +8 -8
- package/lib/system/SystemUndeleteTransaction.d.ts +16 -16
- package/lib/system/SystemUndeleteTransaction.js.map +1 -1
- package/lib/token/AbstractTokenTransferTransaction.cjs +1 -1
- package/lib/token/AbstractTokenTransferTransaction.d.ts +2 -2
- package/lib/token/AbstractTokenTransferTransaction.js.map +1 -1
- package/lib/token/AssessedCustomFee.cjs +1 -1
- package/lib/token/AssessedCustomFee.d.ts +2 -2
- package/lib/token/AssessedCustomFee.js.map +1 -1
- package/lib/token/CustomFee.cjs +1 -1
- package/lib/token/CustomFee.d.ts +2 -2
- package/lib/token/CustomFee.js.map +1 -1
- package/lib/token/CustomFixedFee.cjs +3 -3
- package/lib/token/CustomFixedFee.d.ts +6 -6
- package/lib/token/CustomFixedFee.js.map +1 -1
- package/lib/token/CustomFractionalFee.cjs +3 -3
- package/lib/token/CustomFractionalFee.d.ts +6 -6
- package/lib/token/CustomFractionalFee.js.map +1 -1
- package/lib/token/CustomRoyaltyFee.cjs +4 -4
- package/lib/token/CustomRoyaltyFee.d.ts +8 -8
- package/lib/token/CustomRoyaltyFee.js.map +1 -1
- package/lib/token/NftId.cjs +1 -1
- package/lib/token/NftId.d.ts +1 -1
- package/lib/token/NftId.js +1 -1
- package/lib/token/NftId.js.map +1 -1
- package/lib/token/PendingAirdropId.cjs +1 -1
- package/lib/token/PendingAirdropId.d.ts +1 -1
- package/lib/token/PendingAirdropId.js.map +1 -1
- package/lib/token/PendingAirdropRecord.cjs +1 -1
- package/lib/token/PendingAirdropRecord.d.ts +1 -1
- package/lib/token/PendingAirdropRecord.js.map +1 -1
- package/lib/token/TokenAirdropTransaction.cjs +8 -8
- package/lib/token/TokenAirdropTransaction.d.ts +16 -16
- package/lib/token/TokenAirdropTransaction.js.map +1 -1
- package/lib/token/TokenAssociateTransaction.cjs +7 -7
- package/lib/token/TokenAssociateTransaction.d.ts +14 -14
- package/lib/token/TokenAssociateTransaction.js.map +1 -1
- package/lib/token/TokenAssociation.cjs +1 -1
- package/lib/token/TokenAssociation.d.ts +2 -2
- package/lib/token/TokenAssociation.js.map +1 -1
- package/lib/token/TokenBurnTransaction.cjs +7 -7
- package/lib/token/TokenBurnTransaction.d.ts +14 -14
- package/lib/token/TokenBurnTransaction.js.map +1 -1
- package/lib/token/TokenCancelAirdropTransaction.cjs +6 -6
- package/lib/token/TokenCancelAirdropTransaction.d.ts +12 -12
- package/lib/token/TokenCancelAirdropTransaction.js.map +1 -1
- package/lib/token/TokenClaimAirdropTransaction.cjs +6 -6
- package/lib/token/TokenClaimAirdropTransaction.d.ts +12 -12
- package/lib/token/TokenClaimAirdropTransaction.js.map +1 -1
- package/lib/token/TokenCreateTransaction.cjs +7 -7
- package/lib/token/TokenCreateTransaction.d.ts +14 -14
- package/lib/token/TokenCreateTransaction.js.map +1 -1
- package/lib/token/TokenDeleteTransaction.cjs +7 -7
- package/lib/token/TokenDeleteTransaction.d.ts +14 -14
- package/lib/token/TokenDeleteTransaction.js.map +1 -1
- package/lib/token/TokenDissociateTransaction.cjs +7 -7
- package/lib/token/TokenDissociateTransaction.d.ts +14 -14
- package/lib/token/TokenDissociateTransaction.js.map +1 -1
- package/lib/token/TokenFeeScheduleUpdateTransaction.cjs +7 -7
- package/lib/token/TokenFeeScheduleUpdateTransaction.d.ts +14 -14
- package/lib/token/TokenFeeScheduleUpdateTransaction.js.map +1 -1
- package/lib/token/TokenFreezeTransaction.cjs +7 -7
- package/lib/token/TokenFreezeTransaction.d.ts +14 -14
- package/lib/token/TokenFreezeTransaction.js.map +1 -1
- package/lib/token/TokenGrantKycTransaction.cjs +7 -7
- package/lib/token/TokenGrantKycTransaction.d.ts +14 -14
- package/lib/token/TokenGrantKycTransaction.js.map +1 -1
- package/lib/token/TokenId.cjs +1 -1
- package/lib/token/TokenId.d.ts +1 -1
- package/lib/token/TokenId.js +1 -1
- package/lib/token/TokenId.js.map +1 -1
- package/lib/token/TokenInfo.cjs +1 -1
- package/lib/token/TokenInfo.d.ts +1 -1
- package/lib/token/TokenInfo.js +1 -1
- package/lib/token/TokenInfo.js.map +1 -1
- package/lib/token/TokenInfoQuery.cjs +7 -7
- package/lib/token/TokenInfoQuery.d.ts +14 -14
- package/lib/token/TokenInfoQuery.js.map +1 -1
- package/lib/token/TokenKeyValidation.cjs +1 -1
- package/lib/token/TokenKeyValidation.d.ts +2 -2
- package/lib/token/TokenKeyValidation.js.map +1 -1
- package/lib/token/TokenMintTransaction.cjs +7 -7
- package/lib/token/TokenMintTransaction.d.ts +14 -14
- package/lib/token/TokenMintTransaction.js.map +1 -1
- package/lib/token/TokenNftInfo.cjs +10 -10
- package/lib/token/TokenNftInfo.d.ts +20 -20
- package/lib/token/TokenNftInfo.js.map +1 -1
- package/lib/token/TokenNftInfoQuery.cjs +11 -11
- package/lib/token/TokenNftInfoQuery.d.ts +22 -22
- package/lib/token/TokenNftInfoQuery.js.map +1 -1
- package/lib/token/TokenNftTransfer.cjs +5 -5
- package/lib/token/TokenNftTransfer.d.ts +10 -10
- package/lib/token/TokenNftTransfer.js.map +1 -1
- package/lib/token/TokenNftsUpdateTransaction.cjs +7 -7
- package/lib/token/TokenNftsUpdateTransaction.d.ts +14 -14
- package/lib/token/TokenPauseTransaction.cjs +7 -7
- package/lib/token/TokenPauseTransaction.d.ts +14 -14
- package/lib/token/TokenPauseTransaction.js.map +1 -1
- package/lib/token/TokenReference.cjs +1 -1
- package/lib/token/TokenReference.d.ts +2 -2
- package/lib/token/TokenReference.js.map +1 -1
- package/lib/token/TokenRejectTransaction.cjs +7 -7
- package/lib/token/TokenRejectTransaction.d.ts +14 -14
- package/lib/token/TokenRejectTransaction.js.map +1 -1
- package/lib/token/TokenRevokeKycTransaction.cjs +7 -7
- package/lib/token/TokenRevokeKycTransaction.d.ts +14 -14
- package/lib/token/TokenRevokeKycTransaction.js.map +1 -1
- package/lib/token/TokenSupplyType.cjs +1 -1
- package/lib/token/TokenSupplyType.d.ts +2 -2
- package/lib/token/TokenSupplyType.js.map +1 -1
- package/lib/token/TokenTransfer.cjs +4 -4
- package/lib/token/TokenTransfer.d.ts +8 -8
- package/lib/token/TokenTransfer.js.map +1 -1
- package/lib/token/TokenType.cjs +1 -1
- package/lib/token/TokenType.d.ts +2 -2
- package/lib/token/TokenType.js.map +1 -1
- package/lib/token/TokenUnfreezeTransaction.cjs +7 -7
- package/lib/token/TokenUnfreezeTransaction.d.ts +14 -14
- package/lib/token/TokenUnfreezeTransaction.js.map +1 -1
- package/lib/token/TokenUnpauseTransaction.cjs +7 -7
- package/lib/token/TokenUnpauseTransaction.d.ts +14 -14
- package/lib/token/TokenUnpauseTransaction.js.map +1 -1
- package/lib/token/TokenUpdateNftsTransaction.cjs +7 -7
- package/lib/token/TokenUpdateNftsTransaction.d.ts +14 -14
- package/lib/token/TokenUpdateNftsTransaction.js.map +1 -1
- package/lib/token/TokenUpdateTransaction.cjs +7 -7
- package/lib/token/TokenUpdateTransaction.d.ts +14 -14
- package/lib/token/TokenUpdateTransaction.js.map +1 -1
- package/lib/token/TokenWipeTransaction.cjs +7 -7
- package/lib/token/TokenWipeTransaction.d.ts +14 -14
- package/lib/token/TokenWipeTransaction.js.map +1 -1
- package/lib/topic/TopicCreateTransaction.cjs +6 -6
- package/lib/topic/TopicCreateTransaction.d.ts +12 -12
- package/lib/topic/TopicCreateTransaction.js.map +1 -1
- package/lib/topic/TopicDeleteTransaction.cjs +6 -6
- package/lib/topic/TopicDeleteTransaction.d.ts +12 -12
- package/lib/topic/TopicDeleteTransaction.js.map +1 -1
- package/lib/topic/TopicId.cjs +1 -1
- package/lib/topic/TopicId.d.ts +1 -1
- package/lib/topic/TopicId.js +1 -1
- package/lib/topic/TopicId.js.map +1 -1
- package/lib/topic/TopicInfo.cjs +1 -1
- package/lib/topic/TopicInfo.d.ts +1 -1
- package/lib/topic/TopicInfo.js +1 -1
- package/lib/topic/TopicInfo.js.map +1 -1
- package/lib/topic/TopicInfoQuery.cjs +7 -7
- package/lib/topic/TopicInfoQuery.d.ts +14 -14
- package/lib/topic/TopicInfoQuery.js.map +1 -1
- package/lib/topic/TopicMessage.cjs +2 -2
- package/lib/topic/TopicMessage.d.ts +4 -4
- package/lib/topic/TopicMessage.js.map +1 -1
- package/lib/topic/TopicMessageChunk.cjs +2 -2
- package/lib/topic/TopicMessageChunk.d.ts +4 -4
- package/lib/topic/TopicMessageChunk.js.map +1 -1
- package/lib/topic/TopicMessageQuery.cjs +1 -1
- package/lib/topic/TopicMessageQuery.js +1 -1
- package/lib/topic/TopicMessageQuery.js.map +1 -1
- package/lib/topic/TopicMessageSubmitTransaction.cjs +9 -9
- package/lib/topic/TopicMessageSubmitTransaction.d.ts +18 -18
- package/lib/topic/TopicMessageSubmitTransaction.js.map +1 -1
- package/lib/topic/TopicUpdateTransaction.cjs +6 -6
- package/lib/topic/TopicUpdateTransaction.d.ts +12 -12
- package/lib/topic/TopicUpdateTransaction.js.map +1 -1
- package/lib/transaction/BatchTransaction.cjs +5 -5
- package/lib/transaction/BatchTransaction.d.ts +9 -9
- package/lib/transaction/BatchTransaction.js +1 -1
- package/lib/transaction/BatchTransaction.js.map +1 -1
- package/lib/transaction/CustomFeeLimit.cjs +2 -2
- package/lib/transaction/CustomFeeLimit.d.ts +4 -4
- package/lib/transaction/CustomFeeLimit.js.map +1 -1
- package/lib/transaction/NodeAccountIdSignatureMap.cjs +2 -2
- package/lib/transaction/NodeAccountIdSignatureMap.d.ts +2 -2
- package/lib/transaction/NodeAccountIdSignatureMap.js +1 -1
- package/lib/transaction/NodeAccountIdSignatureMap.js.map +1 -1
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.cjs +1 -1
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.d.ts +2 -2
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.js.map +1 -1
- package/lib/transaction/SignatureMap.cjs +1 -1
- package/lib/transaction/SignatureMap.js.map +1 -1
- package/lib/transaction/SignaturePairMap.cjs +1 -1
- package/lib/transaction/SignaturePairMap.d.ts +2 -2
- package/lib/transaction/SignaturePairMap.js.map +1 -1
- package/lib/transaction/Transaction.cjs +1 -1
- package/lib/transaction/Transaction.d.ts +1 -1
- package/lib/transaction/Transaction.js +1 -1
- package/lib/transaction/Transaction.js.map +1 -1
- package/lib/transaction/TransactionHashMap.cjs +1 -1
- package/lib/transaction/TransactionHashMap.d.ts +2 -2
- package/lib/transaction/TransactionHashMap.js.map +1 -1
- package/lib/transaction/TransactionId.cjs +1 -1
- package/lib/transaction/TransactionId.d.ts +1 -1
- package/lib/transaction/TransactionId.js +1 -1
- package/lib/transaction/TransactionId.js.map +1 -1
- package/lib/transaction/TransactionReceipt.cjs +1 -1
- package/lib/transaction/TransactionReceipt.d.ts +1 -1
- package/lib/transaction/TransactionReceipt.js +1 -1
- package/lib/transaction/TransactionReceipt.js.map +1 -1
- package/lib/transaction/TransactionReceiptQuery.cjs +1 -1
- package/lib/transaction/TransactionReceiptQuery.d.ts +1 -1
- package/lib/transaction/TransactionReceiptQuery.js +1 -1
- package/lib/transaction/TransactionReceiptQuery.js.map +1 -1
- package/lib/transaction/TransactionRecord.cjs +1 -1
- package/lib/transaction/TransactionRecord.d.ts +1 -1
- package/lib/transaction/TransactionRecord.js +1 -1
- package/lib/transaction/TransactionRecord.js.map +1 -1
- package/lib/transaction/TransactionRecordQuery.cjs +1 -1
- package/lib/transaction/TransactionRecordQuery.d.ts +1 -1
- package/lib/transaction/TransactionRecordQuery.js +1 -1
- package/lib/transaction/TransactionRecordQuery.js.map +1 -1
- package/lib/util/ASN1-Decoder.cjs +1 -1
- package/lib/util/ASN1-Decoder.js +1 -1
- package/lib/util/ASN1-Decoder.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/Cache.js +6 -6
- package/src/Duration.js +1 -1
- package/src/EntityIdHelper.js +1 -1
- package/src/EthereumFlow.js +7 -7
- package/src/EthereumTransaction.js +7 -7
- package/src/EvmAddress.js +1 -1
- package/src/ExchangeRate.js +2 -2
- package/src/ExchangeRates.js +1 -1
- package/src/FeeComponents.js +1 -1
- package/src/FeeData.js +1 -1
- package/src/FeeDataType.js +1 -1
- package/src/FeeSchedule.js +1 -1
- package/src/FeeSchedules.js +1 -1
- package/src/FreezeType.js +1 -1
- package/src/Key.js +1 -1
- package/src/KeyList.js +3 -3
- package/src/Mnemonic.js +1 -1
- package/src/PrivateKey.js +7 -7
- package/src/PrngTransaction.js +9 -9
- package/src/PublicKey.js +5 -5
- package/src/RequestType.js +1 -1
- package/src/StakingInfo.js +1 -1
- package/src/Status.js +1 -1
- package/src/Timestamp.js +1 -1
- package/src/TransactionFeeSchedule.js +1 -1
- package/src/Transfer.js +2 -2
- package/src/account/AccountAllowanceAdjustTransaction.js +7 -7
- package/src/account/AccountAllowanceApproveTransaction.js +8 -8
- package/src/account/AccountAllowanceDeleteTransaction.js +7 -7
- package/src/account/AccountBalance.js +1 -1
- package/src/account/AccountBalanceQuery.js +6 -6
- package/src/account/AccountCreateTransaction.js +1 -1
- package/src/account/AccountDeleteTransaction.js +7 -7
- package/src/account/AccountId.js +1 -1
- package/src/account/AccountInfo.js +1 -1
- package/src/account/AccountInfoQuery.js +7 -7
- package/src/account/AccountRecordsQuery.js +7 -7
- package/src/account/AccountUpdateTransaction.js +7 -7
- package/src/account/HbarAllowance.js +3 -3
- package/src/account/HbarTransferMap.js +2 -2
- package/src/account/LiveHash.js +3 -3
- package/src/account/LiveHashAddTransaction.js +7 -7
- package/src/account/LiveHashDeleteTransaction.js +6 -6
- package/src/account/LiveHashQuery.js +7 -7
- package/src/account/NullableTokenDecimalMap.js +2 -2
- package/src/account/ProxyStaker.js +2 -2
- package/src/account/TokenAllowance.js +4 -4
- package/src/account/TokenBalanceMap.js +2 -2
- package/src/account/TokenDecimalMap.js +2 -2
- package/src/account/TokenNftAllowance.js +5 -5
- package/src/account/TokenNftTransferMap.js +5 -5
- package/src/account/TokenRelationship.js +4 -4
- package/src/account/TokenRelationshipMap.js +2 -2
- package/src/account/TokenTransferMap.js +4 -4
- package/src/account/TransferTransaction.js +6 -6
- package/src/address_book/AddressBooks.js +1 -1
- package/src/address_book/Endpoint.js +1 -1
- package/src/address_book/NodeAddress.js +1 -1
- package/src/address_book/NodeAddressBook.js +1 -1
- package/src/channel/Channel.js +1 -1
- package/src/contract/ContractByteCodeQuery.js +6 -6
- package/src/contract/ContractCallQuery.js +1 -1
- package/src/contract/ContractCreateTransaction.js +8 -8
- package/src/contract/ContractDeleteTransaction.js +8 -8
- package/src/contract/ContractExecuteTransaction.js +9 -9
- package/src/contract/ContractFunctionResult.js +2 -2
- package/src/contract/ContractId.js +1 -1
- package/src/contract/ContractInfo.js +1 -1
- package/src/contract/ContractInfoQuery.js +7 -7
- package/src/contract/ContractLogInfo.js +2 -2
- package/src/contract/ContractNonceInfo.js +3 -3
- package/src/contract/ContractStateChange.js +1 -1
- package/src/contract/ContractUpdateTransaction.js +10 -10
- package/src/contract/DelegateContractId.js +2 -2
- package/src/contract/StorageChange.js +1 -1
- package/src/exports.js +1 -1
- package/src/file/FileAppendTransaction.js +7 -7
- package/src/file/FileContentsQuery.js +7 -7
- package/src/file/FileCreateTransaction.js +6 -6
- package/src/file/FileDeleteTransaction.js +7 -7
- package/src/file/FileId.js +1 -1
- package/src/file/FileInfo.js +1 -1
- package/src/file/FileInfoQuery.js +7 -7
- package/src/file/FileUpdateTransaction.js +6 -6
- package/src/network/AddressBookQuery.js +1 -1
- package/src/network/NetworkVersionInfo.js +1 -1
- package/src/network/NetworkVersionInfoQuery.js +6 -6
- package/src/network/SemanticVersion.js +1 -1
- package/src/node/NodeCreateTransaction.js +6 -6
- package/src/node/NodeDeleteTransaction.js +6 -6
- package/src/node/NodeUpdateTransaction.js +6 -6
- package/src/node/ServiceEndpoint.js +1 -1
- package/src/query/CostQuery.js +1 -1
- package/src/query/Query.js +1 -1
- package/src/query/QueryBase.js +1 -1
- package/src/schedule/ScheduleCreateTransaction.js +1 -1
- package/src/schedule/ScheduleDeleteTransaction.js +8 -8
- package/src/schedule/ScheduleId.js +1 -1
- package/src/schedule/ScheduleInfo.js +1 -1
- package/src/schedule/ScheduleInfoQuery.js +7 -7
- package/src/schedule/ScheduleSignTransaction.js +10 -10
- package/src/system/FreezeTransaction.js +6 -6
- package/src/system/SystemDeleteTransaction.js +8 -8
- package/src/system/SystemUndeleteTransaction.js +8 -8
- package/src/token/AbstractTokenTransferTransaction.js +1 -1
- package/src/token/AssessedCustomFee.js +1 -1
- package/src/token/CustomFee.js +1 -1
- package/src/token/CustomFixedFee.js +3 -3
- package/src/token/CustomFractionalFee.js +3 -3
- package/src/token/CustomRoyaltyFee.js +4 -4
- package/src/token/NftId.js +1 -1
- package/src/token/PendingAirdropId.js +1 -1
- package/src/token/PendingAirdropRecord.js +1 -1
- package/src/token/TokenAirdropTransaction.js +8 -8
- package/src/token/TokenAssociateTransaction.js +7 -7
- package/src/token/TokenAssociation.js +1 -1
- package/src/token/TokenBurnTransaction.js +7 -7
- package/src/token/TokenCancelAirdropTransaction.js +6 -6
- package/src/token/TokenClaimAirdropTransaction.js +6 -6
- package/src/token/TokenCreateTransaction.js +7 -7
- package/src/token/TokenDeleteTransaction.js +7 -7
- package/src/token/TokenDissociateTransaction.js +7 -7
- package/src/token/TokenFeeScheduleUpdateTransaction.js +7 -7
- package/src/token/TokenFreezeTransaction.js +7 -7
- package/src/token/TokenGrantKycTransaction.js +7 -7
- package/src/token/TokenId.js +1 -1
- package/src/token/TokenInfo.js +1 -1
- package/src/token/TokenInfoQuery.js +7 -7
- package/src/token/TokenKeyValidation.js +1 -1
- package/src/token/TokenMintTransaction.js +7 -7
- package/src/token/TokenNftInfo.js +10 -10
- package/src/token/TokenNftInfoQuery.js +11 -11
- package/src/token/TokenNftTransfer.js +5 -5
- package/src/token/TokenNftsUpdateTransaction.js +7 -7
- package/src/token/TokenPauseTransaction.js +7 -7
- package/src/token/TokenReference.js +1 -1
- package/src/token/TokenRejectTransaction.js +7 -7
- package/src/token/TokenRevokeKycTransaction.js +7 -7
- package/src/token/TokenSupplyType.js +1 -1
- package/src/token/TokenTransfer.js +4 -4
- package/src/token/TokenType.js +1 -1
- package/src/token/TokenUnfreezeTransaction.js +7 -7
- package/src/token/TokenUnpauseTransaction.js +7 -7
- package/src/token/TokenUpdateNftsTransaction.js +7 -7
- package/src/token/TokenUpdateTransaction.js +7 -7
- package/src/token/TokenWipeTransaction.js +7 -7
- package/src/topic/TopicCreateTransaction.js +6 -6
- package/src/topic/TopicDeleteTransaction.js +6 -6
- package/src/topic/TopicId.js +1 -1
- package/src/topic/TopicInfo.js +1 -1
- package/src/topic/TopicInfoQuery.js +7 -7
- package/src/topic/TopicMessage.js +2 -2
- package/src/topic/TopicMessageChunk.js +2 -2
- package/src/topic/TopicMessageQuery.js +1 -1
- package/src/topic/TopicMessageSubmitTransaction.js +9 -9
- package/src/topic/TopicUpdateTransaction.js +6 -6
- package/src/transaction/BatchTransaction.js +5 -5
- package/src/transaction/CustomFeeLimit.js +2 -2
- package/src/transaction/NodeAccountIdSignatureMap.js +2 -2
- package/src/transaction/NodeAccountIdSignatureMapLegacy.js +1 -1
- package/src/transaction/SignatureMap.js +1 -1
- package/src/transaction/SignaturePairMap.js +1 -1
- package/src/transaction/Transaction.js +1 -1
- package/src/transaction/TransactionHashMap.js +1 -1
- package/src/transaction/TransactionId.js +1 -1
- package/src/transaction/TransactionReceipt.js +1 -1
- package/src/transaction/TransactionReceiptQuery.js +1 -1
- package/src/transaction/TransactionRecord.js +1 -1
- package/src/transaction/TransactionRecordQuery.js +1 -1
- package/src/util/ASN1-Decoder.js +1 -1
package/lib/Key.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Key.js","sources":["../src/Key.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport CACHE from \"./Cache.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@
|
|
1
|
+
{"version":3,"file":"Key.js","sources":["../src/Key.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport CACHE from \"./Cache.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IKey} HieroProto.proto.IKey\n */\n\nexport default class Key {\n /**\n * @internal\n * @abstract\n * @returns {HieroProto.proto.IKey}\n */\n // eslint-disable-next-line jsdoc/require-returns-check\n _toProtobufKey() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IKey} key\n * @returns {Key}\n */\n static _fromProtobufKey(key) {\n if (key.contractID != null) {\n return CACHE.contractId(key.contractID);\n }\n\n if (key.delegatableContractId != null) {\n return CACHE.delegateContractId(key.delegatableContractId);\n }\n\n if (key.ed25519 != null && key.ed25519.byteLength > 0) {\n return CACHE.publicKeyED25519(key.ed25519);\n }\n\n if (key.ECDSASecp256k1 != null && key.ECDSASecp256k1.byteLength > 0) {\n return CACHE.publicKeyECDSA(key.ECDSASecp256k1);\n }\n\n if (key.thresholdKey != null && key.thresholdKey.threshold != null) {\n return CACHE.thresholdKey(key.thresholdKey);\n }\n\n if (key.keyList != null) {\n return CACHE.keyList(key.keyList);\n }\n\n // @ts-ignore\n return null;\n\n /* throw new Error(\n `(BUG) keyFromProtobuf: not implemented key case: ${JSON.stringify(\n key\n )}`\n ); */\n }\n}\n"],"names":["Key","_toProtobufKey","Error","_fromProtobufKey","key","contractID","CACHE","contractId","delegatableContractId","delegateContractId","ed25519","byteLength","publicKeyED25519","ECDSASecp256k1","publicKeyECDSA","thresholdKey","threshold","keyList"],"mappings":"0BASe,MAAMA,EAOjB,cAAAC,GACI,MAAM,IAAIC,MAAM,kBACxB,CAOI,uBAAOC,CAAiBC,GACpB,OAAsB,MAAlBA,EAAIC,WACGC,EAAMC,WAAWH,EAAIC,YAGC,MAA7BD,EAAII,sBACGF,EAAMG,mBAAmBL,EAAII,uBAGrB,MAAfJ,EAAIM,SAAmBN,EAAIM,QAAQC,WAAa,EACzCL,EAAMM,iBAAiBR,EAAIM,SAGZ,MAAtBN,EAAIS,gBAA0BT,EAAIS,eAAeF,WAAa,EACvDL,EAAMQ,eAAeV,EAAIS,gBAGZ,MAApBT,EAAIW,cAAsD,MAA9BX,EAAIW,aAAaC,UACtCV,EAAMS,aAAaX,EAAIW,cAGf,MAAfX,EAAIa,QACGX,EAAMW,QAAQb,EAAIa,SAItB,IAOf"}
|
package/lib/KeyList.cjs
CHANGED
|
@@ -11,9 +11,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @namespace proto
|
|
14
|
-
* @typedef {import("@
|
|
15
|
-
* @typedef {import("@
|
|
16
|
-
* @typedef {import("@
|
|
14
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
15
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKeyList} HieroProto.proto.IKeyList
|
|
16
|
+
* @typedef {import("@hiero-ledger/proto").proto.IThresholdKey} HieroProto.proto.IThresholdKey
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/**
|
package/lib/KeyList.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @namespace proto
|
|
3
|
-
* @typedef {import("@
|
|
4
|
-
* @typedef {import("@
|
|
5
|
-
* @typedef {import("@
|
|
3
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
4
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKeyList} HieroProto.proto.IKeyList
|
|
5
|
+
* @typedef {import("@hiero-ledger/proto").proto.IThresholdKey} HieroProto.proto.IThresholdKey
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* A list of Keys (`Key`) with an optional threshold.
|
|
@@ -79,9 +79,9 @@ export default class KeyList extends Key {
|
|
|
79
79
|
}
|
|
80
80
|
export namespace HieroProto {
|
|
81
81
|
namespace proto {
|
|
82
|
-
type IKey = import("@
|
|
83
|
-
type IKeyList = import("@
|
|
84
|
-
type IThresholdKey = import("@
|
|
82
|
+
type IKey = import("@hiero-ledger/proto").proto.IKey;
|
|
83
|
+
type IKeyList = import("@hiero-ledger/proto").proto.IKeyList;
|
|
84
|
+
type IThresholdKey = import("@hiero-ledger/proto").proto.IThresholdKey;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
import Key from "./Key.js";
|
package/lib/KeyList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyList.js","sources":["../src/KeyList.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Key from \"./Key.js\";\nimport CACHE from \"./Cache.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@
|
|
1
|
+
{"version":3,"file":"KeyList.js","sources":["../src/KeyList.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Key from \"./Key.js\";\nimport CACHE from \"./Cache.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IKey} HieroProto.proto.IKey\n * @typedef {import(\"@hiero-ledger/proto\").proto.IKeyList} HieroProto.proto.IKeyList\n * @typedef {import(\"@hiero-ledger/proto\").proto.IThresholdKey} HieroProto.proto.IThresholdKey\n */\n\n/**\n * A list of Keys (`Key`) with an optional threshold.\n */\nexport default class KeyList extends Key {\n /**\n * @param {?Key[]} [keys]\n * @param {?number} [threshold]\n */\n constructor(keys, threshold) {\n super();\n\n /**\n * @private\n * @type {Key[]}\n */\n // @ts-ignore\n if (keys == null) this._keys = [];\n //checks if the value for `keys` is passed as a single key\n //rather than a list that contains just one key\n else if (keys instanceof Key) this._keys = [keys];\n else this._keys = keys;\n\n /**\n * @type {?number}\n */\n this._threshold = threshold == null ? null : threshold;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {KeyList}\n */\n static of(...keys) {\n return new KeyList(keys, null);\n }\n\n /**\n * @template T\n * @param {ArrayLike<Key>} arrayLike\n * @param {((key: Key) => Key)} [mapFn]\n * @param {T} [thisArg]\n * @returns {KeyList}\n */\n static from(arrayLike, mapFn, thisArg) {\n if (mapFn == null) {\n return new KeyList(Array.from(arrayLike));\n }\n\n return new KeyList(Array.from(arrayLike, mapFn, thisArg));\n }\n\n /**\n * @returns {?number}\n */\n get threshold() {\n return this._threshold;\n }\n\n /**\n * @param {number} threshold\n * @returns {this}\n */\n setThreshold(threshold) {\n this._threshold = threshold;\n return this;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {number}\n */\n push(...keys) {\n return this._keys.push(...keys);\n }\n\n /**\n * @param {number} start\n * @param {number} deleteCount\n * @param {Key[]} items\n * @returns {KeyList}\n */\n splice(start, deleteCount, ...items) {\n return new KeyList(\n this._keys.splice(start, deleteCount, ...items),\n this.threshold,\n );\n }\n\n /**\n * @param {number=} start\n * @param {number=} end\n * @returns {KeyList}\n */\n slice(start, end) {\n return new KeyList(this._keys.slice(start, end), this.threshold);\n }\n\n /**\n * @returns {Iterator<Key>}\n */\n [Symbol.iterator]() {\n return this._keys[Symbol.iterator]();\n }\n\n /**\n * @returns {Key[]}\n */\n toArray() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this._keys.slice();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify({\n threshold: this._threshold,\n keys: this._keys.toString(),\n });\n }\n\n /**\n * @returns {HieroProto.proto.IKey}\n */\n _toProtobufKey() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return\n const keys = this._keys.map((key) => key._toProtobufKey());\n\n if (this.threshold == null) {\n return { keyList: { keys } };\n } else {\n return {\n thresholdKey: {\n threshold: this.threshold,\n keys: { keys },\n },\n };\n }\n }\n\n /**\n * @param {HieroProto.proto.IKeyList} key\n * @returns {KeyList}\n */\n static __fromProtobufKeyList(key) {\n const keys = (key.keys != null ? key.keys : []).map((key) =>\n Key._fromProtobufKey(key),\n );\n return new KeyList(keys);\n }\n\n /**\n * @param {HieroProto.proto.IThresholdKey} key\n * @returns {KeyList}\n */\n static __fromProtobufThresoldKey(key) {\n const list = KeyList.__fromProtobufKeyList(\n key.keys != null ? key.keys : {},\n );\n list.setThreshold(key.threshold != null ? key.threshold : 0);\n return list;\n }\n}\n\nCACHE.setKeyList((key) => KeyList.__fromProtobufKeyList(key));\nCACHE.setThresholdKey((key) => KeyList.__fromProtobufThresoldKey(key));\n"],"names":["KeyList","Key","constructor","keys","threshold","super","this","_keys","_threshold","of","from","arrayLike","mapFn","thisArg","Array","setThreshold","push","splice","start","deleteCount","items","slice","end","Symbol","iterator","toArray","toString","JSON","stringify","_toProtobufKey","map","key","keyList","thresholdKey","__fromProtobufKeyList","_fromProtobufKey","__fromProtobufThresoldKey","list","CACHE","setKeyList","setThresholdKey"],"mappings":"kDAee,MAAMA,UAAgBC,EAKjC,WAAAC,CAAYC,EAAMC,GACdC,QAOkBC,KAAKC,MAAX,MAARJ,EAA2B,GAGtBA,aAAgBF,EAAkB,CAACE,GAC1BA,EAKlBG,KAAKE,WAA0B,MAAbJ,EAAoB,KAAOA,CACrD,CAMI,SAAOK,IAAMN,GACT,OAAO,IAAIH,EAAQG,EAAM,KACjC,CASI,WAAOO,CAAKC,EAAWC,EAAOC,GAC1B,OACW,IAAIb,EADF,MAATY,EACmBE,MAAMJ,KAAKC,GAGfG,MAAMJ,KAAKC,EAAWC,EAAOC,GACxD,CAKI,aAAIT,GACA,OAAOE,KAAKE,UACpB,CAMI,YAAAO,CAAaX,GAET,OADAE,KAAKE,WAAaJ,EACXE,IACf,CAMI,IAAAU,IAAQb,GACJ,OAAOG,KAAKC,MAAMS,QAAQb,EAClC,CAQI,MAAAc,CAAOC,EAAOC,KAAgBC,GAC1B,OAAO,IAAIpB,EACPM,KAAKC,MAAMU,OAAOC,EAAOC,KAAgBC,GACzCd,KAAKF,UAEjB,CAOI,KAAAiB,CAAMH,EAAOI,GACT,OAAO,IAAItB,EAAQM,KAAKC,MAAMc,MAAMH,EAAOI,GAAMhB,KAAKF,UAC9D,CAKI,CAACmB,OAAOC,YACJ,OAAOlB,KAAKC,MAAMgB,OAAOC,WACjC,CAKI,OAAAC,GAEI,OAAOnB,KAAKC,MAAMc,OAC1B,CAKI,QAAAK,GACI,OAAOC,KAAKC,UAAU,CAClBxB,UAAWE,KAAKE,WAChBL,KAAMG,KAAKC,MAAMmB,YAE7B,CAKI,cAAAG,GAEI,MAAM1B,EAAOG,KAAKC,MAAMuB,IAAKC,GAAQA,EAAIF,kBAEzC,OAAsB,MAAlBvB,KAAKF,UACE,CAAE4B,QAAS,CAAE7B,SAEb,CACH8B,aAAc,CACV7B,UAAWE,KAAKF,UAChBD,KAAM,CAAEA,SAI5B,CAMI,4BAAO+B,CAAsBH,GACzB,MAAM5B,GAAoB,MAAZ4B,EAAI5B,KAAe4B,EAAI5B,KAAO,IAAI2B,IAAKC,GACjD9B,EAAIkC,iBAAiBJ,IAEzB,OAAO,IAAI/B,EAAQG,EAC3B,CAMI,gCAAOiC,CAA0BL,GAC7B,MAAMM,EAAOrC,EAAQkC,sBACL,MAAZH,EAAI5B,KAAe4B,EAAI5B,KAAO,CAAE,GAGpC,OADAkC,EAAKtB,aAA8B,MAAjBgB,EAAI3B,UAAoB2B,EAAI3B,UAAY,GACnDiC,CACf,EAGAC,EAAMC,WAAYR,GAAQ/B,EAAQkC,sBAAsBH,IACxDO,EAAME,gBAAiBT,GAAQ/B,EAAQoC,0BAA0BL"}
|
package/lib/Mnemonic.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _cryptography = require("@
|
|
7
|
+
var _cryptography = require("@hiero-ledger/cryptography");
|
|
8
8
|
var _Cache = _interopRequireDefault(require("./Cache.cjs"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
package/lib/Mnemonic.d.ts
CHANGED
|
@@ -142,4 +142,4 @@ export default class Mnemonic {
|
|
|
142
142
|
toString(): string;
|
|
143
143
|
}
|
|
144
144
|
export type PrivateKey = import("./PrivateKey.js").default;
|
|
145
|
-
import { Mnemonic as MnemonicCryptography } from "@
|
|
145
|
+
import { Mnemonic as MnemonicCryptography } from "@hiero-ledger/cryptography";
|
package/lib/Mnemonic.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Mnemonic as t}from"@
|
|
1
|
+
import{Mnemonic as t}from"@hiero-ledger/cryptography";import e from"./Cache.js";class a{constructor(t){this._mnemonic=t}static async generate(){return new a(await t._generate(24))}static async generate12(){return new a(await t._generate(12))}static async fromWords(e){return new a(await t.fromWords(e))}async toPrivateKey(t=""){return e.privateKeyConstructor(await this._mnemonic.toPrivateKey(t))}async toEd25519PrivateKey(t="",a){return e.privateKeyConstructor(await this._mnemonic.toEd25519PrivateKey(t,a))}async toStandardEd25519PrivateKey(t="",a){return e.privateKeyConstructor(await this._mnemonic.toStandardEd25519PrivateKey(t,a))}async toEcdsaPrivateKey(t="",a){return e.privateKeyConstructor(await this._mnemonic.toEcdsaPrivateKey(t,a))}calculateDerivationPathValues(t){const e=/m\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)\/(\d+'?)/.exec(t),a=new Array(5);if(e)for(let t=1;t<=5;t++){let r=e[t];r.endsWith("'")?(r=r.substring(0,r.length-1),a[t-1]=2147483648|parseInt(r,10)):a[t-1]=parseInt(r,10)}return a}async toStandardECDSAsecp256k1PrivateKeyImpl(t,e){return await this.toEcdsaPrivateKey(t,e)}async toStandardECDSAsecp256k1PrivateKey(t="",a){return e.privateKeyConstructor(await this._mnemonic.toStandardECDSAsecp256k1PrivateKey(t,a))}async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath(t="",e){const a=this.calculateDerivationPathValues(e);return await this.toStandardECDSAsecp256k1PrivateKeyImpl(t,a)}static async fromString(e){return new a(await t.fromString(e))}async toLegacyPrivateKey(){return e.privateKeyConstructor(await this._mnemonic.toLegacyPrivateKey())}async toSeed(e){return await t.toSeed(this._mnemonic.words,e)}toString(){return this._mnemonic.toString()}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=Mnemonic.js.map
|
package/lib/Mnemonic.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mnemonic.js","sources":["../src/Mnemonic.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport { Mnemonic as MnemonicCryptography } from \"@hashgraph/cryptography\";\nimport CACHE from \"./Cache.js\";\n\n/**\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n */\n\nconst HARDENED_BIT = 0x80000000;\n\n/**\n * Multi-word mnemonic phrase (BIP-39).\n *\n * Compatible with the official Hiero mobile\n * wallets (24-words or 22-words) and BRD (12-words).\n */\nexport default class Mnemonic {\n /**\n * @param {MnemonicCryptography} mnemonic\n * @hideconstructor\n * @private\n */\n constructor(mnemonic) {\n this._mnemonic = mnemonic;\n }\n\n /**\n * Returns a new random 24-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise<Mnemonic>}\n */\n static async generate() {\n return new Mnemonic(await MnemonicCryptography._generate(24));\n }\n\n /**\n * Returns a new random 12-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise<Mnemonic>}\n */\n static async generate12() {\n return new Mnemonic(await MnemonicCryptography._generate(12));\n }\n\n /**\n * Construct a mnemonic from a list of words. Handles 12, 22 (legacy), and 24 words.\n *\n * An exception of BadMnemonicError will be thrown if the mnemonic\n * contains unknown words or fails the checksum. An invalid mnemonic\n * can still be used to create private keys, the exception will\n * contain the failing mnemonic in case you wish to ignore the\n * validation error and continue.\n *\n * @param {string[]} words\n * @throws {cryptography.BadMnemonicError}\n * @returns {Promise<Mnemonic>}\n */\n static async fromWords(words) {\n return new Mnemonic(await MnemonicCryptography.fromWords(words));\n }\n\n /**\n * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead\n * Recover a private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n */\n async toPrivateKey(passphrase = \"\") {\n return CACHE.privateKeyConstructor(\n // eslint-disable-next-line deprecation/deprecation\n await this._mnemonic.toPrivateKey(passphrase),\n );\n }\n\n /**\n * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead\n * Recover an Ed25519 private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise<PrivateKey>}\n */\n async toEd25519PrivateKey(passphrase = \"\", path) {\n return CACHE.privateKeyConstructor(\n // eslint-disable-next-line deprecation/deprecation\n await this._mnemonic.toEd25519PrivateKey(passphrase, path),\n );\n }\n\n /**\n * Recover an Ed25519 private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number} [index]\n * @returns {Promise<PrivateKey>}\n */\n async toStandardEd25519PrivateKey(passphrase = \"\", index) {\n return CACHE.privateKeyConstructor(\n await this._mnemonic.toStandardEd25519PrivateKey(passphrase, index),\n );\n }\n\n /**\n * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead\n * Recover an ECDSA private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise<PrivateKey>}\n */\n async toEcdsaPrivateKey(passphrase = \"\", path) {\n return CACHE.privateKeyConstructor(\n // eslint-disable-next-line deprecation/deprecation\n await this._mnemonic.toEcdsaPrivateKey(passphrase, path),\n );\n }\n\n /**\n * Converts a derivation path from string to an array of integers.\n * Note that this expects precisely 5 components in the derivation path,\n * as per BIP-44:\n * `m / purpose' / coin_type' / account' / change / address_index`\n * Takes into account `'` for hardening as per BIP-32,\n * and does not prescribe which components should be hardened.\n *\n * @param {string} derivationPath the derivation path in BIP-44 format,\n * e.g. \"m/44'/60'/0'/0/0\"\n * @returns {Array<number>} to be used with PrivateKey#derive\n */\n calculateDerivationPathValues(derivationPath) {\n // Parse the derivation path from string into values\n const pattern = /m\\/(\\d+'?)\\/(\\d+'?)\\/(\\d+'?)\\/(\\d+'?)\\/(\\d+'?)/;\n const matches = pattern.exec(derivationPath);\n const values = new Array(5); // as Array<Number>;\n if (matches) {\n // Extract numbers and use apostrophe to select if is hardened\n for (let i = 1; i <= 5; i++) {\n let value = matches[i];\n if (value.endsWith(\"'\")) {\n value = value.substring(0, value.length - 1);\n values[i - 1] = parseInt(value, 10) | HARDENED_BIT;\n } else {\n values[i - 1] = parseInt(value, 10);\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return values;\n }\n\n /**\n * Common implementation for both `toStandardECDSAsecp256k1PrivateKey`\n * functions.\n *\n * @param {string} passphrase the passphrase used to protect the\n * mnemonic, use \"\" for none\n * @param {Array<number>} derivationPathValues derivation path as an\n * integer array,\n * see: `calculateDerivationPathValues`\n * @returns {Promise<PrivateKey>} a private key\n */\n async toStandardECDSAsecp256k1PrivateKeyImpl(\n passphrase,\n derivationPathValues,\n ) {\n // eslint-disable-next-line deprecation/deprecation\n return await this.toEcdsaPrivateKey(passphrase, derivationPathValues);\n }\n\n /**\n * Recover an ECDSA private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number} [index]\n * @returns {Promise<PrivateKey>}\n */\n async toStandardECDSAsecp256k1PrivateKey(passphrase = \"\", index) {\n return CACHE.privateKeyConstructor(\n await this._mnemonic.toStandardECDSAsecp256k1PrivateKey(\n passphrase,\n index,\n ),\n );\n }\n\n /**\n * Recover an ECDSAsecp256k1 private key from this mnemonic phrase and\n * derivation path, with an optional passphrase\n *\n * @param {string} passphrase the passphrase used to protect the mnemonic,\n * use \"\" for none\n * @param {string} derivationPath the derivation path in BIP-44 format,\n * e.g. \"m/44'/60'/0'/0/0\"\n * @returns {Promise<PrivateKey>} the private key\n */\n async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath(\n passphrase = \"\",\n derivationPath,\n ) {\n const derivationPathValues =\n this.calculateDerivationPathValues(derivationPath);\n return await this.toStandardECDSAsecp256k1PrivateKeyImpl(\n passphrase,\n derivationPathValues,\n );\n }\n\n /**\n * Recover a mnemonic phrase from a string, splitting on spaces. Handles 12, 22 (legacy), and 24 words.\n *\n * @param {string} mnemonic\n * @returns {Promise<Mnemonic>}\n */\n static async fromString(mnemonic) {\n return new Mnemonic(await MnemonicCryptography.fromString(mnemonic));\n }\n\n /**\n * @returns {Promise<PrivateKey>}\n */\n async toLegacyPrivateKey() {\n return CACHE.privateKeyConstructor(\n await this._mnemonic.toLegacyPrivateKey(),\n );\n }\n\n /**\n * @param {string} passphrase\n * @returns {Promise<Uint8Array>}\n */\n async toSeed(passphrase) {\n return await MnemonicCryptography.toSeed(\n this._mnemonic.words,\n passphrase,\n );\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._mnemonic.toString();\n }\n}\n"],"names":["Mnemonic","constructor","mnemonic","this","_mnemonic","generate","MnemonicCryptography","_generate","generate12","fromWords","words","toPrivateKey","passphrase","CACHE","privateKeyConstructor","toEd25519PrivateKey","path","toStandardEd25519PrivateKey","index","toEcdsaPrivateKey","calculateDerivationPathValues","derivationPath","matches","exec","values","Array","i","value","endsWith","substring","length","parseInt","toStandardECDSAsecp256k1PrivateKeyImpl","derivationPathValues","toStandardECDSAsecp256k1PrivateKey","toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath","fromString","toLegacyPrivateKey","toSeed","toString"],"mappings":"6EAiBe,MAAMA,EAMjB,WAAAC,CAAYC,GACRC,KAAKC,UAAYF,CACzB,CAQI,qBAAaG,GACT,OAAO,IAAIL,QAAeM,EAAqBC,UAAU,IACjE,CAQI,uBAAaC,GACT,OAAO,IAAIR,QAAeM,EAAqBC,UAAU,IACjE,CAeI,sBAAaE,CAAUC,GACnB,OAAO,IAAIV,QAAeM,EAAqBG,UAAUC,GACjE,CASI,kBAAMC,CAAaC,EAAa,IAC5B,OAAOC,EAAMC,4BAEHX,KAAKC,UAAUO,aAAaC,GAE9C,CAUI,yBAAMG,CAAoBH,EAAa,GAAII,GACvC,OAAOH,EAAMC,4BAEHX,KAAKC,UAAUW,oBAAoBH,EAAYI,GAEjE,CAUI,iCAAMC,CAA4BL,EAAa,GAAIM,GAC/C,OAAOL,EAAMC,4BACHX,KAAKC,UAAUa,4BAA4BL,EAAYM,GAEzE,CAUI,uBAAMC,CAAkBP,EAAa,GAAII,GACrC,OAAOH,EAAMC,4BAEHX,KAAKC,UAAUe,kBAAkBP,EAAYI,GAE/D,CAcI,6BAAAI,CAA8BC,GAE1B,MACMC,EADU,iDACQC,KAAKF,GACvBG,EAAS,IAAIC,MAAM,GACzB,GAAIH,EAEA,IAAK,IAAII,EAAI,EAAGA,GAAK,EAAGA,IAAK,CACzB,IAAIC,EAAQL,EAAQI,GAChBC,EAAMC,SAAS,MACfD,EAAQA,EAAME,UAAU,EAAGF,EAAMG,OAAS,GAC1CN,EAAOE,EAAI,GAxIV,WAwIeK,SAASJ,EAAO,KAEhCH,EAAOE,EAAI,GAAKK,SAASJ,EAAO,GAEpD,CAGQ,OAAOH,CACf,CAaI,4CAAMQ,CACFpB,EACAqB,GAGA,aAAa9B,KAAKgB,kBAAkBP,EAAYqB,EACxD,CAUI,wCAAMC,CAAmCtB,EAAa,GAAIM,GACtD,OAAOL,EAAMC,4BACHX,KAAKC,UAAU8B,mCACjBtB,EACAM,GAGhB,CAYI,4DAAMiB,CACFvB,EAAa,GACbS,GAEA,MAAMY,EACF9B,KAAKiB,8BAA8BC,GACvC,aAAalB,KAAK6B,uCACdpB,EACAqB,EAEZ,CAQI,uBAAaG,CAAWlC,GACpB,OAAO,IAAIF,QAAeM,EAAqB8B,WAAWlC,GAClE,CAKI,wBAAMmC,GACF,OAAOxB,EAAMC,4BACHX,KAAKC,UAAUiC,qBAEjC,CAMI,YAAMC,CAAO1B,GACT,aAAaN,EAAqBgC,OAC9BnC,KAAKC,UAAUM,MACfE,EAEZ,CAKI,QAAA2B,GACI,OAAOpC,KAAKC,UAAUmC,UAC9B"}
|
|
1
|
+
{"version":3,"file":"Mnemonic.js","sources":["../src/Mnemonic.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport { Mnemonic as MnemonicCryptography } from \"@hiero-ledger/cryptography\";\nimport CACHE from \"./Cache.js\";\n\n/**\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n */\n\nconst HARDENED_BIT = 0x80000000;\n\n/**\n * Multi-word mnemonic phrase (BIP-39).\n *\n * Compatible with the official Hiero mobile\n * wallets (24-words or 22-words) and BRD (12-words).\n */\nexport default class Mnemonic {\n /**\n * @param {MnemonicCryptography} mnemonic\n * @hideconstructor\n * @private\n */\n constructor(mnemonic) {\n this._mnemonic = mnemonic;\n }\n\n /**\n * Returns a new random 24-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise<Mnemonic>}\n */\n static async generate() {\n return new Mnemonic(await MnemonicCryptography._generate(24));\n }\n\n /**\n * Returns a new random 12-word mnemonic from the BIP-39\n * standard English word list.\n *\n * @returns {Promise<Mnemonic>}\n */\n static async generate12() {\n return new Mnemonic(await MnemonicCryptography._generate(12));\n }\n\n /**\n * Construct a mnemonic from a list of words. Handles 12, 22 (legacy), and 24 words.\n *\n * An exception of BadMnemonicError will be thrown if the mnemonic\n * contains unknown words or fails the checksum. An invalid mnemonic\n * can still be used to create private keys, the exception will\n * contain the failing mnemonic in case you wish to ignore the\n * validation error and continue.\n *\n * @param {string[]} words\n * @throws {cryptography.BadMnemonicError}\n * @returns {Promise<Mnemonic>}\n */\n static async fromWords(words) {\n return new Mnemonic(await MnemonicCryptography.fromWords(words));\n }\n\n /**\n * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead\n * Recover a private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n */\n async toPrivateKey(passphrase = \"\") {\n return CACHE.privateKeyConstructor(\n // eslint-disable-next-line deprecation/deprecation\n await this._mnemonic.toPrivateKey(passphrase),\n );\n }\n\n /**\n * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead\n * Recover an Ed25519 private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise<PrivateKey>}\n */\n async toEd25519PrivateKey(passphrase = \"\", path) {\n return CACHE.privateKeyConstructor(\n // eslint-disable-next-line deprecation/deprecation\n await this._mnemonic.toEd25519PrivateKey(passphrase, path),\n );\n }\n\n /**\n * Recover an Ed25519 private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number} [index]\n * @returns {Promise<PrivateKey>}\n */\n async toStandardEd25519PrivateKey(passphrase = \"\", index) {\n return CACHE.privateKeyConstructor(\n await this._mnemonic.toStandardEd25519PrivateKey(passphrase, index),\n );\n }\n\n /**\n * @deprecated - Use `toStandardEd25519PrivateKey()` or `toStandardECDSAsecp256k1PrivateKey()` instead\n * Recover an ECDSA private key from this mnemonic phrase, with an\n * optional passphrase.\n * @param {string} [passphrase]\n * @param {number[]} [path]\n * @returns {Promise<PrivateKey>}\n */\n async toEcdsaPrivateKey(passphrase = \"\", path) {\n return CACHE.privateKeyConstructor(\n // eslint-disable-next-line deprecation/deprecation\n await this._mnemonic.toEcdsaPrivateKey(passphrase, path),\n );\n }\n\n /**\n * Converts a derivation path from string to an array of integers.\n * Note that this expects precisely 5 components in the derivation path,\n * as per BIP-44:\n * `m / purpose' / coin_type' / account' / change / address_index`\n * Takes into account `'` for hardening as per BIP-32,\n * and does not prescribe which components should be hardened.\n *\n * @param {string} derivationPath the derivation path in BIP-44 format,\n * e.g. \"m/44'/60'/0'/0/0\"\n * @returns {Array<number>} to be used with PrivateKey#derive\n */\n calculateDerivationPathValues(derivationPath) {\n // Parse the derivation path from string into values\n const pattern = /m\\/(\\d+'?)\\/(\\d+'?)\\/(\\d+'?)\\/(\\d+'?)\\/(\\d+'?)/;\n const matches = pattern.exec(derivationPath);\n const values = new Array(5); // as Array<Number>;\n if (matches) {\n // Extract numbers and use apostrophe to select if is hardened\n for (let i = 1; i <= 5; i++) {\n let value = matches[i];\n if (value.endsWith(\"'\")) {\n value = value.substring(0, value.length - 1);\n values[i - 1] = parseInt(value, 10) | HARDENED_BIT;\n } else {\n values[i - 1] = parseInt(value, 10);\n }\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return values;\n }\n\n /**\n * Common implementation for both `toStandardECDSAsecp256k1PrivateKey`\n * functions.\n *\n * @param {string} passphrase the passphrase used to protect the\n * mnemonic, use \"\" for none\n * @param {Array<number>} derivationPathValues derivation path as an\n * integer array,\n * see: `calculateDerivationPathValues`\n * @returns {Promise<PrivateKey>} a private key\n */\n async toStandardECDSAsecp256k1PrivateKeyImpl(\n passphrase,\n derivationPathValues,\n ) {\n // eslint-disable-next-line deprecation/deprecation\n return await this.toEcdsaPrivateKey(passphrase, derivationPathValues);\n }\n\n /**\n * Recover an ECDSA private key from this mnemonic phrase, with an\n * optional passphrase.\n *\n * @param {string} [passphrase]\n * @param {number} [index]\n * @returns {Promise<PrivateKey>}\n */\n async toStandardECDSAsecp256k1PrivateKey(passphrase = \"\", index) {\n return CACHE.privateKeyConstructor(\n await this._mnemonic.toStandardECDSAsecp256k1PrivateKey(\n passphrase,\n index,\n ),\n );\n }\n\n /**\n * Recover an ECDSAsecp256k1 private key from this mnemonic phrase and\n * derivation path, with an optional passphrase\n *\n * @param {string} passphrase the passphrase used to protect the mnemonic,\n * use \"\" for none\n * @param {string} derivationPath the derivation path in BIP-44 format,\n * e.g. \"m/44'/60'/0'/0/0\"\n * @returns {Promise<PrivateKey>} the private key\n */\n async toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath(\n passphrase = \"\",\n derivationPath,\n ) {\n const derivationPathValues =\n this.calculateDerivationPathValues(derivationPath);\n return await this.toStandardECDSAsecp256k1PrivateKeyImpl(\n passphrase,\n derivationPathValues,\n );\n }\n\n /**\n * Recover a mnemonic phrase from a string, splitting on spaces. Handles 12, 22 (legacy), and 24 words.\n *\n * @param {string} mnemonic\n * @returns {Promise<Mnemonic>}\n */\n static async fromString(mnemonic) {\n return new Mnemonic(await MnemonicCryptography.fromString(mnemonic));\n }\n\n /**\n * @returns {Promise<PrivateKey>}\n */\n async toLegacyPrivateKey() {\n return CACHE.privateKeyConstructor(\n await this._mnemonic.toLegacyPrivateKey(),\n );\n }\n\n /**\n * @param {string} passphrase\n * @returns {Promise<Uint8Array>}\n */\n async toSeed(passphrase) {\n return await MnemonicCryptography.toSeed(\n this._mnemonic.words,\n passphrase,\n );\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._mnemonic.toString();\n }\n}\n"],"names":["Mnemonic","constructor","mnemonic","this","_mnemonic","generate","MnemonicCryptography","_generate","generate12","fromWords","words","toPrivateKey","passphrase","CACHE","privateKeyConstructor","toEd25519PrivateKey","path","toStandardEd25519PrivateKey","index","toEcdsaPrivateKey","calculateDerivationPathValues","derivationPath","matches","exec","values","Array","i","value","endsWith","substring","length","parseInt","toStandardECDSAsecp256k1PrivateKeyImpl","derivationPathValues","toStandardECDSAsecp256k1PrivateKey","toStandardECDSAsecp256k1PrivateKeyCustomDerivationPath","fromString","toLegacyPrivateKey","toSeed","toString"],"mappings":"gFAiBe,MAAMA,EAMjB,WAAAC,CAAYC,GACRC,KAAKC,UAAYF,CACzB,CAQI,qBAAaG,GACT,OAAO,IAAIL,QAAeM,EAAqBC,UAAU,IACjE,CAQI,uBAAaC,GACT,OAAO,IAAIR,QAAeM,EAAqBC,UAAU,IACjE,CAeI,sBAAaE,CAAUC,GACnB,OAAO,IAAIV,QAAeM,EAAqBG,UAAUC,GACjE,CASI,kBAAMC,CAAaC,EAAa,IAC5B,OAAOC,EAAMC,4BAEHX,KAAKC,UAAUO,aAAaC,GAE9C,CAUI,yBAAMG,CAAoBH,EAAa,GAAII,GACvC,OAAOH,EAAMC,4BAEHX,KAAKC,UAAUW,oBAAoBH,EAAYI,GAEjE,CAUI,iCAAMC,CAA4BL,EAAa,GAAIM,GAC/C,OAAOL,EAAMC,4BACHX,KAAKC,UAAUa,4BAA4BL,EAAYM,GAEzE,CAUI,uBAAMC,CAAkBP,EAAa,GAAII,GACrC,OAAOH,EAAMC,4BAEHX,KAAKC,UAAUe,kBAAkBP,EAAYI,GAE/D,CAcI,6BAAAI,CAA8BC,GAE1B,MACMC,EADU,iDACQC,KAAKF,GACvBG,EAAS,IAAIC,MAAM,GACzB,GAAIH,EAEA,IAAK,IAAII,EAAI,EAAGA,GAAK,EAAGA,IAAK,CACzB,IAAIC,EAAQL,EAAQI,GAChBC,EAAMC,SAAS,MACfD,EAAQA,EAAME,UAAU,EAAGF,EAAMG,OAAS,GAC1CN,EAAOE,EAAI,GAxIV,WAwIeK,SAASJ,EAAO,KAEhCH,EAAOE,EAAI,GAAKK,SAASJ,EAAO,GAEpD,CAGQ,OAAOH,CACf,CAaI,4CAAMQ,CACFpB,EACAqB,GAGA,aAAa9B,KAAKgB,kBAAkBP,EAAYqB,EACxD,CAUI,wCAAMC,CAAmCtB,EAAa,GAAIM,GACtD,OAAOL,EAAMC,4BACHX,KAAKC,UAAU8B,mCACjBtB,EACAM,GAGhB,CAYI,4DAAMiB,CACFvB,EAAa,GACbS,GAEA,MAAMY,EACF9B,KAAKiB,8BAA8BC,GACvC,aAAalB,KAAK6B,uCACdpB,EACAqB,EAEZ,CAQI,uBAAaG,CAAWlC,GACpB,OAAO,IAAIF,QAAeM,EAAqB8B,WAAWlC,GAClE,CAKI,wBAAMmC,GACF,OAAOxB,EAAMC,4BACHX,KAAKC,UAAUiC,qBAEjC,CAMI,YAAMC,CAAO1B,GACT,aAAaN,EAAqBgC,OAC9BnC,KAAKC,UAAUM,MACfE,EAEZ,CAKI,QAAA2B,GACI,OAAOpC,KAAKC,UAAUmC,UAC9B"}
|
package/lib/PrivateKey.cjs
CHANGED
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _bytes = require("@ethersproject/bytes");
|
|
8
|
-
var _cryptography = require("@
|
|
9
|
-
var _proto = require("@
|
|
8
|
+
var _cryptography = require("@hiero-ledger/cryptography");
|
|
9
|
+
var _proto = require("@hiero-ledger/proto");
|
|
10
10
|
var _Mnemonic = _interopRequireDefault(require("./Mnemonic.cjs"));
|
|
11
11
|
var _PublicKey = _interopRequireDefault(require("./PublicKey.cjs"));
|
|
12
12
|
var _Key = _interopRequireDefault(require("./Key.cjs"));
|
|
@@ -25,11 +25,11 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @namespace proto
|
|
28
|
-
* @typedef {import("@
|
|
29
|
-
* @typedef {import("@
|
|
30
|
-
* @typedef {import("@
|
|
31
|
-
* @typedef {import("@
|
|
32
|
-
* @typedef {import("@
|
|
28
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
29
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
30
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignaturePair} HieroProto.proto.ISignaturePair
|
|
31
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
32
|
+
* @typedef {import("@hiero-ledger/proto").proto.TransactionBody} HieroProto.proto.TransactionBody
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
class PrivateKey extends _Key.default {
|
package/lib/PrivateKey.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @namespace proto
|
|
6
|
-
* @typedef {import("@
|
|
7
|
-
* @typedef {import("@
|
|
8
|
-
* @typedef {import("@
|
|
9
|
-
* @typedef {import("@
|
|
10
|
-
* @typedef {import("@
|
|
6
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
7
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
8
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignaturePair} HieroProto.proto.ISignaturePair
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
10
|
+
* @typedef {import("@hiero-ledger/proto").proto.TransactionBody} HieroProto.proto.TransactionBody
|
|
11
11
|
*/
|
|
12
12
|
export default class PrivateKey extends Key {
|
|
13
13
|
/**
|
|
@@ -297,15 +297,15 @@ export default class PrivateKey extends Key {
|
|
|
297
297
|
export type Transaction = import("./transaction/Transaction.js").default;
|
|
298
298
|
export namespace HieroProto {
|
|
299
299
|
namespace proto {
|
|
300
|
-
type IKey = import("@
|
|
301
|
-
type ITransaction = import("@
|
|
302
|
-
type ISignaturePair = import("@
|
|
303
|
-
type ISignedTransaction = import("@
|
|
304
|
-
type TransactionBody = import("@
|
|
300
|
+
type IKey = import("@hiero-ledger/proto").proto.IKey;
|
|
301
|
+
type ITransaction = import("@hiero-ledger/proto").proto.ITransaction;
|
|
302
|
+
type ISignaturePair = import("@hiero-ledger/proto").proto.ISignaturePair;
|
|
303
|
+
type ISignedTransaction = import("@hiero-ledger/proto").proto.ISignedTransaction;
|
|
304
|
+
type TransactionBody = import("@hiero-ledger/proto").proto.TransactionBody;
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
import Key from "./Key.js";
|
|
308
|
-
import { PrivateKey as PrivateKeyCrypto } from "@
|
|
308
|
+
import { PrivateKey as PrivateKeyCrypto } from "@hiero-ledger/cryptography";
|
|
309
309
|
import PublicKey from "./PublicKey.js";
|
|
310
310
|
import SignatureMap from "./transaction/SignatureMap.js";
|
|
311
311
|
import AccountId from "./account/AccountId.js";
|
package/lib/PrivateKey.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{hexlify as t}from"@ethersproject/bytes";import{PrivateKey as e}from"@
|
|
1
|
+
import{hexlify as t}from"@ethersproject/bytes";import{PrivateKey as e}from"@hiero-ledger/cryptography";import{proto as r}from"@hiero-ledger/proto";import n from"./Mnemonic.js";import i from"./PublicKey.js";import o from"./Key.js";import s from"./Cache.js";import a from"./transaction/SignatureMap.js";import c from"./account/AccountId.js";import y from"./transaction/TransactionId.js";import{decode as u}from"./encoding/hex.js";import{ASN1Decoder as m}from"./util/ASN1-Decoder.js";class g extends o{constructor(t){super(),this._key=t}static generateED25519(){return new g(e.generateED25519())}static generateECDSA(){return new g(e.generateECDSA())}static generate(){return g.generateED25519()}static async generateAsync(){return new g(await e.generateAsync())}static async generateED25519Async(){return new g(await e.generateED25519Async())}static async generateECDSAAsync(){return new g(await e.generateECDSAAsync())}static fromBytes(r){const n=t(r);return g.isDerKey(n)?"ecdsa"===g.getAlgorithm(n)?new g(e.fromBytesECDSA(r)):new g(e.fromBytesED25519(r)):new g(e.fromBytes(r))}static fromBytesECDSA(t){return new g(e.fromBytesECDSA(t))}static fromBytesED25519(t){return new g(e.fromBytesED25519(t))}static fromString(t){return g.isDerKey(t)?this.fromStringDer(t):new g(e.fromString(t))}static fromStringDer(t){return g.isDerKey(t)?"ecdsa"===g.getAlgorithm(t)?this.fromStringECDSA(t):this.fromStringED25519(t):g.fromString(t)}static fromStringECDSA(t){return new g(e.fromStringECDSA(t))}static fromStringED25519(t){return new g(e.fromStringED25519(t))}static async fromSeedED25519(t){return new g(await e.fromSeedED25519(t))}static async fromSeedECDSAsecp256k1(t){return new g(await e.fromSeedECDSAsecp256k1(t))}static async fromMnemonic(t,r=""){return new g(t instanceof n?await e.fromMnemonic(t._mnemonic,r):await e.fromMnemonic(t,r))}static async fromKeystore(t,r=""){return new g(await e.fromKeystore(t,r))}static async fromPem(t,r=""){return new g(await e.fromPem(t,r))}async derive(t){return new g(await this._key.derive(t))}async legacyDerive(t){return new g(await this._key.legacyDerive(t))}get publicKey(){return new i(this._key.publicKey)}get chainCode(){return this._key._chainCode}sign(t){return this._key.sign(t)}signTransaction(t,e=!1){if(e)return this._signTransactionLegacy(t);const n=new a;for(const e of t._signedTransactions.list){const t=e.bodyBytes;if(!t)throw new Error("Body bytes are missing");const i=r.TransactionBody.decode(t);if(!i.transactionID||!i.nodeAccountID)throw new Error("Transaction ID or Node Account ID not found in the signed transaction");const o=c._fromProtobuf(i.nodeAccountID),s=y._fromProtobuf(i.transactionID),a=this._key.sign(t);n.addSignature(o,s,this.publicKey,a)}return t.addSignature(this.publicKey,n),n}_signTransactionLegacy(t){const e=t._signedTransactions.list.map(t=>{const e=t.bodyBytes;return e?this._key.sign(e):new Uint8Array});return t.addSignature(this.publicKey,e),1===e.length?e[0]:e}isDerivable(){return this._key.isDerivable()}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toString(){return this._key.toStringDer()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}toKeystore(t=""){return this._key.toKeystore(t)}_toProtobufKey(){return this.publicKey._toProtobufKey()}toAccountId(t,e){return this.publicKey.toAccountId(t,e)}get type(){return this._key._type}getRecoveryId(t,e,r){return this._key.getRecoveryId(t,e,r)}static getAlgorithm(t){if(!g.isDerKey(t))throw new Error("Only der keys are supported");const e=new m(Uint8Array.from(u(t)));e.read();return e.getOidKeyTypes()[0]}static isDerKey(t){try{const e=Uint8Array.from(u(t));return new m(e).read(),!0}catch(t){return!1}}}s.setPrivateKeyConstructor(t=>new g(t));export{g as default};
|
|
2
2
|
//# sourceMappingURL=PrivateKey.js.map
|
package/lib/PrivateKey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrivateKey.js","sources":["../src/PrivateKey.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { hexlify } from \"@ethersproject/bytes\";\nimport { PrivateKey as PrivateKeyCrypto } from \"@hashgraph/cryptography\";\nimport { proto } from \"@hashgraph/proto\";\nimport Mnemonic from \"./Mnemonic.js\";\nimport PublicKey from \"./PublicKey.js\";\nimport Key from \"./Key.js\";\nimport CACHE from \"./Cache.js\";\nimport SignatureMap from \"./transaction/SignatureMap.js\";\nimport AccountId from \"./account/AccountId.js\";\nimport TransactionId from \"./transaction/TransactionId.js\";\nimport { decode } from \"./encoding/hex.js\";\nimport { ASN1Decoder } from \"./util/ASN1-Decoder.js\";\n\n/**\n * @typedef {import(\"./transaction/Transaction.js\").default} Transaction\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HieroProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignaturePair} HieroProto.proto.ISignaturePair\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n */\n\nexport default class PrivateKey extends Key {\n /**\n * @internal\n * @hideconstructor\n * @param {PrivateKeyCrypto} key\n */\n constructor(key) {\n super();\n\n this._key = key;\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generateED25519() {\n return new PrivateKey(PrivateKeyCrypto.generateED25519());\n }\n\n /**\n * Generate a random EDSA private key.\n *\n * @returns {PrivateKey}\n */\n static generateECDSA() {\n return new PrivateKey(PrivateKeyCrypto.generateECDSA());\n }\n\n /**\n * Depredated - Use `generateED25519()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generate() {\n return PrivateKey.generateED25519();\n }\n\n /**\n * Depredated - Use `generateED25519Async()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise<PrivateKey>}\n */\n static async generateAsync() {\n return new PrivateKey(await PrivateKeyCrypto.generateAsync());\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise<PrivateKey>}\n */\n static async generateED25519Async() {\n return new PrivateKey(await PrivateKeyCrypto.generateED25519Async());\n }\n\n /**\n * Generate a random ECDSA private key.\n *\n * @returns {Promise<PrivateKey>}\n */\n static async generateECDSAAsync() {\n return new PrivateKey(await PrivateKeyCrypto.generateECDSAAsync());\n }\n\n /**\n * Construct a private key from bytes. Requires DER header.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytes(data) {\n const keyString = hexlify(data);\n if (PrivateKey.isDerKey(keyString)) {\n if (PrivateKey.getAlgorithm(keyString) === \"ecdsa\") {\n return new PrivateKey(PrivateKeyCrypto.fromBytesECDSA(data));\n } else {\n return new PrivateKey(PrivateKeyCrypto.fromBytesED25519(data));\n }\n }\n\n // If the key is not DER, we assume it's a raw private key\n // this will default to ED25519 as we dont have a way\n // to determine the type of the key based on the raw bytes\n return new PrivateKey(PrivateKeyCrypto.fromBytes(data));\n }\n\n /**\n * Construct a ECDSA private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesECDSA(data) {\n return new PrivateKey(PrivateKeyCrypto.fromBytesECDSA(data));\n }\n\n /**\n * Construct a ED25519 private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesED25519(data) {\n return new PrivateKey(PrivateKeyCrypto.fromBytesED25519(data));\n }\n\n /**\n * @deprecated - Use fromStringECDSA() or fromStringED2551() on a HEX-encoded string\n * and fromStringDer() on a HEX-encoded string with DER prefix instead.\n * Construct a private key from a hex-encoded string. Requires DER header.\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromString(text) {\n if (PrivateKey.isDerKey(text)) {\n return this.fromStringDer(text);\n }\n // If the key is not DER, we assume it's a raw private key\n // this will default to ED25519 as we dont have a way\n // to determine the type of the key based on the raw bytes\n return new PrivateKey(PrivateKeyCrypto.fromString(text));\n }\n\n /**\n * Construct a private key from a HEX-encoded string with a der prefix\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringDer(text) {\n // previous versions of the library used to accept non-der encoded private keys here\n // and it fallbacked to PrivateKey.fromString() so we need to keep this behavior\n if (!PrivateKey.isDerKey(text)) {\n // eslint-disable-next-line deprecation/deprecation\n return PrivateKey.fromString(text);\n }\n\n if (PrivateKey.getAlgorithm(text) === \"ecdsa\") {\n return this.fromStringECDSA(text);\n } else {\n return this.fromStringED25519(text);\n }\n }\n\n /**\n * Construct a ECDSA private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringECDSA(text) {\n return new PrivateKey(PrivateKeyCrypto.fromStringECDSA(text));\n }\n\n /**\n * Construct a Ed25519 private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringED25519(text) {\n return new PrivateKey(PrivateKeyCrypto.fromStringED25519(text));\n }\n\n /**\n * Construct a Ed25519 private key from a Uint8Array seed.\n *\n * @param {Uint8Array} seed\n * @returns {Promise<PrivateKey>}\n */\n static async fromSeedED25519(seed) {\n return new PrivateKey(await PrivateKeyCrypto.fromSeedED25519(seed));\n }\n\n /**\n * Construct a Ed25519 private key from a Uint8Array seed.\n *\n * @param {Uint8Array} seed\n * @returns {Promise<PrivateKey>}\n */\n static async fromSeedECDSAsecp256k1(seed) {\n return new PrivateKey(\n await PrivateKeyCrypto.fromSeedECDSAsecp256k1(seed),\n );\n }\n\n /**\n * @deprecated - Use `Mnemonic.from[Words|String]().to[Ed25519|Ecdsa]PrivateKey()` instead\n *\n * Recover a private key from a mnemonic phrase (and optionally a password).\n * @param {Mnemonic | string} mnemonic\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n */\n static async fromMnemonic(mnemonic, passphrase = \"\") {\n if (mnemonic instanceof Mnemonic) {\n return new PrivateKey(\n // eslint-disable-next-line deprecation/deprecation\n await PrivateKeyCrypto.fromMnemonic(\n mnemonic._mnemonic,\n passphrase,\n ),\n );\n }\n\n return new PrivateKey(\n // eslint-disable-next-line deprecation/deprecation\n await PrivateKeyCrypto.fromMnemonic(mnemonic, passphrase),\n );\n }\n\n /**\n * Recover a private key from a keystore, previously created by `.toKeystore()`.\n *\n * This key will _not_ support child key derivation.\n *\n * @param {Uint8Array} data\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n * @throws {cryptography.BadKeyError} If the passphrase is incorrect or the hash fails to validate.\n */\n static async fromKeystore(data, passphrase = \"\") {\n return new PrivateKey(\n await PrivateKeyCrypto.fromKeystore(data, passphrase),\n );\n }\n\n /**\n * Recover a private key from a pem string; the private key may be encrypted.\n *\n * This method assumes the .pem file has been converted to a string already.\n *\n * If `passphrase` is not null or empty, this looks for the first `ENCRYPTED PRIVATE KEY`\n * section and uses `passphrase` to decrypt it; otherwise, it looks for the first `PRIVATE KEY`\n * section and decodes that as a DER-encoded private key.\n *\n * @param {string} data\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n */\n static async fromPem(data, passphrase = \"\") {\n return new PrivateKey(await PrivateKeyCrypto.fromPem(data, passphrase));\n }\n\n /**\n * Derive a new private key at the given wallet index.\n *\n * Only currently supported for keys created with `fromMnemonic()`; other keys will throw\n * an error.\n *\n * You can check if a key supports derivation with `.supportsDerivation()`\n *\n * @param {number} index\n * @returns {Promise<PrivateKey>}\n * @throws If this key does not support derivation.\n */\n async derive(index) {\n return new PrivateKey(await this._key.derive(index));\n }\n\n /**\n * @param {number} index\n * @returns {Promise<PrivateKey>}\n * @throws If this key does not support derivation.\n */\n async legacyDerive(index) {\n return new PrivateKey(await this._key.legacyDerive(index));\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {PublicKey}\n */\n get publicKey() {\n return new PublicKey(this._key.publicKey);\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {?Uint8Array}\n */\n get chainCode() {\n return this._key._chainCode;\n }\n\n /**\n * Sign a message with this private key.\n *\n * @param {Uint8Array} bytes\n * @returns {Uint8Array} - The signature bytes without the message\n */\n sign(bytes) {\n return this._key.sign(bytes);\n }\n\n /**\n * @deprecated - Use legacy=false flag to use the modern approach\n * or don't pass it at all.\n * @overload\n * @param {Transaction} transaction\n * @param {true} legacy\n * @returns {Uint8Array | Uint8Array[] }\n */\n\n /**\n * @overload\n * @param {Transaction} transaction\n * @param {false} [legacy]\n * @returns {SignatureMap}\n */\n\n /**\n * @param {Transaction} transaction\n * @param {boolean} [legacy]\n * @returns {Uint8Array | Uint8Array[] | SignatureMap}\n */\n signTransaction(transaction, legacy = false) {\n if (legacy) {\n return this._signTransactionLegacy(transaction);\n }\n\n const sigMap = new SignatureMap();\n\n for (const signedTx of transaction._signedTransactions.list) {\n const bodyBytes = signedTx.bodyBytes;\n if (!bodyBytes) throw new Error(\"Body bytes are missing\");\n\n const body = proto.TransactionBody.decode(bodyBytes);\n if (!body.transactionID || !body.nodeAccountID) {\n throw new Error(\n \"Transaction ID or Node Account ID not found in the signed transaction\",\n );\n }\n\n const nodeId = AccountId._fromProtobuf(body.nodeAccountID);\n const transactionId = TransactionId._fromProtobuf(\n body.transactionID,\n );\n const sig = this._key.sign(bodyBytes);\n sigMap.addSignature(nodeId, transactionId, this.publicKey, sig);\n }\n\n transaction.addSignature(this.publicKey, sigMap);\n return sigMap;\n }\n\n /**\n * deprecated - This method is deprecated and will be removed in future versions.\n * Use the `signTransaction` method with the `legacy=false` flag or don't\n * pass it all for the modern approach.\n * @param {Transaction} transaction\n * @returns {Uint8Array | Uint8Array[]}\n */\n _signTransactionLegacy(transaction) {\n const signatures = transaction._signedTransactions.list.map(\n (signedTransaction) => {\n const bodyBytes = signedTransaction.bodyBytes;\n if (!bodyBytes) {\n return new Uint8Array();\n }\n\n return this._key.sign(bodyBytes);\n },\n );\n transaction.addSignature(this.publicKey, signatures);\n // Return directly Uint8Array if there is only one signature\n return signatures.length === 1 ? signatures[0] : signatures;\n }\n\n /**\n * Check if `derive` can be called on this private key.\n *\n * This is only the case if the key was created from a mnemonic.\n *\n * @returns {boolean}\n */\n isDerivable() {\n return this._key.isDerivable();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return this._key.toBytes();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n return this._key.toBytesDer();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return this._key.toBytesRaw();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._key.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringDer() {\n return this._key.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringRaw() {\n return this._key.toStringRaw();\n }\n\n /**\n * Create a keystore with a given passphrase.\n *\n * The key can be recovered later with `fromKeystore()`.\n *\n * Note that this will not retain the ancillary data used for\n * deriving child keys, thus `.derive()` on the restored key will\n * throw even if this instance supports derivation.\n *\n * @param {string} [passphrase]\n * @returns {Promise<Uint8Array>}\n */\n toKeystore(passphrase = \"\") {\n return this._key.toKeystore(passphrase);\n }\n\n /**\n * @returns {HieroProto.proto.IKey}\n */\n _toProtobufKey() {\n return this.publicKey._toProtobufKey();\n }\n\n /**\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @returns {AccountId}\n */\n toAccountId(shard, realm) {\n return this.publicKey.toAccountId(shard, realm);\n }\n\n /**\n * @returns {string}\n */\n get type() {\n return this._key._type;\n }\n\n /**\n * Recover the recovery ID used in the signature for the given message.\n *\n * **Note:** This method only works for ECDSA secp256k1 keys.\n * @param {Uint8Array} r - 32-byte `r` component of the signature\n * @param {Uint8Array} s - 32-byte `s` component of the signature\n * @param {Uint8Array} message - The original (unhashed) message\n * @returns {number} Recovery ID (0–3), or -1 if not found or not applicable\n */\n getRecoveryId(r, s, message) {\n return this._key.getRecoveryId(r, s, message);\n }\n\n /**\n * @param {string} privateKey\n * @returns { \"ecdsa\" | \"ed25519\"}\n */\n static getAlgorithm(privateKey) {\n if (!PrivateKey.isDerKey(privateKey)) {\n throw new Error(\"Only der keys are supported\");\n }\n\n const decoder = new ASN1Decoder(Uint8Array.from(decode(privateKey)));\n decoder.read();\n const decodedKeyType = decoder.getOidKeyTypes()[0];\n // @ts-ignored\n return decodedKeyType;\n }\n\n /**\n * @internal\n * @param {string} key\n * @returns {boolean}\n */\n static isDerKey(key) {\n try {\n const data = Uint8Array.from(decode(key));\n const decoder = new ASN1Decoder(data);\n decoder.read(); // Attempt to read the ASN.1 structure\n return true;\n } catch (error) {\n return false;\n }\n }\n}\n\nCACHE.setPrivateKeyConstructor((key) => new PrivateKey(key));\n"],"names":["PrivateKey","Key","constructor","key","super","this","_key","generateED25519","PrivateKeyCrypto","generateECDSA","generate","generateAsync","generateED25519Async","generateECDSAAsync","fromBytes","data","keyString","hexlify","isDerKey","getAlgorithm","fromBytesECDSA","fromBytesED25519","fromString","text","fromStringDer","fromStringECDSA","fromStringED25519","fromSeedED25519","seed","fromSeedECDSAsecp256k1","fromMnemonic","mnemonic","passphrase","Mnemonic","_mnemonic","fromKeystore","fromPem","derive","index","legacyDerive","publicKey","PublicKey","chainCode","_chainCode","sign","bytes","signTransaction","transaction","legacy","_signTransactionLegacy","sigMap","SignatureMap","signedTx","_signedTransactions","list","bodyBytes","Error","body","proto","TransactionBody","decode","transactionID","nodeAccountID","nodeId","AccountId","_fromProtobuf","transactionId","TransactionId","sig","addSignature","signatures","map","signedTransaction","Uint8Array","length","isDerivable","toBytes","toBytesDer","toBytesRaw","toString","toStringDer","toStringRaw","toKeystore","_toProtobufKey","toAccountId","shard","realm","type","_type","getRecoveryId","r","s","message","privateKey","decoder","ASN1Decoder","from","read","getOidKeyTypes","error","CACHE","setPrivateKeyConstructor"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"PrivateKey.js","sources":["../src/PrivateKey.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { hexlify } from \"@ethersproject/bytes\";\nimport { PrivateKey as PrivateKeyCrypto } from \"@hiero-ledger/cryptography\";\nimport { proto } from \"@hiero-ledger/proto\";\nimport Mnemonic from \"./Mnemonic.js\";\nimport PublicKey from \"./PublicKey.js\";\nimport Key from \"./Key.js\";\nimport CACHE from \"./Cache.js\";\nimport SignatureMap from \"./transaction/SignatureMap.js\";\nimport AccountId from \"./account/AccountId.js\";\nimport TransactionId from \"./transaction/TransactionId.js\";\nimport { decode } from \"./encoding/hex.js\";\nimport { ASN1Decoder } from \"./util/ASN1-Decoder.js\";\n\n/**\n * @typedef {import(\"./transaction/Transaction.js\").default} Transaction\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IKey} HieroProto.proto.IKey\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.ISignaturePair} HieroProto.proto.ISignaturePair\n * @typedef {import(\"@hiero-ledger/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n */\n\nexport default class PrivateKey extends Key {\n /**\n * @internal\n * @hideconstructor\n * @param {PrivateKeyCrypto} key\n */\n constructor(key) {\n super();\n\n this._key = key;\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generateED25519() {\n return new PrivateKey(PrivateKeyCrypto.generateED25519());\n }\n\n /**\n * Generate a random EDSA private key.\n *\n * @returns {PrivateKey}\n */\n static generateECDSA() {\n return new PrivateKey(PrivateKeyCrypto.generateECDSA());\n }\n\n /**\n * Depredated - Use `generateED25519()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {PrivateKey}\n */\n static generate() {\n return PrivateKey.generateED25519();\n }\n\n /**\n * Depredated - Use `generateED25519Async()` instead\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise<PrivateKey>}\n */\n static async generateAsync() {\n return new PrivateKey(await PrivateKeyCrypto.generateAsync());\n }\n\n /**\n * Generate a random Ed25519 private key.\n *\n * @returns {Promise<PrivateKey>}\n */\n static async generateED25519Async() {\n return new PrivateKey(await PrivateKeyCrypto.generateED25519Async());\n }\n\n /**\n * Generate a random ECDSA private key.\n *\n * @returns {Promise<PrivateKey>}\n */\n static async generateECDSAAsync() {\n return new PrivateKey(await PrivateKeyCrypto.generateECDSAAsync());\n }\n\n /**\n * Construct a private key from bytes. Requires DER header.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytes(data) {\n const keyString = hexlify(data);\n if (PrivateKey.isDerKey(keyString)) {\n if (PrivateKey.getAlgorithm(keyString) === \"ecdsa\") {\n return new PrivateKey(PrivateKeyCrypto.fromBytesECDSA(data));\n } else {\n return new PrivateKey(PrivateKeyCrypto.fromBytesED25519(data));\n }\n }\n\n // If the key is not DER, we assume it's a raw private key\n // this will default to ED25519 as we dont have a way\n // to determine the type of the key based on the raw bytes\n return new PrivateKey(PrivateKeyCrypto.fromBytes(data));\n }\n\n /**\n * Construct a ECDSA private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesECDSA(data) {\n return new PrivateKey(PrivateKeyCrypto.fromBytesECDSA(data));\n }\n\n /**\n * Construct a ED25519 private key from bytes.\n *\n * @param {Uint8Array} data\n * @returns {PrivateKey}\n */\n static fromBytesED25519(data) {\n return new PrivateKey(PrivateKeyCrypto.fromBytesED25519(data));\n }\n\n /**\n * @deprecated - Use fromStringECDSA() or fromStringED2551() on a HEX-encoded string\n * and fromStringDer() on a HEX-encoded string with DER prefix instead.\n * Construct a private key from a hex-encoded string. Requires DER header.\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromString(text) {\n if (PrivateKey.isDerKey(text)) {\n return this.fromStringDer(text);\n }\n // If the key is not DER, we assume it's a raw private key\n // this will default to ED25519 as we dont have a way\n // to determine the type of the key based on the raw bytes\n return new PrivateKey(PrivateKeyCrypto.fromString(text));\n }\n\n /**\n * Construct a private key from a HEX-encoded string with a der prefix\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringDer(text) {\n // previous versions of the library used to accept non-der encoded private keys here\n // and it fallbacked to PrivateKey.fromString() so we need to keep this behavior\n if (!PrivateKey.isDerKey(text)) {\n // eslint-disable-next-line deprecation/deprecation\n return PrivateKey.fromString(text);\n }\n\n if (PrivateKey.getAlgorithm(text) === \"ecdsa\") {\n return this.fromStringECDSA(text);\n } else {\n return this.fromStringED25519(text);\n }\n }\n\n /**\n * Construct a ECDSA private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringECDSA(text) {\n return new PrivateKey(PrivateKeyCrypto.fromStringECDSA(text));\n }\n\n /**\n * Construct a Ed25519 private key from a hex-encoded string.\n *\n * @param {string} text\n * @returns {PrivateKey}\n */\n static fromStringED25519(text) {\n return new PrivateKey(PrivateKeyCrypto.fromStringED25519(text));\n }\n\n /**\n * Construct a Ed25519 private key from a Uint8Array seed.\n *\n * @param {Uint8Array} seed\n * @returns {Promise<PrivateKey>}\n */\n static async fromSeedED25519(seed) {\n return new PrivateKey(await PrivateKeyCrypto.fromSeedED25519(seed));\n }\n\n /**\n * Construct a Ed25519 private key from a Uint8Array seed.\n *\n * @param {Uint8Array} seed\n * @returns {Promise<PrivateKey>}\n */\n static async fromSeedECDSAsecp256k1(seed) {\n return new PrivateKey(\n await PrivateKeyCrypto.fromSeedECDSAsecp256k1(seed),\n );\n }\n\n /**\n * @deprecated - Use `Mnemonic.from[Words|String]().to[Ed25519|Ecdsa]PrivateKey()` instead\n *\n * Recover a private key from a mnemonic phrase (and optionally a password).\n * @param {Mnemonic | string} mnemonic\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n */\n static async fromMnemonic(mnemonic, passphrase = \"\") {\n if (mnemonic instanceof Mnemonic) {\n return new PrivateKey(\n // eslint-disable-next-line deprecation/deprecation\n await PrivateKeyCrypto.fromMnemonic(\n mnemonic._mnemonic,\n passphrase,\n ),\n );\n }\n\n return new PrivateKey(\n // eslint-disable-next-line deprecation/deprecation\n await PrivateKeyCrypto.fromMnemonic(mnemonic, passphrase),\n );\n }\n\n /**\n * Recover a private key from a keystore, previously created by `.toKeystore()`.\n *\n * This key will _not_ support child key derivation.\n *\n * @param {Uint8Array} data\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n * @throws {cryptography.BadKeyError} If the passphrase is incorrect or the hash fails to validate.\n */\n static async fromKeystore(data, passphrase = \"\") {\n return new PrivateKey(\n await PrivateKeyCrypto.fromKeystore(data, passphrase),\n );\n }\n\n /**\n * Recover a private key from a pem string; the private key may be encrypted.\n *\n * This method assumes the .pem file has been converted to a string already.\n *\n * If `passphrase` is not null or empty, this looks for the first `ENCRYPTED PRIVATE KEY`\n * section and uses `passphrase` to decrypt it; otherwise, it looks for the first `PRIVATE KEY`\n * section and decodes that as a DER-encoded private key.\n *\n * @param {string} data\n * @param {string} [passphrase]\n * @returns {Promise<PrivateKey>}\n */\n static async fromPem(data, passphrase = \"\") {\n return new PrivateKey(await PrivateKeyCrypto.fromPem(data, passphrase));\n }\n\n /**\n * Derive a new private key at the given wallet index.\n *\n * Only currently supported for keys created with `fromMnemonic()`; other keys will throw\n * an error.\n *\n * You can check if a key supports derivation with `.supportsDerivation()`\n *\n * @param {number} index\n * @returns {Promise<PrivateKey>}\n * @throws If this key does not support derivation.\n */\n async derive(index) {\n return new PrivateKey(await this._key.derive(index));\n }\n\n /**\n * @param {number} index\n * @returns {Promise<PrivateKey>}\n * @throws If this key does not support derivation.\n */\n async legacyDerive(index) {\n return new PrivateKey(await this._key.legacyDerive(index));\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {PublicKey}\n */\n get publicKey() {\n return new PublicKey(this._key.publicKey);\n }\n\n /**\n * Get the public key associated with this private key.\n *\n * The public key can be freely given and used by other parties to verify\n * the signatures generated by this private key.\n *\n * @returns {?Uint8Array}\n */\n get chainCode() {\n return this._key._chainCode;\n }\n\n /**\n * Sign a message with this private key.\n *\n * @param {Uint8Array} bytes\n * @returns {Uint8Array} - The signature bytes without the message\n */\n sign(bytes) {\n return this._key.sign(bytes);\n }\n\n /**\n * @deprecated - Use legacy=false flag to use the modern approach\n * or don't pass it at all.\n * @overload\n * @param {Transaction} transaction\n * @param {true} legacy\n * @returns {Uint8Array | Uint8Array[] }\n */\n\n /**\n * @overload\n * @param {Transaction} transaction\n * @param {false} [legacy]\n * @returns {SignatureMap}\n */\n\n /**\n * @param {Transaction} transaction\n * @param {boolean} [legacy]\n * @returns {Uint8Array | Uint8Array[] | SignatureMap}\n */\n signTransaction(transaction, legacy = false) {\n if (legacy) {\n return this._signTransactionLegacy(transaction);\n }\n\n const sigMap = new SignatureMap();\n\n for (const signedTx of transaction._signedTransactions.list) {\n const bodyBytes = signedTx.bodyBytes;\n if (!bodyBytes) throw new Error(\"Body bytes are missing\");\n\n const body = proto.TransactionBody.decode(bodyBytes);\n if (!body.transactionID || !body.nodeAccountID) {\n throw new Error(\n \"Transaction ID or Node Account ID not found in the signed transaction\",\n );\n }\n\n const nodeId = AccountId._fromProtobuf(body.nodeAccountID);\n const transactionId = TransactionId._fromProtobuf(\n body.transactionID,\n );\n const sig = this._key.sign(bodyBytes);\n sigMap.addSignature(nodeId, transactionId, this.publicKey, sig);\n }\n\n transaction.addSignature(this.publicKey, sigMap);\n return sigMap;\n }\n\n /**\n * deprecated - This method is deprecated and will be removed in future versions.\n * Use the `signTransaction` method with the `legacy=false` flag or don't\n * pass it all for the modern approach.\n * @param {Transaction} transaction\n * @returns {Uint8Array | Uint8Array[]}\n */\n _signTransactionLegacy(transaction) {\n const signatures = transaction._signedTransactions.list.map(\n (signedTransaction) => {\n const bodyBytes = signedTransaction.bodyBytes;\n if (!bodyBytes) {\n return new Uint8Array();\n }\n\n return this._key.sign(bodyBytes);\n },\n );\n transaction.addSignature(this.publicKey, signatures);\n // Return directly Uint8Array if there is only one signature\n return signatures.length === 1 ? signatures[0] : signatures;\n }\n\n /**\n * Check if `derive` can be called on this private key.\n *\n * This is only the case if the key was created from a mnemonic.\n *\n * @returns {boolean}\n */\n isDerivable() {\n return this._key.isDerivable();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return this._key.toBytes();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesDer() {\n return this._key.toBytesDer();\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytesRaw() {\n return this._key.toBytesRaw();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return this._key.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringDer() {\n return this._key.toStringDer();\n }\n\n /**\n * @returns {string}\n */\n toStringRaw() {\n return this._key.toStringRaw();\n }\n\n /**\n * Create a keystore with a given passphrase.\n *\n * The key can be recovered later with `fromKeystore()`.\n *\n * Note that this will not retain the ancillary data used for\n * deriving child keys, thus `.derive()` on the restored key will\n * throw even if this instance supports derivation.\n *\n * @param {string} [passphrase]\n * @returns {Promise<Uint8Array>}\n */\n toKeystore(passphrase = \"\") {\n return this._key.toKeystore(passphrase);\n }\n\n /**\n * @returns {HieroProto.proto.IKey}\n */\n _toProtobufKey() {\n return this.publicKey._toProtobufKey();\n }\n\n /**\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @returns {AccountId}\n */\n toAccountId(shard, realm) {\n return this.publicKey.toAccountId(shard, realm);\n }\n\n /**\n * @returns {string}\n */\n get type() {\n return this._key._type;\n }\n\n /**\n * Recover the recovery ID used in the signature for the given message.\n *\n * **Note:** This method only works for ECDSA secp256k1 keys.\n * @param {Uint8Array} r - 32-byte `r` component of the signature\n * @param {Uint8Array} s - 32-byte `s` component of the signature\n * @param {Uint8Array} message - The original (unhashed) message\n * @returns {number} Recovery ID (0–3), or -1 if not found or not applicable\n */\n getRecoveryId(r, s, message) {\n return this._key.getRecoveryId(r, s, message);\n }\n\n /**\n * @param {string} privateKey\n * @returns { \"ecdsa\" | \"ed25519\"}\n */\n static getAlgorithm(privateKey) {\n if (!PrivateKey.isDerKey(privateKey)) {\n throw new Error(\"Only der keys are supported\");\n }\n\n const decoder = new ASN1Decoder(Uint8Array.from(decode(privateKey)));\n decoder.read();\n const decodedKeyType = decoder.getOidKeyTypes()[0];\n // @ts-ignored\n return decodedKeyType;\n }\n\n /**\n * @internal\n * @param {string} key\n * @returns {boolean}\n */\n static isDerKey(key) {\n try {\n const data = Uint8Array.from(decode(key));\n const decoder = new ASN1Decoder(data);\n decoder.read(); // Attempt to read the ASN.1 structure\n return true;\n } catch (error) {\n return false;\n }\n }\n}\n\nCACHE.setPrivateKeyConstructor((key) => new PrivateKey(key));\n"],"names":["PrivateKey","Key","constructor","key","super","this","_key","generateED25519","PrivateKeyCrypto","generateECDSA","generate","generateAsync","generateED25519Async","generateECDSAAsync","fromBytes","data","keyString","hexlify","isDerKey","getAlgorithm","fromBytesECDSA","fromBytesED25519","fromString","text","fromStringDer","fromStringECDSA","fromStringED25519","fromSeedED25519","seed","fromSeedECDSAsecp256k1","fromMnemonic","mnemonic","passphrase","Mnemonic","_mnemonic","fromKeystore","fromPem","derive","index","legacyDerive","publicKey","PublicKey","chainCode","_chainCode","sign","bytes","signTransaction","transaction","legacy","_signTransactionLegacy","sigMap","SignatureMap","signedTx","_signedTransactions","list","bodyBytes","Error","body","proto","TransactionBody","decode","transactionID","nodeAccountID","nodeId","AccountId","_fromProtobuf","transactionId","TransactionId","sig","addSignature","signatures","map","signedTransaction","Uint8Array","length","isDerivable","toBytes","toBytesDer","toBytesRaw","toString","toStringDer","toStringRaw","toKeystore","_toProtobufKey","toAccountId","shard","realm","type","_type","getRecoveryId","r","s","message","privateKey","decoder","ASN1Decoder","from","read","getOidKeyTypes","error","CACHE","setPrivateKeyConstructor"],"mappings":"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"}
|
package/lib/PrngTransaction.cjs
CHANGED
|
@@ -10,15 +10,15 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @typedef {import("@
|
|
14
|
-
* @typedef {import("@
|
|
15
|
-
* @typedef {import("@
|
|
16
|
-
* @typedef {import("@
|
|
17
|
-
* @typedef {import("@
|
|
18
|
-
* @typedef {import("@
|
|
19
|
-
* @typedef {import("@
|
|
20
|
-
* @typedef {import("@
|
|
21
|
-
* @typedef {import("@
|
|
13
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
14
|
+
* @typedef {import("@hiero-ledger/proto").proto.Transaction} HieroProto.proto.Transaction
|
|
15
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
16
|
+
* @typedef {import("@hiero-ledger/proto").proto.SignedTransaction} HieroProto.proto.SignedTransaction
|
|
17
|
+
* @typedef {import("@hiero-ledger/proto").proto.IUtilPrngTransactionBody } HieroProto.proto.IUtilPrngTransactionBody
|
|
18
|
+
* @typedef {import("@hiero-ledger/proto").proto.UtilPrngTransactionBody} HieroProto.proto.UtilPrngTransactionBody
|
|
19
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionResponse} HieroProto.proto.TransactionResponse
|
|
20
|
+
* @typedef {import("@hiero-ledger/proto").proto.TransactionBody} HieroProto.proto.TransactionBody
|
|
21
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionBody} HieroProto.proto.ITransactionBody
|
|
22
22
|
* @typedef {import("./account/AccountId.js").default} AccountId
|
|
23
23
|
* @typedef {import("./transaction/TransactionId.js").default} TransactionId
|
|
24
24
|
*/
|
package/lib/PrngTransaction.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import("@
|
|
3
|
-
* @typedef {import("@
|
|
4
|
-
* @typedef {import("@
|
|
5
|
-
* @typedef {import("@
|
|
6
|
-
* @typedef {import("@
|
|
7
|
-
* @typedef {import("@
|
|
8
|
-
* @typedef {import("@
|
|
9
|
-
* @typedef {import("@
|
|
10
|
-
* @typedef {import("@
|
|
2
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
3
|
+
* @typedef {import("@hiero-ledger/proto").proto.Transaction} HieroProto.proto.Transaction
|
|
4
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
5
|
+
* @typedef {import("@hiero-ledger/proto").proto.SignedTransaction} HieroProto.proto.SignedTransaction
|
|
6
|
+
* @typedef {import("@hiero-ledger/proto").proto.IUtilPrngTransactionBody } HieroProto.proto.IUtilPrngTransactionBody
|
|
7
|
+
* @typedef {import("@hiero-ledger/proto").proto.UtilPrngTransactionBody} HieroProto.proto.UtilPrngTransactionBody
|
|
8
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionResponse} HieroProto.proto.TransactionResponse
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.TransactionBody} HieroProto.proto.TransactionBody
|
|
10
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionBody} HieroProto.proto.ITransactionBody
|
|
11
11
|
* @typedef {import("./account/AccountId.js").default} AccountId
|
|
12
12
|
* @typedef {import("./transaction/TransactionId.js").default} TransactionId
|
|
13
13
|
*/
|
|
@@ -56,15 +56,15 @@ export default class PrngTransaction extends Transaction {
|
|
|
56
56
|
}
|
|
57
57
|
export namespace HieroProto {
|
|
58
58
|
namespace proto {
|
|
59
|
-
type ITransaction = import("@
|
|
60
|
-
type Transaction = import("@
|
|
61
|
-
type ISignedTransaction = import("@
|
|
62
|
-
type SignedTransaction = import("@
|
|
63
|
-
type IUtilPrngTransactionBody = import("@
|
|
64
|
-
type UtilPrngTransactionBody = import("@
|
|
65
|
-
type TransactionResponse = import("@
|
|
66
|
-
type TransactionBody = import("@
|
|
67
|
-
type ITransactionBody = import("@
|
|
59
|
+
type ITransaction = import("@hiero-ledger/proto").proto.ITransaction;
|
|
60
|
+
type Transaction = import("@hiero-ledger/proto").proto.Transaction;
|
|
61
|
+
type ISignedTransaction = import("@hiero-ledger/proto").proto.ISignedTransaction;
|
|
62
|
+
type SignedTransaction = import("@hiero-ledger/proto").proto.SignedTransaction;
|
|
63
|
+
type IUtilPrngTransactionBody = import("@hiero-ledger/proto").proto.IUtilPrngTransactionBody;
|
|
64
|
+
type UtilPrngTransactionBody = import("@hiero-ledger/proto").proto.UtilPrngTransactionBody;
|
|
65
|
+
type TransactionResponse = import("@hiero-ledger/proto").proto.ITransactionResponse;
|
|
66
|
+
type TransactionBody = import("@hiero-ledger/proto").proto.TransactionBody;
|
|
67
|
+
type ITransactionBody = import("@hiero-ledger/proto").proto.ITransactionBody;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
export type AccountId = import("./account/AccountId.js").default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrngTransaction.js","sources":["../src/PrngTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"./transaction/Transaction.js\";\nimport { isNumber } from \"./util.js\";\n\n/**\n * @typedef {import(\"@
|
|
1
|
+
{"version":3,"file":"PrngTransaction.js","sources":["../src/PrngTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"./transaction/Transaction.js\";\nimport { isNumber } from \"./util.js\";\n\n/**\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.Transaction} HieroProto.proto.Transaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.SignedTransaction} HieroProto.proto.SignedTransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.IUtilPrngTransactionBody } HieroProto.proto.IUtilPrngTransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.UtilPrngTransactionBody} HieroProto.proto.UtilPrngTransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionResponse} HieroProto.proto.TransactionResponse\n * @typedef {import(\"@hiero-ledger/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n */\n\n/**\n * Gets a pseudorandom 32-bit number. Not cryptographically secure. See HIP-351 https://hips.hedera.com/hip/hip-351\n */\nexport default class PrngTransaction extends Transaction {\n /**\n * @param {object} props\n * @param {?number } [props.range]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?number}\n */\n this._range = null;\n\n if (props.range != null) {\n this.setRange(props.range);\n }\n }\n\n /**\n * @param {number} newRange\n * @returns {this}\n */\n setRange(newRange) {\n this._range = newRange;\n return this;\n }\n\n get range() {\n return this._range;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._range != null && isNumber(this._range)) {\n this._validateChecksums(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.TransactionResponse>}\n */\n _execute(channel, request) {\n return channel.util.prng(request);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {PrngTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = /** @type {HieroProto.proto.ITransactionBody} */ (\n bodies[0]\n );\n const transactionRange =\n /** @type {HieroProto.proto.IUtilPrngTransactionBody} */ (\n body.utilPrng\n );\n return Transaction._fromProtobufTransactions(\n new PrngTransaction({\n range: transactionRange.range,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"utilPrng\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IUtilPrngTransactionBody}\n */\n _makeTransactionData() {\n return {\n range: this.range,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"./Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `RandomGenerate:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"utilPrng\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n PrngTransaction._fromProtobuf,\n);\n"],"names":["PrngTransaction","Transaction","constructor","props","super","this","_range","range","setRange","newRange","_validateChecksums","client","isNumber","_execute","channel","request","util","prng","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","transactionRange","_fromProtobufTransactions","_getTransactionDataCase","_makeTransactionData","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"4GA6Be,MAAMA,UAAwBC,EAKzC,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,OAAS,KAEK,MAAfH,EAAMI,OACNF,KAAKG,SAASL,EAAMI,MAEhC,CAMI,QAAAC,CAASC,GAEL,OADAJ,KAAKC,OAASG,EACPJ,IACf,CAEI,SAAIE,GACA,OAAOF,KAAKC,MACpB,CAKI,kBAAAI,CAAmBC,GACI,MAAfN,KAAKC,QAAkBM,EAASP,KAAKC,SACrCD,KAAKK,mBAAmBC,EAEpC,CASI,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,KAAKC,KAAKF,EACjC,CAWI,oBAAOG,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MAGMC,EAFFD,EAAO,GAKN,SACL,OAAOtB,EAAYwB,0BACf,IAAIzB,EAAgB,CAChBO,MAAOiB,EAAiBjB,QAE5BY,EACAC,EACAC,EACAC,EACAC,EAEZ,CAOI,uBAAAG,GACI,MAAO,UACf,CAOI,oBAAAC,GACI,MAAO,CACHpB,MAAOF,KAAKE,MAExB,CAKI,SAAAqB,GAII,MAAO,kBAFHvB,KAAKwB,gBAAgBC,QACxB,WACkCC,YAC3C,EAGAC,EAAqBC,IACjB,WAEAjC,EAAgBkB"}
|
package/lib/PublicKey.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _cryptography = require("@
|
|
7
|
+
var _cryptography = require("@hiero-ledger/cryptography");
|
|
8
8
|
var _array = require("./array.cjs");
|
|
9
9
|
var _Key = _interopRequireDefault(require("./Key.cjs"));
|
|
10
10
|
var _Cache = _interopRequireDefault(require("./Cache.cjs"));
|
|
@@ -18,10 +18,10 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @namespace proto
|
|
21
|
-
* @typedef {import("@
|
|
22
|
-
* @typedef {import("@
|
|
23
|
-
* @typedef {import("@
|
|
24
|
-
* @typedef {import("@
|
|
21
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
22
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
23
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignaturePair} HieroProto.proto.ISignaturePair
|
|
24
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
class PublicKey extends _Key.default {
|
package/lib/PublicKey.d.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @namespace proto
|
|
7
|
-
* @typedef {import("@
|
|
8
|
-
* @typedef {import("@
|
|
9
|
-
* @typedef {import("@
|
|
10
|
-
* @typedef {import("@
|
|
7
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
8
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignaturePair} HieroProto.proto.ISignaturePair
|
|
10
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
11
11
|
*/
|
|
12
12
|
export default class PublicKey extends Key {
|
|
13
13
|
/**
|
|
@@ -132,11 +132,11 @@ export type Transaction = import("./transaction/Transaction.js").default;
|
|
|
132
132
|
export type AccountId = import("./account/AccountId.js").default;
|
|
133
133
|
export namespace HieroProto {
|
|
134
134
|
namespace proto {
|
|
135
|
-
type IKey = import("@
|
|
136
|
-
type ITransaction = import("@
|
|
137
|
-
type ISignaturePair = import("@
|
|
138
|
-
type ISignedTransaction = import("@
|
|
135
|
+
type IKey = import("@hiero-ledger/proto").proto.IKey;
|
|
136
|
+
type ITransaction = import("@hiero-ledger/proto").proto.ITransaction;
|
|
137
|
+
type ISignaturePair = import("@hiero-ledger/proto").proto.ISignaturePair;
|
|
138
|
+
type ISignedTransaction = import("@hiero-ledger/proto").proto.ISignedTransaction;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
import Key from "./Key.js";
|
|
142
|
-
import { PublicKey as PublicKeyCrypto } from "@
|
|
142
|
+
import { PublicKey as PublicKeyCrypto } from "@hiero-ledger/cryptography";
|
package/lib/PublicKey.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{PublicKey as t}from"@
|
|
1
|
+
import{PublicKey as t}from"@hiero-ledger/cryptography";import{arrayEqual as e}from"./array.js";import r from"./Key.js";import s from"./Cache.js";class i extends r{constructor(t){super(),this._key=t}static fromBytes(e){return new i(t.fromBytes(e))}static fromBytesED25519(e){return new i(t.fromBytesED25519(e))}static fromBytesECDSA(e){return new i(t.fromBytesECDSA(e))}static fromString(e){return new i(t.fromString(e))}static fromStringECDSA(e){return new i(t.fromStringECDSA(e))}static fromStringED25519(e){return new i(t.fromStringED25519(e))}verify(t,e){return this._key.verify(t,e)}verifyTransaction(t){t._requireFrozen(),t.isFrozen()||t.freeze();for(const r of t._signedTransactions.list)if(null!=r.sigMap&&null!=r.sigMap.sigPair){let t=!1;for(const s of r.sigMap.sigPair){const i=s.pubKeyPrefix;if(e(i,this.toBytesRaw())){t=!0;const e=r.bodyBytes;let i=null;if(null!=s.ed25519?i=s.ed25519:null!=s.ECDSASecp256k1&&(i=s.ECDSASecp256k1),null==i)continue;if(!this.verify(e,i))return!1}}if(!t)return!1}return!0}toBytes(){return this._key.toBytes()}toBytesDer(){return this._key.toBytesDer()}toBytesRaw(){return this._key.toBytesRaw()}toEthereumAddress(){return this._key.toEthereumAddress()}toEvmAddress(){return this._key.toEthereumAddress()}toString(){return this._key.toString()}toStringDer(){return this._key.toStringDer()}toStringRaw(){return this._key.toStringRaw()}equals(t){return this._key.equals(t._key)}_toProtobufKey(){switch(this._key._type){case"ED25519":return{ed25519:this._key.toBytesRaw()};case"secp256k1":return{ECDSASecp256k1:this._key.toBytesRaw()};default:throw new Error(`unrecognized key type ${this._key._type}`)}}_toProtobufSignature(t){switch(this._key._type){case"ED25519":return{pubKeyPrefix:this._key.toBytesRaw(),ed25519:t};case"secp256k1":return{pubKeyPrefix:this._key.toBytesRaw(),ECDSASecp256k1:t};default:throw new Error(`unrecognized key type ${this._key._type}`)}}get type(){return this._key._type}toAccountId(t,e){return s.accountIdConstructor(t,e,this)}static unusableKey(){return i.fromStringED25519("0000000000000000000000000000000000000000000000000000000000000000")}}s.setPublicKeyED25519(t=>i.fromBytesED25519(t)),s.setPublicKeyECDSA(t=>i.fromBytesECDSA(t));export{i as default};
|
|
2
2
|
//# sourceMappingURL=PublicKey.js.map
|