@ledgerhq/device-trusted-app-kit-ledger-keyring-protocol 0.0.0-develop-20250808001323
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.MD +202 -0
- package/README.md +32 -0
- package/lib/cjs/api/LedgerKeyringProtocol.js +2 -0
- package/lib/cjs/api/LedgerKeyringProtocol.js.map +7 -0
- package/lib/cjs/api/LedgerKeyringProtocolBuilder.js +2 -0
- package/lib/cjs/api/LedgerKeyringProtocolBuilder.js.map +7 -0
- package/lib/cjs/api/app-binder/AddToTrustchainDeviceActionTypes.js +2 -0
- package/lib/cjs/api/app-binder/AddToTrustchainDeviceActionTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/AuthenticateDeviceActionTypes.js +2 -0
- package/lib/cjs/api/app-binder/AuthenticateDeviceActionTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/Errors.js +2 -0
- package/lib/cjs/api/app-binder/Errors.js.map +7 -0
- package/lib/cjs/api/app-binder/GetAppNameCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/GetAppNameCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/GetSeedIdCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/GetSeedIdCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/GetVersionCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/GetVersionCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/GetVersionDeviceActionTypes.js +2 -0
- package/lib/cjs/api/app-binder/GetVersionDeviceActionTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/InitCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/InitCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/KeypairFromBytes.js +2 -0
- package/lib/cjs/api/app-binder/KeypairFromBytes.js.map +7 -0
- package/lib/cjs/api/app-binder/LKRPTypes.js +2 -0
- package/lib/cjs/api/app-binder/LKRPTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/ParseStreamBlockCommandCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/ParseStreamBlockCommandCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/ParseStreamBlockHeaderCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/ParseStreamBlockHeaderCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/ParseStreamBlockSignatureTypes.js +2 -0
- package/lib/cjs/api/app-binder/ParseStreamBlockSignatureTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/SetTrustedMemberTypes.js +2 -0
- package/lib/cjs/api/app-binder/SetTrustedMemberTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/SignBlockCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/SignBlockCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/SignBlockHeaderCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/SignBlockHeaderCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/SignBlockSignatureCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/SignBlockSignatureCommandTypes.js.map +7 -0
- package/lib/cjs/api/app-binder/SignBlockSingleCommandTypes.js +2 -0
- package/lib/cjs/api/app-binder/SignBlockSingleCommandTypes.js.map +7 -0
- package/lib/cjs/api/index.js +2 -0
- package/lib/cjs/api/index.js.map +7 -0
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/index.js.map +7 -0
- package/lib/cjs/internal/DefaultLedgerKeyringProtocol.js +2 -0
- package/lib/cjs/internal/DefaultLedgerKeyringProtocol.js.map +7 -0
- package/lib/cjs/internal/app-binder/LedgerKeyringProtocolBinder.js +2 -0
- package/lib/cjs/internal/app-binder/LedgerKeyringProtocolBinder.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetAppNameCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/GetAppNameCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.test.js +27 -0
- package/lib/cjs/internal/app-binder/command/GetSeedIdCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/GetVersionCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/GetVersionCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/InitCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/InitCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/InitCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/InitCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/ParseBlockSignatureCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockHeader.js +2 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockHeader.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockHeader.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/ParseStreamBlockHeader.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SetTrustedMemberCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/SetTrustedMemberCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SetTrustedMemberCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/SetTrustedMemberCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignBlockHeader.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignBlockHeader.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignBlockHeader.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignBlockHeader.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSignatureCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.test.js +2 -0
- package/lib/cjs/internal/app-binder/command/SignBlockSingleCommand.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/utils/extractTrustedProperty.js +2 -0
- package/lib/cjs/internal/app-binder/command/utils/extractTrustedProperty.js.map +7 -0
- package/lib/cjs/internal/app-binder/command/utils/ledgerKeyringProtocolErrors.js +2 -0
- package/lib/cjs/internal/app-binder/command/utils/ledgerKeyringProtocolErrors.js.map +7 -0
- package/lib/cjs/internal/app-binder/device-action/AddToTrustchainDeviceAction.js +2 -0
- package/lib/cjs/internal/app-binder/device-action/AddToTrustchainDeviceAction.js.map +7 -0
- package/lib/cjs/internal/app-binder/device-action/AuthenticateDeviceAction.js +2 -0
- package/lib/cjs/internal/app-binder/device-action/AuthenticateDeviceAction.js.map +7 -0
- package/lib/cjs/internal/app-binder/device-action/utils/raiseAndAssign.js +2 -0
- package/lib/cjs/internal/app-binder/device-action/utils/raiseAndAssign.js.map +7 -0
- package/lib/cjs/internal/app-binder/di/appBinderModule.js +2 -0
- package/lib/cjs/internal/app-binder/di/appBinderModule.js.map +7 -0
- package/lib/cjs/internal/app-binder/di/appBinderTypes.js +2 -0
- package/lib/cjs/internal/app-binder/di/appBinderTypes.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/InitTask.js +2 -0
- package/lib/cjs/internal/app-binder/task/InitTask.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/ParseStreamToDeviceTask.js +2 -0
- package/lib/cjs/internal/app-binder/task/ParseStreamToDeviceTask.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignBlockTask.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignBlockTask.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignChallengeWithDeviceTask.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignChallengeWithDeviceTask.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.test.js +2 -0
- package/lib/cjs/internal/app-binder/task/SignChallengeWithKeypairTask.test.js.map +7 -0
- package/lib/cjs/internal/app-binder/task/utils/TrustedProperties.js +2 -0
- package/lib/cjs/internal/app-binder/task/utils/TrustedProperties.js.map +7 -0
- package/lib/cjs/internal/di.js +2 -0
- package/lib/cjs/internal/di.js.map +7 -0
- package/lib/cjs/internal/externalTypes.js +2 -0
- package/lib/cjs/internal/externalTypes.js.map +7 -0
- package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.js +2 -0
- package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.js.map +7 -0
- package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js +2 -0
- package/lib/cjs/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js.map +7 -0
- package/lib/cjs/internal/lkrp-datasource/data/LKRPDataSource.js +2 -0
- package/lib/cjs/internal/lkrp-datasource/data/LKRPDataSource.js.map +7 -0
- package/lib/cjs/internal/lkrp-datasource/di/lkrpDatasourceModuleFactory.js +2 -0
- package/lib/cjs/internal/lkrp-datasource/di/lkrpDatasourceModuleFactory.js.map +7 -0
- package/lib/cjs/internal/lkrp-datasource/di/lkrpDatasourceTypes.js +2 -0
- package/lib/cjs/internal/lkrp-datasource/di/lkrpDatasourceTypes.js.map +7 -0
- package/lib/cjs/internal/use-cases/authentication/AuthenticateUseCase.js +2 -0
- package/lib/cjs/internal/use-cases/authentication/AuthenticateUseCase.js.map +7 -0
- package/lib/cjs/internal/use-cases/di/useCasesModule.js +2 -0
- package/lib/cjs/internal/use-cases/di/useCasesModule.js.map +7 -0
- package/lib/cjs/internal/use-cases/di/useCasesTypes.js +2 -0
- package/lib/cjs/internal/use-cases/di/useCasesTypes.js.map +7 -0
- package/lib/cjs/internal/utils/LKRPBlock.js +5 -0
- package/lib/cjs/internal/utils/LKRPBlock.js.map +7 -0
- package/lib/cjs/internal/utils/LKRPBlock.test.js +24 -0
- package/lib/cjs/internal/utils/LKRPBlock.test.js.map +7 -0
- package/lib/cjs/internal/utils/LKRPBlockStream.js +4 -0
- package/lib/cjs/internal/utils/LKRPBlockStream.js.map +7 -0
- package/lib/cjs/internal/utils/LKRPBlockStream.test.js +39 -0
- package/lib/cjs/internal/utils/LKRPBlockStream.test.js.map +7 -0
- package/lib/cjs/internal/utils/LKRPCommand.js +3 -0
- package/lib/cjs/internal/utils/LKRPCommand.js.map +7 -0
- package/lib/cjs/internal/utils/LKRPCommand.test.js +3 -0
- package/lib/cjs/internal/utils/LKRPCommand.test.js.map +7 -0
- package/lib/cjs/internal/utils/TLVBuilder.js +2 -0
- package/lib/cjs/internal/utils/TLVBuilder.js.map +7 -0
- package/lib/cjs/internal/utils/TLVParser.js +2 -0
- package/lib/cjs/internal/utils/TLVParser.js.map +7 -0
- package/lib/cjs/internal/utils/TLVParser.test.js +2 -0
- package/lib/cjs/internal/utils/TLVParser.test.js.map +7 -0
- package/lib/cjs/internal/utils/TLVTags.js +2 -0
- package/lib/cjs/internal/utils/TLVTags.js.map +7 -0
- package/lib/cjs/internal/utils/crypto.js +2 -0
- package/lib/cjs/internal/utils/crypto.js.map +7 -0
- package/lib/cjs/internal/utils/derivationPath.js +2 -0
- package/lib/cjs/internal/utils/derivationPath.js.map +7 -0
- package/lib/cjs/internal/utils/eitherSeqRecord.js +2 -0
- package/lib/cjs/internal/utils/eitherSeqRecord.js.map +7 -0
- package/lib/cjs/internal/utils/hex.js +2 -0
- package/lib/cjs/internal/utils/hex.js.map +7 -0
- package/lib/cjs/internal/utils/required.js +2 -0
- package/lib/cjs/internal/utils/required.js.map +7 -0
- package/lib/cjs/internal/utils/types.js +2 -0
- package/lib/cjs/internal/utils/types.js.map +7 -0
- package/lib/cjs/package.json +55 -0
- package/lib/esm/api/LedgerKeyringProtocol.js +1 -0
- package/lib/esm/api/LedgerKeyringProtocol.js.map +7 -0
- package/lib/esm/api/LedgerKeyringProtocolBuilder.js +2 -0
- package/lib/esm/api/LedgerKeyringProtocolBuilder.js.map +7 -0
- package/lib/esm/api/app-binder/AddToTrustchainDeviceActionTypes.js +1 -0
- package/lib/esm/api/app-binder/AddToTrustchainDeviceActionTypes.js.map +7 -0
- package/lib/esm/api/app-binder/AuthenticateDeviceActionTypes.js +1 -0
- package/lib/esm/api/app-binder/AuthenticateDeviceActionTypes.js.map +7 -0
- package/lib/esm/api/app-binder/Errors.js +2 -0
- package/lib/esm/api/app-binder/Errors.js.map +7 -0
- package/lib/esm/api/app-binder/GetAppNameCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/GetAppNameCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/GetSeedIdCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/GetSeedIdCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/GetVersionCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/GetVersionCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/GetVersionDeviceActionTypes.js +1 -0
- package/lib/esm/api/app-binder/GetVersionDeviceActionTypes.js.map +7 -0
- package/lib/esm/api/app-binder/InitCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/InitCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/KeypairFromBytes.js +2 -0
- package/lib/esm/api/app-binder/KeypairFromBytes.js.map +7 -0
- package/lib/esm/api/app-binder/LKRPTypes.js +2 -0
- package/lib/esm/api/app-binder/LKRPTypes.js.map +7 -0
- package/lib/esm/api/app-binder/ParseStreamBlockCommandCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/ParseStreamBlockCommandCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/ParseStreamBlockHeaderCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/ParseStreamBlockHeaderCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/ParseStreamBlockSignatureTypes.js +1 -0
- package/lib/esm/api/app-binder/ParseStreamBlockSignatureTypes.js.map +7 -0
- package/lib/esm/api/app-binder/SetTrustedMemberTypes.js +1 -0
- package/lib/esm/api/app-binder/SetTrustedMemberTypes.js.map +7 -0
- package/lib/esm/api/app-binder/SignBlockCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/SignBlockCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/SignBlockHeaderCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/SignBlockHeaderCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/SignBlockSignatureCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/SignBlockSignatureCommandTypes.js.map +7 -0
- package/lib/esm/api/app-binder/SignBlockSingleCommandTypes.js +1 -0
- package/lib/esm/api/app-binder/SignBlockSingleCommandTypes.js.map +7 -0
- package/lib/esm/api/index.js +2 -0
- package/lib/esm/api/index.js.map +7 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +7 -0
- package/lib/esm/internal/DefaultLedgerKeyringProtocol.js +2 -0
- package/lib/esm/internal/DefaultLedgerKeyringProtocol.js.map +7 -0
- package/lib/esm/internal/app-binder/LedgerKeyringProtocolBinder.js +2 -0
- package/lib/esm/internal/app-binder/LedgerKeyringProtocolBinder.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetAppNameCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/GetAppNameCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetSeedIdCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/GetSeedIdCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetSeedIdCommand.test.js +27 -0
- package/lib/esm/internal/app-binder/command/GetSeedIdCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/GetVersionCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/GetVersionCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/InitCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/InitCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/InitCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/InitCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/ParseBlockSignatureCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockHeader.js +2 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockHeader.js.map +7 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockHeader.test.js +2 -0
- package/lib/esm/internal/app-binder/command/ParseStreamBlockHeader.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/SetTrustedMemberCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignBlockHeader.js +2 -0
- package/lib/esm/internal/app-binder/command/SignBlockHeader.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignBlockHeader.test.js +2 -0
- package/lib/esm/internal/app-binder/command/SignBlockHeader.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/SignBlockSignatureCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.js +2 -0
- package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.js.map +7 -0
- package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.test.js +2 -0
- package/lib/esm/internal/app-binder/command/SignBlockSingleCommand.test.js.map +7 -0
- package/lib/esm/internal/app-binder/command/utils/extractTrustedProperty.js +2 -0
- package/lib/esm/internal/app-binder/command/utils/extractTrustedProperty.js.map +7 -0
- package/lib/esm/internal/app-binder/command/utils/ledgerKeyringProtocolErrors.js +2 -0
- package/lib/esm/internal/app-binder/command/utils/ledgerKeyringProtocolErrors.js.map +7 -0
- package/lib/esm/internal/app-binder/device-action/AddToTrustchainDeviceAction.js +2 -0
- package/lib/esm/internal/app-binder/device-action/AddToTrustchainDeviceAction.js.map +7 -0
- package/lib/esm/internal/app-binder/device-action/AuthenticateDeviceAction.js +2 -0
- package/lib/esm/internal/app-binder/device-action/AuthenticateDeviceAction.js.map +7 -0
- package/lib/esm/internal/app-binder/device-action/utils/raiseAndAssign.js +2 -0
- package/lib/esm/internal/app-binder/device-action/utils/raiseAndAssign.js.map +7 -0
- package/lib/esm/internal/app-binder/di/appBinderModule.js +2 -0
- package/lib/esm/internal/app-binder/di/appBinderModule.js.map +7 -0
- package/lib/esm/internal/app-binder/di/appBinderTypes.js +2 -0
- package/lib/esm/internal/app-binder/di/appBinderTypes.js.map +7 -0
- package/lib/esm/internal/app-binder/task/InitTask.js +2 -0
- package/lib/esm/internal/app-binder/task/InitTask.js.map +7 -0
- package/lib/esm/internal/app-binder/task/ParseStreamToDeviceTask.js +2 -0
- package/lib/esm/internal/app-binder/task/ParseStreamToDeviceTask.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignBlockTask.js +2 -0
- package/lib/esm/internal/app-binder/task/SignBlockTask.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignChallengeWithDeviceTask.js +2 -0
- package/lib/esm/internal/app-binder/task/SignChallengeWithDeviceTask.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.js +2 -0
- package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.js.map +7 -0
- package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.test.js +2 -0
- package/lib/esm/internal/app-binder/task/SignChallengeWithKeypairTask.test.js.map +7 -0
- package/lib/esm/internal/app-binder/task/utils/TrustedProperties.js +2 -0
- package/lib/esm/internal/app-binder/task/utils/TrustedProperties.js.map +7 -0
- package/lib/esm/internal/di.js +2 -0
- package/lib/esm/internal/di.js.map +7 -0
- package/lib/esm/internal/externalTypes.js +2 -0
- package/lib/esm/internal/externalTypes.js.map +7 -0
- package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.js +2 -0
- package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.js.map +7 -0
- package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js +2 -0
- package/lib/esm/internal/lkrp-datasource/data/HttpLKRPDataSource.test.js.map +7 -0
- package/lib/esm/internal/lkrp-datasource/data/LKRPDataSource.js +1 -0
- package/lib/esm/internal/lkrp-datasource/data/LKRPDataSource.js.map +7 -0
- package/lib/esm/internal/lkrp-datasource/di/lkrpDatasourceModuleFactory.js +2 -0
- package/lib/esm/internal/lkrp-datasource/di/lkrpDatasourceModuleFactory.js.map +7 -0
- package/lib/esm/internal/lkrp-datasource/di/lkrpDatasourceTypes.js +2 -0
- package/lib/esm/internal/lkrp-datasource/di/lkrpDatasourceTypes.js.map +7 -0
- package/lib/esm/internal/use-cases/authentication/AuthenticateUseCase.js +2 -0
- package/lib/esm/internal/use-cases/authentication/AuthenticateUseCase.js.map +7 -0
- package/lib/esm/internal/use-cases/di/useCasesModule.js +2 -0
- package/lib/esm/internal/use-cases/di/useCasesModule.js.map +7 -0
- package/lib/esm/internal/use-cases/di/useCasesTypes.js +2 -0
- package/lib/esm/internal/use-cases/di/useCasesTypes.js.map +7 -0
- package/lib/esm/internal/utils/LKRPBlock.js +5 -0
- package/lib/esm/internal/utils/LKRPBlock.js.map +7 -0
- package/lib/esm/internal/utils/LKRPBlock.test.js +24 -0
- package/lib/esm/internal/utils/LKRPBlock.test.js.map +7 -0
- package/lib/esm/internal/utils/LKRPBlockStream.js +4 -0
- package/lib/esm/internal/utils/LKRPBlockStream.js.map +7 -0
- package/lib/esm/internal/utils/LKRPBlockStream.test.js +39 -0
- package/lib/esm/internal/utils/LKRPBlockStream.test.js.map +7 -0
- package/lib/esm/internal/utils/LKRPCommand.js +3 -0
- package/lib/esm/internal/utils/LKRPCommand.js.map +7 -0
- package/lib/esm/internal/utils/LKRPCommand.test.js +3 -0
- package/lib/esm/internal/utils/LKRPCommand.test.js.map +7 -0
- package/lib/esm/internal/utils/TLVBuilder.js +2 -0
- package/lib/esm/internal/utils/TLVBuilder.js.map +7 -0
- package/lib/esm/internal/utils/TLVParser.js +2 -0
- package/lib/esm/internal/utils/TLVParser.js.map +7 -0
- package/lib/esm/internal/utils/TLVParser.test.js +2 -0
- package/lib/esm/internal/utils/TLVParser.test.js.map +7 -0
- package/lib/esm/internal/utils/TLVTags.js +2 -0
- package/lib/esm/internal/utils/TLVTags.js.map +7 -0
- package/lib/esm/internal/utils/crypto.js +2 -0
- package/lib/esm/internal/utils/crypto.js.map +7 -0
- package/lib/esm/internal/utils/derivationPath.js +2 -0
- package/lib/esm/internal/utils/derivationPath.js.map +7 -0
- package/lib/esm/internal/utils/eitherSeqRecord.js +2 -0
- package/lib/esm/internal/utils/eitherSeqRecord.js.map +7 -0
- package/lib/esm/internal/utils/hex.js +2 -0
- package/lib/esm/internal/utils/hex.js.map +7 -0
- package/lib/esm/internal/utils/required.js +2 -0
- package/lib/esm/internal/utils/required.js.map +7 -0
- package/lib/esm/internal/utils/types.js +1 -0
- package/lib/esm/internal/utils/types.js.map +7 -0
- package/lib/esm/package.json +55 -0
- package/lib/types/api/LedgerKeyringProtocol.d.ts +9 -0
- package/lib/types/api/LedgerKeyringProtocol.d.ts.map +1 -0
- package/lib/types/api/LedgerKeyringProtocolBuilder.d.ts +14 -0
- package/lib/types/api/LedgerKeyringProtocolBuilder.d.ts.map +1 -0
- package/lib/types/api/app-binder/AddToTrustchainDeviceActionTypes.d.ts +27 -0
- package/lib/types/api/app-binder/AddToTrustchainDeviceActionTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/AuthenticateDeviceActionTypes.d.ts +37 -0
- package/lib/types/api/app-binder/AuthenticateDeviceActionTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/Errors.d.ts +27 -0
- package/lib/types/api/app-binder/Errors.d.ts.map +1 -0
- package/lib/types/api/app-binder/GetAppNameCommandTypes.d.ts +5 -0
- package/lib/types/api/app-binder/GetAppNameCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/GetSeedIdCommandTypes.d.ts +14 -0
- package/lib/types/api/app-binder/GetSeedIdCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/GetVersionCommandTypes.d.ts +5 -0
- package/lib/types/api/app-binder/GetVersionCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/GetVersionDeviceActionTypes.d.ts +10 -0
- package/lib/types/api/app-binder/GetVersionDeviceActionTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/InitCommandTypes.d.ts +5 -0
- package/lib/types/api/app-binder/InitCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/KeypairFromBytes.d.ts +11 -0
- package/lib/types/api/app-binder/KeypairFromBytes.d.ts.map +1 -0
- package/lib/types/api/app-binder/LKRPTypes.d.ts +24 -0
- package/lib/types/api/app-binder/LKRPTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/ParseStreamBlockCommandCommandTypes.d.ts +6 -0
- package/lib/types/api/app-binder/ParseStreamBlockCommandCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/ParseStreamBlockHeaderCommandTypes.d.ts +5 -0
- package/lib/types/api/app-binder/ParseStreamBlockHeaderCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/ParseStreamBlockSignatureTypes.d.ts +5 -0
- package/lib/types/api/app-binder/ParseStreamBlockSignatureTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/SetTrustedMemberTypes.d.ts +6 -0
- package/lib/types/api/app-binder/SetTrustedMemberTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/SignBlockCommandTypes.d.ts +9 -0
- package/lib/types/api/app-binder/SignBlockCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/SignBlockHeaderCommandTypes.d.ts +5 -0
- package/lib/types/api/app-binder/SignBlockHeaderCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/SignBlockSignatureCommandTypes.d.ts +6 -0
- package/lib/types/api/app-binder/SignBlockSignatureCommandTypes.d.ts.map +1 -0
- package/lib/types/api/app-binder/SignBlockSingleCommandTypes.d.ts +5 -0
- package/lib/types/api/app-binder/SignBlockSingleCommandTypes.d.ts.map +1 -0
- package/lib/types/api/index.d.ts +7 -0
- package/lib/types/api/index.d.ts.map +1 -0
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/internal/DefaultLedgerKeyringProtocol.d.ts +20 -0
- package/lib/types/internal/DefaultLedgerKeyringProtocol.d.ts.map +1 -0
- package/lib/types/internal/app-binder/LedgerKeyringProtocolBinder.d.ts +29 -0
- package/lib/types/internal/app-binder/LedgerKeyringProtocolBinder.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetAppNameCommand.d.ts +9 -0
- package/lib/types/internal/app-binder/command/GetAppNameCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetSeedIdCommand.d.ts +11 -0
- package/lib/types/internal/app-binder/command/GetSeedIdCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetSeedIdCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/GetSeedIdCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/GetVersionCommand.d.ts +9 -0
- package/lib/types/internal/app-binder/command/GetVersionCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/InitCommand.d.ts +11 -0
- package/lib/types/internal/app-binder/command/InitCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/InitCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/InitCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/ParseBlockSignatureCommand.d.ts +11 -0
- package/lib/types/internal/app-binder/command/ParseBlockSignatureCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/ParseBlockSignatureCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/ParseBlockSignatureCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockCommand.d.ts +11 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockHeader.d.ts +11 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockHeader.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockHeader.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/ParseStreamBlockHeader.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SetTrustedMemberCommand.d.ts +11 -0
- package/lib/types/internal/app-binder/command/SetTrustedMemberCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SetTrustedMemberCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/SetTrustedMemberCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignBlockHeader.d.ts +11 -0
- package/lib/types/internal/app-binder/command/SignBlockHeader.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignBlockHeader.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/SignBlockHeader.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignBlockSignatureCommand.d.ts +10 -0
- package/lib/types/internal/app-binder/command/SignBlockSignatureCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignBlockSignatureCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/SignBlockSignatureCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignBlockSingleCommand.d.ts +11 -0
- package/lib/types/internal/app-binder/command/SignBlockSingleCommand.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/SignBlockSingleCommand.test.d.ts +2 -0
- package/lib/types/internal/app-binder/command/SignBlockSingleCommand.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/utils/extractTrustedProperty.d.ts +4 -0
- package/lib/types/internal/app-binder/command/utils/extractTrustedProperty.d.ts.map +1 -0
- package/lib/types/internal/app-binder/command/utils/ledgerKeyringProtocolErrors.d.ts +9 -0
- package/lib/types/internal/app-binder/command/utils/ledgerKeyringProtocolErrors.d.ts.map +1 -0
- package/lib/types/internal/app-binder/device-action/AddToTrustchainDeviceAction.d.ts +20 -0
- package/lib/types/internal/app-binder/device-action/AddToTrustchainDeviceAction.d.ts.map +1 -0
- package/lib/types/internal/app-binder/device-action/AuthenticateDeviceAction.d.ts +42 -0
- package/lib/types/internal/app-binder/device-action/AuthenticateDeviceAction.d.ts.map +1 -0
- package/lib/types/internal/app-binder/device-action/utils/raiseAndAssign.d.ts +41 -0
- package/lib/types/internal/app-binder/device-action/utils/raiseAndAssign.d.ts.map +1 -0
- package/lib/types/internal/app-binder/di/appBinderModule.d.ts +3 -0
- package/lib/types/internal/app-binder/di/appBinderModule.d.ts.map +1 -0
- package/lib/types/internal/app-binder/di/appBinderTypes.d.ts +4 -0
- package/lib/types/internal/app-binder/di/appBinderTypes.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/InitTask.d.ts +10 -0
- package/lib/types/internal/app-binder/task/InitTask.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/ParseStreamToDeviceTask.d.ts +26 -0
- package/lib/types/internal/app-binder/task/ParseStreamToDeviceTask.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignBlockTask.d.ts +68 -0
- package/lib/types/internal/app-binder/task/SignBlockTask.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignChallengeWithDeviceTask.d.ts +10 -0
- package/lib/types/internal/app-binder/task/SignChallengeWithDeviceTask.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignChallengeWithKeypairTask.d.ts +15 -0
- package/lib/types/internal/app-binder/task/SignChallengeWithKeypairTask.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/SignChallengeWithKeypairTask.test.d.ts +2 -0
- package/lib/types/internal/app-binder/task/SignChallengeWithKeypairTask.test.d.ts.map +1 -0
- package/lib/types/internal/app-binder/task/utils/TrustedProperties.d.ts +26 -0
- package/lib/types/internal/app-binder/task/utils/TrustedProperties.d.ts.map +1 -0
- package/lib/types/internal/di.d.ts +10 -0
- package/lib/types/internal/di.d.ts.map +1 -0
- package/lib/types/internal/externalTypes.d.ts +14 -0
- package/lib/types/internal/externalTypes.d.ts.map +1 -0
- package/lib/types/internal/lkrp-datasource/data/HttpLKRPDataSource.d.ts +22 -0
- package/lib/types/internal/lkrp-datasource/data/HttpLKRPDataSource.d.ts.map +1 -0
- package/lib/types/internal/lkrp-datasource/data/HttpLKRPDataSource.test.d.ts +2 -0
- package/lib/types/internal/lkrp-datasource/data/HttpLKRPDataSource.test.d.ts.map +1 -0
- package/lib/types/internal/lkrp-datasource/data/LKRPDataSource.d.ts +54 -0
- package/lib/types/internal/lkrp-datasource/data/LKRPDataSource.d.ts.map +1 -0
- package/lib/types/internal/lkrp-datasource/di/lkrpDatasourceModuleFactory.d.ts +4 -0
- package/lib/types/internal/lkrp-datasource/di/lkrpDatasourceModuleFactory.d.ts.map +1 -0
- package/lib/types/internal/lkrp-datasource/di/lkrpDatasourceTypes.d.ts +5 -0
- package/lib/types/internal/lkrp-datasource/di/lkrpDatasourceTypes.d.ts.map +1 -0
- package/lib/types/internal/use-cases/authentication/AuthenticateUseCase.d.ts +9 -0
- package/lib/types/internal/use-cases/authentication/AuthenticateUseCase.d.ts.map +1 -0
- package/lib/types/internal/use-cases/di/useCasesModule.d.ts +3 -0
- package/lib/types/internal/use-cases/di/useCasesModule.d.ts.map +1 -0
- package/lib/types/internal/use-cases/di/useCasesTypes.d.ts +4 -0
- package/lib/types/internal/use-cases/di/useCasesTypes.d.ts.map +1 -0
- package/lib/types/internal/utils/LKRPBlock.d.ts +17 -0
- package/lib/types/internal/utils/LKRPBlock.d.ts.map +1 -0
- package/lib/types/internal/utils/LKRPBlock.test.d.ts +2 -0
- package/lib/types/internal/utils/LKRPBlock.test.d.ts.map +1 -0
- package/lib/types/internal/utils/LKRPBlockStream.d.ts +26 -0
- package/lib/types/internal/utils/LKRPBlockStream.d.ts.map +1 -0
- package/lib/types/internal/utils/LKRPBlockStream.test.d.ts +2 -0
- package/lib/types/internal/utils/LKRPBlockStream.test.d.ts.map +1 -0
- package/lib/types/internal/utils/LKRPCommand.d.ts +18 -0
- package/lib/types/internal/utils/LKRPCommand.d.ts.map +1 -0
- package/lib/types/internal/utils/LKRPCommand.test.d.ts +2 -0
- package/lib/types/internal/utils/LKRPCommand.test.d.ts.map +1 -0
- package/lib/types/internal/utils/TLVBuilder.d.ts +15 -0
- package/lib/types/internal/utils/TLVBuilder.d.ts.map +1 -0
- package/lib/types/internal/utils/TLVParser.d.ts +59 -0
- package/lib/types/internal/utils/TLVParser.d.ts.map +1 -0
- package/lib/types/internal/utils/TLVParser.test.d.ts +2 -0
- package/lib/types/internal/utils/TLVParser.test.d.ts.map +1 -0
- package/lib/types/internal/utils/TLVTags.d.ts +27 -0
- package/lib/types/internal/utils/TLVTags.d.ts.map +1 -0
- package/lib/types/internal/utils/crypto.d.ts +19 -0
- package/lib/types/internal/utils/crypto.d.ts.map +1 -0
- package/lib/types/internal/utils/derivationPath.d.ts +3 -0
- package/lib/types/internal/utils/derivationPath.d.ts.map +1 -0
- package/lib/types/internal/utils/eitherSeqRecord.d.ts +29 -0
- package/lib/types/internal/utils/eitherSeqRecord.d.ts.map +1 -0
- package/lib/types/internal/utils/hex.d.ts +3 -0
- package/lib/types/internal/utils/hex.d.ts.map +1 -0
- package/lib/types/internal/utils/required.d.ts +3 -0
- package/lib/types/internal/utils/required.d.ts.map +1 -0
- package/lib/types/internal/utils/types.d.ts +73 -0
- package/lib/types/internal/utils/types.d.ts.map +1 -0
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n=require("purify-ts"),s=require("../../api/app-binder/Errors"),c=require("./LKRPCommand"),r=require("./TLVParser"),e=require("./TLVTags");describe("TLVParser",()=>{describe("Block Data Parsing",()=>{describe("parseCommands",()=>{it("should parse has many commands has specified by the command count value",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,2,e.CommandTags.AddMember,3,e.GeneralTags.Int,1,1,e.CommandTags.Seed,3,e.GeneralTags.Int,1,2])).parseCommands();expect(a).toStrictEqual((0,n.Right)([new c.LKRPCommand(new Uint8Array([e.CommandTags.AddMember,3,e.GeneralTags.Int,1,1])),new c.LKRPCommand(new Uint8Array([e.CommandTags.Seed,3,e.GeneralTags.Int,1,2]))]))})}),describe("parseBlockData",()=>{it("should parse a valid block data",()=>{const a=new r.TLVParser(Uint8Array.from([[e.GeneralTags.Int,1,1],[e.GeneralTags.Hash,3,1,2,3],[e.GeneralTags.PublicKey,3,4,5,6],[e.GeneralTags.Int,1,2],[e.CommandTags.AddMember,3,e.GeneralTags.Int,1,1],[e.CommandTags.Seed,3,e.GeneralTags.Int,1,2],[e.GeneralTags.Signature,3,7,8,9]].flat())).parseBlockData();expect(a).toStrictEqual((0,n.Right)({parent:"010203",issuer:new Uint8Array([4,5,6]),header:Uint8Array.from([[e.GeneralTags.Int,1,1],[e.GeneralTags.Hash,3,1,2,3],[e.GeneralTags.PublicKey,3,4,5,6],[e.GeneralTags.Int,1,2]].flat()),commands:[new c.LKRPCommand(new Uint8Array([e.CommandTags.AddMember,3,e.GeneralTags.Int,1,1])),new c.LKRPCommand(new Uint8Array([e.CommandTags.Seed,3,e.GeneralTags.Int,1,2]))],signature:Uint8Array.from([e.GeneralTags.Signature,3,7,8,9])}))}),it("should fail if the block data is invalid",()=>{const a=new r.TLVParser(new Uint8Array([])).parseBlockData();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Unexpected end of TLV")))})})}),describe("Command Data Parsing",()=>{describe("parseCommandBytes",()=>{it("should parse a valid command bytes",()=>{const a=new r.TLVParser(new Uint8Array([e.CommandTags.AddMember,3,1,2,3])).parseCommandBytes();expect(a).toEqual((0,n.Right)(new Uint8Array([e.CommandTags.AddMember,3,1,2,3])))}),it("should fail if the tag is not a command",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1])).parseCommandBytes();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Invalid command type: 0x01")))})}),describe("Parse Seed Command Data",()=>{it("should parse a valid seed command data",()=>{const t=new Uint8Array([e.GeneralTags.Bytes,3,1,2,3,e.GeneralTags.Int,2,1,2,e.GeneralTags.PublicKey,3,2,4,6,e.GeneralTags.Bytes,3,3,5,7,e.GeneralTags.Bytes,3,4,8,16,e.GeneralTags.PublicKey,3,10,11,12]),i=new r.TLVParser(new Uint8Array([e.CommandTags.Seed,t.length,...t])).parseCommandData();expect(i).toStrictEqual((0,n.Right)({type:e.CommandTags.Seed,topic:new Uint8Array([1,2,3]),protocolVersion:258,groupKey:new Uint8Array([2,4,6]),initializationVector:new Uint8Array([3,5,7]),encryptedXpriv:new Uint8Array([4,8,16]),ephemeralPublicKey:new Uint8Array([10,11,12])}))}),it("should fail if the command data is invalid",()=>{const t=new Uint8Array([e.GeneralTags.Signature,3,1,2,3]),a=new Uint8Array([e.GeneralTags.Bytes,3,1,2,3]),i=new r.TLVParser(new Uint8Array([e.CommandTags.Seed,t.length,...t])),x=new r.TLVParser(new Uint8Array([e.CommandTags.Seed,a.length,...a])),o=i.parseCommandData(),p=x.parseCommandData();expect(o).toEqual((0,n.Left)(new s.LKRPParsingError("Expected bytes"))),expect(p).toEqual((0,n.Left)(new s.LKRPParsingError("Unexpected end of TLV")))})}),describe("Parse AddMember Command Data",()=>{it("should parse a valid add member command data",()=>{const t=new Uint8Array([e.GeneralTags.String,5,65,108,105,99,101,e.GeneralTags.PublicKey,3,1,2,3,e.GeneralTags.Int,1,1]),i=new r.TLVParser(new Uint8Array([e.CommandTags.AddMember,t.length,...t])).parseCommandData();expect(i).toStrictEqual((0,n.Right)({type:e.CommandTags.AddMember,name:"Alice",publicKey:new Uint8Array([1,2,3]),permissions:1}))}),it("should fail if the command data is invalid",()=>{const t=new Uint8Array([e.GeneralTags.Bytes,3,1,2,3]),a=new Uint8Array([e.GeneralTags.String,5,65,108,105,99,101]),i=new r.TLVParser(new Uint8Array([e.CommandTags.AddMember,t.length,...t])),x=new r.TLVParser(new Uint8Array([e.CommandTags.AddMember,a.length,...a])),o=i.parseCommandData(),p=x.parseCommandData();expect(o).toEqual((0,n.Left)(new s.LKRPParsingError("Expected a string"))),expect(p).toEqual((0,n.Left)(new s.LKRPParsingError("Unexpected end of TLV")))})}),describe("Parse PublishKey Command Data",()=>{it("should parse a valid publish key command data",()=>{const t=new Uint8Array([e.GeneralTags.Bytes,3,1,2,3,e.GeneralTags.Bytes,3,4,5,6,e.GeneralTags.PublicKey,3,3,5,7,e.GeneralTags.PublicKey,3,8,9,10]),i=new r.TLVParser(new Uint8Array([e.CommandTags.PublishKey,t.length,...t])).parseCommandData();expect(i).toStrictEqual((0,n.Right)({type:e.CommandTags.PublishKey,initializationVector:new Uint8Array([1,2,3]),encryptedXpriv:new Uint8Array([4,5,6]),recipient:new Uint8Array([3,5,7]),ephemeralPublicKey:new Uint8Array([8,9,10])}))}),it("should fail if the command data is invalid",()=>{const t=new Uint8Array([e.GeneralTags.Int,2,1,2]),a=new Uint8Array([e.GeneralTags.Bytes,3,1,2,3]),i=new r.TLVParser(new Uint8Array([e.CommandTags.PublishKey,t.length,...t])),x=new r.TLVParser(new Uint8Array([e.CommandTags.PublishKey,a.length,...a])),o=i.parseCommandData(),p=x.parseCommandData();expect(o).toEqual((0,n.Left)(new s.LKRPParsingError("Expected bytes"))),expect(p).toEqual((0,n.Left)(new s.LKRPParsingError("Unexpected end of TLV")))})}),describe("Parse Derive Command Data",()=>{it("should parse a valid derive command data",()=>{const t=new Uint8Array([e.GeneralTags.Bytes,4,0,0,0,1,e.GeneralTags.PublicKey,3,4,5,6,e.GeneralTags.Bytes,3,3,5,7,e.GeneralTags.Bytes,3,8,9,10,e.GeneralTags.PublicKey,3,10,11,12]),i=new r.TLVParser(new Uint8Array([e.CommandTags.Derive,t.length,...t])).parseCommandData();expect(i).toStrictEqual((0,n.Right)({type:e.CommandTags.Derive,path:"m/1",groupKey:new Uint8Array([4,5,6]),initializationVector:new Uint8Array([3,5,7]),encryptedXpriv:new Uint8Array([8,9,10]),ephemeralPublicKey:new Uint8Array([10,11,12])}))}),it("should fail if the command data is invalid",()=>{const t=new Uint8Array([e.GeneralTags.Int,2,1,2]),a=new Uint8Array([e.GeneralTags.Bytes,3,1,2,3]),i=new r.TLVParser(new Uint8Array([e.CommandTags.Derive,t.length,...t])),x=new r.TLVParser(new Uint8Array([e.CommandTags.Derive,a.length,...a])),o=i.parseCommandData(),p=x.parseCommandData();expect(o).toEqual((0,n.Left)(new s.LKRPParsingError("Expected bytes"))),expect(p).toEqual((0,n.Left)(new s.LKRPParsingError("Unexpected end of TLV")))})}),it("should fail on unsupported command type",()=>{const a=new r.TLVParser(new Uint8Array([63,1,1])).parseCommandData();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Unsupported command type: 0x3f")))})}),describe("General Types Parsing",()=>{describe("parse",()=>{it("should parse a valid TLV structure",()=>{const t=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1,e.GeneralTags.Bytes,0])),a=t.parse(),i=t.parse();expect(a).toEqual((0,n.Right)({tag:e.GeneralTags.Int,value:1})),expect(i).toEqual((0,n.Right)({tag:e.GeneralTags.Bytes,value:new Uint8Array([])}))}),it("should fail on invalid TLV structure",()=>{const t=new r.TLVParser(new Uint8Array([])),a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int])),i=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,2])),x=t.parse(),o=a.parse(),p=i.parse();expect(x).toEqual((0,n.Left)(new s.LKRPParsingError("Unexpected end of TLV"))),expect(o).toEqual((0,n.Left)(new s.LKRPParsingError("Invalid end of TLV, expected length"))),expect(p).toEqual((0,n.Left)(new s.LKRPParsingError("Invalid end of TLV value")))})}),describe("parseNull",()=>{it("should parse a null value",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Null,0])).parseNull();expect(a).toEqual((0,n.Right)(null))}),it("should fail if the tag is not null",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1])).parseNull();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Expected null")))}),it("should fail if the format is invalid",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Null,1,2])).parseNull();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Invalid null length")))})}),describe("parseInt",()=>{it("should parse big endian integer values",()=>{const t=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1,e.GeneralTags.Int,2,1,0,e.GeneralTags.Int,4,1,0,0,0])),a=t.parseInt(),i=t.parseInt(),x=t.parseInt();expect(a).toEqual((0,n.Right)(1)),expect(i).toEqual((0,n.Right)(256)),expect(x).toEqual((0,n.Right)(16777216))}),it("should fail if the tag is not an integer",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Bytes,1,1])).parseInt();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Expected a number")))}),it("should fail if the integer is not 1, 2, or 4 bytes",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,3,1,2,3])).parseInt();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Unsupported integer length")))})}),describe("parseHash",()=>{it("should parse a hash value",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Hash,3,1,2,3])).parseHash();expect(a).toEqual((0,n.Right)(new Uint8Array([1,2,3])))}),it("should fail if the tag is not a hash",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1])).parseHash();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Expected a hash")))})}),describe("parseSignature",()=>{it("should parse a signature value",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Signature,3,1,2,3])).parseSignature();expect(a).toEqual((0,n.Right)(new Uint8Array([1,2,3])))}),it("should fail if the tag is not a signature",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1])).parseSignature();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Expected a signature")))})}),describe("parseString",()=>{it("should parse a string value",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.String,5,72,101,108,108,111])).parseString();expect(a).toEqual((0,n.Right)("Hello"))}),it("should fail if the tag is not a string",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1])).parseString();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Expected a string")))})}),describe("parseBytes",()=>{it("should parse a bytes value",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Bytes,3,1,2,3])).parseBytes();expect(a).toEqual((0,n.Right)(new Uint8Array([1,2,3])))}),it("should fail if the tag is not bytes",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1])).parseBytes();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Expected bytes")))})}),describe("parsePublicKey",()=>{it("should parse a public key value",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.PublicKey,3,1,2,3])).parsePublicKey();expect(a).toEqual((0,n.Right)(new Uint8Array([1,2,3])))}),it("should fail if the tag is not a public key",()=>{const a=new r.TLVParser(new Uint8Array([e.GeneralTags.Int,1,1])).parsePublicKey();expect(a).toEqual((0,n.Left)(new s.LKRPParsingError("Expected a public key")))})})})});
|
|
2
|
+
//# sourceMappingURL=TLVParser.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/TLVParser.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\n\nimport { LKRPParsingError } from \"@api/app-binder/Errors\";\n\nimport { LKRPCommand } from \"./LKRPCommand\";\nimport { TLVParser } from \"./TLVParser\";\nimport { CommandTags, GeneralTags } from \"./TLVTags\";\n\ndescribe(\"TLVParser\", () => {\n describe(\"Block Data Parsing\", () => {\n describe(\"parseCommands\", () => {\n it(\"should parse has many commands has specified by the command count value\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([\n ...[GeneralTags.Int, 1, 0x02], // Command count: 2\n ...[CommandTags.AddMember, 3, ...[GeneralTags.Int, 1, 0x01]], // First command\n ...[CommandTags.Seed, 3, ...[GeneralTags.Int, 1, 0x02]], // Second command\n ]),\n );\n // WHEN\n const commands = parser.parseCommands();\n\n // THEN\n expect(commands).toStrictEqual(\n Right([\n new LKRPCommand(\n new Uint8Array([\n CommandTags.AddMember,\n 3,\n ...[GeneralTags.Int, 1, 0x01],\n ]),\n ),\n new LKRPCommand(\n new Uint8Array([\n CommandTags.Seed,\n 3,\n ...[GeneralTags.Int, 1, 0x02],\n ]),\n ),\n ]),\n );\n });\n });\n\n describe(\"parseBlockData\", () => {\n it(\"should parse a valid block data\", () => {\n // GIVEN\n const parser = new TLVParser(\n Uint8Array.from(\n [\n [GeneralTags.Int, 1, 0x01], // Version\n [GeneralTags.Hash, 3, 0x01, 0x02, 0x03], // Parent\n [GeneralTags.PublicKey, 3, 0x04, 0x05, 0x06], // Issuer\n [GeneralTags.Int, 1, 0x02], // Command count: 2\n [CommandTags.AddMember, 3, ...[GeneralTags.Int, 1, 0x01]], // First command\n [CommandTags.Seed, 3, ...[GeneralTags.Int, 1, 0x02]], // Second command\n [GeneralTags.Signature, 3, 0x07, 0x08, 0x09], // Signature\n ].flat(),\n ),\n );\n // WHEN\n const blockData = parser.parseBlockData();\n\n // THEN\n expect(blockData).toStrictEqual(\n Right({\n parent: \"010203\",\n issuer: new Uint8Array([0x04, 0x05, 0x06]),\n header: Uint8Array.from(\n [\n [GeneralTags.Int, 1, 0x01], // Version\n [GeneralTags.Hash, 3, 0x01, 0x02, 0x03], // Parent\n [GeneralTags.PublicKey, 3, 0x04, 0x05, 0x06], // Issuer\n [GeneralTags.Int, 1, 0x02], // Command count: 2\n ].flat(),\n ),\n\n commands: [\n new LKRPCommand(\n new Uint8Array([\n CommandTags.AddMember,\n 3,\n ...[GeneralTags.Int, 1, 0x01],\n ]),\n ),\n new LKRPCommand(\n new Uint8Array([\n CommandTags.Seed,\n 3,\n ...[GeneralTags.Int, 1, 0x02],\n ]),\n ),\n ],\n signature: Uint8Array.from([\n GeneralTags.Signature,\n 3,\n 0x07,\n 0x08,\n 0x09,\n ]),\n }),\n );\n });\n\n it(\"should fail if the block data is invalid\", () => {\n // GIVEN\n const parser = new TLVParser(new Uint8Array([]));\n // WHEN\n const blockData = parser.parseBlockData();\n // THEN\n expect(blockData).toEqual(\n Left(new LKRPParsingError(\"Unexpected end of TLV\")),\n );\n });\n });\n });\n\n describe(\"Command Data Parsing\", () => {\n describe(\"parseCommandBytes\", () => {\n it(\"should parse a valid command bytes\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([CommandTags.AddMember, 3, 0x01, 0x02, 0x03]),\n );\n // WHEN\n const value = parser.parseCommandBytes();\n // THEN\n expect(value).toEqual(\n Right(new Uint8Array([CommandTags.AddMember, 3, 0x01, 0x02, 0x03])),\n );\n });\n\n it(\"should fail if the tag is not a command\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01]),\n );\n // WHEN\n const value = parser.parseCommandBytes();\n // THEN\n expect(value).toEqual(\n Left(new LKRPParsingError(`Invalid command type: 0x01`)),\n );\n });\n });\n\n describe(\"Parse Seed Command Data\", () => {\n it(\"should parse a valid seed command data\", () => {\n // GIVEN\n const value = new Uint8Array([\n ...[GeneralTags.Bytes, 3, 0x01, 0x02, 0x03], // Topic\n ...[GeneralTags.Int, 2, 0x01, 0x02], // Protocol Version\n ...[GeneralTags.PublicKey, 3, 0x02, 0x04, 0x06], // Group Key\n ...[GeneralTags.Bytes, 3, 0x03, 0x05, 0x07], // Initialization Vector\n ...[GeneralTags.Bytes, 3, 0x04, 0x08, 0x10], // Encrypted xpriv\n ...[GeneralTags.PublicKey, 3, 0x0a, 0x0b, 0x0c], // Ephemeral Public Key\n ]);\n const parser = new TLVParser(\n new Uint8Array([CommandTags.Seed, value.length, ...value]),\n );\n\n // WHEN\n const parsed = parser.parseCommandData();\n\n // THEN\n expect(parsed).toStrictEqual(\n Right({\n type: CommandTags.Seed,\n topic: new Uint8Array([0x01, 0x02, 0x03]),\n protocolVersion: 258, // 0x0102 in big-endian\n groupKey: new Uint8Array([0x02, 0x04, 0x06]),\n initializationVector: new Uint8Array([0x03, 0x05, 0x07]),\n encryptedXpriv: new Uint8Array([0x04, 0x08, 0x10]),\n ephemeralPublicKey: new Uint8Array([0x0a, 0x0b, 0x0c]),\n }),\n );\n });\n\n it(\"should fail if the command data is invalid\", () => {\n // GIVEN\n const value1 = new Uint8Array([\n ...[GeneralTags.Signature, 3, 0x01, 0x02, 0x03], // Wrong type for Topic\n ]);\n const value2 = new Uint8Array([\n ...[GeneralTags.Bytes, 3, 0x01, 0x02, 0x03], // Correct type but the other fields are missing\n ]);\n const parser1 = new TLVParser(\n new Uint8Array([CommandTags.Seed, value1.length, ...value1]),\n );\n const parser2 = new TLVParser(\n new Uint8Array([CommandTags.Seed, value2.length, ...value2]),\n );\n\n // WHEN\n const parsed1 = parser1.parseCommandData();\n const parsed2 = parser2.parseCommandData();\n\n // THEN\n expect(parsed1).toEqual(Left(new LKRPParsingError(\"Expected bytes\")));\n expect(parsed2).toEqual(\n Left(new LKRPParsingError(\"Unexpected end of TLV\")),\n );\n });\n });\n\n describe(\"Parse AddMember Command Data\", () => {\n it(\"should parse a valid add member command data\", () => {\n // GIVEN\n const value = new Uint8Array([\n ...[GeneralTags.String, 5, 0x41, 0x6c, 0x69, 0x63, 0x65], // Name \"Alice\"\n ...[GeneralTags.PublicKey, 3, 0x01, 0x02, 0x03], // Public Key\n ...[GeneralTags.Int, 1, 0x01], // Permissions\n ]);\n const parser = new TLVParser(\n new Uint8Array([CommandTags.AddMember, value.length, ...value]),\n );\n\n // WHEN\n const parsed = parser.parseCommandData();\n\n // THEN\n expect(parsed).toStrictEqual(\n Right({\n type: CommandTags.AddMember,\n name: \"Alice\",\n publicKey: new Uint8Array([0x01, 0x02, 0x03]),\n permissions: 1,\n }),\n );\n });\n\n it(\"should fail if the command data is invalid\", () => {\n // GIVEN\n const value1 = new Uint8Array([\n ...[GeneralTags.Bytes, 3, 0x01, 0x02, 0x03], // Wrong type for Name\n ]);\n const value2 = new Uint8Array([\n ...[GeneralTags.String, 5, 0x41, 0x6c, 0x69, 0x63, 0x65], // Correct type but the other fields are missing\n ]);\n const parser1 = new TLVParser(\n new Uint8Array([CommandTags.AddMember, value1.length, ...value1]),\n );\n const parser2 = new TLVParser(\n new Uint8Array([CommandTags.AddMember, value2.length, ...value2]),\n );\n\n // WHEN\n const parsed1 = parser1.parseCommandData();\n const parsed2 = parser2.parseCommandData();\n\n // THEN\n expect(parsed1).toEqual(\n Left(new LKRPParsingError(\"Expected a string\")),\n );\n expect(parsed2).toEqual(\n Left(new LKRPParsingError(\"Unexpected end of TLV\")),\n );\n });\n });\n\n describe(\"Parse PublishKey Command Data\", () => {\n it(\"should parse a valid publish key command data\", () => {\n // GIVEN\n const value = new Uint8Array([\n ...[GeneralTags.Bytes, 3, 0x01, 0x02, 0x03], // Initialization Vector\n ...[GeneralTags.Bytes, 3, 0x04, 0x05, 0x06], // Encrypted xpriv\n ...[GeneralTags.PublicKey, 3, 0x03, 0x05, 0x07], // Recipient Public Key\n ...[GeneralTags.PublicKey, 3, 0x08, 0x09, 0x0a], // Ephemeral Public Key\n ]);\n const parser = new TLVParser(\n new Uint8Array([CommandTags.PublishKey, value.length, ...value]),\n );\n\n // WHEN\n const parsed = parser.parseCommandData();\n\n // THEN\n expect(parsed).toStrictEqual(\n Right({\n type: CommandTags.PublishKey,\n initializationVector: new Uint8Array([0x01, 0x02, 0x03]),\n encryptedXpriv: new Uint8Array([0x04, 0x05, 0x06]),\n recipient: new Uint8Array([0x03, 0x05, 0x07]),\n ephemeralPublicKey: new Uint8Array([0x08, 0x09, 0x0a]),\n }),\n );\n });\n\n it(\"should fail if the command data is invalid\", () => {\n // GIVEN\n const value1 = new Uint8Array([\n ...[GeneralTags.Int, 2, 0x01, 0x02], // Wrong type for Initialization Vector\n ]);\n const value2 = new Uint8Array([\n ...[GeneralTags.Bytes, 3, 0x01, 0x02, 0x03], // Correct type but the other fields are missing\n ]);\n const parser1 = new TLVParser(\n new Uint8Array([CommandTags.PublishKey, value1.length, ...value1]),\n );\n const parser2 = new TLVParser(\n new Uint8Array([CommandTags.PublishKey, value2.length, ...value2]),\n );\n\n // WHEN\n const parsed1 = parser1.parseCommandData();\n const parsed2 = parser2.parseCommandData();\n\n // THEN\n expect(parsed1).toEqual(Left(new LKRPParsingError(\"Expected bytes\")));\n expect(parsed2).toEqual(\n Left(new LKRPParsingError(\"Unexpected end of TLV\")),\n );\n });\n });\n\n describe(\"Parse Derive Command Data\", () => {\n it(\"should parse a valid derive command data\", () => {\n // GIVEN\n const value = new Uint8Array([\n ...[GeneralTags.Bytes, 4, 0x00, 0x00, 0x00, 0x01], // Path\n ...[GeneralTags.PublicKey, 3, 0x04, 0x05, 0x06], // Group Key\n ...[GeneralTags.Bytes, 3, 0x03, 0x05, 0x07], // Initialization Vector\n ...[GeneralTags.Bytes, 3, 0x08, 0x09, 0x0a], // Encrypted xpriv\n ...[GeneralTags.PublicKey, 3, 0x0a, 0x0b, 0x0c], // Ephemeral Public Key\n ]);\n const parser = new TLVParser(\n new Uint8Array([CommandTags.Derive, value.length, ...value]),\n );\n\n // WHEN\n const parsed = parser.parseCommandData();\n\n // THEN\n expect(parsed).toStrictEqual(\n Right({\n type: CommandTags.Derive,\n path: \"m/1\",\n groupKey: new Uint8Array([0x04, 0x05, 0x06]),\n initializationVector: new Uint8Array([0x03, 0x05, 0x07]),\n encryptedXpriv: new Uint8Array([0x08, 0x09, 0x0a]),\n ephemeralPublicKey: new Uint8Array([0x0a, 0x0b, 0x0c]),\n }),\n );\n });\n\n it(\"should fail if the command data is invalid\", () => {\n // GIVEN\n const value1 = new Uint8Array([\n ...[GeneralTags.Int, 2, 0x01, 0x02], // Wrong type for Path\n ]);\n const value2 = new Uint8Array([\n ...[GeneralTags.Bytes, 3, 0x01, 0x02, 0x03], // Correct type but the other fields are missing\n ]);\n const parser1 = new TLVParser(\n new Uint8Array([CommandTags.Derive, value1.length, ...value1]),\n );\n const parser2 = new TLVParser(\n new Uint8Array([CommandTags.Derive, value2.length, ...value2]),\n );\n\n // WHEN\n const parsed1 = parser1.parseCommandData();\n const parsed2 = parser2.parseCommandData();\n\n // THEN\n expect(parsed1).toEqual(Left(new LKRPParsingError(\"Expected bytes\")));\n expect(parsed2).toEqual(\n Left(new LKRPParsingError(\"Unexpected end of TLV\")),\n );\n });\n });\n\n it(\"should fail on unsupported command type\", () => {\n // GIVEN\n const parser = new TLVParser(new Uint8Array([0x3f, 1, 0x01]));\n // WHEN\n const parsed = parser.parseCommandData();\n // THEN\n expect(parsed).toEqual(\n Left(new LKRPParsingError(\"Unsupported command type: 0x3f\")),\n );\n });\n });\n\n describe(\"General Types Parsing\", () => {\n describe(\"parse\", () => {\n it(\"should parse a valid TLV structure\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01, GeneralTags.Bytes, 0]),\n );\n // WHEN\n const value1 = parser.parse();\n const value2 = parser.parse();\n // THEN\n expect(value1).toEqual(Right({ tag: GeneralTags.Int, value: 1 }));\n expect(value2).toEqual(\n Right({ tag: GeneralTags.Bytes, value: new Uint8Array([]) }),\n );\n });\n\n it(\"should fail on invalid TLV structure\", () => {\n // GIVEN\n const parser1 = new TLVParser(new Uint8Array([]));\n const parser2 = new TLVParser(new Uint8Array([GeneralTags.Int]));\n const parser3 = new TLVParser(new Uint8Array([GeneralTags.Int, 2]));\n // WHEN\n const value1 = parser1.parse();\n const value2 = parser2.parse();\n const value3 = parser3.parse();\n // THEN\n expect(value1).toEqual(\n Left(new LKRPParsingError(\"Unexpected end of TLV\")),\n );\n expect(value2).toEqual(\n Left(new LKRPParsingError(\"Invalid end of TLV, expected length\")),\n );\n expect(value3).toEqual(\n Left(new LKRPParsingError(\"Invalid end of TLV value\")),\n );\n });\n });\n\n describe(\"parseNull\", () => {\n it(\"should parse a null value\", () => {\n // GIVEN\n const parser = new TLVParser(new Uint8Array([GeneralTags.Null, 0]));\n // WHEN\n const value = parser.parseNull();\n // THEN\n expect(value).toEqual(Right(null));\n });\n\n it(\"should fail if the tag is not null\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01]),\n );\n // WHEN\n const value = parser.parseNull();\n // THEN\n expect(value).toEqual(Left(new LKRPParsingError(\"Expected null\")));\n });\n\n it(\"should fail if the format is invalid\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Null, 1, 0x02]),\n );\n // WHEN\n const value = parser.parseNull();\n // THEN\n expect(value).toEqual(\n Left(new LKRPParsingError(\"Invalid null length\")),\n );\n });\n });\n\n describe(\"parseInt\", () => {\n it(\"should parse big endian integer values\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([\n ...[GeneralTags.Int, 1, 0x01], // 1\n ...[GeneralTags.Int, 2, 0x01, 0x00], // 256\n ...[GeneralTags.Int, 4, 0x01, 0x00, 0x00, 0x00], // 16777216\n ]),\n );\n // WHEN\n const value1 = parser.parseInt();\n const value2 = parser.parseInt();\n const value4 = parser.parseInt();\n // THEN\n expect(value1).toEqual(Right(1));\n expect(value2).toEqual(Right(256));\n expect(value4).toEqual(Right(16777216));\n });\n\n it(\"should fail if the tag is not an integer\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Bytes, 1, 0x01]),\n );\n // WHEN\n const value = parser.parseInt();\n // THEN\n expect(value).toEqual(Left(new LKRPParsingError(\"Expected a number\")));\n });\n\n it(\"should fail if the integer is not 1, 2, or 4 bytes\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 3, 0x01, 0x02, 0x03]),\n );\n // WHEN\n const value = parser.parseInt();\n // THEN\n expect(value).toEqual(\n Left(new LKRPParsingError(\"Unsupported integer length\")),\n );\n });\n });\n\n describe(\"parseHash\", () => {\n it(\"should parse a hash value\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Hash, 3, 0x01, 0x02, 0x03]),\n );\n // WHEN\n const value = parser.parseHash();\n // THEN\n expect(value).toEqual(Right(new Uint8Array([0x01, 0x02, 0x03])));\n });\n\n it(\"should fail if the tag is not a hash\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01]),\n );\n // WHEN\n const value = parser.parseHash();\n // THEN\n expect(value).toEqual(Left(new LKRPParsingError(\"Expected a hash\")));\n });\n });\n\n describe(\"parseSignature\", () => {\n it(\"should parse a signature value\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Signature, 3, 0x01, 0x02, 0x03]),\n );\n // WHEN\n const value = parser.parseSignature();\n // THEN\n expect(value).toEqual(Right(new Uint8Array([0x01, 0x02, 0x03])));\n });\n\n it(\"should fail if the tag is not a signature\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01]),\n );\n // WHEN\n const value = parser.parseSignature();\n // THEN\n expect(value).toEqual(\n Left(new LKRPParsingError(\"Expected a signature\")),\n );\n });\n });\n\n describe(\"parseString\", () => {\n it(\"should parse a string value\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.String, 5, 0x48, 0x65, 0x6c, 0x6c, 0x6f]),\n );\n // WHEN\n const value = parser.parseString();\n // THEN\n expect(value).toEqual(Right(\"Hello\"));\n });\n\n it(\"should fail if the tag is not a string\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01]),\n );\n // WHEN\n const value = parser.parseString();\n // THEN\n expect(value).toEqual(Left(new LKRPParsingError(\"Expected a string\")));\n });\n });\n\n describe(\"parseBytes\", () => {\n it(\"should parse a bytes value\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Bytes, 3, 0x01, 0x02, 0x03]),\n );\n // WHEN\n const value = parser.parseBytes();\n // THEN\n expect(value).toEqual(Right(new Uint8Array([0x01, 0x02, 0x03])));\n });\n\n it(\"should fail if the tag is not bytes\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01]),\n );\n // WHEN\n const value = parser.parseBytes();\n // THEN\n expect(value).toEqual(Left(new LKRPParsingError(\"Expected bytes\")));\n });\n });\n\n describe(\"parsePublicKey\", () => {\n it(\"should parse a public key value\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.PublicKey, 3, 0x01, 0x02, 0x03]),\n );\n // WHEN\n const value = parser.parsePublicKey();\n // THEN\n expect(value).toEqual(Right(new Uint8Array([0x01, 0x02, 0x03])));\n });\n\n it(\"should fail if the tag is not a public key\", () => {\n // GIVEN\n const parser = new TLVParser(\n new Uint8Array([GeneralTags.Int, 1, 0x01]),\n );\n // WHEN\n const value = parser.parsePublicKey();\n // THEN\n expect(value).toEqual(\n Left(new LKRPParsingError(\"Expected a public key\")),\n );\n });\n });\n });\n});\n"],
|
|
5
|
+
"mappings": "aAAA,IAAAA,EAA4B,qBAE5BC,EAAiC,kCAEjCC,EAA4B,yBAC5BC,EAA0B,uBAC1BC,EAAyC,qBAEzC,SAAS,YAAa,IAAM,CAC1B,SAAS,qBAAsB,IAAM,CACnC,SAAS,gBAAiB,IAAM,CAC9B,GAAG,0EAA2E,IAAM,CAUlF,MAAMC,EARS,IAAI,YACjB,IAAI,WAAW,CACT,cAAY,IAAK,EAAG,EACpB,cAAY,UAAW,EAAO,cAAY,IAAK,EAAG,EAClD,cAAY,KAAM,EAAO,cAAY,IAAK,EAAG,CACnD,CAAC,CACH,EAEwB,cAAc,EAGtC,OAAOA,CAAQ,EAAE,iBACf,SAAM,CACJ,IAAI,cACF,IAAI,WAAW,CACb,cAAY,UACZ,EACI,cAAY,IAAK,EAAG,CAC1B,CAAC,CACH,EACA,IAAI,cACF,IAAI,WAAW,CACb,cAAY,KACZ,EACI,cAAY,IAAK,EAAG,CAC1B,CAAC,CACH,CACF,CAAC,CACH,CACF,CAAC,CACH,CAAC,EAED,SAAS,iBAAkB,IAAM,CAC/B,GAAG,kCAAmC,IAAM,CAgB1C,MAAMC,EAdS,IAAI,YACjB,WAAW,KACT,CACE,CAAC,cAAY,IAAK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EAAE,WAAQ,SAAM,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CAAC,CAAC,CACjE,CAAC,EAED,GAAG,sCAAuC,IAAM,CAM9C,MAAMA,EAJS,IAAI,YACjB,IAAI,WAAW,CAAC,cAAY,IAAK,EAAG,CAAI,CAAC,CAC3C,EAEqB,WAAW,EAEhC,OAAOA,CAAK,EAAE,WAAQ,QAAK,IAAI,mBAAiB,gBAAgB,CAAC,CAAC,CACpE,CAAC,CACH,CAAC,EAED,SAAS,iBAAkB,IAAM,CAC/B,GAAG,kCAAmC,IAAM,CAM1C,MAAMA,EAJS,IAAI,YACjB,IAAI,WAAW,CAAC,cAAY,UAAW,EAAG,EAAM,EAAM,CAAI,CAAC,CAC7D,EAEqB,eAAe,EAEpC,OAAOA,CAAK,EAAE,WAAQ,SAAM,IAAI,WAAW,CAAC,EAAM,EAAM,CAAI,CAAC,CAAC,CAAC,CACjE,CAAC,EAED,GAAG,6CAA8C,IAAM,CAMrD,MAAMA,EAJS,IAAI,YACjB,IAAI,WAAW,CAAC,cAAY,IAAK,EAAG,CAAI,CAAC,CAC3C,EAEqB,eAAe,EAEpC,OAAOA,CAAK,EAAE,WACZ,QAAK,IAAI,mBAAiB,uBAAuB,CAAC,CACpD,CACF,CAAC,CACH,CAAC,CACH,CAAC,CACH,CAAC",
|
|
6
|
+
"names": ["import_purify_ts", "import_Errors", "import_LKRPCommand", "import_TLVParser", "import_TLVTags", "commands", "blockData", "value", "parsed", "value1", "value2", "parser1", "parser2", "parsed1", "parsed2", "parser", "parser3", "value3", "value4"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var I=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var A=(u,t)=>{for(var i in t)I(u,i,{get:t[i],enumerable:!0})},B=(u,t,i,S)=>{if(t&&typeof t=="object"||typeof t=="function")for(let M of p(t))!y.call(u,M)&&M!==i&&I(u,M,{get:()=>t[M],enumerable:!(S=N(t,M))||S.enumerable});return u};var U=u=>B(I({},"__esModule",{value:!0}),u);var V={};A(V,{CommandTags:()=>b,GeneralTags:()=>_,TPTags:()=>K});module.exports=U(V);var _=(x=>(x[x.Null=0]="Null",x[x.Int=1]="Int",x[x.Hash=2]="Hash",x[x.Signature=3]="Signature",x[x.String=4]="String",x[x.Bytes=5]="Bytes",x[x.PublicKey=6]="PublicKey",x))(_||{}),b=(E=>(E[E.Seed=16]="Seed",E[E.AddMember=17]="AddMember",E[E.PublishKey=18]="PublishKey",E[E.CloseStream=19]="CloseStream",E[E.EditMember=20]="EditMember",E[E.Derive=21]="Derive",E))(b||{});const R=128;var K=(x=>(x[x.IV=0]="IV",x[x.ISSUER=1|R]="ISSUER",x[x.XPRIV=2|R]="XPRIV",x[x.EPHEMERAL_PUBLIC_KEY=3]="EPHEMERAL_PUBLIC_KEY",x[x.COMMAND_IV=4]="COMMAND_IV",x[x.GROUPKEY=5]="GROUPKEY",x[x.NEW_MEMBER=6|R]="NEW_MEMBER",x))(K||{});0&&(module.exports={CommandTags,GeneralTags,TPTags});
|
|
2
|
+
//# sourceMappingURL=TLVTags.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/TLVTags.ts"],
|
|
4
|
+
"sourcesContent": ["export enum GeneralTags {\n Null = 0x00,\n Int = 0x01,\n Hash = 0x02,\n Signature = 0x03,\n String = 0x04,\n Bytes = 0x05,\n PublicKey = 0x06,\n}\n\nexport enum CommandTags {\n Seed = 0x10,\n AddMember = 0x11,\n PublishKey = 0x12,\n CloseStream = 0x13,\n EditMember = 0x14,\n Derive = 0x15,\n}\n\nconst TP_ENCRYPT = 1 << 7;\n\nexport enum TPTags {\n IV = 0x00,\n ISSUER = 0x01 | TP_ENCRYPT,\n XPRIV = 0x02 | TP_ENCRYPT,\n EPHEMERAL_PUBLIC_KEY = 0x03,\n COMMAND_IV = 0x04,\n GROUPKEY = 0x05,\n NEW_MEMBER = 0x06 | TP_ENCRYPT,\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,gBAAAC,EAAA,WAAAC,IAAA,eAAAC,EAAAL,GAAO,IAAKG,OACVA,IAAA,KAAO,GAAP,OACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,OAAS,GAAT,SACAA,IAAA,MAAQ,GAAR,QACAA,IAAA,UAAY,GAAZ,YAPUA,OAAA,IAUAD,OACVA,IAAA,KAAO,IAAP,OACAA,IAAA,UAAY,IAAZ,YACAA,IAAA,WAAa,IAAb,aACAA,IAAA,YAAc,IAAd,cACAA,IAAA,WAAa,IAAb,aACAA,IAAA,OAAS,IAAT,SANUA,OAAA,IASZ,MAAMI,EAAa,IAEZ,IAAKF,OACVA,IAAA,GAAK,GAAL,KACAA,IAAA,OAAS,EAAOE,GAAhB,SACAF,IAAA,MAAQ,EAAOE,GAAf,QACAF,IAAA,qBAAuB,GAAvB,uBACAA,IAAA,WAAa,GAAb,aACAA,IAAA,SAAW,GAAX,WACAA,IAAA,WAAa,EAAOE,GAApB,aAPUF,OAAA",
|
|
6
|
+
"names": ["TLVTags_exports", "__export", "CommandTags", "GeneralTags", "TPTags", "__toCommonJS", "TP_ENCRYPT"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var l=(e,r)=>{for(var t in r)a(e,t,{get:r[t],enumerable:!0})},u=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of g(r))!d.call(e,i)&&i!==t&&a(e,i,{get:()=>r[i],enumerable:!(n=h(r,i))||n.enumerable});return e};var f=e=>u(a({},"__esModule",{value:!0}),e);var b={};l(b,{AES_BLOCK_SIZE:()=>s,CryptoUtils:()=>B});module.exports=f(b);var c=require("@noble/ciphers/aes"),m=require("@noble/ciphers/webcrypto"),p=require("@noble/hashes/hmac"),y=require("@noble/hashes/sha256"),o=require("@noble/secp256k1"),A=require("../../api/app-binder/KeypairFromBytes");const s=16;class B{static randomBytes(r){return(0,m.randomBytes)(r)}static randomKeypair(){return new A.KeypairFromBytes(o.utils.randomPrivateKey())}static encrypt(r,t,n){return(0,c.gcm)(r,t.slice(0,s)).encrypt(n)}static decrypt(r,t,n){return(0,c.gcm)(r,t.slice(0,s)).decrypt(n)}static hash(r){return(0,y.sha256)(r)}static hmac(r,t){return(0,p.hmac)(y.sha256,r,t)}static derEncode(r,t){const n=this.encodeSigComponent(r),i=this.encodeSigComponent(t),U=n.length+i.length;return Uint8Array.from([48,U,...n,...i])}static encodeSigComponent(r){const t=o.etc.numberToBytesBE(r),n=t[0]&&t[0]>=128?[0]:[],i=t.length+n.length;return Uint8Array.from([2,i,...n,...t])}}0&&(module.exports={AES_BLOCK_SIZE,CryptoUtils});
|
|
2
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/crypto.ts"],
|
|
4
|
+
"sourcesContent": ["import { gcm } from \"@noble/ciphers/aes\";\nimport { randomBytes } from \"@noble/ciphers/webcrypto\";\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { etc, utils } from \"@noble/secp256k1\";\n\nimport { KeypairFromBytes } from \"@api/app-binder/KeypairFromBytes\";\nimport { type Keypair } from \"@api/index\";\n\nexport const AES_BLOCK_SIZE = 16;\n\nexport class CryptoUtils {\n static randomBytes(len: number): Uint8Array {\n return randomBytes(len);\n }\n\n static randomKeypair(): Keypair {\n return new KeypairFromBytes(utils.randomPrivateKey());\n }\n\n static encrypt(\n key: Uint8Array,\n iv: Uint8Array,\n cleartext: Uint8Array,\n ): Uint8Array {\n const cipher = gcm(key, iv.slice(0, AES_BLOCK_SIZE));\n return cipher.encrypt(cleartext);\n }\n\n static decrypt(\n key: Uint8Array,\n iv: Uint8Array,\n ciphertext: Uint8Array,\n ): Uint8Array {\n const cipher = gcm(key, iv.slice(0, AES_BLOCK_SIZE));\n return cipher.decrypt(ciphertext);\n }\n\n static hash(bytes: Uint8Array): Uint8Array {\n return sha256(bytes);\n }\n\n static hmac(key: Uint8Array, message: Uint8Array): Uint8Array {\n return hmac(sha256, key, message);\n }\n\n /**\n * DER specification: https://ledgerhq.atlassian.net/wiki/spaces/TrustServices/pages/3843719348/LNS+Arch+Common+Fields+for+Nano+certificates+and+descriptors#DER-Encoding-spec\n * See: https://ledgerhq.atlassian.net/wiki/spaces/TrustServices/pages/3736863735/LNS+Arch+Nano+Trusted+Names+Descriptor+Format+APIs\n * signature(r,s) = 0x30 & var(L,u8(~)) & sized(8*L, sig_components(r,s)); # DER encoding of the two 32 bytes signature components r & s\n * sig_components(r,s) = 0x02 & var(Lr,u8(~)) & sized(8*Lr, r) & 0x02 & var(Ls,u8(~)) & sized(8*Ls, s);\n */\n public static derEncode(r: bigint, s: bigint): Uint8Array {\n const rBytes = this.encodeSigComponent(r);\n const sBytes = this.encodeSigComponent(s);\n const length = rBytes.length + sBytes.length;\n return Uint8Array.from([0x30, length, ...rBytes, ...sBytes]);\n }\n\n private static encodeSigComponent(number: bigint): Uint8Array {\n const bytes = etc.numberToBytesBE(number);\n const padding = bytes[0] && bytes[0] >= 0x80 ? [0x00] : []; // Add padding if the first byte is >= 0x80 to ensure positive encoding\n const length = bytes.length + padding.length;\n return Uint8Array.from([0x02, length, ...padding, ...bytes]);\n }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,gBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAoB,8BACpB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", "import_secp256k1", "import_KeypairFromBytes", "len", "key", "iv", "cleartext", "ciphertext", "bytes", "message", "s", "rBytes", "sBytes", "length", "number", "padding"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var u=(n,r)=>{for(var t in r)a(n,t,{get:r[t],enumerable:!0})},l=(n,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of o(r))!f.call(n,e)&&e!==t&&a(n,e,{get:()=>r[e],enumerable:!(i=s(r,e))||i.enumerable});return n};var c=n=>l(a({},"__esModule",{value:!0}),n);var h={};u(h,{derivationPathAsBytes:()=>A,derivationPathAsString:()=>d});module.exports=c(h);function d(n){const r=new DataView(n.buffer);return"m/"+Array.from({length:n.length/4},(t,i)=>i*4).map(t=>r.getUint32(t,!1)).map(t=>t>=2147483648?`${t-2147483648}'`:String(t)).join("/")}function A(n){return new Uint8Array(n.split("/").slice(1).flatMap(r=>{const i=r.endsWith("'")?Number(r.slice(0,-1))+2147483648:Number(r),e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,i,!1),Array.from(e)}))}0&&(module.exports={derivationPathAsBytes,derivationPathAsString});
|
|
2
|
+
//# sourceMappingURL=derivationPath.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/derivationPath.ts"],
|
|
4
|
+
"sourcesContent": ["export function derivationPathAsString(bytes: Uint8Array): string {\n const dataView = new DataView(bytes.buffer);\n return (\n \"m/\" +\n Array.from({ length: bytes.length / 4 }, (_, i) => i * 4)\n .map((offset) => dataView.getUint32(offset, false)) // Big-endian\n .map((segment) =>\n segment >= 0x80000000 ? `${segment - 0x80000000}'` : String(segment),\n )\n .join(\"/\")\n );\n}\n\nexport function derivationPathAsBytes(path: string): Uint8Array {\n return new Uint8Array(\n path\n .split(\"/\")\n .slice(1)\n .flatMap((part) => {\n const hardened = part.endsWith(\"'\");\n const number = hardened\n ? Number(part.slice(0, -1)) + 0x80000000\n : Number(part);\n const result = new Uint8Array(4);\n new DataView(result.buffer).setUint32(0, number, false);\n return Array.from(result);\n }),\n );\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2BAAAE,EAAA,2BAAAC,IAAA,eAAAC,EAAAJ,GAAO,SAASG,EAAuBE,EAA2B,CAChE,MAAMC,EAAW,IAAI,SAASD,EAAM,MAAM,EAC1C,MACE,KACA,MAAM,KAAK,CAAE,OAAQA,EAAM,OAAS,CAAE,EAAG,CAACE,EAAG,IAAM,EAAI,CAAC,EACrD,IAAKC,GAAWF,EAAS,UAAUE,EAAQ,EAAK,CAAC,EACjD,IAAKC,GACJA,GAAW,WAAa,GAAGA,EAAU,UAAU,IAAM,OAAOA,CAAO,CACrE,EACC,KAAK,GAAG,CAEf,CAEO,SAASP,EAAsBQ,EAA0B,CAC9D,OAAO,IAAI,WACTA,EACG,MAAM,GAAG,EACT,MAAM,CAAC,EACP,QAASC,GAAS,CAEjB,MAAMC,EADWD,EAAK,SAAS,GAAG,EAE9B,OAAOA,EAAK,MAAM,EAAG,EAAE,CAAC,EAAI,WAC5B,OAAOA,CAAI,EACTE,EAAS,IAAI,WAAW,CAAC,EAC/B,WAAI,SAASA,EAAO,MAAM,EAAE,UAAU,EAAGD,EAAQ,EAAK,EAC/C,MAAM,KAAKC,CAAM,CAC1B,CAAC,CACL,CACF",
|
|
6
|
+
"names": ["derivationPath_exports", "__export", "derivationPathAsBytes", "derivationPathAsString", "__toCommonJS", "bytes", "dataView", "_", "offset", "segment", "path", "part", "number", "result"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var n in e)c(t,n,{get:e[n],enumerable:!0})},y=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!d.call(t,r)&&r!==n&&c(t,r,{get:()=>e[r],enumerable:!(o=i(e,r))||o.enumerable});return t};var h=t=>y(c({},"__esModule",{value:!0}),t);var x={};T(x,{eitherAsyncSeqRecord:()=>E,eitherSeqRecord:()=>R});module.exports=h(x);var s=require("purify-ts");function R(t){const e={};for(const[n,o]of Object.entries(t)){const r=typeof o=="function"&&o.length===0&&o();if(!s.Either.isEither(r))Object.assign(e,{[n]:o});else{if(r.isLeft())return r;Object.assign(e,{[n]:r.extract()})}}return(0,s.Right)(e)}function E(t){return s.EitherAsync.sequence(Object.entries(t).map(([e,n])=>n&&typeof n=="object"&&n.constructor===s.EitherAsync?n.map(o=>[e,o]):s.EitherAsync.liftEither((0,s.Right)([e,n])))).map(Object.fromEntries)}0&&(module.exports={eitherAsyncSeqRecord,eitherSeqRecord});
|
|
2
|
+
//# sourceMappingURL=eitherSeqRecord.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/eitherSeqRecord.ts"],
|
|
4
|
+
"sourcesContent": ["import { Either, EitherAsync, Right } from \"purify-ts\";\n\n/**\n * Like a lazy version of [Either.sequence](https://gigobyte.github.io/purify/adts/Either#static-sequence) but for records.\n * E.g.:\n * eitherSeqRecord({ a: () => Right(1), b: () => Right(\"a\") }) -> Right({ a: 1, b: \"a\" })\n * eitherSeqRecord({ a: () => Right(1), b: () => Left(\"error\") }) -> Left(\"error\")\n * It also allows with non-Either values:\n * eitherSeqRecord({ a: () => Right(1), b: \"a\" }) -> Right({ a: 1, b: \"a\" })\n */\n\nexport function eitherSeqRecord<T extends object>(\n record: T,\n): EitherSeqRecord<T> {\n const result: Partial<EitherSeqRecord<T>> = {};\n for (const [key, value] of Object.entries(record) as [string, T[keyof T]][]) {\n const res =\n typeof value === \"function\" &&\n value.length === 0 &&\n (value as () => unknown)();\n\n if (!Either.isEither(res)) {\n Object.assign(result, { [key]: value });\n } else if (res.isLeft()) {\n return res as EitherSeqRecord<T>;\n } else {\n Object.assign(result, { [key]: res.extract() });\n }\n }\n return Right(result) as EitherSeqRecord<T>;\n}\n\ntype EitherSeqRecord<T extends object> = Either<\n UnionOfLeft<T>,\n RecordOfNonLeft<T>\n>;\n\ntype RecordOfNonLeft<T extends object> = {\n [K in keyof T]: T[K] extends () => Either<unknown, infer R> ? R : T[K];\n};\n\ntype UnionOfLeft<T extends object> =\n T extends Record<string, infer U>\n ? U extends () => Either<infer L, unknown>\n ? L\n : never\n : never;\n\n/**\n * eitherAsyncSeqRecord: like eitherSeqRecord but for EitherAsync.\n * (but not wrapped in a function as EitherAsync are already lazy).\n * E.g.:\n * eitherSeqRecordAsync({ a: EitherAsync<ErrA, 1>, b: EitherAsync<ErrB, \"a\"> }) -> EitherAsync(ErrA | ErrB, { a: 1, b: \"a\" }>\n */\nexport function eitherAsyncSeqRecord<T extends object>(\n record: T,\n): EitherAsyncSeqRecord<T> {\n return EitherAsync.sequence(\n Object.entries(record).map(([key, value]) =>\n value &&\n typeof value === \"object\" &&\n (value as object).constructor === EitherAsync\n ? (value as EitherAsync<unknown, unknown>).map((v) => [key, v])\n : EitherAsync.liftEither(Right([key, value])),\n ),\n ).map(Object.fromEntries) as EitherAsyncSeqRecord<T>;\n}\n\ntype EitherAsyncSeqRecord<T extends object> = EitherAsync<\n UnionOfLeftAsync<T>,\n RecordOfNonLeftAsync<T>\n>;\n\ntype RecordOfNonLeftAsync<T extends object> = {\n [K in keyof T]: T[K] extends EitherAsync<unknown, infer R> ? R : T[K];\n};\n\ntype UnionOfLeftAsync<T extends object> =\n T extends Record<string, infer U>\n ? U extends EitherAsync<infer L, unknown>\n ? L\n : never\n : never;\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,EAAA,oBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAA2C,qBAWpC,SAASF,EACdG,EACoB,CACpB,MAAMC,EAAsC,CAAC,EAC7C,SAAW,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQH,CAAM,EAA6B,CAC3E,MAAMI,EACJ,OAAOD,GAAU,YACjBA,EAAM,SAAW,GAChBA,EAAwB,EAE3B,GAAI,CAAC,SAAO,SAASC,CAAG,EACtB,OAAO,OAAOH,EAAQ,CAAE,CAACC,CAAG,EAAGC,CAAM,CAAC,MACjC,IAAIC,EAAI,OAAO,EACpB,OAAOA,EAEP,OAAO,OAAOH,EAAQ,CAAE,CAACC,CAAG,EAAGE,EAAI,QAAQ,CAAE,CAAC,EAElD,CACA,SAAO,SAAMH,CAAM,CACrB,CAwBO,SAASL,EACdI,EACyB,CACzB,OAAO,cAAY,SACjB,OAAO,QAAQA,CAAM,EAAE,IAAI,CAAC,CAACE,EAAKC,CAAK,IACrCA,GACA,OAAOA,GAAU,UAChBA,EAAiB,cAAgB,cAC7BA,EAAwC,IAAKE,GAAM,CAACH,EAAKG,CAAC,CAAC,EAC5D,cAAY,cAAW,SAAM,CAACH,EAAKC,CAAK,CAAC,CAAC,CAChD,CACF,EAAE,IAAI,OAAO,WAAW,CAC1B",
|
|
6
|
+
"names": ["eitherSeqRecord_exports", "__export", "eitherAsyncSeqRecord", "eitherSeqRecord", "__toCommonJS", "import_purify_ts", "record", "result", "key", "value", "res", "v"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var y=(r,t)=>{for(var n in t)o(r,n,{get:t[n],enumerable:!0})},s=(r,t,n,f)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of u(t))!x.call(r,e)&&e!==n&&o(r,e,{get:()=>t[e],enumerable:!(f=i(t,e))||f.enumerable});return r};var a=r=>s(o({},"__esModule",{value:!0}),r);var m={};y(m,{bytesToHex:()=>h,hexToBytes:()=>g});module.exports=a(m);function g(r){return Uint8Array.from(Buffer.from(r,"hex"))}function h(r){return Buffer.from(r).toString("hex")}0&&(module.exports={bytesToHex,hexToBytes});
|
|
2
|
+
//# sourceMappingURL=hex.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/hex.ts"],
|
|
4
|
+
"sourcesContent": ["export function hexToBytes(hex: string): Uint8Array {\n return Uint8Array.from(Buffer.from(hex, \"hex\"));\n}\n\nexport function bytesToHex(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString(\"hex\");\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,eAAAC,IAAA,eAAAC,EAAAJ,GAAO,SAASG,EAAWE,EAAyB,CAClD,OAAO,WAAW,KAAK,OAAO,KAAKA,EAAK,KAAK,CAAC,CAChD,CAEO,SAASH,EAAWI,EAA2B,CACpD,OAAO,OAAO,KAAKA,CAAK,EAAE,SAAS,KAAK,CAC1C",
|
|
6
|
+
"names": ["hex_exports", "__export", "bytesToHex", "hexToBytes", "__toCommonJS", "hex", "bytes"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var d=(e,r)=>{for(var n in r)o(e,n,{get:r[n],enumerable:!0})},p=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of m(r))!a.call(e,i)&&i!==n&&o(e,i,{get:()=>r[i],enumerable:!(t=l(r,i))||t.enumerable});return e};var s=e=>p(o({},"__esModule",{value:!0}),e);var g={};d(g,{required:()=>b});module.exports=s(g);var u=require("purify-ts"),f=require("../../api/app-binder/Errors");function b(e,r){return u.Maybe.fromNullable(e).toEither(new f.LKRPMissingDataError(r))}0&&(module.exports={required});
|
|
2
|
+
//# sourceMappingURL=required.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/required.ts"],
|
|
4
|
+
"sourcesContent": ["import { Maybe } from \"purify-ts\";\n\nimport { LKRPMissingDataError } from \"@api/app-binder/Errors\";\n\nexport function required<T>(prop: T | undefined | null, errorMsg: string) {\n return Maybe.fromNullable(prop).toEither(new LKRPMissingDataError(errorMsg));\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAsB,qBAEtBC,EAAqC,kCAE9B,SAASH,EAAYI,EAA4BC,EAAkB,CACxE,OAAO,QAAM,aAAaD,CAAI,EAAE,SAAS,IAAI,uBAAqBC,CAAQ,CAAC,CAC7E",
|
|
6
|
+
"names": ["required_exports", "__export", "required", "__toCommonJS", "import_purify_ts", "import_Errors", "prop", "errorMsg"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var m=(r,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!d.call(r,t)&&t!==n&&a(r,t,{get:()=>e[t],enumerable:!(i=y(e,t))||i.enumerable});return r};var o=r=>m(a({},"__esModule",{value:!0}),r);var s={};module.exports=o(s);
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/internal/utils/types.ts"],
|
|
4
|
+
"sourcesContent": ["import { type LKRPBlockStream } from \"./LKRPBlockStream\";\nimport { type LKRPCommand } from \"./LKRPCommand\";\nimport { type CommandTags } from \"./TLVTags\";\n\nexport type Trustchain = {\n [path: string]: LKRPBlockStream;\n};\n\nexport type PublishedKey = {\n privateKey: Uint8Array;\n chainCode: Uint8Array;\n};\n\nexport type EncryptedPublishedKey = {\n encryptedXpriv: Uint8Array;\n initializationVector: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\nexport type LKRPBlockData = {\n parent: string;\n issuer: Uint8Array;\n commands: LKRPCommand[];\n signature: Uint8Array;\n};\n\nexport type LKRPBlockParsedData = LKRPBlockData & { header: Uint8Array };\n\nexport type LKRPCommandData = Seed | AddMember | PublishKey | Derive;\n\ntype Seed = {\n type: CommandTags.Seed;\n topic: Uint8Array;\n protocolVersion: number;\n groupKey: Uint8Array;\n initializationVector: Uint8Array;\n encryptedXpriv: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\ntype AddMember = {\n type: CommandTags.AddMember;\n name: string;\n publicKey: Uint8Array;\n permissions: number;\n};\n\ntype PublishKey = {\n type: CommandTags.PublishKey;\n initializationVector: Uint8Array;\n encryptedXpriv: Uint8Array;\n recipient: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\ntype Derive = {\n type: CommandTags.Derive;\n path: string;\n groupKey: Uint8Array;\n initializationVector: Uint8Array;\n encryptedXpriv: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n};\n\nexport type UnsignedCommandData =\n | AddMemberUnsignedData\n | PublishKeyUnsignedData\n | DeriveUnsignedData;\n\nexport type AddMemberUnsignedData = AddMember;\ntype PublishKeyUnsignedData = Pick<PublishKey, \"type\" | \"recipient\">;\ntype DeriveUnsignedData = Pick<Derive, \"type\" | \"path\">;\n\nexport type ParsedTrustedProperties = {\n iv: Uint8Array;\n issuer: Uint8Array;\n xpriv: Uint8Array;\n ephemeralPublicKey: Uint8Array;\n commandIv: Uint8Array;\n groupKey: Uint8Array;\n newMember: Uint8Array;\n};\n\nexport type EncryptedCommand =\n | EncryptedDeriveCommand\n | AddMemberUnsignedData\n | EncryptedPublishKeyCommand;\n\nexport type EncryptedDeriveCommand = DeriveUnsignedData &\n Pick<\n ParsedTrustedProperties,\n \"iv\" | \"xpriv\" | \"ephemeralPublicKey\" | \"commandIv\" | \"groupKey\"\n >;\nexport type EncryptedPublishKeyCommand = PublishKeyUnsignedData &\n Pick<\n ParsedTrustedProperties,\n \"iv\" | \"xpriv\" | \"ephemeralPublicKey\" | \"commandIv\"\n >;\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ledgerhq/device-trusted-app-kit-ledger-keyring-protocol",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"private": false,
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./lib/types/index.d.ts",
|
|
9
|
+
"import": "./lib/esm/index.js",
|
|
10
|
+
"require": "./lib/cjs/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./*": {
|
|
13
|
+
"types": "./lib/types/*",
|
|
14
|
+
"import": "./lib/esm/*",
|
|
15
|
+
"require": "./lib/cjs/*"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"./lib"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"prebuild": "rimraf lib",
|
|
23
|
+
"build": "pnpm ldmk-tool build --entryPoints src/index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
24
|
+
"dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"",
|
|
25
|
+
"watch:builds": "pnpm ldmk-tool watch --entryPoints src/index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
|
26
|
+
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"",
|
|
27
|
+
"lint": "eslint",
|
|
28
|
+
"lint:fix": "pnpm lint --fix",
|
|
29
|
+
"postpack": "find . -name '*.tgz' -exec cp {} ../../dist/ \\; ",
|
|
30
|
+
"prettier": "prettier . --check",
|
|
31
|
+
"prettier:fix": "prettier . --write",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"test": "vitest run --passWithNoTests",
|
|
34
|
+
"test:watch": "vitest --passWithNoTests",
|
|
35
|
+
"test:coverage": "vitest run --coverage --passWithNoTests"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@ledgerhq/device-management-kit": "workspace:*",
|
|
39
|
+
"@ledgerhq/signer-utils": "workspace:*",
|
|
40
|
+
"@noble/ciphers": "^1.3.0",
|
|
41
|
+
"@noble/hashes": "^1.8.0",
|
|
42
|
+
"@noble/secp256k1": "^2.3.0",
|
|
43
|
+
"inversify": "catalog:",
|
|
44
|
+
"purify-ts": "catalog:",
|
|
45
|
+
"reflect-metadata": "catalog:",
|
|
46
|
+
"xstate": "catalog:"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@ledgerhq/eslint-config-dsdk": "workspace:*",
|
|
50
|
+
"@ledgerhq/ldmk-tool": "workspace:*",
|
|
51
|
+
"@ledgerhq/prettier-config-dsdk": "workspace:*",
|
|
52
|
+
"@ledgerhq/tsconfig-dsdk": "workspace:*",
|
|
53
|
+
"@ledgerhq/vitest-config-dmk": "workspace:*"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=LedgerKeyringProtocol.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{DefaultLedgerKeyringProtocol as s}from"../internal/DefaultLedgerKeyringProtocol";class n{dmk;sessionId;baseUrl;constructor({dmk:e,sessionId:i,baseUrl:r}){this.dmk=e,this.sessionId=i,this.baseUrl=r}build(){return new s({dmk:this.dmk,sessionId:this.sessionId,baseUrl:this.baseUrl})}}export{n as LedgerKeyringProtocolBuilder};
|
|
2
|
+
//# sourceMappingURL=LedgerKeyringProtocolBuilder.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/LedgerKeyringProtocolBuilder.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type DeviceManagementKit,\n type DeviceSessionId,\n} from \"@ledgerhq/device-management-kit\";\n\nimport { type LedgerKeyringProtocol } from \"@api/LedgerKeyringProtocol\";\nimport { DefaultLedgerKeyringProtocol } from \"@internal/DefaultLedgerKeyringProtocol\";\n\nexport class LedgerKeyringProtocolBuilder {\n private readonly dmk: DeviceManagementKit;\n private readonly sessionId: DeviceSessionId;\n private readonly baseUrl: string;\n\n constructor({\n dmk,\n sessionId,\n baseUrl,\n }: {\n dmk: DeviceManagementKit;\n sessionId: DeviceSessionId;\n baseUrl: string;\n }) {\n this.dmk = dmk;\n this.sessionId = sessionId;\n this.baseUrl = baseUrl;\n }\n\n build(): LedgerKeyringProtocol {\n return new DefaultLedgerKeyringProtocol({\n dmk: this.dmk,\n sessionId: this.sessionId,\n baseUrl: this.baseUrl,\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AAMA,OAAS,gCAAAA,MAAoC,yCAEtC,MAAMC,CAA6B,CACvB,IACA,UACA,QAEjB,YAAY,CACV,IAAAC,EACA,UAAAC,EACA,QAAAC,CACF,EAIG,CACD,KAAK,IAAMF,EACX,KAAK,UAAYC,EACjB,KAAK,QAAUC,CACjB,CAEA,OAA+B,CAC7B,OAAO,IAAIJ,EAA6B,CACtC,IAAK,KAAK,IACV,UAAW,KAAK,UAChB,QAAS,KAAK,OAChB,CAAC,CACH,CACF",
|
|
6
|
+
"names": ["DefaultLedgerKeyringProtocol", "LedgerKeyringProtocolBuilder", "dmk", "sessionId", "baseUrl"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=AddToTrustchainDeviceActionTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=AuthenticateDeviceActionTypes.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{GeneralDmkError as n}from"@ledgerhq/device-management-kit";class t extends n{constructor(r){super(r);this.err=r}_tag="LKRPHttpRequestError"}class a extends t{constructor(r){super(r);this.err=r}_tag="LKRPUnauthorizedError"}class d extends n{constructor(r){super(r);this.err=r}_tag="LKRPParsingError"}class u extends n{constructor(r){super(r);this.err=r}_tag="LKRPMissingDataError"}class c extends n{constructor(r){super(r);this.err=r}_tag="LKRPUnhandledState"}export{t as LKRPHttpRequestError,u as LKRPMissingDataError,d as LKRPParsingError,a as LKRPUnauthorizedError,c as LKRPUnhandledState};
|
|
2
|
+
//# sourceMappingURL=Errors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/app-binder/Errors.ts"],
|
|
4
|
+
"sourcesContent": ["import { GeneralDmkError } from \"@ledgerhq/device-management-kit\";\n\nexport class LKRPHttpRequestError extends GeneralDmkError {\n override _tag = \"LKRPHttpRequestError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPUnauthorizedError extends LKRPHttpRequestError {\n override _tag = \"LKRPUnauthorizedError\";\n constructor(override err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPParsingError extends GeneralDmkError {\n override readonly _tag = \"LKRPParsingError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPMissingDataError extends GeneralDmkError {\n override readonly _tag = \"LKRPMissingDataError\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n\nexport class LKRPUnhandledState extends GeneralDmkError {\n override readonly _tag = \"LKRPUnhandledState\";\n constructor(readonly err?: unknown) {\n super(err);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,mBAAAA,MAAuB,kCAEzB,MAAMC,UAA6BD,CAAgB,CAExD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHS,KAAO,sBAIlB,CAEO,MAAMC,UAA8BF,CAAqB,CAE9D,YAAqBC,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHS,KAAO,uBAIlB,CAEO,MAAME,UAAyBJ,CAAgB,CAEpD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,kBAI3B,CAEO,MAAMG,UAA6BL,CAAgB,CAExD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,sBAI3B,CAEO,MAAMI,UAA2BN,CAAgB,CAEtD,YAAqBE,EAAe,CAClC,MAAMA,CAAG,EADU,SAAAA,CAErB,CAHkB,KAAO,oBAI3B",
|
|
6
|
+
"names": ["GeneralDmkError", "LKRPHttpRequestError", "err", "LKRPUnauthorizedError", "LKRPParsingError", "LKRPMissingDataError", "LKRPUnhandledState"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=GetAppNameCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=GetSeedIdCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=GetVersionCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=GetVersionDeviceActionTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=InitCommandTypes.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{getPublicKey as i,getSharedSecret as y,signAsync as a}from"@noble/secp256k1";import{CryptoUtils as n}from"../../internal/utils/crypto";import{bytesToHex as o}from"../../internal/utils/hex";class u{constructor(r,e=i(r)){this.privateKey=r;this.publicKey=e}pubKeyToU8a(){return this.publicKey}pubKeyToHex(){return o(this.publicKey)}async sign(r){const{r:e,s:t}=await a(r,this.privateKey);return n.derEncode(e,t)}ecdh(r,e=!0){return y(this.privateKey,r,e)}}export{u as KeypairFromBytes};
|
|
2
|
+
//# sourceMappingURL=KeypairFromBytes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/app-binder/KeypairFromBytes.ts"],
|
|
4
|
+
"sourcesContent": ["import { getPublicKey, getSharedSecret, signAsync } from \"@noble/secp256k1\";\n\nimport { type Keypair } from \"@api/index\";\nimport { CryptoUtils } from \"@internal/utils/crypto\";\nimport { bytesToHex } from \"@internal/utils/hex\";\n\nexport class KeypairFromBytes implements Keypair {\n constructor(\n private readonly privateKey: Uint8Array,\n private readonly publicKey = getPublicKey(privateKey),\n ) {}\n\n pubKeyToU8a(): Uint8Array {\n return this.publicKey;\n }\n\n pubKeyToHex(): string {\n return bytesToHex(this.publicKey);\n }\n\n async sign(message: Uint8Array): Promise<Uint8Array> {\n const { r, s } = await signAsync(message, this.privateKey);\n return CryptoUtils.derEncode(r, s);\n }\n\n ecdh(publicKey: Uint8Array, isCompressed = true): Uint8Array {\n return getSharedSecret(this.privateKey, publicKey, isCompressed);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,gBAAAA,EAAc,mBAAAC,EAAiB,aAAAC,MAAiB,mBAGzD,OAAS,eAAAC,MAAmB,yBAC5B,OAAS,cAAAC,MAAkB,sBAEpB,MAAMC,CAAoC,CAC/C,YACmBC,EACAC,EAAYP,EAAaM,CAAU,EACpD,CAFiB,gBAAAA,EACA,eAAAC,CAChB,CAEH,aAA0B,CACxB,OAAO,KAAK,SACd,CAEA,aAAsB,CACpB,OAAOH,EAAW,KAAK,SAAS,CAClC,CAEA,MAAM,KAAKI,EAA0C,CACnD,KAAM,CAAE,EAAAC,EAAG,EAAAC,CAAE,EAAI,MAAMR,EAAUM,EAAS,KAAK,UAAU,EACzD,OAAOL,EAAY,UAAUM,EAAGC,CAAC,CACnC,CAEA,KAAKH,EAAuBI,EAAe,GAAkB,CAC3D,OAAOV,EAAgB,KAAK,WAAYM,EAAWI,CAAY,CACjE,CACF",
|
|
6
|
+
"names": ["getPublicKey", "getSharedSecret", "signAsync", "CryptoUtils", "bytesToHex", "KeypairFromBytes", "privateKey", "publicKey", "message", "r", "s", "isCompressed"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/api/app-binder/LKRPTypes.ts"],
|
|
4
|
+
"sourcesContent": ["export interface Keypair {\n pubKeyToU8a(): Uint8Array;\n pubKeyToHex(): string;\n sign(message: Uint8Array): Promise<Uint8Array>;\n ecdh(publicKey: Uint8Array): Uint8Array;\n}\n\nexport type JWT = {\n access_token: string;\n permissions: {\n [trustchainId: string]: {\n [path: string]: string[];\n };\n };\n};\n\n/**\n * https://ledgerhq.atlassian.net/wiki/spaces/TA/pages/5865144361/ARCH+LKRP+-+v2+specifications#Member-permissions\n */\nexport enum Permissions {\n OWNER = 0xffffffff, // Owners of the stream have access to everything\n CAN_ENCRYPT = 1, // The member can have access to the stream private key\n CAN_DERIVE = 1 << 1, // The member can have access to the stream chain code (if a member have access to the private key and the chain code it is able to derive sub-streams)\n CAN_ADD_BLOCK = 1 << 2, // The member is authorized to issue blocks in the current stream\n}\n"],
|
|
5
|
+
"mappings": "AAmBO,IAAKA,OACVA,IAAA,MAAQ,YAAR,QACAA,IAAA,YAAc,GAAd,cACAA,IAAA,WAAa,GAAb,aACAA,IAAA,cAAgB,GAAhB,gBAJUA,OAAA",
|
|
6
|
+
"names": ["Permissions"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=ParseStreamBlockCommandCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=ParseStreamBlockHeaderCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=ParseStreamBlockSignatureTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SetTrustedMemberTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SignBlockCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SignBlockHeaderCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SignBlockSignatureCommandTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=SignBlockSingleCommandTypes.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export*from"./app-binder/AuthenticateDeviceActionTypes";export*from"./app-binder/KeypairFromBytes";export*from"./app-binder/LKRPTypes";export*from"./LedgerKeyringProtocol";export*from"./LedgerKeyringProtocolBuilder";export*from"../internal/externalTypes";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/api/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from \"./app-binder/AuthenticateDeviceActionTypes\";\nexport * from \"./app-binder/KeypairFromBytes\";\nexport * from \"./app-binder/LKRPTypes\";\nexport * from \"@api/LedgerKeyringProtocol\";\nexport * from \"@api/LedgerKeyringProtocolBuilder\";\nexport * from \"@internal/externalTypes\";\n"],
|
|
5
|
+
"mappings": "AAAA,WAAc,6CACd,WAAc,gCACd,WAAc,yBACd,WAAc,6BACd,WAAc,oCACd,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/lib/esm/index.js
ADDED