@ledgerhq/device-management-kit 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/package.json +1 -2
- package/lib/cjs/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/cjs/src/api/DeviceManagementKit.test.js.map +2 -2
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js +1 -1
- package/lib/cjs/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
- package/lib/cjs/src/api/command/di/commandModule.js +1 -1
- package/lib/cjs/src/api/command/di/commandModule.js.map +3 -3
- package/lib/cjs/src/api/command/di/commandModule.test.js +1 -1
- package/lib/cjs/src/api/command/di/commandModule.test.js.map +2 -2
- 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/utils/CommandUtils.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.js.map +2 -2
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js +1 -1
- package/lib/cjs/src/api/command/utils/CommandUtils.test.js.map +2 -2
- package/lib/cjs/src/api/command/utils/GlobalCommandError.js +1 -1
- package/lib/cjs/src/api/command/utils/GlobalCommandError.js.map +2 -2
- package/lib/cjs/src/api/device/DeviceModel.js +1 -1
- package/lib/cjs/src/api/device/DeviceModel.js.map +2 -2
- package/lib/cjs/src/api/device-action/di/deviceActionModule.js +1 -1
- package/lib/cjs/src/api/device-action/di/deviceActionModule.js.map +3 -3
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js +1 -1
- package/lib/cjs/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/cjs/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- 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/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 +1 -1
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/GetDeviceMetadata/types.js.map +1 -1
- 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/GoToDashboardDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/InstallOrUpdateApps/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppDeviceAction/types.js.map +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
- package/lib/cjs/src/api/device-action/os/OpenAppWithDependencies/types.js.map +1 -1
- 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/SendCommandInAppDeviceActionTypes.js +1 -1
- package/lib/cjs/src/api/device-action/os/SendCommandInAppDeviceAction/SendCommandInAppDeviceActionTypes.js.map +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +2 -2
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
- package/lib/cjs/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +2 -2
- 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/data/StaticDeviceModelDataSource.test.js +1 -1
- package/lib/cjs/src/api/device-model/data/StaticDeviceModelDataSource.test.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/index.js +1 -1
- package/lib/cjs/src/api/index.js.map +2 -2
- 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/GenuineCheck/types.js.map +1 -1
- 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 +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/InstallApp/types.js.map +1 -1
- 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/ListInstalledApps/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/ListInstalledApps/types.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 +2 -2
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/device-action/UninstallApp/types.js.map +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/task/types.js +1 -1
- package/lib/cjs/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/cjs/src/api/secure-channel/utils.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.js.map +3 -3
- package/lib/cjs/src/api/secure-channel/utils.test.js +1 -1
- package/lib/cjs/src/api/secure-channel/utils.test.js.map +3 -3
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
- package/lib/cjs/src/api/transport/model/DeviceConnectionStateMachine.test.js.map +7 -0
- 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/utils/AppName.js +2 -0
- package/lib/cjs/src/api/utils/AppName.js.map +7 -0
- package/lib/cjs/src/api/utils/AppName.test.js +2 -0
- package/lib/cjs/src/api/utils/AppName.test.js.map +7 -0
- package/lib/cjs/src/di.js +1 -1
- package/lib/cjs/src/di.js.map +2 -2
- package/lib/cjs/src/internal/config/di/configModule.js +1 -1
- package/lib/cjs/src/internal/config/di/configModule.js.map +3 -3
- package/lib/cjs/src/internal/config/di/configModule.test.js +1 -1
- package/lib/cjs/src/internal/config/di/configModule.test.js.map +2 -2
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js +1 -1
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.js.map +3 -3
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js +1 -1
- package/lib/cjs/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
- package/lib/cjs/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
- 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/service/DefaultApduSenderService.test.js +1 -1
- package/lib/cjs/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- package/lib/cjs/src/internal/discovery/di/discoveryModule.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.js.map +3 -3
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/cjs/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
- package/lib/cjs/src/internal/logger-publisher/di/loggerModule.test.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/secure-channel/di/secureChannelModule.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/cjs/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
- package/lib/cjs/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/cjs/src/internal/secure-channel/model/Errors.js.map +3 -3
- package/lib/cjs/src/internal/send/di/sendModule.js +1 -1
- package/lib/cjs/src/internal/send/di/sendModule.js.map +3 -3
- package/lib/cjs/src/internal/send/di/sendModule.test.js +1 -1
- package/lib/cjs/src/internal/send/di/sendModule.test.js.map +2 -2
- 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.js +1 -1
- package/lib/cjs/src/internal/transport/di/transportModule.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/esm/package.json +1 -2
- package/lib/esm/src/api/DeviceManagementKit.test.js +1 -1
- package/lib/esm/src/api/DeviceManagementKit.test.js.map +2 -2
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.js.map +3 -3
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayBuilder.test.js.map +2 -2
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js +1 -1
- package/lib/esm/src/api/apdu/utils/ByteArrayParser.js.map +3 -3
- package/lib/esm/src/api/command/di/commandModule.js +1 -1
- package/lib/esm/src/api/command/di/commandModule.js.map +3 -3
- package/lib/esm/src/api/command/di/commandModule.test.js +1 -1
- package/lib/esm/src/api/command/di/commandModule.test.js.map +2 -2
- 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/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 +2 -2
- package/lib/esm/src/api/command/utils/GlobalCommandError.js +1 -1
- package/lib/esm/src/api/command/utils/GlobalCommandError.js.map +2 -2
- package/lib/esm/src/api/device/DeviceModel.js +1 -1
- package/lib/esm/src/api/device/DeviceModel.js.map +2 -2
- package/lib/esm/src/api/device-action/di/deviceActionModule.js +1 -1
- package/lib/esm/src/api/device-action/di/deviceActionModule.js.map +3 -3
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js +1 -1
- package/lib/esm/src/api/device-action/di/deviceActionModule.test.js.map +2 -2
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js +1 -1
- package/lib/esm/src/api/device-action/model/UserInteractionRequired.js.map +2 -2
- 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/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 +1 -1
- package/lib/esm/src/api/device-action/os/GetDeviceMetadata/GetDeviceMetadataDeviceAction.js.map +2 -2
- 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/GoToDashboard/GoToDashboardDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.js.map +2 -2
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.test.js.map +3 -3
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js +1 -1
- package/lib/esm/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.js.map +2 -2
- 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/task/BuildAppsInstallPlanTask.js +1 -1
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.js.map +3 -3
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js +1 -1
- package/lib/esm/src/api/device-action/task/BuildAppsInstallPlanTask.test.js.map +3 -3
- 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/data/StaticDeviceModelDataSource.test.js +1 -1
- package/lib/esm/src/api/device-model/data/StaticDeviceModelDataSource.test.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/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 +2 -2
- 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/ListInstalledApps/types.js +1 -1
- package/lib/esm/src/api/secure-channel/device-action/ListInstalledApps/types.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 +2 -2
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js +1 -1
- package/lib/esm/src/api/secure-channel/task/ConnectToSecureChannelTask.test.js.map +3 -3
- package/lib/esm/src/api/secure-channel/task/types.js +1 -1
- package/lib/esm/src/api/secure-channel/task/types.js.map +2 -2
- package/lib/esm/src/api/secure-channel/utils.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.js.map +3 -3
- package/lib/esm/src/api/secure-channel/utils.test.js +1 -1
- package/lib/esm/src/api/secure-channel/utils.test.js.map +3 -3
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js +1 -1
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.js.map +3 -3
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.js +2 -0
- package/lib/esm/src/api/transport/model/DeviceConnectionStateMachine.test.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/api/utils/AppName.js +2 -0
- package/lib/esm/src/api/utils/AppName.js.map +7 -0
- package/lib/esm/src/api/utils/AppName.test.js +2 -0
- package/lib/esm/src/api/utils/AppName.test.js.map +7 -0
- package/lib/esm/src/di.js +1 -1
- package/lib/esm/src/di.js.map +2 -2
- package/lib/esm/src/internal/config/di/configModule.js +1 -1
- package/lib/esm/src/internal/config/di/configModule.js.map +3 -3
- package/lib/esm/src/internal/config/di/configModule.test.js +1 -1
- package/lib/esm/src/internal/config/di/configModule.test.js.map +2 -2
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js +1 -1
- package/lib/esm/src/internal/device-model/di/deviceModelModule.js.map +3 -3
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js +1 -1
- package/lib/esm/src/internal/device-model/di/deviceModelModule.test.js.map +2 -2
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.js.map +3 -3
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js +1 -1
- package/lib/esm/src/internal/device-session/di/deviceSessionModule.test.js.map +2 -2
- 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/service/DefaultApduSenderService.test.js +1 -1
- package/lib/esm/src/internal/device-session/service/DefaultApduSenderService.test.js.map +2 -2
- package/lib/esm/src/internal/discovery/di/discoveryModule.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.js.map +3 -3
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js +1 -1
- package/lib/esm/src/internal/discovery/di/discoveryModule.test.js.map +2 -2
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.js +1 -1
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.js.map +3 -3
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.js +1 -1
- package/lib/esm/src/internal/logger-publisher/di/loggerModule.test.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/secure-channel/di/secureChannelModule.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.js.map +3 -3
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js +1 -1
- package/lib/esm/src/internal/secure-channel/di/secureChannelModule.test.js.map +2 -2
- package/lib/esm/src/internal/secure-channel/model/Errors.js +1 -1
- package/lib/esm/src/internal/secure-channel/model/Errors.js.map +3 -3
- package/lib/esm/src/internal/send/di/sendModule.js +1 -1
- package/lib/esm/src/internal/send/di/sendModule.js.map +3 -3
- package/lib/esm/src/internal/send/di/sendModule.test.js +1 -1
- package/lib/esm/src/internal/send/di/sendModule.test.js.map +2 -2
- 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.js +1 -1
- package/lib/esm/src/internal/transport/di/transportModule.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/types/src/api/apdu/utils/ApduBuilder.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ApduParser.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts +28 -0
- package/lib/types/src/api/apdu/utils/ByteArrayBuilder.d.ts.map +1 -1
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts +1 -0
- package/lib/types/src/api/apdu/utils/ByteArrayParser.d.ts.map +1 -1
- package/lib/types/src/api/command/di/commandModule.d.ts.map +1 -1
- package/lib/types/src/api/command/os/__mocks__/GetOsVersionCommand.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandErrors.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/CommandUtils.d.ts +3 -0
- package/lib/types/src/api/command/utils/CommandUtils.d.ts.map +1 -1
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts +1 -1
- package/lib/types/src/api/command/utils/GlobalCommandError.d.ts.map +1 -1
- package/lib/types/src/api/device/DeviceModel.d.ts +2 -1
- package/lib/types/src/api/device/DeviceModel.d.ts.map +1 -1
- package/lib/types/src/api/device-action/__test-utils__/setupTestMachine.d.ts.map +1 -1
- package/lib/types/src/api/device-action/di/deviceActionModule.d.ts.map +1 -1
- package/lib/types/src/api/device-action/model/UserInteractionRequired.d.ts +1 -0
- package/lib/types/src/api/device-action/model/UserInteractionRequired.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 +0 -1
- 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.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts +2 -1
- package/lib/types/src/api/device-action/os/GetDeviceMetadata/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GetDeviceStatus/GetDeviceStatusDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/GoToDashboard/GoToDashboardDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/InstallOrUpdateAppsDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts +3 -2
- package/lib/types/src/api/device-action/os/InstallOrUpdateApps/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts +0 -1
- package/lib/types/src/api/device-action/os/OpenAppDeviceAction/types.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/OpenAppWithDependenciesDeviceAction.d.ts.map +1 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts +0 -1
- package/lib/types/src/api/device-action/os/OpenAppWithDependencies/types.d.ts.map +1 -1
- 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 +0 -1
- 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 +2 -2
- package/lib/types/src/api/device-action/task/BuildAppsInstallPlanTask.d.ts.map +1 -1
- 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.map +1 -1
- package/lib/types/src/api/device-session/service/DefaultApduReceiverService.stub.d.ts.map +1 -1
- package/lib/types/src/api/device-session/service/DefaultApduSenderService.stub.d.ts.map +1 -1
- package/lib/types/src/api/index.d.ts +1 -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/GenuineCheck/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/GenuineCheck/types.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/InstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/InstallApp/types.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/ListInstalledApps/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/ListInstalledApps/types.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/secure-channel/device-action/UninstallApp/types.d.ts +2 -1
- package/lib/types/src/api/secure-channel/device-action/UninstallApp/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts +5 -2
- package/lib/types/src/api/secure-channel/task/ConnectToSecureChannelTask.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts +6 -1
- package/lib/types/src/api/secure-channel/task/types.d.ts.map +1 -1
- package/lib/types/src/api/secure-channel/utils.d.ts +0 -11
- package/lib/types/src/api/secure-channel/utils.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts +8 -7
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.d.ts.map +1 -1
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts +2 -0
- package/lib/types/src/api/transport/model/DeviceConnectionStateMachine.test.d.ts.map +1 -0
- package/lib/types/src/api/transport/model/Errors.d.ts +5 -0
- package/lib/types/src/api/transport/model/Errors.d.ts.map +1 -1
- package/lib/types/src/api/utils/AppName.d.ts +2 -0
- package/lib/types/src/api/utils/AppName.d.ts.map +1 -0
- package/lib/types/src/api/utils/AppName.test.d.ts +2 -0
- package/lib/types/src/api/utils/AppName.test.d.ts.map +1 -0
- package/lib/types/src/api/utils/HexaString.d.ts.map +1 -1
- package/lib/types/src/di.d.ts.map +1 -1
- package/lib/types/src/internal/config/di/configModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-model/di/deviceModelModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/di/deviceSessionModule.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/model/DeviceSession.stub.d.ts.map +1 -1
- package/lib/types/src/internal/device-session/utils/deviceSessionUtils.d.ts.map +1 -1
- package/lib/types/src/internal/discovery/di/discoveryModule.d.ts.map +1 -1
- package/lib/types/src/internal/logger-publisher/di/loggerModule.d.ts.map +1 -1
- package/lib/types/src/internal/manager-api/di/managerApiModule.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/di/secureChannelModule.d.ts.map +1 -1
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts +22 -2
- package/lib/types/src/internal/secure-channel/model/Errors.d.ts.map +1 -1
- package/lib/types/src/internal/send/di/sendModule.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/di/transportModule.d.ts.map +1 -1
- package/lib/types/tsconfig.prod.tsbuildinfo +1 -1
- package/package.json +2 -3
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/di/commandModule.test.ts"],
|
4
|
-
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandModuleFactory } from \"./commandModule\";\nimport { commandTypes } from \"./commandTypes\";\n\ndescribe(\"commandModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory();\n container = new Container();\n container.
|
5
|
-
"mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAmC,oDACnCC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAAqC,2BACrCC,EAA6B,0BAE7B,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,EAC3BD,EAAY,IAAI,YAChBA,EAAU,
|
4
|
+
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { SendCommandUseCase } from \"@api/command/use-case/SendCommandUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { commandModuleFactory } from \"./commandModule\";\nimport { commandTypes } from \"./commandTypes\";\n\ndescribe(\"commandModuleFactory\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory();\n container = new Container();\n container.loadSync(\n mod,\n deviceSessionModuleFactory(),\n loggerModuleFactory(),\n );\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get<SendCommandUseCase>(\n commandTypes.SendCommandUseCase,\n );\n expect(sendCommandUseCase).toBeInstanceOf(SendCommandUseCase);\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof commandModuleFactory>;\n beforeEach(() => {\n mod = commandModuleFactory({ stub: true });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed sendCommand usecase\", () => {\n const sendCommandUseCase = container.get(commandTypes.SendCommandUseCase);\n expect(sendCommandUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAAmC,oDACnCC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAAqC,2BACrCC,EAA6B,0BAE7B,SAAS,uBAAwB,IAAM,CACrC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,EAC3BD,EAAY,IAAI,YAChBA,EAAU,SACRC,KACA,8BAA2B,KAC3B,uBAAoB,CACtB,CACF,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,gDAAiD,IAAM,CACxD,MAAMC,EAAqBF,EAAU,IACnC,eAAa,kBACf,EACA,OAAOE,CAAkB,EAAE,eAAe,oBAAkB,CAC9D,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIF,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,wBAAqB,CAAE,KAAM,EAAK,CAAC,EACzCD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,4CAA6C,IAAM,CACpD,MAAMC,EAAqBF,EAAU,IAAI,eAAa,kBAAkB,EACxE,OAAOE,CAAkB,EAAE,eAAe,aAAW,CACvD,CAAC,CACH,CAAC,CACH,CAAC",
|
6
6
|
"names": ["import_inversify", "import_SendCommandUseCase", "import_deviceSessionModule", "import_loggerModule", "import_di", "import_commandModule", "import_commandTypes", "container", "mod", "sendCommandUseCase"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var t=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(s,e)=>{for(var o in e)t(s,o,{get:e[o],enumerable:!0})},c=(s,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of d(e))!l.call(s,i)&&i!==o&&t(s,i,{get:()=>e[i],enumerable:!(a=n(e,i))||a.enumerable});return s};var f=s=>c(t({},"__esModule",{value:!0}),s);var m={};u(m,{getOsVersionCommandResponseMockBuilder:()=>g});module.exports=f(m);var r=require("../../../device/DeviceModel");const g=(s=r.DeviceModelId.NANO_SP,e={})=>({[r.DeviceModelId.NANO_SP]:{isBootloader:!1,isOsu:!1,targetId:856686596,seTargetId:856686596,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[r.DeviceModelId.NANO_S]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[r.DeviceModelId.NANO_X]:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}},[r.DeviceModelId.STAX]:{isBootloader:!1,isOsu:!1,targetId:857735172,seTargetId:857735172,seVersion:"1.3.0",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[r.DeviceModelId.FLEX]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e}})[s];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
|
1
|
+
"use strict";var t=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(s,e)=>{for(var o in e)t(s,o,{get:e[o],enumerable:!0})},c=(s,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of d(e))!l.call(s,i)&&i!==o&&t(s,i,{get:()=>e[i],enumerable:!(a=n(e,i))||a.enumerable});return s};var f=s=>c(t({},"__esModule",{value:!0}),s);var m={};u(m,{getOsVersionCommandResponseMockBuilder:()=>g});module.exports=f(m);var r=require("../../../device/DeviceModel");const g=(s=r.DeviceModelId.NANO_SP,e={})=>({[r.DeviceModelId.NANO_SP]:{isBootloader:!1,isOsu:!1,targetId:856686596,seTargetId:856686596,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"4.03",mcuBootloaderVersion:"3.12",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[r.DeviceModelId.NANO_S]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[r.DeviceModelId.NANO_X]:{isBootloader:!1,isOsu:!1,targetId:855638020,seTargetId:855638020,seVersion:"2.2.3",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"2.30",mcuBootloaderVersion:"1.16",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}},[r.DeviceModelId.STAX]:{isBootloader:!1,isOsu:!1,targetId:857735172,seTargetId:857735172,seVersion:"1.3.0",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"5.24",mcuBootloaderVersion:"0.48",hwVersion:"00",langId:0,recoverState:void 0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[r.DeviceModelId.FLEX]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1},...e},[r.DeviceModelId.APEX]:{isBootloader:!1,isOsu:!1,targetId:858783748,seTargetId:858783748,seVersion:"1.1.1",seFlags:new Uint8Array([230,0,0,0]),mcuTargetId:void 0,mcuSephVersion:"6.4.0",mcuBootloaderVersion:"5.4.0",hwVersion:"00",langId:0,recoverState:0,secureElementFlags:{isPinValidated:!0,hasMcuSerialNumber:!0,hasValidCertificate:!0,isCustomAuthorityConnectionAllowed:!1,isSecureConnectionAllowed:!1,isOnboarded:!0,isMcuCodeSigned:!0,isInRecoveryMode:!1}}})[s];0&&(module.exports={getOsVersionCommandResponseMockBuilder});
|
2
2
|
//# sourceMappingURL=GetOsVersionCommand.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/command/os/__mocks__/GetOsVersionCommand.ts"],
|
4
|
-
"sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n isBootloader: false,\n isOsu: false,\n targetId: 856686596,\n seTargetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n [DeviceModelId.STAX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 857735172,\n seTargetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.FLEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n })[deviceModelId];\n"],
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4CAAAE,IAAA,eAAAC,EAAAH,GACA,IAAAI,EAA8B,mCAEvB,MAAMF,EAAyC,CACpDG,EAA+B,gBAAc,QAC7CC,EAAuC,CAAC,KAEvC,CACC,CAAC,gBAAc,OAAO,EAAG,CACvB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,EACR,aAAc,OACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,EACR,aAAc,OACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,MAAM,EAAG,CACtB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,EACR,aAAc,EACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,CACF,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,OAChB,qBAAsB,OACtB,UAAW,KACX,OAAQ,EACR,aAAc,OACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,EACA,CAAC,gBAAc,IAAI,EAAG,CACpB,aAAc,GACd,MAAO,GACP,SAAU,UACV,WAAY,UACZ,UAAW,QACX,QAAS,IAAI,WAAW,CAAC,IAAM,EAAM,EAAM,CAAI,CAAC,EAChD,YAAa,OACb,eAAgB,QAChB,qBAAsB,QACtB,UAAW,KACX,OAAQ,EACR,aAAc,EACd,mBAAoB,CAClB,eAAgB,GAChB,mBAAoB,GACpB,oBAAqB,GACrB,mCAAoC,GACpC,0BAA2B,GAC3B,YAAa,GACb,gBAAiB,GACjB,iBAAkB,EACpB,EACA,GAAGA,CACL,CACF,GAAGD,CAAa",
|
4
|
+
"sourcesContent": ["import { type GetOsVersionResponse } from \"@api/command/os/GetOsVersionCommand\";\nimport { DeviceModelId } from \"@api/device/DeviceModel\";\n\nexport const getOsVersionCommandResponseMockBuilder = (\n deviceModelId: DeviceModelId = DeviceModelId.NANO_SP,\n props: Partial<GetOsVersionResponse> = {},\n): GetOsVersionResponse =>\n ({\n [DeviceModelId.NANO_SP]: {\n isBootloader: false,\n isOsu: false,\n targetId: 856686596,\n seTargetId: 856686596,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"4.03\",\n mcuBootloaderVersion: \"3.12\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_S]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.NANO_X]: {\n isBootloader: false,\n isOsu: false,\n targetId: 855638020,\n seTargetId: 855638020,\n seVersion: \"2.2.3\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"2.30\",\n mcuBootloaderVersion: \"1.16\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n [DeviceModelId.STAX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 857735172,\n seTargetId: 857735172,\n seVersion: \"1.3.0\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"5.24\",\n mcuBootloaderVersion: \"0.48\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: undefined,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.FLEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n ...props,\n },\n [DeviceModelId.APEX]: {\n isBootloader: false,\n isOsu: false,\n targetId: 858783748,\n seTargetId: 858783748,\n seVersion: \"1.1.1\",\n seFlags: new Uint8Array([0xe6, 0x00, 0x00, 0x00]),\n mcuTargetId: undefined,\n mcuSephVersion: \"6.4.0\",\n mcuBootloaderVersion: \"5.4.0\",\n hwVersion: \"00\",\n langId: 0,\n recoverState: 0,\n secureElementFlags: {\n isPinValidated: true,\n hasMcuSerialNumber: true,\n hasValidCertificate: true,\n isCustomAuthorityConnectionAllowed: false,\n isSecureConnectionAllowed: false,\n isOnboarded: true,\n isMcuCodeSigned: true,\n isInRecoveryMode: false,\n },\n },\n })[deviceModelId];\n"],
|
5
|
+
"mappings": "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",
|
6
6
|
"names": ["GetOsVersionCommand_exports", "__export", "getOsVersionCommandResponseMockBuilder", "__toCommonJS", "import_DeviceModel", "deviceModelId", "props"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var f=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var a=(x,r)=>{for(var i in r)f(x,i,{get:r[i],enumerable:!0})},y=(x,r,i,p)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of c(r))!l.call(x,e)&&e!==i&&f(x,e,{get:()=>r[e],enumerable:!(p=A(r,e))||p.enumerable});return x};var R=x=>y(f({},"__esModule",{value:!0}),x);var S={};a(S,{CommandUtils:()=>n});module.exports=R(S);class n{static isValidStatusCode(r){return r.length===2}static isSuccessResponse({statusCode:r}){return n.isValidStatusCode(r)?r[0]===144&&r[1]===0:!1}static isLockedDeviceResponse({statusCode:r}){return n.isValidStatusCode(r)?r[0]===85&&r[1]===21||r[0]===105&&r[1]===130||r[0]===83&&r[1]===3:!1}static isRefusedByUser({statusCode:r}){return n.isValidStatusCode(r)?r[0]===85&&r[1]===1||r[0]===105&&r[1]===133:!1}static isAppAlreadyInstalled({statusCode:r}){return n.isValidStatusCode(r)?r[0]===106&&r[1]===128||r[0]===106&&r[1]===129||r[0]===106&&r[1]===142||r[0]===106&&r[1]===143:!1}static isOutOfMemory({statusCode:r}){return n.isValidStatusCode(r)?r[0]===106&&r[1]===132||r[0]===106&&r[1]===133||r[0]===81&&r[1]===2||r[0]===81&&r[1]===3:!1}static isApduThatTriggersDisconnection(r){const i=new Map;return i.set("openApp",new Uint8Array([224,216,0,0])),i.set("closeApp",new Uint8Array([176,167,0,0])),Array.from(i.values()).some(p=>{for(let e=0;e<4;e++)if(p[e]!==r[e])return!1;return!0})}}0&&(module.exports={CommandUtils});
|
2
2
|
//# sourceMappingURL=CommandUtils.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/utils/CommandUtils.ts"],
|
4
|
-
"sourcesContent": ["import { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nexport class CommandUtils {\n static isValidStatusCode(statusCode: Uint8Array) {\n return statusCode.length === 2;\n }\n\n static isSuccessResponse({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return statusCode[0] === 0x90 && statusCode[1] === 0x00;\n }\n\n static isLockedDeviceResponse({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return statusCode[0] === 0x55 && statusCode[1] === 0x15;\n }\n\n static isApduThatTriggersDisconnection(apdu: Uint8Array) {\n /**\n * Map of known APDUs that trigger a disconnection.\n */\n const apduMap = new Map();\n apduMap.set(\"openApp\", new Uint8Array([0xe0, 0xd8, 0x00, 0x00]));\n apduMap.set(\"closeApp\", new Uint8Array([0xb0, 0xa7, 0x00, 0x00]));\n // TODO: add more APDUs that trigger a disconnection (e.g firmware flashing ?)\n\n // check if apdu first 4 UintArray is included in apduMap\n return Array.from(apduMap.values()).some((value: Uint8Array) => {\n for (let i = 0; i < 4; i++) {\n if (value[i] !== apdu[i]) {\n return false;\n }\n }\n return true;\n });\n }\n}\n"],
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAEO,MAAME,CAAa,CACxB,OAAO,kBAAkBE,EAAwB,CAC/C,OAAOA,EAAW,SAAW,CAC/B,CAEA,OAAO,kBAAkB,CAAE,WAAAA,CAAW,EAAiB,CACrD,OAAKF,EAAa,kBAAkBE,CAAU,EAIvCA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,EAH1C,EAIX,CAEA,OAAO,uBAAuB,CAAE,WAAAA,CAAW,EAAiB,CAC1D,OAAKF,EAAa,kBAAkBE,CAAU,
|
4
|
+
"sourcesContent": ["import { type ApduResponse } from \"@api/device-session/ApduResponse\";\n\nexport class CommandUtils {\n static isValidStatusCode(statusCode: Uint8Array) {\n return statusCode.length === 2;\n }\n\n static isSuccessResponse({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return statusCode[0] === 0x90 && statusCode[1] === 0x00;\n }\n\n static isLockedDeviceResponse({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return (\n (statusCode[0] === 0x55 && statusCode[1] === 0x15) ||\n (statusCode[0] === 0x69 && statusCode[1] === 0x82) ||\n (statusCode[0] === 0x53 && statusCode[1] === 0x03)\n );\n }\n\n static isRefusedByUser({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return (\n (statusCode[0] === 0x55 && statusCode[1] === 0x01) ||\n (statusCode[0] === 0x69 && statusCode[1] === 0x85)\n );\n }\n\n static isAppAlreadyInstalled({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return (\n (statusCode[0] === 0x6a && statusCode[1] === 0x80) ||\n (statusCode[0] === 0x6a && statusCode[1] === 0x81) ||\n (statusCode[0] === 0x6a && statusCode[1] === 0x8e) ||\n (statusCode[0] === 0x6a && statusCode[1] === 0x8f)\n );\n }\n\n static isOutOfMemory({ statusCode }: ApduResponse) {\n if (!CommandUtils.isValidStatusCode(statusCode)) {\n return false;\n }\n\n return (\n (statusCode[0] === 0x6a && statusCode[1] === 0x84) ||\n (statusCode[0] === 0x6a && statusCode[1] === 0x85) ||\n (statusCode[0] === 0x51 && statusCode[1] === 0x02) ||\n (statusCode[0] === 0x51 && statusCode[1] === 0x03)\n );\n }\n\n static isApduThatTriggersDisconnection(apdu: Uint8Array) {\n /**\n * Map of known APDUs that trigger a disconnection.\n */\n const apduMap = new Map();\n apduMap.set(\"openApp\", new Uint8Array([0xe0, 0xd8, 0x00, 0x00]));\n apduMap.set(\"closeApp\", new Uint8Array([0xb0, 0xa7, 0x00, 0x00]));\n // TODO: add more APDUs that trigger a disconnection (e.g firmware flashing ?)\n\n // check if apdu first 4 UintArray is included in apduMap\n return Array.from(apduMap.values()).some((value: Uint8Array) => {\n for (let i = 0; i < 4; i++) {\n if (value[i] !== apdu[i]) {\n return false;\n }\n }\n return true;\n });\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,IAAA,eAAAC,EAAAH,GAEO,MAAME,CAAa,CACxB,OAAO,kBAAkBE,EAAwB,CAC/C,OAAOA,EAAW,SAAW,CAC/B,CAEA,OAAO,kBAAkB,CAAE,WAAAA,CAAW,EAAiB,CACrD,OAAKF,EAAa,kBAAkBE,CAAU,EAIvCA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,EAH1C,EAIX,CAEA,OAAO,uBAAuB,CAAE,WAAAA,CAAW,EAAiB,CAC1D,OAAKF,EAAa,kBAAkBE,CAAU,EAK3CA,EAAW,CAAC,IAAM,IAAQA,EAAW,CAAC,IAAM,IAC5CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,KAC5CA,EAAW,CAAC,IAAM,IAAQA,EAAW,CAAC,IAAM,EANtC,EAQX,CAEA,OAAO,gBAAgB,CAAE,WAAAA,CAAW,EAAiB,CACnD,OAAKF,EAAa,kBAAkBE,CAAU,EAK3CA,EAAW,CAAC,IAAM,IAAQA,EAAW,CAAC,IAAM,GAC5CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,IALtC,EAOX,CAEA,OAAO,sBAAsB,CAAE,WAAAA,CAAW,EAAiB,CACzD,OAAKF,EAAa,kBAAkBE,CAAU,EAK3CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,KAC5CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,KAC5CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,KAC5CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,IAPtC,EASX,CAEA,OAAO,cAAc,CAAE,WAAAA,CAAW,EAAiB,CACjD,OAAKF,EAAa,kBAAkBE,CAAU,EAK3CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,KAC5CA,EAAW,CAAC,IAAM,KAAQA,EAAW,CAAC,IAAM,KAC5CA,EAAW,CAAC,IAAM,IAAQA,EAAW,CAAC,IAAM,GAC5CA,EAAW,CAAC,IAAM,IAAQA,EAAW,CAAC,IAAM,EAPtC,EASX,CAEA,OAAO,gCAAgCC,EAAkB,CAIvD,MAAMC,EAAU,IAAI,IACpB,OAAAA,EAAQ,IAAI,UAAW,IAAI,WAAW,CAAC,IAAM,IAAM,EAAM,CAAI,CAAC,CAAC,EAC/DA,EAAQ,IAAI,WAAY,IAAI,WAAW,CAAC,IAAM,IAAM,EAAM,CAAI,CAAC,CAAC,EAIzD,MAAM,KAAKA,EAAQ,OAAO,CAAC,EAAE,KAAMC,GAAsB,CAC9D,QAASC,EAAI,EAAGA,EAAI,EAAGA,IACrB,GAAID,EAAMC,CAAC,IAAMH,EAAKG,CAAC,EACrB,MAAO,GAGX,MAAO,EACT,CAAC,CACH,CACF",
|
6
6
|
"names": ["CommandUtils_exports", "__export", "CommandUtils", "__toCommonJS", "statusCode", "apdu", "apduMap", "value", "i"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var r=require("../../command/os/CloseAppCommand"),o=require("../../command/os/GetAppAndVersionCommand"),a=require("../../command/os/OpenAppCommand"),s=require("../../device-session/ApduResponse"),t=require("./CommandUtils");describe("CommandUtils",()=>{describe("static isSuccessResponse",()=>{it("should return true if the status code is 0x9000",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([])});expect(t.CommandUtils.isSuccessResponse(e)).toBe(!0)}),it("should return false if the status code is not 0x9000",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([110,128]),data:Uint8Array.from([])});expect(t.CommandUtils.isSuccessResponse(e)).toBe(!1)}),it("should return false if the status code is not 2 bytes long",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([85]),data:Uint8Array.from([])});expect(t.CommandUtils.isSuccessResponse(e)).toBe(!1)})}),describe("static isValidStatusCode",()=>{it("should return true if the status code is 2 bytes long",()=>{const e=Uint8Array.from([144,0]);expect(t.CommandUtils.isValidStatusCode(e)).toBe(!0)}),it("should return false if the status code is not 2 bytes long",()=>{const e=Uint8Array.from([144]);expect(t.CommandUtils.isValidStatusCode(e)).toBe(!1)})}),describe("static isLockedDeviceResponse",()=>{it("should return true if the status code is 0x5515",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([85,21]),data:Uint8Array.from([])});expect(t.CommandUtils.isLockedDeviceResponse(e)).toBe(!0)}),it("should return true if the status code is 0x6982",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([105,130]),data:Uint8Array.from([])});expect(t.CommandUtils.isLockedDeviceResponse(e)).toBe(!0)}),it("should return true if the status code is 0x5303",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([83,3]),data:Uint8Array.from([])});expect(t.CommandUtils.isLockedDeviceResponse(e)).toBe(!0)}),it("should return false if the status code is not 0x5515",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([])});expect(t.CommandUtils.isLockedDeviceResponse(e)).toBe(!1)}),it("should return false if the status code is not 2 bytes long",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([144]),data:Uint8Array.from([])});expect(t.CommandUtils.isLockedDeviceResponse(e)).toBe(!1)})}),describe("static isRefusedByUser",()=>{it("should return true if the status code is 0x5501",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([85,1]),data:Uint8Array.from([])});expect(t.CommandUtils.isRefusedByUser(e)).toBe(!0)}),it("should return true if the status code is 0x6985",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([105,133]),data:Uint8Array.from([])});expect(t.CommandUtils.isRefusedByUser(e)).toBe(!0)}),it("should return false if the status code is not 0x5501",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([])});expect(t.CommandUtils.isRefusedByUser(e)).toBe(!1)})}),describe("static isAppAlreadyInstalled",()=>{it("should return true if the status code is 0x6a80",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([106,128]),data:Uint8Array.from([])});expect(t.CommandUtils.isAppAlreadyInstalled(e)).toBe(!0)}),it("should return true if the status code is 0x6a81",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([106,129]),data:Uint8Array.from([])});expect(t.CommandUtils.isAppAlreadyInstalled(e)).toBe(!0)}),it("should return true if the status code is 0x6a8e",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([106,142]),data:Uint8Array.from([])});expect(t.CommandUtils.isAppAlreadyInstalled(e)).toBe(!0)}),it("should return true if the status code is 0x6a8f",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([106,143]),data:Uint8Array.from([])});expect(t.CommandUtils.isAppAlreadyInstalled(e)).toBe(!0)}),it("should return false if the status code is not 0x6a80",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([])});expect(t.CommandUtils.isAppAlreadyInstalled(e)).toBe(!1)})}),describe("static isOutOfMemory",()=>{it("should return true if the status code is 0x6a84",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([106,132]),data:Uint8Array.from([])});expect(t.CommandUtils.isOutOfMemory(e)).toBe(!0)}),it("should return true if the status code is 0x6a85",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([106,133]),data:Uint8Array.from([])});expect(t.CommandUtils.isOutOfMemory(e)).toBe(!0)}),it("should return true if the status code is 0x5102",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([81,2]),data:Uint8Array.from([])});expect(t.CommandUtils.isOutOfMemory(e)).toBe(!0)}),it("should return true if the status code is 0x5103",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([81,3]),data:Uint8Array.from([])});expect(t.CommandUtils.isOutOfMemory(e)).toBe(!0)}),it("should return false if the status code is not 0x6a84",()=>{const e=new s.ApduResponse({statusCode:Uint8Array.from([144,0]),data:Uint8Array.from([])});expect(t.CommandUtils.isOutOfMemory(e)).toBe(!1)})}),describe("static isApduThatTriggersDisconnection",()=>{it("should return true if the APDU is openApp",()=>{const e=new a.OpenAppCommand({appName:"test"}).getApdu().getRawApdu();expect(t.CommandUtils.isApduThatTriggersDisconnection(e)).toBe(!0)}),it("should return true if the APDU is closeApp",()=>{const e=new r.CloseAppCommand().getApdu().getRawApdu();expect(t.CommandUtils.isApduThatTriggersDisconnection(e)).toBe(!0)}),it("should return false if the APDU is not a known one",()=>{const e=new o.GetAppAndVersionCommand().getApdu().getRawApdu();expect(t.CommandUtils.isApduThatTriggersDisconnection(e)).toBe(!1)})})});
|
2
2
|
//# sourceMappingURL=CommandUtils.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/utils/CommandUtils.test.ts"],
|
4
|
-
"sourcesContent": ["import { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nimport { GetAppAndVersionCommand } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { OpenAppCommand } from \"@api/command/os/OpenAppCommand\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { CommandUtils } from \"./CommandUtils\";\n\ndescribe(\"CommandUtils\", () => {\n describe(\"static isSuccessResponse\", () => {\n it(\"should return true if the status code is 0x9000\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isSuccessResponse(response)).toBe(true);\n });\n\n it(\"should return false if the status code is not 0x9000\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6e, 0x80]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isSuccessResponse(response)).toBe(false);\n });\n\n it(\"should return false if the status code is not 2 bytes long\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x55]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isSuccessResponse(response)).toBe(false);\n });\n });\n\n describe(\"static isValidStatusCode\", () => {\n it(\"should return true if the status code is 2 bytes long\", () => {\n const statusCode = Uint8Array.from([0x90, 0x00]);\n\n expect(CommandUtils.isValidStatusCode(statusCode)).toBe(true);\n });\n\n it(\"should return false if the status code is not 2 bytes long\", () => {\n const statusCode = Uint8Array.from([0x90]);\n\n expect(CommandUtils.isValidStatusCode(statusCode)).toBe(false);\n });\n });\n\n describe(\"static isLockedDeviceResponse\", () => {\n it(\"should return true if the status code is 0x5515\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x55, 0x15]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(true);\n });\n\n it(\"should return false if the status code is not 0x5515\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(false);\n });\n\n it(\"should return false if the status code is not 2 bytes long\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(false);\n });\n });\n\n describe(\"static isApduThatTriggersDisconnection\", () => {\n it(\"should return true if the APDU is openApp\", () => {\n const apdu = new OpenAppCommand({ appName: \"test\" })\n .getApdu()\n .getRawApdu();\n\n expect(CommandUtils.isApduThatTriggersDisconnection(apdu)).toBe(true);\n });\n\n it(\"should return true if the APDU is closeApp\", () => {\n const apdu = new CloseAppCommand().getApdu().getRawApdu();\n\n expect(CommandUtils.isApduThatTriggersDisconnection(apdu)).toBe(true);\n });\n\n it(\"should return false if the APDU is not a known one\", () => {\n const apdu = new GetAppAndVersionCommand().getApdu().getRawApdu();\n\n expect(CommandUtils.isApduThatTriggersDisconnection(apdu)).toBe(false);\n });\n });\n});\n"],
|
5
|
-
"mappings": "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",
|
4
|
+
"sourcesContent": ["import { CloseAppCommand } from \"@api/command/os/CloseAppCommand\";\nimport { GetAppAndVersionCommand } from \"@api/command/os/GetAppAndVersionCommand\";\nimport { OpenAppCommand } from \"@api/command/os/OpenAppCommand\";\nimport { ApduResponse } from \"@api/device-session/ApduResponse\";\n\nimport { CommandUtils } from \"./CommandUtils\";\n\ndescribe(\"CommandUtils\", () => {\n describe(\"static isSuccessResponse\", () => {\n it(\"should return true if the status code is 0x9000\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isSuccessResponse(response)).toBe(true);\n });\n\n it(\"should return false if the status code is not 0x9000\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6e, 0x80]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isSuccessResponse(response)).toBe(false);\n });\n\n it(\"should return false if the status code is not 2 bytes long\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x55]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isSuccessResponse(response)).toBe(false);\n });\n });\n\n describe(\"static isValidStatusCode\", () => {\n it(\"should return true if the status code is 2 bytes long\", () => {\n const statusCode = Uint8Array.from([0x90, 0x00]);\n\n expect(CommandUtils.isValidStatusCode(statusCode)).toBe(true);\n });\n\n it(\"should return false if the status code is not 2 bytes long\", () => {\n const statusCode = Uint8Array.from([0x90]);\n\n expect(CommandUtils.isValidStatusCode(statusCode)).toBe(false);\n });\n });\n\n describe(\"static isLockedDeviceResponse\", () => {\n it(\"should return true if the status code is 0x5515\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x55, 0x15]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x6982\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x69, 0x82]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x5303\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x53, 0x03]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(true);\n });\n\n it(\"should return false if the status code is not 0x5515\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(false);\n });\n\n it(\"should return false if the status code is not 2 bytes long\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isLockedDeviceResponse(response)).toBe(false);\n });\n });\n\n describe(\"static isRefusedByUser\", () => {\n it(\"should return true if the status code is 0x5501\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x55, 0x01]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isRefusedByUser(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x6985\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x69, 0x85]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isRefusedByUser(response)).toBe(true);\n });\n\n it(\"should return false if the status code is not 0x5501\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isRefusedByUser(response)).toBe(false);\n });\n });\n\n describe(\"static isAppAlreadyInstalled\", () => {\n it(\"should return true if the status code is 0x6a80\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6a, 0x80]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isAppAlreadyInstalled(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x6a81\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6a, 0x81]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isAppAlreadyInstalled(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x6a8e\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6a, 0x8e]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isAppAlreadyInstalled(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x6a8f\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6a, 0x8f]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isAppAlreadyInstalled(response)).toBe(true);\n });\n\n it(\"should return false if the status code is not 0x6a80\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isAppAlreadyInstalled(response)).toBe(false);\n });\n });\n\n describe(\"static isOutOfMemory\", () => {\n it(\"should return true if the status code is 0x6a84\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6a, 0x84]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isOutOfMemory(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x6a85\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x6a, 0x85]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isOutOfMemory(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x5102\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x51, 0x02]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isOutOfMemory(response)).toBe(true);\n });\n\n it(\"should return true if the status code is 0x5103\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x51, 0x03]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isOutOfMemory(response)).toBe(true);\n });\n\n it(\"should return false if the status code is not 0x6a84\", () => {\n const response = new ApduResponse({\n statusCode: Uint8Array.from([0x90, 0x00]),\n data: Uint8Array.from([]),\n });\n\n expect(CommandUtils.isOutOfMemory(response)).toBe(false);\n });\n });\n\n describe(\"static isApduThatTriggersDisconnection\", () => {\n it(\"should return true if the APDU is openApp\", () => {\n const apdu = new OpenAppCommand({ appName: \"test\" })\n .getApdu()\n .getRawApdu();\n\n expect(CommandUtils.isApduThatTriggersDisconnection(apdu)).toBe(true);\n });\n\n it(\"should return true if the APDU is closeApp\", () => {\n const apdu = new CloseAppCommand().getApdu().getRawApdu();\n\n expect(CommandUtils.isApduThatTriggersDisconnection(apdu)).toBe(true);\n });\n\n it(\"should return false if the APDU is not a known one\", () => {\n const apdu = new GetAppAndVersionCommand().getApdu().getRawApdu();\n\n expect(CommandUtils.isApduThatTriggersDisconnection(apdu)).toBe(false);\n });\n });\n});\n"],
|
5
|
+
"mappings": "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",
|
6
6
|
"names": ["import_CloseAppCommand", "import_GetAppAndVersionCommand", "import_OpenAppCommand", "import_ApduResponse", "import_CommandUtils", "response", "statusCode", "apdu"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var
|
1
|
+
"use strict";var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var C=(e,r)=>{for(var n in r)s(e,n,{get:r[n],enumerable:!0})},g=(e,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of l(r))!p.call(e,a)&&a!==n&&s(e,a,{get:()=>r[a],enumerable:!(o=i(r,a))||o.enumerable});return e};var u=e=>g(s({},"__esModule",{value:!0}),e);var x={};C(x,{GLOBAL_ERRORS:()=>m,GlobalCommandError:()=>c,GlobalCommandErrorHandler:()=>v});module.exports=u(x);var d=require("../../apdu/utils/ApduParser"),t=require("../../Error"),E=require("./CommandErrors");class c extends t.DeviceExchangeError{constructor(r){super({tag:"GlobalCommandError",...r})}}const m={5515:{message:"Device is locked.",tag:"DeviceLockedError"},5501:{message:"Action refused on device.",tag:"ActionRefusedError"},5502:{message:"Pin is not set",tag:"PinNotSetError"},5223:{message:"Device internal error",tag:"DeviceInternalError"},"6e00":{message:"CLA not supported",tag:"DeviceInternalError"},"6d00":{message:"INS not supported",tag:"DeviceInternalError"}};class v{static handle(r){const o=new d.ApduParser(r).encodeToHexaString(r.statusCode);return(0,E.isCommandErrorCode)(o,m)?new c({...m[o],errorCode:o}):new t.UnknownDeviceExchangeError({message:"UnknownError",errorCode:o})}}0&&(module.exports={GLOBAL_ERRORS,GlobalCommandError,GlobalCommandErrorHandler});
|
2
2
|
//# sourceMappingURL=GlobalCommandError.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/command/utils/GlobalCommandError.ts"],
|
4
|
-
"sourcesContent": ["import { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n type CommandErrorArgs,\n DeviceExchangeError,\n UnknownDeviceExchangeError,\n} from \"@api/Error\";\n\nimport { type CommandErrors, isCommandErrorCode } from \"./CommandErrors\";\n\n/**\n * Status word list of global errors that any command could result\n */\nexport type GlobalCommandErrorStatusCode
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,uBAAAC,EAAA,8BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA2B,sCAE3BC,EAIO,sBAEPC,EAAuD,
|
4
|
+
"sourcesContent": ["import { ApduParser } from \"@api/apdu/utils/ApduParser\";\nimport { type ApduResponse } from \"@api/device-session/ApduResponse\";\nimport {\n type CommandErrorArgs,\n DeviceExchangeError,\n UnknownDeviceExchangeError,\n} from \"@api/Error\";\n\nimport { type CommandErrors, isCommandErrorCode } from \"./CommandErrors\";\n\n/**\n * Status word list of global errors that any command could result\n */\nexport type GlobalCommandErrorStatusCode =\n | \"5515\"\n | \"5501\"\n | \"5502\"\n | \"5223\"\n | \"6e00\"\n | \"6d00\";\n\n/**\n * Global command error class\n */\nexport class GlobalCommandError extends DeviceExchangeError<GlobalCommandErrorStatusCode> {\n constructor(args: CommandErrorArgs<GlobalCommandErrorStatusCode>) {\n super({ tag: \"GlobalCommandError\", ...args });\n }\n}\n\n/**\n * Global errors dictionary that links a global status code to an error message\n */\nexport const GLOBAL_ERRORS: CommandErrors<GlobalCommandErrorStatusCode> = {\n \"5515\": { message: \"Device is locked.\", tag: \"DeviceLockedError\" },\n \"5501\": { message: \"Action refused on device.\", tag: \"ActionRefusedError\" },\n \"5502\": { message: \"Pin is not set\", tag: \"PinNotSetError\" },\n \"5223\": { message: \"Device internal error\", tag: \"DeviceInternalError\" },\n \"6e00\": { message: \"CLA not supported\", tag: \"DeviceInternalError\" },\n \"6d00\": { message: \"INS not supported\", tag: \"DeviceInternalError\" },\n};\n\n/**\n * Global error handler utility class\n */\nexport class GlobalCommandErrorHandler {\n /**\n * Static method to get a handled GlobalCommandError or an unhandled DmkError from an apdu response\n * @param apduResponse\n */\n static handle(\n apduResponse: ApduResponse,\n ): GlobalCommandError | UnknownDeviceExchangeError {\n const parser = new ApduParser(apduResponse);\n const errorCode = parser.encodeToHexaString(apduResponse.statusCode);\n if (isCommandErrorCode(errorCode, GLOBAL_ERRORS)) {\n return new GlobalCommandError({ ...GLOBAL_ERRORS[errorCode], errorCode });\n }\n return new UnknownDeviceExchangeError({\n message: \"UnknownError\",\n errorCode,\n });\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,uBAAAC,EAAA,8BAAAC,IAAA,eAAAC,EAAAL,GAAA,IAAAM,EAA2B,sCAE3BC,EAIO,sBAEPC,EAAuD,2BAgBhD,MAAML,UAA2B,qBAAkD,CACxF,YAAYM,EAAsD,CAChE,MAAM,CAAE,IAAK,qBAAsB,GAAGA,CAAK,CAAC,CAC9C,CACF,CAKO,MAAMP,EAA6D,CACxE,KAAQ,CAAE,QAAS,oBAAqB,IAAK,mBAAoB,EACjE,KAAQ,CAAE,QAAS,4BAA6B,IAAK,oBAAqB,EAC1E,KAAQ,CAAE,QAAS,iBAAkB,IAAK,gBAAiB,EAC3D,KAAQ,CAAE,QAAS,wBAAyB,IAAK,qBAAsB,EACvE,OAAQ,CAAE,QAAS,oBAAqB,IAAK,qBAAsB,EACnE,OAAQ,CAAE,QAAS,oBAAqB,IAAK,qBAAsB,CACrE,EAKO,MAAME,CAA0B,CAKrC,OAAO,OACLM,EACiD,CAEjD,MAAMC,EADS,IAAI,aAAWD,CAAY,EACjB,mBAAmBA,EAAa,UAAU,EACnE,SAAI,sBAAmBC,EAAWT,CAAa,EACtC,IAAIC,EAAmB,CAAE,GAAGD,EAAcS,CAAS,EAAG,UAAAA,CAAU,CAAC,EAEnE,IAAI,6BAA2B,CACpC,QAAS,eACT,UAAAA,CACF,CAAC,CACH,CACF",
|
6
6
|
"names": ["GlobalCommandError_exports", "__export", "GLOBAL_ERRORS", "GlobalCommandError", "GlobalCommandErrorHandler", "__toCommonJS", "import_ApduParser", "import_Error", "import_CommandErrors", "args", "apduResponse", "errorCode"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(n,e)=>{for(var o in e)i(n,o,{get:e[o],enumerable:!0})},x=(n,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!c.call(n,t)&&t!==o&&i(n,t,{get:()=>e[t],enumerable:!(a=s(e,t))||a.enumerable});return n};var y=n=>x(i({},"__esModule",{value:!0}),n);var N={};d(N,{DeviceModel:()=>m,DeviceModelId:()=>l,LEDGER_VENDOR_ID:()=>A});module.exports=y(N);var l=(r=>(r.NANO_S="nanoS",r.NANO_SP="nanoSP",r.NANO_X="nanoX",r.STAX="stax",r.FLEX="flex",r.APEX="apex",r))(l||{});class m{id;model;name;constructor({id:e,model:o,name:a}){this.id=e,this.model=o,this.name=a}}const A=11415;0&&(module.exports={DeviceModel,DeviceModelId,LEDGER_VENDOR_ID});
|
2
2
|
//# sourceMappingURL=DeviceModel.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../src/api/device/DeviceModel.ts"],
|
4
|
-
"sourcesContent": ["export enum DeviceModelId {\n NANO_S = \"nanoS\",\n NANO_SP = \"nanoSP\",\n NANO_X = \"nanoX\",\n STAX = \"stax\",\n FLEX = \"flex\",\n}\n\n/**\n * Unique identifier for a device.\n *\n * NB: This identifier is generated at runtime and is not persisted. It cannot\n * be used to identify a device across sessions.\n * There is in fact no way to identify a device across sessions, which is a\n * privacy feature of Ledger devices.\n */\nexport type DeviceId = string;\n\nexport type DeviceModelArgs = {\n readonly id: DeviceId;\n readonly model: DeviceModelId;\n readonly name: string;\n};\n\nexport class DeviceModel {\n public readonly id: DeviceId;\n public readonly model: DeviceModelId;\n public readonly name: string;\n\n constructor({ id, model, name }: DeviceModelArgs) {\n this.id = id;\n this.model = model;\n this.name = name;\n }\n}\n\nexport const LEDGER_VENDOR_ID = 0x2c97;\n"],
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,kBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAL,GAAO,IAAKG,OACVA,EAAA,OAAS,QACTA,EAAA,QAAU,SACVA,EAAA,OAAS,QACTA,EAAA,KAAO,OACPA,EAAA,KAAO,
|
4
|
+
"sourcesContent": ["export enum DeviceModelId {\n NANO_S = \"nanoS\",\n NANO_SP = \"nanoSP\",\n NANO_X = \"nanoX\",\n STAX = \"stax\",\n FLEX = \"flex\",\n APEX = \"apex\",\n}\n\n/**\n * Unique identifier for a device.\n *\n * NB: This identifier is generated at runtime and is not persisted. It cannot\n * be used to identify a device across sessions.\n * There is in fact no way to identify a device across sessions, which is a\n * privacy feature of Ledger devices.\n */\nexport type DeviceId = string;\n\nexport type DeviceModelArgs = {\n readonly id: DeviceId;\n readonly model: DeviceModelId;\n readonly name: string;\n};\n\nexport class DeviceModel {\n public readonly id: DeviceId;\n public readonly model: DeviceModelId;\n public readonly name: string;\n\n constructor({ id, model, name }: DeviceModelArgs) {\n this.id = id;\n this.model = model;\n this.name = name;\n }\n}\n\nexport const LEDGER_VENDOR_ID = 0x2c97;\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,kBAAAC,EAAA,qBAAAC,IAAA,eAAAC,EAAAL,GAAO,IAAKG,OACVA,EAAA,OAAS,QACTA,EAAA,QAAU,SACVA,EAAA,OAAS,QACTA,EAAA,KAAO,OACPA,EAAA,KAAO,OACPA,EAAA,KAAO,OANGA,OAAA,IAyBL,MAAMD,CAAY,CACP,GACA,MACA,KAEhB,YAAY,CAAE,GAAAI,EAAI,MAAAC,EAAO,KAAAC,CAAK,EAAoB,CAChD,KAAK,GAAKF,EACV,KAAK,MAAQC,EACb,KAAK,KAAOC,CACd,CACF,CAEO,MAAMJ,EAAmB",
|
6
6
|
"names": ["DeviceModel_exports", "__export", "DeviceModel", "DeviceModelId", "LEDGER_VENDOR_ID", "__toCommonJS", "id", "model", "name"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var
|
1
|
+
"use strict";var c=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var d=(o,e)=>{for(var t in e)c(o,t,{get:e[t],enumerable:!0})},p=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!m.call(o,i)&&i!==t&&c(o,i,{get:()=>e[i],enumerable:!(s=A(e,i))||s.enumerable});return o};var v=o=>p(c({},"__esModule",{value:!0}),o);var C={};d(C,{deviceActionModuleFactory:()=>f});module.exports=v(C);var n=require("inversify"),a=require("../../device-action/use-case/ExecuteDeviceActionUseCase"),u=require("../../../../src/di.stub"),r=require("./deviceActionTypes");const f=({stub:o=!1}={})=>new n.ContainerModule(({bind:e,rebindSync:t})=>{e(r.deviceActionTypes.ExecuteDeviceActionUseCase).to(a.ExecuteDeviceActionUseCase),o&&t(r.deviceActionTypes.ExecuteDeviceActionUseCase).to(u.StubUseCase)});0&&(module.exports={deviceActionModuleFactory});
|
2
2
|
//# sourceMappingURL=deviceActionModule.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-action/di/deviceActionModule.ts"],
|
4
|
-
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ntype DeviceActionModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const deviceActionModuleFactory = ({\n stub = false,\n}: DeviceActionModuleArgs = {}) =>\n new ContainerModule(
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA2C,kEAC3CC,EAA4B,6BAE5BC,EAAkC,+BAM3B,MAAML,EAA4B,CAAC,CACxC,KAAAM,EAAO,EACT,EAA4B,CAAC,IAC3B,IAAI,
|
6
|
-
"names": ["deviceActionModule_exports", "__export", "deviceActionModuleFactory", "__toCommonJS", "import_inversify", "import_ExecuteDeviceActionUseCase", "import_di", "import_deviceActionTypes", "stub", "bind", "
|
4
|
+
"sourcesContent": ["import { ContainerModule } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ntype DeviceActionModuleArgs = Partial<{\n readonly stub: boolean;\n}>;\n\nexport const deviceActionModuleFactory = ({\n stub = false,\n}: DeviceActionModuleArgs = {}) =>\n new ContainerModule(({ bind, rebindSync }) => {\n bind(deviceActionTypes.ExecuteDeviceActionUseCase).to(\n ExecuteDeviceActionUseCase,\n );\n if (stub) {\n rebindSync(deviceActionTypes.ExecuteDeviceActionUseCase).to(StubUseCase);\n }\n });\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAgC,qBAEhCC,EAA2C,kEAC3CC,EAA4B,6BAE5BC,EAAkC,+BAM3B,MAAML,EAA4B,CAAC,CACxC,KAAAM,EAAO,EACT,EAA4B,CAAC,IAC3B,IAAI,kBAAgB,CAAC,CAAE,KAAAC,EAAM,WAAAC,CAAW,IAAM,CAC5CD,EAAK,oBAAkB,0BAA0B,EAAE,GACjD,4BACF,EACID,GACFE,EAAW,oBAAkB,0BAA0B,EAAE,GAAG,aAAW,CAE3E,CAAC",
|
6
|
+
"names": ["deviceActionModule_exports", "__export", "deviceActionModuleFactory", "__toCommonJS", "import_inversify", "import_ExecuteDeviceActionUseCase", "import_di", "import_deviceActionTypes", "stub", "bind", "rebindSync"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var c=require("inversify"),r=require("../../device-action/use-case/ExecuteDeviceActionUseCase"),s=require("../../../internal/device-session/di/deviceSessionModule"),u=require("../../../internal/logger-publisher/di/loggerModule"),d=require("../../../../src/di.stub"),i=require("./deviceActionModule"),n=require("./deviceActionTypes");describe("deviceActionModule",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=(0,i.deviceActionModuleFactory)(),e=new c.Container,e.
|
1
|
+
"use strict";var c=require("inversify"),r=require("../../device-action/use-case/ExecuteDeviceActionUseCase"),s=require("../../../internal/device-session/di/deviceSessionModule"),u=require("../../../internal/logger-publisher/di/loggerModule"),d=require("../../../../src/di.stub"),i=require("./deviceActionModule"),n=require("./deviceActionTypes");describe("deviceActionModule",()=>{describe("Default",()=>{let e,t;beforeEach(()=>{t=(0,i.deviceActionModuleFactory)(),e=new c.Container,e.loadSync(t,(0,s.deviceSessionModuleFactory)(),(0,u.loggerModuleFactory)())}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return non-stubbed executeDeviceAction usecase",()=>{const o=e.get(n.deviceActionTypes.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(r.ExecuteDeviceActionUseCase)})}),describe("Stubbed",()=>{let e,t;beforeEach(()=>{t=(0,i.deviceActionModuleFactory)({stub:!0}),e=new c.Container,e.loadSync(t)}),it("should return the config module",()=>{expect(t).toBeDefined()}),it("should return stubbed executeDeviceAction usecase",()=>{const o=e.get(n.deviceActionTypes.ExecuteDeviceActionUseCase);expect(o).toBeInstanceOf(d.StubUseCase)})})});
|
2
2
|
//# sourceMappingURL=deviceActionModule.test.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-action/di/deviceActionModule.test.ts"],
|
4
|
-
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionModuleFactory } from \"./deviceActionModule\";\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ndescribe(\"deviceActionModule\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory();\n container = new Container();\n container.
|
5
|
-
"mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAA2C,kEAC3CC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAA0C,gCAC1CC,EAAkC,+BAElC,SAAS,qBAAsB,IAAM,CACnC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,6BAA0B,EAChCD,EAAY,IAAI,YAChBA,EAAU,
|
4
|
+
"sourcesContent": ["import { Container } from \"inversify\";\n\nimport { ExecuteDeviceActionUseCase } from \"@api/device-action/use-case/ExecuteDeviceActionUseCase\";\nimport { deviceSessionModuleFactory } from \"@internal/device-session/di/deviceSessionModule\";\nimport { loggerModuleFactory } from \"@internal/logger-publisher/di/loggerModule\";\nimport { StubUseCase } from \"@root/src/di.stub\";\n\nimport { deviceActionModuleFactory } from \"./deviceActionModule\";\nimport { deviceActionTypes } from \"./deviceActionTypes\";\n\ndescribe(\"deviceActionModule\", () => {\n describe(\"Default\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory();\n container = new Container();\n container.loadSync(\n mod,\n deviceSessionModuleFactory(),\n loggerModuleFactory(),\n );\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return non-stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase =\n container.get<ExecuteDeviceActionUseCase>(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(\n ExecuteDeviceActionUseCase,\n );\n });\n });\n\n describe(\"Stubbed\", () => {\n let container: Container;\n let mod: ReturnType<typeof deviceActionModuleFactory>;\n beforeEach(() => {\n mod = deviceActionModuleFactory({ stub: true });\n container = new Container();\n container.loadSync(mod);\n });\n\n it(\"should return the config module\", () => {\n expect(mod).toBeDefined();\n });\n\n it(\"should return stubbed executeDeviceAction usecase\", () => {\n const executeDeviceActionUseCase = container.get(\n deviceActionTypes.ExecuteDeviceActionUseCase,\n );\n expect(executeDeviceActionUseCase).toBeInstanceOf(StubUseCase);\n });\n });\n});\n"],
|
5
|
+
"mappings": "aAAA,IAAAA,EAA0B,qBAE1BC,EAA2C,kEAC3CC,EAA2C,2DAC3CC,EAAoC,sDACpCC,EAA4B,6BAE5BC,EAA0C,gCAC1CC,EAAkC,+BAElC,SAAS,qBAAsB,IAAM,CACnC,SAAS,UAAW,IAAM,CACxB,IAAIC,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,6BAA0B,EAChCD,EAAY,IAAI,YAChBA,EAAU,SACRC,KACA,8BAA2B,KAC3B,uBAAoB,CACtB,CACF,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,wDAAyD,IAAM,CAChE,MAAMC,EACJF,EAAU,IACR,oBAAkB,0BACpB,EACF,OAAOE,CAA0B,EAAE,eACjC,4BACF,CACF,CAAC,CACH,CAAC,EAED,SAAS,UAAW,IAAM,CACxB,IAAIF,EACAC,EACJ,WAAW,IAAM,CACfA,KAAM,6BAA0B,CAAE,KAAM,EAAK,CAAC,EAC9CD,EAAY,IAAI,YAChBA,EAAU,SAASC,CAAG,CACxB,CAAC,EAED,GAAG,kCAAmC,IAAM,CAC1C,OAAOA,CAAG,EAAE,YAAY,CAC1B,CAAC,EAED,GAAG,oDAAqD,IAAM,CAC5D,MAAMC,EAA6BF,EAAU,IAC3C,oBAAkB,0BACpB,EACA,OAAOE,CAA0B,EAAE,eAAe,aAAW,CAC/D,CAAC,CACH,CAAC,CACH,CAAC",
|
6
6
|
"names": ["import_inversify", "import_ExecuteDeviceActionUseCase", "import_deviceSessionModule", "import_loggerModule", "import_di", "import_deviceActionModule", "import_deviceActionTypes", "container", "mod", "executeDeviceActionUseCase"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var c=(l,p)=>{for(var g in p)s(l,g,{get:p[g],enumerable:!0})},f=(l,p,g,a)=>{if(p&&typeof p=="object"||typeof p=="function")for(let n of w(p))!S.call(l,n)&&n!==g&&s(l,n,{get:()=>p[n],enumerable:!(a=i(p,n))||a.enumerable});return l};var h=l=>f(s({},"__esModule",{value:!0}),l);var k={};c(k,{UserInteractionRequired:()=>A});module.exports=h(k);var A=(o=>(o.None="none",o.UnlockDevice="unlock-device",o.AllowSecureConnection="allow-secure-connection",o.ConfirmOpenApp="confirm-open-app",o.SignTransaction="sign-transaction",o.SignTypedData="sign-typed-data",o.AllowListApps="allow-list-apps",o.VerifyAddress="verify-address",o.SignPersonalMessage="sign-personal-message",o.SignDelegationAuthorization="sign-delegation-authorization",o.Web3ChecksOptIn="web3-checks-opt-in",o))(A||{});0&&(module.exports={UserInteractionRequired});
|
2
2
|
//# sourceMappingURL=UserInteractionRequired.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-action/model/UserInteractionRequired.ts"],
|
4
|
-
"sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the users about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n Web3ChecksOptIn = \"web3-checks-opt-in\",\n}\n"],
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBACtBA,EAAA,gBAAkB,
|
4
|
+
"sourcesContent": ["/**\n * The user interaction required on the device to move further in a device action.\n * This is used to inform the users about the action they need to take on the device.\n */\nexport enum UserInteractionRequired {\n None = \"none\",\n UnlockDevice = \"unlock-device\",\n AllowSecureConnection = \"allow-secure-connection\",\n ConfirmOpenApp = \"confirm-open-app\",\n SignTransaction = \"sign-transaction\",\n SignTypedData = \"sign-typed-data\",\n AllowListApps = \"allow-list-apps\",\n VerifyAddress = \"verify-address\",\n SignPersonalMessage = \"sign-personal-message\",\n SignDelegationAuthorization = \"sign-delegation-authorization\",\n Web3ChecksOptIn = \"web3-checks-opt-in\",\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6BAAAE,IAAA,eAAAC,EAAAH,GAIO,IAAKE,OACVA,EAAA,KAAO,OACPA,EAAA,aAAe,gBACfA,EAAA,sBAAwB,0BACxBA,EAAA,eAAiB,mBACjBA,EAAA,gBAAkB,mBAClBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,kBAChBA,EAAA,cAAgB,iBAChBA,EAAA,oBAAsB,wBACtBA,EAAA,4BAA8B,gCAC9BA,EAAA,gBAAkB,qBAXRA,OAAA",
|
6
6
|
"names": ["UserInteractionRequired_exports", "__export", "UserInteractionRequired", "__toCommonJS"]
|
7
7
|
}
|
package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var
|
1
|
+
"use strict";var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var m=(r,t)=>{for(var s in t)o(r,s,{get:t[s],enumerable:!0})},C=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!I.call(r,n)&&n!==s&&o(r,n,{get:()=>t[n],enumerable:!(e=A(t,n))||e.enumerable});return r};var d=r=>C(o({},"__esModule",{value:!0}),r);var S={};m(S,{CallTaskInAppDeviceAction:()=>D});module.exports=d(S);var p=require("purify-ts"),a=require("xstate"),l=require("../../../command/model/CommandResult"),i=require("../../../device-action/model/UserInteractionRequired"),c=require("../../../device-action/os/Errors"),u=require("../../../device-action/os/OpenAppDeviceAction/OpenAppDeviceAction"),k=require("../../../device-action/xstate-utils/XStateDeviceAction");class D extends k.XStateDeviceAction{makeStateMachine(t){const{callTask:s}=this.extractDependencies(t);return(0,a.setup)({types:{input:{},context:{},output:{}},actors:{callTask:(0,a.fromPromise)(s),openAppStateMachine:new u.OpenAppDeviceAction({input:{appName:this.input.appName}}).makeStateMachine(t)},guards:{skipOpenApp:()=>this.input.skipOpenApp,noInternalError:({context:e})=>e._internalState.error===null},actions:{assignErrorFromEvent:(0,a.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"CallTaskInAppDeviceAction",initial:"InitialState",context:({input:e})=>({input:e,intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None},_internalState:{taskResponse:null,error:null}}),states:{InitialState:{always:[{target:"CallTask",guard:"skipOpenApp"},"OpenAppDeviceAction"]},OpenAppDeviceAction:{invoke:{id:"openAppStateMachine",input:{appName:this.input.appName},src:"openAppStateMachine",onSnapshot:{actions:(0,a.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{actions:(0,a.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:n=>({...e.context._internalState,error:n})})}),target:"CheckOpenAppDeviceActionResult"}}},CheckOpenAppDeviceActionResult:{always:[{target:"CallTask",guard:"noInternalError"},"Error"]},CallTask:{entry:(0,a.assign)({intermediateValue:{requiredUserInteraction:this.input.requiredUserInteraction}}),exit:(0,a.assign)({intermediateValue:{requiredUserInteraction:i.UserInteractionRequired.None}}),invoke:{id:"callTask",src:"callTask",input:e=>e.context.input.task,onDone:{target:"CallTaskResultCheck",actions:[(0,a.assign)({_internalState:({event:e,context:n})=>(0,l.isSuccessCommandResult)(e.output)?{...n._internalState,taskResponse:e.output.data}:{...n._internalState,error:e.output.error}})]},onError:{target:"Error",actions:"assignErrorFromEvent"}}},CallTaskResultCheck:{always:[{target:"Success",guard:"noInternalError"},"Error"]},Success:{type:"final"},Error:{type:"final"}},output:({context:e})=>e._internalState.taskResponse?(0,p.Right)(e._internalState.taskResponse):(0,p.Left)(e._internalState.error||new c.UnknownDAError("No error in final state"))})}extractDependencies(t){return{callTask:s=>s.input(t)}}}0&&(module.exports={CallTaskInAppDeviceAction});
|
2
2
|
//# sourceMappingURL=CallTaskInAppDeviceAction.js.map
|
package/lib/cjs/src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceAction.ts"],
|
4
|
-
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type CommandResult,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAInput,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAInternalState,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, calls a task\n * in the app.\n * The output will be the result of the task.\n *\n * ```ts\n * input: {\n * appName: string;\n * task: (internalApi: InternalApi) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new CallTaskInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * task: async (internalApi: InternalApi) => internalApi.sendCommand(new MyAppSpecificCommand()),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class CallTaskInAppDeviceAction<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n > {\n type types = StateMachineTypes<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >;\n\n const { callTask } = this.extractDependencies(internalAPI);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n callTask: fromPromise(callTask),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\n
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4B,qBAC5BC,EAA2C,kBAE3CC,EAGO,4CAEPC,EAAwC,4DACxCC,EAA+B,wCAC/BC,EAAoC,yEAEpCC,EAGO,8DAoCA,MAAMR,UAIH,oBAMR,CACA,iBACES,EAOA,CASA,KAAM,CAAE,SAAAC,CAAS,EAAI,KAAK,oBAAoBD,CAAW,EAEzD,SAAO,SAAM,CACX,MAAO,CACL,MAAO,CAAC,EACR,QAAS,CAAC,EACV,OAAQ,CAAC,CACX,EACA,OAAQ,CACN,YAAU,eAAYC,CAAQ,EAC9B,oBAAqB,IAAI,sBAAoB,CAC3C,MAAO,CACL,QAAS,KAAK,MAAM,
|
4
|
+
"sourcesContent": ["import { Left, Right } from \"purify-ts\";\nimport { assign, fromPromise, setup } from \"xstate\";\n\nimport {\n type CommandResult,\n isSuccessCommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport { UserInteractionRequired } from \"@api/device-action/model/UserInteractionRequired\";\nimport { UnknownDAError } from \"@api/device-action/os/Errors\";\nimport { OpenAppDeviceAction } from \"@api/device-action/os/OpenAppDeviceAction/OpenAppDeviceAction\";\nimport { type StateMachineTypes } from \"@api/device-action/xstate-utils/StateMachineTypes\";\nimport {\n type DeviceActionStateMachine,\n XStateDeviceAction,\n} from \"@api/device-action/xstate-utils/XStateDeviceAction\";\n\nimport {\n type CallTaskInAppDAError,\n type CallTaskInAppDAInput,\n type CallTaskInAppDAIntermediateValue,\n type CallTaskInAppDAInternalState,\n type CallTaskInAppDAOutput,\n} from \"./CallTaskInAppDeviceActionTypes\";\n\n/**\n * Tries to open an app on the device, and if it is successful, calls a task\n * in the app.\n * The output will be the result of the task.\n *\n * ```ts\n * input: {\n * appName: string;\n * task: (internalApi: InternalApi) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n * requiredUserInteraction: UserInteraction;\n * }\n * ```\n *\n * Example of usage:\n *\n * ```ts\n * const deviceAction = new CallTaskInAppDeviceAction({\n * input: {\n * appName: \"MyApp\",\n * task: async (internalApi: InternalApi) => internalApi.sendCommand(new MyAppSpecificCommand()),\n * requiredUserInteraction: UserInteractionRequired.None,\n * },\n * });\n * dmk.executeDeviceAction({ sessionId: \"mySessionId\", deviceAction });\n * ```\n */\nexport class CallTaskInAppDeviceAction<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction extends UserInteractionRequired,\n> extends XStateDeviceAction<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n> {\n makeStateMachine(\n internalAPI: InternalApi,\n ): DeviceActionStateMachine<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n > {\n type types = StateMachineTypes<\n CallTaskInAppDAOutput<TaskResponse>,\n CallTaskInAppDAInput<TaskResponse, TaskErrorCodes, UserInteraction>,\n CallTaskInAppDAError<TaskErrorCodes>,\n CallTaskInAppDAIntermediateValue<UserInteraction>,\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >;\n\n const { callTask } = this.extractDependencies(internalAPI);\n\n return setup({\n types: {\n input: {} as types[\"input\"],\n context: {} as types[\"context\"],\n output: {} as types[\"output\"],\n },\n actors: {\n callTask: fromPromise(callTask),\n openAppStateMachine: new OpenAppDeviceAction({\n input: {\n appName: this.input.appName,\n },\n }).makeStateMachine(internalAPI),\n },\n guards: {\n skipOpenApp: () => this.input.skipOpenApp,\n noInternalError: ({ context }) => context._internalState.error === null,\n },\n actions: {\n assignErrorFromEvent: assign({\n _internalState: (_) => ({\n ..._.context._internalState,\n error: _.event[\"error\"], // NOTE: it should never happen, the error is not typed anymore here\n }),\n }),\n },\n }).createMachine({\n id: \"CallTaskInAppDeviceAction\",\n initial: \"InitialState\",\n context: ({ input }) => {\n return {\n input: input,\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n _internalState: {\n taskResponse: null,\n error: null,\n },\n };\n },\n states: {\n InitialState: {\n always: [\n {\n target: \"CallTask\",\n guard: \"skipOpenApp\",\n },\n \"OpenAppDeviceAction\",\n ],\n },\n OpenAppDeviceAction: {\n invoke: {\n id: \"openAppStateMachine\",\n input: {\n appName: this.input.appName,\n },\n src: \"openAppStateMachine\",\n onSnapshot: {\n actions: assign({\n intermediateValue: (_) =>\n _.event.snapshot.context.intermediateValue,\n }),\n },\n onDone: {\n actions: assign({\n _internalState: (_) => {\n return _.event.output.caseOf<\n CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes>\n >({\n Right: () => _.context._internalState,\n Left: (error) => ({\n ..._.context._internalState,\n error,\n }),\n });\n },\n }),\n target: \"CheckOpenAppDeviceActionResult\",\n },\n },\n },\n CheckOpenAppDeviceActionResult: {\n always: [\n {\n target: \"CallTask\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n CallTask: {\n entry: assign({\n intermediateValue: {\n requiredUserInteraction: this.input.requiredUserInteraction,\n },\n }),\n exit: assign({\n intermediateValue: {\n requiredUserInteraction: UserInteractionRequired.None,\n },\n }),\n invoke: {\n id: \"callTask\",\n src: \"callTask\",\n input: (_: { context: types[\"context\"] }) => _.context.input.task,\n onDone: {\n target: \"CallTaskResultCheck\",\n actions: [\n assign({\n _internalState: ({ event, context }) => {\n if (isSuccessCommandResult(event.output)) {\n return {\n ...context._internalState,\n taskResponse: event.output.data,\n };\n }\n return {\n ...context._internalState,\n error: event.output.error,\n };\n },\n }),\n ],\n },\n onError: {\n target: \"Error\",\n actions: \"assignErrorFromEvent\",\n },\n },\n },\n CallTaskResultCheck: {\n always: [\n {\n target: \"Success\",\n guard: \"noInternalError\",\n },\n \"Error\",\n ],\n },\n Success: {\n type: \"final\",\n },\n Error: {\n type: \"final\",\n },\n },\n output: ({ context }) =>\n context._internalState.taskResponse\n ? Right(context._internalState.taskResponse)\n : Left(\n context._internalState.error ||\n new UnknownDAError(\"No error in final state\"),\n ),\n });\n }\n\n extractDependencies(internalApi: InternalApi) {\n return {\n callTask: (_: {\n input: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n }): Promise<CommandResult<TaskResponse, TaskErrorCodes>> =>\n _.input(internalApi),\n };\n }\n}\n"],
|
5
|
+
"mappings": "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",
|
6
6
|
"names": ["CallTaskInAppDeviceAction_exports", "__export", "CallTaskInAppDeviceAction", "__toCommonJS", "import_purify_ts", "import_xstate", "import_CommandResult", "import_UserInteractionRequired", "import_Errors", "import_OpenAppDeviceAction", "import_XStateDeviceAction", "internalAPI", "callTask", "context", "_", "input", "error", "event", "internalApi"]
|
7
7
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../../src/api/device-action/os/CallTaskInAppDeviceAction/CallTaskInAppDeviceActionTypes.ts"],
|
4
|
-
"sourcesContent": ["import {\n type CommandErrorResult,\n type CommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\n\nexport type CallTaskInAppDAOutput<TaskResponse> = TaskResponse;\n\nexport type CallTaskInAppDAInput<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction,\n> = {\n readonly task: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n readonly appName: string;\n readonly skipOpenApp: boolean;\n readonly requiredUserInteraction: UserInteraction;\n
|
4
|
+
"sourcesContent": ["import {\n type CommandErrorResult,\n type CommandResult,\n} from \"@api/command/model/CommandResult\";\nimport { type InternalApi } from \"@api/device-action/DeviceAction\";\nimport {\n type OpenAppDAError,\n type OpenAppDAIntermediateValue,\n} from \"@api/device-action/os/OpenAppDeviceAction/types\";\n\nexport type CallTaskInAppDAOutput<TaskResponse> = TaskResponse;\n\nexport type CallTaskInAppDAInput<\n TaskResponse,\n TaskErrorCodes,\n UserInteraction,\n> = {\n readonly task: (\n internalApi: InternalApi,\n ) => Promise<CommandResult<TaskResponse, TaskErrorCodes>>;\n readonly appName: string;\n readonly skipOpenApp: boolean;\n readonly requiredUserInteraction: UserInteraction;\n};\n\nexport type CallTaskInAppDAError<TaskErrorCodes = void> =\n | OpenAppDAError\n | CommandErrorResult<TaskErrorCodes>[\"error\"];\n\nexport type CallTaskInAppDAIntermediateValue<UserInteraction> =\n | { readonly requiredUserInteraction: UserInteraction }\n | OpenAppDAIntermediateValue;\n\nexport type CallTaskInAppDAInternalState<TaskResponse, TaskErrorCodes> = {\n readonly taskResponse: TaskResponse | null;\n readonly error: CallTaskInAppDAError<TaskErrorCodes> | null;\n};\n"],
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
6
6
|
"names": ["CallTaskInAppDeviceActionTypes_exports", "__toCommonJS"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var l=(o,r)=>{for(var e in r)t(o,e,{get:r[e],enumerable:!0})},d=(o,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of s(r))!E.call(o,n)&&n!==e&&t(o,n,{get:()=>r[n],enumerable:!(i=a(r,n))||i.enumerable});return o};var c=o=>d(t({},"__esModule",{value:!0}),o);var A={};l(A,{AppAlreadyInstalledDAError:()=>y,DeviceLockedError:()=>m,DeviceNotOnboardedError:()=>g,OutOfMemoryDAError:()=>k,RefusedByUserDAError:()=>D,UnknownDAError:()=>w,UnsupportedFirmwareDAError:()=>p});module.exports=c(A);class g{_tag="DeviceNotOnboardedError";originalError;constructor(r){this.originalError=new Error(r??"Device not onboarded.")}}class m{_tag="DeviceLockedError";originalError;constructor(r){this.originalError=new Error(r??"Device locked.")}}class p{_tag="UnsupportedFirmwareDAError";originalError;constructor(r){this.originalError=new Error(r??"Unknown error.")}}class D{_tag="RefusedByUserDAError";originalError;constructor(r){this.originalError=new Error(r??"Unknown error.")}}class y{_tag="AppAlreadyInstalledDAError";originalError;constructor(r){this.originalError=new Error(r??"Unknown error.")}}class k{_tag="OutOfMemoryDAError";originalError;constructor(r){this.originalError=new Error(r??"Unknown error.")}}class w{_tag="UnknownDAError";originalError;constructor(r){this.originalError=new Error(r??"Unknown error.")}}0&&(module.exports={AppAlreadyInstalledDAError,DeviceLockedError,DeviceNotOnboardedError,OutOfMemoryDAError,RefusedByUserDAError,UnknownDAError,UnsupportedFirmwareDAError});
|
2
2
|
//# sourceMappingURL=Errors.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../../src/api/device-action/os/Errors.ts"],
|
4
|
-
"sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport class DeviceNotOnboardedError implements DmkError {\n readonly _tag = \"DeviceNotOnboardedError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Device not onboarded.\");\n }\n}\n\nexport class DeviceLockedError implements DmkError {\n readonly _tag = \"DeviceLockedError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Device locked.\");\n }\n}\n\nexport class UnsupportedFirmwareDAError implements DmkError {\n readonly _tag = \"UnsupportedFirmwareDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n\nexport class OutOfMemoryDAError implements DmkError {\n readonly _tag = \"OutOfMemoryDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n\nexport class UnknownDAError implements DmkError {\n readonly _tag = \"UnknownDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n"],
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
6
|
-
"names": ["Errors_exports", "__export", "DeviceLockedError", "DeviceNotOnboardedError", "OutOfMemoryDAError", "UnknownDAError", "UnsupportedFirmwareDAError", "__toCommonJS", "message"]
|
4
|
+
"sourcesContent": ["import { type DmkError } from \"@api/Error\";\n\nexport class DeviceNotOnboardedError implements DmkError {\n readonly _tag = \"DeviceNotOnboardedError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Device not onboarded.\");\n }\n}\n\nexport class DeviceLockedError implements DmkError {\n readonly _tag = \"DeviceLockedError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Device locked.\");\n }\n}\n\nexport class UnsupportedFirmwareDAError implements DmkError {\n readonly _tag = \"UnsupportedFirmwareDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n\nexport class RefusedByUserDAError implements DmkError {\n readonly _tag = \"RefusedByUserDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n\nexport class AppAlreadyInstalledDAError implements DmkError {\n readonly _tag = \"AppAlreadyInstalledDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n\nexport class OutOfMemoryDAError implements DmkError {\n readonly _tag = \"OutOfMemoryDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n\nexport class UnknownDAError implements DmkError {\n readonly _tag = \"UnknownDAError\";\n readonly originalError?: Error;\n\n constructor(message?: string) {\n this.originalError = new Error(message ?? \"Unknown error.\");\n }\n}\n"],
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,EAAA,sBAAAC,EAAA,4BAAAC,EAAA,uBAAAC,EAAA,yBAAAC,EAAA,mBAAAC,EAAA,+BAAAC,IAAA,eAAAC,EAAAT,GAEO,MAAMI,CAA4C,CAC9C,KAAO,0BACP,cAET,YAAYM,EAAkB,CAC5B,KAAK,cAAgB,IAAI,MAAMA,GAAW,uBAAuB,CACnE,CACF,CAEO,MAAMP,CAAsC,CACxC,KAAO,oBACP,cAET,YAAYO,EAAkB,CAC5B,KAAK,cAAgB,IAAI,MAAMA,GAAW,gBAAgB,CAC5D,CACF,CAEO,MAAMF,CAA+C,CACjD,KAAO,6BACP,cAET,YAAYE,EAAkB,CAC5B,KAAK,cAAgB,IAAI,MAAMA,GAAW,gBAAgB,CAC5D,CACF,CAEO,MAAMJ,CAAyC,CAC3C,KAAO,uBACP,cAET,YAAYI,EAAkB,CAC5B,KAAK,cAAgB,IAAI,MAAMA,GAAW,gBAAgB,CAC5D,CACF,CAEO,MAAMR,CAA+C,CACjD,KAAO,6BACP,cAET,YAAYQ,EAAkB,CAC5B,KAAK,cAAgB,IAAI,MAAMA,GAAW,gBAAgB,CAC5D,CACF,CAEO,MAAML,CAAuC,CACzC,KAAO,qBACP,cAET,YAAYK,EAAkB,CAC5B,KAAK,cAAgB,IAAI,MAAMA,GAAW,gBAAgB,CAC5D,CACF,CAEO,MAAMH,CAAmC,CACrC,KAAO,iBACP,cAET,YAAYG,EAAkB,CAC5B,KAAK,cAAgB,IAAI,MAAMA,GAAW,gBAAgB,CAC5D,CACF",
|
6
|
+
"names": ["Errors_exports", "__export", "AppAlreadyInstalledDAError", "DeviceLockedError", "DeviceNotOnboardedError", "OutOfMemoryDAError", "RefusedByUserDAError", "UnknownDAError", "UnsupportedFirmwareDAError", "__toCommonJS", "message"]
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var v=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var O=(i,a)=>{for(var s in a)v(i,s,{get:a[s],enumerable:!0})},P=(i,a,s,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of R(a))!b.call(i,o)&&o!==s&&v(i,o,{get:()=>a[o],enumerable:!(p=L(a,o))||p.enumerable});return i};var q=i=>P(v({},"__esModule",{value:!0}),i);var B={};O(B,{GetDeviceMetadataDeviceAction:()=>N});module.exports=q(B);var d=require("purify-ts"),n=require("xstate"),f=require("../../../command/model/CommandResult"),l=require("../../../device-action/model/UserInteractionRequired"),h=require("../../../device-action/os/Const"),D=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),M=require("../../../device-action/os/ListApps/ListAppsDeviceAction"),y=require("../../../device-action/task/GetApplicationsMetadataTask"),A=require("../../../device-action/task/GetFirmwareMetadataTask"),C=require("../../../device-action/xstate-utils/XStateDeviceAction"),c=require("../../../device-session/DeviceSessionState"),x=require("../../../secure-channel/device-action/ListInstalledApps/types"),V=require("../../../secure-channel/task/ConnectToSecureChannelTask"),u=require("../../../secure-channel/task/types");class N extends C.XStateDeviceAction{makeStateMachine(a){const{getDeviceMetadata:s,getFirmwareMetadata:p,getApplicationsMetadata:o,listAppsSecureChannel:S}=this.extractDependencies(a),t=this.input.unlockTimeout??h.DEFAULT_UNLOCK_TIMEOUT_MS,m=new D.GoToDashboardDeviceAction({input:{unlockTimeout:t}}).makeStateMachine(a),g=new M.ListAppsDeviceAction({input:{unlockTimeout:t}}).makeStateMachine(a);return(0,n.setup)({types:{input:{unlockTimeout:t},context:{},output:{}},actors:{goToDashboard:m,getDeviceMetadata:(0,n.fromPromise)(s),getFirmwareMetadata:(0,n.fromPromise)(p),getApplicationsMetadata:(0,n.fromPromise)(o),listApps:g,listAppsSecureChannel:(0,n.fromObservable)(S)},guards:{hasError:({context:e})=>e._internalState.error!==null,hasMetadata:({context:e})=>e._internalState.firmwareVersion!==null&&e._internalState.firmwareUpdateContext!==null&&e._internalState.customImage!==null&&e._internalState.applications!==null&&e._internalState.applicationsUpdates!==null&&e._internalState.installedLanguages!==null&&e._internalState.catalog!==null,forceUpdate:({context:e})=>!!e.input.forceUpdate,useSecureChannel:({context:e})=>!!e.input.useSecureChannel},actions:{assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GetDeviceMetadataDeviceAction",initial:"DeviceReady",context:e=>({input:{useSecureChannel:e.input.useSecureChannel,forceUpdate:e.input.forceUpdate,unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None},_internalState:{error:null,deviceVersion:null,firmware:null,firmwareVersion:null,firmwareUpdateContext:null,customImage:null,installedApps:null,applications:null,applicationsUpdates:null,installedLanguages:null,catalog:null}}),states:{DeviceReady:{always:[{target:"GoToDashboard",guard:"forceUpdate"},{target:"GetDeviceMetadataFromContext"}]},GetDeviceMetadataFromContext:{invoke:{src:"getDeviceMetadata",onDone:{target:"GetDeviceMetadataFromContextResultCheck",actions:(0,n.assign)({_internalState:e=>e.event.output===null?e.context._internalState:{...e.context._internalState,firmwareVersion:e.event.output.firmwareVersion,firmwareUpdateContext:e.event.output.firmwareUpdateContext,customImage:e.event.output.customImage,applications:e.event.output.applications,applicationsUpdates:e.event.output.applicationsUpdates,installedLanguages:e.event.output.installedLanguages,catalog:e.event.output.catalog}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetDeviceMetadataFromContextResultCheck:{always:[{target:"Success",guard:"hasMetadata"},{target:"GoToDashboard"}]},GoToDashboard:{exit:(0,n.assign)({intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None}}),invoke:{id:"dashboard",src:"goToDashboard",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{target:"GoToDashboardCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetFirmwareMetadata"}]},GetFirmwareMetadata:{invoke:{src:"getFirmwareMetadata",onDone:{target:"GetFirmwareMetadataResultCheck",actions:(0,n.assign)({_internalState:e=>{if((0,f.isSuccessCommandResult)(e.event.output)){const r=a.getDeviceSessionState();return r.sessionStateType!==c.DeviceSessionStateType.Connected&&a.setDeviceSessionState({...r,firmwareVersion:e.event.output.data.firmwareVersion,firmwareUpdateContext:e.event.output.data.firmwareUpdateContext,customImage:e.event.output.data.customImage}),{...e.context._internalState,deviceVersion:e.event.output.data.deviceVersion,firmware:e.event.output.data.firmware,firmwareVersion:e.event.output.data.firmwareVersion,firmwareUpdateContext:e.event.output.data.firmwareUpdateContext,customImage:e.event.output.data.customImage}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetFirmwareMetadataResultCheck:{always:[{guard:"hasError",target:"Error"},{guard:"useSecureChannel",target:"ListAppsSecureChannel"},{target:"ListApps"}]},ListAppsSecureChannel:{exit:(0,n.assign)({intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None}}),invoke:{id:"listAppsSecureChannel",src:"listAppsSecureChannel",input:e=>({firmware:e.context._internalState.firmware,firmwareVersion:e.context._internalState.firmwareVersion}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case u.SecureChannelEventType.PermissionRequested:return{requiredUserInteraction:l.UserInteractionRequired.AllowSecureConnection};case u.SecureChannelEventType.PermissionGranted:{const r=a.getDeviceSessionState();return r.sessionStateType!==c.DeviceSessionStateType.Connected&&a.setDeviceSessionState({...r,isSecureConnectionAllowed:!0}),{requiredUserInteraction:l.UserInteractionRequired.None}}default:return{...e.context.intermediateValue}}},_internalState:e=>{if(e.event.snapshot.context?.type===u.SecureChannelEventType.Result){if((0,x.installedAppResultGuard)(e.event.snapshot.context.payload))return{...e.context._internalState,installedApps:e.event.snapshot.context.payload.map(r=>({name:r.name,hash:r.hash,hashCode:r.hash_code_data}))};throw new Error(`Invalid result ${JSON.stringify(e.event.snapshot.context.payload)}`)}return{...e.context._internalState}}})},onDone:{target:"ListAppsCheck"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ListApps:{exit:(0,n.assign)({intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None}}),invoke:{id:"listApps",src:"listApps",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{target:"ListAppsCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.isLeft()?{...e.context._internalState,error:e.event.output.extract()}:{...e.context._internalState,installedApps:e.event.output.unsafeCoerce().map(r=>({name:r.appName,hash:r.appFullHash,hashCode:r.appCodeHash}))}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetApplicationsMetadata"}]},GetApplicationsMetadata:{invoke:{src:"getApplicationsMetadata",input:e=>({deviceVersion:e.context._internalState.deviceVersion,firmware:e.context._internalState.firmware,firmwareVersion:e.context._internalState.firmwareVersion,installedApps:e.context._internalState.installedApps}),onDone:{target:"GetApplicationsMetadataResultCheck",actions:(0,n.assign)({_internalState:e=>{if((0,f.isSuccessCommandResult)(e.event.output)){const r=a.getDeviceSessionState();return r.sessionStateType!==c.DeviceSessionStateType.Connected&&a.setDeviceSessionState({...r,installedApps:e.event.output.data.applications,appsUpdates:e.event.output.data.applicationsUpdates,installedLanguages:e.event.output.data.installedLanguages,catalog:e.event.output.data.catalog}),{...e.context._internalState,applications:e.event.output.data.applications,applicationsUpdates:e.event.output.data.applicationsUpdates,installedLanguages:e.event.output.data.installedLanguages,catalog:e.event.output.data.catalog}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetApplicationsMetadataResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:r}=e,{error:w,firmwareVersion:G,firmwareUpdateContext:I,customImage:F,applications:E,applicationsUpdates:U,installedLanguages:k,catalog:T}=r._internalState;return w?(0,d.Left)(w):(0,d.Right)({firmwareVersion:G,firmwareUpdateContext:I,customImage:F,applications:E,applicationsUpdates:U,installedLanguages:k,catalog:T})}})}extractDependencies(a){return{getDeviceMetadata:async()=>{const t=a.getDeviceSessionState();return t.sessionStateType===c.DeviceSessionStateType.Connected||t.firmwareVersion?.metadata===void 0||t.firmwareUpdateContext===void 0||t.customImage===void 0||t.installedApps.length===0||t.appsUpdates===void 0||t.installedLanguages===void 0||t.catalog===void 0?null:{firmwareVersion:t.firmwareVersion,firmwareUpdateContext:t.firmwareUpdateContext,customImage:t.customImage,applications:t.installedApps,applicationsUpdates:t.appsUpdates,installedLanguages:t.installedLanguages,catalog:t.catalog}},getFirmwareMetadata:async()=>new A.GetFirmwareMetadataTask(a).run(),getApplicationsMetadata:async t=>new y.GetApplicationsMetadataTask(a,{deviceVersion:t.input.deviceVersion,firmware:t.input.firmware,firmwareVersion:t.input.firmwareVersion,installedApps:t.input.installedApps}).run(),listAppsSecureChannel:t=>{const{firmware:m,firmwareVersion:g}=t.input,e=a.getSecureChannelService().listInstalledApps(g.metadata,m);return new V.ConnectToSecureChannelTask(a,{connection:e}).run()}}}}0&&(module.exports={GetDeviceMetadataDeviceAction});
|
1
|
+
"use strict";var v=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var O=(i,a)=>{for(var s in a)v(i,s,{get:a[s],enumerable:!0})},P=(i,a,s,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of R(a))!b.call(i,o)&&o!==s&&v(i,o,{get:()=>a[o],enumerable:!(p=L(a,o))||p.enumerable});return i};var q=i=>P(v({},"__esModule",{value:!0}),i);var B={};O(B,{GetDeviceMetadataDeviceAction:()=>N});module.exports=q(B);var d=require("purify-ts"),n=require("xstate"),f=require("../../../command/model/CommandResult"),l=require("../../../device-action/model/UserInteractionRequired"),h=require("../../../device-action/os/Const"),D=require("../../../device-action/os/GoToDashboard/GoToDashboardDeviceAction"),M=require("../../../device-action/os/ListApps/ListAppsDeviceAction"),y=require("../../../device-action/task/GetApplicationsMetadataTask"),A=require("../../../device-action/task/GetFirmwareMetadataTask"),C=require("../../../device-action/xstate-utils/XStateDeviceAction"),c=require("../../../device-session/DeviceSessionState"),x=require("../../../secure-channel/device-action/ListInstalledApps/types"),V=require("../../../secure-channel/task/ConnectToSecureChannelTask"),u=require("../../../secure-channel/task/types");class N extends C.XStateDeviceAction{makeStateMachine(a){const{getDeviceMetadata:s,getFirmwareMetadata:p,getApplicationsMetadata:o,listAppsSecureChannel:S}=this.extractDependencies(a),t=this.input.unlockTimeout??h.DEFAULT_UNLOCK_TIMEOUT_MS,m=new D.GoToDashboardDeviceAction({input:{unlockTimeout:t}}).makeStateMachine(a),g=new M.ListAppsDeviceAction({input:{unlockTimeout:t}}).makeStateMachine(a);return(0,n.setup)({types:{input:{unlockTimeout:t},context:{},output:{}},actors:{goToDashboard:m,getDeviceMetadata:(0,n.fromPromise)(s),getFirmwareMetadata:(0,n.fromPromise)(p),getApplicationsMetadata:(0,n.fromPromise)(o),listApps:g,listAppsSecureChannel:(0,n.fromObservable)(S)},guards:{hasError:({context:e})=>e._internalState.error!==null,hasMetadata:({context:e})=>e._internalState.firmwareVersion!==null&&e._internalState.firmwareUpdateContext!==null&&e._internalState.customImage!==null&&e._internalState.applications!==null&&e._internalState.applicationsUpdates!==null&&e._internalState.installedLanguages!==null&&e._internalState.catalog!==null,forceUpdate:({context:e})=>!!e.input.forceUpdate,useSecureChannel:({context:e})=>!!e.input.useSecureChannel},actions:{assignErrorFromEvent:(0,n.assign)({_internalState:e=>({...e.context._internalState,error:e.event.error})})}}).createMachine({id:"GetDeviceMetadataDeviceAction",initial:"DeviceReady",context:e=>({input:{useSecureChannel:e.input.useSecureChannel,forceUpdate:e.input.forceUpdate,unlockTimeout:e.input.unlockTimeout},intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None},_internalState:{error:null,deviceVersion:null,firmware:null,firmwareVersion:null,firmwareUpdateContext:null,customImage:null,installedApps:null,applications:null,applicationsUpdates:null,installedLanguages:null,catalog:null}}),states:{DeviceReady:{always:[{target:"GoToDashboard",guard:"forceUpdate"},{target:"GetDeviceMetadataFromContext"}]},GetDeviceMetadataFromContext:{invoke:{src:"getDeviceMetadata",onDone:{target:"GetDeviceMetadataFromContextResultCheck",actions:(0,n.assign)({_internalState:e=>e.event.output===null?e.context._internalState:{...e.context._internalState,firmwareVersion:e.event.output.firmwareVersion,firmwareUpdateContext:e.event.output.firmwareUpdateContext,customImage:e.event.output.customImage,applications:e.event.output.applications,applicationsUpdates:e.event.output.applicationsUpdates,installedLanguages:e.event.output.installedLanguages,catalog:e.event.output.catalog}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetDeviceMetadataFromContextResultCheck:{always:[{target:"Success",guard:"hasMetadata"},{target:"GoToDashboard"}]},GoToDashboard:{exit:(0,n.assign)({intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None}}),invoke:{id:"dashboard",src:"goToDashboard",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{target:"GoToDashboardCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.caseOf({Right:()=>e.context._internalState,Left:r=>({...e.context._internalState,error:r})})})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GoToDashboardCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetFirmwareMetadata"}]},GetFirmwareMetadata:{invoke:{src:"getFirmwareMetadata",onDone:{target:"GetFirmwareMetadataResultCheck",actions:(0,n.assign)({_internalState:e=>{if((0,f.isSuccessCommandResult)(e.event.output)){const r=a.getDeviceSessionState();return r.sessionStateType!==c.DeviceSessionStateType.Connected&&a.setDeviceSessionState({...r,firmwareVersion:e.event.output.data.firmwareVersion,firmwareUpdateContext:e.event.output.data.firmwareUpdateContext,customImage:e.event.output.data.customImage}),{...e.context._internalState,deviceVersion:e.event.output.data.deviceVersion,firmware:e.event.output.data.firmware,firmwareVersion:e.event.output.data.firmwareVersion,firmwareUpdateContext:e.event.output.data.firmwareUpdateContext,customImage:e.event.output.data.customImage}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetFirmwareMetadataResultCheck:{always:[{guard:"hasError",target:"Error"},{guard:"useSecureChannel",target:"ListAppsSecureChannel"},{target:"ListApps"}]},ListAppsSecureChannel:{exit:(0,n.assign)({intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None}}),invoke:{id:"listAppsSecureChannel",src:"listAppsSecureChannel",input:e=>({firmware:e.context._internalState.firmware,firmwareVersion:e.context._internalState.firmwareVersion}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>{switch(e.event.snapshot.context?.type){case u.SecureChannelEventType.PermissionRequested:return{requiredUserInteraction:l.UserInteractionRequired.AllowSecureConnection};case u.SecureChannelEventType.PermissionGranted:{const r=a.getDeviceSessionState();return r.sessionStateType!==c.DeviceSessionStateType.Connected&&a.setDeviceSessionState({...r,isSecureConnectionAllowed:!0}),{requiredUserInteraction:l.UserInteractionRequired.None}}default:return{...e.context.intermediateValue}}},_internalState:e=>{if(e.event.snapshot.context?.type===u.SecureChannelEventType.Error)return{...e.context._internalState,error:e.event.snapshot.context.error.mapDAErrors()};if(e.event.snapshot.context?.type===u.SecureChannelEventType.Result){if((0,x.installedAppResultGuard)(e.event.snapshot.context.payload))return{...e.context._internalState,installedApps:e.event.snapshot.context.payload.map(r=>({name:r.name,hash:r.hash,hashCode:r.hash_code_data}))};throw new Error(`Invalid result ${JSON.stringify(e.event.snapshot.context.payload)}`)}return{...e.context._internalState}}})},onDone:{target:"ListAppsCheck"},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ListApps:{exit:(0,n.assign)({intermediateValue:{requiredUserInteraction:l.UserInteractionRequired.None}}),invoke:{id:"listApps",src:"listApps",input:e=>({unlockTimeout:e.context.input.unlockTimeout}),onSnapshot:{actions:(0,n.assign)({intermediateValue:e=>e.event.snapshot.context.intermediateValue})},onDone:{target:"ListAppsCheck",actions:(0,n.assign)({_internalState:e=>e.event.output.isLeft()?{...e.context._internalState,error:e.event.output.extract()}:{...e.context._internalState,installedApps:e.event.output.unsafeCoerce().map(r=>({name:r.appName,hash:r.appFullHash,hashCode:r.appCodeHash}))}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},ListAppsCheck:{always:[{target:"Error",guard:"hasError"},{target:"GetApplicationsMetadata"}]},GetApplicationsMetadata:{invoke:{src:"getApplicationsMetadata",input:e=>({deviceVersion:e.context._internalState.deviceVersion,firmware:e.context._internalState.firmware,firmwareVersion:e.context._internalState.firmwareVersion,installedApps:e.context._internalState.installedApps}),onDone:{target:"GetApplicationsMetadataResultCheck",actions:(0,n.assign)({_internalState:e=>{if((0,f.isSuccessCommandResult)(e.event.output)){const r=a.getDeviceSessionState();return r.sessionStateType!==c.DeviceSessionStateType.Connected&&a.setDeviceSessionState({...r,installedApps:e.event.output.data.applications,appsUpdates:e.event.output.data.applicationsUpdates,installedLanguages:e.event.output.data.installedLanguages,catalog:e.event.output.data.catalog}),{...e.context._internalState,applications:e.event.output.data.applications,applicationsUpdates:e.event.output.data.applicationsUpdates,installedLanguages:e.event.output.data.installedLanguages,catalog:e.event.output.data.catalog}}return{...e.context._internalState,error:e.event.output.error}}})},onError:{target:"Error",actions:"assignErrorFromEvent"}}},GetApplicationsMetadataResultCheck:{always:[{guard:"hasError",target:"Error"},{target:"Success"}]},Success:{type:"final"},Error:{type:"final"}},output:e=>{const{context:r}=e,{error:w,firmwareVersion:G,firmwareUpdateContext:I,customImage:E,applications:F,applicationsUpdates:U,installedLanguages:k,catalog:T}=r._internalState;return w?(0,d.Left)(w):(0,d.Right)({firmwareVersion:G,firmwareUpdateContext:I,customImage:E,applications:F,applicationsUpdates:U,installedLanguages:k,catalog:T})}})}extractDependencies(a){return{getDeviceMetadata:async()=>{const t=a.getDeviceSessionState();return t.sessionStateType===c.DeviceSessionStateType.Connected||t.firmwareVersion?.metadata===void 0||t.firmwareUpdateContext===void 0||t.customImage===void 0||t.installedApps.length===0||t.appsUpdates===void 0||t.installedLanguages===void 0||t.catalog===void 0?null:{firmwareVersion:t.firmwareVersion,firmwareUpdateContext:t.firmwareUpdateContext,customImage:t.customImage,applications:t.installedApps,applicationsUpdates:t.appsUpdates,installedLanguages:t.installedLanguages,catalog:t.catalog}},getFirmwareMetadata:async()=>new A.GetFirmwareMetadataTask(a).run(),getApplicationsMetadata:async t=>new y.GetApplicationsMetadataTask(a,{deviceVersion:t.input.deviceVersion,firmware:t.input.firmware,firmwareVersion:t.input.firmwareVersion,installedApps:t.input.installedApps}).run(),listAppsSecureChannel:t=>{const{firmware:m,firmwareVersion:g}=t.input,e=a.getSecureChannelService().listInstalledApps(g.metadata,m);return new V.ConnectToSecureChannelTask(a,{connection:e}).run()}}}}0&&(module.exports={GetDeviceMetadataDeviceAction});
|
2
2
|
//# sourceMappingURL=GetDeviceMetadataDeviceAction.js.map
|