@ledgerhq/device-core 0.1.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/.turbo/turbo-build.log +4 -0
- package/LICENSE.txt +21 -0
- package/jest.config.json +13 -0
- package/lib/capabilities/isCustomLockScreenSupported.d.ts +5 -0
- package/lib/capabilities/isCustomLockScreenSupported.d.ts.map +1 -0
- package/lib/capabilities/isCustomLockScreenSupported.js +16 -0
- package/lib/capabilities/isCustomLockScreenSupported.js.map +1 -0
- package/lib/capabilities/isCustomLockScreenSupported.test.d.ts +2 -0
- package/lib/capabilities/isCustomLockScreenSupported.test.d.ts.map +1 -0
- package/lib/capabilities/isCustomLockScreenSupported.test.js +22 -0
- package/lib/capabilities/isCustomLockScreenSupported.test.js.map +1 -0
- package/lib/capabilities/isEditDeviceNameSupported.d.ts +3 -0
- package/lib/capabilities/isEditDeviceNameSupported.d.ts.map +1 -0
- package/lib/capabilities/isEditDeviceNameSupported.js +9 -0
- package/lib/capabilities/isEditDeviceNameSupported.js.map +1 -0
- package/lib/capabilities/isEditDeviceNameSupported.test.d.ts +2 -0
- package/lib/capabilities/isEditDeviceNameSupported.test.d.ts.map +1 -0
- package/lib/capabilities/isEditDeviceNameSupported.test.js +19 -0
- package/lib/capabilities/isEditDeviceNameSupported.test.js.map +1 -0
- package/lib/capabilities/isSyncOnboardingSupported.d.ts +3 -0
- package/lib/capabilities/isSyncOnboardingSupported.d.ts.map +1 -0
- package/lib/capabilities/isSyncOnboardingSupported.js +9 -0
- package/lib/capabilities/isSyncOnboardingSupported.js.map +1 -0
- package/lib/capabilities/isSyncOnboardingSupported.test.d.ts +2 -0
- package/lib/capabilities/isSyncOnboardingSupported.test.d.ts.map +1 -0
- package/lib/capabilities/isSyncOnboardingSupported.test.js +17 -0
- package/lib/capabilities/isSyncOnboardingSupported.test.js.map +1 -0
- package/lib/commands/entities/APDU.d.ts +9 -0
- package/lib/commands/entities/APDU.d.ts.map +1 -0
- package/lib/commands/entities/APDU.js +3 -0
- package/lib/commands/entities/APDU.js.map +1 -0
- package/lib/commands/entities/FirmwareInfoEntity.d.ts +16 -0
- package/lib/commands/entities/FirmwareInfoEntity.d.ts.map +1 -0
- package/lib/commands/entities/FirmwareInfoEntity.js +3 -0
- package/lib/commands/entities/FirmwareInfoEntity.js.map +1 -0
- package/lib/commands/use-cases/getDeviceName.d.ts +3 -0
- package/lib/commands/use-cases/getDeviceName.d.ts.map +1 -0
- package/lib/commands/use-cases/getDeviceName.js +48 -0
- package/lib/commands/use-cases/getDeviceName.js.map +1 -0
- package/lib/commands/use-cases/getVersion.d.ts +15 -0
- package/lib/commands/use-cases/getVersion.d.ts.map +1 -0
- package/lib/commands/use-cases/getVersion.js +31 -0
- package/lib/commands/use-cases/getVersion.js.map +1 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.d.ts +7 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.d.ts.map +1 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.js +20 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.js.map +1 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.test.d.ts +2 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.test.d.ts.map +1 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.test.js +53 -0
- package/lib/commands/use-cases/isBootloaderVersionSupported.test.js.map +1 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.d.ts +3 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.d.ts.map +1 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.js +15 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.js.map +1 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.test.d.ts +2 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.test.d.ts.map +1 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.test.js +45 -0
- package/lib/commands/use-cases/isDeviceLocalizationSupported.test.js.map +1 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.d.ts +7 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.d.ts.map +1 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.js +16 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.js.map +1 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.test.d.ts +2 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.test.d.ts.map +1 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.test.js +36 -0
- package/lib/commands/use-cases/isHardwareVersionSupported.test.js.map +1 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.d.ts +3 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.d.ts.map +1 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.js +23 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.js.map +1 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.test.d.ts +2 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.test.d.ts.map +1 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.test.js +27 -0
- package/lib/commands/use-cases/parseGetDeviceNameResponse.test.js.map +1 -0
- package/lib/commands/use-cases/parseGetVersionResponse.d.ts +4 -0
- package/lib/commands/use-cases/parseGetVersionResponse.d.ts.map +1 -0
- package/lib/commands/use-cases/parseGetVersionResponse.js +108 -0
- package/lib/commands/use-cases/parseGetVersionResponse.js.map +1 -0
- package/lib/commands/use-cases/parseGetVersionResponse.test.d.ts +2 -0
- package/lib/commands/use-cases/parseGetVersionResponse.test.d.ts.map +1 -0
- package/lib/commands/use-cases/parseGetVersionResponse.test.js +105 -0
- package/lib/commands/use-cases/parseGetVersionResponse.test.js.map +1 -0
- package/lib/customLockScreen/screenSpecs.d.ts +30 -0
- package/lib/customLockScreen/screenSpecs.d.ts.map +1 -0
- package/lib/customLockScreen/screenSpecs.js +46 -0
- package/lib/customLockScreen/screenSpecs.js.map +1 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +56 -0
- package/lib/index.js.map +1 -0
- package/lib/managerApi/entities/AppEntity.d.ts +62 -0
- package/lib/managerApi/entities/AppEntity.d.ts.map +1 -0
- package/lib/managerApi/entities/AppEntity.js +12 -0
- package/lib/managerApi/entities/AppEntity.js.map +1 -0
- package/lib/managerApi/entities/DeviceInfoEntity.d.ts +22 -0
- package/lib/managerApi/entities/DeviceInfoEntity.d.ts.map +1 -0
- package/lib/managerApi/entities/DeviceInfoEntity.js +3 -0
- package/lib/managerApi/entities/DeviceInfoEntity.js.map +1 -0
- package/lib/managerApi/entities/DeviceVersionEntity.d.ts +17 -0
- package/lib/managerApi/entities/DeviceVersionEntity.d.ts.map +1 -0
- package/lib/managerApi/entities/DeviceVersionEntity.js +3 -0
- package/lib/managerApi/entities/DeviceVersionEntity.js.map +1 -0
- package/lib/managerApi/entities/FirmwareUpdateContextEntity.d.ts +42 -0
- package/lib/managerApi/entities/FirmwareUpdateContextEntity.d.ts.map +1 -0
- package/lib/managerApi/entities/FirmwareUpdateContextEntity.js +3 -0
- package/lib/managerApi/entities/FirmwareUpdateContextEntity.js.map +1 -0
- package/lib/managerApi/entities/Id.d.ts +2 -0
- package/lib/managerApi/entities/Id.d.ts.map +1 -0
- package/lib/managerApi/entities/Id.js +3 -0
- package/lib/managerApi/entities/Id.js.map +1 -0
- package/lib/managerApi/entities/LanguagePackageEntity.d.ts +20 -0
- package/lib/managerApi/entities/LanguagePackageEntity.d.ts.map +1 -0
- package/lib/managerApi/entities/LanguagePackageEntity.js +3 -0
- package/lib/managerApi/entities/LanguagePackageEntity.js.map +1 -0
- package/lib/managerApi/entities/mocks/aDeviceInfo.d.ts +3 -0
- package/lib/managerApi/entities/mocks/aDeviceInfo.d.ts.map +1 -0
- package/lib/managerApi/entities/mocks/aDeviceInfo.js +8 -0
- package/lib/managerApi/entities/mocks/aDeviceInfo.js.map +1 -0
- package/lib/managerApi/entities/mocks/aDeviceVersion.d.ts +3 -0
- package/lib/managerApi/entities/mocks/aDeviceVersion.d.ts.map +1 -0
- package/lib/managerApi/entities/mocks/aDeviceVersion.js +8 -0
- package/lib/managerApi/entities/mocks/aDeviceVersion.js.map +1 -0
- package/lib/managerApi/entities/mocks/aFinalFirmware.d.ts +3 -0
- package/lib/managerApi/entities/mocks/aFinalFirmware.d.ts.map +1 -0
- package/lib/managerApi/entities/mocks/aFinalFirmware.js +8 -0
- package/lib/managerApi/entities/mocks/aFinalFirmware.js.map +1 -0
- package/lib/managerApi/entities/mocks/aOsuFirmware.d.ts +19 -0
- package/lib/managerApi/entities/mocks/aOsuFirmware.d.ts.map +1 -0
- package/lib/managerApi/entities/mocks/aOsuFirmware.js +8 -0
- package/lib/managerApi/entities/mocks/aOsuFirmware.js.map +1 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.d.ts +18 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.d.ts.map +1 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.js +204 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.js.map +1 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.test.d.ts +2 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.test.d.ts.map +1 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.test.js +402 -0
- package/lib/managerApi/repositories/HttpManagerApiRepository.test.js.map +1 -0
- package/lib/managerApi/repositories/ManagerApiRepository.d.ts +54 -0
- package/lib/managerApi/repositories/ManagerApiRepository.d.ts.map +1 -0
- package/lib/managerApi/repositories/ManagerApiRepository.js +3 -0
- package/lib/managerApi/repositories/ManagerApiRepository.js.map +1 -0
- package/lib/managerApi/repositories/StubManagerApiRepository.d.ts +15 -0
- package/lib/managerApi/repositories/StubManagerApiRepository.d.ts.map +1 -0
- package/lib/managerApi/repositories/StubManagerApiRepository.js +44 -0
- package/lib/managerApi/repositories/StubManagerApiRepository.js.map +1 -0
- package/lib/managerApi/use-cases/fetchMcus.d.ts +3 -0
- package/lib/managerApi/use-cases/fetchMcus.d.ts.map +1 -0
- package/lib/managerApi/use-cases/fetchMcus.js +8 -0
- package/lib/managerApi/use-cases/fetchMcus.js.map +1 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.d.ts +12 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.d.ts.map +1 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.js +62 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.js.map +1 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.test.d.ts +2 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.test.d.ts.map +1 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.test.js +178 -0
- package/lib/managerApi/use-cases/getLatestFirmwareForDevice.test.js.map +1 -0
- package/lib/managerApi/use-cases/getProviderIdUseCase.d.ts +7 -0
- package/lib/managerApi/use-cases/getProviderIdUseCase.d.ts.map +1 -0
- package/lib/managerApi/use-cases/getProviderIdUseCase.js +23 -0
- package/lib/managerApi/use-cases/getProviderIdUseCase.js.map +1 -0
- package/lib/managerApi/use-cases/getUserHashes.d.ts +5 -0
- package/lib/managerApi/use-cases/getUserHashes.d.ts.map +1 -0
- package/lib/managerApi/use-cases/getUserHashes.js +33 -0
- package/lib/managerApi/use-cases/getUserHashes.js.map +1 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.d.ts +5 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.d.ts.map +1 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.js +12 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.js.map +1 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.test.d.ts +2 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.test.d.ts.map +1 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.test.js +20 -0
- package/lib-es/capabilities/isCustomLockScreenSupported.test.js.map +1 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.d.ts +3 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.d.ts.map +1 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.js +5 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.js.map +1 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.test.d.ts +2 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.test.d.ts.map +1 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.test.js +17 -0
- package/lib-es/capabilities/isEditDeviceNameSupported.test.js.map +1 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.d.ts +3 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.d.ts.map +1 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.js +5 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.js.map +1 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.test.d.ts +2 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.test.d.ts.map +1 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.test.js +15 -0
- package/lib-es/capabilities/isSyncOnboardingSupported.test.js.map +1 -0
- package/lib-es/commands/entities/APDU.d.ts +9 -0
- package/lib-es/commands/entities/APDU.d.ts.map +1 -0
- package/lib-es/commands/entities/APDU.js +2 -0
- package/lib-es/commands/entities/APDU.js.map +1 -0
- package/lib-es/commands/entities/FirmwareInfoEntity.d.ts +16 -0
- package/lib-es/commands/entities/FirmwareInfoEntity.d.ts.map +1 -0
- package/lib-es/commands/entities/FirmwareInfoEntity.js +2 -0
- package/lib-es/commands/entities/FirmwareInfoEntity.js.map +1 -0
- package/lib-es/commands/use-cases/getDeviceName.d.ts +3 -0
- package/lib-es/commands/use-cases/getDeviceName.d.ts.map +1 -0
- package/lib-es/commands/use-cases/getDeviceName.js +44 -0
- package/lib-es/commands/use-cases/getDeviceName.js.map +1 -0
- package/lib-es/commands/use-cases/getVersion.d.ts +15 -0
- package/lib-es/commands/use-cases/getVersion.d.ts.map +1 -0
- package/lib-es/commands/use-cases/getVersion.js +27 -0
- package/lib-es/commands/use-cases/getVersion.js.map +1 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.d.ts +7 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.d.ts.map +1 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.js +16 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.js.map +1 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.test.d.ts +2 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.test.d.ts.map +1 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.test.js +51 -0
- package/lib-es/commands/use-cases/isBootloaderVersionSupported.test.js.map +1 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.d.ts +3 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.d.ts.map +1 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.js +11 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.js.map +1 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.test.d.ts +2 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.test.d.ts.map +1 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.test.js +43 -0
- package/lib-es/commands/use-cases/isDeviceLocalizationSupported.test.js.map +1 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.d.ts +7 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.d.ts.map +1 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.js +12 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.js.map +1 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.test.d.ts +2 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.test.d.ts.map +1 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.test.js +34 -0
- package/lib-es/commands/use-cases/isHardwareVersionSupported.test.js.map +1 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.d.ts +3 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.d.ts.map +1 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.js +19 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.js.map +1 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.test.d.ts +2 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.test.d.ts.map +1 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.test.js +25 -0
- package/lib-es/commands/use-cases/parseGetDeviceNameResponse.test.js.map +1 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.d.ts +4 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.d.ts.map +1 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.js +104 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.js.map +1 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.test.d.ts +2 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.test.d.ts.map +1 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.test.js +103 -0
- package/lib-es/commands/use-cases/parseGetVersionResponse.test.js.map +1 -0
- package/lib-es/customLockScreen/screenSpecs.d.ts +30 -0
- package/lib-es/customLockScreen/screenSpecs.d.ts.map +1 -0
- package/lib-es/customLockScreen/screenSpecs.js +40 -0
- package/lib-es/customLockScreen/screenSpecs.js.map +1 -0
- package/lib-es/index.d.ts +23 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +21 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/managerApi/entities/AppEntity.d.ts +62 -0
- package/lib-es/managerApi/entities/AppEntity.d.ts.map +1 -0
- package/lib-es/managerApi/entities/AppEntity.js +9 -0
- package/lib-es/managerApi/entities/AppEntity.js.map +1 -0
- package/lib-es/managerApi/entities/DeviceInfoEntity.d.ts +22 -0
- package/lib-es/managerApi/entities/DeviceInfoEntity.d.ts.map +1 -0
- package/lib-es/managerApi/entities/DeviceInfoEntity.js +2 -0
- package/lib-es/managerApi/entities/DeviceInfoEntity.js.map +1 -0
- package/lib-es/managerApi/entities/DeviceVersionEntity.d.ts +17 -0
- package/lib-es/managerApi/entities/DeviceVersionEntity.d.ts.map +1 -0
- package/lib-es/managerApi/entities/DeviceVersionEntity.js +2 -0
- package/lib-es/managerApi/entities/DeviceVersionEntity.js.map +1 -0
- package/lib-es/managerApi/entities/FirmwareUpdateContextEntity.d.ts +42 -0
- package/lib-es/managerApi/entities/FirmwareUpdateContextEntity.d.ts.map +1 -0
- package/lib-es/managerApi/entities/FirmwareUpdateContextEntity.js +2 -0
- package/lib-es/managerApi/entities/FirmwareUpdateContextEntity.js.map +1 -0
- package/lib-es/managerApi/entities/Id.d.ts +2 -0
- package/lib-es/managerApi/entities/Id.d.ts.map +1 -0
- package/lib-es/managerApi/entities/Id.js +2 -0
- package/lib-es/managerApi/entities/Id.js.map +1 -0
- package/lib-es/managerApi/entities/LanguagePackageEntity.d.ts +20 -0
- package/lib-es/managerApi/entities/LanguagePackageEntity.d.ts.map +1 -0
- package/lib-es/managerApi/entities/LanguagePackageEntity.js +2 -0
- package/lib-es/managerApi/entities/LanguagePackageEntity.js.map +1 -0
- package/lib-es/managerApi/entities/mocks/aDeviceInfo.d.ts +3 -0
- package/lib-es/managerApi/entities/mocks/aDeviceInfo.d.ts.map +1 -0
- package/lib-es/managerApi/entities/mocks/aDeviceInfo.js +4 -0
- package/lib-es/managerApi/entities/mocks/aDeviceInfo.js.map +1 -0
- package/lib-es/managerApi/entities/mocks/aDeviceVersion.d.ts +3 -0
- package/lib-es/managerApi/entities/mocks/aDeviceVersion.d.ts.map +1 -0
- package/lib-es/managerApi/entities/mocks/aDeviceVersion.js +4 -0
- package/lib-es/managerApi/entities/mocks/aDeviceVersion.js.map +1 -0
- package/lib-es/managerApi/entities/mocks/aFinalFirmware.d.ts +3 -0
- package/lib-es/managerApi/entities/mocks/aFinalFirmware.d.ts.map +1 -0
- package/lib-es/managerApi/entities/mocks/aFinalFirmware.js +4 -0
- package/lib-es/managerApi/entities/mocks/aFinalFirmware.js.map +1 -0
- package/lib-es/managerApi/entities/mocks/aOsuFirmware.d.ts +19 -0
- package/lib-es/managerApi/entities/mocks/aOsuFirmware.d.ts.map +1 -0
- package/lib-es/managerApi/entities/mocks/aOsuFirmware.js +4 -0
- package/lib-es/managerApi/entities/mocks/aOsuFirmware.js.map +1 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.d.ts +18 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.d.ts.map +1 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.js +197 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.js.map +1 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.test.d.ts +2 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.test.d.ts.map +1 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.test.js +400 -0
- package/lib-es/managerApi/repositories/HttpManagerApiRepository.test.js.map +1 -0
- package/lib-es/managerApi/repositories/ManagerApiRepository.d.ts +54 -0
- package/lib-es/managerApi/repositories/ManagerApiRepository.d.ts.map +1 -0
- package/lib-es/managerApi/repositories/ManagerApiRepository.js +2 -0
- package/lib-es/managerApi/repositories/ManagerApiRepository.js.map +1 -0
- package/lib-es/managerApi/repositories/StubManagerApiRepository.d.ts +15 -0
- package/lib-es/managerApi/repositories/StubManagerApiRepository.d.ts.map +1 -0
- package/lib-es/managerApi/repositories/StubManagerApiRepository.js +40 -0
- package/lib-es/managerApi/repositories/StubManagerApiRepository.js.map +1 -0
- package/lib-es/managerApi/use-cases/fetchMcus.d.ts +3 -0
- package/lib-es/managerApi/use-cases/fetchMcus.d.ts.map +1 -0
- package/lib-es/managerApi/use-cases/fetchMcus.js +4 -0
- package/lib-es/managerApi/use-cases/fetchMcus.js.map +1 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.d.ts +12 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.d.ts.map +1 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.js +58 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.js.map +1 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.test.d.ts +2 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.test.d.ts.map +1 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.test.js +176 -0
- package/lib-es/managerApi/use-cases/getLatestFirmwareForDevice.test.js.map +1 -0
- package/lib-es/managerApi/use-cases/getProviderIdUseCase.d.ts +7 -0
- package/lib-es/managerApi/use-cases/getProviderIdUseCase.d.ts.map +1 -0
- package/lib-es/managerApi/use-cases/getProviderIdUseCase.js +19 -0
- package/lib-es/managerApi/use-cases/getProviderIdUseCase.js.map +1 -0
- package/lib-es/managerApi/use-cases/getUserHashes.d.ts +5 -0
- package/lib-es/managerApi/use-cases/getUserHashes.d.ts.map +1 -0
- package/lib-es/managerApi/use-cases/getUserHashes.js +26 -0
- package/lib-es/managerApi/use-cases/getUserHashes.js.map +1 -0
- package/package.json +67 -0
- package/src/capabilities/isCustomLockScreenSupported.test.ts +25 -0
- package/src/capabilities/isCustomLockScreenSupported.ts +17 -0
- package/src/capabilities/isEditDeviceNameSupported.test.ts +18 -0
- package/src/capabilities/isEditDeviceNameSupported.ts +5 -0
- package/src/capabilities/isSyncOnboardingSupported.test.ts +16 -0
- package/src/capabilities/isSyncOnboardingSupported.ts +5 -0
- package/src/commands/entities/APDU.ts +12 -0
- package/src/commands/entities/FirmwareInfoEntity.ts +14 -0
- package/src/commands/use-cases/getDeviceName.ts +38 -0
- package/src/commands/use-cases/getVersion.ts +23 -0
- package/src/commands/use-cases/isBootloaderVersionSupported.test.ts +58 -0
- package/src/commands/use-cases/isBootloaderVersionSupported.ts +24 -0
- package/src/commands/use-cases/isDeviceLocalizationSupported.test.ts +48 -0
- package/src/commands/use-cases/isDeviceLocalizationSupported.ts +20 -0
- package/src/commands/use-cases/isHardwareVersionSupported.test.ts +39 -0
- package/src/commands/use-cases/isHardwareVersionSupported.ts +20 -0
- package/src/commands/use-cases/parseGetDeviceNameResponse.test.ts +35 -0
- package/src/commands/use-cases/parseGetDeviceNameResponse.ts +20 -0
- package/src/commands/use-cases/parseGetVersionResponse.test.ts +123 -0
- package/src/commands/use-cases/parseGetVersionResponse.ts +121 -0
- package/src/customLockScreen/screenSpecs.ts +87 -0
- package/src/index.ts +33 -0
- package/src/managerApi/entities/AppEntity.ts +66 -0
- package/src/managerApi/entities/DeviceInfoEntity.ts +26 -0
- package/src/managerApi/entities/DeviceVersionEntity.ts +17 -0
- package/src/managerApi/entities/FirmwareUpdateContextEntity.ts +44 -0
- package/src/managerApi/entities/Id.ts +1 -0
- package/src/managerApi/entities/LanguagePackageEntity.ts +21 -0
- package/src/managerApi/entities/mocks/aDeviceInfo.ts +16 -0
- package/src/managerApi/entities/mocks/aDeviceVersion.ts +22 -0
- package/src/managerApi/entities/mocks/aFinalFirmware.ts +25 -0
- package/src/managerApi/entities/mocks/aOsuFirmware.ts +22 -0
- package/src/managerApi/repositories/HttpManagerApiRepository.test.ts +494 -0
- package/src/managerApi/repositories/HttpManagerApiRepository.ts +284 -0
- package/src/managerApi/repositories/ManagerApiRepository.ts +68 -0
- package/src/managerApi/repositories/StubManagerApiRepository.ts +49 -0
- package/src/managerApi/use-cases/fetchMcus.ts +5 -0
- package/src/managerApi/use-cases/getLatestFirmwareForDevice.test.ts +196 -0
- package/src/managerApi/use-cases/getLatestFirmwareForDevice.ts +66 -0
- package/src/managerApi/use-cases/getProviderIdUseCase.ts +24 -0
- package/src/managerApi/use-cases/getUserHashes.ts +30 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
2
|
+
import { isEditDeviceNameSupported } from "./isEditDeviceNameSupported";
|
|
3
|
+
|
|
4
|
+
const supportedDevices = [DeviceModelId.stax, DeviceModelId.nanoX, DeviceModelId.europa];
|
|
5
|
+
const unsupportedDevices = [DeviceModelId.nanoS, DeviceModelId.blue, DeviceModelId.nanoSP];
|
|
6
|
+
|
|
7
|
+
describe("isEditDeviceNameSupported", () => {
|
|
8
|
+
it("should return true for supported devices", () => {
|
|
9
|
+
supportedDevices.forEach((deviceModelId: DeviceModelId) => {
|
|
10
|
+
expect(isEditDeviceNameSupported(deviceModelId)).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
it("should return false for unsupported devices", () => {
|
|
14
|
+
unsupportedDevices.forEach((deviceModelId: DeviceModelId) => {
|
|
15
|
+
expect(isEditDeviceNameSupported(deviceModelId)).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
2
|
+
import { isSyncOnboardingSupported } from "./isSyncOnboardingSupported";
|
|
3
|
+
|
|
4
|
+
describe("isSyncOnboardingSupported", () => {
|
|
5
|
+
it("should return true if sync onboarding is supported", () => {
|
|
6
|
+
expect(isSyncOnboardingSupported(DeviceModelId.stax)).toBe(true);
|
|
7
|
+
expect(isSyncOnboardingSupported(DeviceModelId.europa)).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("should return false if sync onboarding is not supported", () => {
|
|
11
|
+
expect(isSyncOnboardingSupported(DeviceModelId.nanoS)).toBe(false);
|
|
12
|
+
expect(isSyncOnboardingSupported(DeviceModelId.nanoSP)).toBe(false);
|
|
13
|
+
expect(isSyncOnboardingSupported(DeviceModelId.nanoX)).toBe(false);
|
|
14
|
+
expect(isSyncOnboardingSupported(DeviceModelId.blue)).toBe(false);
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type FirmwareInfoEntity = {
|
|
2
|
+
isBootloader: boolean;
|
|
3
|
+
rawVersion: string; // if SE seVersion, if BL blVersion
|
|
4
|
+
targetId: number; // if SE seTargetId, if BL mcuTargetId
|
|
5
|
+
seVersion?: string;
|
|
6
|
+
mcuVersion: string; // NB historically not undefined. but will be ""
|
|
7
|
+
mcuBlVersion?: string;
|
|
8
|
+
mcuTargetId?: number;
|
|
9
|
+
seTargetId?: number;
|
|
10
|
+
flags: Buffer;
|
|
11
|
+
bootloaderVersion?: string;
|
|
12
|
+
hardwareVersion?: number;
|
|
13
|
+
languageId?: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Transport, { StatusCodes } from "@ledgerhq/hw-transport";
|
|
2
|
+
import { LocalTracer } from "@ledgerhq/logs";
|
|
3
|
+
import { APDU } from "../entities/APDU";
|
|
4
|
+
import { parseGetDeviceNameResponse } from "./parseGetDeviceNameResponse";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A first APDU that we send because getDeviceName sometimes misbehaves on LNX
|
|
8
|
+
* if it's not sent.
|
|
9
|
+
* cf. https://github.com/LedgerHQ/ledger-live/pull/2250 where it was removed
|
|
10
|
+
* cf. https://github.com/LedgerHQ/ledger-live/pull/2401 where it was added back
|
|
11
|
+
*/
|
|
12
|
+
const CLEANING_APDU: APDU = [0xe0, 0x50, 0x00, 0x00, undefined];
|
|
13
|
+
|
|
14
|
+
const GET_DEVICE_NAME_APDU: APDU = [0xe0, 0xd2, 0x00, 0x00, Buffer.from([])];
|
|
15
|
+
|
|
16
|
+
export async function getDeviceName(transport: Transport): Promise<string> {
|
|
17
|
+
const tracer = new LocalTracer("hw", {
|
|
18
|
+
transport: transport.getTraceContext(),
|
|
19
|
+
function: "getDeviceName",
|
|
20
|
+
});
|
|
21
|
+
tracer.trace("Start");
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
// Legacy: prevents bad apdu response for LNX
|
|
25
|
+
await transport.send(...CLEANING_APDU);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
tracer.trace(`Error on 0xe0500000: ${error}`, { error });
|
|
28
|
+
}
|
|
29
|
+
tracer.trace("Sent cleaning 0xe0500000");
|
|
30
|
+
|
|
31
|
+
const res = await transport.send(...GET_DEVICE_NAME_APDU, [
|
|
32
|
+
StatusCodes.OK,
|
|
33
|
+
StatusCodes.DEVICE_NOT_ONBOARDED,
|
|
34
|
+
StatusCodes.DEVICE_NOT_ONBOARDED_2,
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
return parseGetDeviceNameResponse(res);
|
|
38
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Transport from "@ledgerhq/hw-transport";
|
|
2
|
+
import { FirmwareInfoEntity } from "../entities/FirmwareInfoEntity";
|
|
3
|
+
import { APDU } from "../entities/APDU";
|
|
4
|
+
import { parseGetVersionResponse } from "./parseGetVersionResponse";
|
|
5
|
+
|
|
6
|
+
export const GET_VERSION_APDU: APDU = [0xe0, 0x01, 0x00, 0x00, undefined];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get the FirmwareInfo of a given device
|
|
10
|
+
*
|
|
11
|
+
* @param transport
|
|
12
|
+
* @param options - Contains optional options:
|
|
13
|
+
* - abortTimeoutMs: aborts the APDU exchange after a given timeout
|
|
14
|
+
*/
|
|
15
|
+
export async function getVersion(
|
|
16
|
+
transport: Transport,
|
|
17
|
+
{ abortTimeoutMs }: { abortTimeoutMs?: number } = {},
|
|
18
|
+
): Promise<FirmwareInfoEntity> {
|
|
19
|
+
const res = await transport.send(...GET_VERSION_APDU, undefined, {
|
|
20
|
+
abortTimeoutMs,
|
|
21
|
+
});
|
|
22
|
+
return parseGetVersionResponse(res);
|
|
23
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
2
|
+
import { isBootloaderVersionSupported } from "./isBootloaderVersionSupported";
|
|
3
|
+
|
|
4
|
+
const { nanoS, nanoSP, nanoX, stax } = DeviceModelId;
|
|
5
|
+
|
|
6
|
+
test("isBootloaderVersionSupported", () => {
|
|
7
|
+
/**
|
|
8
|
+
* Nano S
|
|
9
|
+
* */
|
|
10
|
+
expect(isBootloaderVersionSupported("1.9.0", nanoS)).toBe(false);
|
|
11
|
+
expect(isBootloaderVersionSupported("1.9.0-whatever0", nanoS)).toBe(false);
|
|
12
|
+
|
|
13
|
+
expect(isBootloaderVersionSupported("2.0.0", nanoS)).toBe(true);
|
|
14
|
+
expect(isBootloaderVersionSupported("2.0.0-rc1", nanoS)).toBe(true);
|
|
15
|
+
expect(isBootloaderVersionSupported("2.0.1", nanoS)).toBe(true);
|
|
16
|
+
expect(isBootloaderVersionSupported("2.0.1-whatever0", nanoS)).toBe(true);
|
|
17
|
+
expect(isBootloaderVersionSupported("2.1.0", nanoS)).toBe(true);
|
|
18
|
+
expect(isBootloaderVersionSupported("2.1.0-whatever0", nanoS)).toBe(true);
|
|
19
|
+
expect(isBootloaderVersionSupported("3.0.0", nanoS)).toBe(true);
|
|
20
|
+
expect(isBootloaderVersionSupported("3.0.0-whatever0", nanoS)).toBe(true);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Nano X
|
|
24
|
+
* */
|
|
25
|
+
expect(isBootloaderVersionSupported("1.9.0", nanoX)).toBe(false);
|
|
26
|
+
expect(isBootloaderVersionSupported("1.9.0-whatever0", nanoX)).toBe(false);
|
|
27
|
+
|
|
28
|
+
expect(isBootloaderVersionSupported("2.0.0", nanoX)).toBe(true);
|
|
29
|
+
expect(isBootloaderVersionSupported("2.0.0-rc1", nanoX)).toBe(true);
|
|
30
|
+
expect(isBootloaderVersionSupported("2.0.1", nanoX)).toBe(true);
|
|
31
|
+
expect(isBootloaderVersionSupported("2.0.1-whatever0", nanoX)).toBe(true);
|
|
32
|
+
expect(isBootloaderVersionSupported("2.1.0", nanoX)).toBe(true);
|
|
33
|
+
expect(isBootloaderVersionSupported("2.1.0-whatever0", nanoX)).toBe(true);
|
|
34
|
+
expect(isBootloaderVersionSupported("3.0.0", nanoX)).toBe(true);
|
|
35
|
+
expect(isBootloaderVersionSupported("3.0.0-whatever0", nanoX)).toBe(true);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Nano SP
|
|
39
|
+
* */
|
|
40
|
+
expect(isBootloaderVersionSupported("0.9.0", nanoSP)).toBe(false);
|
|
41
|
+
expect(isBootloaderVersionSupported("0.9.0-whatever0", nanoSP)).toBe(false);
|
|
42
|
+
|
|
43
|
+
expect(isBootloaderVersionSupported("1.0.0", nanoSP)).toBe(true);
|
|
44
|
+
expect(isBootloaderVersionSupported("1.0.0-rc1", nanoSP)).toBe(true);
|
|
45
|
+
expect(isBootloaderVersionSupported("1.0.1", nanoSP)).toBe(true);
|
|
46
|
+
expect(isBootloaderVersionSupported("1.0.1-whatever0", nanoSP)).toBe(true);
|
|
47
|
+
expect(isBootloaderVersionSupported("1.1.0", nanoSP)).toBe(true);
|
|
48
|
+
expect(isBootloaderVersionSupported("1.1.0-whatever0", nanoSP)).toBe(true);
|
|
49
|
+
expect(isBootloaderVersionSupported("1.0.0", nanoSP)).toBe(true);
|
|
50
|
+
expect(isBootloaderVersionSupported("1.0.0-whatever0", nanoSP)).toBe(true);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Stax
|
|
54
|
+
* */
|
|
55
|
+
expect(isBootloaderVersionSupported("0.9.0", stax)).toBe(false);
|
|
56
|
+
expect(isBootloaderVersionSupported("1.0.0", stax)).toBe(true);
|
|
57
|
+
expect(isBootloaderVersionSupported("1.0.0-whatever0", stax)).toBe(true);
|
|
58
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { satisfies as versionSatisfies, coerce as semverCoerce } from "semver";
|
|
2
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
3
|
+
|
|
4
|
+
const deviceVersionRangesForBootloaderVersion: {
|
|
5
|
+
[key in DeviceModelId]?: string;
|
|
6
|
+
} = {
|
|
7
|
+
nanoS: ">=2.0.0",
|
|
8
|
+
nanoX: ">=2.0.0",
|
|
9
|
+
nanoSP: ">=1.0.0",
|
|
10
|
+
stax: ">=1.0.0",
|
|
11
|
+
europa: ">=1.0.0",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @returns whether the Bootloader Version bytes are included in the result of the
|
|
15
|
+
* getVersion APDU
|
|
16
|
+
**/
|
|
17
|
+
|
|
18
|
+
export const isBootloaderVersionSupported = (seVersion: string, modelId?: DeviceModelId): boolean =>
|
|
19
|
+
!!modelId &&
|
|
20
|
+
!!deviceVersionRangesForBootloaderVersion[modelId] &&
|
|
21
|
+
!!versionSatisfies(
|
|
22
|
+
semverCoerce(seVersion) || seVersion,
|
|
23
|
+
deviceVersionRangesForBootloaderVersion[modelId] as string,
|
|
24
|
+
);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
2
|
+
import { isDeviceLocalizationSupported } from "./isDeviceLocalizationSupported";
|
|
3
|
+
const { nanoS, nanoSP, nanoX, stax } = DeviceModelId;
|
|
4
|
+
|
|
5
|
+
test("isDeviceLocalizationSupported", () => {
|
|
6
|
+
/**
|
|
7
|
+
* Nano X
|
|
8
|
+
* */
|
|
9
|
+
expect(isDeviceLocalizationSupported("2.0.0", nanoX)).toBe(false);
|
|
10
|
+
expect(isDeviceLocalizationSupported("2.0.0-whatever0", nanoX)).toBe(false);
|
|
11
|
+
|
|
12
|
+
expect(isDeviceLocalizationSupported("2.1.0", nanoX)).toBe(true);
|
|
13
|
+
expect(isDeviceLocalizationSupported("2.1.0-rc1", nanoX)).toBe(true);
|
|
14
|
+
expect(isDeviceLocalizationSupported("2.1.1", nanoX)).toBe(true);
|
|
15
|
+
expect(isDeviceLocalizationSupported("2.1.1-whatever0", nanoX)).toBe(true);
|
|
16
|
+
expect(isDeviceLocalizationSupported("2.2.0", nanoX)).toBe(true);
|
|
17
|
+
expect(isDeviceLocalizationSupported("2.2.0-whatever0", nanoX)).toBe(true);
|
|
18
|
+
expect(isDeviceLocalizationSupported("3.0.0", nanoX)).toBe(true);
|
|
19
|
+
expect(isDeviceLocalizationSupported("3.0.0-whatever0", nanoX)).toBe(true);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Nano SP
|
|
23
|
+
* */
|
|
24
|
+
expect(isDeviceLocalizationSupported("1.0.0", nanoSP)).toBe(false);
|
|
25
|
+
expect(isDeviceLocalizationSupported("1.0.0-whatever", nanoSP)).toBe(false);
|
|
26
|
+
|
|
27
|
+
expect(isDeviceLocalizationSupported("1.1.0", nanoSP)).toBe(true);
|
|
28
|
+
expect(isDeviceLocalizationSupported("1.1.0-rc1", nanoSP)).toBe(true);
|
|
29
|
+
expect(isDeviceLocalizationSupported("1.1.2", nanoSP)).toBe(true);
|
|
30
|
+
expect(isDeviceLocalizationSupported("1.1.2-whatever0", nanoSP)).toBe(true);
|
|
31
|
+
expect(isDeviceLocalizationSupported("1.2.0", nanoSP)).toBe(true);
|
|
32
|
+
expect(isDeviceLocalizationSupported("1.2.0-whatever0", nanoSP)).toBe(true);
|
|
33
|
+
expect(isDeviceLocalizationSupported("2.0.0", nanoSP)).toBe(true);
|
|
34
|
+
expect(isDeviceLocalizationSupported("2.0.0-whatever0", nanoSP)).toBe(true);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Stax
|
|
38
|
+
* */
|
|
39
|
+
expect(isDeviceLocalizationSupported("0.9.0", stax)).toBe(false);
|
|
40
|
+
expect(isDeviceLocalizationSupported("9.0.0", stax)).toBe(true);
|
|
41
|
+
expect(isDeviceLocalizationSupported("9.0.0-whatever", stax)).toBe(true);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* NanoS
|
|
45
|
+
* */
|
|
46
|
+
expect(isDeviceLocalizationSupported("9.0.0", nanoS)).toBe(false);
|
|
47
|
+
expect(isDeviceLocalizationSupported("9.0.0-whatever", nanoS)).toBe(false);
|
|
48
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
2
|
+
import { satisfies as versionSatisfies, coerce as semverCoerce } from "semver";
|
|
3
|
+
|
|
4
|
+
const deviceVersionRangesForLocalization: { [key in DeviceModelId]?: string } = {
|
|
5
|
+
nanoX: ">=2.1.0",
|
|
6
|
+
nanoSP: ">=1.1.0",
|
|
7
|
+
stax: ">=1.0.0",
|
|
8
|
+
europa: ">=1.0.0",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const isDeviceLocalizationSupported = (
|
|
12
|
+
seVersion: string,
|
|
13
|
+
modelId?: DeviceModelId,
|
|
14
|
+
): boolean =>
|
|
15
|
+
!!modelId &&
|
|
16
|
+
!!deviceVersionRangesForLocalization[modelId] &&
|
|
17
|
+
!!versionSatisfies(
|
|
18
|
+
semverCoerce(seVersion) || seVersion,
|
|
19
|
+
deviceVersionRangesForLocalization[modelId] as string,
|
|
20
|
+
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
2
|
+
import { isHardwareVersionSupported } from "./isHardwareVersionSupported";
|
|
3
|
+
|
|
4
|
+
const { nanoS, nanoSP, nanoX, stax } = DeviceModelId;
|
|
5
|
+
|
|
6
|
+
test("isHardwareVersionSupported", () => {
|
|
7
|
+
/**
|
|
8
|
+
* Nano S
|
|
9
|
+
* */
|
|
10
|
+
expect(isHardwareVersionSupported("2.0.0", nanoS)).toBe(false);
|
|
11
|
+
expect(isHardwareVersionSupported("2.0.0-whatever0", nanoS)).toBe(false);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Nano X
|
|
15
|
+
* */
|
|
16
|
+
expect(isHardwareVersionSupported("1.9.0", nanoX)).toBe(false);
|
|
17
|
+
expect(isHardwareVersionSupported("1.9.0-whatever0", nanoX)).toBe(false);
|
|
18
|
+
|
|
19
|
+
expect(isHardwareVersionSupported("2.0.0", nanoX)).toBe(true);
|
|
20
|
+
expect(isHardwareVersionSupported("2.0.0-rc1", nanoX)).toBe(true);
|
|
21
|
+
expect(isHardwareVersionSupported("2.0.1", nanoX)).toBe(true);
|
|
22
|
+
expect(isHardwareVersionSupported("2.0.1-whatever0", nanoX)).toBe(true);
|
|
23
|
+
expect(isHardwareVersionSupported("2.1.0", nanoX)).toBe(true);
|
|
24
|
+
expect(isHardwareVersionSupported("2.1.0-whatever0", nanoX)).toBe(true);
|
|
25
|
+
expect(isHardwareVersionSupported("3.0.0", nanoX)).toBe(true);
|
|
26
|
+
expect(isHardwareVersionSupported("3.0.0-whatever0", nanoX)).toBe(true);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Nano SP
|
|
30
|
+
* */
|
|
31
|
+
expect(isHardwareVersionSupported("2.0.0", nanoSP)).toBe(false);
|
|
32
|
+
expect(isHardwareVersionSupported("2.0.0-whatever0", nanoSP)).toBe(false);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Stax
|
|
36
|
+
* */
|
|
37
|
+
expect(isHardwareVersionSupported("2.0.0", stax)).toBe(false);
|
|
38
|
+
expect(isHardwareVersionSupported("2.0.0-whatever0", stax)).toBe(false);
|
|
39
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { satisfies as versionSatisfies, coerce as semverCoerce } from "semver";
|
|
2
|
+
import { DeviceModelId } from "@ledgerhq/devices";
|
|
3
|
+
|
|
4
|
+
const deviceVersionRangesForHardwareVersion: {
|
|
5
|
+
[key in DeviceModelId]?: string;
|
|
6
|
+
} = {
|
|
7
|
+
nanoX: ">=2.0.0",
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @returns whether the Hardware Version bytes are included in the result of the
|
|
11
|
+
* getVersion APDU
|
|
12
|
+
* */
|
|
13
|
+
|
|
14
|
+
export const isHardwareVersionSupported = (seVersion: string, modelId?: DeviceModelId): boolean =>
|
|
15
|
+
!!modelId &&
|
|
16
|
+
!!deviceVersionRangesForHardwareVersion[modelId] &&
|
|
17
|
+
!!versionSatisfies(
|
|
18
|
+
semverCoerce(seVersion) || seVersion,
|
|
19
|
+
deviceVersionRangesForHardwareVersion[modelId] as string,
|
|
20
|
+
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { parseGetDeviceNameResponse } from "./parseGetDeviceNameResponse";
|
|
2
|
+
|
|
3
|
+
describe("getDeviceName", () => {
|
|
4
|
+
it("should return name if available", () => {
|
|
5
|
+
const responseBuffer = Buffer.from("50756572746f9000", "hex");
|
|
6
|
+
|
|
7
|
+
const result = parseGetDeviceNameResponse(responseBuffer);
|
|
8
|
+
|
|
9
|
+
expect(result).toMatch("Puerto"); // 🐾
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should return empty name when the device is not onboarded", () => {
|
|
13
|
+
const responseBuffer = Buffer.from("bababababababa6d07", "hex");
|
|
14
|
+
|
|
15
|
+
const result = parseGetDeviceNameResponse(responseBuffer);
|
|
16
|
+
|
|
17
|
+
expect(result).toMatch("");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should return empty name when the device is not onboarded #2", () => {
|
|
21
|
+
const responseBuffer = Buffer.from("bababababababa6611", "hex");
|
|
22
|
+
|
|
23
|
+
const result = parseGetDeviceNameResponse(responseBuffer);
|
|
24
|
+
|
|
25
|
+
expect(result).toMatch("");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should throw for an unexpected bootloader or any other code", () => {
|
|
29
|
+
const responseBuffer = Buffer.from("662d", "hex");
|
|
30
|
+
|
|
31
|
+
expect(() => {
|
|
32
|
+
parseGetDeviceNameResponse(responseBuffer);
|
|
33
|
+
}).toThrow(Error);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StatusCodes, TransportStatusError } from "@ledgerhq/hw-transport";
|
|
2
|
+
import { LocalTracer } from "@ledgerhq/logs";
|
|
3
|
+
|
|
4
|
+
export function parseGetDeviceNameResponse(response: Buffer): string {
|
|
5
|
+
const tracer = new LocalTracer("hw", {
|
|
6
|
+
function: "parseGetDeviceNameResponse",
|
|
7
|
+
});
|
|
8
|
+
const status = response.readUInt16BE(response.length - 2);
|
|
9
|
+
if (tracer) tracer.trace("Result status from 0xe0d20000", { status });
|
|
10
|
+
|
|
11
|
+
switch (status) {
|
|
12
|
+
case StatusCodes.OK:
|
|
13
|
+
return response.slice(0, response.length - 2).toString("utf-8");
|
|
14
|
+
case StatusCodes.DEVICE_NOT_ONBOARDED:
|
|
15
|
+
case StatusCodes.DEVICE_NOT_ONBOARDED_2:
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
throw new TransportStatusError(status);
|
|
20
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { parseGetVersionResponse } from "./parseGetVersionResponse";
|
|
2
|
+
|
|
3
|
+
describe("parseGetVersionResult", () => {
|
|
4
|
+
it("correctly parses an arbitrary regular result buffer", () => {
|
|
5
|
+
const responseBuffer = Buffer.from(
|
|
6
|
+
[
|
|
7
|
+
"33000004", // targetId
|
|
8
|
+
"05", // device version length
|
|
9
|
+
"322e322e33", // device version aka `rawVersion`
|
|
10
|
+
"04", // flags length
|
|
11
|
+
"ee000000", // flags
|
|
12
|
+
"04", // mcu version length
|
|
13
|
+
"322e3330", // mcu version aka `mcuVersion`
|
|
14
|
+
"04", // booloader version length
|
|
15
|
+
"312e3136", // bootloader version aka `bootloaderVersion`
|
|
16
|
+
"01", // hw version length
|
|
17
|
+
"01", // hw version aka `hardwareVersion`
|
|
18
|
+
"01", // language id length
|
|
19
|
+
"00", // language id
|
|
20
|
+
"01", // ?
|
|
21
|
+
"00", // ?
|
|
22
|
+
"9000", // status
|
|
23
|
+
].join(""),
|
|
24
|
+
"hex",
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const expectedParseResult = {
|
|
28
|
+
isBootloader: false,
|
|
29
|
+
rawVersion: "2.2.3",
|
|
30
|
+
targetId: 855638020,
|
|
31
|
+
seVersion: "2.2.3",
|
|
32
|
+
mcuVersion: "2.30",
|
|
33
|
+
mcuBlVersion: undefined,
|
|
34
|
+
mcuTargetId: undefined,
|
|
35
|
+
seTargetId: 855638020,
|
|
36
|
+
flags: Buffer.from([238, 0, 0, 0]),
|
|
37
|
+
bootloaderVersion: "1.16",
|
|
38
|
+
hardwareVersion: 1,
|
|
39
|
+
languageId: 0,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const parseResult = parseGetVersionResponse(responseBuffer);
|
|
43
|
+
|
|
44
|
+
expect(parseResult).toEqual(expectedParseResult);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("should handle old firmware with zero rawVersionLength", () => {
|
|
48
|
+
const responseBuffer = Buffer.from(
|
|
49
|
+
[
|
|
50
|
+
"33000004", // targetId
|
|
51
|
+
"00", // device version length
|
|
52
|
+
"04", // flags length
|
|
53
|
+
"ee000000", // flags
|
|
54
|
+
"04", // mcu version length
|
|
55
|
+
"322e3330", // mcu version aka `mcuVersion`
|
|
56
|
+
"01", // hw version length
|
|
57
|
+
"01", // hw version aka `hardwareVersion`
|
|
58
|
+
"01", // language id length
|
|
59
|
+
"00", // language id
|
|
60
|
+
"01", // ?
|
|
61
|
+
"00", // ?
|
|
62
|
+
"9000", // status
|
|
63
|
+
].join(""),
|
|
64
|
+
"hex",
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const expectedParseResult = {
|
|
68
|
+
isBootloader: false,
|
|
69
|
+
rawVersion: "0.0.0", // Defaults to "0.0.0" for old firmware
|
|
70
|
+
targetId: 855638020,
|
|
71
|
+
seVersion: "0.0.0",
|
|
72
|
+
mcuVersion: "2.30",
|
|
73
|
+
mcuBlVersion: undefined,
|
|
74
|
+
mcuTargetId: undefined,
|
|
75
|
+
seTargetId: 855638020,
|
|
76
|
+
flags: Buffer.from([]), // Expected to be an empty buffer
|
|
77
|
+
bootloaderVersion: undefined, // because seVersion is "0.0.0" so isBootloaderVersionSupported will return false
|
|
78
|
+
hardwareVersion: undefined, // because seVersion is "0.0.0" so isDeviceVersionSupported will return false
|
|
79
|
+
languageId: undefined, // because seVersion is "0.0.0" so isDeviceLocalizationSupported will return false
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const parseResult = parseGetVersionResponse(responseBuffer);
|
|
83
|
+
|
|
84
|
+
expect(parseResult).toEqual(expectedParseResult);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("correctly parses buffer for a bootloader version", () => {
|
|
88
|
+
const responseBuffer = Buffer.from(
|
|
89
|
+
[
|
|
90
|
+
"05010003", // targetId, also mcuTargetId
|
|
91
|
+
"04", // rawVersion length
|
|
92
|
+
"312e3136", // rawVersion, also mcuBlVersion
|
|
93
|
+
"04", // flags length
|
|
94
|
+
"f4d8aa43", // flags
|
|
95
|
+
"05", // seVersion length
|
|
96
|
+
"322e322e33", //seVersion
|
|
97
|
+
"04", // seTargetId length
|
|
98
|
+
"33000004", // seTargetId
|
|
99
|
+
"9000", // status
|
|
100
|
+
].join(""),
|
|
101
|
+
"hex",
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const expectedParseResult = {
|
|
105
|
+
isBootloader: true,
|
|
106
|
+
rawVersion: "1.16",
|
|
107
|
+
targetId: 83951619,
|
|
108
|
+
seVersion: "2.2.3",
|
|
109
|
+
mcuVersion: "",
|
|
110
|
+
mcuBlVersion: "1.16",
|
|
111
|
+
mcuTargetId: 83951619,
|
|
112
|
+
seTargetId: 855638020,
|
|
113
|
+
flags: Buffer.from([244, 216, 170, 67]),
|
|
114
|
+
bootloaderVersion: undefined,
|
|
115
|
+
hardwareVersion: undefined,
|
|
116
|
+
languageId: undefined,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const parseResult = parseGetVersionResponse(responseBuffer);
|
|
120
|
+
|
|
121
|
+
expect(parseResult).toEqual(expectedParseResult);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { identifyTargetId } from "@ledgerhq/devices";
|
|
2
|
+
import { FirmwareInfoEntity } from "../entities/FirmwareInfoEntity";
|
|
3
|
+
import { isDeviceLocalizationSupported } from "./isDeviceLocalizationSupported";
|
|
4
|
+
import { isHardwareVersionSupported } from "./isHardwareVersionSupported";
|
|
5
|
+
import { isBootloaderVersionSupported } from "./isBootloaderVersionSupported";
|
|
6
|
+
|
|
7
|
+
export function parseGetVersionResponse(response: Buffer): FirmwareInfoEntity {
|
|
8
|
+
const data = response.slice(0, response.length - 2);
|
|
9
|
+
let i = 0;
|
|
10
|
+
|
|
11
|
+
// parse the target id of either BL or SE
|
|
12
|
+
const targetId = data.readUIntBE(0, 4);
|
|
13
|
+
i += 4;
|
|
14
|
+
|
|
15
|
+
// parse the version of either BL or SE
|
|
16
|
+
const rawVersionLength = data[i++];
|
|
17
|
+
let rawVersion = data.slice(i, i + rawVersionLength).toString();
|
|
18
|
+
i += rawVersionLength;
|
|
19
|
+
|
|
20
|
+
// flags. gives information about manager allowed in SE mode.
|
|
21
|
+
const flagsLength = data[i++];
|
|
22
|
+
let flags = data.slice(i, i + flagsLength);
|
|
23
|
+
i += flagsLength;
|
|
24
|
+
|
|
25
|
+
if (!rawVersionLength) {
|
|
26
|
+
// To support old firmware like bootloader of 1.3.1
|
|
27
|
+
rawVersion = "0.0.0";
|
|
28
|
+
flags = Buffer.allocUnsafeSlow(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let mcuVersion = "";
|
|
32
|
+
let mcuBlVersion: string | undefined;
|
|
33
|
+
let seVersion: string | undefined;
|
|
34
|
+
let bootloaderVersion: string | undefined;
|
|
35
|
+
let hardwareVersion: number | undefined;
|
|
36
|
+
let mcuTargetId: number | undefined;
|
|
37
|
+
let seTargetId: number | undefined;
|
|
38
|
+
let languageId: number | undefined;
|
|
39
|
+
|
|
40
|
+
const isBootloader = (targetId & 4026531840) !== 805306368;
|
|
41
|
+
|
|
42
|
+
if (isBootloader) {
|
|
43
|
+
mcuBlVersion = rawVersion;
|
|
44
|
+
mcuTargetId = targetId;
|
|
45
|
+
|
|
46
|
+
if (i < data.length) {
|
|
47
|
+
// se part 1
|
|
48
|
+
const part1Length = data[i++];
|
|
49
|
+
const part1 = data.slice(i, i + part1Length);
|
|
50
|
+
i += part1Length;
|
|
51
|
+
|
|
52
|
+
// at this time, this is how we branch old & new format
|
|
53
|
+
if (part1Length >= 5) {
|
|
54
|
+
seVersion = part1.toString();
|
|
55
|
+
// se part 2
|
|
56
|
+
const part2Length = data[i++];
|
|
57
|
+
const part2 = data.slice(i, i + part2Length);
|
|
58
|
+
i += flagsLength;
|
|
59
|
+
seTargetId = part2.readUIntBE(0, 4);
|
|
60
|
+
} else {
|
|
61
|
+
seTargetId = part1.readUIntBE(0, 4);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
seVersion = rawVersion;
|
|
66
|
+
seTargetId = targetId;
|
|
67
|
+
|
|
68
|
+
// if SE: mcu version
|
|
69
|
+
const mcuVersionLength = data[i++];
|
|
70
|
+
let mcuVersionBuf: Buffer = Buffer.from(data.slice(i, i + mcuVersionLength));
|
|
71
|
+
i += mcuVersionLength;
|
|
72
|
+
|
|
73
|
+
if (mcuVersionBuf[mcuVersionBuf.length - 1] === 0) {
|
|
74
|
+
mcuVersionBuf = mcuVersionBuf.slice(0, mcuVersionBuf.length - 1);
|
|
75
|
+
}
|
|
76
|
+
mcuVersion = mcuVersionBuf.toString();
|
|
77
|
+
|
|
78
|
+
const isOSU = rawVersion.includes("-osu");
|
|
79
|
+
|
|
80
|
+
if (!isOSU) {
|
|
81
|
+
const deviceModel = identifyTargetId(targetId);
|
|
82
|
+
|
|
83
|
+
if (isBootloaderVersionSupported(seVersion, deviceModel?.id)) {
|
|
84
|
+
const bootloaderVersionLength = data[i++];
|
|
85
|
+
let bootloaderVersionBuf: Buffer = Buffer.from(data.slice(i, i + bootloaderVersionLength));
|
|
86
|
+
i += bootloaderVersionLength;
|
|
87
|
+
|
|
88
|
+
if (bootloaderVersionBuf[bootloaderVersionBuf.length - 1] === 0) {
|
|
89
|
+
bootloaderVersionBuf = bootloaderVersionBuf.slice(0, bootloaderVersionBuf.length - 1);
|
|
90
|
+
}
|
|
91
|
+
bootloaderVersion = bootloaderVersionBuf.toString();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (isHardwareVersionSupported(seVersion, deviceModel?.id)) {
|
|
95
|
+
const hardwareVersionLength = data[i++];
|
|
96
|
+
hardwareVersion = data.slice(i, i + hardwareVersionLength).readUIntBE(0, 1); // ?? string? number?
|
|
97
|
+
i += hardwareVersionLength;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (isDeviceLocalizationSupported(seVersion, deviceModel?.id)) {
|
|
101
|
+
const languageIdLength = data[i++];
|
|
102
|
+
languageId = data.slice(i, i + languageIdLength).readUIntBE(0, 1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
isBootloader,
|
|
109
|
+
rawVersion,
|
|
110
|
+
targetId,
|
|
111
|
+
seVersion,
|
|
112
|
+
mcuVersion,
|
|
113
|
+
mcuBlVersion,
|
|
114
|
+
mcuTargetId,
|
|
115
|
+
seTargetId,
|
|
116
|
+
flags,
|
|
117
|
+
bootloaderVersion,
|
|
118
|
+
hardwareVersion,
|
|
119
|
+
languageId,
|
|
120
|
+
};
|
|
121
|
+
}
|