@ledgerhq/context-module 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -6
- package/lib/cjs/index.js +2 -20
- package/lib/cjs/index.js.map +7 -1
- package/lib/cjs/package.json +54 -59
- package/lib/cjs/src/ContextModule.js +2 -3
- package/lib/cjs/src/ContextModule.js.map +7 -1
- package/lib/cjs/src/ContextModuleBuilder.js +2 -87
- package/lib/cjs/src/ContextModuleBuilder.js.map +7 -1
- package/lib/cjs/src/ContextModuleBuilder.test.js +2 -0
- package/lib/cjs/src/ContextModuleBuilder.test.js.map +7 -0
- package/lib/cjs/src/DefaultContextModule.js +2 -21
- package/lib/cjs/src/DefaultContextModule.js.map +7 -1
- package/lib/cjs/src/DefaultContextModule.test.js +2 -0
- package/lib/cjs/src/DefaultContextModule.test.js.map +7 -0
- package/lib/cjs/src/config/di/configModuleFactory.js +2 -10
- package/lib/cjs/src/config/di/configModuleFactory.js.map +7 -1
- package/lib/cjs/src/config/di/configTypes.js +2 -7
- package/lib/cjs/src/config/di/configTypes.js.map +7 -1
- package/lib/cjs/src/config/model/ContextModuleConfig.js +2 -3
- package/lib/cjs/src/config/model/ContextModuleConfig.js.map +7 -1
- package/lib/cjs/src/di.js +2 -17
- package/lib/cjs/src/di.js.map +7 -1
- package/lib/cjs/src/external-plugin/data/DAppDto.js +2 -3
- package/lib/cjs/src/external-plugin/data/DAppDto.js.map +7 -1
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js +2 -3
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -1
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -83
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -1
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +2 -0
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +7 -0
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js +2 -13
- package/lib/cjs/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -1
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.js +2 -8
- package/lib/cjs/src/external-plugin/di/externalPluginTypes.js.map +7 -1
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -136
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -1
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +2 -0
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +7 -0
- package/lib/cjs/src/external-plugin/model/DappInfos.js +2 -3
- package/lib/cjs/src/external-plugin/model/DappInfos.js.map +7 -1
- package/lib/cjs/src/external-plugin/model/SelectorDetails.js +2 -3
- package/lib/cjs/src/external-plugin/model/SelectorDetails.js.map +7 -1
- package/lib/cjs/src/index.js +2 -30
- package/lib/cjs/src/index.js.map +7 -1
- package/lib/cjs/src/nft/data/HttpNftDataSource.js +2 -57
- package/lib/cjs/src/nft/data/HttpNftDataSource.js.map +7 -1
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +2 -0
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +7 -0
- package/lib/cjs/src/nft/data/NftDataSource.js +2 -3
- package/lib/cjs/src/nft/data/NftDataSource.js.map +7 -1
- package/lib/cjs/src/nft/di/nftModuleFactory.js +2 -13
- package/lib/cjs/src/nft/di/nftModuleFactory.js.map +7 -1
- package/lib/cjs/src/nft/di/nftTypes.js +2 -8
- package/lib/cjs/src/nft/di/nftTypes.js.map +7 -1
- package/lib/cjs/src/nft/domain/NftContextLoader.js +2 -111
- package/lib/cjs/src/nft/domain/NftContextLoader.js.map +7 -1
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js +2 -0
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +7 -0
- package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js +2 -0
- package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.js.map +7 -0
- package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.test.js +2 -0
- package/lib/cjs/src/pki/data/HttpPkiCertificateDataSource.test.js.map +7 -0
- package/lib/cjs/src/pki/data/PkiCertificateDataSource.js +2 -0
- package/lib/cjs/src/pki/data/PkiCertificateDataSource.js.map +7 -0
- package/lib/cjs/src/pki/data/pkiDataSourceTypes.js +2 -0
- package/lib/cjs/src/pki/data/pkiDataSourceTypes.js.map +7 -0
- package/lib/cjs/src/pki/di/pkiModuleFactory.js +2 -0
- package/lib/cjs/src/pki/di/pkiModuleFactory.js.map +7 -0
- package/lib/cjs/src/pki/di/pkiTypes.js +2 -0
- package/lib/cjs/src/pki/di/pkiTypes.js.map +7 -0
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js +2 -0
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.js.map +7 -0
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js +2 -0
- package/lib/cjs/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +7 -0
- package/lib/cjs/src/pki/domain/PkiCertificateLoader.js +2 -0
- package/lib/cjs/src/pki/domain/PkiCertificateLoader.js.map +7 -0
- package/lib/cjs/src/pki/model/KeyId.js +2 -0
- package/lib/cjs/src/pki/model/KeyId.js.map +7 -0
- package/lib/cjs/src/pki/model/KeyUsage.js +2 -0
- package/lib/cjs/src/pki/model/KeyUsage.js.map +7 -0
- package/lib/cjs/src/pki/model/PkiCertificate.js +2 -0
- package/lib/cjs/src/pki/model/PkiCertificate.js.map +7 -0
- package/lib/cjs/src/pki/model/PkiCertificateInfo.js +2 -0
- package/lib/cjs/src/pki/model/PkiCertificateInfo.js.map +7 -0
- package/lib/cjs/src/shared/domain/ContextLoader.js +2 -3
- package/lib/cjs/src/shared/domain/ContextLoader.js.map +7 -1
- package/lib/cjs/src/shared/model/ClearSignContext.js +2 -13
- package/lib/cjs/src/shared/model/ClearSignContext.js.map +7 -1
- package/lib/cjs/src/shared/model/GenericPath.js +2 -0
- package/lib/cjs/src/shared/model/GenericPath.js.map +7 -0
- package/lib/cjs/src/shared/model/SignatureTags.js +2 -0
- package/lib/cjs/src/shared/model/SignatureTags.js.map +7 -0
- package/lib/cjs/src/shared/model/TransactionContext.js +2 -3
- package/lib/cjs/src/shared/model/TransactionContext.js.map +7 -1
- package/lib/cjs/src/shared/model/TransactionSubset.js +2 -3
- package/lib/cjs/src/shared/model/TransactionSubset.js.map +7 -1
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.js +2 -6
- package/lib/cjs/src/shared/model/TypedDataClearSignContext.js.map +7 -1
- package/lib/cjs/src/shared/model/TypedDataContext.js +2 -3
- package/lib/cjs/src/shared/model/TypedDataContext.js.map +7 -1
- package/lib/cjs/src/shared/utils/HexStringUtils.js +2 -15
- package/lib/cjs/src/shared/utils/HexStringUtils.js.map +7 -1
- package/lib/cjs/src/shared/utils/HexStringUtils.test.js +2 -0
- package/lib/cjs/src/shared/utils/HexStringUtils.test.js.map +7 -0
- package/lib/cjs/src/shared/utils/KeyUsageMapper.js +2 -0
- package/lib/cjs/src/shared/utils/KeyUsageMapper.js.map +7 -0
- package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js +2 -0
- package/lib/cjs/src/shared/utils/KeyUsageMapper.test.js.map +7 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.js +2 -83
- package/lib/cjs/src/token/data/HttpTokenDataSource.js.map +7 -1
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js +2 -0
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +7 -0
- package/lib/cjs/src/token/data/TokenDataSource.js +2 -3
- package/lib/cjs/src/token/data/TokenDataSource.js.map +7 -1
- package/lib/cjs/src/token/data/TokenDto.js +2 -3
- package/lib/cjs/src/token/data/TokenDto.js.map +7 -1
- package/lib/cjs/src/token/di/tokenModuleFactory.js +2 -13
- package/lib/cjs/src/token/di/tokenModuleFactory.js.map +7 -1
- package/lib/cjs/src/token/di/tokenTypes.js +2 -8
- package/lib/cjs/src/token/di/tokenTypes.js.map +7 -1
- package/lib/cjs/src/token/domain/TokenContextLoader.js +2 -74
- package/lib/cjs/src/token/domain/TokenContextLoader.js.map +7 -1
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js +2 -0
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +7 -0
- package/lib/cjs/src/transaction/data/CalldataDto.js +2 -0
- package/lib/cjs/src/transaction/data/CalldataDto.js.map +7 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +2 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +7 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +2 -0
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +7 -0
- package/lib/cjs/src/transaction/data/TransactionDataSource.js +2 -0
- package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +7 -0
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js +2 -0
- package/lib/cjs/src/transaction/di/transactionModuleFactory.js.map +7 -0
- package/lib/cjs/src/transaction/di/transactionTypes.js +2 -0
- package/lib/cjs/src/transaction/di/transactionTypes.js.map +7 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +2 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +7 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +2 -0
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js +2 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +2 -0
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js +2 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDataSource.js.map +7 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDto.js +2 -0
- package/lib/cjs/src/trusted-name/data/TrustedNameDto.js.map +7 -0
- package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js +2 -0
- package/lib/cjs/src/trusted-name/di/trustedNameModuleFactory.js.map +7 -0
- package/lib/cjs/src/trusted-name/di/trustedNameTypes.js +2 -0
- package/lib/cjs/src/trusted-name/di/trustedNameTypes.js.map +7 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +2 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +7 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +2 -0
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +7 -0
- package/lib/cjs/src/typed-data/data/FiltersDto.js +2 -3
- package/lib/cjs/src/typed-data/data/FiltersDto.js.map +7 -1
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js +2 -163
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -1
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +2 -0
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +7 -0
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.js +2 -3
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.js.map +7 -1
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js +2 -13
- package/lib/cjs/src/typed-data/di/typedDataModuleFactory.js.map +7 -1
- package/lib/cjs/src/typed-data/di/typedDataTypes.js +2 -8
- package/lib/cjs/src/typed-data/di/typedDataTypes.js.map +7 -1
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -127
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -1
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +2 -0
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +7 -0
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js +2 -3
- package/lib/cjs/src/typed-data/domain/TypedDataContextLoader.js.map +7 -1
- package/lib/cjs/src/uniswap/constants/plugin.js +2 -0
- package/lib/cjs/src/uniswap/constants/plugin.js.map +7 -0
- package/lib/cjs/src/uniswap/constants/uniswap.js +2 -0
- package/lib/cjs/src/uniswap/constants/uniswap.js.map +7 -0
- package/lib/cjs/src/uniswap/constants/weth.js +2 -0
- package/lib/cjs/src/uniswap/constants/weth.js.map +7 -0
- package/lib/cjs/src/uniswap/data/AbiDecoderDataSource.js +2 -0
- package/lib/cjs/src/uniswap/data/AbiDecoderDataSource.js.map +7 -0
- package/lib/cjs/src/uniswap/data/CommandDecoderDataSource.js +2 -0
- package/lib/cjs/src/uniswap/data/CommandDecoderDataSource.js.map +7 -0
- package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.js +2 -0
- package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.js.map +7 -0
- package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.test.js +2 -0
- package/lib/cjs/src/uniswap/data/DefaultCommandDecoderDataSource.test.js.map +7 -0
- package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.js +2 -0
- package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.js.map +7 -0
- package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.test.js +2 -0
- package/lib/cjs/src/uniswap/data/EthersAbiDecoderDataSource.test.js.map +7 -0
- package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js +2 -0
- package/lib/cjs/src/uniswap/di/uniswapModuleFactory.js.map +7 -0
- package/lib/cjs/src/uniswap/di/uniswapTypes.js +2 -0
- package/lib/cjs/src/uniswap/di/uniswapTypes.js.map +7 -0
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js +2 -0
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.js.map +7 -0
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js +2 -0
- package/lib/cjs/src/uniswap/domain/UniswapContextLoader.test.js.map +7 -0
- package/lib/esm/index.js +2 -4
- package/lib/esm/index.js.map +7 -1
- package/lib/esm/package.json +54 -59
- package/lib/esm/src/ContextModule.js +1 -2
- package/lib/esm/src/ContextModule.js.map +7 -1
- package/lib/esm/src/ContextModuleBuilder.js +2 -83
- package/lib/esm/src/ContextModuleBuilder.js.map +7 -1
- package/lib/esm/src/ContextModuleBuilder.test.js +2 -0
- package/lib/esm/src/ContextModuleBuilder.test.js.map +7 -0
- package/lib/esm/src/DefaultContextModule.js +2 -17
- package/lib/esm/src/DefaultContextModule.js.map +7 -1
- package/lib/esm/src/DefaultContextModule.test.js +2 -0
- package/lib/esm/src/DefaultContextModule.test.js.map +7 -0
- package/lib/esm/src/config/di/configModuleFactory.js +2 -6
- package/lib/esm/src/config/di/configModuleFactory.js.map +7 -1
- package/lib/esm/src/config/di/configTypes.js +2 -4
- package/lib/esm/src/config/di/configTypes.js.map +7 -1
- package/lib/esm/src/config/model/ContextModuleConfig.js +1 -2
- package/lib/esm/src/config/model/ContextModuleConfig.js.map +7 -1
- package/lib/esm/src/di.js +2 -13
- package/lib/esm/src/di.js.map +7 -1
- package/lib/esm/src/external-plugin/data/DAppDto.js +1 -2
- package/lib/esm/src/external-plugin/data/DAppDto.js.map +7 -1
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js +1 -2
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.js.map +7 -1
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js +2 -77
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.js.map +7 -1
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +2 -0
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +7 -0
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js +2 -9
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.js.map +7 -1
- package/lib/esm/src/external-plugin/di/externalPluginTypes.js +2 -5
- package/lib/esm/src/external-plugin/di/externalPluginTypes.js.map +7 -1
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js +2 -133
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.js.map +7 -1
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +2 -0
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +7 -0
- package/lib/esm/src/external-plugin/model/DappInfos.js +1 -2
- package/lib/esm/src/external-plugin/model/DappInfos.js.map +7 -1
- package/lib/esm/src/external-plugin/model/SelectorDetails.js +1 -2
- package/lib/esm/src/external-plugin/model/SelectorDetails.js.map +7 -1
- package/lib/esm/src/index.js +2 -14
- package/lib/esm/src/index.js.map +7 -1
- package/lib/esm/src/nft/data/HttpNftDataSource.js +2 -51
- package/lib/esm/src/nft/data/HttpNftDataSource.js.map +7 -1
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js +2 -0
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +7 -0
- package/lib/esm/src/nft/data/NftDataSource.js +1 -2
- package/lib/esm/src/nft/data/NftDataSource.js.map +7 -1
- package/lib/esm/src/nft/di/nftModuleFactory.js +2 -9
- package/lib/esm/src/nft/di/nftModuleFactory.js.map +7 -1
- package/lib/esm/src/nft/di/nftTypes.js +2 -5
- package/lib/esm/src/nft/di/nftTypes.js.map +7 -1
- package/lib/esm/src/nft/domain/NftContextLoader.js +2 -108
- package/lib/esm/src/nft/domain/NftContextLoader.js.map +7 -1
- package/lib/esm/src/nft/domain/NftContextLoader.test.js +2 -0
- package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +7 -0
- package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js +2 -0
- package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.js.map +7 -0
- package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.test.js +2 -0
- package/lib/esm/src/pki/data/HttpPkiCertificateDataSource.test.js.map +7 -0
- package/lib/esm/src/pki/data/PkiCertificateDataSource.js +1 -0
- package/lib/esm/src/pki/data/PkiCertificateDataSource.js.map +7 -0
- package/lib/esm/src/pki/data/pkiDataSourceTypes.js +1 -0
- package/lib/esm/src/pki/data/pkiDataSourceTypes.js.map +7 -0
- package/lib/esm/src/pki/di/pkiModuleFactory.js +2 -0
- package/lib/esm/src/pki/di/pkiModuleFactory.js.map +7 -0
- package/lib/esm/src/pki/di/pkiTypes.js +2 -0
- package/lib/esm/src/pki/di/pkiTypes.js.map +7 -0
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js +2 -0
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.js.map +7 -0
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js +2 -0
- package/lib/esm/src/pki/domain/DefaultPkiCertificateLoader.test.js.map +7 -0
- package/lib/esm/src/pki/domain/PkiCertificateLoader.js +1 -0
- package/lib/esm/src/pki/domain/PkiCertificateLoader.js.map +7 -0
- package/lib/esm/src/pki/model/KeyId.js +2 -0
- package/lib/esm/src/pki/model/KeyId.js.map +7 -0
- package/lib/esm/src/pki/model/KeyUsage.js +2 -0
- package/lib/esm/src/pki/model/KeyUsage.js.map +7 -0
- package/lib/esm/src/pki/model/PkiCertificate.js +1 -0
- package/lib/esm/src/pki/model/PkiCertificate.js.map +7 -0
- package/lib/esm/src/pki/model/PkiCertificateInfo.js +1 -0
- package/lib/esm/src/pki/model/PkiCertificateInfo.js.map +7 -0
- package/lib/esm/src/shared/domain/ContextLoader.js +1 -2
- package/lib/esm/src/shared/domain/ContextLoader.js.map +7 -1
- package/lib/esm/src/shared/model/ClearSignContext.js +2 -10
- package/lib/esm/src/shared/model/ClearSignContext.js.map +7 -1
- package/lib/esm/src/shared/model/GenericPath.js +2 -0
- package/lib/esm/src/shared/model/GenericPath.js.map +7 -0
- package/lib/esm/src/shared/model/SignatureTags.js +2 -0
- package/lib/esm/src/shared/model/SignatureTags.js.map +7 -0
- package/lib/esm/src/shared/model/TransactionContext.js +1 -2
- package/lib/esm/src/shared/model/TransactionContext.js.map +7 -1
- package/lib/esm/src/shared/model/TransactionSubset.js +1 -2
- package/lib/esm/src/shared/model/TransactionSubset.js.map +7 -1
- package/lib/esm/src/shared/model/TypedDataClearSignContext.js +2 -3
- package/lib/esm/src/shared/model/TypedDataClearSignContext.js.map +7 -1
- package/lib/esm/src/shared/model/TypedDataContext.js +1 -2
- package/lib/esm/src/shared/model/TypedDataContext.js.map +7 -1
- package/lib/esm/src/shared/utils/HexStringUtils.js +2 -11
- package/lib/esm/src/shared/utils/HexStringUtils.js.map +7 -1
- package/lib/esm/src/shared/utils/HexStringUtils.test.js +2 -0
- package/lib/esm/src/shared/utils/HexStringUtils.test.js.map +7 -0
- package/lib/esm/src/shared/utils/KeyUsageMapper.js +2 -0
- package/lib/esm/src/shared/utils/KeyUsageMapper.js.map +7 -0
- package/lib/esm/src/shared/utils/KeyUsageMapper.test.js +2 -0
- package/lib/esm/src/shared/utils/KeyUsageMapper.test.js.map +7 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.js +2 -77
- package/lib/esm/src/token/data/HttpTokenDataSource.js.map +7 -1
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js +2 -0
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +7 -0
- package/lib/esm/src/token/data/TokenDataSource.js +1 -2
- package/lib/esm/src/token/data/TokenDataSource.js.map +7 -1
- package/lib/esm/src/token/data/TokenDto.js +1 -2
- package/lib/esm/src/token/data/TokenDto.js.map +7 -1
- package/lib/esm/src/token/di/tokenModuleFactory.js +2 -9
- package/lib/esm/src/token/di/tokenModuleFactory.js.map +7 -1
- package/lib/esm/src/token/di/tokenTypes.js +2 -5
- package/lib/esm/src/token/di/tokenTypes.js.map +7 -1
- package/lib/esm/src/token/domain/TokenContextLoader.js +2 -71
- package/lib/esm/src/token/domain/TokenContextLoader.js.map +7 -1
- package/lib/esm/src/token/domain/TokenContextLoader.test.js +2 -0
- package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +7 -0
- package/lib/esm/src/transaction/data/CalldataDto.js +1 -0
- package/lib/esm/src/transaction/data/CalldataDto.js.map +7 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +2 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +7 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +2 -0
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +7 -0
- package/lib/esm/src/transaction/data/TransactionDataSource.js +1 -0
- package/lib/esm/src/transaction/data/TransactionDataSource.js.map +7 -0
- package/lib/esm/src/transaction/di/transactionModuleFactory.js +2 -0
- package/lib/esm/src/transaction/di/transactionModuleFactory.js.map +7 -0
- package/lib/esm/src/transaction/di/transactionTypes.js +2 -0
- package/lib/esm/src/transaction/di/transactionTypes.js.map +7 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js +2 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +7 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +2 -0
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +7 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js +2 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.js.map +7 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +2 -0
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +7 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDataSource.js +1 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDataSource.js.map +7 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDto.js +1 -0
- package/lib/esm/src/trusted-name/data/TrustedNameDto.js.map +7 -0
- package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js +2 -0
- package/lib/esm/src/trusted-name/di/trustedNameModuleFactory.js.map +7 -0
- package/lib/esm/src/trusted-name/di/trustedNameTypes.js +2 -0
- package/lib/esm/src/trusted-name/di/trustedNameTypes.js.map +7 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +2 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +7 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +2 -0
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +7 -0
- package/lib/esm/src/typed-data/data/FiltersDto.js +1 -2
- package/lib/esm/src/typed-data/data/FiltersDto.js.map +7 -1
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js +2 -157
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.js.map +7 -1
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +2 -0
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +7 -0
- package/lib/esm/src/typed-data/data/TypedDataDataSource.js +1 -2
- package/lib/esm/src/typed-data/data/TypedDataDataSource.js.map +7 -1
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js +2 -9
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.js.map +7 -1
- package/lib/esm/src/typed-data/di/typedDataTypes.js +2 -5
- package/lib/esm/src/typed-data/di/typedDataTypes.js.map +7 -1
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js +2 -124
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.js.map +7 -1
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +2 -0
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +7 -0
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js +1 -2
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.js.map +7 -1
- package/lib/esm/src/uniswap/constants/plugin.js +2 -0
- package/lib/esm/src/uniswap/constants/plugin.js.map +7 -0
- package/lib/esm/src/uniswap/constants/uniswap.js +2 -0
- package/lib/esm/src/uniswap/constants/uniswap.js.map +7 -0
- package/lib/esm/src/uniswap/constants/weth.js +2 -0
- package/lib/esm/src/uniswap/constants/weth.js.map +7 -0
- package/lib/esm/src/uniswap/data/AbiDecoderDataSource.js +1 -0
- package/lib/esm/src/uniswap/data/AbiDecoderDataSource.js.map +7 -0
- package/lib/esm/src/uniswap/data/CommandDecoderDataSource.js +1 -0
- package/lib/esm/src/uniswap/data/CommandDecoderDataSource.js.map +7 -0
- package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.js +2 -0
- package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.js.map +7 -0
- package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.test.js +2 -0
- package/lib/esm/src/uniswap/data/DefaultCommandDecoderDataSource.test.js.map +7 -0
- package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.js +2 -0
- package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.js.map +7 -0
- package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.test.js +2 -0
- package/lib/esm/src/uniswap/data/EthersAbiDecoderDataSource.test.js.map +7 -0
- package/lib/esm/src/uniswap/di/uniswapModuleFactory.js +2 -0
- package/lib/esm/src/uniswap/di/uniswapModuleFactory.js.map +7 -0
- package/lib/esm/src/uniswap/di/uniswapTypes.js +2 -0
- package/lib/esm/src/uniswap/di/uniswapTypes.js.map +7 -0
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.js +2 -0
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.js.map +7 -0
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js +2 -0
- package/lib/esm/src/uniswap/domain/UniswapContextLoader.test.js.map +7 -0
- package/lib/{cjs → types}/src/ContextModule.d.ts +3 -2
- package/lib/types/src/ContextModule.d.ts.map +1 -0
- package/lib/{cjs → types}/src/ContextModuleBuilder.d.ts +9 -11
- package/lib/types/src/ContextModuleBuilder.d.ts.map +1 -0
- package/lib/types/src/ContextModuleBuilder.test.d.ts +2 -0
- package/lib/types/src/ContextModuleBuilder.test.d.ts.map +1 -0
- package/lib/types/src/DefaultContextModule.d.ts +18 -0
- package/lib/types/src/DefaultContextModule.d.ts.map +1 -0
- package/lib/types/src/DefaultContextModule.test.d.ts +2 -0
- package/lib/types/src/DefaultContextModule.test.d.ts.map +1 -0
- package/lib/{cjs → types}/src/config/di/configModuleFactory.d.ts +1 -1
- package/lib/{cjs → types}/src/config/di/configModuleFactory.d.ts.map +1 -1
- package/lib/types/src/config/model/ContextModuleConfig.d.ts +16 -0
- package/lib/types/src/config/model/ContextModuleConfig.d.ts.map +1 -0
- package/lib/{cjs → types}/src/di.d.ts +1 -1
- package/lib/types/src/di.d.ts.map +1 -0
- package/lib/{cjs → types}/src/external-plugin/data/ExternalPluginDataSource.d.ts +3 -3
- package/lib/types/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +1 -0
- package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.test.d.ts +2 -0
- package/lib/types/src/external-plugin/data/HttpExternalPluginDataSource.test.d.ts.map +1 -0
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.test.d.ts +2 -0
- package/lib/types/src/external-plugin/domain/ExternalPluginContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/external-plugin/model/DappInfos.d.ts +6 -0
- package/lib/types/src/external-plugin/model/DappInfos.d.ts.map +1 -0
- package/lib/{cjs → types}/src/index.d.ts +8 -1
- package/lib/types/src/index.d.ts.map +1 -0
- package/lib/types/src/nft/data/HttpNftDataSource.test.d.ts +2 -0
- package/lib/types/src/nft/data/HttpNftDataSource.test.d.ts.map +1 -0
- package/lib/{cjs → types}/src/nft/data/NftDataSource.d.ts +1 -1
- package/lib/types/src/nft/data/NftDataSource.d.ts.map +1 -0
- package/lib/{cjs → types}/src/nft/domain/NftContextLoader.d.ts +2 -1
- package/lib/types/src/nft/domain/NftContextLoader.d.ts.map +1 -0
- package/lib/types/src/nft/domain/NftContextLoader.test.d.ts +2 -0
- package/lib/types/src/nft/domain/NftContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts +12 -0
- package/lib/types/src/pki/data/HttpPkiCertificateDataSource.d.ts.map +1 -0
- package/lib/types/src/pki/data/HttpPkiCertificateDataSource.test.d.ts +2 -0
- package/lib/types/src/pki/data/HttpPkiCertificateDataSource.test.d.ts.map +1 -0
- package/lib/types/src/pki/data/PkiCertificateDataSource.d.ts +7 -0
- package/lib/types/src/pki/data/PkiCertificateDataSource.d.ts.map +1 -0
- package/lib/types/src/pki/data/pkiDataSourceTypes.d.ts +23 -0
- package/lib/types/src/pki/data/pkiDataSourceTypes.d.ts.map +1 -0
- package/lib/types/src/pki/di/pkiModuleFactory.d.ts +3 -0
- package/lib/types/src/pki/di/pkiModuleFactory.d.ts.map +1 -0
- package/lib/types/src/pki/di/pkiTypes.d.ts +5 -0
- package/lib/types/src/pki/di/pkiTypes.d.ts.map +1 -0
- package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts +10 -0
- package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.d.ts.map +1 -0
- package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.test.d.ts +2 -0
- package/lib/types/src/pki/domain/DefaultPkiCertificateLoader.test.d.ts.map +1 -0
- package/lib/types/src/pki/domain/PkiCertificateLoader.d.ts +6 -0
- package/lib/types/src/pki/domain/PkiCertificateLoader.d.ts.map +1 -0
- package/lib/types/src/pki/model/KeyId.d.ts +14 -0
- package/lib/types/src/pki/model/KeyId.d.ts.map +1 -0
- package/lib/types/src/pki/model/KeyUsage.d.ts +15 -0
- package/lib/types/src/pki/model/KeyUsage.d.ts.map +1 -0
- package/lib/types/src/pki/model/PkiCertificate.d.ts +5 -0
- package/lib/types/src/pki/model/PkiCertificate.d.ts.map +1 -0
- package/lib/types/src/pki/model/PkiCertificateInfo.d.ts +7 -0
- package/lib/types/src/pki/model/PkiCertificateInfo.d.ts.map +1 -0
- package/lib/types/src/shared/domain/ContextLoader.d.ts +7 -0
- package/lib/types/src/shared/domain/ContextLoader.d.ts.map +1 -0
- package/lib/types/src/shared/model/ClearSignContext.d.ts +51 -0
- package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -0
- package/lib/types/src/shared/model/GenericPath.d.ts +105 -0
- package/lib/types/src/shared/model/GenericPath.d.ts.map +1 -0
- package/lib/types/src/shared/model/SignatureTags.d.ts +3 -0
- package/lib/types/src/shared/model/SignatureTags.d.ts.map +1 -0
- package/lib/types/src/shared/model/TransactionContext.d.ts +21 -0
- package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -0
- package/lib/types/src/shared/utils/HexStringUtils.d.ts +5 -0
- package/lib/{cjs → types}/src/shared/utils/HexStringUtils.d.ts.map +1 -1
- package/lib/types/src/shared/utils/HexStringUtils.test.d.ts +2 -0
- package/lib/types/src/shared/utils/HexStringUtils.test.d.ts.map +1 -0
- package/lib/types/src/shared/utils/KeyUsageMapper.d.ts +6 -0
- package/lib/types/src/shared/utils/KeyUsageMapper.d.ts.map +1 -0
- package/lib/types/src/shared/utils/KeyUsageMapper.test.d.ts +2 -0
- package/lib/types/src/shared/utils/KeyUsageMapper.test.d.ts.map +1 -0
- package/lib/{cjs → types}/src/token/data/HttpTokenDataSource.d.ts.map +1 -1
- package/lib/types/src/token/data/HttpTokenDataSource.test.d.ts +2 -0
- package/lib/types/src/token/data/HttpTokenDataSource.test.d.ts.map +1 -0
- package/lib/{cjs → types}/src/token/data/TokenDataSource.d.ts +1 -1
- package/lib/types/src/token/data/TokenDataSource.d.ts.map +1 -0
- package/lib/types/src/token/data/TokenDto.d.ts +16 -0
- package/lib/types/src/token/data/TokenDto.d.ts.map +1 -0
- package/lib/{cjs → types}/src/token/domain/TokenContextLoader.d.ts +2 -1
- package/lib/types/src/token/domain/TokenContextLoader.d.ts.map +1 -0
- package/lib/types/src/token/domain/TokenContextLoader.test.d.ts +2 -0
- package/lib/types/src/token/domain/TokenContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/transaction/data/CalldataDto.d.ts +128 -0
- package/lib/types/src/transaction/data/CalldataDto.d.ts.map +1 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts +23 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts +2 -0
- package/lib/types/src/transaction/data/HttpTransactionDataSource.test.d.ts.map +1 -0
- package/lib/types/src/transaction/data/TransactionDataSource.d.ts +13 -0
- package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +1 -0
- package/lib/types/src/transaction/di/transactionModuleFactory.d.ts +3 -0
- package/lib/types/src/transaction/di/transactionModuleFactory.d.ts.map +1 -0
- package/lib/types/src/transaction/di/transactionTypes.d.ts +5 -0
- package/lib/types/src/transaction/di/transactionTypes.d.ts.map +1 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts +10 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts +2 -0
- package/lib/types/src/transaction/domain/TransactionContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts +11 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts +2 -0
- package/lib/types/src/trusted-name/data/HttpTrustedNameDataSource.test.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts +16 -0
- package/lib/types/src/trusted-name/data/TrustedNameDataSource.d.ts.map +1 -0
- package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts +15 -0
- package/lib/types/src/trusted-name/data/TrustedNameDto.d.ts.map +1 -0
- package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts +3 -0
- package/lib/types/src/trusted-name/di/trustedNameModuleFactory.d.ts.map +1 -0
- package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts +5 -0
- package/lib/types/src/trusted-name/di/trustedNameTypes.d.ts.map +1 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts +12 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.d.ts.map +1 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts +2 -0
- package/lib/types/src/trusted-name/domain/TrustedNameContextLoader.test.d.ts.map +1 -0
- package/lib/{cjs → types}/src/typed-data/data/FiltersDto.d.ts +3 -0
- package/lib/types/src/typed-data/data/FiltersDto.d.ts.map +1 -0
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +1 -0
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts +3 -0
- package/lib/types/src/typed-data/data/HttpTypedDataDataSource.test.d.ts.map +1 -0
- package/lib/{cjs → types}/src/typed-data/data/TypedDataDataSource.d.ts +3 -3
- package/lib/types/src/typed-data/data/TypedDataDataSource.d.ts.map +1 -0
- package/lib/{cjs → types}/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +1 -1
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.test.d.ts +2 -0
- package/lib/types/src/typed-data/domain/DefaultTypedDataContextLoader.test.d.ts.map +1 -0
- package/lib/types/src/uniswap/constants/plugin.d.ts +3 -0
- package/lib/types/src/uniswap/constants/plugin.d.ts.map +1 -0
- package/lib/types/src/uniswap/constants/uniswap.d.ts +21 -0
- package/lib/types/src/uniswap/constants/uniswap.d.ts.map +1 -0
- package/lib/types/src/uniswap/constants/weth.d.ts +20 -0
- package/lib/types/src/uniswap/constants/weth.d.ts.map +1 -0
- package/lib/types/src/uniswap/data/AbiDecoderDataSource.d.ts +5 -0
- package/lib/types/src/uniswap/data/AbiDecoderDataSource.d.ts.map +1 -0
- package/lib/types/src/uniswap/data/CommandDecoderDataSource.d.ts +6 -0
- package/lib/types/src/uniswap/data/CommandDecoderDataSource.d.ts.map +1 -0
- package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.d.ts +14 -0
- package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.d.ts.map +1 -0
- package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.test.d.ts +2 -0
- package/lib/types/src/uniswap/data/DefaultCommandDecoderDataSource.test.d.ts.map +1 -0
- package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.d.ts +5 -0
- package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.d.ts.map +1 -0
- package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.test.d.ts +2 -0
- package/lib/types/src/uniswap/data/EthersAbiDecoderDataSource.test.d.ts.map +1 -0
- package/lib/types/src/uniswap/di/uniswapModuleFactory.d.ts +3 -0
- package/lib/types/src/uniswap/di/uniswapModuleFactory.d.ts.map +1 -0
- package/lib/types/src/uniswap/di/uniswapTypes.d.ts +6 -0
- package/lib/types/src/uniswap/di/uniswapTypes.d.ts.map +1 -0
- package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts +105 -0
- package/lib/types/src/uniswap/domain/UniswapContextLoader.d.ts.map +1 -0
- package/lib/types/src/uniswap/domain/UniswapContextLoader.test.d.ts +2 -0
- package/lib/types/src/uniswap/domain/UniswapContextLoader.test.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -0
- package/package.json +25 -30
- package/lib/cjs/src/ContextModule.d.ts.map +0 -1
- package/lib/cjs/src/ContextModuleBuilder.d.ts.map +0 -1
- package/lib/cjs/src/DefaultContextModule.d.ts +0 -20
- package/lib/cjs/src/DefaultContextModule.d.ts.map +0 -1
- package/lib/cjs/src/config/model/ContextModuleConfig.d.ts +0 -9
- package/lib/cjs/src/config/model/ContextModuleConfig.d.ts.map +0 -1
- package/lib/cjs/src/di.d.ts.map +0 -1
- package/lib/cjs/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +0 -1
- package/lib/cjs/src/external-plugin/model/DappInfos.d.ts +0 -6
- package/lib/cjs/src/external-plugin/model/DappInfos.d.ts.map +0 -1
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts +0 -9
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +0 -1
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js +0 -3
- package/lib/cjs/src/forward-domain/data/ForwardDomainDataSource.js.map +0 -1
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +0 -6
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +0 -1
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js +0 -40
- package/lib/cjs/src/forward-domain/data/HttpForwardDomainDataSource.js.map +0 -1
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts +0 -3
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +0 -1
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js +0 -13
- package/lib/cjs/src/forward-domain/di/forwardDomainModuleFactory.js.map +0 -1
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts +0 -5
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.d.ts.map +0 -1
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js +0 -8
- package/lib/cjs/src/forward-domain/di/forwardDomainTypes.js.map +0 -1
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +0 -11
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +0 -1
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js +0 -66
- package/lib/cjs/src/forward-domain/domain/ForwardDomainContextLoader.js.map +0 -1
- package/lib/cjs/src/index.d.ts.map +0 -1
- package/lib/cjs/src/nft/data/NftDataSource.d.ts.map +0 -1
- package/lib/cjs/src/nft/domain/NftContextLoader.d.ts.map +0 -1
- package/lib/cjs/src/shared/domain/ContextLoader.d.ts +0 -6
- package/lib/cjs/src/shared/domain/ContextLoader.d.ts.map +0 -1
- package/lib/cjs/src/shared/model/ClearSignContext.d.ts +0 -21
- package/lib/cjs/src/shared/model/ClearSignContext.d.ts.map +0 -1
- package/lib/cjs/src/shared/model/TransactionContext.d.ts +0 -6
- package/lib/cjs/src/shared/model/TransactionContext.d.ts.map +0 -1
- package/lib/cjs/src/shared/utils/HexStringUtils.d.ts +0 -4
- package/lib/cjs/src/token/data/TokenDataSource.d.ts.map +0 -1
- package/lib/cjs/src/token/data/TokenDto.d.ts +0 -6
- package/lib/cjs/src/token/data/TokenDto.d.ts.map +0 -1
- package/lib/cjs/src/token/domain/TokenContextLoader.d.ts.map +0 -1
- package/lib/cjs/src/typed-data/data/FiltersDto.d.ts.map +0 -1
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +0 -1
- package/lib/cjs/src/typed-data/data/TypedDataDataSource.d.ts.map +0 -1
- package/lib/cjs/tsconfig.cjs.tsbuildinfo +0 -1
- package/lib/esm/index.d.ts +0 -3
- package/lib/esm/index.d.ts.map +0 -1
- package/lib/esm/src/ContextModule.d.ts +0 -9
- package/lib/esm/src/ContextModule.d.ts.map +0 -1
- package/lib/esm/src/ContextModuleBuilder.d.ts +0 -45
- package/lib/esm/src/ContextModuleBuilder.d.ts.map +0 -1
- package/lib/esm/src/DefaultContextModule.d.ts +0 -20
- package/lib/esm/src/DefaultContextModule.d.ts.map +0 -1
- package/lib/esm/src/config/di/configModuleFactory.d.ts +0 -4
- package/lib/esm/src/config/di/configModuleFactory.d.ts.map +0 -1
- package/lib/esm/src/config/di/configTypes.d.ts +0 -4
- package/lib/esm/src/config/di/configTypes.d.ts.map +0 -1
- package/lib/esm/src/config/model/ContextModuleConfig.d.ts +0 -9
- package/lib/esm/src/config/model/ContextModuleConfig.d.ts.map +0 -1
- package/lib/esm/src/di.d.ts +0 -8
- package/lib/esm/src/di.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/data/DAppDto.d.ts +0 -38
- package/lib/esm/src/external-plugin/data/DAppDto.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts +0 -12
- package/lib/esm/src/external-plugin/data/ExternalPluginDataSource.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +0 -10
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts +0 -3
- package/lib/esm/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts +0 -5
- package/lib/esm/src/external-plugin/di/externalPluginTypes.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +0 -15
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/model/DappInfos.d.ts +0 -6
- package/lib/esm/src/external-plugin/model/DappInfos.d.ts.map +0 -1
- package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts +0 -8
- package/lib/esm/src/external-plugin/model/SelectorDetails.d.ts.map +0 -1
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts +0 -9
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.d.ts.map +0 -1
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js +0 -2
- package/lib/esm/src/forward-domain/data/ForwardDomainDataSource.js.map +0 -1
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts +0 -6
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.d.ts.map +0 -1
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js +0 -34
- package/lib/esm/src/forward-domain/data/HttpForwardDomainDataSource.js.map +0 -1
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts +0 -3
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.d.ts.map +0 -1
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js +0 -9
- package/lib/esm/src/forward-domain/di/forwardDomainModuleFactory.js.map +0 -1
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts +0 -5
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.d.ts.map +0 -1
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.js +0 -5
- package/lib/esm/src/forward-domain/di/forwardDomainTypes.js.map +0 -1
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts +0 -11
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.d.ts.map +0 -1
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js +0 -63
- package/lib/esm/src/forward-domain/domain/ForwardDomainContextLoader.js.map +0 -1
- package/lib/esm/src/index.d.ts +0 -14
- package/lib/esm/src/index.d.ts.map +0 -1
- package/lib/esm/src/nft/data/HttpNftDataSource.d.ts +0 -7
- package/lib/esm/src/nft/data/HttpNftDataSource.d.ts.map +0 -1
- package/lib/esm/src/nft/data/NftDataSource.d.ts +0 -15
- package/lib/esm/src/nft/data/NftDataSource.d.ts.map +0 -1
- package/lib/esm/src/nft/di/nftModuleFactory.d.ts +0 -3
- package/lib/esm/src/nft/di/nftModuleFactory.d.ts.map +0 -1
- package/lib/esm/src/nft/di/nftTypes.d.ts +0 -5
- package/lib/esm/src/nft/di/nftTypes.d.ts.map +0 -1
- package/lib/esm/src/nft/domain/NftContextLoader.d.ts +0 -11
- package/lib/esm/src/nft/domain/NftContextLoader.d.ts.map +0 -1
- package/lib/esm/src/shared/domain/ContextLoader.d.ts +0 -6
- package/lib/esm/src/shared/domain/ContextLoader.d.ts.map +0 -1
- package/lib/esm/src/shared/model/ClearSignContext.d.ts +0 -21
- package/lib/esm/src/shared/model/ClearSignContext.d.ts.map +0 -1
- package/lib/esm/src/shared/model/TransactionContext.d.ts +0 -6
- package/lib/esm/src/shared/model/TransactionContext.d.ts.map +0 -1
- package/lib/esm/src/shared/model/TransactionSubset.d.ts +0 -6
- package/lib/esm/src/shared/model/TransactionSubset.d.ts.map +0 -1
- package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts +0 -33
- package/lib/esm/src/shared/model/TypedDataClearSignContext.d.ts.map +0 -1
- package/lib/esm/src/shared/model/TypedDataContext.d.ts +0 -16
- package/lib/esm/src/shared/model/TypedDataContext.d.ts.map +0 -1
- package/lib/esm/src/shared/utils/HexStringUtils.d.ts +0 -4
- package/lib/esm/src/shared/utils/HexStringUtils.d.ts.map +0 -1
- package/lib/esm/src/token/data/HttpTokenDataSource.d.ts +0 -9
- package/lib/esm/src/token/data/HttpTokenDataSource.d.ts.map +0 -1
- package/lib/esm/src/token/data/TokenDataSource.d.ts +0 -9
- package/lib/esm/src/token/data/TokenDataSource.d.ts.map +0 -1
- package/lib/esm/src/token/data/TokenDto.d.ts +0 -6
- package/lib/esm/src/token/data/TokenDto.d.ts.map +0 -1
- package/lib/esm/src/token/di/tokenModuleFactory.d.ts +0 -3
- package/lib/esm/src/token/di/tokenModuleFactory.d.ts.map +0 -1
- package/lib/esm/src/token/di/tokenTypes.d.ts +0 -5
- package/lib/esm/src/token/di/tokenTypes.d.ts.map +0 -1
- package/lib/esm/src/token/domain/TokenContextLoader.d.ts +0 -15
- package/lib/esm/src/token/domain/TokenContextLoader.d.ts.map +0 -1
- package/lib/esm/src/typed-data/data/FiltersDto.d.ts +0 -55
- package/lib/esm/src/typed-data/data/FiltersDto.d.ts.map +0 -1
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts +0 -14
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.d.ts.map +0 -1
- package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts +0 -17
- package/lib/esm/src/typed-data/data/TypedDataDataSource.d.ts.map +0 -1
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts +0 -3
- package/lib/esm/src/typed-data/di/typedDataModuleFactory.d.ts.map +0 -1
- package/lib/esm/src/typed-data/di/typedDataTypes.d.ts +0 -5
- package/lib/esm/src/typed-data/di/typedDataTypes.d.ts.map +0 -1
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +0 -13
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts.map +0 -1
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts +0 -6
- package/lib/esm/src/typed-data/domain/TypedDataContextLoader.d.ts.map +0 -1
- package/lib/esm/tsconfig.esm.tsbuildinfo +0 -1
- /package/lib/{cjs → types}/index.d.ts +0 -0
- /package/lib/{cjs → types}/index.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/config/di/configTypes.d.ts +0 -0
- /package/lib/{cjs → types}/src/config/di/configTypes.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/external-plugin/data/DAppDto.d.ts +0 -0
- /package/lib/{cjs → types}/src/external-plugin/data/DAppDto.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/external-plugin/data/HttpExternalPluginDataSource.d.ts +0 -0
- /package/lib/{cjs → types}/src/external-plugin/data/HttpExternalPluginDataSource.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/external-plugin/di/externalPluginModuleFactory.d.ts +0 -0
- /package/lib/{cjs → types}/src/external-plugin/di/externalPluginModuleFactory.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/external-plugin/di/externalPluginTypes.d.ts +0 -0
- /package/lib/{cjs → types}/src/external-plugin/di/externalPluginTypes.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/external-plugin/domain/ExternalPluginContextLoader.d.ts +0 -0
- /package/lib/{cjs → types}/src/external-plugin/domain/ExternalPluginContextLoader.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/external-plugin/model/SelectorDetails.d.ts +0 -0
- /package/lib/{cjs → types}/src/external-plugin/model/SelectorDetails.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/nft/data/HttpNftDataSource.d.ts +0 -0
- /package/lib/{cjs → types}/src/nft/data/HttpNftDataSource.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/nft/di/nftModuleFactory.d.ts +0 -0
- /package/lib/{cjs → types}/src/nft/di/nftModuleFactory.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/nft/di/nftTypes.d.ts +0 -0
- /package/lib/{cjs → types}/src/nft/di/nftTypes.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/shared/model/TransactionSubset.d.ts +0 -0
- /package/lib/{cjs → types}/src/shared/model/TransactionSubset.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/shared/model/TypedDataClearSignContext.d.ts +0 -0
- /package/lib/{cjs → types}/src/shared/model/TypedDataClearSignContext.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/shared/model/TypedDataContext.d.ts +0 -0
- /package/lib/{cjs → types}/src/shared/model/TypedDataContext.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/token/data/HttpTokenDataSource.d.ts +0 -0
- /package/lib/{cjs → types}/src/token/di/tokenModuleFactory.d.ts +0 -0
- /package/lib/{cjs → types}/src/token/di/tokenModuleFactory.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/token/di/tokenTypes.d.ts +0 -0
- /package/lib/{cjs → types}/src/token/di/tokenTypes.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/typed-data/data/HttpTypedDataDataSource.d.ts +0 -0
- /package/lib/{cjs → types}/src/typed-data/di/typedDataModuleFactory.d.ts +0 -0
- /package/lib/{cjs → types}/src/typed-data/di/typedDataModuleFactory.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/typed-data/di/typedDataTypes.d.ts +0 -0
- /package/lib/{cjs → types}/src/typed-data/di/typedDataTypes.d.ts.map +0 -0
- /package/lib/{cjs → types}/src/typed-data/domain/DefaultTypedDataContextLoader.d.ts +0 -0
- /package/lib/{cjs → types}/src/typed-data/domain/TypedDataContextLoader.d.ts +0 -0
- /package/lib/{cjs → types}/src/typed-data/domain/TypedDataContextLoader.d.ts.map +0 -0
package/lib/cjs/src/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from \"./config/model/ContextModuleConfig\";\nexport * from \"./ContextModule\";\nexport * from \"./ContextModuleBuilder\";\nexport * from \"./DefaultContextModule\";\nexport * from \"./external-plugin/domain/ExternalPluginContextLoader\";\nexport * from \"./nft/domain/NftContextLoader\";\nexport * from \"./pki/domain/PkiCertificateLoader\";\nexport * from \"./pki/model/KeyId\";\nexport * from \"./pki/model/KeyUsage\";\nexport * from \"./pki/model/PkiCertificate\";\nexport * from \"./pki/model/PkiCertificateInfo\";\nexport * from \"./shared/domain/ContextLoader\";\nexport * from \"./shared/model/ClearSignContext\";\nexport * from \"./shared/model/GenericPath\";\nexport * from \"./shared/model/TransactionContext\";\nexport * from \"./shared/model/TransactionSubset\";\nexport * from \"./shared/model/TypedDataClearSignContext\";\nexport * from \"./shared/model/TypedDataContext\";\nexport * from \"./token/domain/TokenContextLoader\";\nexport * from \"./trusted-name/domain/TrustedNameContextLoader\";\n"],
|
|
5
|
+
"mappings": "iaAAA,IAAAA,EAAA,kBAAAC,EAAAD,GAAAE,EAAAF,EAAc,8CAAd,gBACAE,EAAAF,EAAc,2BADd,gBAEAE,EAAAF,EAAc,kCAFd,gBAGAE,EAAAF,EAAc,kCAHd,gBAIAE,EAAAF,EAAc,gEAJd,gBAKAE,EAAAF,EAAc,yCALd,gBAMAE,EAAAF,EAAc,6CANd,gBAOAE,EAAAF,EAAc,6BAPd,gBAQAE,EAAAF,EAAc,gCARd,gBASAE,EAAAF,EAAc,sCATd,gBAUAE,EAAAF,EAAc,0CAVd,gBAWAE,EAAAF,EAAc,yCAXd,gBAYAE,EAAAF,EAAc,2CAZd,gBAaAE,EAAAF,EAAc,sCAbd,gBAcAE,EAAAF,EAAc,6CAdd,gBAeAE,EAAAF,EAAc,4CAfd,gBAgBAE,EAAAF,EAAc,oDAhBd,gBAiBAE,EAAAF,EAAc,2CAjBd,gBAkBAE,EAAAF,EAAc,6CAlBd,gBAmBAE,EAAAF,EAAc,0DAnBd",
|
|
6
|
+
"names": ["src_exports", "__toCommonJS", "__reExport"]
|
|
7
|
+
}
|
|
@@ -1,57 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.HttpNftDataSource = void 0;
|
|
13
|
-
const axios_1 = __importDefault(require("axios"));
|
|
14
|
-
const inversify_1 = require("inversify");
|
|
15
|
-
const purify_ts_1 = require("purify-ts");
|
|
16
|
-
const package_json_1 = __importDefault(require("../../../package.json"));
|
|
17
|
-
let HttpNftDataSource = class HttpNftDataSource {
|
|
18
|
-
async getSetPluginPayload({ chainId, address, selector, }) {
|
|
19
|
-
try {
|
|
20
|
-
const response = await axios_1.default.request({
|
|
21
|
-
method: "GET",
|
|
22
|
-
url: `https://nft.api.live.ledger.com/v1/ethereum/${chainId}/contracts/${address}/plugin-selector/${selector}`,
|
|
23
|
-
headers: {
|
|
24
|
-
"X-Ledger-Client-Version": `context-module/${package_json_1.default.version}`,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
return response.data.payload
|
|
28
|
-
? (0, purify_ts_1.Right)(response.data.payload)
|
|
29
|
-
: (0, purify_ts_1.Left)(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"));
|
|
30
|
-
}
|
|
31
|
-
catch (_error) {
|
|
32
|
-
return (0, purify_ts_1.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async getNftInfosPayload({ chainId, address, }) {
|
|
36
|
-
try {
|
|
37
|
-
const response = await axios_1.default.request({
|
|
38
|
-
method: "GET",
|
|
39
|
-
url: `https://nft.api.live.ledger.com/v1/ethereum/${chainId}/contracts/${address}`,
|
|
40
|
-
headers: {
|
|
41
|
-
"X-Ledger-Client-Version": `context-module/${package_json_1.default.version}`,
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
return response.data.payload
|
|
45
|
-
? (0, purify_ts_1.Right)(response.data.payload)
|
|
46
|
-
: (0, purify_ts_1.Left)(new Error("[ContextModule] HttpNftDataSource: no nft metadata"));
|
|
47
|
-
}
|
|
48
|
-
catch (_error) {
|
|
49
|
-
return (0, purify_ts_1.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
exports.HttpNftDataSource = HttpNftDataSource;
|
|
54
|
-
exports.HttpNftDataSource = HttpNftDataSource = __decorate([
|
|
55
|
-
(0, inversify_1.injectable)()
|
|
56
|
-
], HttpNftDataSource);
|
|
57
|
-
//# sourceMappingURL=HttpNftDataSource.js.map
|
|
1
|
+
"use strict";var y=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},u=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of P(t))!x.call(e,r)&&r!==o&&i(e,r,{get:()=>t[r],enumerable:!(a=c(t,r))||a.enumerable});return e};var f=(e,t,o)=>(o=e!=null?y(E(e)):{},u(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),G=e=>u(i({},"__esModule",{value:!0}),e),g=(e,t,o,a)=>{for(var r=a>1?void 0:a?c(t,o):t,l=e.length-1,d;l>=0;l--)(d=e[l])&&(r=(a?d(t,o,r):d(r))||r);return a&&r&&i(t,o,r),r};var $={};C($,{HttpNftDataSource:()=>s});module.exports=G($);var m=f(require("axios")),h=require("inversify"),n=require("purify-ts"),p=f(require("../../../package.json"));let s=class{async getSetPluginPayload({chainId:t,address:o,selector:a}){try{const r=await m.default.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${t}/contracts/${o}/plugin-selector/${a}`,headers:{"X-Ledger-Client-Version":`context-module/${p.default.version}`}});return r.data.payload?(0,n.Right)(r.data.payload):(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}catch{return(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}}async getNftInfosPayload({chainId:t,address:o}){try{const a=await m.default.request({method:"GET",url:`https://nft.api.live.ledger.com/v1/ethereum/${t}/contracts/${o}`,headers:{"X-Ledger-Client-Version":`context-module/${p.default.version}`}});return a.data.payload?(0,n.Right)(a.data.payload):(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}catch{return(0,n.Left)(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}}};s=g([(0,h.injectable)()],s);0&&(module.exports={HttpNftDataSource});
|
|
2
|
+
//# sourceMappingURL=HttpNftDataSource.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/nft/data/HttpNftDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport {\n GetNftInformationsParams,\n GetSetPluginPayloadParams,\n NftDataSource,\n} from \"@/nft/data/NftDataSource\";\nimport PACKAGE from \"@root/package.json\";\n\n@injectable()\nexport class HttpNftDataSource implements NftDataSource {\n public async getSetPluginPayload({\n chainId,\n address,\n selector,\n }: GetSetPluginPayloadParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `https://nft.api.live.ledger.com/v1/ethereum/${chainId}/contracts/${address}/plugin-selector/${selector}`,\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n }\n }\n\n public async getNftInfosPayload({\n chainId,\n address,\n }: GetNftInformationsParams): Promise<Either<Error, string>> {\n try {\n const response = await axios.request<{ payload: string }>({\n method: \"GET\",\n url: `https://nft.api.live.ledger.com/v1/ethereum/${chainId}/contracts/${address}`,\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n\n return response.data.payload\n ? Right(response.data.payload)\n : Left(new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"));\n } catch (_error) {\n return Left(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "4rBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAkB,oBAClBC,EAA2B,qBAC3BC,EAAoC,qBAOpCC,EAAoB,iCAGb,IAAMC,EAAN,KAAiD,CACtD,MAAa,oBAAoB,CAC/B,QAAAC,EACA,QAAAC,EACA,SAAAC,CACF,EAA8D,CAC5D,GAAI,CACF,MAAMC,EAAW,MAAM,EAAAC,QAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,+CAA+CJ,CAAO,cAAcC,CAAO,oBAAoBC,CAAQ,GAC5G,QAAS,CACP,0BAA2B,kBAAkB,EAAAG,QAAQ,OAAO,EAC9D,CACF,CAAC,EAED,OAAOF,EAAS,KAAK,WACjB,SAAMA,EAAS,KAAK,OAAO,KAC3B,QACE,IAAI,MACF,8DACF,CACF,CACN,MAAiB,CACf,SAAO,QACL,IAAI,MACF,uEACF,CACF,CACF,CACF,CAEA,MAAa,mBAAmB,CAC9B,QAAAH,EACA,QAAAC,CACF,EAA6D,CAC3D,GAAI,CACF,MAAME,EAAW,MAAM,EAAAC,QAAM,QAA6B,CACxD,OAAQ,MACR,IAAK,+CAA+CJ,CAAO,cAAcC,CAAO,GAChF,QAAS,CACP,0BAA2B,kBAAkB,EAAAI,QAAQ,OAAO,EAC9D,CACF,CAAC,EAED,OAAOF,EAAS,KAAK,WACjB,SAAMA,EAAS,KAAK,OAAO,KAC3B,QAAK,IAAI,MAAM,oDAAoD,CAAC,CAC1E,MAAiB,CACf,SAAO,QACL,IAAI,MACF,qEACF,CACF,CACF,CACF,CACF,EAvDaJ,EAANO,EAAA,IADN,cAAW,GACCP",
|
|
6
|
+
"names": ["HttpNftDataSource_exports", "__export", "HttpNftDataSource", "__toCommonJS", "import_axios", "import_inversify", "import_purify_ts", "import_package", "HttpNftDataSource", "chainId", "address", "selector", "response", "axios", "PACKAGE", "__decorateClass"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.create;var n=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var h=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!y.call(t,r)&&r!==a&&n(t,r,{get:()=>e[r],enumerable:!(s=u(e,r))||s.enumerable});return t};var l=(t,e,a)=>(a=t!=null?i(x(t)):{},h(e||!t||!t.__esModule?n(a,"default",{value:t,enumerable:!0}):a,t));var o=l(require("axios")),d=l(require("../../../package.json")),c=require("./HttpNftDataSource");vi.mock("axios");describe("HttpNftDataSource",()=>{let t;beforeAll(()=>{t=new c.HttpNftDataSource,vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${d.default.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o.default,"request").mockImplementation(a),await t.getNftInfosPayload({address:"0x00",chainId:1}),await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"}),expect(a).toHaveBeenNthCalledWith(1,expect.objectContaining({headers:{"X-Ledger-Client-Version":e}})),expect(a).toHaveBeenNthCalledWith(2,expect.objectContaining({headers:{"X-Ledger-Client-Version":e}}))}),describe("getNftInfosPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(o.default,"request").mockRejectedValue(new Error("error"));const e=await t.getNftInfosPayload({address:"0x00",chainId:1});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch nft informations"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(o.default,"request").mockResolvedValue(e);const a=await t.getNftInfosPayload({address:"0x00",chainId:1});expect(a.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: no nft metadata"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(o.default,"request").mockResolvedValue(e);const a=await t.getNftInfosPayload({address:"0x00",chainId:1});expect(a.extract()).toEqual("payload")})}),describe("getSetPluginPayload",()=>{it("should return an error when axios throws an error",async()=>{vi.spyOn(o.default,"request").mockRejectedValue(new Error("error"));const e=await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(e.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload"))}),it("should return an error when the response is empty",async()=>{const e={data:{}};vi.spyOn(o.default,"request").mockResolvedValue(e);const a=await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(a.extract()).toEqual(new Error("[ContextModule] HttpNftDataSource: unexpected empty response"))}),it("should return the payload",async()=>{const e={data:{payload:"payload"}};vi.spyOn(o.default,"request").mockResolvedValue(e);const a=await t.getSetPluginPayload({address:"0x00",chainId:1,selector:"0x00"});expect(a.extract()).toEqual("payload")})})});
|
|
2
|
+
//# sourceMappingURL=HttpNftDataSource.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/nft/data/HttpNftDataSource.test.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\n\nimport PACKAGE from \"@root/package.json\";\n\nimport { HttpNftDataSource } from \"./HttpNftDataSource\";\nimport { type NftDataSource } from \"./NftDataSource\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpNftDataSource\", () => {\n let datasource: NftDataSource;\n\n beforeAll(() => {\n datasource = new HttpNftDataSource();\n vi.clearAllMocks();\n });\n\n it(\"should call axios with the ledger client version header\", async () => {\n // GIVEN\n const version = `context-module/${PACKAGE.version}`;\n const requestSpy = vi.fn(() => Promise.resolve({ data: [] }));\n vi.spyOn(axios, \"request\").mockImplementation(requestSpy);\n\n // WHEN\n await datasource.getNftInfosPayload({ address: \"0x00\", chainId: 1 });\n await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(requestSpy).toHaveBeenNthCalledWith(\n 1,\n expect.objectContaining({\n headers: { \"X-Ledger-Client-Version\": version },\n }),\n );\n expect(requestSpy).toHaveBeenNthCalledWith(\n 2,\n expect.objectContaining({\n headers: { \"X-Ledger-Client-Version\": version },\n }),\n );\n });\n\n describe(\"getNftInfosPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch nft informations\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\"[ContextModule] HttpNftDataSource: no nft metadata\"),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getNftInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n\n describe(\"getSetPluginPayload\", () => {\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: Failed to fetch set plugin payload\",\n ),\n );\n });\n\n it(\"should return an error when the response is empty\", async () => {\n // GIVEN\n const response = { data: {} };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\n new Error(\n \"[ContextModule] HttpNftDataSource: unexpected empty response\",\n ),\n );\n });\n\n it(\"should return the payload\", async () => {\n // GIVEN\n const response = { data: { payload: \"payload\" } };\n vi.spyOn(axios, \"request\").mockResolvedValue(response);\n\n // WHEN\n const result = await datasource.getSetPluginPayload({\n address: \"0x00\",\n chainId: 1,\n selector: \"0x00\",\n });\n\n // THEN\n expect(result.extract()).toEqual(\"payload\");\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "wdAAA,IAAAA,EAAkB,oBAElBC,EAAoB,iCAEpBC,EAAkC,+BAGlC,GAAG,KAAK,OAAO,EAEf,SAAS,oBAAqB,IAAM,CAClC,IAAIC,EAEJ,UAAU,IAAM,CACdA,EAAa,IAAI,oBACjB,GAAG,cAAc,CACnB,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMC,EAAU,kBAAkB,EAAAC,QAAQ,OAAO,GAC3CC,EAAa,GAAG,GAAG,IAAM,QAAQ,QAAQ,CAAE,KAAM,CAAC,CAAE,CAAC,CAAC,EAC5D,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,mBAAmBD,CAAU,EAGxD,MAAMH,EAAW,mBAAmB,CAAE,QAAS,OAAQ,QAAS,CAAE,CAAC,EACnE,MAAMA,EAAW,oBAAoB,CACnC,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOG,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CAAE,0BAA2BF,CAAQ,CAChD,CAAC,CACH,EACA,OAAOE,CAAU,EAAE,wBACjB,EACA,OAAO,iBAAiB,CACtB,QAAS,CAAE,0BAA2BF,CAAQ,CAChD,CAAC,CACH,CACF,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAAG,oDAAqD,SAAY,CAElE,GAAG,MAAM,EAAAG,QAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,OAAO,CAAC,EAG/D,MAAMC,EAAS,MAAML,EAAW,mBAAmB,CACjD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,qEACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMC,EAAW,CAAE,KAAM,CAAC,CAAE,EAC5B,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkBE,CAAQ,EAGrD,MAAMD,EAAS,MAAML,EAAW,mBAAmB,CACjD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MAAM,oDAAoD,CAChE,CACF,CAAC,EAED,GAAG,4BAA6B,SAAY,CAE1C,MAAMC,EAAW,CAAE,KAAM,CAAE,QAAS,SAAU,CAAE,EAChD,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkBE,CAAQ,EAGrD,MAAMD,EAAS,MAAML,EAAW,mBAAmB,CACjD,QAAS,OACT,QAAS,CACX,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,EAED,SAAS,sBAAuB,IAAM,CACpC,GAAG,oDAAqD,SAAY,CAElE,GAAG,MAAM,EAAAD,QAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,OAAO,CAAC,EAG/D,MAAMC,EAAS,MAAML,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,uEACF,CACF,CACF,CAAC,EAED,GAAG,oDAAqD,SAAY,CAElE,MAAMC,EAAW,CAAE,KAAM,CAAC,CAAE,EAC5B,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkBE,CAAQ,EAGrD,MAAMD,EAAS,MAAML,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QACvB,IAAI,MACF,8DACF,CACF,CACF,CAAC,EAED,GAAG,4BAA6B,SAAY,CAE1C,MAAMC,EAAW,CAAE,KAAM,CAAE,QAAS,SAAU,CAAE,EAChD,GAAG,MAAM,EAAAF,QAAO,SAAS,EAAE,kBAAkBE,CAAQ,EAGrD,MAAMD,EAAS,MAAML,EAAW,oBAAoB,CAClD,QAAS,OACT,QAAS,EACT,SAAU,MACZ,CAAC,EAGD,OAAOK,EAAO,QAAQ,CAAC,EAAE,QAAQ,SAAS,CAC5C,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_axios", "import_package", "import_HttpNftDataSource", "datasource", "version", "PACKAGE", "requestSpy", "axios", "result", "response"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=NftDataSource.js.map
|
|
1
|
+
"use strict";var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var P=(t,r,o,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of n(r))!m.call(t,a)&&a!==o&&s(t,a,{get:()=>r[a],enumerable:!(e=i(r,a))||e.enumerable});return t};var d=t=>P(s({},"__esModule",{value:!0}),t);var g={};module.exports=d(g);
|
|
2
|
+
//# sourceMappingURL=NftDataSource.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/nft/data/NftDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import { type Either } from \"purify-ts\";\n\nexport type GetSetPluginPayloadParams = {\n chainId: number;\n address: string;\n selector: string;\n};\n\nexport type GetNftInformationsParams = {\n chainId: number;\n address: string;\n};\n\nexport interface NftDataSource {\n getNftInfosPayload(\n params: GetNftInformationsParams,\n ): Promise<Either<Error, string>>;\n getSetPluginPayload(\n params: GetSetPluginPayloadParams,\n ): Promise<Either<Error, string>>;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["NftDataSource_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.nftModuleFactory = void 0;
|
|
4
|
-
const inversify_1 = require("inversify");
|
|
5
|
-
const HttpNftDataSource_1 = require("../../nft/data/HttpNftDataSource");
|
|
6
|
-
const nftTypes_1 = require("../../nft/di/nftTypes");
|
|
7
|
-
const NftContextLoader_1 = require("../../nft/domain/NftContextLoader");
|
|
8
|
-
const nftModuleFactory = () => new inversify_1.ContainerModule((bind, _unbind, _isBound, _rebind) => {
|
|
9
|
-
bind(nftTypes_1.nftTypes.NftDataSource).to(HttpNftDataSource_1.HttpNftDataSource);
|
|
10
|
-
bind(nftTypes_1.nftTypes.NftContextLoader).to(NftContextLoader_1.NftContextLoader);
|
|
11
|
-
});
|
|
12
|
-
exports.nftModuleFactory = nftModuleFactory;
|
|
13
|
-
//# sourceMappingURL=nftModuleFactory.js.map
|
|
1
|
+
"use strict";var f=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var N=(t,o)=>{for(var r in o)f(t,r,{get:o[r],enumerable:!0})},s=(t,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of u(o))!c.call(t,e)&&e!==r&&f(t,e,{get:()=>o[e],enumerable:!(n=d(o,e))||n.enumerable});return t};var x=t=>s(f({},"__esModule",{value:!0}),t);var _={};N(_,{nftModuleFactory:()=>C});module.exports=x(_);var m=require("inversify"),i=require("../../nft/data/HttpNftDataSource"),a=require("../../nft/di/nftTypes"),p=require("../../nft/domain/NftContextLoader");const C=()=>new m.ContainerModule((t,o,r,n)=>{t(a.nftTypes.NftDataSource).to(i.HttpNftDataSource),t(a.nftTypes.NftContextLoader).to(p.NftContextLoader)});0&&(module.exports={nftModuleFactory});
|
|
2
|
+
//# sourceMappingURL=nftModuleFactory.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/nft/di/nftModuleFactory.ts"],
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpNftDataSource } from \"@/nft/data/HttpNftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\n\nexport const nftModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(nftTypes.NftDataSource).to(HttpNftDataSource);\n bind(nftTypes.NftContextLoader).to(NftContextLoader);\n });\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAAkC,wCAClCC,EAAyB,6BACzBC,EAAiC,yCAE1B,MAAML,EAAmB,IAC9B,IAAI,kBAAgB,CAACM,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAK,WAAS,aAAa,EAAE,GAAG,mBAAiB,EACjDA,EAAK,WAAS,gBAAgB,EAAE,GAAG,kBAAgB,CACrD,CAAC",
|
|
6
|
+
"names": ["nftModuleFactory_exports", "__export", "nftModuleFactory", "__toCommonJS", "import_inversify", "import_HttpNftDataSource", "import_nftTypes", "import_NftContextLoader", "bind", "_unbind", "_isBound", "_rebind"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.nftTypes = void 0;
|
|
4
|
-
exports.nftTypes = {
|
|
5
|
-
NftDataSource: Symbol.for("nftDataSource"),
|
|
6
|
-
NftContextLoader: Symbol.for("nftContextLoader"),
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=nftTypes.js.map
|
|
1
|
+
"use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var x=(o,t)=>{for(var f in t)r(o,f,{get:t[f],enumerable:!0})},y=(o,t,f,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of S(t))!c.call(o,e)&&e!==f&&r(o,e,{get:()=>t[e],enumerable:!(a=n(t,e))||a.enumerable});return o};var b=o=>y(r({},"__esModule",{value:!0}),o);var l={};x(l,{nftTypes:()=>d});module.exports=b(l);const d={NftDataSource:Symbol.for("nftDataSource"),NftContextLoader:Symbol.for("nftContextLoader")};0&&(module.exports={nftTypes});
|
|
2
|
+
//# sourceMappingURL=nftTypes.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/nft/di/nftTypes.ts"],
|
|
4
|
+
"sourcesContent": ["export const nftTypes = {\n NftDataSource: Symbol.for(\"nftDataSource\"),\n NftContextLoader: Symbol.for(\"nftContextLoader\"),\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAW,CACtB,cAAe,OAAO,IAAI,eAAe,EACzC,iBAAkB,OAAO,IAAI,kBAAkB,CACjD",
|
|
6
|
+
"names": ["nftTypes_exports", "__export", "nftTypes", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -1,111 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.NftContextLoader = void 0;
|
|
16
|
-
const device_management_kit_1 = require("@ledgerhq/device-management-kit");
|
|
17
|
-
const inversify_1 = require("inversify");
|
|
18
|
-
const nftTypes_1 = require("../../nft/di/nftTypes");
|
|
19
|
-
const ClearSignContext_1 = require("../../shared/model/ClearSignContext");
|
|
20
|
-
var ERC721_SUPPORTED_SELECTOR;
|
|
21
|
-
(function (ERC721_SUPPORTED_SELECTOR) {
|
|
22
|
-
ERC721_SUPPORTED_SELECTOR["Approve"] = "0x095ea7b3";
|
|
23
|
-
ERC721_SUPPORTED_SELECTOR["SetApprovalForAll"] = "0xa22cb465";
|
|
24
|
-
ERC721_SUPPORTED_SELECTOR["TransferFrom"] = "0x23b872dd";
|
|
25
|
-
ERC721_SUPPORTED_SELECTOR["SafeTransferFrom"] = "0x42842e0e";
|
|
26
|
-
ERC721_SUPPORTED_SELECTOR["SafeTransferFromWithData"] = "0xb88d4fde";
|
|
27
|
-
})(ERC721_SUPPORTED_SELECTOR || (ERC721_SUPPORTED_SELECTOR = {}));
|
|
28
|
-
var ERC1155_SUPPORTED_SELECTOR;
|
|
29
|
-
(function (ERC1155_SUPPORTED_SELECTOR) {
|
|
30
|
-
ERC1155_SUPPORTED_SELECTOR["SetApprovalForAll"] = "0xa22cb465";
|
|
31
|
-
ERC1155_SUPPORTED_SELECTOR["SafeTransferFrom"] = "0xf242432a";
|
|
32
|
-
ERC1155_SUPPORTED_SELECTOR["SafeBatchTransferFrom"] = "0x2eb2c2d6";
|
|
33
|
-
})(ERC1155_SUPPORTED_SELECTOR || (ERC1155_SUPPORTED_SELECTOR = {}));
|
|
34
|
-
const SUPPORTED_SELECTORS = [
|
|
35
|
-
...Object.values(ERC721_SUPPORTED_SELECTOR),
|
|
36
|
-
...Object.values(ERC1155_SUPPORTED_SELECTOR),
|
|
37
|
-
];
|
|
38
|
-
let NftContextLoader = class NftContextLoader {
|
|
39
|
-
_dataSource;
|
|
40
|
-
constructor(dataSource) {
|
|
41
|
-
this._dataSource = dataSource;
|
|
42
|
-
}
|
|
43
|
-
async load(transaction) {
|
|
44
|
-
const responses = [];
|
|
45
|
-
if (!transaction.to || !transaction.data || transaction.data === "0x") {
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
const selector = transaction.data.slice(0, 10);
|
|
49
|
-
if (!(0, device_management_kit_1.isHexaString)(selector)) {
|
|
50
|
-
return [
|
|
51
|
-
{
|
|
52
|
-
type: ClearSignContext_1.ClearSignContextType.ERROR,
|
|
53
|
-
error: new Error("Invalid selector"),
|
|
54
|
-
},
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
if (!this.isSelectorSupported(selector)) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
|
-
// EXAMPLE:
|
|
61
|
-
// https://nft.api.live.ledger.com/v1/ethereum/1/contracts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/plugin-selector/0x095ea7b3
|
|
62
|
-
const getPluginPayloadResponse = await this._dataSource.getSetPluginPayload({
|
|
63
|
-
chainId: transaction.chainId,
|
|
64
|
-
address: transaction.to,
|
|
65
|
-
selector,
|
|
66
|
-
});
|
|
67
|
-
const pluginPayload = getPluginPayloadResponse.caseOf({
|
|
68
|
-
Left: (error) => ({
|
|
69
|
-
type: ClearSignContext_1.ClearSignContextType.ERROR,
|
|
70
|
-
error,
|
|
71
|
-
}),
|
|
72
|
-
Right: (value) => ({
|
|
73
|
-
type: ClearSignContext_1.ClearSignContextType.PLUGIN,
|
|
74
|
-
payload: value,
|
|
75
|
-
}),
|
|
76
|
-
});
|
|
77
|
-
if (pluginPayload.type === ClearSignContext_1.ClearSignContextType.ERROR) {
|
|
78
|
-
return [pluginPayload];
|
|
79
|
-
}
|
|
80
|
-
responses.push(pluginPayload);
|
|
81
|
-
const getNftInfosPayloadResponse = await this._dataSource.getNftInfosPayload({
|
|
82
|
-
chainId: transaction.chainId,
|
|
83
|
-
address: transaction.to,
|
|
84
|
-
});
|
|
85
|
-
const nftInfosPayload = getNftInfosPayloadResponse.caseOf({
|
|
86
|
-
Left: (error) => ({
|
|
87
|
-
type: ClearSignContext_1.ClearSignContextType.ERROR,
|
|
88
|
-
error,
|
|
89
|
-
}),
|
|
90
|
-
Right: (value) => ({
|
|
91
|
-
type: ClearSignContext_1.ClearSignContextType.NFT,
|
|
92
|
-
payload: value,
|
|
93
|
-
}),
|
|
94
|
-
});
|
|
95
|
-
if (nftInfosPayload.type === ClearSignContext_1.ClearSignContextType.ERROR) {
|
|
96
|
-
return [nftInfosPayload];
|
|
97
|
-
}
|
|
98
|
-
responses.push(nftInfosPayload);
|
|
99
|
-
return responses;
|
|
100
|
-
}
|
|
101
|
-
isSelectorSupported(selector) {
|
|
102
|
-
return Object.values(SUPPORTED_SELECTORS).includes(selector);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
exports.NftContextLoader = NftContextLoader;
|
|
106
|
-
exports.NftContextLoader = NftContextLoader = __decorate([
|
|
107
|
-
(0, inversify_1.injectable)(),
|
|
108
|
-
__param(0, (0, inversify_1.inject)(nftTypes_1.nftTypes.NftDataSource)),
|
|
109
|
-
__metadata("design:paramtypes", [Object])
|
|
110
|
-
], NftContextLoader);
|
|
111
|
-
//# sourceMappingURL=NftContextLoader.js.map
|
|
1
|
+
"use strict";var p=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var b=(o,e)=>{for(var a in e)p(o,a,{get:e[a],enumerable:!0})},C=(o,e,a,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of F(e))!I.call(o,r)&&r!==a&&p(o,r,{get:()=>e[r],enumerable:!(t=u(e,r))||t.enumerable});return o};var N=o=>C(p({},"__esModule",{value:!0}),o),g=(o,e,a,t)=>{for(var r=t>1?void 0:t?u(e,a):e,n=o.length-1,d;n>=0;n--)(d=o[n])&&(r=(t?d(e,a,r):d(r))||r);return t&&r&&p(e,a,r),r},y=(o,e)=>(a,t)=>e(a,t,o);var j={};b(j,{NftContextLoader:()=>l});module.exports=N(j);var x=require("@ledgerhq/device-management-kit"),c=require("inversify"),m=require("../../nft/di/nftTypes"),s=require("../../shared/model/ClearSignContext");var S=(n=>(n.Approve="0x095ea7b3",n.SetApprovalForAll="0xa22cb465",n.TransferFrom="0x23b872dd",n.SafeTransferFrom="0x42842e0e",n.SafeTransferFromWithData="0xb88d4fde",n))(S||{}),h=(t=>(t.SetApprovalForAll="0xa22cb465",t.SafeTransferFrom="0xf242432a",t.SafeBatchTransferFrom="0x2eb2c2d6",t))(h||{});const v=[...Object.values(S),...Object.values(h)];let l=class{_dataSource;constructor(e){this._dataSource=e}async load(e){const a=[];if(!e.to||!e.data||e.data==="0x")return[];const t=e.data.slice(0,10);if(!(0,x.isHexaString)(t))return[{type:s.ClearSignContextType.ERROR,error:new Error("Invalid selector")}];if(!this.isSelectorSupported(t))return[];const n=(await this._dataSource.getSetPluginPayload({chainId:e.chainId,address:e.to,selector:t})).caseOf({Left:i=>({type:s.ClearSignContextType.ERROR,error:i}),Right:i=>({type:s.ClearSignContextType.PLUGIN,payload:i})});if(n.type===s.ClearSignContextType.ERROR)return[n];a.push(n);const f=(await this._dataSource.getNftInfosPayload({chainId:e.chainId,address:e.to})).caseOf({Left:i=>({type:s.ClearSignContextType.ERROR,error:i}),Right:i=>({type:s.ClearSignContextType.NFT,payload:i})});return f.type===s.ClearSignContextType.ERROR?[f]:(a.push(f),a)}async loadField(e){return e.type!==s.ClearSignContextType.NFT?null:(await this._dataSource.getNftInfosPayload({address:e.address,chainId:e.chainId})).caseOf({Left:t=>({type:s.ClearSignContextType.ERROR,error:t}),Right:t=>({type:s.ClearSignContextType.NFT,payload:t})})}isSelectorSupported(e){return Object.values(v).includes(e)}};l=g([(0,c.injectable)(),y(0,(0,c.inject)(m.nftTypes.NftDataSource))],l);0&&(module.exports={NftContextLoader});
|
|
2
|
+
//# sourceMappingURL=NftContextLoader.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/nft/domain/NftContextLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import { HexaString, isHexaString } from \"@ledgerhq/device-management-kit\";\nimport { inject, injectable } from \"inversify\";\n\nimport type { NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { nftTypes } from \"@/nft/di/nftTypes\";\nimport { ContextLoader } from \"@/shared/domain/ContextLoader\";\nimport {\n ClearSignContext,\n ClearSignContextType,\n} from \"@/shared/model/ClearSignContext\";\nimport {\n TransactionContext,\n TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\nenum ERC721_SUPPORTED_SELECTOR {\n Approve = \"0x095ea7b3\",\n SetApprovalForAll = \"0xa22cb465\",\n TransferFrom = \"0x23b872dd\",\n SafeTransferFrom = \"0x42842e0e\",\n SafeTransferFromWithData = \"0xb88d4fde\",\n}\n\nenum ERC1155_SUPPORTED_SELECTOR {\n SetApprovalForAll = \"0xa22cb465\",\n SafeTransferFrom = \"0xf242432a\",\n SafeBatchTransferFrom = \"0x2eb2c2d6\",\n}\n\nconst SUPPORTED_SELECTORS: HexaString[] = [\n ...Object.values(ERC721_SUPPORTED_SELECTOR),\n ...Object.values(ERC1155_SUPPORTED_SELECTOR),\n];\n\n@injectable()\nexport class NftContextLoader implements ContextLoader {\n private _dataSource: NftDataSource;\n\n constructor(@inject(nftTypes.NftDataSource) dataSource: NftDataSource) {\n this._dataSource = dataSource;\n }\n\n async load(transaction: TransactionContext): Promise<ClearSignContext[]> {\n const responses: ClearSignContext[] = [];\n\n if (!transaction.to || !transaction.data || transaction.data === \"0x\") {\n return [];\n }\n\n const selector = transaction.data.slice(0, 10);\n\n if (!isHexaString(selector)) {\n return [\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ];\n }\n\n if (!this.isSelectorSupported(selector)) {\n return [];\n }\n\n // EXAMPLE:\n // https://nft.api.live.ledger.com/v1/ethereum/1/contracts/0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/plugin-selector/0x095ea7b3\n const getPluginPayloadResponse = await this._dataSource.getSetPluginPayload(\n {\n chainId: transaction.chainId,\n address: transaction.to,\n selector,\n },\n );\n\n const pluginPayload = getPluginPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.PLUGIN,\n payload: value,\n }),\n });\n\n if (pluginPayload.type === ClearSignContextType.ERROR) {\n return [pluginPayload];\n }\n\n responses.push(pluginPayload);\n\n const getNftInfosPayloadResponse =\n await this._dataSource.getNftInfosPayload({\n chainId: transaction.chainId,\n address: transaction.to,\n });\n\n const nftInfosPayload = getNftInfosPayloadResponse.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n\n if (nftInfosPayload.type === ClearSignContextType.ERROR) {\n return [nftInfosPayload];\n }\n\n responses.push(nftInfosPayload);\n\n return responses;\n }\n\n async loadField(\n field: TransactionFieldContext,\n ): Promise<ClearSignContext | null> {\n if (field.type !== ClearSignContextType.NFT) {\n return null;\n }\n const payload = await this._dataSource.getNftInfosPayload({\n address: field.address,\n chainId: field.chainId,\n });\n return payload.caseOf({\n Left: (error): ClearSignContext => ({\n type: ClearSignContextType.ERROR,\n error,\n }),\n Right: (value): ClearSignContext => ({\n type: ClearSignContextType.NFT,\n payload: value,\n }),\n });\n }\n\n private isSelectorSupported(selector: HexaString) {\n return Object.values(SUPPORTED_SELECTORS).includes(selector);\n }\n}\n"],
|
|
5
|
+
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAyC,2CACzCC,EAAmC,qBAGnCC,EAAyB,6BAEzBC,EAGO,2CAMP,IAAKC,OACHA,EAAA,QAAU,aACVA,EAAA,kBAAoB,aACpBA,EAAA,aAAe,aACfA,EAAA,iBAAmB,aACnBA,EAAA,yBAA2B,aALxBA,OAAA,IAQAC,OACHA,EAAA,kBAAoB,aACpBA,EAAA,iBAAmB,aACnBA,EAAA,sBAAwB,aAHrBA,OAAA,IAML,MAAMC,EAAoC,CACxC,GAAG,OAAO,OAAOF,CAAyB,EAC1C,GAAG,OAAO,OAAOC,CAA0B,CAC7C,EAGO,IAAME,EAAN,KAAgD,CAC7C,YAER,YAA4CC,EAA2B,CACrE,KAAK,YAAcA,CACrB,CAEA,MAAM,KAAKC,EAA8D,CACvE,MAAMC,EAAgC,CAAC,EAEvC,GAAI,CAACD,EAAY,IAAM,CAACA,EAAY,MAAQA,EAAY,OAAS,KAC/D,MAAO,CAAC,EAGV,MAAME,EAAWF,EAAY,KAAK,MAAM,EAAG,EAAE,EAE7C,GAAI,IAAC,gBAAaE,CAAQ,EACxB,MAAO,CACL,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,EAGF,GAAI,CAAC,KAAK,oBAAoBA,CAAQ,EACpC,MAAO,CAAC,EAaV,MAAMC,GAR2B,MAAM,KAAK,YAAY,oBACtD,CACE,QAASH,EAAY,QACrB,QAASA,EAAY,GACrB,SAAAE,CACF,CACF,GAE+C,OAAO,CACpD,KAAOE,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,OAC3B,QAASA,CACX,EACF,CAAC,EAED,GAAIF,EAAc,OAAS,uBAAqB,MAC9C,MAAO,CAACA,CAAa,EAGvBF,EAAU,KAAKE,CAAa,EAQ5B,MAAMG,GALJ,MAAM,KAAK,YAAY,mBAAmB,CACxC,QAASN,EAAY,QACrB,QAASA,EAAY,EACvB,CAAC,GAEgD,OAAO,CACxD,KAAOI,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,IAC3B,QAASA,CACX,EACF,CAAC,EAED,OAAIC,EAAgB,OAAS,uBAAqB,MACzC,CAACA,CAAe,GAGzBL,EAAU,KAAKK,CAAe,EAEvBL,EACT,CAEA,MAAM,UACJM,EACkC,CAClC,OAAIA,EAAM,OAAS,uBAAqB,IAC/B,MAEO,MAAM,KAAK,YAAY,mBAAmB,CACxD,QAASA,EAAM,QACf,QAASA,EAAM,OACjB,CAAC,GACc,OAAO,CACpB,KAAOH,IAA6B,CAClC,KAAM,uBAAqB,MAC3B,MAAAA,CACF,GACA,MAAQC,IAA6B,CACnC,KAAM,uBAAqB,IAC3B,QAASA,CACX,EACF,CAAC,CACH,CAEQ,oBAAoBH,EAAsB,CAChD,OAAO,OAAO,OAAOL,CAAmB,EAAE,SAASK,CAAQ,CAC7D,CACF,EA3GaJ,EAANU,EAAA,IADN,cAAW,EAIGC,EAAA,eAAO,WAAS,aAAa,IAH/BX",
|
|
6
|
+
"names": ["NftContextLoader_exports", "__export", "NftContextLoader", "__toCommonJS", "import_device_management_kit", "import_inversify", "import_nftTypes", "import_ClearSignContext", "ERC721_SUPPORTED_SELECTOR", "ERC1155_SUPPORTED_SELECTOR", "SUPPORTED_SELECTORS", "NftContextLoader", "dataSource", "transaction", "responses", "selector", "pluginPayload", "error", "value", "nftInfosPayload", "field", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=require("purify-ts"),d=require("../../nft/domain/NftContextLoader"),o=require("../../shared/model/ClearSignContext");describe("NftContextLoader",()=>{const r=vi.fn(),s=vi.fn();let c,e;beforeEach(()=>{vi.restoreAllMocks(),c={getNftInfosPayload:r,getSetPluginPayload:s},e=new d.NftContextLoader(c)}),describe("load function",()=>{it("should return an empty array if no dest",async()=>{const t={to:void 0,data:"0x01"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if undefined data",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:void 0},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if empty data",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if selector not supported",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b20000000000000"},a=await e.load(t);expect(a).toEqual([])}),it("should return an error when transaction data is not a valid hex string",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"notahexstring"},a=await e.load(t);expect(a).toEqual([{type:o.ClearSignContextType.ERROR,error:new Error("Invalid selector")}])}),it("should return an error when datasource get plugin payload return a Left",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000000"};s.mockResolvedValueOnce((0,n.Left)(new Error("error")));const a=await e.load(t);expect(a).toEqual([{type:o.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return an error when datasource get nft infos payload return a Left",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000000"};s.mockResolvedValueOnce((0,n.Right)("payload1")),r.mockResolvedValueOnce((0,n.Left)(new Error("error")));const a=await e.load(t);expect(a).toEqual([{type:o.ClearSignContextType.ERROR,error:new Error("error")}])}),it("should return a response",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000000"};s.mockResolvedValueOnce((0,n.Right)("payload1")),r.mockResolvedValueOnce((0,n.Right)("payload2"));const a=await e.load(t);expect(a).toEqual([{type:o.ClearSignContextType.PLUGIN,payload:"payload1"},{type:o.ClearSignContextType.NFT,payload:"payload2"}])})}),describe("loadField function",()=>{it("should return an error when field type if not supported",async()=>{const t={type:o.ClearSignContextType.TOKEN,chainId:7,address:"0x1234"},a=await e.loadField(t);expect(a).toEqual(null)}),it("should return a payload",async()=>{const t={type:o.ClearSignContextType.NFT,chainId:7,address:"0x1234"};r.mockResolvedValueOnce((0,n.Right)("payload"));const a=await e.loadField(t);expect(a).toEqual({type:o.ClearSignContextType.NFT,payload:"payload"})}),it("should return an error when unable to fetch the datasource",async()=>{const t={type:o.ClearSignContextType.NFT,chainId:7,address:"0x1234"};r.mockResolvedValueOnce((0,n.Left)(new Error("error")));const a=await e.loadField(t);expect(a).toEqual({type:o.ClearSignContextType.ERROR,error:new Error("error")})})})});
|
|
2
|
+
//# sourceMappingURL=NftContextLoader.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/nft/domain/NftContextLoader.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { type NftDataSource } from \"@/nft/data/NftDataSource\";\nimport { NftContextLoader } from \"@/nft/domain/NftContextLoader\";\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\n\ndescribe(\"NftContextLoader\", () => {\n const spyGetNftInfosPayload = vi.fn();\n const spyGetPluginPayload = vi.fn();\n let mockDataSource: NftDataSource;\n let loader: NftContextLoader;\n\n beforeEach(() => {\n vi.restoreAllMocks();\n mockDataSource = {\n getNftInfosPayload: spyGetNftInfosPayload,\n getSetPluginPayload: spyGetPluginPayload,\n };\n loader = new NftContextLoader(mockDataSource);\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if no dest\", async () => {\n const transaction = { to: undefined, data: \"0x01\" } as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if undefined data\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: undefined,\n } as unknown as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if empty data\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x\",\n } as unknown as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if selector not supported\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b20000000000000\",\n } as unknown as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when transaction data is not a valid hex string\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"notahexstring\",\n } as TransactionContext;\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"Invalid selector\"),\n },\n ]);\n });\n\n it(\"should return an error when datasource get plugin payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000000\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return an error when datasource get nft infos payload return a Left\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000000\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n },\n ]);\n });\n\n it(\"should return a response\", async () => {\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000000\",\n } as TransactionContext;\n spyGetPluginPayload.mockResolvedValueOnce(Right(\"payload1\"));\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload2\"));\n\n const result = await loader.load(transaction);\n\n expect(result).toEqual([\n {\n type: ClearSignContextType.PLUGIN,\n payload: \"payload1\",\n },\n {\n type: ClearSignContextType.NFT,\n payload: \"payload2\",\n },\n ]);\n });\n });\n\n describe(\"loadField function\", () => {\n it(\"should return an error when field type if not supported\", async () => {\n const field: TransactionFieldContext = {\n type: ClearSignContextType.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n const result = await loader.loadField(field);\n\n expect(result).toEqual(null);\n });\n\n it(\"should return a payload\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Right(\"payload\"));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.NFT,\n payload: \"payload\",\n });\n });\n\n it(\"should return an error when unable to fetch the datasource\", async () => {\n // GIVEN\n const field: TransactionFieldContext = {\n type: ClearSignContextType.NFT,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n spyGetNftInfosPayload.mockResolvedValueOnce(Left(new Error(\"error\")));\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.ERROR,\n error: new Error(\"error\"),\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAA4B,qBAG5BC,EAAiC,yCACjCC,EAAqC,2CAMrC,SAAS,mBAAoB,IAAM,CACjC,MAAMC,EAAwB,GAAG,GAAG,EAC9BC,EAAsB,GAAG,GAAG,EAClC,IAAIC,EACAC,EAEJ,WAAW,IAAM,CACf,GAAG,gBAAgB,EACnBD,EAAiB,CACf,mBAAoBF,EACpB,oBAAqBC,CACvB,EACAE,EAAS,IAAI,mBAAiBD,CAAc,CAC9C,CAAC,EAED,SAAS,gBAAiB,IAAM,CAC9B,GAAG,0CAA2C,SAAY,CACxD,MAAME,EAAc,CAAE,GAAI,OAAW,KAAM,MAAO,EAE5CC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,iDAAkD,SAAY,CAC/D,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,MACR,EAEMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,6CAA8C,SAAY,CAC3D,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,IACR,EAEMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,yDAA0D,SAAY,CACvE,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,yBACR,EAEMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CAAC,CAAC,CAC3B,CAAC,EAED,GAAG,yEAA0E,SAAY,CACvF,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,eACR,EAEMC,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,kBAAkB,CACrC,CACF,CAAC,CACH,CAAC,EAED,GAAG,0EAA2E,SAAY,CACxF,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,yBACR,EACAH,EAAoB,yBAAsB,QAAK,IAAI,MAAM,OAAO,CAAC,CAAC,EAElE,MAAMI,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,EAED,GAAG,6EAA8E,SAAY,CAC3F,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,yBACR,EACAH,EAAoB,yBAAsB,SAAM,UAAU,CAAC,EAC3DD,EAAsB,yBAAsB,QAAK,IAAI,MAAM,OAAO,CAAC,CAAC,EAEpE,MAAMK,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CACF,CAAC,CACH,CAAC,EAED,GAAG,2BAA4B,SAAY,CACzC,MAAMD,EAAc,CAClB,GAAI,6CACJ,KAAM,yBACR,EACAH,EAAoB,yBAAsB,SAAM,UAAU,CAAC,EAC3DD,EAAsB,yBAAsB,SAAM,UAAU,CAAC,EAE7D,MAAMK,EAAS,MAAMF,EAAO,KAAKC,CAAW,EAE5C,OAAOC,CAAM,EAAE,QAAQ,CACrB,CACE,KAAM,uBAAqB,OAC3B,QAAS,UACX,EACA,CACE,KAAM,uBAAqB,IAC3B,QAAS,UACX,CACF,CAAC,CACH,CAAC,CACH,CAAC,EAED,SAAS,qBAAsB,IAAM,CACnC,GAAG,0DAA2D,SAAY,CACxE,MAAMC,EAAiC,CACrC,KAAM,uBAAqB,MAC3B,QAAS,EACT,QAAS,QACX,EAEMD,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAE3C,OAAOD,CAAM,EAAE,QAAQ,IAAI,CAC7B,CAAC,EAED,GAAG,0BAA2B,SAAY,CAExC,MAAMC,EAAiC,CACrC,KAAM,uBAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAN,EAAsB,yBAAsB,SAAM,SAAS,CAAC,EAC5D,MAAMK,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,IAC3B,QAAS,SACX,CAAC,CACH,CAAC,EAED,GAAG,6DAA8D,SAAY,CAE3E,MAAMC,EAAiC,CACrC,KAAM,uBAAqB,IAC3B,QAAS,EACT,QAAS,QACX,EAGAN,EAAsB,yBAAsB,QAAK,IAAI,MAAM,OAAO,CAAC,CAAC,EACpE,MAAMK,EAAS,MAAMF,EAAO,UAAUG,CAAK,EAG3C,OAAOD,CAAM,EAAE,QAAQ,CACrB,KAAM,uBAAqB,MAC3B,MAAO,IAAI,MAAM,OAAO,CAC1B,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_purify_ts", "import_NftContextLoader", "import_ClearSignContext", "spyGetNftInfosPayload", "spyGetPluginPayload", "mockDataSource", "loader", "transaction", "result", "field"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var R=Object.create;var n=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var U=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},m=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of D(e))!b.call(t,o)&&o!==r&&n(t,o,{get:()=>e[o],enumerable:!(i=d(e,o))||i.enumerable});return t};var g=(t,e,r)=>(r=t!=null?R(E(t)):{},m(e||!t||!t.__esModule?n(r,"default",{value:t,enumerable:!0}):r,t)),_=t=>m(n({},"__esModule",{value:!0}),t),u=(t,e,r,i)=>{for(var o=i>1?void 0:i?d(e,r):e,a=t.length-1,p;a>=0;a--)(p=t[a])&&(o=(i?p(e,r,o):p(o))||o);return i&&o&&n(e,r,o),o},l=(t,e)=>(r,i)=>e(r,i,t);var K={};U(K,{HttpPkiCertificateDataSource:()=>c});module.exports=_(K);var C=require("@ledgerhq/device-management-kit"),y=g(require("axios")),f=require("inversify"),s=require("purify-ts"),k=require("../../config/di/configTypes"),P=require("../../shared/model/SignatureTags"),h=require("../../shared/utils/HexStringUtils"),x=require("../../shared/utils/KeyUsageMapper"),M=g(require("../../../package.json"));let c=class{constructor(e){this.config=e}async fetchCertificate(e){const r={output:"descriptor",target_device:e.targetDevice,latest:!0,public_key_id:e.keyId,public_key_usage:e.keyUsage};try{const i=await y.default.request({method:"GET",url:`${this.config.cal.url}/certificates`,params:r,headers:{"X-Ledger-Client-Version":`context-module/${M.default.version}`}});if(i.status==200&&i.data!==void 0&&i.data.length>0&&this.isValidPkiCertificateResponse(i.data[0],this.config.cal.mode)){const o=(0,C.hexaStringToBuffer)(h.HexStringUtils.appendSignatureToPayload(i.data[0].descriptor.data,i.data[0].descriptor.signatures[this.config.cal.mode],P.SIGNATURE_TAG));if(!o)return(0,s.Left)(Error("[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate"));const a={payload:o,keyUsageNumber:x.KeyUsageMapper.mapKeyUsageForFirmware(e.keyUsage)};return(0,s.Right)(a)}else return(0,s.Left)(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor"))}catch{return(0,s.Left)(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor"))}}isValidPkiCertificateResponse(e,r){return typeof e=="object"&&e!==null&&"descriptor"in e&&typeof e.descriptor=="object"&&e.descriptor!==null&&"data"in e.descriptor&&typeof e.descriptor.data=="string"&&"signatures"in e.descriptor&&typeof e.descriptor.signatures=="object"&&e.descriptor.signatures!==null&&r in e.descriptor.signatures&&typeof e.descriptor.signatures[r]=="string"}};c=u([(0,f.injectable)(),l(0,(0,f.inject)(k.configTypes.Config))],c);0&&(module.exports={HttpPkiCertificateDataSource});
|
|
2
|
+
//# sourceMappingURL=HttpPkiCertificateDataSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/data/HttpPkiCertificateDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import { hexaStringToBuffer } from \"@ledgerhq/device-management-kit\";\nimport axios from \"axios\";\nimport { inject, injectable } from \"inversify\";\nimport { Either, Left, Right } from \"purify-ts\";\n\nimport { configTypes } from \"@/config/di/configTypes\";\nimport type {\n ContextModuleCalMode,\n ContextModuleConfig,\n} from \"@/config/model/ContextModuleConfig\";\nimport { PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\nimport { SIGNATURE_TAG } from \"@/shared/model/SignatureTags\";\nimport { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\nimport { KeyUsageMapper } from \"@/shared/utils/KeyUsageMapper\";\nimport PACKAGE from \"@root/package.json\";\n\nimport { type PkiCertificateDataSource } from \"./PkiCertificateDataSource\";\nimport {\n type PkiCertificateRequestDto,\n type PkiCertificateResponseDto,\n} from \"./pkiDataSourceTypes\";\n\n@injectable()\nexport class HttpPkiCertificateDataSource implements PkiCertificateDataSource {\n constructor(\n @inject(configTypes.Config) private readonly config: ContextModuleConfig,\n ) {}\n\n async fetchCertificate(\n pkiCertificateInfo: PkiCertificateInfo,\n ): Promise<Either<Error, PkiCertificate | undefined>> {\n const requestDto: PkiCertificateRequestDto = {\n output: \"descriptor\",\n target_device: pkiCertificateInfo.targetDevice,\n latest: true,\n public_key_id: pkiCertificateInfo.keyId,\n public_key_usage: pkiCertificateInfo.keyUsage,\n };\n\n try {\n const pkiCertificateResponse = await axios.request<\n PkiCertificateResponseDto[]\n >({\n method: \"GET\",\n url: `${this.config.cal.url}/certificates`,\n params: requestDto,\n headers: {\n \"X-Ledger-Client-Version\": `context-module/${PACKAGE.version}`,\n },\n });\n\n if (\n pkiCertificateResponse.status == 200 &&\n pkiCertificateResponse.data !== undefined &&\n pkiCertificateResponse.data.length > 0 &&\n this.isValidPkiCertificateResponse(\n pkiCertificateResponse.data[0],\n this.config.cal.mode,\n )\n ) {\n const payload = hexaStringToBuffer(\n HexStringUtils.appendSignatureToPayload(\n pkiCertificateResponse.data[0].descriptor.data,\n pkiCertificateResponse.data[0].descriptor.signatures[\n this.config.cal.mode\n ],\n SIGNATURE_TAG,\n ),\n );\n if (!payload) {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate\",\n ),\n );\n }\n const pkiCertificate: PkiCertificate = {\n payload: payload,\n keyUsageNumber: KeyUsageMapper.mapKeyUsageForFirmware(\n pkiCertificateInfo.keyUsage,\n ),\n };\n return Right(pkiCertificate);\n } else {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n );\n }\n } catch (_error) {\n return Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n );\n }\n }\n\n private isValidPkiCertificateResponse(\n value: unknown,\n mode: ContextModuleCalMode,\n ): value is PkiCertificateResponseDto {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"descriptor\" in value &&\n typeof value.descriptor === \"object\" &&\n value.descriptor !== null &&\n \"data\" in value.descriptor &&\n typeof value.descriptor.data === \"string\" &&\n \"signatures\" in value.descriptor &&\n typeof value.descriptor.signatures === \"object\" &&\n value.descriptor.signatures !== null &&\n mode in value.descriptor.signatures &&\n typeof (value.descriptor.signatures as Record<string, unknown>)[mode] ===\n \"string\"\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "qtBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,2CACnCC,EAAkB,oBAClBC,EAAmC,qBACnCC,EAAoC,qBAEpCC,EAA4B,mCAO5BC,EAA8B,wCAC9BC,EAA+B,yCAC/BC,EAA+B,yCAC/BC,EAAoB,iCASb,IAAMC,EAAN,KAAuE,CAC5E,YAC+CC,EAC7C,CAD6C,YAAAA,CAC5C,CAEH,MAAM,iBACJC,EACoD,CACpD,MAAMC,EAAuC,CAC3C,OAAQ,aACR,cAAeD,EAAmB,aAClC,OAAQ,GACR,cAAeA,EAAmB,MAClC,iBAAkBA,EAAmB,QACvC,EAEA,GAAI,CACF,MAAME,EAAyB,MAAM,EAAAC,QAAM,QAEzC,CACA,OAAQ,MACR,IAAK,GAAG,KAAK,OAAO,IAAI,GAAG,gBAC3B,OAAQF,EACR,QAAS,CACP,0BAA2B,kBAAkB,EAAAG,QAAQ,OAAO,EAC9D,CACF,CAAC,EAED,GACEF,EAAuB,QAAU,KACjCA,EAAuB,OAAS,QAChCA,EAAuB,KAAK,OAAS,GACrC,KAAK,8BACHA,EAAuB,KAAK,CAAC,EAC7B,KAAK,OAAO,IAAI,IAClB,EACA,CACA,MAAMG,KAAU,sBACd,iBAAe,yBACbH,EAAuB,KAAK,CAAC,EAAE,WAAW,KAC1CA,EAAuB,KAAK,CAAC,EAAE,WAAW,WACxC,KAAK,OAAO,IAAI,IAClB,EACA,eACF,CACF,EACA,GAAI,CAACG,EACH,SAAO,QACL,MACE,oGACF,CACF,EAEF,MAAMC,EAAiC,CACrC,QAASD,EACT,eAAgB,iBAAe,uBAC7BL,EAAmB,QACrB,CACF,EACA,SAAO,SAAMM,CAAc,CAC7B,KACE,UAAO,QACL,MACE,wFACF,CACF,CAEJ,MAAiB,CACf,SAAO,QACL,MACE,wFACF,CACF,CACF,CACF,CAEQ,8BACNC,EACAC,EACoC,CACpC,OACE,OAAOD,GAAU,UACjBA,IAAU,MACV,eAAgBA,GAChB,OAAOA,EAAM,YAAe,UAC5BA,EAAM,aAAe,MACrB,SAAUA,EAAM,YAChB,OAAOA,EAAM,WAAW,MAAS,UACjC,eAAgBA,EAAM,YACtB,OAAOA,EAAM,WAAW,YAAe,UACvCA,EAAM,WAAW,aAAe,MAChCC,KAAQD,EAAM,WAAW,YACzB,OAAQA,EAAM,WAAW,WAAuCC,CAAI,GAClE,QAEN,CACF,EAhGaV,EAANW,EAAA,IADN,cAAW,EAGPC,EAAA,eAAO,cAAY,MAAM,IAFjBZ",
|
|
6
|
+
"names": ["HttpPkiCertificateDataSource_exports", "__export", "HttpPkiCertificateDataSource", "__toCommonJS", "import_device_management_kit", "import_axios", "import_inversify", "import_purify_ts", "import_configTypes", "import_SignatureTags", "import_HexStringUtils", "import_KeyUsageMapper", "import_package", "HttpPkiCertificateDataSource", "config", "pkiCertificateInfo", "requestDto", "pkiCertificateResponse", "axios", "PACKAGE", "payload", "pkiCertificate", "value", "mode", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var d=Object.create;var f=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var C=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!k.call(t,i)&&i!==a&&f(t,i,{get:()=>e[i],enumerable:!(s=u(e,i))||s.enumerable});return t};var y=(t,e,a)=>(a=t!=null?d(p(t)):{},C(e||!t||!t.__esModule?f(a,"default",{value:t,enumerable:!0}):a,t));var o=y(require("axios")),r=require("purify-ts"),c=require("../../pki/data/HttpPkiCertificateDataSource"),n=require("../../pki/model/KeyUsage");vi.mock("axios");describe("HttpPkiCertificateDataSource",()=>{const t={cal:{url:"https://cal.com",mode:"test",branch:"main"}};describe("fetchCertificate",()=>{it("should return certificate",async()=>{const e={targetDevice:"targetDevice",keyUsage:n.KeyUsage.Calldata,keyId:"keyId"};vi.spyOn(o.default,"request").mockResolvedValue({status:200,data:[{descriptor:{data:"01020304",signatures:{test:"05060708"}}}]});const a=await new c.HttpPkiCertificateDataSource(t).fetchCertificate(e);expect(a).toEqual((0,r.Right)({keyUsageNumber:11,payload:new Uint8Array([1,2,3,4,21,4,5,6,7,8])}))}),it("should return an error when certificate is not found",async()=>{const e={targetDevice:"targetDevice",keyUsage:n.KeyUsage.Calldata,keyId:"keyId"};vi.spyOn(o.default,"request").mockResolvedValue({status:200,data:[]});const a=await new c.HttpPkiCertificateDataSource(t).fetchCertificate(e);expect(a).toEqual((0,r.Left)(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor")))}),it("should return an error when axios request fails",async()=>{const e={targetDevice:"targetDevice",keyUsage:n.KeyUsage.Calldata,keyId:"keyId"};vi.spyOn(o.default,"request").mockRejectedValue(new Error("error"));const a=await new c.HttpPkiCertificateDataSource(t).fetchCertificate(e);expect(a).toEqual((0,r.Left)(Error("[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor")))}),it("should return an error when payload cannot be generated",async()=>{const e={targetDevice:"targetDevice",keyUsage:n.KeyUsage.Calldata,keyId:"keyId"};vi.spyOn(o.default,"request").mockResolvedValue({status:200,data:[{descriptor:{data:"corrupteddata",signatures:{test:"05060708"}}}]});const a=await new c.HttpPkiCertificateDataSource(t).fetchCertificate(e);expect(a).toEqual((0,r.Left)(Error("[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate")))})})});
|
|
2
|
+
//# sourceMappingURL=HttpPkiCertificateDataSource.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/data/HttpPkiCertificateDataSource.test.ts"],
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { Left, Right } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpPkiCertificateDataSource } from \"@/pki/data/HttpPkiCertificateDataSource\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpPkiCertificateDataSource\", () => {\n const config = {\n cal: {\n url: \"https://cal.com\",\n mode: \"test\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n\n describe(\"fetchCertificate\", () => {\n it(\"should return certificate\", async () => {\n // GIVEN\n const pkiCertificateInfo: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: \"keyId\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: [\n {\n descriptor: {\n data: \"01020304\",\n signatures: {\n test: \"05060708\",\n },\n },\n },\n ],\n });\n\n // WHEN\n const result = await new HttpPkiCertificateDataSource(\n config,\n ).fetchCertificate(pkiCertificateInfo);\n\n // THEN\n expect(result).toEqual(\n Right({\n keyUsageNumber: 11,\n payload: new Uint8Array([\n 0x01, 0x02, 0x03, 0x04, 0x15, 0x04, 0x05, 0x06, 0x07, 0x08,\n ]),\n }),\n );\n });\n\n it(\"should return an error when certificate is not found\", async () => {\n // GIVEN\n const pkiCertificateInfo: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: \"keyId\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: [],\n });\n\n // WHEN\n const result = await new HttpPkiCertificateDataSource(\n config,\n ).fetchCertificate(pkiCertificateInfo);\n\n // THEN\n expect(result).toEqual(\n Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n ),\n );\n });\n\n it(\"should return an error when axios request fails\", async () => {\n // GIVEN\n const pkiCertificateInfo: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: \"keyId\",\n };\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error(\"error\"));\n\n // WHEN\n const result = await new HttpPkiCertificateDataSource(\n config,\n ).fetchCertificate(pkiCertificateInfo);\n\n // THEN\n expect(result).toEqual(\n Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: failed to fetch PKI for given descriptor\",\n ),\n ),\n );\n });\n\n it(\"should return an error when payload cannot be generated\", async () => {\n // GIVEN\n const pkiCertificateInfo: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: \"keyId\",\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({\n status: 200,\n data: [\n {\n descriptor: {\n data: \"corrupteddata\",\n signatures: {\n test: \"05060708\",\n },\n },\n },\n ],\n });\n\n // WHEN\n const result = await new HttpPkiCertificateDataSource(\n config,\n ).fetchCertificate(pkiCertificateInfo);\n\n // THEN\n expect(result).toEqual(\n Left(\n Error(\n \"[ContextModule] HttpPkiCertificateDataSource: Cannot generate payload from fetched PKI Certificate\",\n ),\n ),\n );\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "wdAAA,IAAAA,EAAkB,oBAClBC,EAA4B,qBAG5BC,EAA6C,mDAC7CC,EAAyB,gCAGzB,GAAG,KAAK,OAAO,EAEf,SAAS,+BAAgC,IAAM,CAC7C,MAAMC,EAAS,CACb,IAAK,CACH,IAAK,kBACL,KAAM,OACN,OAAQ,MACV,CACF,EAEA,SAAS,mBAAoB,IAAM,CACjC,GAAG,4BAA6B,SAAY,CAE1C,MAAMC,EAAyC,CAC7C,aAAc,eACd,SAAU,WAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAM,CACJ,CACE,WAAY,CACV,KAAM,WACN,WAAY,CACV,KAAM,UACR,CACF,CACF,CACF,CACF,CAAC,EAGD,MAAMC,EAAS,MAAM,IAAI,+BACvBH,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOE,CAAM,EAAE,WACb,SAAM,CACJ,eAAgB,GAChB,QAAS,IAAI,WAAW,CACtB,EAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,EAAM,EAAM,CACxD,CAAC,CACH,CAAC,CACH,CACF,CAAC,EAED,GAAG,uDAAwD,SAAY,CAErE,MAAMF,EAAyC,CAC7C,aAAc,eACd,SAAU,WAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAM,CAAC,CACT,CAAC,EAGD,MAAMC,EAAS,MAAM,IAAI,+BACvBH,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOE,CAAM,EAAE,WACb,QACE,MACE,wFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,kDAAmD,SAAY,CAEhE,MAAMF,EAAyC,CAC7C,aAAc,eACd,SAAU,WAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,OAAO,CAAC,EAG/D,MAAMC,EAAS,MAAM,IAAI,+BACvBH,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOE,CAAM,EAAE,WACb,QACE,MACE,wFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMF,EAAyC,CAC7C,aAAc,eACd,SAAU,WAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAM,EAAAC,QAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAM,CACJ,CACE,WAAY,CACV,KAAM,gBACN,WAAY,CACV,KAAM,UACR,CACF,CACF,CACF,CACF,CAAC,EAGD,MAAMC,EAAS,MAAM,IAAI,+BACvBH,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOE,CAAM,EAAE,WACb,QACE,MACE,oGACF,CACF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_axios", "import_purify_ts", "import_HttpPkiCertificateDataSource", "import_KeyUsage", "config", "pkiCertificateInfo", "axios", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(i,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!m.call(i,t)&&t!==o&&f(i,t,{get:()=>e[t],enumerable:!(r=c(e,t))||r.enumerable});return i};var n=i=>p(f({},"__esModule",{value:!0}),i);var C={};module.exports=n(C);
|
|
2
|
+
//# sourceMappingURL=PkiCertificateDataSource.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/data/PkiCertificateDataSource.ts"],
|
|
4
|
+
"sourcesContent": ["import { type Either } from \"purify-ts\";\n\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\nexport interface PkiCertificateDataSource {\n fetchCertificate(\n certificateInfos: PkiCertificateInfo,\n ): Promise<Either<Error, PkiCertificate | undefined>>;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["PkiCertificateDataSource_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var p=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a(t))!o.call(e,i)&&i!==n&&s(e,i,{get:()=>t[i],enumerable:!(r=g(t,i))||r.enumerable});return e};var c=e=>p(s({},"__esModule",{value:!0}),e);var d={};module.exports=c(d);
|
|
2
|
+
//# sourceMappingURL=pkiDataSourceTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/data/pkiDataSourceTypes.ts"],
|
|
4
|
+
"sourcesContent": ["export type PkiCertificateRequestDto = {\n public_key_id: string | undefined;\n public_key_usage: string;\n output: string;\n target_device: string;\n latest: boolean;\n};\n\nexport type PkiCertificateResponseDto = {\n id: string;\n target_device: string;\n not_valid_after: string;\n public_key_usage: string;\n certificate_version: string;\n descriptor: {\n data: string;\n descriptorType: string;\n signatures: {\n prod: string;\n test: string;\n };\n };\n};\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["pkiDataSourceTypes_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var k=(t,o)=>{for(var i in o)a(t,i,{get:o[i],enumerable:!0})},C=(t,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of u(o))!d.call(t,e)&&e!==i&&a(t,e,{get:()=>o[e],enumerable:!(r=p(o,e))||r.enumerable});return t};var P=t=>C(a({},"__esModule",{value:!0}),t);var s={};k(s,{nanoPkiModuleFactory:()=>l});module.exports=P(s);var n=require("inversify"),c=require("../../pki/data/HttpPkiCertificateDataSource"),m=require("../../pki/domain/DefaultPkiCertificateLoader"),f=require("./pkiTypes");const l=()=>new n.ContainerModule((t,o,i,r)=>{t(f.pkiTypes.PkiCertificateDataSource).to(c.HttpPkiCertificateDataSource),t(f.pkiTypes.PkiCertificateLoader).to(m.DefaultPkiCertificateLoader)});0&&(module.exports={nanoPkiModuleFactory});
|
|
2
|
+
//# sourceMappingURL=pkiModuleFactory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/di/pkiModuleFactory.ts"],
|
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { HttpPkiCertificateDataSource } from \"@/pki/data/HttpPkiCertificateDataSource\";\nimport { DefaultPkiCertificateLoader } from \"@/pki/domain/DefaultPkiCertificateLoader\";\n\nimport { pkiTypes } from \"./pkiTypes\";\n\nexport const nanoPkiModuleFactory = () =>\n new ContainerModule((bind, _unbind, _isBound, _rebind) => {\n bind(pkiTypes.PkiCertificateDataSource).to(HttpPkiCertificateDataSource);\n bind(pkiTypes.PkiCertificateLoader).to(DefaultPkiCertificateLoader);\n });\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA6C,mDAC7CC,EAA4C,oDAE5CC,EAAyB,sBAElB,MAAML,EAAuB,IAClC,IAAI,kBAAgB,CAACM,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAK,WAAS,wBAAwB,EAAE,GAAG,8BAA4B,EACvEA,EAAK,WAAS,oBAAoB,EAAE,GAAG,6BAA2B,CACpE,CAAC",
|
|
6
|
+
"names": ["pkiModuleFactory_exports", "__export", "nanoPkiModuleFactory", "__toCommonJS", "import_inversify", "import_HttpPkiCertificateDataSource", "import_DefaultPkiCertificateLoader", "import_pkiTypes", "bind", "_unbind", "_isBound", "_rebind"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var C=(i,e)=>{for(var r in e)a(i,r,{get:e[r],enumerable:!0})},P=(i,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of f(e))!k.call(i,t)&&t!==r&&a(i,t,{get:()=>e[t],enumerable:!(o=c(e,t))||o.enumerable});return i};var S=i=>P(a({},"__esModule",{value:!0}),i);var y={};C(y,{pkiTypes:()=>p});module.exports=S(y);const p={PkiCertificateDataSource:Symbol.for("PkiCertificateDataSource"),PkiCertificateLoader:Symbol.for("PkiCertificateLoader")};0&&(module.exports={pkiTypes});
|
|
2
|
+
//# sourceMappingURL=pkiTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/di/pkiTypes.ts"],
|
|
4
|
+
"sourcesContent": ["export const pkiTypes = {\n PkiCertificateDataSource: Symbol.for(\"PkiCertificateDataSource\"),\n PkiCertificateLoader: Symbol.for(\"PkiCertificateLoader\"),\n};\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAO,MAAME,EAAW,CACtB,yBAA0B,OAAO,IAAI,0BAA0B,EAC/D,qBAAsB,OAAO,IAAI,sBAAsB,CACzD",
|
|
6
|
+
"names": ["pkiTypes_exports", "__export", "pkiTypes", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var d=(i,t)=>{for(var r in t)o(i,r,{get:t[r],enumerable:!0})},S=(i,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of k(t))!P.call(i,e)&&e!==r&&o(i,e,{get:()=>t[e],enumerable:!(a=n(t,e))||a.enumerable});return i};var y=i=>S(o({},"__esModule",{value:!0}),i),s=(i,t,r,a)=>{for(var e=a>1?void 0:a?n(t,r):t,m=i.length-1,p;m>=0;m--)(p=i[m])&&(e=(a?p(t,r,e):p(e))||e);return a&&e&&o(t,r,e),e},u=(i,t)=>(r,a)=>t(r,a,i);var h={};d(h,{DefaultPkiCertificateLoader:()=>c});module.exports=y(h);var f=require("inversify"),C=require("../../pki/di/pkiTypes");let c=class{_dataSource;constructor(t){this._dataSource=t}async loadCertificate(t){return(await this._dataSource.fetchCertificate(t)).orDefault(void 0)}};c=s([(0,f.injectable)(),u(0,(0,f.inject)(C.pkiTypes.PkiCertificateDataSource))],c);0&&(module.exports={DefaultPkiCertificateLoader});
|
|
2
|
+
//# sourceMappingURL=DefaultPkiCertificateLoader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/domain/DefaultPkiCertificateLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import { inject, injectable } from \"inversify\";\n\nimport { type PkiCertificateDataSource } from \"@/pki/data/PkiCertificateDataSource\";\nimport { pkiTypes } from \"@/pki/di/pkiTypes\";\nimport { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\nimport { PkiCertificateLoader } from \"./PkiCertificateLoader\";\n\n@injectable()\nexport class DefaultPkiCertificateLoader implements PkiCertificateLoader {\n private _dataSource: PkiCertificateDataSource;\n\n constructor(\n @inject(pkiTypes.PkiCertificateDataSource)\n dataSource: PkiCertificateDataSource,\n ) {\n this._dataSource = dataSource;\n }\n\n async loadCertificate(\n certificateInfos: PkiCertificateInfo,\n ): Promise<PkiCertificate | undefined> {\n const certificate =\n await this._dataSource.fetchCertificate(certificateInfos);\n\n return certificate.orDefault(undefined);\n }\n}\n"],
|
|
5
|
+
"mappings": "okBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmC,qBAGnCC,EAAyB,6BAOlB,IAAMC,EAAN,KAAkE,CAC/D,YAER,YAEEC,EACA,CACA,KAAK,YAAcA,CACrB,CAEA,MAAM,gBACJC,EACqC,CAIrC,OAFE,MAAM,KAAK,YAAY,iBAAiBA,CAAgB,GAEvC,UAAU,MAAS,CACxC,CACF,EAlBaF,EAANG,EAAA,IADN,cAAW,EAKPC,EAAA,eAAO,WAAS,wBAAwB,IAJhCJ",
|
|
6
|
+
"names": ["DefaultPkiCertificateLoader_exports", "__export", "DefaultPkiCertificateLoader", "__toCommonJS", "import_inversify", "import_pkiTypes", "DefaultPkiCertificateLoader", "dataSource", "certificateInfos", "__decorateClass", "__decorateParam"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=require("purify-ts"),r=require("../../pki/domain/DefaultPkiCertificateLoader"),c=require("../../pki/model/KeyUsage");describe("DefaultPkiCertificateLoader",()=>{describe("loadCertificate",()=>{it("should call loadCertificate",async()=>{const e={targetDevice:"targetDevice",keyUsage:c.KeyUsage.Calldata,keyId:"keyId"},t={keyUsageNumber:11,payload:new Uint8Array([1,2,3,4,21,4,5,6,7,8])},a={fetchCertificate:vi.fn().mockResolvedValue((0,i.Right)(t))},o=await new r.DefaultPkiCertificateLoader(a).loadCertificate(e);expect(o).toEqual(t),expect(a.fetchCertificate).toHaveBeenCalledWith(e)})})});
|
|
2
|
+
//# sourceMappingURL=DefaultPkiCertificateLoader.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/domain/DefaultPkiCertificateLoader.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { Right } from \"purify-ts\";\n\nimport { DefaultPkiCertificateLoader } from \"@/pki/domain/DefaultPkiCertificateLoader\";\nimport { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\ndescribe(\"DefaultPkiCertificateLoader\", () => {\n describe(\"loadCertificate\", () => {\n it(\"should call loadCertificate\", async () => {\n // GIVEN\n const certificateInfos: PkiCertificateInfo = {\n targetDevice: \"targetDevice\",\n keyUsage: KeyUsage.Calldata,\n keyId: \"keyId\",\n };\n const certificate = {\n keyUsageNumber: 11,\n payload: new Uint8Array([\n 0x01, 0x02, 0x03, 0x04, 0x15, 0x04, 0x05, 0x06, 0x07, 0x08,\n ]),\n };\n const dataSource = {\n fetchCertificate: vi.fn().mockResolvedValue(Right(certificate)),\n };\n\n // WHEN\n const loader = new DefaultPkiCertificateLoader(dataSource);\n const result = await loader.loadCertificate(certificateInfos);\n\n // THEN\n expect(result).toEqual(certificate);\n expect(dataSource.fetchCertificate).toHaveBeenCalledWith(\n certificateInfos,\n );\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAAsB,qBAEtBC,EAA4C,oDAC5CC,EAAyB,gCAGzB,SAAS,8BAA+B,IAAM,CAC5C,SAAS,kBAAmB,IAAM,CAChC,GAAG,8BAA+B,SAAY,CAE5C,MAAMC,EAAuC,CAC3C,aAAc,eACd,SAAU,WAAS,SACnB,MAAO,OACT,EACMC,EAAc,CAClB,eAAgB,GAChB,QAAS,IAAI,WAAW,CACtB,EAAM,EAAM,EAAM,EAAM,GAAM,EAAM,EAAM,EAAM,EAAM,CACxD,CAAC,CACH,EACMC,EAAa,CACjB,iBAAkB,GAAG,GAAG,EAAE,qBAAkB,SAAMD,CAAW,CAAC,CAChE,EAIME,EAAS,MADA,IAAI,8BAA4BD,CAAU,EAC7B,gBAAgBF,CAAgB,EAG5D,OAAOG,CAAM,EAAE,QAAQF,CAAW,EAClC,OAAOC,EAAW,gBAAgB,EAAE,qBAClCF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_purify_ts", "import_DefaultPkiCertificateLoader", "import_KeyUsage", "certificateInfos", "certificate", "dataSource", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var f=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var C=(e,i,o,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of c(i))!n.call(e,t)&&t!==o&&f(e,t,{get:()=>i[t],enumerable:!(r=a(i,t))||r.enumerable});return e};var P=e=>C(f({},"__esModule",{value:!0}),e);var k={};module.exports=P(k);
|
|
2
|
+
//# sourceMappingURL=PkiCertificateLoader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/domain/PkiCertificateLoader.ts"],
|
|
4
|
+
"sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\nimport { type PkiCertificateInfo } from \"@/pki/model/PkiCertificateInfo\";\n\nexport interface PkiCertificateLoader {\n loadCertificate(\n certificateInfos: PkiCertificateInfo,\n ): Promise<PkiCertificate | undefined>;\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["PkiCertificateLoader_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var s=(e,t)=>{for(var _ in t)l(e,_,{get:t[_],enumerable:!0})},u=(e,t,_,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of m(t))!c.call(e,r)&&r!==_&&l(e,r,{get:()=>t[r],enumerable:!(o=k(t,r))||o.enumerable});return e};var d=e=>u(l({},"__esModule",{value:!0}),e);var g={};s(g,{KeyId:()=>n});module.exports=d(g);var n=(a=>(a.Test="test",a.PersoV2="persov2",a.LedgerRootV3="ledger_root_v3",a.PluginSelectorKey="plugin_selector_key",a.NftMetadataKey="nft_metadata_key",a.PartnerMetadataKey="partner_metadata_key",a.Erc20MetadataKey="erc20_metadata_key",a.DomainMetadataKey="domain_metadata_key",a.CalCalldataKey="cal_calldata_key",a.CalTrustedNameKey="cal_trusted_name_key",a.CalNetwork="cal_network",a))(n||{});0&&(module.exports={KeyId});
|
|
2
|
+
//# sourceMappingURL=KeyId.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/model/KeyId.ts"],
|
|
4
|
+
"sourcesContent": ["export enum KeyId {\n Test = \"test\",\n PersoV2 = \"persov2\",\n LedgerRootV3 = \"ledger_root_v3\",\n PluginSelectorKey = \"plugin_selector_key\",\n NftMetadataKey = \"nft_metadata_key\",\n PartnerMetadataKey = \"partner_metadata_key\",\n Erc20MetadataKey = \"erc20_metadata_key\",\n DomainMetadataKey = \"domain_metadata_key\",\n CalCalldataKey = \"cal_calldata_key\",\n CalTrustedNameKey = \"cal_trusted_name_key\",\n CalNetwork = \"cal_network\",\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GAAO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,aAAe,iBACfA,EAAA,kBAAoB,sBACpBA,EAAA,eAAiB,mBACjBA,EAAA,mBAAqB,uBACrBA,EAAA,iBAAmB,qBACnBA,EAAA,kBAAoB,sBACpBA,EAAA,eAAiB,mBACjBA,EAAA,kBAAoB,uBACpBA,EAAA,WAAa,cAXHA,OAAA",
|
|
6
|
+
"names": ["KeyId_exports", "__export", "KeyId", "__toCommonJS"]
|
|
7
|
+
}
|