@ledgerhq/context-module 1.1.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/lib/cjs/package.json +8 -7
- package/lib/cjs/src/ContextModuleBuilder.test.js +1 -1
- package/lib/cjs/src/ContextModuleBuilder.test.js.map +2 -2
- package/lib/cjs/src/DefaultContextModule.js +1 -1
- package/lib/cjs/src/DefaultContextModule.js.map +3 -3
- package/lib/cjs/src/DefaultContextModule.test.js +1 -1
- package/lib/cjs/src/DefaultContextModule.test.js.map +2 -2
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +3 -3
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
- package/lib/cjs/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +2 -2
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
- package/lib/cjs/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +2 -2
- package/lib/cjs/src/index.js +1 -1
- package/lib/cjs/src/index.js.map +2 -2
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js +1 -1
- package/lib/cjs/src/nft/data/HttpNftDataSource.test.js.map +2 -2
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js +1 -1
- package/lib/cjs/src/nft/domain/NftContextLoader.test.js.map +2 -2
- 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/model/ClearSignContext.js +1 -1
- package/lib/cjs/src/shared/model/ClearSignContext.js.map +2 -2
- package/lib/cjs/src/shared/model/GenericPath.js +1 -1
- package/lib/cjs/src/shared/model/GenericPath.js.map +1 -1
- 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 +1 -1
- package/lib/cjs/src/shared/model/TransactionContext.js.map +1 -1
- package/lib/cjs/src/shared/utils/HexStringUtils.js +1 -1
- package/lib/cjs/src/shared/utils/HexStringUtils.js.map +3 -3
- 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.test.js +1 -1
- package/lib/cjs/src/token/data/HttpTokenDataSource.test.js.map +2 -2
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js +1 -1
- package/lib/cjs/src/token/domain/TokenContextLoader.test.js.map +2 -2
- package/lib/cjs/src/transaction/data/CalldataDto.js +1 -1
- package/lib/cjs/src/transaction/data/CalldataDto.js.map +1 -1
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js +1 -1
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
- package/lib/cjs/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
- package/lib/cjs/src/transaction/data/TransactionDataSource.js +1 -1
- package/lib/cjs/src/transaction/data/TransactionDataSource.js.map +1 -1
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js +1 -1
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.js.map +2 -2
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js +1 -1
- package/lib/cjs/src/transaction/domain/TransactionContextLoader.test.js.map +2 -2
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
- package/lib/cjs/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +2 -2
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.js.map +2 -2
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
- package/lib/cjs/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +2 -2
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
- package/lib/cjs/src/typed-data/data/HttpTypedDataDataSource.test.js.map +2 -2
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
- package/lib/cjs/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +2 -2
- 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/package.json +8 -7
- package/lib/esm/src/ContextModuleBuilder.test.js +1 -1
- package/lib/esm/src/ContextModuleBuilder.test.js.map +2 -2
- package/lib/esm/src/DefaultContextModule.js +1 -1
- package/lib/esm/src/DefaultContextModule.js.map +3 -3
- package/lib/esm/src/DefaultContextModule.test.js +1 -1
- package/lib/esm/src/DefaultContextModule.test.js.map +2 -2
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js +1 -1
- package/lib/esm/src/external-plugin/data/HttpExternalPluginDataSource.test.js.map +2 -2
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js +1 -1
- package/lib/esm/src/external-plugin/domain/ExternalPluginContextLoader.test.js.map +2 -2
- package/lib/esm/src/index.js +1 -1
- package/lib/esm/src/index.js.map +2 -2
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js +1 -1
- package/lib/esm/src/nft/data/HttpNftDataSource.test.js.map +2 -2
- package/lib/esm/src/nft/domain/NftContextLoader.test.js +1 -1
- package/lib/esm/src/nft/domain/NftContextLoader.test.js.map +2 -2
- 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/model/ClearSignContext.js +1 -1
- package/lib/esm/src/shared/model/ClearSignContext.js.map +2 -2
- package/lib/esm/src/shared/model/GenericPath.js.map +1 -1
- 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/utils/HexStringUtils.js +1 -1
- package/lib/esm/src/shared/utils/HexStringUtils.js.map +3 -3
- 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.test.js +1 -1
- package/lib/esm/src/token/data/HttpTokenDataSource.test.js.map +2 -2
- package/lib/esm/src/token/domain/TokenContextLoader.test.js +1 -1
- package/lib/esm/src/token/domain/TokenContextLoader.test.js.map +2 -2
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js +1 -1
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.js.map +3 -3
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js +1 -1
- package/lib/esm/src/transaction/data/HttpTransactionDataSource.test.js.map +3 -3
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js +1 -1
- package/lib/esm/src/transaction/domain/TransactionContextLoader.js.map +2 -2
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js +1 -1
- package/lib/esm/src/transaction/domain/TransactionContextLoader.test.js.map +2 -2
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js +1 -1
- package/lib/esm/src/trusted-name/data/HttpTrustedNameDataSource.test.js.map +2 -2
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js +1 -1
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.js.map +2 -2
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js +1 -1
- package/lib/esm/src/trusted-name/domain/TrustedNameContextLoader.test.js.map +2 -2
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js +1 -1
- package/lib/esm/src/typed-data/data/HttpTypedDataDataSource.test.js.map +2 -2
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js +1 -1
- package/lib/esm/src/typed-data/domain/DefaultTypedDataContextLoader.test.js.map +2 -2
- 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/types/src/DefaultContextModule.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/index.d.ts +5 -0
- package/lib/types/src/index.d.ts.map +1 -1
- 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/model/ClearSignContext.d.ts +24 -13
- package/lib/types/src/shared/model/ClearSignContext.d.ts.map +1 -1
- package/lib/types/src/shared/model/GenericPath.d.ts +2 -2
- package/lib/types/src/shared/model/GenericPath.d.ts.map +1 -1
- 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 +3 -1
- package/lib/types/src/shared/model/TransactionContext.d.ts.map +1 -1
- package/lib/types/src/shared/utils/HexStringUtils.d.ts +1 -0
- package/lib/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/types/src/transaction/data/CalldataDto.d.ts +15 -4
- package/lib/types/src/transaction/data/CalldataDto.d.ts.map +1 -1
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts +8 -4
- package/lib/types/src/transaction/data/HttpTransactionDataSource.d.ts.map +1 -1
- package/lib/types/src/transaction/data/TransactionDataSource.d.ts +2 -1
- package/lib/types/src/transaction/data/TransactionDataSource.d.ts.map +1 -1
- package/lib/types/src/transaction/domain/TransactionContextLoader.d.ts.map +1 -1
- 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 -1
- package/package.json +10 -9
|
@@ -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": "AAAA,OAAOA,MAAW,QAClB,OAAS,QAAAC,EAAM,SAAAC,MAAa,YAG5B,OAAS,gCAAAC,MAAoC,0CAC7C,OAAS,YAAAC,MAAgB,uBAGzB,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,SAAUF,EAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAMJ,EAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAM,CACJ,CACE,WAAY,CACV,KAAM,WACN,WAAY,CACV,KAAM,UACR,CACF,CACF,CACF,CACF,CAAC,EAGD,MAAMO,EAAS,MAAM,IAAIJ,EACvBE,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOC,CAAM,EAAE,QACbL,EAAM,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,MAAMI,EAAyC,CAC7C,aAAc,eACd,SAAUF,EAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAMJ,EAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAM,CAAC,CACT,CAAC,EAGD,MAAMO,EAAS,MAAM,IAAIJ,EACvBE,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOC,CAAM,EAAE,QACbN,EACE,MACE,wFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,kDAAmD,SAAY,CAEhE,MAAMK,EAAyC,CAC7C,aAAc,eACd,SAAUF,EAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAMJ,EAAO,SAAS,EAAE,kBAAkB,IAAI,MAAM,OAAO,CAAC,EAG/D,MAAMO,EAAS,MAAM,IAAIJ,EACvBE,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOC,CAAM,EAAE,QACbN,EACE,MACE,wFACF,CACF,CACF,CACF,CAAC,EAED,GAAG,0DAA2D,SAAY,CAExE,MAAMK,EAAyC,CAC7C,aAAc,eACd,SAAUF,EAAS,SACnB,MAAO,OACT,EACA,GAAG,MAAMJ,EAAO,SAAS,EAAE,kBAAkB,CAC3C,OAAQ,IACR,KAAM,CACJ,CACE,WAAY,CACV,KAAM,gBACN,WAAY,CACV,KAAM,UACR,CACF,CACF,CACF,CACF,CAAC,EAGD,MAAMO,EAAS,MAAM,IAAIJ,EACvBE,CACF,EAAE,iBAAiBC,CAAkB,EAGrC,OAAOC,CAAM,EAAE,QACbN,EACE,MACE,oGACF,CACF,CACF,CACF,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["axios", "Left", "Right", "HttpPkiCertificateDataSource", "KeyUsage", "config", "pkiCertificateInfo", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=PkiCertificateDataSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=pkiDataSourceTypes.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ContainerModule as i}from"inversify";import{HttpPkiCertificateDataSource as e}from"../../pki/data/HttpPkiCertificateDataSource";import{DefaultPkiCertificateLoader as r}from"../../pki/domain/DefaultPkiCertificateLoader";import{pkiTypes as o}from"./pkiTypes";const d=()=>new i((t,a,f,n)=>{t(o.PkiCertificateDataSource).to(e),t(o.PkiCertificateLoader).to(r)});export{d as 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": "AAAA,OAAS,mBAAAA,MAAuB,YAEhC,OAAS,gCAAAC,MAAoC,0CAC7C,OAAS,+BAAAC,MAAmC,2CAE5C,OAAS,YAAAC,MAAgB,aAElB,MAAMC,EAAuB,IAClC,IAAIJ,EAAgB,CAACK,EAAMC,EAASC,EAAUC,IAAY,CACxDH,EAAKF,EAAS,wBAAwB,EAAE,GAAGF,CAA4B,EACvEI,EAAKF,EAAS,oBAAoB,EAAE,GAAGD,CAA2B,CACpE,CAAC",
|
|
6
|
+
"names": ["ContainerModule", "HttpPkiCertificateDataSource", "DefaultPkiCertificateLoader", "pkiTypes", "nanoPkiModuleFactory", "bind", "_unbind", "_isBound", "_rebind"]
|
|
7
|
+
}
|
|
@@ -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": "AAAO,MAAMA,EAAW,CACtB,yBAA0B,OAAO,IAAI,0BAA0B,EAC/D,qBAAsB,OAAO,IAAI,sBAAsB,CACzD",
|
|
6
|
+
"names": ["pkiTypes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var n=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var m=(a,t,e,r)=>{for(var i=r>1?void 0:r?s(t,e):t,o=a.length-1,f;o>=0;o--)(f=a[o])&&(i=(r?f(t,e,i):f(i))||i);return r&&i&&n(t,e,i),i},p=(a,t)=>(e,r)=>t(e,r,a);import{inject as u,injectable as C}from"inversify";import{pkiTypes as k}from"../../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=m([C(),p(0,u(k.PkiCertificateDataSource))],c);export{c as 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": "iOAAA,OAAS,UAAAA,EAAQ,cAAAC,MAAkB,YAGnC,OAAS,YAAAC,MAAgB,oBAOlB,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,CADNC,EAAW,EAKPC,EAAA,EAAAC,EAAOC,EAAS,wBAAwB,IAJhCP",
|
|
6
|
+
"names": ["inject", "injectable", "pkiTypes", "DefaultPkiCertificateLoader", "dataSource", "certificateInfos", "__decorateClass", "injectable", "__decorateParam", "inject", "pkiTypes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Right as r}from"purify-ts";import{DefaultPkiCertificateLoader as c}from"../../pki/domain/DefaultPkiCertificateLoader";import{KeyUsage as o}from"../../pki/model/KeyUsage";describe("DefaultPkiCertificateLoader",()=>{describe("loadCertificate",()=>{it("should call loadCertificate",async()=>{const e={targetDevice:"targetDevice",keyUsage:o.Calldata,keyId:"keyId"},t={keyUsageNumber:11,payload:new Uint8Array([1,2,3,4,21,4,5,6,7,8])},a={fetchCertificate:vi.fn().mockResolvedValue(r(t))},i=await new c(a).loadCertificate(e);expect(i).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,OAAS,SAAAA,MAAa,YAEtB,OAAS,+BAAAC,MAAmC,2CAC5C,OAAS,YAAAC,MAAgB,uBAGzB,SAAS,8BAA+B,IAAM,CAC5C,SAAS,kBAAmB,IAAM,CAChC,GAAG,8BAA+B,SAAY,CAE5C,MAAMC,EAAuC,CAC3C,aAAc,eACd,SAAUD,EAAS,SACnB,MAAO,OACT,EACME,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,kBAAkBL,EAAMI,CAAW,CAAC,CAChE,EAIME,EAAS,MADA,IAAIL,EAA4BI,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": ["Right", "DefaultPkiCertificateLoader", "KeyUsage", "certificateInfos", "certificate", "dataSource", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=PkiCertificateLoader.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var t=(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))(t||{});export{t as 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": "AAAO,IAAKA,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"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var r=(t=>(t.GenuineCheck="genuine_check",t.ExchangePayload="exchange_payload",t.NftMeta="nft_meta",t.TrustedName="trusted_name",t.BackupProvider="backup_provider",t.ProtectOrchestrator="protect_orchestrator",t.PluginMeta="plugin_meta",t.CoinMeta="coin_meta",t.SeedIdAuth="seed_id_auth",t.TxSimulationSigner="tx_simu_signer",t.Calldata="calldata",t.Network="network",t))(r||{});export{r as KeyUsage};
|
|
2
|
+
//# sourceMappingURL=KeyUsage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pki/model/KeyUsage.ts"],
|
|
4
|
+
"sourcesContent": ["export enum KeyUsage {\n GenuineCheck = \"genuine_check\",\n ExchangePayload = \"exchange_payload\",\n NftMeta = \"nft_meta\",\n TrustedName = \"trusted_name\",\n BackupProvider = \"backup_provider\",\n ProtectOrchestrator = \"protect_orchestrator\",\n PluginMeta = \"plugin_meta\",\n CoinMeta = \"coin_meta\",\n SeedIdAuth = \"seed_id_auth\",\n TxSimulationSigner = \"tx_simu_signer\",\n Calldata = \"calldata\",\n Network = \"network\",\n}\n"],
|
|
5
|
+
"mappings": "AAAO,IAAKA,OACVA,EAAA,aAAe,gBACfA,EAAA,gBAAkB,mBAClBA,EAAA,QAAU,WACVA,EAAA,YAAc,eACdA,EAAA,eAAiB,kBACjBA,EAAA,oBAAsB,uBACtBA,EAAA,WAAa,cACbA,EAAA,SAAW,YACXA,EAAA,WAAa,eACbA,EAAA,mBAAqB,iBACrBA,EAAA,SAAW,WACXA,EAAA,QAAU,UAZAA,OAAA",
|
|
6
|
+
"names": ["KeyUsage"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=PkiCertificate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=PkiCertificateInfo.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=(e=>(e.TOKEN="token",e.NFT="nft",e.TRUSTED_NAME="trustedName",e.PLUGIN="plugin",e.EXTERNAL_PLUGIN="externalPlugin",e.TRANSACTION_INFO="transactionInfo",e.ENUM="enum",e.TRANSACTION_FIELD_DESCRIPTION="transactionFieldDescription",e.ERROR="error",e))(t||{});export{t as ClearSignContextType};
|
|
2
2
|
//# sourceMappingURL=ClearSignContext.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/shared/model/ClearSignContext.ts"],
|
|
4
|
-
"sourcesContent": ["import { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n ENUM = \"enum\",\n TRANSACTION_FIELD_DESCRIPTION = \"transactionFieldDescription\",\n ERROR = \"error\",\n}\n\nexport type
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { type PkiCertificate } from \"@/pki/model/PkiCertificate\";\n\nimport { type GenericPath } from \"./GenericPath\";\n\nexport enum ClearSignContextType {\n TOKEN = \"token\",\n NFT = \"nft\",\n TRUSTED_NAME = \"trustedName\",\n PLUGIN = \"plugin\",\n EXTERNAL_PLUGIN = \"externalPlugin\",\n TRANSACTION_INFO = \"transactionInfo\",\n ENUM = \"enum\",\n TRANSACTION_FIELD_DESCRIPTION = \"transactionFieldDescription\",\n ERROR = \"error\",\n}\n\nexport type ClearSignContextReferenceType =\n | ClearSignContextType.TOKEN\n | ClearSignContextType.NFT\n | ClearSignContextType.ENUM\n | ClearSignContextType.TRUSTED_NAME;\n\nexport type ClearSignContextReference<\n Type extends ClearSignContextReferenceType = ClearSignContextReferenceType,\n> = Type extends ClearSignContextType.ENUM\n ? {\n type: ClearSignContextType.ENUM;\n valuePath: GenericPath;\n id: number; // enum id to reference\n }\n : Type extends ClearSignContextType.TRUSTED_NAME\n ? {\n type: ClearSignContextType.TRUSTED_NAME;\n valuePath: GenericPath;\n types: string[];\n sources: string[];\n }\n :\n | {\n type: Type;\n valuePath: GenericPath;\n value?: never;\n }\n | {\n type: Type;\n valuePath?: never;\n value: string;\n };\n\nexport type ClearSignContextSuccessType = Exclude<\n ClearSignContextType,\n ClearSignContextType.ERROR\n>;\n\n// NOTE: this is a union of all possible success types\n// There is currently two types of success:\n// - ENUM: which is a special case, we need to handle it differently\n// because we don't want to send the whole enum\n// but only the parts that are needed.\n// - id: the enum id to reference\n// - payload: the payload to send with a provideEnum command\n// - name: the name of the enum to be displayed on the device\n// - value: the value of the enum to be retrieved from the transaction\n// - All other types\n// - payload: the payload to send with a provide command\n// - reference: the reference to the value to be retrieved from the transaction\nexport type ClearSignContextSuccess<\n Type extends ClearSignContextSuccessType = ClearSignContextSuccessType,\n> = Type extends ClearSignContextType.ENUM\n ? {\n type: ClearSignContextType.ENUM;\n id: number;\n payload: string;\n value: number;\n certificate?: PkiCertificate;\n }\n : {\n type: Exclude<\n ClearSignContextType,\n ClearSignContextType.ENUM | ClearSignContextType.ERROR\n >;\n payload: string;\n reference?: ClearSignContextReference;\n certificate?: PkiCertificate;\n };\n\nexport type ClearSignContextError = {\n type: ClearSignContextType.ERROR;\n error: Error;\n};\n\nexport type ClearSignContext = ClearSignContextSuccess | ClearSignContextError;\n"],
|
|
5
|
+
"mappings": "AAIO,IAAKA,OACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,aAAe,cACfA,EAAA,OAAS,SACTA,EAAA,gBAAkB,iBAClBA,EAAA,iBAAmB,kBACnBA,EAAA,KAAO,OACPA,EAAA,8BAAgC,8BAChCA,EAAA,MAAQ,QATEA,OAAA",
|
|
6
6
|
"names": ["ClearSignContextType"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/shared/model/GenericPath.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Generic binary paths are a way to to navigate in any kind of structured binary data such as:\n * - transactions\n * - typed messages (EIP-712)\n * - meta transactions (EIP-2771)\n * - user operations (EIP-4337)\n * - ...\n * We follow here the concepts defined in the clear signing standard:\n * https://github.com/LedgerHQ/clear-signing-erc7730-registry/blob/master/specs/erc-7730.md#structured-data\n *\n * - The container is the structure to be signed, for instance a transaction\n * - The structured data is the data we want to navigate in, for instance a transaction calldata\n *\n * A generic path is either a field of the container, or a path in the structured data.\n * Those path will also be handled by the devices:\n * https://github.com/LedgerHQ/generic_parser/blob/master/specs.md#path_element\n */\n\n// A generic path is either a path in the container, or a path in its data.\n// Path in the data is a list of steps to apply\nexport type GenericPath = ContainerPathValues | DataPathElement[];\n\n// Path in the container is only a finite list of known attributes\nexport enum ContainerPath {\n FROM = \"FROM\",\n TO = \"TO\",\n VALUE = \"VALUE\",\n}\nexport type ContainerPathValues = keyof typeof ContainerPath;\n\n/**\n * A path in binary data will be composed of:\n * - any number of steps of which:\n * - Tuple: a set of elements which size if known\n * - Array: an array of elements with dynamic size\n * - Reference: a pointer to dereference\n * - one leaf at the end to indicate the returned element type\n * - static leaf: 1 fixed-size chunk is returned\n * - dynamic leaf: element of variable size is returned\n * - optionally a slice element, only allowed after the leaf, to slice the result\n *\n * An example for a transaction with that ethereum smart contract:\n * function requestWithdrawalsWithPermit(uint256[] _amounts, address _owner, (uint256,uint256,uint8,bytes32,bytes32) _permit)\n * In that case:\n * - _amounts is an array\n * - _permit is a tuple\n * We could have a tuple in an array, or an array in a tuple, in which case we would have several steps in the binary path.\n */\nexport type DataPathElement =\n | DataPathElementTuple\n | DataPathElementArray\n | DataPathElementRef\n | DataPathElementLeaf\n | DataPathElementSlice;\nexport enum DataPathElementType {\n TUPLE = \"TUPLE\",\n ARRAY = \"ARRAY\",\n REF = \"REF\",\n LEAF = \"LEAF\",\n SLICE = \"SLICE\",\n}\nexport type DataPathElementTypeValues = keyof typeof DataPathElementType;\n\n/**\n * Path element to navigate in a tuple.\n * - offset: the item of the tuple to select\n */\nexport interface DataPathElementTuple {\n type: \"TUPLE\";\n offset: number;\n}\n\n/**\n * Path element to navigate in an array of variable size.\n * - itemSize: the length of each item in that array (not the number of items which is variable).\n * - start: the start of the array slice to iterate on. If unset, start from the beginning of that array.\n * -
|
|
4
|
+
"sourcesContent": ["/**\n * Generic binary paths are a way to to navigate in any kind of structured binary data such as:\n * - transactions\n * - typed messages (EIP-712)\n * - meta transactions (EIP-2771)\n * - user operations (EIP-4337)\n * - ...\n * We follow here the concepts defined in the clear signing standard:\n * https://github.com/LedgerHQ/clear-signing-erc7730-registry/blob/master/specs/erc-7730.md#structured-data\n *\n * - The container is the structure to be signed, for instance a transaction\n * - The structured data is the data we want to navigate in, for instance a transaction calldata\n *\n * A generic path is either a field of the container, or a path in the structured data.\n * Those path will also be handled by the devices:\n * https://github.com/LedgerHQ/generic_parser/blob/master/specs.md#path_element\n */\n\n// A generic path is either a path in the container, or a path in its data.\n// Path in the data is a list of steps to apply\nexport type GenericPath = ContainerPathValues | DataPathElement[];\n\n// Path in the container is only a finite list of known attributes\nexport enum ContainerPath {\n FROM = \"FROM\",\n TO = \"TO\",\n VALUE = \"VALUE\",\n}\nexport type ContainerPathValues = keyof typeof ContainerPath;\n\n/**\n * A path in binary data will be composed of:\n * - any number of steps of which:\n * - Tuple: a set of elements which size if known\n * - Array: an array of elements with dynamic size\n * - Reference: a pointer to dereference\n * - one leaf at the end to indicate the returned element type\n * - static leaf: 1 fixed-size chunk is returned\n * - dynamic leaf: element of variable size is returned\n * - optionally a slice element, only allowed after the leaf, to slice the result\n *\n * An example for a transaction with that ethereum smart contract:\n * function requestWithdrawalsWithPermit(uint256[] _amounts, address _owner, (uint256,uint256,uint8,bytes32,bytes32) _permit)\n * In that case:\n * - _amounts is an array\n * - _permit is a tuple\n * We could have a tuple in an array, or an array in a tuple, in which case we would have several steps in the binary path.\n */\nexport type DataPathElement =\n | DataPathElementTuple\n | DataPathElementArray\n | DataPathElementRef\n | DataPathElementLeaf\n | DataPathElementSlice;\nexport enum DataPathElementType {\n TUPLE = \"TUPLE\",\n ARRAY = \"ARRAY\",\n REF = \"REF\",\n LEAF = \"LEAF\",\n SLICE = \"SLICE\",\n}\nexport type DataPathElementTypeValues = keyof typeof DataPathElementType;\n\n/**\n * Path element to navigate in a tuple.\n * - offset: the item of the tuple to select\n */\nexport interface DataPathElementTuple {\n type: \"TUPLE\";\n offset: number;\n}\n\n/**\n * Path element to navigate in an array of variable size.\n * - itemSize: the length of each item in that array (not the number of items which is variable).\n * - start: the start of the array slice to iterate on. If unset, start from the beginning of that array.\n * - end: the end of the array slice to iterate on (exclusive). If unset, iterate until the end of that array.\n */\nexport interface DataPathElementArray {\n type: \"ARRAY\";\n itemSize: number;\n start?: number;\n end?: number;\n}\n\n// Path element to indicate the current item should be de-referenced (its value contains a pointer).\nexport interface DataPathElementRef {\n type: \"REF\";\n}\n\n/**\n * Path element to represent the leaf of the path, to be returned.\n * It is mandatory, and only allowed at the end of the path.\n * It indicates the type of data to return:\n * - Static leaf: data of static size, typically 1 chunk\n * - Dynamic leaf: data of dynamic size, typically length+data\n * - Tuple leaf: returned data is a tuple (a set of a static number of elements)\n * - Array leaf: returned data is an array (dynamic number of elements)\n */\nexport interface DataPathElementLeaf {\n type: \"LEAF\";\n leafType: DataPathLeafTypeValues;\n}\nexport enum DataPathLeafType {\n STATIC_LEAF = \"STATIC_LEAF\",\n DYNAMIC_LEAF = \"DYNAMIC_LEAF\",\n TUPLE_LEAF = \"TUPLE_LEAF\",\n ARRAY_LEAF = \"ARRAY_LEAF\",\n}\nexport type DataPathLeafTypeValues = keyof typeof DataPathLeafType;\n\n/**\n * Path element to represent a slice.\n * It is optional and only allowed at the end of a path, after the leaf.\n * It means the leaf shall be sliced before being returned.\n */\nexport interface DataPathElementSlice {\n type: \"SLICE\";\n start?: number;\n end?: number;\n}\n"],
|
|
5
5
|
"mappings": "AAuBO,IAAKA,OACVA,EAAA,KAAO,OACPA,EAAA,GAAK,KACLA,EAAA,MAAQ,QAHEA,OAAA,IA+BAC,OACVA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,KAAO,OACPA,EAAA,MAAQ,QALEA,OAAA,IAiDAC,OACVA,EAAA,YAAc,cACdA,EAAA,aAAe,eACfA,EAAA,WAAa,aACbA,EAAA,WAAa,aAJHA,OAAA",
|
|
6
6
|
"names": ["ContainerPath", "DataPathElementType", "DataPathLeafType"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/shared/model/SignatureTags.ts"],
|
|
4
|
+
"sourcesContent": ["export const SIGNATURE_TAG = \"15\";\nexport const INFO_SIGNATURE_TAG = \"81ff\";\n"],
|
|
5
|
+
"mappings": "AAAO,MAAMA,EAAgB,KAChBC,EAAqB",
|
|
6
|
+
"names": ["SIGNATURE_TAG", "INFO_SIGNATURE_TAG"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class g{static stringToHex(
|
|
1
|
+
class g{static stringToHex(e){let t="";for(let r=0;r<e.length;r++){const n=e.charCodeAt(r).toString(16);t+=n.padStart(2,"0")}return t}static appendSignatureToPayload(e,t,r){t.length%2!==0&&(t="0"+t);let n=(t.length/2).toString(16);return n.length%2!==0&&(n="0"+n),`${e}${r}${n}${t}`}}export{g as HexStringUtils};
|
|
2
2
|
//# sourceMappingURL=HexStringUtils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/shared/utils/HexStringUtils.ts"],
|
|
4
|
-
"sourcesContent": ["export class HexStringUtils {\n static stringToHex(str: string): string {\n let hexString = \"\";\n for (let i = 0; i < str.length; i++) {\n const hex = str.charCodeAt(i).toString(16);\n hexString += hex.padStart(2, \"0\"); // Ensure each hex code is at least 2 characters long\n }\n return hexString;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAO,MAAMA,CAAe,CAC1B,OAAO,YAAYC,EAAqB,CACtC,IAAIC,EAAY,GAChB,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,IAAK,CACnC,MAAMC,EAAMH,EAAI,WAAWE,CAAC,EAAE,SAAS,EAAE,EACzCD,GAAaE,EAAI,SAAS,EAAG,GAAG,CAClC,CACA,OAAOF,CACT,CACF",
|
|
6
|
-
"names": ["HexStringUtils", "str", "hexString", "i", "hex"]
|
|
4
|
+
"sourcesContent": ["export class HexStringUtils {\n static stringToHex(str: string): string {\n let hexString = \"\";\n for (let i = 0; i < str.length; i++) {\n const hex = str.charCodeAt(i).toString(16);\n hexString += hex.padStart(2, \"0\"); // Ensure each hex code is at least 2 characters long\n }\n return hexString;\n }\n\n static appendSignatureToPayload(\n payload: string,\n signature: string,\n tag: string,\n ): string {\n // Ensure correct padding\n if (signature.length % 2 !== 0) {\n signature = \"0\" + signature;\n }\n // TLV encoding as according to trusted name documentation\n let signatureLength = (signature.length / 2).toString(16);\n if (signatureLength.length % 2 !== 0) {\n signatureLength = \"0\" + signatureLength;\n }\n\n return `${payload}${tag}${signatureLength}${signature}`;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAMA,CAAe,CAC1B,OAAO,YAAYC,EAAqB,CACtC,IAAIC,EAAY,GAChB,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,IAAK,CACnC,MAAMC,EAAMH,EAAI,WAAWE,CAAC,EAAE,SAAS,EAAE,EACzCD,GAAaE,EAAI,SAAS,EAAG,GAAG,CAClC,CACA,OAAOF,CACT,CAEA,OAAO,yBACLG,EACAC,EACAC,EACQ,CAEJD,EAAU,OAAS,IAAM,IAC3BA,EAAY,IAAMA,GAGpB,IAAIE,GAAmBF,EAAU,OAAS,GAAG,SAAS,EAAE,EACxD,OAAIE,EAAgB,OAAS,IAAM,IACjCA,EAAkB,IAAMA,GAGnB,GAAGH,CAAO,GAAGE,CAAG,GAAGC,CAAe,GAAGF,CAAS,EACvD,CACF",
|
|
6
|
+
"names": ["HexStringUtils", "str", "hexString", "i", "hex", "payload", "signature", "tag", "signatureLength"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{HexStringUtils as e}from"../../shared/utils/HexStringUtils";describe("HexStringUtils",()=>{describe("appendSignatureToPayload",()=>{it("should append signature to payload",()=>{const s=e.appendSignatureToPayload("01020304","05060708","15");expect(s).toEqual("01020304150405060708")}),it("should append signature to payload with odd length",()=>{const s=e.appendSignatureToPayload("01020304","5060708","15");expect(s).toEqual("01020304150405060708")})}),describe("stringToHex",()=>{it("should convert string to hex",()=>{const t=e.stringToHex("test");expect(t).toEqual("74657374")}),it("should convert string to hex with odd length",()=>{const t=e.stringToHex("test1");expect(t).toEqual("7465737431")})})});
|
|
2
|
+
//# sourceMappingURL=HexStringUtils.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/shared/utils/HexStringUtils.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { HexStringUtils } from \"@/shared/utils/HexStringUtils\";\n\ndescribe(\"HexStringUtils\", () => {\n describe(\"appendSignatureToPayload\", () => {\n it(\"should append signature to payload\", () => {\n // GIVEN\n const payload = \"01020304\";\n const signature = \"05060708\";\n const tag = \"15\";\n // WHEN\n const result = HexStringUtils.appendSignatureToPayload(\n payload,\n signature,\n tag,\n );\n // THEN\n expect(result).toEqual(\"01020304150405060708\");\n });\n\n it(\"should append signature to payload with odd length\", () => {\n // GIVEN\n const payload = \"01020304\";\n const signature = \"5060708\";\n const tag = \"15\";\n // WHEN\n const result = HexStringUtils.appendSignatureToPayload(\n payload,\n signature,\n tag,\n );\n // THEN\n expect(result).toEqual(\"01020304150405060708\");\n });\n });\n\n describe(\"stringToHex\", () => {\n it(\"should convert string to hex\", () => {\n // GIVEN\n const str = \"test\";\n // WHEN\n const result = HexStringUtils.stringToHex(str);\n // THEN\n expect(result).toEqual(\"74657374\");\n });\n\n it(\"should convert string to hex with odd length\", () => {\n // GIVEN\n const str = \"test1\";\n // WHEN\n const result = HexStringUtils.stringToHex(str);\n // THEN\n expect(result).toEqual(\"7465737431\");\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,kBAAAA,MAAsB,gCAE/B,SAAS,iBAAkB,IAAM,CAC/B,SAAS,2BAA4B,IAAM,CACzC,GAAG,qCAAsC,IAAM,CAM7C,MAAMC,EAASD,EAAe,yBAJd,WACE,WACN,IAMZ,EAEA,OAAOC,CAAM,EAAE,QAAQ,sBAAsB,CAC/C,CAAC,EAED,GAAG,qDAAsD,IAAM,CAM7D,MAAMA,EAASD,EAAe,yBAJd,WACE,UACN,IAMZ,EAEA,OAAOC,CAAM,EAAE,QAAQ,sBAAsB,CAC/C,CAAC,CACH,CAAC,EAED,SAAS,cAAe,IAAM,CAC5B,GAAG,+BAAgC,IAAM,CAIvC,MAAMA,EAASD,EAAe,YAFlB,MAEiC,EAE7C,OAAOC,CAAM,EAAE,QAAQ,UAAU,CACnC,CAAC,EAED,GAAG,+CAAgD,IAAM,CAIvD,MAAMA,EAASD,EAAe,YAFlB,OAEiC,EAE7C,OAAOC,CAAM,EAAE,QAAQ,YAAY,CACrC,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["HexStringUtils", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{KeyUsage as e}from"../../pki/model/KeyUsage";class s{static keyUsageMap=new Map([[e.GenuineCheck,1],[e.ExchangePayload,2],[e.NftMeta,3],[e.TrustedName,4],[e.BackupProvider,5],[e.ProtectOrchestrator,6],[e.PluginMeta,7],[e.CoinMeta,8],[e.SeedIdAuth,9],[e.TxSimulationSigner,10],[e.Calldata,11],[e.Network,12]]);static mapKeyUsageForFirmware(a){return this.keyUsageMap.get(a)??-1}}export{s as KeyUsageMapper};
|
|
2
|
+
//# sourceMappingURL=KeyUsageMapper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/shared/utils/KeyUsageMapper.ts"],
|
|
4
|
+
"sourcesContent": ["import { KeyUsage } from \"@/pki/model/KeyUsage\";\n\nexport class KeyUsageMapper {\n private static keyUsageMap = new Map<KeyUsage, number>([\n [KeyUsage.GenuineCheck, 1],\n [KeyUsage.ExchangePayload, 2],\n [KeyUsage.NftMeta, 3],\n [KeyUsage.TrustedName, 4],\n [KeyUsage.BackupProvider, 5],\n [KeyUsage.ProtectOrchestrator, 6],\n [KeyUsage.PluginMeta, 7],\n [KeyUsage.CoinMeta, 8],\n [KeyUsage.SeedIdAuth, 9],\n [KeyUsage.TxSimulationSigner, 10],\n [KeyUsage.Calldata, 11],\n [KeyUsage.Network, 12],\n ]);\n\n static mapKeyUsageForFirmware(keyUsage: KeyUsage): number {\n return this.keyUsageMap.get(keyUsage as KeyUsage) ?? -1;\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,MAAgB,uBAElB,MAAMC,CAAe,CAC1B,OAAe,YAAc,IAAI,IAAsB,CACrD,CAACD,EAAS,aAAc,CAAC,EACzB,CAACA,EAAS,gBAAiB,CAAC,EAC5B,CAACA,EAAS,QAAS,CAAC,EACpB,CAACA,EAAS,YAAa,CAAC,EACxB,CAACA,EAAS,eAAgB,CAAC,EAC3B,CAACA,EAAS,oBAAqB,CAAC,EAChC,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,SAAU,CAAC,EACrB,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,mBAAoB,EAAE,EAChC,CAACA,EAAS,SAAU,EAAE,EACtB,CAACA,EAAS,QAAS,EAAE,CACvB,CAAC,EAED,OAAO,uBAAuBE,EAA4B,CACxD,OAAO,KAAK,YAAY,IAAIA,CAAoB,GAAK,EACvD,CACF",
|
|
6
|
+
"names": ["KeyUsage", "KeyUsageMapper", "keyUsage"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{KeyUsage as e}from"../../pki/model/KeyUsage";import{KeyUsageMapper as r}from"../../shared/utils/KeyUsageMapper";describe("KeyUsageMapper",()=>{describe("mapKeyUsageForFirmware",()=>{it.each([[e.GenuineCheck,1],[e.ExchangePayload,2],[e.NftMeta,3],[e.TrustedName,4],[e.BackupProvider,5],[e.ProtectOrchestrator,6],[e.PluginMeta,7],[e.CoinMeta,8],[e.SeedIdAuth,9],[e.TxSimulationSigner,10],[e.Calldata,11],[e.Network,12]])("should map key usage %s to %i",(a,t)=>{const o=r.mapKeyUsageForFirmware(a);expect(o).toEqual(t)}),it("should return -1 when key usage is not found",()=>{const a=r.mapKeyUsageForFirmware("unknown");expect(a).toEqual(-1)})})});
|
|
2
|
+
//# sourceMappingURL=KeyUsageMapper.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/shared/utils/KeyUsageMapper.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { KeyUsage } from \"@/pki/model/KeyUsage\";\nimport { KeyUsageMapper } from \"@/shared/utils/KeyUsageMapper\";\n\ndescribe(\"KeyUsageMapper\", () => {\n describe(\"mapKeyUsageForFirmware\", () => {\n it.each([\n [KeyUsage.GenuineCheck, 1],\n [KeyUsage.ExchangePayload, 2],\n [KeyUsage.NftMeta, 3],\n [KeyUsage.TrustedName, 4],\n [KeyUsage.BackupProvider, 5],\n [KeyUsage.ProtectOrchestrator, 6],\n [KeyUsage.PluginMeta, 7],\n [KeyUsage.CoinMeta, 8],\n [KeyUsage.SeedIdAuth, 9],\n [KeyUsage.TxSimulationSigner, 10],\n [KeyUsage.Calldata, 11],\n [KeyUsage.Network, 12],\n ])(`should map key usage %s to %i`, (keyUsage, expected) => {\n // WHEN\n const result = KeyUsageMapper.mapKeyUsageForFirmware(keyUsage);\n\n // THEN\n expect(result).toEqual(expected);\n });\n\n it(\"should return -1 when key usage is not found\", () => {\n // WHEN\n const result = KeyUsageMapper.mapKeyUsageForFirmware(\n \"unknown\" as KeyUsage,\n );\n\n // THEN\n expect(result).toEqual(-1);\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,MAAgB,uBACzB,OAAS,kBAAAC,MAAsB,gCAE/B,SAAS,iBAAkB,IAAM,CAC/B,SAAS,yBAA0B,IAAM,CACvC,GAAG,KAAK,CACN,CAACD,EAAS,aAAc,CAAC,EACzB,CAACA,EAAS,gBAAiB,CAAC,EAC5B,CAACA,EAAS,QAAS,CAAC,EACpB,CAACA,EAAS,YAAa,CAAC,EACxB,CAACA,EAAS,eAAgB,CAAC,EAC3B,CAACA,EAAS,oBAAqB,CAAC,EAChC,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,SAAU,CAAC,EACrB,CAACA,EAAS,WAAY,CAAC,EACvB,CAACA,EAAS,mBAAoB,EAAE,EAChC,CAACA,EAAS,SAAU,EAAE,EACtB,CAACA,EAAS,QAAS,EAAE,CACvB,CAAC,EAAE,gCAAiC,CAACE,EAAUC,IAAa,CAE1D,MAAMC,EAASH,EAAe,uBAAuBC,CAAQ,EAG7D,OAAOE,CAAM,EAAE,QAAQD,CAAQ,CACjC,CAAC,EAED,GAAG,+CAAgD,IAAM,CAEvD,MAAMC,EAASH,EAAe,uBAC5B,SACF,EAGA,OAAOG,CAAM,EAAE,QAAQ,EAAE,CAC3B,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["KeyUsage", "KeyUsageMapper", "keyUsage", "expected", "result"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"axios";import{Left as n}from"purify-ts";import{HttpTokenDataSource as r}from"../../token/data/HttpTokenDataSource";import s from"../../../package.json";
|
|
1
|
+
import o from"axios";import{Left as n}from"purify-ts";import{HttpTokenDataSource as r}from"../../token/data/HttpTokenDataSource";import s from"../../../package.json";vi.mock("axios");describe("HttpTokenDataSource",()=>{let t;beforeAll(()=>{const e={cal:{url:"https://crypto-assets-service.api.ledger.com/v1",mode:"prod",branch:"main"}};t=new r(e),vi.clearAllMocks()}),it("should call axios with the ledger client version header",async()=>{const e=`context-module/${s.version}`,a=vi.fn(()=>Promise.resolve({data:[]}));vi.spyOn(o,"request").mockImplementation(a),await t.getTokenInfosPayload({address:"0x00",chainId:1}),expect(a).toHaveBeenCalledWith(expect.objectContaining({headers:{"X-Ledger-Client-Version":e}}))}),it("should return a string when axios response is correct",async()=>{const e={ticker:"USDC",descriptor:{data:"55534443000000000800000001",signatures:{prod:"0123"}}};vi.spyOn(o,"request").mockResolvedValue({data:[e]});const a=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(a.extract()).toEqual("04555344430000000008000000010123")}),it("should return an error when data is empty",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:void 0});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no signature",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:[{}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no ticker",async()=>{const e={ticker:"USDC",descriptor:{data:"55534443000000000800000001",signatures:{test:"0123"}}};vi.spyOn(o,"request").mockResolvedValue({data:[e]});const a=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(a).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return undefined when no decimals",async()=>{vi.spyOn(o,"request").mockResolvedValue({data:[{live_signature:"0x0",ticker:"USDC"}]});const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1")))}),it("should return an error when axios throws an error",async()=>{vi.spyOn(o,"request").mockRejectedValue(new Error);const e=await t.getTokenInfosPayload({address:"0x00",chainId:1});expect(e).toEqual(n(new Error("[ContextModule] HttpTokenDataSource: Failed to fetch token informations")))})});
|
|
2
2
|
//# sourceMappingURL=HttpTokenDataSource.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/token/data/HttpTokenDataSource.test.ts"],
|
|
4
|
-
"sourcesContent": ["import axios from \"axios\";\nimport { Left } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type TokenDto } from \"@/token/data/TokenDto\";\nimport PACKAGE from \"@root/package.json\";\n\
|
|
5
|
-
"mappings": "AAAA,OAAOA,MAAW,QAClB,OAAS,QAAAC,MAAY,YAGrB,OAAS,uBAAAC,MAA2B,mCAGpC,OAAOC,MAAa,qBAEpB,
|
|
4
|
+
"sourcesContent": ["import axios from \"axios\";\nimport { Left } from \"purify-ts\";\n\nimport { type ContextModuleConfig } from \"@/config/model/ContextModuleConfig\";\nimport { HttpTokenDataSource } from \"@/token/data/HttpTokenDataSource\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { type TokenDto } from \"@/token/data/TokenDto\";\nimport PACKAGE from \"@root/package.json\";\n\nvi.mock(\"axios\");\n\ndescribe(\"HttpTokenDataSource\", () => {\n let datasource: TokenDataSource;\n\n beforeAll(() => {\n const config = {\n cal: {\n url: \"https://crypto-assets-service.api.ledger.com/v1\",\n mode: \"prod\",\n branch: \"main\",\n },\n } as ContextModuleConfig;\n datasource = new HttpTokenDataSource(config);\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.getTokenInfosPayload({ address: \"0x00\", chainId: 1 });\n\n // THEN\n expect(requestSpy).toHaveBeenCalledWith(\n expect.objectContaining({\n headers: { \"X-Ledger-Client-Version\": version },\n }),\n );\n });\n\n it(\"should return a string when axios response is correct\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"55534443000000000800000001\",\n signatures: {\n prod: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result.extract()).toEqual(\"04555344430000000008000000010123\");\n });\n\n it(\"should return an error when data is empty\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: undefined });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no signature\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [{}] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no ticker\", async () => {\n // GIVEN\n const tokenDTO: TokenDto = {\n ticker: \"USDC\",\n descriptor: {\n data: \"55534443000000000800000001\",\n signatures: {\n test: \"0123\",\n },\n },\n };\n vi.spyOn(axios, \"request\").mockResolvedValue({ data: [tokenDTO] });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return undefined when no decimals\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockResolvedValue({\n data: [{ live_signature: \"0x0\", ticker: \"USDC\" }],\n });\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: no token metadata for address 0x00 on chain 1\",\n ),\n ),\n );\n });\n\n it(\"should return an error when axios throws an error\", async () => {\n // GIVEN\n vi.spyOn(axios, \"request\").mockRejectedValue(new Error());\n\n // WHEN\n const result = await datasource.getTokenInfosPayload({\n address: \"0x00\",\n chainId: 1,\n });\n\n // THEN\n expect(result).toEqual(\n Left(\n new Error(\n \"[ContextModule] HttpTokenDataSource: Failed to fetch token informations\",\n ),\n ),\n );\n });\n});\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["axios", "Left", "HttpTokenDataSource", "PACKAGE", "datasource", "config", "version", "requestSpy", "tokenDTO", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Left as r,Right as s}from"purify-ts";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";import{TokenContextLoader as c}from"../../token/domain/TokenContextLoader";describe("TokenContextLoader",()=>{const n={getTokenInfosPayload:
|
|
1
|
+
import{Left as r,Right as s}from"purify-ts";import{ClearSignContextType as o}from"../../shared/model/ClearSignContext";import{TokenContextLoader as c}from"../../token/domain/TokenContextLoader";describe("TokenContextLoader",()=>{const n={getTokenInfosPayload:vi.fn()},e=new c(n);beforeEach(()=>{vi.restoreAllMocks(),vi.spyOn(n,"getTokenInfosPayload").mockImplementation(({address:t})=>Promise.resolve(s(`payload-${t}`)))}),describe("load function",()=>{it("should return an empty array if transaction dest is undefined",async()=>{const t={to:void 0,data:"0x01"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if transaction data is undefined",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:void 0},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if transaction data is empty",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x"},a=await e.load(t);expect(a).toEqual([])}),it("should return an empty array if the selector is 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.ERROR,error:new Error("Invalid selector")}])}),it("should return an error when datasource returns an error",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000",chainId:1};vi.spyOn(n,"getTokenInfosPayload").mockResolvedValue(r(new Error("error")));const a=await e.load(t);expect(a).toEqual([{type:o.ERROR,error:new Error("error")}])}),it("should return a correct response",async()=>{const t={to:"0xdAC17F958D2ee523a2206206994597C13D831ec7",data:"0x095ea7b30000000000",chainId:1},a=await e.load(t);expect(a).toEqual([{type:o.TOKEN,payload:"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7"}])})}),describe("loadField function",()=>{it("should return an error when field type if not supported",async()=>{const t={type:o.NFT,chainId:7,address:"0x1234"},a=await e.loadField(t);expect(a).toEqual(null)}),it("should return a payload",async()=>{const t={type:o.TOKEN,chainId:7,address:"0x1234"};vi.spyOn(n,"getTokenInfosPayload").mockResolvedValue(s("payload"));const a=await e.loadField(t);expect(a).toEqual({type:o.TOKEN,payload:"payload"})}),it("should return an error when unable to fetch the datasource",async()=>{const t={type:o.TOKEN,chainId:7,address:"0x1234"};vi.spyOn(n,"getTokenInfosPayload").mockResolvedValue(r(new Error("error")));const a=await e.loadField(t);expect(a).toEqual({type:o.ERROR,error:new Error("error")})})})});
|
|
2
2
|
//# sourceMappingURL=TokenContextLoader.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/token/domain/TokenContextLoader.test.ts"],
|
|
4
|
-
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextLoader } from \"@/token/domain/TokenContextLoader\";\n\ndescribe(\"TokenContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload:
|
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,EAAM,SAAAC,MAAa,YAE5B,OAAS,wBAAAC,MAA4B,kCAMrC,OAAS,sBAAAC,MAA0B,oCAEnC,SAAS,qBAAsB,IAAM,CACnC,MAAMC,EAAuC,CAC3C,qBAAsB,
|
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { ClearSignContextType } from \"@/shared/model/ClearSignContext\";\nimport {\n type TransactionContext,\n type TransactionFieldContext,\n} from \"@/shared/model/TransactionContext\";\nimport { type TokenDataSource } from \"@/token/data/TokenDataSource\";\nimport { TokenContextLoader } from \"@/token/domain/TokenContextLoader\";\n\ndescribe(\"TokenContextLoader\", () => {\n const mockTokenDataSource: TokenDataSource = {\n getTokenInfosPayload: vi.fn(),\n };\n const loader = new TokenContextLoader(mockTokenDataSource);\n\n beforeEach(() => {\n vi.restoreAllMocks();\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockImplementation(\n ({ address }) => Promise.resolve(Right(`payload-${address}`)),\n );\n });\n\n describe(\"load function\", () => {\n it(\"should return an empty array if transaction dest is undefined\", async () => {\n // GIVEN\n const transaction = { to: undefined, data: \"0x01\" } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if transaction data is undefined\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: undefined,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if transaction data is empty\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x\",\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an empty array if the selector is not supported\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b20000000000000\",\n } as unknown as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([]);\n });\n\n it(\"should return an error when transaction data is not a valid hex string\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"notahexstring\",\n } as unknown as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\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 returns an error\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000\",\n chainId: 1,\n } as TransactionContext;\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n { type: ClearSignContextType.ERROR, error: new Error(\"error\") },\n ]);\n });\n\n it(\"should return a correct response\", async () => {\n // GIVEN\n const transaction = {\n to: \"0xdAC17F958D2ee523a2206206994597C13D831ec7\",\n data: \"0x095ea7b30000000000\",\n chainId: 1,\n } as TransactionContext;\n\n // WHEN\n const result = await loader.load(transaction);\n\n // THEN\n expect(result).toEqual([\n {\n type: ClearSignContextType.TOKEN,\n payload: \"payload-0xdAC17F958D2ee523a2206206994597C13D831ec7\",\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.NFT,\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.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Right(\"payload\"),\n );\n const result = await loader.loadField(field);\n\n // THEN\n expect(result).toEqual({\n type: ClearSignContextType.TOKEN,\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.TOKEN,\n chainId: 7,\n address: \"0x1234\",\n };\n\n // WHEN\n vi.spyOn(mockTokenDataSource, \"getTokenInfosPayload\").mockResolvedValue(\n Left(new Error(\"error\")),\n );\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": "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",
|
|
6
6
|
"names": ["Left", "Right", "ClearSignContextType", "TokenContextLoader", "mockTokenDataSource", "loader", "address", "transaction", "result", "field"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var d=(l,e,t,r)=>{for(var o=r>1?void 0:r?S(e,t):e,n=l.length-1,i;n>=0;n--)(i=l[n])&&(o=(r?i(e,t,o):i(o))||o);return r&&o&&_(e,t,o),o},f=(l,e)=>(t,r)=>e(t,r,l);import M from"axios";import{inject as m,injectable as I}from"inversify";import{Left as c,Right as x}from"purify-ts";import{configTypes as R}from"../../config/di/configTypes";import{pkiTypes as O}from"../../pki/di/pkiTypes";import{KeyId as F}from"../../pki/model/KeyId";import{KeyUsage as U}from"../../pki/model/KeyUsage";import{ClearSignContextType as a}from"../../shared/model/ClearSignContext";import{INFO_SIGNATURE_TAG as h}from"../../shared/model/SignatureTags";import{HexStringUtils as T}from"../../shared/utils/HexStringUtils";import k from"../../../package.json";let y=class{constructor(e,t){this.config=e;this._certificateLoader=t}async getTransactionDescriptors({chainId:e,address:t,selector:r,deviceModelId:o}){let n;try{n=(await M.request({method:"GET",url:`${this.config.cal.url}/dapps`,params:{output:"descriptors_calldata",chain_id:e,contracts:t,ref:`branch:${this.config.cal.branch}`},headers:{"X-Ledger-Client-Version":`context-module/${k.version}`}})).data}catch(i){return c(new Error(`[ContextModule] HttpTransactionDataSource: Failed to fetch transaction informations: ${i}`))}if(!Array.isArray(n))return c(new Error("[ContextModule] HttpTransactionDataSource: Response is not an array"));if(n.length===0)return c(new Error(`[ContextModule] HttpTransactionDataSource: No data for contract ${t} and selector ${r}`));for(const i of n){t=t.toLowerCase(),r=`0x${r.slice(2).toLowerCase()}`;const s=i.descriptors_calldata?.[t]?.[r];if(!s||!this.isCalldataDescriptorV1(s,this.config.cal.mode))continue;const g=s.transaction_info.descriptor.data,E=s.transaction_info.descriptor.signatures[this.config.cal.mode],D={targetDevice:o,keyUsage:U.Calldata,keyId:F.CalCalldataKey},u=await this._certificateLoader.loadCertificate(D),V={type:a.TRANSACTION_INFO,payload:T.appendSignatureToPayload(g,E,h),certificate:u},C=[];for(const[p,b]of Object.entries(s.enums))for(const[v,{data:N,signatures:P}]of Object.entries(b))C.push({type:a.ENUM,id:Number(p),value:Number(v),payload:T.appendSignatureToPayload(N,P[this.config.cal.mode],h),certificate:u});const A=s.fields.map(p=>({type:a.TRANSACTION_FIELD_DESCRIPTION,payload:p.descriptor,reference:this.getReference(p.param)}));return x([V,...C,...A])}return c(new Error(`[ContextModule] HttpTransactionDataSource: Invalid response for contract ${t} and selector ${r}`))}getReference(e){if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="path")return{type:a.TOKEN,valuePath:this.toGenericPath(e.token.binary_path)};if(e.type==="TOKEN_AMOUNT"&&e.token!==void 0&&e.token.type==="constant")return{type:a.TOKEN,value:e.token.value};if(e.type==="NFT"&&e.collection.type==="path")return{type:a.NFT,valuePath:this.toGenericPath(e.collection.binary_path)};if(e.type==="NFT"&&e.collection.type==="constant")return{type:a.NFT,value:e.collection.value};if(e.type==="TRUSTED_NAME"&&e.value.type==="path")return{type:a.TRUSTED_NAME,valuePath:this.toGenericPath(e.value.binary_path),types:e.types,sources:e.sources};if(e.type==="ENUM"&&e.value.type==="path")return{type:a.ENUM,valuePath:this.toGenericPath(e.value.binary_path),id:e.id}}toGenericPath(e){return e.type==="CONTAINER"?e.value:e.elements.map(t=>{if(t.type==="ARRAY"){const{weight:r,...o}=t;return{itemSize:r,...o}}else if(t.type==="LEAF"){const{leaf_type:r,...o}=t;return{leafType:r,...o}}return t})}isCalldataDescriptorV1(e,t){return typeof e=="object"&&e.type==="calldata"&&e.version==="v1"&&this.isTransactionInfoV1(e.transaction_info,t)&&this.isEnumV1(e.enums,t)&&Array.isArray(e.fields)&&e.fields.every(r=>this.isFieldV1(r))}isTransactionInfoV1(e,t){return typeof e=="object"&&typeof e.descriptor=="object"&&typeof e.descriptor.data=="string"&&typeof e.descriptor.signatures=="object"&&typeof e.descriptor.signatures[t]=="string"}isEnumV1(e,t){return typeof e=="object"&&Object.entries(e).every(([r,o])=>typeof r=="string"&&typeof o=="object"&&Object.entries(o).every(([n,i])=>typeof n=="string"&&typeof i=="object"&&typeof i.data=="string"&&i.signatures!==void 0&&this.isCalldataSignatures(i.signatures,t)))}isCalldataSignatures(e,t){return typeof e=="object"&&typeof e[t]=="string"}isFieldV1(e){return typeof e=="object"&&typeof e.descriptor=="string"&&typeof e.param=="object"&&typeof e.param.value=="object"&&this.isDescriptorValueV1(e.param.value)&&(e.param.type==="RAW"||e.param.type==="AMOUNT"||e.param.type==="DATETIME"||e.param.type==="DURATION"||e.param.type==="UNIT"||e.param.type==="ENUM"||e.param.type==="NFT"&&this.isDescriptorValueV1(e.param.collection)||e.param.type==="TOKEN_AMOUNT"&&(e.param.token===void 0||this.isDescriptorValueV1(e.param.token))||e.param.type==="TRUSTED_NAME"&&Array.isArray(e.param.types)&&Array.isArray(e.param.sources)&&e.param.types.every(t=>typeof t=="string")&&e.param.sources.every(t=>typeof t=="string"))}isDescriptorValueV1(e){return typeof e=="object"&&typeof e.type_family=="string"&&["UINT","INT","UFIXED","FIXED","ADDRESS","BOOL","BYTES","STRING"].includes(e.type_family)&&(typeof e.type_size>"u"||typeof e.type_size=="number")&&(e.type==="path"&&this.isCalldataDescriptorValueBinaryPathV1(e)||e.type==="constant"&&this.isCalldataDescriptorValueConstantV1(e))}isCalldataDescriptorValueConstantV1(e){return typeof e=="object"&&e.type==="constant"&&typeof e.value=="string"}isCalldataDescriptorValueBinaryPathV1(e){return typeof e=="object"&&(e.type==="path"&&e.binary_path.type==="CONTAINER"&&["FROM","TO","VALUE"].includes(e.binary_path.value)||e.binary_path.type==="DATA"&&Array.isArray(e.binary_path.elements)&&e.binary_path.elements.every(t=>this.isPathElementV1(t)))}isPathElementV1(e){return typeof e=="object"&&(e.type==="REF"||e.type==="TUPLE"&&typeof e.offset=="number"||e.type==="ARRAY"&&typeof e.weight=="number"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number")||e.type==="LEAF"&&typeof e.leaf_type=="string"&&["ARRAY_LEAF","TUPLE_LEAF","STATIC_LEAF","DYNAMIC_LEAF"].includes(e.leaf_type)||e.type==="SLICE"&&(typeof e.start>"u"||typeof e.start=="number")&&(typeof e.end>"u"||typeof e.end=="number"))}};y=d([I(),f(0,m(R.Config)),f(1,m(O.PkiCertificateLoader))],y);export{y as HttpTransactionDataSource};
|
|
2
2
|
//# sourceMappingURL=HttpTransactionDataSource.js.map
|