@sravankumar02/sdk-core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +11 -0
- package/README.md +94 -0
- package/out/abi/argSerializer.d.ts +45 -0
- package/out/abi/argSerializer.js +171 -0
- package/out/abi/argSerializer.js.map +1 -0
- package/out/abi/argumentErrorContext.d.ts +12 -0
- package/out/abi/argumentErrorContext.js +34 -0
- package/out/abi/argumentErrorContext.js.map +1 -0
- package/out/abi/code.d.ts +23 -0
- package/out/abi/code.js +41 -0
- package/out/abi/code.js.map +1 -0
- package/out/abi/codec/address.d.ts +24 -0
- package/out/abi/codec/address.js +41 -0
- package/out/abi/codec/address.js.map +1 -0
- package/out/abi/codec/arrayVec.d.ts +11 -0
- package/out/abi/codec/arrayVec.js +39 -0
- package/out/abi/codec/arrayVec.js.map +1 -0
- package/out/abi/codec/binary.d.ts +30 -0
- package/out/abi/codec/binary.js +134 -0
- package/out/abi/codec/binary.js.map +1 -0
- package/out/abi/codec/binaryCodecUtils.d.ts +6 -0
- package/out/abi/codec/binaryCodecUtils.js +35 -0
- package/out/abi/codec/binaryCodecUtils.js.map +1 -0
- package/out/abi/codec/boolean.d.ts +13 -0
- package/out/abi/codec/boolean.js +57 -0
- package/out/abi/codec/boolean.js.map +1 -0
- package/out/abi/codec/bytes.d.ts +11 -0
- package/out/abi/codec/bytes.js +30 -0
- package/out/abi/codec/bytes.js.map +1 -0
- package/out/abi/codec/codemetadata.d.ts +8 -0
- package/out/abi/codec/codemetadata.js +23 -0
- package/out/abi/codec/codemetadata.js.map +1 -0
- package/out/abi/codec/constants.d.ts +1 -0
- package/out/abi/codec/constants.js +5 -0
- package/out/abi/codec/constants.js.map +1 -0
- package/out/abi/codec/enum.d.ts +13 -0
- package/out/abi/codec/enum.js +49 -0
- package/out/abi/codec/enum.js.map +1 -0
- package/out/abi/codec/explicit-enum.d.ts +10 -0
- package/out/abi/codec/explicit-enum.js +30 -0
- package/out/abi/codec/explicit-enum.js.map +1 -0
- package/out/abi/codec/fields.d.ts +9 -0
- package/out/abi/codec/fields.js +31 -0
- package/out/abi/codec/fields.js.map +1 -0
- package/out/abi/codec/h256.d.ts +24 -0
- package/out/abi/codec/h256.js +39 -0
- package/out/abi/codec/h256.js.map +1 -0
- package/out/abi/codec/index.d.ts +6 -0
- package/out/abi/codec/index.js +19 -0
- package/out/abi/codec/index.js.map +1 -0
- package/out/abi/codec/list.d.ts +14 -0
- package/out/abi/codec/list.js +67 -0
- package/out/abi/codec/list.js.map +1 -0
- package/out/abi/codec/managedDecimal.d.ts +11 -0
- package/out/abi/codec/managedDecimal.js +53 -0
- package/out/abi/codec/managedDecimal.js.map +1 -0
- package/out/abi/codec/managedDecimalSigned.d.ts +11 -0
- package/out/abi/codec/managedDecimalSigned.js +53 -0
- package/out/abi/codec/managedDecimalSigned.js.map +1 -0
- package/out/abi/codec/nothing.d.ts +8 -0
- package/out/abi/codec/nothing.js +20 -0
- package/out/abi/codec/nothing.js.map +1 -0
- package/out/abi/codec/numerical.d.ts +13 -0
- package/out/abi/codec/numerical.js +122 -0
- package/out/abi/codec/numerical.js.map +1 -0
- package/out/abi/codec/option.d.ts +14 -0
- package/out/abi/codec/option.js +66 -0
- package/out/abi/codec/option.js.map +1 -0
- package/out/abi/codec/primitive.d.ts +20 -0
- package/out/abi/codec/primitive.js +81 -0
- package/out/abi/codec/primitive.js.map +1 -0
- package/out/abi/codec/string.d.ts +9 -0
- package/out/abi/codec/string.js +28 -0
- package/out/abi/codec/string.js.map +1 -0
- package/out/abi/codec/struct.d.ts +11 -0
- package/out/abi/codec/struct.js +30 -0
- package/out/abi/codec/struct.js.map +1 -0
- package/out/abi/codec/tokenIdentifier.d.ts +9 -0
- package/out/abi/codec/tokenIdentifier.js +28 -0
- package/out/abi/codec/tokenIdentifier.js.map +1 -0
- package/out/abi/codec/tuple.d.ts +11 -0
- package/out/abi/codec/tuple.js +23 -0
- package/out/abi/codec/tuple.js.map +1 -0
- package/out/abi/codec/utils.d.ts +20 -0
- package/out/abi/codec/utils.js +69 -0
- package/out/abi/codec/utils.js.map +1 -0
- package/out/abi/function.d.ts +24 -0
- package/out/abi/function.js +56 -0
- package/out/abi/function.js.map +1 -0
- package/out/abi/index.d.ts +12 -0
- package/out/abi/index.js +25 -0
- package/out/abi/index.js.map +1 -0
- package/out/abi/interaction.d.ts +67 -0
- package/out/abi/interaction.js +146 -0
- package/out/abi/interaction.js.map +1 -0
- package/out/abi/interface.d.ts +85 -0
- package/out/abi/interface.js +3 -0
- package/out/abi/interface.js.map +1 -0
- package/out/abi/nativeSerializer.d.ts +27 -0
- package/out/abi/nativeSerializer.js +343 -0
- package/out/abi/nativeSerializer.js.map +1 -0
- package/out/abi/query.d.ts +18 -0
- package/out/abi/query.js +19 -0
- package/out/abi/query.js.map +1 -0
- package/out/abi/returnCode.d.ts +26 -0
- package/out/abi/returnCode.js +45 -0
- package/out/abi/returnCode.js.map +1 -0
- package/out/abi/smartContract.d.ts +74 -0
- package/out/abi/smartContract.js +208 -0
- package/out/abi/smartContract.js.map +1 -0
- package/out/abi/typeFormula.d.ts +7 -0
- package/out/abi/typeFormula.js +20 -0
- package/out/abi/typeFormula.js.map +1 -0
- package/out/abi/typeFormulaParser.d.ts +14 -0
- package/out/abi/typeFormulaParser.js +126 -0
- package/out/abi/typeFormulaParser.js.map +1 -0
- package/out/abi/typesystem/abi.d.ts +64 -0
- package/out/abi/typesystem/abi.js +208 -0
- package/out/abi/typesystem/abi.js.map +1 -0
- package/out/abi/typesystem/address.d.ts +23 -0
- package/out/abi/typesystem/address.js +41 -0
- package/out/abi/typesystem/address.js.map +1 -0
- package/out/abi/typesystem/algebraic.d.ts +24 -0
- package/out/abi/typesystem/algebraic.js +59 -0
- package/out/abi/typesystem/algebraic.js.map +1 -0
- package/out/abi/typesystem/boolean.d.ts +24 -0
- package/out/abi/typesystem/boolean.js +46 -0
- package/out/abi/typesystem/boolean.js.map +1 -0
- package/out/abi/typesystem/bytes.d.ts +28 -0
- package/out/abi/typesystem/bytes.js +58 -0
- package/out/abi/typesystem/bytes.js.map +1 -0
- package/out/abi/typesystem/codeMetadata.d.ts +11 -0
- package/out/abi/typesystem/codeMetadata.js +24 -0
- package/out/abi/typesystem/codeMetadata.js.map +1 -0
- package/out/abi/typesystem/collections.d.ts +9 -0
- package/out/abi/typesystem/collections.js +32 -0
- package/out/abi/typesystem/collections.js.map +1 -0
- package/out/abi/typesystem/composite.d.ts +16 -0
- package/out/abi/typesystem/composite.js +53 -0
- package/out/abi/typesystem/composite.js.map +1 -0
- package/out/abi/typesystem/endpoint.d.ts +41 -0
- package/out/abi/typesystem/endpoint.js +78 -0
- package/out/abi/typesystem/endpoint.js.map +1 -0
- package/out/abi/typesystem/enum.d.ts +51 -0
- package/out/abi/typesystem/enum.js +137 -0
- package/out/abi/typesystem/enum.js.map +1 -0
- package/out/abi/typesystem/event.d.ts +25 -0
- package/out/abi/typesystem/event.js +36 -0
- package/out/abi/typesystem/event.js.map +1 -0
- package/out/abi/typesystem/explicit-enum.d.ts +33 -0
- package/out/abi/typesystem/explicit-enum.js +63 -0
- package/out/abi/typesystem/explicit-enum.js.map +1 -0
- package/out/abi/typesystem/factory.d.ts +4 -0
- package/out/abi/typesystem/factory.js +19 -0
- package/out/abi/typesystem/factory.js.map +1 -0
- package/out/abi/typesystem/fields.d.ts +24 -0
- package/out/abi/typesystem/fields.js +90 -0
- package/out/abi/typesystem/fields.js.map +1 -0
- package/out/abi/typesystem/generic.d.ts +47 -0
- package/out/abi/typesystem/generic.js +120 -0
- package/out/abi/typesystem/generic.js.map +1 -0
- package/out/abi/typesystem/genericArray.d.ts +17 -0
- package/out/abi/typesystem/genericArray.js +44 -0
- package/out/abi/typesystem/genericArray.js.map +1 -0
- package/out/abi/typesystem/h256.d.ts +18 -0
- package/out/abi/typesystem/h256.js +35 -0
- package/out/abi/typesystem/h256.js.map +1 -0
- package/out/abi/typesystem/index.d.ts +33 -0
- package/out/abi/typesystem/index.js +46 -0
- package/out/abi/typesystem/index.js.map +1 -0
- package/out/abi/typesystem/managedDecimal.d.ts +26 -0
- package/out/abi/typesystem/managedDecimal.js +62 -0
- package/out/abi/typesystem/managedDecimal.js.map +1 -0
- package/out/abi/typesystem/managedDecimalSigned.d.ts +26 -0
- package/out/abi/typesystem/managedDecimalSigned.js +62 -0
- package/out/abi/typesystem/managedDecimalSigned.js.map +1 -0
- package/out/abi/typesystem/matchers.d.ts +51 -0
- package/out/abi/typesystem/matchers.js +185 -0
- package/out/abi/typesystem/matchers.js.map +1 -0
- package/out/abi/typesystem/nothing.d.ts +13 -0
- package/out/abi/typesystem/nothing.js +31 -0
- package/out/abi/typesystem/nothing.js.map +1 -0
- package/out/abi/typesystem/numerical.d.ts +130 -0
- package/out/abi/typesystem/numerical.js +286 -0
- package/out/abi/typesystem/numerical.js.map +1 -0
- package/out/abi/typesystem/string.d.ts +26 -0
- package/out/abi/typesystem/string.js +51 -0
- package/out/abi/typesystem/string.js.map +1 -0
- package/out/abi/typesystem/struct.d.ts +30 -0
- package/out/abi/typesystem/struct.js +78 -0
- package/out/abi/typesystem/struct.js.map +1 -0
- package/out/abi/typesystem/tokenIdentifier.d.ts +21 -0
- package/out/abi/typesystem/tokenIdentifier.js +51 -0
- package/out/abi/typesystem/tokenIdentifier.js.map +1 -0
- package/out/abi/typesystem/tuple.d.ts +16 -0
- package/out/abi/typesystem/tuple.js +71 -0
- package/out/abi/typesystem/tuple.js.map +1 -0
- package/out/abi/typesystem/typeExpressionParser.d.ts +8 -0
- package/out/abi/typesystem/typeExpressionParser.js +30 -0
- package/out/abi/typesystem/typeExpressionParser.js.map +1 -0
- package/out/abi/typesystem/typeMapper.d.ts +20 -0
- package/out/abi/typesystem/typeMapper.js +215 -0
- package/out/abi/typesystem/typeMapper.js.map +1 -0
- package/out/abi/typesystem/types.d.ts +129 -0
- package/out/abi/typesystem/types.js +285 -0
- package/out/abi/typesystem/types.js.map +1 -0
- package/out/abi/typesystem/variadic.d.ts +35 -0
- package/out/abi/typesystem/variadic.js +81 -0
- package/out/abi/typesystem/variadic.js.map +1 -0
- package/out/accountManagement/accountController.d.ts +18 -0
- package/out/accountManagement/accountController.js +54 -0
- package/out/accountManagement/accountController.js.map +1 -0
- package/out/accountManagement/accountTransactionsFactory.d.ts +27 -0
- package/out/accountManagement/accountTransactionsFactory.js +78 -0
- package/out/accountManagement/accountTransactionsFactory.js.map +1 -0
- package/out/accountManagement/index.d.ts +3 -0
- package/out/accountManagement/index.js +16 -0
- package/out/accountManagement/index.js.map +1 -0
- package/out/accountManagement/resources.d.ts +8 -0
- package/out/accountManagement/resources.js +3 -0
- package/out/accountManagement/resources.js.map +1 -0
- package/out/accounts/account.d.ts +94 -0
- package/out/accounts/account.js +154 -0
- package/out/accounts/account.js.map +1 -0
- package/out/accounts/index.d.ts +1 -0
- package/out/accounts/index.js +14 -0
- package/out/accounts/index.js.map +1 -0
- package/out/core/address.d.ts +105 -0
- package/out/core/address.js +313 -0
- package/out/core/address.js.map +1 -0
- package/out/core/asyncTimer.d.ts +27 -0
- package/out/core/asyncTimer.js +91 -0
- package/out/core/asyncTimer.js.map +1 -0
- package/out/core/baseController.d.ts +16 -0
- package/out/core/baseController.js +34 -0
- package/out/core/baseController.js.map +1 -0
- package/out/core/codeMetadata.d.ts +74 -0
- package/out/core/codeMetadata.js +146 -0
- package/out/core/codeMetadata.js.map +1 -0
- package/out/core/compatibility.d.ts +10 -0
- package/out/core/compatibility.js +22 -0
- package/out/core/compatibility.js.map +1 -0
- package/out/core/config.d.ts +15 -0
- package/out/core/config.js +20 -0
- package/out/core/config.js.map +1 -0
- package/out/core/constants.d.ts +28 -0
- package/out/core/constants.js +32 -0
- package/out/core/constants.js.map +1 -0
- package/out/core/errors.d.ts +279 -0
- package/out/core/errors.js +437 -0
- package/out/core/errors.js.map +1 -0
- package/out/core/globals.d.ts +0 -0
- package/out/core/globals.js +5 -0
- package/out/core/globals.js.map +1 -0
- package/out/core/index.d.ts +21 -0
- package/out/core/index.js +35 -0
- package/out/core/index.js.map +1 -0
- package/out/core/interfaces.d.ts +40 -0
- package/out/core/interfaces.js +3 -0
- package/out/core/interfaces.js.map +1 -0
- package/out/core/logger.d.ts +17 -0
- package/out/core/logger.js +50 -0
- package/out/core/logger.js.map +1 -0
- package/out/core/message.d.ts +57 -0
- package/out/core/message.js +71 -0
- package/out/core/message.js.map +1 -0
- package/out/core/networkParams.d.ts +57 -0
- package/out/core/networkParams.js +112 -0
- package/out/core/networkParams.js.map +1 -0
- package/out/core/reflection.d.ts +1 -0
- package/out/core/reflection.js +14 -0
- package/out/core/reflection.js.map +1 -0
- package/out/core/signature.d.ts +17 -0
- package/out/core/signature.js +82 -0
- package/out/core/signature.js.map +1 -0
- package/out/core/smartContractQuery.d.ts +35 -0
- package/out/core/smartContractQuery.js +34 -0
- package/out/core/smartContractQuery.js.map +1 -0
- package/out/core/tokenTransfersDataBuilder.d.ts +10 -0
- package/out/core/tokenTransfersDataBuilder.js +44 -0
- package/out/core/tokenTransfersDataBuilder.js.map +1 -0
- package/out/core/tokens.d.ts +130 -0
- package/out/core/tokens.js +287 -0
- package/out/core/tokens.js.map +1 -0
- package/out/core/transaction.d.ts +263 -0
- package/out/core/transaction.js +323 -0
- package/out/core/transaction.js.map +1 -0
- package/out/core/transactionBuilder.d.ts +32 -0
- package/out/core/transactionBuilder.js +45 -0
- package/out/core/transactionBuilder.js.map +1 -0
- package/out/core/transactionComputer.d.ts +51 -0
- package/out/core/transactionComputer.js +163 -0
- package/out/core/transactionComputer.js.map +1 -0
- package/out/core/transactionEvents.d.ts +17 -0
- package/out/core/transactionEvents.js +27 -0
- package/out/core/transactionEvents.js.map +1 -0
- package/out/core/transactionLogs.d.ts +11 -0
- package/out/core/transactionLogs.js +38 -0
- package/out/core/transactionLogs.js.map +1 -0
- package/out/core/transactionOnNetwork.d.ts +40 -0
- package/out/core/transactionOnNetwork.js +164 -0
- package/out/core/transactionOnNetwork.js.map +1 -0
- package/out/core/transactionStatus.d.ts +45 -0
- package/out/core/transactionStatus.js +71 -0
- package/out/core/transactionStatus.js.map +1 -0
- package/out/core/transactionWatcher.d.ts +48 -0
- package/out/core/transactionWatcher.js +148 -0
- package/out/core/transactionWatcher.js.map +1 -0
- package/out/core/transactionsFactoryConfig.d.ts +54 -0
- package/out/core/transactionsFactoryConfig.js +66 -0
- package/out/core/transactionsFactoryConfig.js.map +1 -0
- package/out/core/utils.codec.d.ts +8 -0
- package/out/core/utils.codec.js +75 -0
- package/out/core/utils.codec.js.map +1 -0
- package/out/core/utils.d.ts +20 -0
- package/out/core/utils.js +86 -0
- package/out/core/utils.js.map +1 -0
- package/out/delegation/delegationController.d.ts +37 -0
- package/out/delegation/delegationController.js +215 -0
- package/out/delegation/delegationController.js.map +1 -0
- package/out/delegation/delegationTransactionsFactory.d.ts +48 -0
- package/out/delegation/delegationTransactionsFactory.js +311 -0
- package/out/delegation/delegationTransactionsFactory.js.map +1 -0
- package/out/delegation/delegationTransactionsOutcomeParser.d.ts +10 -0
- package/out/delegation/delegationTransactionsOutcomeParser.js +35 -0
- package/out/delegation/delegationTransactionsOutcomeParser.js.map +1 -0
- package/out/delegation/index.d.ts +4 -0
- package/out/delegation/index.js +17 -0
- package/out/delegation/index.js.map +1 -0
- package/out/delegation/resources.d.ts +38 -0
- package/out/delegation/resources.js +3 -0
- package/out/delegation/resources.js.map +1 -0
- package/out/entrypoints/config.d.ts +29 -0
- package/out/entrypoints/config.js +36 -0
- package/out/entrypoints/config.js.map +1 -0
- package/out/entrypoints/entrypoints.d.ts +92 -0
- package/out/entrypoints/entrypoints.js +203 -0
- package/out/entrypoints/entrypoints.js.map +1 -0
- package/out/entrypoints/index.d.ts +2 -0
- package/out/entrypoints/index.js +15 -0
- package/out/entrypoints/index.js.map +1 -0
- package/out/governance/governanceController.d.ts +33 -0
- package/out/governance/governanceController.js +205 -0
- package/out/governance/governanceController.js.map +1 -0
- package/out/governance/governanceTransactionsFactory.d.ts +16 -0
- package/out/governance/governanceTransactionsFactory.js +99 -0
- package/out/governance/governanceTransactionsFactory.js.map +1 -0
- package/out/governance/governanceTransactionsOutcomeParser.d.ts +15 -0
- package/out/governance/governanceTransactionsOutcomeParser.js +99 -0
- package/out/governance/governanceTransactionsOutcomeParser.js.map +1 -0
- package/out/governance/index.d.ts +4 -0
- package/out/governance/index.js +17 -0
- package/out/governance/index.js.map +1 -0
- package/out/governance/resources.d.ts +82 -0
- package/out/governance/resources.js +11 -0
- package/out/governance/resources.js.map +1 -0
- package/out/index.d.ts +19 -0
- package/out/index.js +32 -0
- package/out/index.js.map +1 -0
- package/out/multisig/index.d.ts +3 -0
- package/out/multisig/index.js +16 -0
- package/out/multisig/index.js.map +1 -0
- package/out/multisig/multisigController.d.ts +221 -0
- package/out/multisig/multisigController.js +540 -0
- package/out/multisig/multisigController.js.map +1 -0
- package/out/multisig/multisigTransactionsFactory.d.ts +110 -0
- package/out/multisig/multisigTransactionsFactory.js +355 -0
- package/out/multisig/multisigTransactionsFactory.js.map +1 -0
- package/out/multisig/multisigTransactionsOutcomeParser.d.ts +31 -0
- package/out/multisig/multisigTransactionsOutcomeParser.js +41 -0
- package/out/multisig/multisigTransactionsOutcomeParser.js.map +1 -0
- package/out/multisig/proposeTransferExecuteContractInput.d.ts +32 -0
- package/out/multisig/proposeTransferExecuteContractInput.js +65 -0
- package/out/multisig/proposeTransferExecuteContractInput.js.map +1 -0
- package/out/multisig/resources.d.ts +182 -0
- package/out/multisig/resources.js +125 -0
- package/out/multisig/resources.js.map +1 -0
- package/out/networkProviders/accountAwaiter.d.ts +35 -0
- package/out/networkProviders/accountAwaiter.js +67 -0
- package/out/networkProviders/accountAwaiter.js.map +1 -0
- package/out/networkProviders/accounts.d.ts +55 -0
- package/out/networkProviders/accounts.js +154 -0
- package/out/networkProviders/accounts.js.map +1 -0
- package/out/networkProviders/apiNetworkProvider.d.ts +48 -0
- package/out/networkProviders/apiNetworkProvider.js +235 -0
- package/out/networkProviders/apiNetworkProvider.js.map +1 -0
- package/out/networkProviders/blocks.d.ts +48 -0
- package/out/networkProviders/blocks.js +76 -0
- package/out/networkProviders/blocks.js.map +1 -0
- package/out/networkProviders/config.d.ts +6 -0
- package/out/networkProviders/config.js +18 -0
- package/out/networkProviders/config.js.map +1 -0
- package/out/networkProviders/constants.d.ts +9 -0
- package/out/networkProviders/constants.js +16 -0
- package/out/networkProviders/constants.js.map +1 -0
- package/out/networkProviders/contractQueryRequest.d.ts +6 -0
- package/out/networkProviders/contractQueryRequest.js +20 -0
- package/out/networkProviders/contractQueryRequest.js.map +1 -0
- package/out/networkProviders/index.d.ts +11 -0
- package/out/networkProviders/index.js +28 -0
- package/out/networkProviders/index.js.map +1 -0
- package/out/networkProviders/interface.d.ts +110 -0
- package/out/networkProviders/interface.js +3 -0
- package/out/networkProviders/interface.js.map +1 -0
- package/out/networkProviders/networkConfig.d.ts +48 -0
- package/out/networkProviders/networkConfig.js +41 -0
- package/out/networkProviders/networkConfig.js.map +1 -0
- package/out/networkProviders/networkProviderConfig.d.ts +4 -0
- package/out/networkProviders/networkProviderConfig.js +3 -0
- package/out/networkProviders/networkProviderConfig.js.map +1 -0
- package/out/networkProviders/networkStatus.d.ts +31 -0
- package/out/networkProviders/networkStatus.js +31 -0
- package/out/networkProviders/networkStatus.js.map +1 -0
- package/out/networkProviders/proxyNetworkProvider.d.ts +51 -0
- package/out/networkProviders/proxyNetworkProvider.js +261 -0
- package/out/networkProviders/proxyNetworkProvider.js.map +1 -0
- package/out/networkProviders/resources.d.ts +12 -0
- package/out/networkProviders/resources.js +29 -0
- package/out/networkProviders/resources.js.map +1 -0
- package/out/networkProviders/tokenDefinitions.d.ts +49 -0
- package/out/networkProviders/tokenDefinitions.js +152 -0
- package/out/networkProviders/tokenDefinitions.js.map +1 -0
- package/out/networkProviders/tokens.d.ts +40 -0
- package/out/networkProviders/tokens.js +106 -0
- package/out/networkProviders/tokens.js.map +1 -0
- package/out/networkProviders/userAgent.d.ts +2 -0
- package/out/networkProviders/userAgent.js +30 -0
- package/out/networkProviders/userAgent.js.map +1 -0
- package/out/proto/compiled.d.ts +2 -0
- package/out/proto/compiled.js +719 -0
- package/out/proto/compiled.js.map +1 -0
- package/out/proto/index.d.ts +5 -0
- package/out/proto/index.js +18 -0
- package/out/proto/index.js.map +1 -0
- package/out/proto/serializer.d.ts +22 -0
- package/out/proto/serializer.js +114 -0
- package/out/proto/serializer.js.map +1 -0
- package/out/smartContracts/index.d.ts +4 -0
- package/out/smartContracts/index.js +17 -0
- package/out/smartContracts/index.js.map +1 -0
- package/out/smartContracts/resources.d.ts +38 -0
- package/out/smartContracts/resources.js +3 -0
- package/out/smartContracts/resources.js.map +1 -0
- package/out/smartContracts/smartContractController.d.ts +32 -0
- package/out/smartContracts/smartContractController.js +128 -0
- package/out/smartContracts/smartContractController.js.map +1 -0
- package/out/smartContracts/smartContractTransactionsFactory.d.ts +42 -0
- package/out/smartContracts/smartContractTransactionsFactory.js +165 -0
- package/out/smartContracts/smartContractTransactionsFactory.js.map +1 -0
- package/out/smartContracts/smartContractTransactionsOutcomeParser.d.ts +28 -0
- package/out/smartContracts/smartContractTransactionsOutcomeParser.js +189 -0
- package/out/smartContracts/smartContractTransactionsOutcomeParser.js.map +1 -0
- package/out/tokenManagement/index.d.ts +4 -0
- package/out/tokenManagement/index.js +17 -0
- package/out/tokenManagement/index.js.map +1 -0
- package/out/tokenManagement/resources.d.ts +220 -0
- package/out/tokenManagement/resources.js +3 -0
- package/out/tokenManagement/resources.js.map +1 -0
- package/out/tokenManagement/tokenManagementController.d.ts +108 -0
- package/out/tokenManagement/tokenManagementController.js +582 -0
- package/out/tokenManagement/tokenManagementController.js.map +1 -0
- package/out/tokenManagement/tokenManagementTransactionsFactory.d.ts +82 -0
- package/out/tokenManagement/tokenManagementTransactionsFactory.js +684 -0
- package/out/tokenManagement/tokenManagementTransactionsFactory.js.map +1 -0
- package/out/tokenManagement/tokenManagementTransactionsOutcomeParser.d.ts +109 -0
- package/out/tokenManagement/tokenManagementTransactionsOutcomeParser.js +356 -0
- package/out/tokenManagement/tokenManagementTransactionsOutcomeParser.js.map +1 -0
- package/out/tokenOperations/codec.d.ts +7 -0
- package/out/tokenOperations/codec.js +55 -0
- package/out/tokenOperations/codec.js.map +1 -0
- package/out/transactionsOutcomeParsers/index.d.ts +4 -0
- package/out/transactionsOutcomeParsers/index.js +17 -0
- package/out/transactionsOutcomeParsers/index.js.map +1 -0
- package/out/transactionsOutcomeParsers/resources.d.ts +23 -0
- package/out/transactionsOutcomeParsers/resources.js +48 -0
- package/out/transactionsOutcomeParsers/resources.js.map +1 -0
- package/out/transactionsOutcomeParsers/transactionEventsParser.d.ts +16 -0
- package/out/transactionsOutcomeParsers/transactionEventsParser.js +48 -0
- package/out/transactionsOutcomeParsers/transactionEventsParser.js.map +1 -0
- package/out/transfers/index.d.ts +3 -0
- package/out/transfers/index.js +16 -0
- package/out/transfers/index.js.map +1 -0
- package/out/transfers/resources.d.ts +17 -0
- package/out/transfers/resources.js +3 -0
- package/out/transfers/resources.js.map +1 -0
- package/out/transfers/transferTransactionsFactory.d.ts +32 -0
- package/out/transfers/transferTransactionsFactory.js +131 -0
- package/out/transfers/transferTransactionsFactory.js.map +1 -0
- package/out/transfers/transfersControllers.d.ts +11 -0
- package/out/transfers/transfersControllers.js +43 -0
- package/out/transfers/transfersControllers.js.map +1 -0
- package/out/wallet/assertions.d.ts +3 -0
- package/out/wallet/assertions.js +12 -0
- package/out/wallet/assertions.js.map +1 -0
- package/out/wallet/crypto/constants.d.ts +6 -0
- package/out/wallet/crypto/constants.js +11 -0
- package/out/wallet/crypto/constants.js.map +1 -0
- package/out/wallet/crypto/decryptor.d.ts +5 -0
- package/out/wallet/crypto/decryptor.js +29 -0
- package/out/wallet/crypto/decryptor.js.map +1 -0
- package/out/wallet/crypto/derivationParams.d.ts +23 -0
- package/out/wallet/crypto/derivationParams.js +38 -0
- package/out/wallet/crypto/derivationParams.js.map +1 -0
- package/out/wallet/crypto/encryptedData.d.ts +15 -0
- package/out/wallet/crypto/encryptedData.js +52 -0
- package/out/wallet/crypto/encryptedData.js.map +1 -0
- package/out/wallet/crypto/encryptor.d.ts +14 -0
- package/out/wallet/crypto/encryptor.js +39 -0
- package/out/wallet/crypto/encryptor.js.map +1 -0
- package/out/wallet/crypto/index.d.ts +7 -0
- package/out/wallet/crypto/index.js +20 -0
- package/out/wallet/crypto/index.js.map +1 -0
- package/out/wallet/crypto/pubkeyDecryptor.d.ts +6 -0
- package/out/wallet/crypto/pubkeyDecryptor.js +38 -0
- package/out/wallet/crypto/pubkeyDecryptor.js.map +1 -0
- package/out/wallet/crypto/pubkeyEncryptor.d.ts +6 -0
- package/out/wallet/crypto/pubkeyEncryptor.js +54 -0
- package/out/wallet/crypto/pubkeyEncryptor.js.map +1 -0
- package/out/wallet/crypto/randomness.d.ts +7 -0
- package/out/wallet/crypto/randomness.js +15 -0
- package/out/wallet/crypto/randomness.js.map +1 -0
- package/out/wallet/crypto/x25519EncryptedData.d.ts +15 -0
- package/out/wallet/crypto/x25519EncryptedData.js +37 -0
- package/out/wallet/crypto/x25519EncryptedData.js.map +1 -0
- package/out/wallet/index.d.ts +11 -0
- package/out/wallet/index.js +24 -0
- package/out/wallet/index.js.map +1 -0
- package/out/wallet/keypair.d.ts +12 -0
- package/out/wallet/keypair.js +32 -0
- package/out/wallet/keypair.js.map +1 -0
- package/out/wallet/mnemonic.d.ts +13 -0
- package/out/wallet/mnemonic.js +74 -0
- package/out/wallet/mnemonic.js.map +1 -0
- package/out/wallet/pem.d.ts +8 -0
- package/out/wallet/pem.js +60 -0
- package/out/wallet/pem.js.map +1 -0
- package/out/wallet/pemEntry.d.ts +10 -0
- package/out/wallet/pemEntry.js +73 -0
- package/out/wallet/pemEntry.js.map +1 -0
- package/out/wallet/userKeys.d.ts +23 -0
- package/out/wallet/userKeys.js +99 -0
- package/out/wallet/userKeys.js.map +1 -0
- package/out/wallet/userPem.d.ts +15 -0
- package/out/wallet/userPem.js +51 -0
- package/out/wallet/userPem.js.map +1 -0
- package/out/wallet/userSigner.d.ts +16 -0
- package/out/wallet/userSigner.js +41 -0
- package/out/wallet/userSigner.js.map +1 -0
- package/out/wallet/userVerifier.d.ts +18 -0
- package/out/wallet/userVerifier.js +27 -0
- package/out/wallet/userVerifier.js.map +1 -0
- package/out/wallet/userWallet.d.ts +54 -0
- package/out/wallet/userWallet.js +206 -0
- package/out/wallet/userWallet.js.map +1 -0
- package/out/wallet/validatorKeys.d.ts +26 -0
- package/out/wallet/validatorKeys.js +77 -0
- package/out/wallet/validatorKeys.js.map +1 -0
- package/out/wallet/validatorSigner.d.ts +10 -0
- package/out/wallet/validatorSigner.js +25 -0
- package/out/wallet/validatorSigner.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EncryptedData = void 0;
|
|
4
|
+
const derivationParams_1 = require("./derivationParams");
|
|
5
|
+
class EncryptedData {
|
|
6
|
+
constructor(data) {
|
|
7
|
+
this.id = data.id;
|
|
8
|
+
this.version = data.version;
|
|
9
|
+
this.ciphertext = data.ciphertext;
|
|
10
|
+
this.iv = data.iv;
|
|
11
|
+
this.cipher = data.cipher;
|
|
12
|
+
this.kdf = data.kdf;
|
|
13
|
+
this.kdfparams = data.kdfparams;
|
|
14
|
+
this.mac = data.mac;
|
|
15
|
+
this.salt = data.salt;
|
|
16
|
+
}
|
|
17
|
+
toJSON() {
|
|
18
|
+
return {
|
|
19
|
+
version: this.version,
|
|
20
|
+
id: this.id,
|
|
21
|
+
crypto: {
|
|
22
|
+
ciphertext: this.ciphertext,
|
|
23
|
+
cipherparams: { iv: this.iv },
|
|
24
|
+
cipher: this.cipher,
|
|
25
|
+
kdf: this.kdf,
|
|
26
|
+
kdfparams: {
|
|
27
|
+
dklen: this.kdfparams.dklen,
|
|
28
|
+
salt: this.salt,
|
|
29
|
+
n: this.kdfparams.n,
|
|
30
|
+
r: this.kdfparams.r,
|
|
31
|
+
p: this.kdfparams.p
|
|
32
|
+
},
|
|
33
|
+
mac: this.mac,
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static fromJSON(data) {
|
|
38
|
+
return new EncryptedData({
|
|
39
|
+
version: data.version,
|
|
40
|
+
id: data.id,
|
|
41
|
+
ciphertext: data.crypto.ciphertext,
|
|
42
|
+
iv: data.crypto.cipherparams.iv,
|
|
43
|
+
cipher: data.crypto.cipher,
|
|
44
|
+
kdf: data.crypto.kdf,
|
|
45
|
+
kdfparams: new derivationParams_1.ScryptKeyDerivationParams(data.crypto.kdfparams.n, data.crypto.kdfparams.r, data.crypto.kdfparams.p, data.crypto.kdfparams.dklen),
|
|
46
|
+
salt: data.crypto.kdfparams.salt,
|
|
47
|
+
mac: data.crypto.mac,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.EncryptedData = EncryptedData;
|
|
52
|
+
//# sourceMappingURL=encryptedData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryptedData.js","sourceRoot":"","sources":["../../../src/wallet/crypto/encryptedData.ts"],"names":[],"mappings":";;;AAAA,yDAA+D;AAE/D,MAAa,aAAa;IAWxB,YAAY,IAAmC;QAC7C,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,C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AS,CAAC,KAAK,CAC5B;YACD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI;YAChC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG;SACrB,CAAC,CAAC;IACL,CAAC;CACF;AA9DD,sCA8DC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EncryptedData } from "./encryptedData";
|
|
3
|
+
interface IRandomness {
|
|
4
|
+
id: string;
|
|
5
|
+
iv: Buffer;
|
|
6
|
+
salt: Buffer;
|
|
7
|
+
}
|
|
8
|
+
export declare enum EncryptorVersion {
|
|
9
|
+
V4 = 4
|
|
10
|
+
}
|
|
11
|
+
export declare class Encryptor {
|
|
12
|
+
static encrypt(data: Buffer, password: string, randomness?: IRandomness): EncryptedData;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Encryptor = exports.EncryptorVersion = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const derivationParams_1 = require("./derivationParams");
|
|
10
|
+
const encryptedData_1 = require("./encryptedData");
|
|
11
|
+
const randomness_1 = require("./randomness");
|
|
12
|
+
var EncryptorVersion;
|
|
13
|
+
(function (EncryptorVersion) {
|
|
14
|
+
EncryptorVersion[EncryptorVersion["V4"] = 4] = "V4";
|
|
15
|
+
})(EncryptorVersion = exports.EncryptorVersion || (exports.EncryptorVersion = {}));
|
|
16
|
+
class Encryptor {
|
|
17
|
+
static encrypt(data, password, randomness = new randomness_1.Randomness()) {
|
|
18
|
+
const kdParams = new derivationParams_1.ScryptKeyDerivationParams();
|
|
19
|
+
const derivedKey = kdParams.generateDerivedKey(Buffer.from(password), randomness.salt);
|
|
20
|
+
const derivedKeyFirstHalf = derivedKey.slice(0, 16);
|
|
21
|
+
const derivedKeySecondHalf = derivedKey.slice(16, 32);
|
|
22
|
+
const cipher = crypto_1.default.createCipheriv(constants_1.CipherAlgorithm, derivedKeyFirstHalf, randomness.iv);
|
|
23
|
+
const ciphertext = Buffer.concat([cipher.update(data), cipher.final()]);
|
|
24
|
+
const mac = crypto_1.default.createHmac(constants_1.DigestAlgorithm, derivedKeySecondHalf).update(ciphertext).digest();
|
|
25
|
+
return new encryptedData_1.EncryptedData({
|
|
26
|
+
version: EncryptorVersion.V4,
|
|
27
|
+
id: randomness.id,
|
|
28
|
+
ciphertext: ciphertext.toString('hex'),
|
|
29
|
+
iv: randomness.iv.toString('hex'),
|
|
30
|
+
cipher: constants_1.CipherAlgorithm,
|
|
31
|
+
kdf: constants_1.KeyDerivationFunction,
|
|
32
|
+
kdfparams: kdParams,
|
|
33
|
+
mac: mac.toString('hex'),
|
|
34
|
+
salt: randomness.salt.toString('hex')
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Encryptor = Encryptor;
|
|
39
|
+
//# sourceMappingURL=encryptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encryptor.js","sourceRoot":"","sources":["../../../src/wallet/crypto/encryptor.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,2CAAsF;AACtF,yDAA+D;AAC/D,mDAAgD;AAChD,6CAA0C;AAQ1C,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,mDAAM,CAAA;AACR,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B;AAED,MAAa,SAAS;IACpB,MAAM,CAAC,OAAO,CAAC,IAAY,EAAE,QAAgB,EAAE,aAA0B,IAAI,uBAAU,EAAE;QACvF,MAAM,QAAQ,GAAG,IAA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Binding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./constants"), exports);
|
|
14
|
+
__exportStar(require("./encryptor"), exports);
|
|
15
|
+
__exportStar(require("./decryptor"), exports);
|
|
16
|
+
__exportStar(require("./pubkeyEncryptor"), exports);
|
|
17
|
+
__exportStar(require("./pubkeyDecryptor"), exports);
|
|
18
|
+
__exportStar(require("./encryptedData"), exports);
|
|
19
|
+
__exportStar(require("./randomness"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wallet/crypto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,+CAA6B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { UserSecretKey } from "../userKeys";
|
|
3
|
+
import { X25519EncryptedData } from "./x25519EncryptedData";
|
|
4
|
+
export declare class PubkeyDecryptor {
|
|
5
|
+
static decrypt(data: X25519EncryptedData, decryptorSecretKey: UserSecretKey): Promise<Buffer>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PubkeyDecryptor = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const ed2curve_1 = __importDefault(require("ed2curve"));
|
|
9
|
+
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
10
|
+
const userKeys_1 = require("../userKeys");
|
|
11
|
+
class PubkeyDecryptor {
|
|
12
|
+
static async decrypt(data, decryptorSecretKey) {
|
|
13
|
+
const ciphertext = Buffer.from(data.ciphertext, "hex");
|
|
14
|
+
const edhPubKey = Buffer.from(data.identities.ephemeralPubKey, "hex");
|
|
15
|
+
const originatorPubKeyBuffer = Buffer.from(data.identities.originatorPubKey, "hex");
|
|
16
|
+
const originatorPubKey = new userKeys_1.UserPublicKey(originatorPubKeyBuffer);
|
|
17
|
+
const authMessage = crypto_1.default
|
|
18
|
+
.createHash("sha256")
|
|
19
|
+
.update(Buffer.concat([ciphertext, edhPubKey]))
|
|
20
|
+
.digest();
|
|
21
|
+
if (!(await originatorPubKey.verify(authMessage, Buffer.from(data.mac, "hex")))) {
|
|
22
|
+
throw new Error("Invalid authentication for encrypted message originator");
|
|
23
|
+
}
|
|
24
|
+
const nonce = Buffer.from(data.nonce, "hex");
|
|
25
|
+
const x25519Secret = ed2curve_1.default.convertSecretKey(decryptorSecretKey.valueOf());
|
|
26
|
+
const x25519EdhPubKey = ed2curve_1.default.convertPublicKey(edhPubKey);
|
|
27
|
+
if (x25519EdhPubKey === null) {
|
|
28
|
+
throw new Error("Could not convert ed25519 public key to x25519");
|
|
29
|
+
}
|
|
30
|
+
const decryptedMessage = tweetnacl_1.default.box.open(ciphertext, nonce, x25519EdhPubKey, x25519Secret);
|
|
31
|
+
if (decryptedMessage === null) {
|
|
32
|
+
throw new Error("Failed authentication for given ciphertext");
|
|
33
|
+
}
|
|
34
|
+
return Buffer.from(decryptedMessage);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.PubkeyDecryptor = PubkeyDecryptor;
|
|
38
|
+
//# sourceMappingURL=pubkeyDecryptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pubkeyDecryptor.js","sourceRoot":"","sources":["../../../src/wallet/crypto/pubkeyDecryptor.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,wDAAgC;AAChC,0DAA6B;AAC7B,0CAA2D;AAG3D,MAAa,eAAe;IACxB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAyB,EAAE,kBAAiC;QAC7E,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtE,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACpF,MAAM,gBAAgB,GAAG,IAAI,wBAAa,CAAC,sBAAsB,CAAC,CAAC;QAEnE,MAAM,WAAW,GAAG,gBAAM;aACrB,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;aAC9C,MAAM,EAAE,CAAC;QAEd,IAAI,CAAC,CAAC,MAAM,gBAAgB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;YAC7E,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;SAC9E;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7E,MAAM,eAAe,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC7D,IAAI,eAAe,KAAK,IAAI,EAAE;YAC1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SACrE;QAED,MAAM,gBAAgB,GAAG,mBAAI,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;QACzF,IAAI,gBAAgB,KAAK,IAAI,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;SACjE;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACzC,CAAC;CACJ;AA9BD,0CA8BC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { UserPublicKey, UserSecretKey } from "../userKeys";
|
|
3
|
+
import { X25519EncryptedData } from "./x25519EncryptedData";
|
|
4
|
+
export declare class PubkeyEncryptor {
|
|
5
|
+
static encrypt(data: Buffer, recipientPubKey: UserPublicKey, authSecretKey: UserSecretKey): X25519EncryptedData;
|
|
6
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PubkeyEncryptor = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const ed2curve_1 = __importDefault(require("ed2curve"));
|
|
9
|
+
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
const x25519EncryptedData_1 = require("./x25519EncryptedData");
|
|
12
|
+
class PubkeyEncryptor {
|
|
13
|
+
static encrypt(data, recipientPubKey, authSecretKey) {
|
|
14
|
+
// create a new x25519 keypair that will be used for EDH
|
|
15
|
+
const edhPair = tweetnacl_1.default.sign.keyPair();
|
|
16
|
+
const recipientDHPubKey = ed2curve_1.default.convertPublicKey(recipientPubKey.valueOf());
|
|
17
|
+
if (recipientDHPubKey === null) {
|
|
18
|
+
throw new Error("Could not convert ed25519 public key to x25519");
|
|
19
|
+
}
|
|
20
|
+
const edhConvertedSecretKey = ed2curve_1.default.convertSecretKey(edhPair.secretKey);
|
|
21
|
+
// For the nonce we use a random component and a deterministic one based on the message
|
|
22
|
+
// - this is so we won't completely rely on the random number generator
|
|
23
|
+
const nonceDeterministic = crypto_1.default
|
|
24
|
+
.createHash("sha256")
|
|
25
|
+
.update(data)
|
|
26
|
+
.digest()
|
|
27
|
+
.slice(0, constants_1.PubKeyEncNonceLength / 2);
|
|
28
|
+
const nonceRandom = tweetnacl_1.default.randomBytes(constants_1.PubKeyEncNonceLength / 2);
|
|
29
|
+
const nonce = Buffer.concat([nonceDeterministic, nonceRandom]);
|
|
30
|
+
const encryptedMessage = tweetnacl_1.default.box(data, nonce, recipientDHPubKey, edhConvertedSecretKey);
|
|
31
|
+
// Note that the ciphertext is already authenticated for the ephemeral key - but we want it authenticated by
|
|
32
|
+
// the ed25519 key which the user interacts with. A signature over H(ciphertext | edhPubKey)
|
|
33
|
+
// would be enough
|
|
34
|
+
const authMessage = crypto_1.default
|
|
35
|
+
.createHash("sha256")
|
|
36
|
+
.update(Buffer.concat([encryptedMessage, edhPair.publicKey]))
|
|
37
|
+
.digest();
|
|
38
|
+
const signature = authSecretKey.sign(authMessage);
|
|
39
|
+
return new x25519EncryptedData_1.X25519EncryptedData({
|
|
40
|
+
version: constants_1.PubKeyEncVersion,
|
|
41
|
+
nonce: Buffer.from(nonce).toString("hex"),
|
|
42
|
+
cipher: constants_1.PubKeyEncCipher,
|
|
43
|
+
ciphertext: Buffer.from(encryptedMessage).toString("hex"),
|
|
44
|
+
mac: Buffer.from(signature).toString("hex"),
|
|
45
|
+
identities: {
|
|
46
|
+
recipient: recipientPubKey.hex(),
|
|
47
|
+
ephemeralPubKey: Buffer.from(edhPair.publicKey).toString("hex"),
|
|
48
|
+
originatorPubKey: authSecretKey.generatePublicKey().hex(),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.PubkeyEncryptor = PubkeyEncryptor;
|
|
54
|
+
//# sourceMappingURL=pubkeyEncryptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pubkeyEncryptor.js","sourceRoot":"","sources":["../../../src/wallet/crypto/pubkeyEncryptor.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,wDAAgC;AAChC,0DAA6B;AAE7B,2CAAsF;AACtF,+DAA4D;AAE5D,MAAa,eAAe;IACxB,MAAM,CAAC,OAAO,CAAC,IAAY,EAAE,eAA8B,EAAE,aAA4B;QACrF,wDAAwD;QACxD,MAAM,OAAO,GAAG,mBAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACpC,MAAM,iBAAiB,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/E,IAAI,iBAAiB,KAAK,IAAI,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SACrE;QACD,MAAM,qBAAqB,GAAG,kBAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE3E,uFAAuF;QACvF,wEAAwE;QACxE,MAAM,kBAAkB,GAAG,gBAAM;aAC5B,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,IAAI,CAAC;aACZ,MAAM,EAAE;aACR,KAAK,CAAC,CAAC,EAAE,gC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A5CD,0CA4CC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Randomness = void 0;
|
|
4
|
+
const ed25519_1 = require("@noble/ed25519");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
const crypto = require("crypto");
|
|
7
|
+
class Randomness {
|
|
8
|
+
constructor(init) {
|
|
9
|
+
this.salt = init?.salt || Buffer.from(ed25519_1.utils.randomBytes(32));
|
|
10
|
+
this.iv = init?.iv || Buffer.from(ed25519_1.utils.randomBytes(16));
|
|
11
|
+
this.id = init?.id || uuid_1.v4({ random: crypto.randomBytes(16) });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.Randomness = Randomness;
|
|
15
|
+
//# sourceMappingURL=randomness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomness.js","sourceRoot":"","sources":["../../../src/wallet/crypto/randomness.ts"],"names":[],"mappings":";;;AAAA,4CAAuC;AACvC,+BAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEjC,MAAa,UAAU;IAKrB,YAAY,IAA0B;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,IAAI,SAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AAVD,gCAUC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class X25519EncryptedData {
|
|
2
|
+
nonce: string;
|
|
3
|
+
version: number;
|
|
4
|
+
cipher: string;
|
|
5
|
+
ciphertext: string;
|
|
6
|
+
mac: string;
|
|
7
|
+
identities: {
|
|
8
|
+
recipient: string;
|
|
9
|
+
ephemeralPubKey: string;
|
|
10
|
+
originatorPubKey: string;
|
|
11
|
+
};
|
|
12
|
+
constructor(data: Omit<X25519EncryptedData, "toJSON">);
|
|
13
|
+
toJSON(): any;
|
|
14
|
+
static fromJSON(data: any): X25519EncryptedData;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.X25519EncryptedData = void 0;
|
|
4
|
+
class X25519EncryptedData {
|
|
5
|
+
constructor(data) {
|
|
6
|
+
this.nonce = data.nonce;
|
|
7
|
+
this.version = data.version;
|
|
8
|
+
this.cipher = data.cipher;
|
|
9
|
+
this.ciphertext = data.ciphertext;
|
|
10
|
+
this.mac = data.mac;
|
|
11
|
+
this.identities = data.identities;
|
|
12
|
+
}
|
|
13
|
+
toJSON() {
|
|
14
|
+
return {
|
|
15
|
+
version: this.version,
|
|
16
|
+
nonce: this.nonce,
|
|
17
|
+
identities: this.identities,
|
|
18
|
+
crypto: {
|
|
19
|
+
ciphertext: this.ciphertext,
|
|
20
|
+
cipher: this.cipher,
|
|
21
|
+
mac: this.mac,
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
static fromJSON(data) {
|
|
26
|
+
return new X25519EncryptedData({
|
|
27
|
+
nonce: data.nonce,
|
|
28
|
+
version: data.version,
|
|
29
|
+
ciphertext: data.crypto.ciphertext,
|
|
30
|
+
cipher: data.crypto.cipher,
|
|
31
|
+
mac: data.crypto.mac,
|
|
32
|
+
identities: data.identities,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.X25519EncryptedData = X25519EncryptedData;
|
|
37
|
+
//# sourceMappingURL=x25519EncryptedData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x25519EncryptedData.js","sourceRoot":"","sources":["../../../src/wallet/crypto/x25519EncryptedData.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAmB;IAY5B,YAAY,IAAyC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACtC,CAAC;IAED,MAAM;QACF,OAAO;YACH,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE;gBACJ,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;aAChB;SACJ,CAAC;IACN,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,IAAS;QACrB,OAAO,IAAI,mBAAmB,CAAC;YAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;YAClC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG;YACpB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC9B,CAAC,CAAC;IACP,CAAC;CACJ;AA5CD,kDA4CC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./crypto";
|
|
2
|
+
export * from "./keypair";
|
|
3
|
+
export * from "./mnemonic";
|
|
4
|
+
export * from "./pem";
|
|
5
|
+
export * from "./userKeys";
|
|
6
|
+
export * from "./userPem";
|
|
7
|
+
export * from "./userSigner";
|
|
8
|
+
export * from "./userVerifier";
|
|
9
|
+
export * from "./userWallet";
|
|
10
|
+
export * from "./validatorKeys";
|
|
11
|
+
export * from "./validatorSigner";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./crypto"), exports);
|
|
14
|
+
__exportStar(require("./keypair"), exports);
|
|
15
|
+
__exportStar(require("./mnemonic"), exports);
|
|
16
|
+
__exportStar(require("./pem"), exports);
|
|
17
|
+
__exportStar(require("./userKeys"), exports);
|
|
18
|
+
__exportStar(require("./userPem"), exports);
|
|
19
|
+
__exportStar(require("./userSigner"), exports);
|
|
20
|
+
__exportStar(require("./userVerifier"), exports);
|
|
21
|
+
__exportStar(require("./userWallet"), exports);
|
|
22
|
+
__exportStar(require("./validatorKeys"), exports);
|
|
23
|
+
__exportStar(require("./validatorSigner"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,6CAA2B;AAC3B,wCAAsB;AACtB,6CAA2B;AAC3B,4CAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B;AAC/B,+CAA6B;AAC7B,kDAAgC;AAChC,oDAAkC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserPublicKey, UserSecretKey } from "./userKeys";
|
|
2
|
+
export declare class KeyPair {
|
|
3
|
+
readonly secretKey: UserSecretKey;
|
|
4
|
+
readonly publicKey: UserPublicKey;
|
|
5
|
+
constructor(secretKey: UserSecretKey);
|
|
6
|
+
static generate(): KeyPair;
|
|
7
|
+
static newFromBytes(data: Uint8Array): KeyPair;
|
|
8
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
9
|
+
verify(data: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
10
|
+
getSecretKey(): UserSecretKey;
|
|
11
|
+
getPublicKey(): UserPublicKey;
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeyPair = void 0;
|
|
4
|
+
const userKeys_1 = require("./userKeys");
|
|
5
|
+
class KeyPair {
|
|
6
|
+
constructor(secretKey) {
|
|
7
|
+
this.secretKey = secretKey;
|
|
8
|
+
this.publicKey = this.secretKey.generatePublicKey();
|
|
9
|
+
}
|
|
10
|
+
static generate() {
|
|
11
|
+
const secretKey = userKeys_1.UserSecretKey.generate();
|
|
12
|
+
return new KeyPair(secretKey);
|
|
13
|
+
}
|
|
14
|
+
static newFromBytes(data) {
|
|
15
|
+
const secretKey = new userKeys_1.UserSecretKey(data);
|
|
16
|
+
return new KeyPair(secretKey);
|
|
17
|
+
}
|
|
18
|
+
async sign(data) {
|
|
19
|
+
return this.secretKey.sign(data);
|
|
20
|
+
}
|
|
21
|
+
async verify(data, signature) {
|
|
22
|
+
return this.publicKey.verify(data, signature);
|
|
23
|
+
}
|
|
24
|
+
getSecretKey() {
|
|
25
|
+
return this.secretKey;
|
|
26
|
+
}
|
|
27
|
+
getPublicKey() {
|
|
28
|
+
return this.publicKey;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.KeyPair = KeyPair;
|
|
32
|
+
//# sourceMappingURL=keypair.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keypair.js","sourceRoot":"","sources":["../../src/wallet/keypair.ts"],"names":[],"mappings":";;;AAAA,yCAA0D;AAE1D,MAAa,OAAO;IAIhB,YAAY,SAAwB;QAChC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,QAAQ;QACX,MAAM,SAAS,GAAG,wBAAa,CAAC,QAAQ,EAAE,CAAC;QAC3C,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAgB;QAChC,MAAM,SAAS,GAAG,IAAI,wBAAa,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAgB;QACvB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAgB,EAAE,SAAqB;QAChD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClD,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;CACJ;AAlCD,0BAkCC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UserSecretKey } from "./userKeys";
|
|
2
|
+
export declare class Mnemonic {
|
|
3
|
+
private readonly text;
|
|
4
|
+
private constructor();
|
|
5
|
+
static generate(): Mnemonic;
|
|
6
|
+
static fromString(text: string): Mnemonic;
|
|
7
|
+
static fromEntropy(entropy: Uint8Array): Mnemonic;
|
|
8
|
+
static assertTextIsValid(text: string): void;
|
|
9
|
+
deriveKey(addressIndex?: number, password?: string): UserSecretKey;
|
|
10
|
+
getWords(): string[];
|
|
11
|
+
getEntropy(): Uint8Array;
|
|
12
|
+
toString(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mnemonic = void 0;
|
|
4
|
+
const ed25519_hd_key_1 = require("ed25519-hd-key");
|
|
5
|
+
const errors_1 = require("../core/errors");
|
|
6
|
+
const userKeys_1 = require("./userKeys");
|
|
7
|
+
const MNEMONIC_STRENGTH = 256;
|
|
8
|
+
const BIP44_DERIVATION_PREFIX = "m/44'/508'/0'/0'";
|
|
9
|
+
let bip39;
|
|
10
|
+
// Load bip39 when needed
|
|
11
|
+
function loadBip39() {
|
|
12
|
+
if (!bip39) {
|
|
13
|
+
try {
|
|
14
|
+
bip39 = require("bip39");
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
throw new Error("bip39 is required but not installed. Please install 'bip39' to use mnemonic features.");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
class Mnemonic {
|
|
22
|
+
constructor(text) {
|
|
23
|
+
this.text = text;
|
|
24
|
+
}
|
|
25
|
+
static generate() {
|
|
26
|
+
loadBip39();
|
|
27
|
+
const text = bip39.generateMnemonic(MNEMONIC_STRENGTH);
|
|
28
|
+
return new Mnemonic(text);
|
|
29
|
+
}
|
|
30
|
+
static fromString(text) {
|
|
31
|
+
loadBip39();
|
|
32
|
+
text = text.trim();
|
|
33
|
+
Mnemonic.assertTextIsValid(text);
|
|
34
|
+
return new Mnemonic(text);
|
|
35
|
+
}
|
|
36
|
+
static fromEntropy(entropy) {
|
|
37
|
+
loadBip39();
|
|
38
|
+
try {
|
|
39
|
+
const text = bip39.entropyToMnemonic(Buffer.from(entropy));
|
|
40
|
+
return new Mnemonic(text);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new errors_1.ErrBadMnemonicEntropy(err);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
static assertTextIsValid(text) {
|
|
47
|
+
loadBip39();
|
|
48
|
+
let isValid = bip39.validateMnemonic(text);
|
|
49
|
+
if (!isValid) {
|
|
50
|
+
throw new errors_1.ErrWrongMnemonic();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
deriveKey(addressIndex = 0, password = "") {
|
|
54
|
+
loadBip39();
|
|
55
|
+
let seed = bip39.mnemonicToSeedSync(this.text, password);
|
|
56
|
+
let derivationPath = `${BIP44_DERIVATION_PREFIX}/${addressIndex}'`;
|
|
57
|
+
let derivationResult = ed25519_hd_key_1.derivePath(derivationPath, seed.toString("hex"));
|
|
58
|
+
let key = derivationResult.key;
|
|
59
|
+
return new userKeys_1.UserSecretKey(key);
|
|
60
|
+
}
|
|
61
|
+
getWords() {
|
|
62
|
+
return this.text.split(" ");
|
|
63
|
+
}
|
|
64
|
+
getEntropy() {
|
|
65
|
+
loadBip39();
|
|
66
|
+
const entropy = bip39.mnemonicToEntropy(this.text);
|
|
67
|
+
return Buffer.from(entropy, "hex");
|
|
68
|
+
}
|
|
69
|
+
toString() {
|
|
70
|
+
return this.text;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.Mnemonic = Mnemonic;
|
|
74
|
+
//# sourceMappingURL=mnemonic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mnemonic.js","sourceRo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L,CAAC;IAEM,MAAM,CAAC,iBAAiB,CAAC,IAAY;QACxC,SAAS,EAAE,CAAC;QACZ,IAAI,OAAO,GAAG,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAE3C,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,IAAI,yBAAgB,EAAE,CAAC;SAChC;IACL,CAAC;IAED,SAAS,CAAC,eAAuB,CAAC,EAAE,WAAmB,EAAE;QACrD,SAAS,EAAE,CAAC;QACZ,IAAI,IAAI,GAAG,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACzD,IAAI,cAAc,GAAG,GAAG,uBAAuB,IAAI,YAAY,GAAG,CAAC;QACnE,IAAI,gBAAgB,GAAG,2BAAU,CAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,IAAI,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC;QAC/B,OAAO,IAAI,wBAAa,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,UAAU;QACN,SAAS,EAAE,CAAC;QACZ,MAAM,OAAO,GAAG,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AA9DD,4BA8DC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { UserSecretKey } from "./userKeys";
|
|
3
|
+
import { ValidatorSecretKey } from "./validatorKeys";
|
|
4
|
+
export declare function parseUserKey(text: string, index?: number): UserSecretKey;
|
|
5
|
+
export declare function parseUserKeys(text: string): UserSecretKey[];
|
|
6
|
+
export declare function parseValidatorKey(text: string, index?: number): ValidatorSecretKey;
|
|
7
|
+
export declare function parseValidatorKeys(text: string): ValidatorSecretKey[];
|
|
8
|
+
export declare function parse(text: string, expectedLength: number): Buffer[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse = exports.parseValidatorKeys = exports.parseValidatorKey = exports.parseUserKeys = exports.parseUserKey = void 0;
|
|
4
|
+
const errors_1 = require("../core/errors");
|
|
5
|
+
const userKeys_1 = require("./userKeys");
|
|
6
|
+
const validatorKeys_1 = require("./validatorKeys");
|
|
7
|
+
function parseUserKey(text, index = 0) {
|
|
8
|
+
const keys = parseUserKeys(text);
|
|
9
|
+
return keys[index];
|
|
10
|
+
}
|
|
11
|
+
exports.parseUserKey = parseUserKey;
|
|
12
|
+
function parseUserKeys(text) {
|
|
13
|
+
// The user PEM files encode both the seed and the pubkey in their payloads.
|
|
14
|
+
const buffers = parse(text, userKeys_1.USER_SEED_LENGTH + userKeys_1.USER_PUBKEY_LENGTH);
|
|
15
|
+
return buffers.map((buffer) => new userKeys_1.UserSecretKey(buffer.slice(0, userKeys_1.USER_SEED_LENGTH)));
|
|
16
|
+
}
|
|
17
|
+
exports.parseUserKeys = parseUserKeys;
|
|
18
|
+
function parseValidatorKey(text, index = 0) {
|
|
19
|
+
const keys = parseValidatorKeys(text);
|
|
20
|
+
return keys[index];
|
|
21
|
+
}
|
|
22
|
+
exports.parseValidatorKey = parseValidatorKey;
|
|
23
|
+
function parseValidatorKeys(text) {
|
|
24
|
+
const buffers = parse(text, validatorKeys_1.VALIDATOR_SECRETKEY_LENGTH);
|
|
25
|
+
return buffers.map((buffer) => new validatorKeys_1.ValidatorSecretKey(buffer));
|
|
26
|
+
}
|
|
27
|
+
exports.parseValidatorKeys = parseValidatorKeys;
|
|
28
|
+
function parse(text, expectedLength) {
|
|
29
|
+
// Split by newlines, trim whitespace, then discard remaining empty lines.
|
|
30
|
+
const lines = text
|
|
31
|
+
.split(/\r?\n/)
|
|
32
|
+
.map((line) => line.trim())
|
|
33
|
+
.filter((line) => line.length > 0);
|
|
34
|
+
const buffers = [];
|
|
35
|
+
let linesAccumulator = [];
|
|
36
|
+
for (const line of lines) {
|
|
37
|
+
if (line.startsWith("-----BEGIN")) {
|
|
38
|
+
linesAccumulator = [];
|
|
39
|
+
}
|
|
40
|
+
else if (line.startsWith("-----END")) {
|
|
41
|
+
const asBase64 = linesAccumulator.join("");
|
|
42
|
+
const asHex = Buffer.from(asBase64, "base64").toString();
|
|
43
|
+
const asBytes = Buffer.from(asHex, "hex");
|
|
44
|
+
if (asBytes.length != expectedLength) {
|
|
45
|
+
throw new errors_1.ErrBadPEM(`incorrect key length: expected ${expectedLength}, found ${asBytes.length}`);
|
|
46
|
+
}
|
|
47
|
+
buffers.push(asBytes);
|
|
48
|
+
linesAccumulator = [];
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
linesAccumulator.push(line);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (linesAccumulator.length != 0) {
|
|
55
|
+
throw new errors_1.ErrBadPEM("incorrect file structure");
|
|
56
|
+
}
|
|
57
|
+
return buffers;
|
|
58
|
+
}
|
|
59
|
+
exports.parse = parse;
|
|
60
|
+
//# sourceMappingURL=pem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pem.js","sourceRoot":"","sources":["../../src/wallet/pem.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAC3C,yCAAiF;AACjF,mDAAiF;AAEjF,SAAgB,YAAY,CAAC,IAAY,EAAE,QAAgB,CAAC;IACxD,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAHD,oCAGC;AAED,SAAgB,aAAa,CAAC,IAAY;IACtC,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C,EAAE;YACpC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;YACzD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAE1C,IAAI,OAAO,CAAC,MAAM,IAAI,cAAc,EAAE;gBAClC,MAAM,IAAI,kBAAS,CAAC,kCAAkC,cAAc,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;aACpG;YAED,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,gBAAgB,GAAG,EAAE,CAAC;SACzB;aAAM;YACH,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC/B;KACJ;IAED,IAAI,gBAAgB,CAAC,MAAM,IAAI,CAAC,EAAE;QAC9B,MAAM,IAAI,kBAAS,CAAC,0BAA0B,CAAC,CAAC;KACnD;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAjCD,sBAiCC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class PemEntry {
|
|
2
|
+
label: string;
|
|
3
|
+
message: Uint8Array;
|
|
4
|
+
constructor(label: string, message: Uint8Array);
|
|
5
|
+
static fromTextAll(pemText: string): PemEntry[];
|
|
6
|
+
private static groupBlocks;
|
|
7
|
+
toText(): string;
|
|
8
|
+
private static cleanLines;
|
|
9
|
+
private static wrapText;
|
|
10
|
+
}
|