@ledgerhq/device-management-kit 0.6.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -3
- package/lib/cjs/package.json +23 -23
- package/lib/cjs/src/api/DeviceManagementKit.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.js.map +3 -3
- package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.test.js.map +3 -3
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKitBuilder.js.map +2 -2
- package/lib/cjs/src/api/DmkConfig.js +1 -1
- package/lib/cjs/src/api/DmkConfig.js.map +1 -1
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js +1 -1
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.js.map +3 -3
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js +1 -1
- package/lib/cjs/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js +2 -0
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
- package/lib/cjs/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/cjs/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js +1 -1
- package/lib/cjs/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
- package/lib/cjs/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +3 -3
- package/lib/cjs/src/api/device-action/DeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/DeviceAction.js.map +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/cjs/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/Errors.js +1 -1
- package/lib/cjs/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js +2 -0
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
- package/lib/cjs/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
- package/lib/cjs/src/api/device-model/model/DeviceModel.js +1 -1
- package/lib/cjs/src/api/device-model/model/DeviceModel.js.map +2 -2
- package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js +1 -1
- package/lib/cjs/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
- package/lib/cjs/src/api/device-session/DeviceSessionState.js +1 -1
- package/lib/cjs/src/api/device-session/DeviceSessionState.js.map +2 -2
- package/lib/cjs/src/api/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/transport/model/DeviceApduSender.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceApduSender.js.map +7 -0
- package/lib/cjs/src/api/transport/model/DeviceConnection.js +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnection.js.map +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
- package/lib/cjs/src/api/transport/model/DiscoveredDevice.js.map +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js +1 -1
- package/lib/cjs/src/api/transport/model/Errors.js.map +3 -3
- package/lib/cjs/src/api/transport/model/Transport.js.map +1 -1
- package/lib/cjs/src/api/types.js +1 -1
- package/lib/cjs/src/api/types.js.map +1 -1
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +2 -2
- package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js +1 -1
- package/lib/cjs/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DevicePinger.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
- package/lib/cjs/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +3 -3
- package/lib/cjs/src/internal/device-session/model/Frame.js +1 -1
- package/lib/cjs/src/internal/device-session/model/Frame.js.map +3 -3
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
- package/lib/cjs/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
- package/lib/cjs/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDataSource.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
- package/lib/cjs/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js +1 -1
- package/lib/cjs/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
- package/lib/cjs/src/internal/manager-api/model/Application.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Application.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/model/Const.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Const.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/model/Firmware.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Firmware.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/model/Language.js +2 -0
- package/lib/cjs/src/internal/manager-api/model/Language.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/model/Params.js +1 -1
- package/lib/cjs/src/internal/manager-api/model/Params.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js +1 -1
- package/lib/cjs/src/internal/manager-api/service/ManagerApiService.js.map +1 -1
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
- package/lib/cjs/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js +1 -1
- package/lib/cjs/src/internal/secure-channel/service/SecureChannelService.js.map +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/cjs/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/cjs/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/cjs/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/cjs/src/internal/transport/service/DefaultTransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/DefaultTransportService.js.map +3 -3
- package/lib/cjs/src/internal/transport/service/TransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/TransportService.js.map +1 -1
- package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
- package/lib/cjs/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
- package/lib/esm/package.json +23 -23
- package/lib/esm/src/api/DeviceManagementKit.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.js.map +3 -3
- package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.test.js.map +3 -3
- package/lib/esm/src/api/DeviceManagementKitBuilder.js +1 -1
- package/lib/esm/src/api/DeviceManagementKitBuilder.js.map +3 -3
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js +2 -0
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/GetCustomImageSizeCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js +1 -1
- package/lib/esm/src/api/command/os/GetOsVersionCommand.js.map +3 -3
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js +1 -1
- package/lib/esm/src/api/command/os/GetOsVersionCommand.test.js.map +3 -3
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.js +2 -0
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.js.map +7 -0
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js +2 -0
- package/lib/esm/src/api/command/os/ListLanguagePackCommand.test.js.map +7 -0
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js +1 -1
- package/lib/esm/src/api/command/os/__mocks__/GetOsVersionCommand.js.map +2 -2
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.js +1 -1
- package/lib/esm/src/api/command/use-case/SendCommandUseCase.js.map +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.js.map +3 -3
- package/lib/esm/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/esm/src/api/command/utils/CommandUtils.test.js.map +3 -3
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/makeInternalApi.js.map +3 -3
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js +1 -1
- package/lib/esm/src/api/device-action/__test-utils__/setupTestMachine.js.map +3 -3
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.test.js.map +2 -2
- package/lib/esm/src/api/device-action/os/Errors.js +1 -1
- package/lib/esm/src/api/device-action/os/Errors.js.map +3 -3
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js +1 -0
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.test.js.map +2 -2
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -0
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/ListApps/ListAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +2 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +7 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js +2 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.js.map +7 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js +1 -0
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/types.js.map +7 -0
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.test.js.map +2 -2
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js +2 -0
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js +2 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/GetApplicationsMetadataTask.test.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js +2 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/GetFirmwareMetadataTask.test.js.map +7 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js +2 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.js.map +7 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js +2 -0
- package/lib/esm/src/api/device-action/task/PredictOutOfMemoryTask.test.js.map +7 -0
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js +1 -1
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.js.map +2 -2
- package/lib/esm/src/api/device-model/model/DeviceModel.js +1 -1
- package/lib/esm/src/api/device-model/model/DeviceModel.js.map +2 -2
- package/lib/esm/src/api/device-model/model/DeviceModel.stub.js +1 -1
- package/lib/esm/src/api/device-model/model/DeviceModel.stub.js.map +2 -2
- package/lib/esm/src/api/device-session/DeviceSessionState.js +1 -1
- package/lib/esm/src/api/device-session/DeviceSessionState.js.map +2 -2
- package/lib/esm/src/api/index.js +1 -1
- package/lib/esm/src/api/index.js.map +3 -3
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/transport/model/DeviceApduSender.js +1 -0
- package/lib/esm/src/api/transport/model/DeviceApduSender.js.map +7 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +2 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +7 -0
- package/lib/esm/src/api/transport/model/Errors.js +1 -1
- package/lib/esm/src/api/transport/model/Errors.js.map +3 -3
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +3 -3
- package/lib/esm/src/internal/device-session/data/ApduResponseConst.js +1 -1
- package/lib/esm/src/internal/device-session/data/ApduResponseConst.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DevicePinger.js +1 -1
- package/lib/esm/src/internal/device-session/model/DevicePinger.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSession.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSession.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js +1 -1
- package/lib/esm/src/internal/device-session/model/DeviceSessionStateHandler.test.js.map +3 -3
- package/lib/esm/src/internal/device-session/model/Frame.js +1 -1
- package/lib/esm/src/internal/device-session/model/Frame.js.map +3 -3
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.js.map +2 -2
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.js.map +3 -3
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js +1 -1
- package/lib/esm/src/internal/device-session/use-case/CloseSessionsUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/DisconnectUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StartDiscoveringUseCase.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.js.map +3 -3
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js +1 -1
- package/lib/esm/src/internal/discovery/use-case/StopDiscoveringUseCase.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js +1 -1
- package/lib/esm/src/internal/manager-api/data/AxiosManagerApiDataSource.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js +1 -1
- package/lib/esm/src/internal/manager-api/data/ManagerApiDto.js.map +1 -1
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js +1 -1
- package/lib/esm/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.js.map +2 -2
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.js.map +3 -3
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiModule.test.js.map +2 -2
- package/lib/esm/src/internal/manager-api/di/managerApiTypes.js +1 -1
- package/lib/esm/src/internal/manager-api/di/managerApiTypes.js.map +2 -2
- package/lib/esm/src/internal/manager-api/model/Application.js +1 -1
- package/lib/esm/src/internal/manager-api/model/Application.js.map +1 -1
- package/lib/esm/src/internal/manager-api/model/Const.js +1 -1
- package/lib/esm/src/internal/manager-api/model/Const.js.map +3 -3
- package/lib/esm/src/internal/manager-api/model/Language.js +1 -0
- package/lib/esm/src/internal/manager-api/model/Language.js.map +7 -0
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.js.map +3 -3
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js +1 -1
- package/lib/esm/src/internal/manager-api/service/DefaultManagerApiService.test.js.map +3 -3
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js +2 -0
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.js.map +7 -0
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js +2 -0
- package/lib/esm/src/internal/manager-api/use-case/SetProviderUseCase.test.js.map +7 -0
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/service/DefaultSecureChannelService.test.js.map +3 -3
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js +1 -1
- package/lib/esm/src/internal/send/use-case/SendApduUseCase.js.map +3 -3
- package/lib/esm/src/internal/transport/di/transportModule.test.js +1 -1
- package/lib/esm/src/internal/transport/di/transportModule.test.js.map +2 -2
- package/lib/esm/src/internal/transport/service/DefaultTransportService.js +1 -1
- package/lib/esm/src/internal/transport/service/DefaultTransportService.js.map +3 -3
- package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js +1 -1
- package/lib/esm/src/internal/transport/service/__mocks__/DefaultTransportService.js.map +2 -2
- package/lib/types/src/api/DeviceManagementKit.d.ts +11 -1
- package/lib/types/src/api/DeviceManagementKit.d.ts.map +1 -1
- package/lib/types/src/api/DeviceManagementKitBuilder.d.ts.map +1 -1
- package/lib/types/src/api/DmkConfig.d.ts +2 -0
- package/lib/types/src/api/DmkConfig.d.ts.map +1 -1
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts +16 -0
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/GetCustomImageSizeCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts +30 -2
- package/lib/types/src/api/command/os/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts +24 -0
- package/lib/types/src/api/command/os/ListLanguagePackCommand.d.ts.map +1 -0
- package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts +2 -0
- package/lib/types/src/api/command/os/ListLanguagePackCommand.test.d.ts.map +1 -0
- package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts +5 -1
- package/lib/types/src/api/command/use-case/SendCommandUseCase.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandUtils.d.ts +1 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts +3 -1
- package/lib/types/src/api/device-action/DeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/makeInternalApi.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts +5 -0
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts +1 -0
- package/lib/types/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/Errors.d.ts +10 -0
- package/lib/types/src/api/device-action/os/Errors.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts +58 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +27 -0
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts +3 -4
- package/lib/types/src/api/device-action/os/GoToDashboard/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts +40 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +64 -0
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts +15 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts +2 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +25 -0
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -0
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts +1 -0
- package/lib/types/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.d.ts.map +1 -1
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts +30 -0
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts +31 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/GetApplicationsMetadataTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts +18 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/GetFirmwareMetadataTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts +21 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.d.ts.map +1 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts +2 -0
- package/lib/types/src/api/device-action/task/PredictOutOfMemoryTask.test.d.ts.map +1 -0
- package/lib/types/src/api/device-model/data/StaticDeviceModelDataSource.d.ts.map +1 -1
- package/lib/types/src/api/device-model/model/DeviceModel.d.ts +2 -0
- package/lib/types/src/api/device-model/model/DeviceModel.d.ts.map +1 -1
- package/lib/types/src/api/device-model/model/DeviceModel.stub.d.ts.map +1 -1
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts +93 -0
- package/lib/types/src/api/device-session/DeviceSessionState.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +6 -1
- package/lib/types/src/api/index.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/GenuineCheckDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/InstallAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/ListInstalledAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/UninstallAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceApduSender.d.ts +17 -0
- package/lib/types/src/api/transport/model/DeviceApduSender.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DeviceConnection.d.ts +2 -1
- package/lib/types/src/api/transport/model/DeviceConnection.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +62 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts +1 -1
- package/lib/types/src/api/transport/model/DiscoveredDevice.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Errors.d.ts +22 -3
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/Transport.d.ts +1 -1
- package/lib/types/src/api/transport/model/Transport.d.ts.map +1 -1
- package/lib/types/src/api/types.d.ts +6 -2
- package/lib/types/src/api/types.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts +1 -0
- package/lib/types/src/internal/device-session/data/ApduResponseConst.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DevicePinger.d.ts +1 -1
- package/lib/types/src/internal/device-session/model/DevicePinger.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts +3 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSessionStateHandler.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/Frame.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts +3 -1
- package/lib/types/src/internal/device-session/use-case/CloseSessionsUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts +1 -1
- package/lib/types/src/internal/discovery/use-case/ListenToAvailableDevicesUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts +1 -1
- package/lib/types/src/internal/discovery/use-case/StartDiscoveringUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts +4 -2
- package/lib/types/src/internal/discovery/use-case/StopDiscoveringUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts +24 -5
- package/lib/types/src/internal/manager-api/data/AxiosManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts +51 -6
- package/lib/types/src/internal/manager-api/data/ManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts +104 -18
- package/lib/types/src/internal/manager-api/data/ManagerApiDto.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts +7 -0
- package/lib/types/src/internal/manager-api/data/__mocks__/AxiosManagerApiDataSource.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts +1 -0
- package/lib/types/src/internal/manager-api/di/managerApiTypes.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Application.d.ts +12 -12
- package/lib/types/src/internal/manager-api/model/Application.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Const.d.ts +2 -0
- package/lib/types/src/internal/manager-api/model/Const.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts +17 -3
- package/lib/types/src/internal/manager-api/model/Firmware.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/model/Language.d.ts +12 -0
- package/lib/types/src/internal/manager-api/model/Language.d.ts.map +1 -0
- package/lib/types/src/internal/manager-api/model/Params.d.ts +20 -6
- package/lib/types/src/internal/manager-api/model/Params.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts +9 -3
- package/lib/types/src/internal/manager-api/service/DefaultManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts +42 -7
- package/lib/types/src/internal/manager-api/service/ManagerApiService.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts +13 -0
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.d.ts.map +1 -0
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts +2 -0
- package/lib/types/src/internal/manager-api/use-case/SetProviderUseCase.test.d.ts.map +1 -0
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts +2 -2
- package/lib/types/src/internal/secure-channel/service/DefaultSecureChannelService.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts +3 -3
- package/lib/types/src/internal/secure-channel/service/SecureChannelService.d.ts.map +1 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts +5 -1
- package/lib/types/src/internal/send/use-case/SendApduUseCase.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts +2 -0
- package/lib/types/src/internal/transport/service/DefaultTransportService.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/TransportService.d.ts +3 -1
- package/lib/types/src/internal/transport/service/TransportService.d.ts.map +1 -1
- package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts +1 -0
- package/lib/types/src/internal/transport/service/__mocks__/DefaultTransportService.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +15 -15
package/README.md
CHANGED
@@ -7,9 +7,9 @@
|
|
7
7
|
- [Description](#description)
|
8
8
|
- [Installation](#installation)
|
9
9
|
- [Usage](#usage)
|
10
|
-
- [
|
10
|
+
- [Prerequisites](#prerequisites)
|
11
11
|
- [Main Features](#main-features)
|
12
|
-
- [Setting up the
|
12
|
+
- [Setting up the Device Management Kit](#setting-up-the-device-management-kit)
|
13
13
|
- [Connecting to a Device](#connecting-to-a-device)
|
14
14
|
- [Sending an APDU](#sending-an-apdu)
|
15
15
|
- [Sending a Pre-defined Command](#sending-a-pre-defined-command)
|
@@ -36,7 +36,7 @@ npm install @ledgerhq/device-management-kit
|
|
36
36
|
|
37
37
|
## Usage
|
38
38
|
|
39
|
-
###
|
39
|
+
### Prerequisites
|
40
40
|
|
41
41
|
Some of the APIs exposed return objects of type `Observable` from RxJS. Ensure you are familiar with the basics of the Observer pattern and RxJS before using this Device Management Kit. You can refer to [RxJS documentation](https://rxjs.dev/guide/overview) for more information.
|
42
42
|
|
@@ -80,6 +80,40 @@ export const sdk = new DeviceManagementKitBuilder()
|
|
80
80
|
.build();
|
81
81
|
```
|
82
82
|
|
83
|
+
### Add a custom Manager API Provider
|
84
|
+
|
85
|
+
Custom providers can be set in two ways:
|
86
|
+
|
87
|
+
- At build time:
|
88
|
+
|
89
|
+
```ts
|
90
|
+
import {
|
91
|
+
ConsoleLogger,
|
92
|
+
DeviceManagementKitBuilder,
|
93
|
+
} from "@ledgerhq/device-management-kit";
|
94
|
+
import { webHidTransportFactory } from "@ledgerhq/device-transport-kit-web-hid";
|
95
|
+
|
96
|
+
export const sdk = new DeviceManagementKitBuilder()
|
97
|
+
.addLogger(new ConsoleLogger())
|
98
|
+
.addTransport(webHidTransportFactory)
|
99
|
+
.addConfig({ provider: 123 }) // using provider key in the addConfig obj
|
100
|
+
.build();
|
101
|
+
```
|
102
|
+
|
103
|
+
- At runtime:
|
104
|
+
|
105
|
+
```ts
|
106
|
+
dmk.setProvider(123); // using the setProvider from DMK
|
107
|
+
```
|
108
|
+
|
109
|
+
### Get the current provider
|
110
|
+
|
111
|
+
getProvider function will return the current provider set within the Device Management Kit, whether it has been set at build or run time:
|
112
|
+
|
113
|
+
```ts
|
114
|
+
dmk.getProvider();
|
115
|
+
```
|
116
|
+
|
83
117
|
### Connecting to a Device
|
84
118
|
|
85
119
|
There are two steps to connecting to a device:
|
@@ -204,6 +238,9 @@ import { OpenAppCommand } from "@ledgerhq/device-management-kit";
|
|
204
238
|
const command = new OpenAppCommand("Bitcoin"); // Open the Bitcoin app
|
205
239
|
|
206
240
|
await dmk.sendCommand({ sessionId, command });
|
241
|
+
|
242
|
+
// Or with a timeout
|
243
|
+
await dmk.sendCommand({ sessionId, command, abortTimeout: 2000 });
|
207
244
|
```
|
208
245
|
|
209
246
|
#### Close App
|
package/lib/cjs/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ledgerhq/device-management-kit",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.7.0",
|
4
4
|
"private": false,
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"exports": {
|
@@ -16,9 +16,9 @@
|
|
16
16
|
],
|
17
17
|
"scripts": {
|
18
18
|
"prebuild": "rimraf lib",
|
19
|
-
"build": "pnpm
|
19
|
+
"build": "pnpm ldmk-tool build --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
20
20
|
"dev": "concurrently \"pnpm watch:builds\" \"pnpm watch:types\"",
|
21
|
-
"watch:builds": "pnpm
|
21
|
+
"watch:builds": "pnpm ldmk-tool watch --entryPoints index.ts,src/**/*.ts --tsconfig tsconfig.prod.json",
|
22
22
|
"watch:types": "concurrently \"tsc --watch -p tsconfig.prod.json\" \"tsc-alias --watch -p tsconfig.prod.json\"",
|
23
23
|
"lint": "eslint",
|
24
24
|
"lint:fix": "pnpm lint --fix",
|
@@ -32,33 +32,33 @@
|
|
32
32
|
"module:create": "pnpm hygen core-module with-prompt"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@sentry/minimal": "
|
36
|
-
"axios": "
|
37
|
-
"inversify": "
|
38
|
-
"inversify-logger-middleware": "
|
39
|
-
"isomorphic-ws": "
|
40
|
-
"purify-ts": "
|
41
|
-
"reflect-metadata": "
|
42
|
-
"semver": "
|
43
|
-
"url": "
|
44
|
-
"uuid": "
|
45
|
-
"ws": "
|
46
|
-
"xstate": "
|
35
|
+
"@sentry/minimal": "catalog:",
|
36
|
+
"axios": "catalog:",
|
37
|
+
"inversify": "catalog:",
|
38
|
+
"inversify-logger-middleware": "catalog:",
|
39
|
+
"isomorphic-ws": "catalog:",
|
40
|
+
"purify-ts": "catalog:",
|
41
|
+
"reflect-metadata": "catalog:",
|
42
|
+
"semver": "catalog:",
|
43
|
+
"url": "catalog:",
|
44
|
+
"uuid": "catalog:",
|
45
|
+
"ws": "catalog:",
|
46
|
+
"xstate": "catalog:"
|
47
47
|
},
|
48
48
|
"peerDependencies": {
|
49
|
-
"rxjs": "
|
49
|
+
"rxjs": "catalog:"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
52
|
-
"@ledgerhq/
|
52
|
+
"@ledgerhq/ldmk-tool": "workspace:*",
|
53
53
|
"@ledgerhq/eslint-config-dsdk": "workspace:*",
|
54
54
|
"@ledgerhq/prettier-config-dsdk": "workspace:*",
|
55
55
|
"@ledgerhq/tsconfig-dsdk": "workspace:*",
|
56
56
|
"@ledgerhq/vitest-config-dmk": "workspace:*",
|
57
|
-
"@statelyai/inspect": "
|
58
|
-
"@types/semver": "
|
59
|
-
"@types/uuid": "
|
60
|
-
"@types/ws": "
|
61
|
-
"rxjs": "
|
62
|
-
"ts-node": "
|
57
|
+
"@statelyai/inspect": "catalog:",
|
58
|
+
"@types/semver": "catalog:",
|
59
|
+
"@types/uuid": "catalog:",
|
60
|
+
"@types/ws": "catalog:",
|
61
|
+
"rxjs": "catalog:",
|
62
|
+
"ts-node": "catalog:"
|
63
63
|
}
|
64
64
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var
|
1
|
+
"use strict";var c=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var g=(t,e)=>{for(var i in e)c(t,i,{get:e[i],enumerable:!0})},y=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of u(e))!U.call(t,r)&&r!==i&&c(t,r,{get:()=>e[r],enumerable:!(o=D(e,r))||o.enumerable});return t};var S=t=>y(c({},"__esModule",{value:!0}),t);var l={};g(l,{DeviceManagementKit:()=>A});module.exports=S(l);var p=require("./command/di/commandTypes"),m=require("../internal/config/di/configTypes"),n=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),a=require("../internal/manager-api/di/managerApiTypes"),C=require("../internal/send/di/sendTypes"),v=require("../../src/di"),d=require("./device-action/di/deviceActionTypes");class A{container;constructor({stub:e,transports:i,loggers:o,config:r}={}){this.container=(0,v.makeContainer)({stub:e,transports:i,loggers:o,config:r})}getVersion(){return this.container.get(m.configTypes.GetDmkVersionUseCase).getDmkVersion()}startDiscovering(e){return this.container.get(s.discoveryTypes.StartDiscoveringUseCase).execute(e)}stopDiscovering(){return this.container.get(s.discoveryTypes.StopDiscoveringUseCase).execute()}listenToAvailableDevices(e){return this.container.get(s.discoveryTypes.ListenToAvailableDevicesUseCase).execute(e)}connect(e){return this.container.get(s.discoveryTypes.ConnectUseCase).execute(e)}disconnect(e){return this.container.get(s.discoveryTypes.DisconnectUseCase).execute(e)}sendApdu(e){return this.container.get(C.sendTypes.SendApduUseCase).execute(e)}sendCommand(e){return this.container.get(p.commandTypes.SendCommandUseCase).execute(e)}executeDeviceAction(e){return this.container.get(d.deviceActionTypes.ExecuteDeviceActionUseCase).execute(e)}getConnectedDevice(e){return this.container.get(s.discoveryTypes.GetConnectedDeviceUseCase).execute(e)}getDeviceSessionState(e){return this.container.get(n.deviceSessionTypes.GetDeviceSessionStateUseCase).execute(e)}close(){return this.container.get(n.deviceSessionTypes.CloseSessionsUseCase).execute()}listConnectedDevices(){return this.container.get(s.discoveryTypes.ListConnectedDevicesUseCase).execute()}listenToConnectedDevice(){return this.container.get(s.discoveryTypes.ListenToConnectedDeviceUseCase).execute()}disableDeviceSessionRefresher(e){return this.container.get(n.deviceSessionTypes.DisableDeviceSessionRefresherUseCase).execute(e)}setProvider(e){return this.container.get(a.managerApiTypes.SetProviderUseCase).execute(e)}getProvider(){return this.container.get(a.managerApiTypes.ManagerApiDataSource).getProvider()}}0&&(module.exports={DeviceManagementKit});
|
2
2
|
//# sourceMappingURL=DeviceManagementKit.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/api/DeviceManagementKit.ts"],
|
4
|
-
"sourcesContent": ["import { type Container } from \"inversify\";\nimport { type Observable } from \"rxjs\";\n\nimport { commandTypes } from \"@api/command/di/commandTypes\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type SendCommandUseCase,\n type SendCommandUseCaseArgs,\n} from \"@api/command/use-case/SendCommandUseCase\";\nimport {\n type ExecuteDeviceActionUseCase,\n type ExecuteDeviceActionUseCaseArgs,\n} from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport {\n type ConnectUseCaseArgs,\n type DisconnectUseCaseArgs,\n type DiscoveredDevice,\n type GetConnectedDeviceUseCaseArgs,\n type SendApduUseCaseArgs,\n type StartDiscoveringUseCaseArgs,\n} from \"@api/types\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { type GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { type CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { type GetDeviceSessionStateUseCase } from \"@internal/device-session/use-case/GetDeviceSessionStateUseCase\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { type ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { type DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { type GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { type ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport {\n type ListenToAvailableDevicesUseCase,\n type ListenToAvailableDevicesUseCaseArgs,\n} from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { type ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport type { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport type { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport { type SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { makeContainer, type MakeContainerProps } from \"@root/src/di\";\n\nimport {\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"./device-action/DeviceAction\";\nimport { deviceActionTypes } from \"./device-action/di/deviceActionTypes\";\nimport { type DisableDeviceSessionRefresherUseCase } from \"./device-session/use-case/DisableDeviceSessionRefresher\";\nimport { type DmkError } from \"./Error\";\n\n/**\n * The main class to interact with the Device Management Kit.\n *\n * NB: do not instantiate this class directly, instead, use `LedgerDMKBuilder`.\n */\nexport class DeviceManagementKit {\n readonly container: Container;\n /** @internal */\n constructor({\n stub,\n transports,\n loggers,\n config,\n }: Partial<MakeContainerProps> = {}) {\n // NOTE: MakeContainerProps might not be the exact type here\n // For the init of the project this is sufficient, but we might need to\n // update the constructor arguments as we go (we might have more than just the container config)\n this.container = makeContainer({\n stub,\n transports,\n loggers,\n config,\n });\n }\n\n /**\n * Returns a promise resolving to the version of the SDK.\n */\n getVersion(): Promise<string> {\n return this.container\n .get<GetDmkVersionUseCase>(configTypes.GetDmkVersionUseCase)\n .getDmkVersion();\n }\n\n /**\n * Starts discovering devices connected.\n *\n * For the WeHID implementation, this use-case needs to be called as a result\n * of an user interaction (button \"click\" event for ex).\n *\n * @param {StartDiscoveringUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice>} An observable of discovered devices.\n */\n startDiscovering(\n args: StartDiscoveringUseCaseArgs,\n ): Observable<DiscoveredDevice> {\n return this.container\n .get<StartDiscoveringUseCase>(discoveryTypes.StartDiscoveringUseCase)\n .execute(args);\n }\n\n /**\n * Stops discovering devices connected.\n */\n stopDiscovering() {\n return this.container\n .get<StopDiscoveringUseCase>(discoveryTypes.StopDiscoveringUseCase)\n .execute();\n }\n\n /**\n * Listen to list of known discovered devices (and later BLE).\n * @param {ListenToAvailableDevicesUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice[]>} An observable of known discovered devices.\n */\n listenToAvailableDevices(\n args: ListenToAvailableDevicesUseCaseArgs,\n ): Observable<DiscoveredDevice[]> {\n return this.container\n .get<ListenToAvailableDevicesUseCase>(\n discoveryTypes.ListenToAvailableDevicesUseCase,\n )\n .execute(args);\n }\n\n /**\n * Connects to a device previously discovered with `DeviceManagementKit.startDiscovering`.\n * Creates a new device session which:\n * - Represents the connection to the device.\n * - Is terminated upon disconnection of the device.\n * - Exposes the device state through an observable (see `DeviceManagementKit.getDeviceSessionState`)\n * - Should be used for all subsequent communication with the device.\n *\n * @param {ConnectUseCaseArgs} args - The arguments for connecting to the device.\n * - `device`: The discovered device obtained from `StartDiscoveringUseCase`.\n * - `sessionRefresherOptions` (optional): Configuration for session refreshing.\n * - `isRefresherDisabled`: Whether the refresher is disabled.\n * - `pollingInterval`: The refresh interval in milliseconds\n * @returns The session ID to use for further communication with the device.\n */\n connect(args: ConnectUseCaseArgs): Promise<DeviceSessionId> {\n return this.container\n .get<ConnectUseCase>(discoveryTypes.ConnectUseCase)\n .execute(args);\n }\n\n /**\n * Disconnects to a discovered device.\n *\n * @param {DisconnectUseCaseArgs} args - The session ID to disconnect.\n */\n disconnect(args: DisconnectUseCaseArgs): Promise<void> {\n return this.container\n .get<DisconnectUseCase>(discoveryTypes.DisconnectUseCase)\n .execute(args);\n }\n\n /**\n * Sends an APDU command to a device through a device session.\n *\n * @param {SendApduUseCaseArgs} args - The device session ID and APDU command to send.\n */\n sendApdu(args: SendApduUseCaseArgs): Promise<ApduResponse> {\n return this.container\n .get<SendApduUseCase>(sendTypes.SendApduUseCase)\n .execute(args);\n }\n\n /**\n * Sends a command to a device through a device session.\n *\n * @param {SendCommandUseCaseArgs<Response, Args, ErrorCodes>} args - The device session ID, command, command error codes and command parameters to send.\n * @returns A promise resolving with the response from the command.\n */\n sendCommand<Response, Args, ErrorCodes>(\n args: SendCommandUseCaseArgs<Response, Args, ErrorCodes>,\n ): Promise<CommandResult<Response, ErrorCodes>> {\n return this.container\n .get<SendCommandUseCase>(commandTypes.SendCommandUseCase)\n .execute(args);\n }\n\n executeDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n args: ExecuteDeviceActionUseCaseArgs<\n Output,\n Input,\n Error,\n IntermediateValue\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n return this.container\n .get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n )\n .execute(args);\n }\n\n /**\n * Gets the connected from its device session ID.\n *\n * @param {GetConnectedDeviceUseCaseArgs} args - The device session ID.\n * @returns {ConnectedDevice} The connected device.\n */\n getConnectedDevice(args: GetConnectedDeviceUseCaseArgs): ConnectedDevice {\n return this.container\n .get<GetConnectedDeviceUseCase>(discoveryTypes.GetConnectedDeviceUseCase)\n .execute(args);\n }\n\n /**\n * Gets the device state of a session.\n *\n * @param {{ sessionId: DeviceSessionId }} args - The device session ID.\n * @returns {Observable<DeviceSessionState>} An observable of the session device state.\n */\n getDeviceSessionState(args: {\n sessionId: DeviceSessionId;\n }): Observable<DeviceSessionState> {\n return this.container\n .get<GetDeviceSessionStateUseCase>(\n deviceSessionTypes.GetDeviceSessionStateUseCase,\n )\n .execute(args);\n }\n\n /**\n * Close the Device Management kit.\n *\n */\n close() {\n return this.container\n .get<CloseSessionsUseCase>(deviceSessionTypes.CloseSessionsUseCase)\n .execute();\n }\n\n /**\n * Lists all connected devices.\n *\n * @returns {ConnectedDevice[]} The list of device sessions.\n */\n listConnectedDevices(): ConnectedDevice[] {\n return this.container\n .get<ListConnectedDevicesUseCase>(\n discoveryTypes.ListConnectedDevicesUseCase,\n )\n .execute();\n }\n\n /**\n * Listen to connected device.\n *\n * @returns {Observable<ConnectedDevice>} An observable of connected device.\n */\n listenToConnectedDevice(): Observable<ConnectedDevice> {\n return this.container\n .get<ListenToConnectedDeviceUseCase>(\n discoveryTypes.ListenToConnectedDeviceUseCase,\n )\n .execute();\n }\n\n /**\n * Disable the device session refresher.\n *\n * @param {DisableDeviceSessionRefresherUseCaseArgs} args - The device session ID and a string to identify the blocker.\n * @returns {() => void} A function to reenable the device session refresher.\n */\n disableDeviceSessionRefresher(args: {\n sessionId: DeviceSessionId;\n blockerId: string;\n }) {\n return this.container\n .get<DisableDeviceSessionRefresherUseCase>(\n deviceSessionTypes.DisableDeviceSessionRefresherUseCase,\n )\n .execute(args);\n }\n}\n"],
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAGA,IAAAI,EAA6B,wCAsB7BC,EAA4B,2CAE5BC,EAAmC,0DAGnCC,EAA+B,
|
6
|
-
"names": ["DeviceManagementKit_exports", "__export", "DeviceManagementKit", "__toCommonJS", "import_commandTypes", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_sendTypes", "import_di", "import_deviceActionTypes", "stub", "transports", "loggers", "config", "args"]
|
4
|
+
"sourcesContent": ["import { type Container } from \"inversify\";\nimport { type Observable } from \"rxjs\";\n\nimport { commandTypes } from \"@api/command/di/commandTypes\";\nimport { type CommandResult } from \"@api/command/model/CommandResult\";\nimport {\n type SendCommandUseCase,\n type SendCommandUseCaseArgs,\n} from \"@api/command/use-case/SendCommandUseCase\";\nimport {\n type ExecuteDeviceActionUseCase,\n type ExecuteDeviceActionUseCaseArgs,\n} from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type DeviceSessionState } from \"@api/device-session/DeviceSessionState\";\nimport { type DeviceSessionId } from \"@api/device-session/types\";\nimport { type ConnectedDevice } from \"@api/transport/model/ConnectedDevice\";\nimport {\n type ConnectUseCaseArgs,\n type DisconnectUseCaseArgs,\n type DiscoveredDevice,\n type GetConnectedDeviceUseCaseArgs,\n type SendApduUseCaseArgs,\n type StartDiscoveringUseCaseArgs,\n} from \"@api/types\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { type GetDmkVersionUseCase } from \"@internal/config/use-case/GetDmkVersionUseCase\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { type CloseSessionsUseCase } from \"@internal/device-session/use-case/CloseSessionsUseCase\";\nimport { type GetDeviceSessionStateUseCase } from \"@internal/device-session/use-case/GetDeviceSessionStateUseCase\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { type ConnectUseCase } from \"@internal/discovery/use-case/ConnectUseCase\";\nimport { type DisconnectUseCase } from \"@internal/discovery/use-case/DisconnectUseCase\";\nimport { type GetConnectedDeviceUseCase } from \"@internal/discovery/use-case/GetConnectedDeviceUseCase\";\nimport { type ListConnectedDevicesUseCase } from \"@internal/discovery/use-case/ListConnectedDevicesUseCase\";\nimport {\n type ListenToAvailableDevicesUseCase,\n type ListenToAvailableDevicesUseCaseArgs,\n} from \"@internal/discovery/use-case/ListenToAvailableDevicesUseCase\";\nimport { type ListenToConnectedDeviceUseCase } from \"@internal/discovery/use-case/ListenToConnectedDeviceUseCase\";\nimport type { StartDiscoveringUseCase } from \"@internal/discovery/use-case/StartDiscoveringUseCase\";\nimport type { StopDiscoveringUseCase } from \"@internal/discovery/use-case/StopDiscoveringUseCase\";\nimport { type ManagerApiDataSource } from \"@internal/manager-api/data/ManagerApiDataSource\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport { type SetProviderUseCase } from \"@internal/manager-api/use-case/SetProviderUseCase\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport { type SendApduUseCase } from \"@internal/send/use-case/SendApduUseCase\";\nimport { makeContainer, type MakeContainerProps } from \"@root/src/di\";\n\nimport {\n type DeviceActionIntermediateValue,\n type ExecuteDeviceActionReturnType,\n} from \"./device-action/DeviceAction\";\nimport { deviceActionTypes } from \"./device-action/di/deviceActionTypes\";\nimport { type DisableDeviceSessionRefresherUseCase } from \"./device-session/use-case/DisableDeviceSessionRefresher\";\nimport { type DmkError } from \"./Error\";\n\n/**\n * The main class to interact with the Device Management Kit.\n *\n * NB: do not instantiate this class directly, instead, use `LedgerDMKBuilder`.\n */\nexport class DeviceManagementKit {\n readonly container: Container;\n /** @internal */\n constructor({\n stub,\n transports,\n loggers,\n config,\n }: Partial<MakeContainerProps> = {}) {\n // NOTE: MakeContainerProps might not be the exact type here\n // For the init of the project this is sufficient, but we might need to\n // update the constructor arguments as we go (we might have more than just the container config)\n this.container = makeContainer({\n stub,\n transports,\n loggers,\n config,\n });\n }\n\n /**\n * Returns a promise resolving to the version of the SDK.\n */\n getVersion(): Promise<string> {\n return this.container\n .get<GetDmkVersionUseCase>(configTypes.GetDmkVersionUseCase)\n .getDmkVersion();\n }\n\n /**\n * Starts discovering devices connected.\n *\n * For the WeHID implementation, this use-case needs to be called as a result\n * of an user interaction (button \"click\" event for ex).\n *\n * @param {StartDiscoveringUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice>} An observable of discovered devices.\n */\n startDiscovering(\n args: StartDiscoveringUseCaseArgs,\n ): Observable<DiscoveredDevice> {\n return this.container\n .get<StartDiscoveringUseCase>(discoveryTypes.StartDiscoveringUseCase)\n .execute(args);\n }\n\n /**\n * Stops discovering devices connected.\n */\n stopDiscovering() {\n return this.container\n .get<StopDiscoveringUseCase>(discoveryTypes.StopDiscoveringUseCase)\n .execute();\n }\n\n /**\n * Listen to list of known discovered devices (and later BLE).\n * @param {ListenToAvailableDevicesUseCaseArgs} args - The transport to use for discover, or undefined to discover from all transports.\n * @returns {Observable<DiscoveredDevice[]>} An observable of known discovered devices.\n */\n listenToAvailableDevices(\n args: ListenToAvailableDevicesUseCaseArgs,\n ): Observable<DiscoveredDevice[]> {\n return this.container\n .get<ListenToAvailableDevicesUseCase>(\n discoveryTypes.ListenToAvailableDevicesUseCase,\n )\n .execute(args);\n }\n\n /**\n * Connects to a device previously discovered with `DeviceManagementKit.startDiscovering`.\n * Creates a new device session which:\n * - Represents the connection to the device.\n * - Is terminated upon disconnection of the device.\n * - Exposes the device state through an observable (see `DeviceManagementKit.getDeviceSessionState`)\n * - Should be used for all subsequent communication with the device.\n *\n * @param {ConnectUseCaseArgs} args - The arguments for connecting to the device.\n * - `device`: The discovered device obtained from `StartDiscoveringUseCase`.\n * - `sessionRefresherOptions` (optional): Configuration for session refreshing.\n * - `isRefresherDisabled`: Whether the refresher is disabled.\n * - `pollingInterval`: The refresh interval in milliseconds\n * @returns The session ID to use for further communication with the device.\n */\n connect(args: ConnectUseCaseArgs): Promise<DeviceSessionId> {\n return this.container\n .get<ConnectUseCase>(discoveryTypes.ConnectUseCase)\n .execute(args);\n }\n\n /**\n * Disconnects to a discovered device.\n *\n * @param {DisconnectUseCaseArgs} args - The session ID to disconnect.\n */\n disconnect(args: DisconnectUseCaseArgs): Promise<void> {\n return this.container\n .get<DisconnectUseCase>(discoveryTypes.DisconnectUseCase)\n .execute(args);\n }\n\n /**\n * Sends an APDU command to a device through a device session.\n *\n * @param {SendApduUseCaseArgs} args - The device session ID and APDU command to send.\n */\n sendApdu(args: SendApduUseCaseArgs): Promise<ApduResponse> {\n return this.container\n .get<SendApduUseCase>(sendTypes.SendApduUseCase)\n .execute(args);\n }\n\n /**\n * Sends a command to a device through a device session.\n *\n * @param {SendCommandUseCaseArgs<Response, Args, ErrorCodes>} args - The device session ID, command, command error codes and command parameters to send.\n * @returns A promise resolving with the response from the command.\n */\n sendCommand<Response, Args, ErrorCodes>(\n args: SendCommandUseCaseArgs<Response, Args, ErrorCodes>,\n ): Promise<CommandResult<Response, ErrorCodes>> {\n return this.container\n .get<SendCommandUseCase>(commandTypes.SendCommandUseCase)\n .execute(args);\n }\n\n executeDeviceAction<\n Output,\n Input,\n Error extends DmkError,\n IntermediateValue extends DeviceActionIntermediateValue,\n >(\n args: ExecuteDeviceActionUseCaseArgs<\n Output,\n Input,\n Error,\n IntermediateValue\n >,\n ): ExecuteDeviceActionReturnType<Output, Error, IntermediateValue> {\n return this.container\n .get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n )\n .execute(args);\n }\n\n /**\n * Gets the connected from its device session ID.\n *\n * @param {GetConnectedDeviceUseCaseArgs} args - The device session ID.\n * @returns {ConnectedDevice} The connected device.\n */\n getConnectedDevice(args: GetConnectedDeviceUseCaseArgs): ConnectedDevice {\n return this.container\n .get<GetConnectedDeviceUseCase>(discoveryTypes.GetConnectedDeviceUseCase)\n .execute(args);\n }\n\n /**\n * Gets the device state of a session.\n *\n * @param {{ sessionId: DeviceSessionId }} args - The device session ID.\n * @returns {Observable<DeviceSessionState>} An observable of the session device state.\n */\n getDeviceSessionState(args: {\n sessionId: DeviceSessionId;\n }): Observable<DeviceSessionState> {\n return this.container\n .get<GetDeviceSessionStateUseCase>(\n deviceSessionTypes.GetDeviceSessionStateUseCase,\n )\n .execute(args);\n }\n\n /**\n * Close the Device Management kit.\n *\n */\n close() {\n return this.container\n .get<CloseSessionsUseCase>(deviceSessionTypes.CloseSessionsUseCase)\n .execute();\n }\n\n /**\n * Lists all connected devices.\n *\n * @returns {ConnectedDevice[]} The list of device sessions.\n */\n listConnectedDevices(): ConnectedDevice[] {\n return this.container\n .get<ListConnectedDevicesUseCase>(\n discoveryTypes.ListConnectedDevicesUseCase,\n )\n .execute();\n }\n\n /**\n * Listen to connected device.\n *\n * @returns {Observable<ConnectedDevice>} An observable of connected device.\n */\n listenToConnectedDevice(): Observable<ConnectedDevice> {\n return this.container\n .get<ListenToConnectedDeviceUseCase>(\n discoveryTypes.ListenToConnectedDeviceUseCase,\n )\n .execute();\n }\n\n /**\n * Disable the device session refresher.\n *\n * @param {DisableDeviceSessionRefresherUseCaseArgs} args - The device session ID and a string to identify the blocker.\n * @returns {() => void} A function to reenable the device session refresher.\n */\n disableDeviceSessionRefresher(args: {\n sessionId: DeviceSessionId;\n blockerId: string;\n }): () => void {\n return this.container\n .get<DisableDeviceSessionRefresherUseCase>(\n deviceSessionTypes.DisableDeviceSessionRefresherUseCase,\n )\n .execute(args);\n }\n /**\n * Sets the provider for the manager API.\n *\n * @param {number} provider - The provider to set.\n */\n setProvider(provider: number): void {\n return this.container\n .get<SetProviderUseCase>(managerApiTypes.SetProviderUseCase)\n .execute(provider);\n }\n\n /**\n * Returns the current provider value from the manager API data source.\n */\n getProvider(): number {\n return this.container\n .get<ManagerApiDataSource>(managerApiTypes.ManagerApiDataSource)\n .getProvider();\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,GAGA,IAAAI,EAA6B,wCAsB7BC,EAA4B,2CAE5BC,EAAmC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EACC,QAAQA,CAAI,CACjB,CAMA,OAAQ,CACN,OAAO,KAAK,UACT,IAA0B,qBAAmB,oBAAoB,EACjE,QAAQ,CACb,CAOA,sBAA0C,CACxC,OAAO,KAAK,UACT,IACC,iBAAe,2BACjB,EACC,QAAQ,CACb,CAOA,yBAAuD,CACrD,OAAO,KAAK,UACT,IACC,iBAAe,8BACjB,EACC,QAAQ,CACb,CAQA,8BAA8BA,EAGf,CACb,OAAO,KAAK,UACT,IACC,qBAAmB,oCACrB,EACC,QAAQA,CAAI,CACjB,CAMA,YAAYC,EAAwB,CAClC,OAAO,KAAK,UACT,IAAwB,kBAAgB,kBAAkB,EAC1D,QAAQA,CAAQ,CACrB,CAKA,aAAsB,CACpB,OAAO,KAAK,UACT,IAA0B,kBAAgB,oBAAoB,EAC9D,YAAY,CACjB,CACF",
|
6
|
+
"names": ["DeviceManagementKit_exports", "__export", "DeviceManagementKit", "__toCommonJS", "import_commandTypes", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_managerApiTypes", "import_sendTypes", "import_di", "import_deviceActionTypes", "stub", "transports", "loggers", "config", "args", "provider"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var C=Object.create;var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var U=(t,o,i,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of S(o))!x.call(t,n)&&n!==i&&a(t,n,{get:()=>o[n],enumerable:!(r=b(o,n))||r.enumerable});return t};var B=(t,o,i)=>(i=t!=null?C(k(t)):{},U(o||!t||!t.__esModule?a(i,"default",{value:t,enumerable:!0}):i,t));var m=require("../internal/config/data/LocalConfigDataSource.stub"),p=require("../internal/config/di/configTypes"),f=require("../internal/device-session/di/deviceSessionTypes"),s=require("../internal/discovery/di/discoveryTypes"),l=require("../internal/manager-api/di/managerApiTypes"),u=require("../internal/send/di/sendTypes"),h=B(require("../../package.json")),v=require("../../src/di.stub"),D=require("./command/di/commandTypes"),g=require("./logger-subscriber/service/ConsoleLogger"),c=require("./DeviceManagementKit");vi.mock("./logger-subscriber/service/ConsoleLogger");let e,d;describe("DeviceManagementKit",()=>{describe("clean",()=>{beforeEach(()=>{d=new g.ConsoleLogger,e=new c.DeviceManagementKit({stub:!1,loggers:[d],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create an instance",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a clean `version`",async()=>{expect(await e.getVersion()).toBe(h.default.version)}),it("should have startDiscovery method",()=>{expect(e.startDiscovering).toBeDefined()}),it("should have stopDiscovery method",()=>{expect(e.stopDiscovering).toBeDefined()}),it("should have connect method",()=>{expect(e.connect).toBeDefined()}),it("should have sendApdu method",()=>{expect(e.sendApdu).toBeDefined()}),it("should have getConnectedDevice method",()=>{expect(e.getConnectedDevice).toBeDefined()}),it("should have sendCommand method",()=>{expect(e.sendCommand).toBeDefined()}),it("should have listConnectedDevices method",()=>{expect(e.listConnectedDevices).toBeDefined()}),it("should have listenToConnectedDevice method",()=>{expect(e.listenToConnectedDevice).toBeDefined()}),it("should have disableDeviceSessionRefresher method",()=>{expect(e.disableDeviceSessionRefresher).toBeDefined()}),it("should have setProvider method",()=>{expect(e.setProvider).toBeDefined()})}),describe("stubbed",()=>{beforeEach(()=>{e=new c.DeviceManagementKit({stub:!0,loggers:[],config:{managerApiUrl:"http://fake.url",mockUrl:"http://fake-mock.url",webSocketUrl:"http://fake-websocket.url",firmwareDistributionSalt:"salt"}})}),it("should create a stubbed dmk",()=>{expect(e).toBeDefined(),expect(e).toBeInstanceOf(c.DeviceManagementKit)}),it("should return a stubbed config",()=>{expect(e.container.get(p.configTypes.LocalConfigDataSource)).toBeInstanceOf(m.StubLocalConfigDataSource)}),it("should return a stubbed version",async()=>{expect(await e.getVersion()).toBe("0.0.0-stub.1")}),it.each([[s.discoveryTypes.StartDiscoveringUseCase],[s.discoveryTypes.StopDiscoveringUseCase],[s.discoveryTypes.ConnectUseCase],[u.sendTypes.SendApduUseCase],[D.commandTypes.SendCommandUseCase],[s.discoveryTypes.GetConnectedDeviceUseCase],[s.discoveryTypes.DisconnectUseCase],[f.deviceSessionTypes.GetDeviceSessionStateUseCase],[s.discoveryTypes.ListConnectedDevicesUseCase],[s.discoveryTypes.ListenToConnectedDeviceUseCase],[l.managerApiTypes.SetProviderUseCase]])("should have %s use case",t=>{const o=e.container.get(t);expect(o).toBeInstanceOf(v.StubUseCase),expect(o.execute()).toBe("stub")})})});
|
2
2
|
//# sourceMappingURL=DeviceManagementKit.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/api/DeviceManagementKit.test.ts"],
|
4
|
-
"sourcesContent": ["import { type interfaces } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have disableDeviceSessionRefresher method\", () => {\n expect(dmk.disableDeviceSessionRefresher).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n },\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: interfaces.ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>(diSymbol);\n expect(uc).toBeInstanceOf(StubUseCase);\n expect(uc.execute()).toBe(\"stub\");\n },\n );\n });\n});\n"],
|
5
|
-
"mappings": "wdAGA,IAAAA,EAA0C,4DAC1CC,EAA4B,2CAC5BC,EAAmC,0DACnCC,EAA+B,iDAC/BC,EAA0B,uCAC1BC,EAAgB,iCAChBC,EAA4B,6BAE5BC,EAA6B,qCAC7BC,EAA8B,qDAC9BC,EAAoC,
|
6
|
-
"names": ["import_LocalConfigDataSource", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_sendTypes", "import_package", "import_di", "import_commandTypes", "import_ConsoleLogger", "import_DeviceManagementKit", "dmk", "logger", "pkg", "diSymbol", "uc"]
|
4
|
+
"sourcesContent": ["import { type interfaces } from \"inversify\";\n\nimport { type LocalConfigDataSource } from \"@internal/config/data/ConfigDataSource\";\nimport { StubLocalConfigDataSource } from \"@internal/config/data/LocalConfigDataSource.stub\";\nimport { configTypes } from \"@internal/config/di/configTypes\";\nimport { deviceSessionTypes } from \"@internal/device-session/di/deviceSessionTypes\";\nimport { discoveryTypes } from \"@internal/discovery/di/discoveryTypes\";\nimport { managerApiTypes } from \"@internal/manager-api/di/managerApiTypes\";\nimport { sendTypes } from \"@internal/send/di/sendTypes\";\nimport pkg from \"@root/package.json\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandTypes } from \"./command/di/commandTypes\";\nimport { ConsoleLogger } from \"./logger-subscriber/service/ConsoleLogger\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\nvi.mock(\"./logger-subscriber/service/ConsoleLogger\");\n\nlet dmk: DeviceManagementKit;\nlet logger: ConsoleLogger;\ndescribe(\"DeviceManagementKit\", () => {\n describe(\"clean\", () => {\n beforeEach(() => {\n logger = new ConsoleLogger();\n dmk = new DeviceManagementKit({\n stub: false,\n loggers: [logger],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n });\n\n it(\"should create an instance\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a clean `version`\", async () => {\n expect(await dmk.getVersion()).toBe(pkg.version);\n });\n\n it(\"should have startDiscovery method\", () => {\n expect(dmk.startDiscovering).toBeDefined();\n });\n\n it(\"should have stopDiscovery method\", () => {\n expect(dmk.stopDiscovering).toBeDefined();\n });\n\n it(\"should have connect method\", () => {\n expect(dmk.connect).toBeDefined();\n });\n\n it(\"should have sendApdu method\", () => {\n expect(dmk.sendApdu).toBeDefined();\n });\n\n it(\"should have getConnectedDevice method\", () => {\n expect(dmk.getConnectedDevice).toBeDefined();\n });\n\n it(\"should have sendCommand method\", () => {\n expect(dmk.sendCommand).toBeDefined();\n });\n\n it(\"should have listConnectedDevices method\", () => {\n expect(dmk.listConnectedDevices).toBeDefined();\n });\n\n it(\"should have listenToConnectedDevice method\", () => {\n expect(dmk.listenToConnectedDevice).toBeDefined();\n });\n\n it(\"should have disableDeviceSessionRefresher method\", () => {\n expect(dmk.disableDeviceSessionRefresher).toBeDefined();\n });\n\n it(\"should have setProvider method\", () => {\n expect(dmk.setProvider).toBeDefined();\n });\n });\n\n describe(\"stubbed\", () => {\n beforeEach(() => {\n dmk = new DeviceManagementKit({\n stub: true,\n loggers: [],\n config: {\n managerApiUrl: \"http://fake.url\",\n mockUrl: \"http://fake-mock.url\",\n webSocketUrl: \"http://fake-websocket.url\",\n firmwareDistributionSalt: \"salt\",\n } as DmkConfig,\n });\n });\n\n it(\"should create a stubbed dmk\", () => {\n expect(dmk).toBeDefined();\n expect(dmk).toBeInstanceOf(DeviceManagementKit);\n });\n\n it(\"should return a stubbed config\", () => {\n expect(\n dmk.container.get<LocalConfigDataSource>(\n configTypes.LocalConfigDataSource,\n ),\n ).toBeInstanceOf(StubLocalConfigDataSource);\n });\n\n it(\"should return a stubbed version\", async () => {\n expect(await dmk.getVersion()).toBe(\"0.0.0-stub.1\");\n });\n\n it.each([\n [discoveryTypes.StartDiscoveringUseCase],\n [discoveryTypes.StopDiscoveringUseCase],\n [discoveryTypes.ConnectUseCase],\n [sendTypes.SendApduUseCase],\n [commandTypes.SendCommandUseCase],\n [discoveryTypes.GetConnectedDeviceUseCase],\n [discoveryTypes.DisconnectUseCase],\n [deviceSessionTypes.GetDeviceSessionStateUseCase],\n [discoveryTypes.ListConnectedDevicesUseCase],\n [discoveryTypes.ListenToConnectedDeviceUseCase],\n [managerApiTypes.SetProviderUseCase],\n ])(\n \"should have %s use case\",\n (diSymbol: interfaces.ServiceIdentifier<StubUseCase>) => {\n const uc = dmk.container.get<StubUseCase>(diSymbol);\n expect(uc).toBeInstanceOf(StubUseCase);\n expect(uc.execute()).toBe(\"stub\");\n },\n );\n });\n});\n"],
|
5
|
+
"mappings": "wdAGA,IAAAA,EAA0C,4DAC1CC,EAA4B,2CAC5BC,EAAmC,0DACnCC,EAA+B,iDAC/BC,EAAgC,oDAChCC,EAA0B,uCAC1BC,EAAgB,iCAChBC,EAA4B,6BAE5BC,EAA6B,qCAC7BC,EAA8B,qDAC9BC,EAAoC,iCAGpC,GAAG,KAAK,2CAA2C,EAEnD,IAAIC,EACAC,EACJ,SAAS,sBAAuB,IAAM,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ACxB,WAAW,IAAM,CACfA,EAAM,IAAI,sBAAoB,CAC5B,KAAM,GACN,QAAS,CAAC,EACV,OAAQ,CACN,cAAe,kBACf,QAAS,uBACT,aAAc,4BACd,yBAA0B,MAC5B,CACF,CAAC,CACH,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,OAAOA,CAAG,EAAE,YAAY,EACxB,OAAOA,CAAG,EAAE,eAAe,qBAAmB,CAChD,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,OACEA,EAAI,UAAU,IACZ,cAAY,qBACd,CACF,EAAE,eAAe,2BAAyB,CAC5C,CAAC,EAED,GAAG,kCAAmC,SAAY,CAChD,OAAO,MAAMA,EAAI,WAAW,CAAC,EAAE,KAAK,cAAc,CACpD,CAAC,EAED,GAAG,KAAK,CACN,CAAC,iBAAe,uBAAuB,EACvC,CAAC,iBAAe,sBAAsB,EACtC,CAAC,iBAAe,cAAc,EAC9B,CAAC,YAAU,eAAe,EAC1B,CAAC,eAAa,kBAAkB,EAChC,CAAC,iBAAe,yBAAyB,EACzC,CAAC,iBAAe,iBAAiB,EACjC,CAAC,qBAAmB,4BAA4B,EAChD,CAAC,iBAAe,2BAA2B,EAC3C,CAAC,iBAAe,8BAA8B,EAC9C,CAAC,kBAAgB,kBAAkB,CACrC,CAAC,EACC,0BACCG,GAAwD,CACvD,MAAMC,EAAKJ,EAAI,UAAU,IAAiBG,CAAQ,EAClD,OAAOC,CAAE,EAAE,eAAe,aAAW,EACrC,OAAOA,EAAG,QAAQ,CAAC,EAAE,KAAK,MAAM,CAClC,CACF,CACF,CAAC,CACH,CAAC",
|
6
|
+
"names": ["import_LocalConfigDataSource", "import_configTypes", "import_deviceSessionTypes", "import_discoveryTypes", "import_managerApiTypes", "import_sendTypes", "import_package", "import_di", "import_commandTypes", "import_ConsoleLogger", "import_DeviceManagementKit", "dmk", "logger", "pkg", "diSymbol", "uc"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var o in r)a(e,o,{get:r[o],enumerable:!0})},l=(e,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of m(r))!c.call(e,i)&&i!==o&&a(e,i,{get:()=>r[i],enumerable:!(s=p(r,i))||s.enumerable});return e};var D=e=>l(a({},"__esModule",{value:!0}),e);var S={};u(S,{DeviceManagementKitBuilder:()=>f});module.exports=D(S);var t=require("../internal/manager-api/model/Const"),n=require("../internal/secure-channel/model/Const"),g=require("./DeviceManagementKit");class f{stub=!1;loggers=[];transports=[];config={managerApiUrl:t.DEFAULT_MANAGER_API_BASE_URL,mockUrl:t.DEFAULT_MOCK_SERVER_BASE_URL,webSocketUrl:n.DEFAULT_WEB_SOCKET_BASE_URL,provider:t.DEFAULT_PROVIDER,firmwareDistributionSalt:t.DEFAULT_FIRMWARE_DISTRIBUTION_SALT};build(){return new g.DeviceManagementKit({stub:this.stub,transports:this.transports,loggers:this.loggers,config:this.config})}setStub(r){return this.stub=r,this}addTransport(r){return this.transports.push(r),this}addLogger(r){return this.loggers.push(r),this}addConfig(r){return this.config={...this.config,...r},this}}0&&(module.exports={DeviceManagementKitBuilder});
|
2
2
|
//# sourceMappingURL=DeviceManagementKitBuilder.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/api/DeviceManagementKitBuilder.ts"],
|
4
|
-
"sourcesContent": ["import {\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n} from \"@internal/manager-api/model/Const\";\nimport { DEFAULT_WEB_SOCKET_BASE_URL } from \"@internal/secure-channel/model/Const\";\n\nimport { type LoggerSubscriberService } from \"./logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"./transport/model/Transport\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\n/**\n * Builder for the `DeviceManagementKit` class.\n *\n * @example\n * ```\n * const dmk = new LedgerDeviceManagementKitBuilder()\n * .setStub(false)\n * .addTransport((args) => transportFactory(args))\n * .addTransport(transportFactory)\n * .addLogger(myLogger)\n * .build();\n * ```\n */\nexport class DeviceManagementKitBuilder {\n private stub = false;\n private readonly loggers: LoggerSubscriberService[] = [];\n private readonly transports: TransportFactory[] = [];\n private config: DmkConfig = {\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n webSocketUrl: DEFAULT_WEB_SOCKET_BASE_URL,\n };\n\n build(): DeviceManagementKit {\n return new DeviceManagementKit({\n stub: this.stub,\n transports: this.transports,\n loggers: this.loggers,\n config: this.config,\n });\n }\n\n setStub(stubbed: boolean): DeviceManagementKitBuilder {\n this.stub = stubbed;\n return this;\n }\n\n addTransport(transport: TransportFactory): DeviceManagementKitBuilder {\n this.transports.push(transport);\n return this;\n }\n\n /**\n * Add a logger to the SDK that will receive its logs\n */\n addLogger(logger: LoggerSubscriberService): DeviceManagementKitBuilder {\n this.loggers.push(logger);\n return this;\n }\n\n addConfig(config: Partial<DmkConfig>): DeviceManagementKitBuilder {\n this.config = {\n ...this.config,\n ...config,\n };\n return this;\n }\n}\n"],
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,
|
4
|
+
"sourcesContent": ["import {\n DEFAULT_FIRMWARE_DISTRIBUTION_SALT,\n DEFAULT_MANAGER_API_BASE_URL,\n DEFAULT_MOCK_SERVER_BASE_URL,\n DEFAULT_PROVIDER,\n} from \"@internal/manager-api/model/Const\";\nimport { DEFAULT_WEB_SOCKET_BASE_URL } from \"@internal/secure-channel/model/Const\";\n\nimport { type LoggerSubscriberService } from \"./logger-subscriber/service/LoggerSubscriberService\";\nimport { type TransportFactory } from \"./transport/model/Transport\";\nimport { DeviceManagementKit } from \"./DeviceManagementKit\";\nimport { type DmkConfig } from \"./DmkConfig\";\n\n/**\n * Builder for the `DeviceManagementKit` class.\n *\n * @example\n * ```\n * const dmk = new LedgerDeviceManagementKitBuilder()\n * .setStub(false)\n * .addTransport((args) => transportFactory(args))\n * .addTransport(transportFactory)\n * .addLogger(myLogger)\n * .build();\n * ```\n */\nexport class DeviceManagementKitBuilder {\n private stub = false;\n private readonly loggers: LoggerSubscriberService[] = [];\n private readonly transports: TransportFactory[] = [];\n private config: DmkConfig = {\n managerApiUrl: DEFAULT_MANAGER_API_BASE_URL,\n mockUrl: DEFAULT_MOCK_SERVER_BASE_URL,\n webSocketUrl: DEFAULT_WEB_SOCKET_BASE_URL,\n provider: DEFAULT_PROVIDER,\n firmwareDistributionSalt: DEFAULT_FIRMWARE_DISTRIBUTION_SALT,\n };\n\n build(): DeviceManagementKit {\n return new DeviceManagementKit({\n stub: this.stub,\n transports: this.transports,\n loggers: this.loggers,\n config: this.config,\n });\n }\n\n setStub(stubbed: boolean): DeviceManagementKitBuilder {\n this.stub = stubbed;\n return this;\n }\n\n addTransport(transport: TransportFactory): DeviceManagementKitBuilder {\n this.transports.push(transport);\n return this;\n }\n\n /**\n * Add a logger to the SDK that will receive its logs\n */\n addLogger(logger: LoggerSubscriberService): DeviceManagementKitBuilder {\n this.loggers.push(logger);\n return this;\n }\n\n addConfig(config: Partial<DmkConfig>): DeviceManagementKitBuilder {\n this.config = {\n ...this.config,\n ...config,\n };\n return this;\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAKO,6CACPA,EAA4C,gDAI5CC,EAAoC,iCAgB7B,MAAMH,CAA2B,CAC9B,KAAO,GACE,QAAqC,CAAC,EACtC,WAAiC,CAAC,EAC3C,OAAoB,CAC1B,cAAe,+BACf,QAAS,+BACT,aAAc,8BACd,SAAU,mBACV,yBAA0B,oCAC5B,EAEA,OAA6B,CAC3B,OAAO,IAAI,sBAAoB,CAC7B,KAAM,KAAK,KACX,WAAY,KAAK,WACjB,QAAS,KAAK,QACd,OAAQ,KAAK,MACf,CAAC,CACH,CAEA,QAAQI,EAA8C,CACpD,YAAK,KAAOA,EACL,IACT,CAEA,aAAaC,EAAyD,CACpE,YAAK,WAAW,KAAKA,CAAS,EACvB,IACT,CAKA,UAAUC,EAA6D,CACrE,YAAK,QAAQ,KAAKA,CAAM,EACjB,IACT,CAEA,UAAUC,EAAwD,CAChE,YAAK,OAAS,CACZ,GAAG,KAAK,OACR,GAAGA,CACL,EACO,IACT,CACF",
|
6
6
|
"names": ["DeviceManagementKitBuilder_exports", "__export", "DeviceManagementKitBuilder", "__toCommonJS", "import_Const", "import_DeviceManagementKit", "stubbed", "transport", "logger", "config"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var n=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var a=(i,r,g,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of m(r))!s.call(i,t)&&t!==g&&n(i,t,{get:()=>r[t],enumerable:!(e=o(r,t))||e.enumerable});return i};var l=i=>a(n({},"__esModule",{value:!0}),i);var p={};module.exports=l(p);
|
2
2
|
//# sourceMappingURL=DmkConfig.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../src/api/DmkConfig.ts"],
|
4
|
-
"sourcesContent": ["export type DmkConfig = {\n mockUrl: string;\n managerApiUrl: string;\n webSocketUrl: string;\n};\n"],
|
4
|
+
"sourcesContent": ["export type DmkConfig = {\n mockUrl: string;\n managerApiUrl: string;\n webSocketUrl: string;\n provider: number;\n firmwareDistributionSalt: string;\n};\n"],
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
6
6
|
"names": ["DmkConfig_exports", "__toCommonJS"]
|
7
7
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var a=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var f=(r,e)=>{for(var o in e)a(r,o,{get:e[o],enumerable:!0})},z=(r,e,o,m)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of I(e))!S.call(r,t)&&t!==o&&a(r,t,{get:()=>e[t],enumerable:!(m=E(e,t))||m.enumerable});return r};var G=r=>z(a({},"__esModule",{value:!0}),r);var x={};f(x,{GetCustomImageSizeCommand:()=>A,GetCustomImageSizeCommandError:()=>c});module.exports=G(x);var d=require("../../apdu/utils/ApduBuilder"),i=require("../../apdu/utils/ApduParser"),p=require("../../command/Errors"),s=require("../../command/model/CommandResult"),u=require("../../command/utils/CommandErrors"),C=require("../../command/utils/CommandUtils"),g=require("../../command/utils/GlobalCommandError"),l=require("../../Error");const n={"662e":{message:"Invalid state, no background image loaded."},"662f":{message:"Invalid state, device is in recovery mode."}};class c extends l.DeviceExchangeError{constructor({message:e,errorCode:o}){super({message:e,errorCode:o,tag:"GetCustomImageSizeCommandError"})}}class A{getApdu(){const e={cla:224,ins:100,p1:0,p2:0};return new d.ApduBuilder(e).build()}parseResponse(e){const o=new i.ApduParser(e);if(!C.CommandUtils.isSuccessResponse(e)){const t=o.encodeToHexaString(e.statusCode);return(0,u.isCommandErrorCode)(t,n)?(0,s.CommandResultFactory)({error:new c({...n[t],errorCode:t})}):(0,s.CommandResultFactory)({error:g.GlobalCommandErrorHandler.handle(e)})}const m=o.extract32BitUInt();return m===void 0?(0,s.CommandResultFactory)({error:new p.InvalidStatusWordError("Didn't receive any size")}):(0,s.CommandResultFactory)({data:m})}}0&&(module.exports={GetCustomImageSizeCommand,GetCustomImageSizeCommandError});
|
2
|
+
//# sourceMappingURL=GetCustomImageSizeCommand.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/api/command/os/GetCustomImageSizeCommand.ts"],
|
4
|
+
"sourcesContent": ["import { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder, type ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nimport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type Command } from \"@api/command/Command\";\nimport { InvalidStatusWordError } from \"@api/command/Errors\";\nimport {\n type CommandResult,\n CommandResultFactory,\n} from \"@api/command/model/CommandResult\";\nimport {\n type CommandErrors,\n isCommandErrorCode,\n} from \"@api/command/utils/CommandErrors\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { GlobalCommandErrorHandler } from \"@api/command/utils/GlobalCommandError\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport { type CommandErrorArgs, DeviceExchangeError } from \"@api/Error\";\n\nexport type GetCustomImageSizeResponse = number;\n\nexport type GetCustomImageSizeErrorCodes = \"662e\" | \"662f\";\n\nconst IMAGE_SIZE_ERRORS: CommandErrors<GetCustomImageSizeErrorCodes> = {\n \"662e\": { message: \"Invalid state, no background image loaded.\" },\n \"662f\": { message: \"Invalid state, device is in recovery mode.\" },\n};\n\nexport type GetCustomImageSizeCommandResult = CommandResult<\n GetCustomImageSizeResponse,\n GetCustomImageSizeErrorCodes\n>;\n\nexport class GetCustomImageSizeCommandError extends DeviceExchangeError<GetCustomImageSizeErrorCodes> {\n constructor({\n message,\n errorCode,\n }: CommandErrorArgs<GetCustomImageSizeErrorCodes>) {\n super({ message, errorCode, tag: \"GetCustomImageSizeCommandError\" });\n }\n}\n\nexport class GetCustomImageSizeCommand\n implements\n Command<GetCustomImageSizeResponse, void, GetCustomImageSizeErrorCodes>\n{\n getApdu(): Apdu {\n const apduArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x64,\n p1: 0x00,\n p2: 0x00,\n };\n return new ApduBuilder(apduArgs).build();\n }\n\n parseResponse(apduResponse: ApduResponse): GetCustomImageSizeCommandResult {\n const parser = new ApduParser(apduResponse);\n\n if (!CommandUtils.isSuccessResponse(apduResponse)) {\n const errorCode = parser.encodeToHexaString(apduResponse.statusCode);\n if (isCommandErrorCode(errorCode, IMAGE_SIZE_ERRORS)) {\n return CommandResultFactory({\n error: new GetCustomImageSizeCommandError({\n ...IMAGE_SIZE_ERRORS[errorCode],\n errorCode,\n }),\n });\n }\n return CommandResultFactory({\n error: GlobalCommandErrorHandler.handle(apduResponse),\n });\n }\n\n const size = parser.extract32BitUInt();\n if (size === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Didn't receive any size\"),\n });\n }\n\n return CommandResultFactory({\n data: size,\n });\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,mCAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAkD,uCAClDC,EAA2B,sCAE3BC,EAAuC,+BACvCC,EAGO,4CACPC,EAGO,4CACPC,EAA6B,2CAC7BC,EAA0C,iDAE1CC,EAA2D,sBAM3D,MAAMC,EAAiE,CACrE,OAAQ,CAAE,QAAS,4CAA6C,EAChE,OAAQ,CAAE,QAAS,4CAA6C,CAClE,EAOO,MAAMV,UAAuC,qBAAkD,CACpG,YAAY,CACV,QAAAW,EACA,UAAAC,CACF,EAAmD,CACjD,MAAM,CAAE,QAAAD,EAAS,UAAAC,EAAW,IAAK,gCAAiC,CAAC,CACrE,CACF,CAEO,MAAMb,CAGb,CACE,SAAgB,CACd,MAAMc,EAA4B,CAChC,IAAK,IACL,IAAK,IACL,GAAI,EACJ,GAAI,CACN,EACA,OAAO,IAAI,cAAYA,CAAQ,EAAE,MAAM,CACzC,CAEA,cAAcC,EAA6D,CACzE,MAAMC,EAAS,IAAI,aAAWD,CAAY,EAE1C,GAAI,CAAC,eAAa,kBAAkBA,CAAY,EAAG,CACjD,MAAMF,EAAYG,EAAO,mBAAmBD,EAAa,UAAU,EACnE,SAAI,sBAAmBF,EAAWF,CAAiB,KAC1C,wBAAqB,CAC1B,MAAO,IAAIV,EAA+B,CACxC,GAAGU,EAAkBE,CAAS,EAC9B,UAAAA,CACF,CAAC,CACH,CAAC,KAEI,wBAAqB,CAC1B,MAAO,4BAA0B,OAAOE,CAAY,CACtD,CAAC,CACH,CAEA,MAAME,EAAOD,EAAO,iBAAiB,EACrC,OAAIC,IAAS,UACJ,wBAAqB,CAC1B,MAAO,IAAI,yBAAuB,yBAAyB,CAC7D,CAAC,KAGI,wBAAqB,CAC1B,KAAMA,CACR,CAAC,CACH,CACF",
|
6
|
+
"names": ["GetCustomImageSizeCommand_exports", "__export", "GetCustomImageSizeCommand", "GetCustomImageSizeCommandError", "__toCommonJS", "import_ApduBuilder", "import_ApduParser", "import_Errors", "import_CommandResult", "import_CommandErrors", "import_CommandUtils", "import_GlobalCommandError", "import_Error", "IMAGE_SIZE_ERRORS", "message", "errorCode", "apduArgs", "apduResponse", "parser", "size"]
|
7
|
+
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var n=require("../../command/Errors"),r=require("../../command/model/CommandResult"),a=require("../../command/model/CommandResult"),i=require("../../command/os/GetCustomImageSizeCommand"),o=require("../../device-session/ApduResponse");const u=new Uint8Array([224,100,0,0,0]);describe("GetCustomImageSizeCommand",()=>{let t;beforeEach(()=>{t=new i.GetCustomImageSizeCommand}),it("should return the correct APDU",()=>{const e=t.getApdu();expect(e.getRawApdu()).toStrictEqual(u)}),it("should parse result successfully",()=>{const e=new o.ApduResponse({statusCode:new Uint8Array([144,0]),data:new Uint8Array([0,0,137,233])}),s=t.parseResponse(e);expect(s).toStrictEqual((0,r.CommandResultFactory)({data:35305}))}),it("should fail on invalid size",()=>{const e=new o.ApduResponse({statusCode:new Uint8Array([144,0]),data:new Uint8Array([233])}),s=t.parseResponse(e);expect(s).toStrictEqual((0,r.CommandResultFactory)({error:new n.InvalidStatusWordError("Didn't receive any size")}))}),it("should fail on device error",()=>{const e=new o.ApduResponse({statusCode:new Uint8Array([102,46]),data:new Uint8Array([])}),s=t.parseResponse(e);expect((0,a.isSuccessCommandResult)(s)).toBeFalsy()})});
|
2
|
+
//# sourceMappingURL=GetCustomImageSizeCommand.test.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../src/api/command/os/GetCustomImageSizeCommand.test.ts"],
|
4
|
+
"sourcesContent": ["import { InvalidStatusWordError } from \"@api/command/Errors\";\nimport { CommandResultFactory } from \"@api/command/model/CommandResult\";\nimport { isSuccessCommandResult } from \"@api/command/model/CommandResult\";\nimport { GetCustomImageSizeCommand } from \"@api/command/os/GetCustomImageSizeCommand\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nconst IMAGE_SIZE_APDU = new Uint8Array([0xe0, 0x64, 0x00, 0x00, 0x00]);\n\ndescribe(\"GetCustomImageSizeCommand\", () => {\n let command: GetCustomImageSizeCommand;\n\n beforeEach(() => {\n command = new GetCustomImageSizeCommand();\n });\n\n it(\"should return the correct APDU\", () => {\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(IMAGE_SIZE_APDU);\n });\n\n it(\"should parse result successfully\", () => {\n const response: ApduResponse = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([0x00, 0x00, 0x89, 0xe9]),\n });\n const result = command.parseResponse(response);\n expect(result).toStrictEqual(\n CommandResultFactory({\n data: 35305,\n }),\n );\n });\n\n it(\"should fail on invalid size\", () => {\n const response: ApduResponse = new ApduResponse({\n statusCode: new Uint8Array([0x90, 0x00]),\n data: new Uint8Array([0xe9]),\n });\n const result = command.parseResponse(response);\n expect(result).toStrictEqual(\n CommandResultFactory({\n error: new InvalidStatusWordError(\"Didn't receive any size\"),\n }),\n );\n });\n\n it(\"should fail on device error\", () => {\n const response: ApduResponse = new ApduResponse({\n statusCode: new Uint8Array([0x66, 0x2e]),\n data: new Uint8Array([]),\n });\n const result = command.parseResponse(response);\n expect(isSuccessCommandResult(result)).toBeFalsy();\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAAuC,+BACvCC,EAAqC,4CACrCA,EAAuC,4CACvCC,EAA0C,qDAC1CC,EAA6B,4CAE7B,MAAMC,EAAkB,IAAI,WAAW,CAAC,IAAM,IAAM,EAAM,EAAM,CAAI,CAAC,EAErE,SAAS,4BAA6B,IAAM,CAC1C,IAAIC,EAEJ,WAAW,IAAM,CACfA,EAAU,IAAI,2BAChB,CAAC,EAED,GAAG,iCAAkC,IAAM,CACzC,MAAMC,EAAOD,EAAQ,QAAQ,EAC7B,OAAOC,EAAK,WAAW,CAAC,EAAE,cAAcF,CAAe,CACzD,CAAC,EAED,GAAG,mCAAoC,IAAM,CAC3C,MAAMG,EAAyB,IAAI,eAAa,CAC9C,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,EAAM,EAAM,IAAM,GAAI,CAAC,CAC/C,CAAC,EACKC,EAASH,EAAQ,cAAcE,CAAQ,EAC7C,OAAOC,CAAM,EAAE,iBACb,wBAAqB,CACnB,KAAM,KACR,CAAC,CACH,CACF,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,MAAMD,EAAyB,IAAI,eAAa,CAC9C,WAAY,IAAI,WAAW,CAAC,IAAM,CAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,GAAI,CAAC,CAC7B,CAAC,EACKC,EAASH,EAAQ,cAAcE,CAAQ,EAC7C,OAAOC,CAAM,EAAE,iBACb,wBAAqB,CACnB,MAAO,IAAI,yBAAuB,yBAAyB,CAC7D,CAAC,CACH,CACF,CAAC,EAED,GAAG,8BAA+B,IAAM,CACtC,MAAMD,EAAyB,IAAI,eAAa,CAC9C,WAAY,IAAI,WAAW,CAAC,IAAM,EAAI,CAAC,EACvC,KAAM,IAAI,WAAW,CAAC,CAAC,CACzB,CAAC,EACKC,EAASH,EAAQ,cAAcE,CAAQ,EAC7C,UAAO,0BAAuBC,CAAM,CAAC,EAAE,UAAU,CACnD,CAAC,CACH,CAAC",
|
6
|
+
"names": ["import_Errors", "import_CommandResult", "import_GetCustomImageSizeCommand", "import_ApduResponse", "IMAGE_SIZE_APDU", "command", "apdu", "response", "result"]
|
7
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var g=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var L=(d,r)=>{for(var n in r)g(d,n,{get:r[n],enumerable:!0})},R=(d,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of T(r))!B.call(d,s)&&s!==n&&g(d,s,{get:()=>r[s],enumerable:!(e=w(r,s))||e.enumerable});return d};var D=d=>R(g({},"__esModule",{value:!0}),d);var G={};L(G,{GetOsVersionCommand:()=>C});module.exports=D(G);var t=require("semver"),I=require("../../apdu/utils/ApduBuilder"),v=require("../../apdu/utils/ApduParser"),O=require("../../command/Errors"),c=require("../../command/model/CommandResult"),b=require("../../command/utils/CommandUtils"),F=require("../../command/utils/GlobalCommandError"),o=require("../../device/DeviceModel"),N=require("./SecureElementFlagsParser");class C{args=void 0;getApdu(){const r={cla:224,ins:1,p1:0,p2:0};return new I.ApduBuilder(r).build()}parseResponse(r,n){if(!b.CommandUtils.isSuccessResponse(r))return(0,c.CommandResultFactory)({error:F.GlobalCommandErrorHandler.handle(r)});const e=new v.ApduParser(r),s=e.extract32BitUInt();if(s===void 0)return(0,c.CommandResultFactory)({error:new O.InvalidStatusWordError("Missing target ID in OS version")});let l=e.encodeToString(e.extractFieldLVEncoded()),m=e.extractFieldLVEncoded()??new Uint8Array(0);const E={...new N.SecureElementFlagsParser(m).generalDeviceState()};l||(l="0.0.0",m=new Uint8Array);const S=(s&4026531840)!==805306368,h=l.includes("-osu");let a="",y="",p="",f="",V,u,A,x;if(S){p=l,V=s;const i=e.extractFieldLVEncoded();i&&(i.length>=5?(a=e.encodeToString(i),u=parseInt(e.encodeToHexaString(e.extractFieldLVEncoded()),16)):u=parseInt(e.encodeToHexaString(i),16))}else{if(a=l,u=s,y=e.encodeToString(e.extractFieldLVEncoded()),this.isBootloaderVersionSupported(a,n)&&(p=e.encodeToString(e.extractFieldLVEncoded())),this.isHardwareVersionSupported(a,n)?f=e.encodeToHexaString(e.extractFieldLVEncoded()):f="00",this.isLocalizationSupported(a,n)){const i=e.extractFieldLVEncoded();i!==void 0&&(A=parseInt(e.encodeToHexaString(i),16))}if(this.isRecoverSupported(a,n)){const i=e.extractFieldLVEncoded();i!==void 0&&(x=parseInt(e.encodeToHexaString(i),16))}}return(0,c.CommandResultFactory)({data:{isBootloader:S,isOsu:h,targetId:s,seTargetId:u,mcuTargetId:V,seVersion:a,seFlags:m,mcuSephVersion:y,mcuBootloaderVersion:p,hwVersion:f,langId:A,recoverState:x,secureElementFlags:E}})}isBootloaderVersionSupported(r,n){const e=(0,t.coerce)(r)??"";switch(n){case o.DeviceModelId.NANO_S:case o.DeviceModelId.NANO_X:return(0,t.gte)(e,"2.0.0");default:return!0}}isHardwareVersionSupported(r,n){const e=(0,t.coerce)(r)??"";switch(n){case o.DeviceModelId.NANO_X:return(0,t.gte)(e,"2.0.0");default:return!1}}isLocalizationSupported(r,n){const e=(0,t.coerce)(r)??"";switch(n){case o.DeviceModelId.NANO_S:return!1;case o.DeviceModelId.NANO_SP:return(0,t.gte)(e,"1.1.0");case o.DeviceModelId.NANO_X:return(0,t.gte)(e,"2.1.0");default:return!0}}isRecoverSupported(r,n){const e=(0,t.coerce)(r)??"";switch(n){case o.DeviceModelId.NANO_S:return!1;case o.DeviceModelId.NANO_SP:return(0,t.gte)(e,"1.1.2");case o.DeviceModelId.NANO_X:return(0,t.gte)(e,"2.2.3");case o.DeviceModelId.STAX:return(0,t.gte)(e,"1.4.0");case o.DeviceModelId.FLEX:return(0,t.gte)(e,"1.0.1");default:return!0}}}0&&(module.exports={GetOsVersionCommand});
|
2
2
|
//# sourceMappingURL=GetOsVersionCommand.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/os/GetOsVersionCommand.ts"],
|
4
|
-
"sourcesContent": ["import { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder, type ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nimport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type Command } from \"@api/command/Command\";\nimport {\n type CommandResult,\n CommandResultFactory,\n} from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { GlobalCommandErrorHandler } from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport {\n type DeviceGeneralState,\n type EndorsementInformation,\n type OnboardingStatus,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { SecureElementFlagsParser } from \"./SecureElementFlagsParser\";\n\n/**\n * Response of the GetOsVersionCommand.\n */\nexport type GetOsVersionResponse = {\n /**\n * Target identifier.\n */\n readonly targetId: number;\n\n /**\n * Version of BOLOS on the secure element (SE).\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly seVersion: string;\n\n /**\n * Secure element flags.\n * Used to represent the current state of the secure element.\n */\n readonly seFlags: Uint8Array;\n\n /**\n * Version of the microcontroller unit (MCU) SEPH, which is the SE-MCU link protocol.\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly mcuSephVersion: string;\n\n /**\n * Version of the MCU bootloader.\n */\n readonly mcuBootloaderVersion: string;\n\n /**\n * Hardware revision version.\n * Only available for Ledger Nano X in which case it's \"00\" or \"01\".\n */\n readonly hwVersion: string;\n\n /**\n * Identifier of the installed language pack.\n * Can be one of:\n * - \"00\": English\n * - \"01\": French\n * - \"02\": Spanish\n
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,IAAA,eAAAC,EAAAH,
|
6
|
-
"names": ["GetOsVersionCommand_exports", "__export", "GetOsVersionCommand", "__toCommonJS", "import_ApduBuilder", "import_ApduParser", "import_CommandResult", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_SecureElementFlagsParser", "getOsVersionApduArgs", "apduResponse", "deviceModelId", "parser", "targetId", "
|
4
|
+
"sourcesContent": ["import { coerce, gte } from \"semver\";\n\nimport { type Apdu } from \"@api/apdu/model/Apdu\";\nimport { ApduBuilder, type ApduBuilderArgs } from \"@api/apdu/utils/ApduBuilder\";\nimport { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type Command } from \"@api/command/Command\";\nimport { InvalidStatusWordError } from \"@api/command/Errors\";\nimport {\n type CommandResult,\n CommandResultFactory,\n} from \"@api/command/model/CommandResult\";\nimport { CommandUtils } from \"@api/command/utils/CommandUtils\";\nimport { GlobalCommandErrorHandler } from \"@api/command/utils/GlobalCommandError\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport {\n type DeviceGeneralState,\n type EndorsementInformation,\n type OnboardingStatus,\n type WordsInformation,\n} from \"@api/device/SecureElementFlags\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { SecureElementFlagsParser } from \"./SecureElementFlagsParser\";\n\n/**\n * Response of the GetOsVersionCommand.\n */\nexport type GetOsVersionResponse = {\n /**\n * Indicated if the device is running in bootloader mode.\n * It can happens during a firmware update process.\n */\n readonly isBootloader: boolean;\n\n /**\n * Indicated if the device firmware is an OS Updater (OSU).\n * It can happens during a firmware update process.\n */\n readonly isOsu: boolean;\n\n /**\n * Target identifier.\n */\n readonly targetId: number;\n\n /**\n * Target identifier of the secure element.\n * Not always available when the device is in bootloader mode.\n */\n readonly seTargetId: number | undefined;\n\n /**\n * Target identifier of the microcontroller unit (MCU).\n * Only available when the device is in bootloader mode.\n */\n readonly mcuTargetId: number | undefined;\n\n /**\n * Version of BOLOS on the secure element (SE).\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly seVersion: string;\n\n /**\n * Secure element flags.\n * Used to represent the current state of the secure element.\n */\n readonly seFlags: Uint8Array;\n\n /**\n * Version of the microcontroller unit (MCU) SEPH, which is the SE-MCU link protocol.\n * {@link https://developers.ledger.com/docs/device-app/architecture/bolos/hardware-architecture | Hardware Architecture}\n */\n readonly mcuSephVersion: string;\n\n /**\n * Version of the MCU bootloader.\n */\n readonly mcuBootloaderVersion: string;\n\n /**\n * Hardware revision version.\n * Only available for Ledger Nano X in which case it's \"00\" or \"01\".\n */\n readonly hwVersion: string;\n\n /**\n * Identifier of the installed language pack.\n * Can be one of:\n * - \"00\": English\n * - \"01\": French\n * - \"02\": Spanish\n * - \"03\": Portuguese\n * - \"04\": German\n * - \"05\": Russian\n * - \"06\": Turkish\n */\n readonly langId: number | undefined;\n\n /**\n * State for Ledger Recover. // [SHOULD] Add more information about this field\n */\n readonly recoverState: number | undefined;\n\n /**\n * The parsed secure element flags.\n */\n readonly secureElementFlags: DeviceGeneralState &\n EndorsementInformation &\n WordsInformation &\n OnboardingStatus;\n};\n\nexport type GetOsVersionCommandResult = CommandResult<GetOsVersionResponse>;\n\n/**\n * Command to get information about the device firmware.\n */\nexport class GetOsVersionCommand implements Command<GetOsVersionResponse> {\n readonly args = undefined;\n\n getApdu(): Apdu {\n const getOsVersionApduArgs: ApduBuilderArgs = {\n cla: 0xe0,\n ins: 0x01,\n p1: 0x00,\n p2: 0x00,\n };\n return new ApduBuilder(getOsVersionApduArgs).build();\n }\n\n parseResponse(\n apduResponse: ApduResponse,\n deviceModelId: DeviceModelId,\n ): GetOsVersionCommandResult {\n if (!CommandUtils.isSuccessResponse(apduResponse)) {\n return CommandResultFactory({\n error: GlobalCommandErrorHandler.handle(apduResponse),\n });\n }\n const parser = new ApduParser(apduResponse);\n const targetId = parser.extract32BitUInt();\n if (targetId === undefined) {\n return CommandResultFactory({\n error: new InvalidStatusWordError(\"Missing target ID in OS version\"),\n });\n }\n\n let version = parser.encodeToString(parser.extractFieldLVEncoded());\n let seFlags = parser.extractFieldLVEncoded() ?? new Uint8Array(0);\n const seFlagsParser = new SecureElementFlagsParser(seFlags);\n // This is the parsed secure element flags.\n const secureElementFlags = { ...seFlagsParser.generalDeviceState() };\n\n // Handle old firmwares with no version\n if (!version) {\n version = \"0.0.0\";\n seFlags = new Uint8Array();\n }\n\n const isBootloader = (targetId & 0xf0000000) !== 0x30000000;\n const isOsu = version.includes(\"-osu\");\n let seVersion: string = \"\";\n let mcuSephVersion: string = \"\";\n let mcuBootloaderVersion: string = \"\";\n let hwVersion: string = \"\";\n let mcuTargetId: number | undefined = undefined;\n let seTargetId: number | undefined = undefined;\n let langId: number | undefined = undefined;\n let recoverState: number | undefined = undefined;\n\n if (isBootloader) {\n mcuBootloaderVersion = version;\n mcuTargetId = targetId;\n\n const seData = parser.extractFieldLVEncoded();\n if (seData) {\n if (seData.length >= 5) {\n // It means it's a version followed by the seTargetId\n seVersion = parser.encodeToString(seData);\n seTargetId = parseInt(\n parser.encodeToHexaString(parser.extractFieldLVEncoded()),\n 16,\n );\n } else {\n // It's the seTargetId\n seTargetId = parseInt(parser.encodeToHexaString(seData), 16);\n }\n }\n } else {\n seVersion = version;\n seTargetId = targetId;\n\n mcuSephVersion = parser.encodeToString(parser.extractFieldLVEncoded());\n\n if (this.isBootloaderVersionSupported(seVersion, deviceModelId)) {\n mcuBootloaderVersion = parser.encodeToString(\n parser.extractFieldLVEncoded(),\n );\n }\n\n if (this.isHardwareVersionSupported(seVersion, deviceModelId)) {\n hwVersion = parser.encodeToHexaString(parser.extractFieldLVEncoded());\n } else {\n hwVersion = \"00\";\n }\n\n if (this.isLocalizationSupported(seVersion, deviceModelId)) {\n const langIdBuffer = parser.extractFieldLVEncoded();\n if (langIdBuffer !== undefined) {\n langId = parseInt(parser.encodeToHexaString(langIdBuffer), 16);\n }\n }\n\n if (this.isRecoverSupported(seVersion, deviceModelId)) {\n const recoverStateBuffer = parser.extractFieldLVEncoded();\n if (recoverStateBuffer !== undefined) {\n recoverState = parseInt(\n parser.encodeToHexaString(recoverStateBuffer),\n 16,\n );\n }\n }\n }\n\n return CommandResultFactory({\n data: {\n isBootloader,\n isOsu,\n targetId,\n seTargetId,\n mcuTargetId,\n seVersion,\n seFlags,\n mcuSephVersion,\n mcuBootloaderVersion,\n hwVersion,\n langId,\n recoverState,\n secureElementFlags,\n },\n });\n }\n\n private isBootloaderVersionSupported(\n seVersion: string,\n deviceModelId: DeviceModelId,\n ): boolean {\n const version = coerce(seVersion) ?? \"\";\n switch (deviceModelId) {\n case DeviceModelId.NANO_S:\n case DeviceModelId.NANO_X:\n return gte(version, \"2.0.0\");\n default:\n return true;\n }\n }\n\n private isHardwareVersionSupported(\n seVersion: string,\n deviceModelId: DeviceModelId,\n ): boolean {\n const version = coerce(seVersion) ?? \"\";\n switch (deviceModelId) {\n case DeviceModelId.NANO_X:\n return gte(version, \"2.0.0\");\n default:\n return false;\n }\n }\n\n private isLocalizationSupported(\n seVersion: string,\n deviceModelId: DeviceModelId,\n ): boolean {\n const version = coerce(seVersion) ?? \"\";\n switch (deviceModelId) {\n case DeviceModelId.NANO_S:\n return false;\n case DeviceModelId.NANO_SP:\n return gte(version, \"1.1.0\");\n case DeviceModelId.NANO_X:\n return gte(version, \"2.1.0\");\n default:\n return true;\n }\n }\n\n private isRecoverSupported(\n seVersion: string,\n deviceModelId: DeviceModelId,\n ): boolean {\n const version = coerce(seVersion) ?? \"\";\n switch (deviceModelId) {\n case DeviceModelId.NANO_S:\n return false;\n case DeviceModelId.NANO_SP:\n return gte(version, \"1.1.2\");\n case DeviceModelId.NANO_X:\n return gte(version, \"2.2.3\");\n case DeviceModelId.STAX:\n return gte(version, \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MAAMG,KAAU,UAAOK,CAAS,GAAK,GACrC,OAAQR,EAAe,CACrB,KAAK,gBAAc,OACjB,SAAO,OAAIG,EAAS,OAAO,EAC7B,QACE,MAAO,EACX,CACF,CAEQ,wBACNK,EACAR,EACS,CACT,MAAMG,KAAU,UAAOK,CAAS,GAAK,GACrC,OAAQR,EAAe,CACrB,KAAK,gBAAc,OACjB,MAAO,GACT,KAAK,gBAAc,QACjB,SAAO,OAAIG,EAAS,OAAO,EAC7B,KAAK,gBAAc,OACjB,SAAO,OAAIA,EAAS,OAAO,EAC7B,QACE,MAAO,EACX,CACF,CAEQ,mBACNK,EACAR,EACS,CACT,MAAMG,KAAU,UAAOK,CAAS,GAAK,GACrC,OAAQR,EAAe,CACrB,KAAK,gBAAc,OACjB,MAAO,GACT,KAAK,gBAAc,QACjB,SAAO,OAAIG,EAAS,OAAO,EAC7B,KAAK,gBAAc,OACjB,SAAO,OAAIA,EAAS,OAAO,EAC7B,KAAK,gBAAc,KACjB,SAAO,OAAIA,EAAS,OAAO,EAC7B,KAAK,gBAAc,KACjB,SAAO,OAAIA,EAAS,OAAO,EAC7B,QACE,MAAO,EACX,CACF,CACF",
|
6
|
+
"names": ["GetOsVersionCommand_exports", "__export", "GetOsVersionCommand", "__toCommonJS", "import_semver", "import_ApduBuilder", "import_ApduParser", "import_Errors", "import_CommandResult", "import_CommandUtils", "import_GlobalCommandError", "import_DeviceModel", "import_SecureElementFlagsParser", "getOsVersionApduArgs", "apduResponse", "deviceModelId", "parser", "targetId", "version", "seFlags", "secureElementFlags", "isBootloader", "isOsu", "seVersion", "mcuSephVersion", "mcuBootloaderVersion", "hwVersion", "mcuTargetId", "seTargetId", "langId", "recoverState", "seData", "langIdBuffer", "recoverStateBuffer"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var r=require("../../command/model/CommandResult"),
|
1
|
+
"use strict";var r=require("../../command/model/CommandResult"),t=require("../../device/DeviceModel"),o=require("../../device-session/ApduResponse"),a=require("./__mocks__/GetOsVersionCommand"),n=require("./GetOsVersionCommand");const d=Uint8Array.from([224,1,0,0,0]),i=Uint8Array.from([51,0,0,4,5,50,46,50,46,51,4,230,0,0,0,4,50,46,51,48,4,49,46,49,54,1,0,1,0,1,0,144,0]),c=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:i}),u=Uint8Array.from([51,16,0,4,5,49,46,49,46,49,4,230,0,0,0,4,52,46,48,51,4,51,46,49,50,1,0,1,0,144,0]),l=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:u}),p=Uint8Array.from([51,32,0,4,5,49,46,51,46,48,4,230,0,0,0,4,53,46,50,52,4,48,46,52,56,1,0,1,0,144,0]),S=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:p}),m=Uint8Array.from([5,1,0,3,4,49,46,49,54,4,244,216,170,67,5,50,46,50,46,51,4,51,0,0,4,144,0]),O=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:m}),A=Uint8Array.from([51,0,0,4,0,4,238,0,0,0,4,50,46,51,48,1,1,1,0,1,0,144,0]),f=new o.ApduResponse({statusCode:Uint8Array.from([144,0]),data:A});describe("GetOsVersionCommand",()=>{let s;beforeEach(()=>{s=new n.GetOsVersionCommand}),describe("getApdu",()=>{it("should return the GetOsVersion apdu",()=>{const e=s.getApdu();expect(e.getRawApdu()).toStrictEqual(d)})}),describe("parseResponse",()=>{describe("Nano X",()=>{it("should parse the LNX response",()=>{const e=s.parseResponse(c,t.DeviceModelId.NANO_X),x=(0,r.CommandResultFactory)({data:(0,a.getOsVersionCommandResponseMockBuilder)(t.DeviceModelId.NANO_X)});expect(e).toStrictEqual(x)})}),describe("Nano S Plus",()=>{it("should parse the LNSP response",()=>{const e=s.parseResponse(l,t.DeviceModelId.NANO_SP),x=(0,r.CommandResultFactory)({data:(0,a.getOsVersionCommandResponseMockBuilder)(t.DeviceModelId.NANO_SP)});expect(e).toStrictEqual(x)})}),describe("Stax",()=>{it("should parse the STAX response",()=>{const e=s.parseResponse(S,t.DeviceModelId.STAX),x=(0,r.CommandResultFactory)({data:(0,a.getOsVersionCommandResponseMockBuilder)(t.DeviceModelId.STAX)});expect(e).toStrictEqual(x)})}),describe("Bootloader",()=>{it("should parse the bootloader response",()=>{const e=s.parseResponse(O,t.DeviceModelId.STAX),x=(0,r.CommandResultFactory)({data:{isBootloader:!0,isOsu:!1,targetId:83951619,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([244,216,170,67]),mcuTargetId:83951619,mcuSephVersion:"",mcuBootloaderVersion:"1.16",hwVersion:"",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!0,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!1,isInRecoveryMode:!1}}});expect(e).toStrictEqual(x)})}),describe("Old firmware",()=>{it("should parse the old firmware response",()=>{const e=s.parseResponse(f,t.DeviceModelId.NANO_X),x=(0,r.CommandResultFactory)({data:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"0.0.0",seFlags:new Uint8Array,mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"",hwVersion:"00",langId:void 0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!0,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}}});expect(e).toStrictEqual(x)})}),describe("Error handling",()=>{it("should return an error if the response is not successful",()=>{const e=new o.ApduResponse({statusCode:Uint8Array.from([110,128]),data:Uint8Array.from([])}),x=s.parseResponse(e,t.DeviceModelId.NANO_S);expect((0,r.isSuccessCommandResult)(x)).toBeFalsy()})})})});
|
2
2
|
//# sourceMappingURL=GetOsVersionCommand.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/os/GetOsVersionCommand.test.ts"],
|
4
|
-
"sourcesContent": ["import {\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { getOsVersionCommandResponseMockBuilder } from \"./__mocks__/GetOsVersionCommand\";\nimport { GetOsVersionCommand } from \"./GetOsVersionCommand\";\n\nconst GET_OS_VERSION_APDU = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\nconst LNX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x32, 0x2e, 0x33, 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01,\n 0x00, 0x01, 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD,\n});\n\nconst LNSP_REPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x10, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x31, 0x2e, 0x31, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x34, 0x2e, 0x30, 0x33, 0x04, 0x33, 0x2e, 0x31, 0x32, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNSP_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNSP_REPONSE_DATA_GOOD,\n});\n\nconst STAX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x20, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x33, 0x2e, 0x30, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x35, 0x2e, 0x32, 0x34, 0x04, 0x30, 0x2e, 0x34, 0x38, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst STAX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: STAX_RESPONSE_DATA_GOOD,\n});\n\ndescribe(\"GetOsVersionCommand\", () => {\n let command: GetOsVersionCommand;\n\n beforeEach(() => {\n command = new GetOsVersionCommand();\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the GetOsVersion apdu\", () => {\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(GET_OS_VERSION_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n describe(\"Nano X\", () => {\n it(\"should parse the LNX response\", () => {\n const parsed = command.parseResponse(\n LNX_RESPONSE_GOOD,\n DeviceModelId.NANO_X,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_X),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Nano S Plus\", () => {\n it(\"should parse the LNSP response\", () => {\n const parsed = command.parseResponse(\n LNSP_RESPONSE_GOOD,\n DeviceModelId.NANO_SP,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_SP),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Stax\", () => {\n it(\"should parse the STAX response\", () => {\n const parsed = command.parseResponse(\n STAX_RESPONSE_GOOD,\n DeviceModelId.STAX,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.STAX),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Error handling\", () => {\n it(\"should return an error if the response is not successful\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6e, 0x80]),\n data: Uint8Array.from([]),\n });\n const result = command.parseResponse(response, DeviceModelId.NANO_S);\n\n expect(isSuccessCommandResult(result)).toBeFalsy();\n });\n });\n });\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CACfA,EAAU,IAAI,qBAChB,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,GAAG,sCAAuC,IAAM,CAC9C,MAAMC,EAAOD,EAAQ,QAAQ,EAC7B,OAAOC,EAAK,WAAW,CAAC,EAAE,
|
6
|
-
"names": ["import_CommandResult", "import_DeviceModel", "import_ApduResponse", "import_GetOsVersionCommand", "GET_OS_VERSION_APDU", "LNX_RESPONSE_DATA_GOOD", "LNX_RESPONSE_GOOD", "LNSP_REPONSE_DATA_GOOD", "LNSP_RESPONSE_GOOD", "STAX_RESPONSE_DATA_GOOD", "STAX_RESPONSE_GOOD", "command", "apdu", "parsed", "expected", "response", "result"]
|
4
|
+
"sourcesContent": ["import {\n CommandResultFactory,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { getOsVersionCommandResponseMockBuilder } from \"./__mocks__/GetOsVersionCommand\";\nimport { GetOsVersionCommand } from \"./GetOsVersionCommand\";\n\nconst GET_OS_VERSION_APDU = Uint8Array.from([0xe0, 0x01, 0x00, 0x00, 0x00]);\n\nconst LNX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x32, 0x2e, 0x33, 0x30, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x01,\n 0x00, 0x01, 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNX_RESPONSE_DATA_GOOD,\n});\n\nconst LNSP_REPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x10, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x31, 0x2e, 0x31, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x34, 0x2e, 0x30, 0x33, 0x04, 0x33, 0x2e, 0x31, 0x32, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst LNSP_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: LNSP_REPONSE_DATA_GOOD,\n});\n\nconst STAX_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x20, 0x00, 0x04, 0x05, 0x31, 0x2e, 0x33, 0x2e, 0x30, 0x04, 0xe6, 0x00,\n 0x00, 0x00, 0x04, 0x35, 0x2e, 0x32, 0x34, 0x04, 0x30, 0x2e, 0x34, 0x38, 0x01,\n 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst STAX_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: STAX_RESPONSE_DATA_GOOD,\n});\n\nconst BL_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x05, 0x01, 0x00, 0x03, 0x04, 0x31, 0x2e, 0x31, 0x36, 0x04, 0xf4, 0xd8, 0xaa,\n 0x43, 0x05, 0x32, 0x2e, 0x32, 0x2e, 0x33, 0x04, 0x33, 0x00, 0x00, 0x04, 0x90,\n 0x00,\n]);\nconst BL_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: BL_RESPONSE_DATA_GOOD,\n});\n\nconst OLD_FM_RESPONSE_DATA_GOOD = Uint8Array.from([\n 0x33, 0x00, 0x00, 0x04, 0x00, 0x04, 0xee, 0x00, 0x00, 0x00, 0x04, 0x32, 0x2e,\n 0x33, 0x30, 0x01, 0x01, 0x01, 0x00, 0x01, 0x00, 0x90, 0x00,\n]);\nconst OLD_FM_RESPONSE_GOOD = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: OLD_FM_RESPONSE_DATA_GOOD,\n});\n\ndescribe(\"GetOsVersionCommand\", () => {\n let command: GetOsVersionCommand;\n\n beforeEach(() => {\n command = new GetOsVersionCommand();\n });\n\n describe(\"getApdu\", () => {\n it(\"should return the GetOsVersion apdu\", () => {\n const apdu = command.getApdu();\n expect(apdu.getRawApdu()).toStrictEqual(GET_OS_VERSION_APDU);\n });\n });\n\n describe(\"parseResponse\", () => {\n describe(\"Nano X\", () => {\n it(\"should parse the LNX response\", () => {\n const parsed = command.parseResponse(\n LNX_RESPONSE_GOOD,\n DeviceModelId.NANO_X,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_X),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Nano S Plus\", () => {\n it(\"should parse the LNSP response\", () => {\n const parsed = command.parseResponse(\n LNSP_RESPONSE_GOOD,\n DeviceModelId.NANO_SP,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.NANO_SP),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Stax\", () => {\n it(\"should parse the STAX response\", () => {\n const parsed = command.parseResponse(\n STAX_RESPONSE_GOOD,\n DeviceModelId.STAX,\n );\n\n const expected = CommandResultFactory({\n data: getOsVersionCommandResponseMockBuilder(DeviceModelId.STAX),\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Bootloader\", () => {\n it(\"should parse the bootloader response\", () => {\n const parsed = command.parseResponse(\n BL_RESPONSE_GOOD,\n DeviceModelId.STAX,\n );\n\n const expected = CommandResultFactory({\n data: {\n isBootloader: true,\n isOsu: false,\n targetId: 83951619,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xf4, 0xd8, 0xaa, 0x43]),\n mcuTargetId: 83951619,\n mcuSephVersion: \"\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"\",\n langId: undefined,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: true,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: false,\n isInRecoveryMode: false,\n },\n },\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Old firmware\", () => {\n it(\"should parse the old firmware response\", () => {\n const parsed = command.parseResponse(\n OLD_FM_RESPONSE_GOOD,\n DeviceModelId.NANO_X,\n );\n\n const expected = CommandResultFactory({\n data: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"0.0.0\",\n seFlags: new Uint8Array(),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"\",\n hwVersion: \"00\",\n langId: undefined,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: true,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n });\n\n expect(parsed).toStrictEqual(expected);\n });\n });\n\n describe(\"Error handling\", () => {\n it(\"should return an error if the response is not successful\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6e, 0x80]),\n data: Uint8Array.from([]),\n });\n const result = command.parseResponse(response, DeviceModelId.NANO_S);\n\n expect(isSuccessCommandResult(result)).toBeFalsy();\n });\n });\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAGO,4CACPC,EAA8B,mCAC9BC,EAA6B,4CAE7BC,EAAuD,2CACvDA,EAAoC,iCAEpC,MAAMC,EAAsB,WAAW,KAAK,CAAC,IAAM,EAAM,EAAM,EAAM,CAAI,CAAC,EAEpEC,EAAyB,WAAW,KAAK,CAC7C,GAAM,EAAM,EAAM,EAAM,EAAM,GAAM,GAAM,GAAM,GAAM,GAAM,EAAM,IAAM,EACxE,EAAM,EAAM,EAAM,GAAM,GAAM,GAAM,GAAM,EAAM,GAAM,GAAM,GAAM,GAAM,EACxE,EAAM,EAAM,EAAM,EAAM,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eviceModel", "import_ApduResponse", "import_GetOsVersionCommand", "GET_OS_VERSION_APDU", "LNX_RESPONSE_DATA_GOOD", "LNX_RESPONSE_GOOD", "LNSP_REPONSE_DATA_GOOD", "LNSP_RESPONSE_GOOD", "STAX_RESPONSE_DATA_GOOD", "STAX_RESPONSE_GOOD", "BL_RESPONSE_DATA_GOOD", "BL_RESPONSE_GOOD", "OLD_FM_RESPONSE_DATA_GOOD", "OLD_FM_RESPONSE_GOOD", "command", "apdu", "parsed", "expected", "response", "result"]
|
7
7
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
"use strict";var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var R=(o,r)=>{for(var e in r)d(o,e,{get:r[e],enumerable:!0})},I=(o,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of x(r))!y.call(o,a)&&a!==e&&d(o,a,{get:()=>r[a],enumerable:!(n=P(r,a))||n.enumerable});return o};var S=o=>I(d({},"__esModule",{value:!0}),o);var B={};R(B,{ListLanguagePackCommand:()=>b,ListLanguagePackCommandError:()=>A});module.exports=S(B);var p=require("../../apdu/utils/ApduBuilder"),c=require("../../apdu/utils/ApduParser"),i=require("../../command/Errors"),t=require("../../command/model/CommandResult"),L=require("../../command/utils/CommandErrors"),C=require("../../command/utils/CommandUtils"),l=require("../../command/utils/GlobalCommandError"),f=require("../../Error"),m=require("../../utils/HexaString");const g={"662d":{message:"Invalid LIST_ARG, first command must be sent with P1_LIST_LANGUAGE_PACKS_FIRST."}};class A extends f.DeviceExchangeError{constructor({message:r,errorCode:e}){super({message:r,errorCode:e,tag:"ListLanguagePackCommandError"})}}class b{constructor(r){this.args=r}getApdu(){const r={cla:224,ins:52,p1:this.args.firstChunk?0:1,p2:0};return new p.ApduBuilder(r).build()}parseResponse(r){const e=new c.ApduParser(r);if(!C.CommandUtils.isSuccessResponse(r)){const s=e.encodeToHexaString(r.statusCode);return(0,L.isCommandErrorCode)(s,g)?(0,t.CommandResultFactory)({error:new A({...g[s],errorCode:s})}):(0,t.CommandResultFactory)({error:l.GlobalCommandErrorHandler.handle(r)})}if(e.extract8BitUInt()===void 0)return(0,t.CommandResultFactory)({data:void 0});e.extract8BitUInt();const a=e.extractFieldLVEncoded();if(a===void 0)return(0,t.CommandResultFactory)({error:new i.InvalidStatusWordError("Failed to get language pack id")});const u=e.extractFieldLVEncoded();if(u===void 0)return(0,t.CommandResultFactory)({error:new i.InvalidStatusWordError("Failed to get language pack size")});const E=parseInt((0,m.bufferToHexaString)(a),16),k=parseInt((0,m.bufferToHexaString)(u),16);return(0,t.CommandResultFactory)({data:{id:E,size:k}})}}0&&(module.exports={ListLanguagePackCommand,ListLanguagePackCommandError});
|
2
|
+
//# sourceMappingURL=ListLanguagePackCommand.js.map
|