@onekeyfe/hd-core 1.1.28 → 1.2.0-alpha.1
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/__tests__/evmLedgerLegacySafety.test.ts +15 -4
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/logBlockEvent.test.ts +37 -0
- package/__tests__/protocol-v2.test.ts +2908 -0
- package/dist/api/BaseMethod.d.ts +1 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/DirList.d.ts +10 -0
- package/dist/api/DirList.d.ts.map +1 -0
- package/dist/api/DirMake.d.ts +9 -0
- package/dist/api/DirMake.d.ts.map +1 -0
- package/dist/api/DirRemove.d.ts +9 -0
- package/dist/api/DirRemove.d.ts.map +1 -0
- package/dist/api/FileDelete.d.ts +9 -0
- package/dist/api/FileDelete.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts +19 -0
- package/dist/api/FileRead.d.ts.map +1 -0
- package/dist/api/FileWrite.d.ts +24 -0
- package/dist/api/FileWrite.d.ts.map +1 -0
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +35 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
- package/dist/api/GetDeviceInfo.d.ts +9 -0
- package/dist/api/GetDeviceInfo.d.ts.map +1 -0
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetFeatures.d.ts.map +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +6 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts +10 -0
- package/dist/api/PathInfo.d.ts.map +1 -0
- package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +2 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumGetAddress.d.ts +2 -6
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts +2 -5
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts +5 -8
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts +2 -9
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts +2 -9
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts +2 -8
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts +2 -8
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +1 -11
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +1 -11
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +1 -15
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +1 -11
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +1 -11
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +2 -11
- package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceLock.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +1 -1
- package/dist/api/device/DeviceUploadResource.d.ts.map +1 -1
- package/dist/api/device/DeviceVerify.d.ts.map +1 -1
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts +2 -8
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getAddress.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/getPublicKey.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signMessage.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedHash.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/verifyMessage.d.ts.map +1 -1
- package/dist/api/firmware/bootloaderHelper.d.ts.map +1 -1
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/api/helpers/batchGetPublickeys.d.ts +3 -0
- package/dist/api/helpers/batchGetPublickeys.d.ts.map +1 -1
- package/dist/api/helpers/filesystemValidation.d.ts +7 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
- package/dist/api/index.d.ts +32 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/lightning/LnurlAuth.d.ts +4 -0
- package/dist/api/lightning/LnurlAuth.d.ts.map +1 -1
- package/dist/api/neo/NeoGetAddress.d.ts +2 -8
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts +2 -8
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts +2 -9
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts +9 -12
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts +2 -8
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts +2 -9
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotGetAddress.d.ts +3 -0
- package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
- package/dist/api/polkadot/networks.d.ts +3 -0
- package/dist/api/polkadot/networks.d.ts.map +1 -1
- package/dist/api/protocol-v2/DevReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DevReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +29 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +7 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +6 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +13 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +6 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +1 -0
- package/dist/api/protocol-v2/Ping.d.ts +8 -0
- package/dist/api/protocol-v2/Ping.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +33 -0
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -0
- package/dist/api/scdo/ScdoGetAddress.d.ts +2 -6
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts +2 -5
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts +2 -5
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +1 -0
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +3 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +3 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +6 -0
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +2 -1
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +3 -2
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +3 -0
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +3 -0
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +3 -0
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +5 -2
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +3 -0
- package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +5 -0
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +3 -0
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +3 -0
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +4 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +4 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +7 -4
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/MessagesConfig.d.ts +2 -2
- package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts +5 -4
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/device/Device.d.ts +33 -11
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +9 -9
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +2 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceFeatures.d.ts +6 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -0
- package/dist/deviceProfile/buildDeviceProfile.d.ts +21 -0
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -0
- package/dist/deviceProfile/index.d.ts +3 -0
- package/dist/deviceProfile/index.d.ts.map +1 -0
- package/dist/events/logBlockEvent.d.ts +1 -0
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +8 -0
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +717 -302
- package/dist/index.js +17654 -1271
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +93 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +13 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +4 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +1 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +27 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +85 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -0
- package/dist/types/api/getPassphraseState.d.ts +10 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +37 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +103 -0
- package/dist/types/api/protocolV2.d.ts.map +1 -0
- package/dist/types/api/searchDevices.d.ts +2 -2
- package/dist/types/api/searchDevices.d.ts.map +1 -1
- package/dist/types/device.d.ts +91 -5
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +2 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +2 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/capabilitieUtils.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +6 -8
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +1 -0
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/findDefectiveBatchDevice.d.ts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +26 -22
- package/src/api/DirList.ts +31 -0
- package/src/api/DirMake.ts +23 -0
- package/src/api/DirRemove.ts +23 -0
- package/src/api/FileDelete.ts +23 -0
- package/src/api/FileRead.ts +167 -0
- package/src/api/FileWrite.ts +216 -0
- package/src/api/FirmwareUpdate.ts +13 -5
- package/src/api/FirmwareUpdateV2.ts +22 -19
- package/src/api/FirmwareUpdateV3.ts +19 -5
- package/src/api/FirmwareUpdateV4.ts +820 -0
- package/src/api/GetDeviceInfo.ts +145 -0
- package/src/api/GetFeatures.ts +5 -2
- package/src/api/GetOnekeyFeatures.ts +84 -3
- package/src/api/GetPassphraseState.ts +16 -10
- package/src/api/PathInfo.ts +39 -0
- package/src/api/PromptWebDeviceAccess.ts +11 -1
- package/src/api/SearchDevices.ts +7 -2
- package/src/api/alephium/AlephiumGetAddress.ts +6 -2
- package/src/api/alephium/AlephiumSignMessage.ts +6 -1
- package/src/api/alephium/AlephiumSignTransaction.ts +15 -4
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +21 -13
- package/src/api/aptos/AptosGetAddress.ts +2 -3
- package/src/api/benfen/BenfenGetAddress.ts +11 -7
- package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
- package/src/api/benfen/BenfenSignMessage.ts +6 -1
- package/src/api/benfen/BenfenSignTransaction.ts +6 -1
- package/src/api/btc/BTCGetPublicKey.ts +3 -2
- package/src/api/btc/BTCSignPsbt.ts +1 -2
- package/src/api/btc/helpers/versionLimit.ts +7 -1
- package/src/api/cardano/CardanoSignTransaction.ts +2 -4
- package/src/api/conflux/ConfluxSignTransaction.ts +5 -2
- package/src/api/device/DeviceFullyUploadResource.ts +3 -3
- package/src/api/device/DeviceLock.ts +1 -3
- package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
- package/src/api/device/DeviceRebootToBootloader.ts +10 -1
- package/src/api/device/DeviceSupportFeatures.ts +2 -13
- package/src/api/device/DeviceUpdateBootloader.ts +4 -4
- package/src/api/device/DeviceUploadResource.ts +4 -5
- package/src/api/device/DeviceVerify.ts +1 -2
- package/src/api/dynex/DnxGetAddress.ts +6 -0
- package/src/api/dynex/DnxSignTransaction.ts +6 -0
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +3 -4
- package/src/api/evm/EVMSignMessage.ts +1 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +14 -1
- package/src/api/evm/EVMSignTransaction.ts +1 -1
- package/src/api/evm/EVMSignTypedData.ts +32 -18
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/evm/latest/signTypedHash.ts +2 -4
- package/src/api/evm/legacyV1/getAddress.ts +5 -3
- package/src/api/evm/legacyV1/getPublicKey.ts +5 -3
- package/src/api/evm/legacyV1/signMessage.ts +5 -3
- package/src/api/evm/legacyV1/signTypedData.ts +9 -8
- package/src/api/evm/legacyV1/signTypedHash.ts +7 -7
- package/src/api/evm/legacyV1/verifyMessage.ts +5 -3
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +8 -8
- package/src/api/firmware/bootloaderHelper.ts +3 -2
- package/src/api/firmware/getBinary.ts +1 -1
- package/src/api/firmware/releaseHelper.ts +3 -3
- package/src/api/firmware/uploadFirmware.ts +8 -12
- package/src/api/helpers/batchGetPublickeys.ts +51 -6
- package/src/api/helpers/filesystemValidation.ts +51 -0
- package/src/api/index.ts +34 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +4 -5
- package/src/api/lightning/LnurlAuth.ts +4 -0
- package/src/api/neo/NeoGetAddress.ts +6 -1
- package/src/api/neo/NeoSignTransaction.ts +6 -1
- package/src/api/nervos/NervosGetAddress.ts +6 -2
- package/src/api/nervos/NervosSignTransaction.ts +14 -4
- package/src/api/nexa/NexaGetAddress.ts +6 -2
- package/src/api/nexa/NexaSignTransaction.ts +11 -12
- package/src/api/polkadot/networks.ts +9 -0
- package/src/api/protocol-v2/DevReboot.ts +24 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +63 -0
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +118 -0
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +20 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +16 -0
- package/src/api/protocol-v2/DeviceReboot.ts +24 -0
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +29 -0
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +20 -0
- package/src/api/protocol-v2/FilesystemDiskControl.ts +50 -0
- package/src/api/protocol-v2/FilesystemFixPermission.ts +16 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +16 -0
- package/src/api/protocol-v2/GetProtoVersion.ts +16 -0
- package/src/api/protocol-v2/Ping.ts +18 -0
- package/src/api/protocol-v2/helpers.ts +182 -0
- package/src/api/scdo/ScdoGetAddress.ts +6 -2
- package/src/api/scdo/ScdoSignMessage.ts +6 -1
- package/src/api/scdo/ScdoSignTransaction.ts +6 -2
- package/src/api/solana/SolGetAddress.ts +4 -0
- package/src/api/solana/SolSignMessage.ts +3 -0
- package/src/api/solana/SolSignOffchainMessage.ts +3 -0
- package/src/api/solana/SolSignTransaction.ts +6 -0
- package/src/api/stellar/StellarGetAddress.ts +10 -1
- package/src/api/stellar/StellarSignTransaction.ts +14 -1
- package/src/api/sui/SuiGetAddress.ts +5 -3
- package/src/api/sui/SuiGetPublicKey.ts +3 -0
- package/src/api/sui/SuiSignMessage.ts +3 -0
- package/src/api/sui/SuiSignTransaction.ts +14 -12
- package/src/api/ton/TonGetAddress.ts +3 -0
- package/src/api/ton/TonSignData.ts +10 -3
- package/src/api/ton/TonSignMessage.ts +6 -5
- package/src/api/ton/TonSignProof.ts +3 -0
- package/src/api/tron/TronSignMessage.ts +5 -1
- package/src/api/tron/TronSignTransaction.ts +4 -0
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/constants/index.ts +10 -1
- package/src/core/index.ts +91 -61
- package/src/data/messages/messages-protocol-v2.json +13375 -0
- package/src/data-manager/DataManager.ts +16 -11
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +38 -12
- package/src/data-manager/connectSettings.ts +6 -0
- package/src/device/Device.ts +398 -76
- package/src/device/DeviceCommands.ts +195 -29
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DevicePool.ts +8 -8
- package/src/deviceProfile/buildDeviceFeatures.ts +368 -0
- package/src/deviceProfile/buildDeviceProfile.ts +333 -0
- package/src/deviceProfile/index.ts +5 -0
- package/src/events/logBlockEvent.ts +23 -0
- package/src/events/ui-request.ts +8 -0
- package/src/inject.ts +52 -1
- package/src/protocols/protocol-v2/features.ts +178 -0
- package/src/protocols/protocol-v2/firmware.ts +43 -0
- package/src/protocols/protocol-v2/index.ts +16 -0
- package/src/types/api/export.ts +1 -0
- package/src/types/api/firmwareUpdate.ts +49 -0
- package/src/types/api/getDeviceInfo.ts +99 -0
- package/src/types/api/getPassphraseState.ts +13 -2
- package/src/types/api/index.ts +88 -1
- package/src/types/api/protocolV2.ts +200 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +102 -5
- package/src/types/params.ts +7 -0
- package/src/types/settings.ts +6 -1
- package/src/utils/capabilitieUtils.ts +1 -2
- package/src/utils/deviceFeaturesUtils.ts +75 -81
- package/src/utils/deviceInfoUtils.ts +23 -34
- package/src/utils/deviceVersionUtils.ts +7 -25
- package/src/utils/findDefectiveBatchDevice.ts +6 -6
- package/src/utils/index.ts +1 -0
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { isNaN } from 'lodash';
|
|
3
3
|
import { EDeviceType, type EFirmwareType, ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
|
-
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
4
|
+
import { Enum_Capability, type GetPassphraseState } from '@onekeyfe/hd-transport';
|
|
5
5
|
|
|
6
6
|
import { toHardened } from '../api/helpers/pathUtils';
|
|
7
7
|
import { DeviceModelToTypes, DeviceTypeToModels } from '../types';
|
|
8
|
-
import DataManager, {
|
|
8
|
+
import DataManager, {
|
|
9
|
+
type IFirmwareField,
|
|
10
|
+
type ProtocolV1MessageSchema,
|
|
11
|
+
} from '../data-manager/DataManager';
|
|
9
12
|
import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';
|
|
10
13
|
import { getDeviceType } from './deviceInfoUtils';
|
|
11
14
|
import { getDeviceFirmwareVersion } from './deviceVersionUtils';
|
|
12
15
|
import { existCapability } from './capabilitieUtils';
|
|
13
16
|
|
|
14
17
|
import type { Device } from '../device/Device';
|
|
15
|
-
import type {
|
|
16
|
-
import type { Features, SupportFeatureType } from '../types';
|
|
18
|
+
import type { Features, IDeviceType, SupportFeatureType } from '../types';
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
// 生成的 GetPassphraseState 已包含 _only_main_pin / allow_create_attach_pin,
|
|
21
|
+
// 不再需要手动扩展字段。
|
|
22
|
+
type GetPassphraseStateMessage = GetPassphraseState;
|
|
23
|
+
|
|
24
|
+
export const getSupportProtocolV1MessageSchema = (
|
|
19
25
|
features: Features | undefined
|
|
20
|
-
): { messages: JSON;
|
|
26
|
+
): { messages: JSON; protocolV1MessageSchema: ProtocolV1MessageSchema } => {
|
|
21
27
|
if (!features)
|
|
22
28
|
return {
|
|
23
|
-
messages: DataManager.messages.
|
|
24
|
-
|
|
29
|
+
messages: DataManager.messages.v1CurrentSchema,
|
|
30
|
+
protocolV1MessageSchema: 'v1CurrentSchema',
|
|
25
31
|
};
|
|
26
32
|
|
|
27
33
|
const currentDeviceVersion = getDeviceFirmwareVersion(features).join('.');
|
|
@@ -37,18 +43,18 @@ export const getSupportMessageVersion = (
|
|
|
37
43
|
const sortedDeviceVersionConfigs =
|
|
38
44
|
deviceVersionConfigs?.sort((a, b) => semver.compare(b.minVersion, a.minVersion)) ?? [];
|
|
39
45
|
|
|
40
|
-
for (const { minVersion,
|
|
46
|
+
for (const { minVersion, protocolV1MessageSchema } of sortedDeviceVersionConfigs) {
|
|
41
47
|
if (semver.gte(currentDeviceVersion, minVersion)) {
|
|
42
48
|
return {
|
|
43
|
-
messages: DataManager.messages[
|
|
44
|
-
|
|
49
|
+
messages: DataManager.messages[protocolV1MessageSchema],
|
|
50
|
+
protocolV1MessageSchema,
|
|
45
51
|
};
|
|
46
52
|
}
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
return {
|
|
50
|
-
messages: DataManager.messages.
|
|
51
|
-
|
|
56
|
+
messages: DataManager.messages.v1CurrentSchema,
|
|
57
|
+
protocolV1MessageSchema: 'v1CurrentSchema',
|
|
52
58
|
};
|
|
53
59
|
};
|
|
54
60
|
|
|
@@ -68,7 +74,11 @@ export const supportNewPassphrase = (features?: Features): SupportFeatureType =>
|
|
|
68
74
|
if (!features) return { support: false };
|
|
69
75
|
|
|
70
76
|
const deviceType = getDeviceType(features);
|
|
71
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
deviceType === EDeviceType.Touch ||
|
|
79
|
+
deviceType === EDeviceType.Pro ||
|
|
80
|
+
deviceType === EDeviceType.Pro2
|
|
81
|
+
) {
|
|
72
82
|
return { support: true };
|
|
73
83
|
}
|
|
74
84
|
|
|
@@ -82,25 +92,26 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
82
92
|
options?: {
|
|
83
93
|
expectPassphraseState?: string;
|
|
84
94
|
onlyMainPin?: boolean;
|
|
95
|
+
allowCreateAttachPin?: boolean;
|
|
85
96
|
}
|
|
86
97
|
) => {
|
|
87
|
-
const { features
|
|
98
|
+
const { features } = device;
|
|
88
99
|
const locked = features?.unlocked === false;
|
|
100
|
+
const deviceType = device.getCurrentDeviceType();
|
|
89
101
|
|
|
90
|
-
const { passphraseState, newSession, unlockedAttachPin } = await getPassphraseState(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
...options,
|
|
95
|
-
}
|
|
96
|
-
);
|
|
102
|
+
const { passphraseState, newSession, unlockedAttachPin } = await getPassphraseState(device, {
|
|
103
|
+
...options,
|
|
104
|
+
});
|
|
97
105
|
|
|
98
106
|
const isModeT =
|
|
99
|
-
|
|
107
|
+
deviceType === EDeviceType.Touch ||
|
|
108
|
+
deviceType === EDeviceType.Pro ||
|
|
109
|
+
deviceType === EDeviceType.Pro2;
|
|
100
110
|
|
|
101
111
|
// 如果可以获取到 passphraseState,但是设备 features 显示设备未开启 passphrase,需要刷新设备状态
|
|
102
112
|
// if passphraseState can be obtained, but the device features show that the device has not enabled passphrase, the device status needs to be refreshed
|
|
103
|
-
const needRefreshWithPassphrase =
|
|
113
|
+
const needRefreshWithPassphrase =
|
|
114
|
+
passphraseState && device.getCurrentPassphraseProtection() !== true;
|
|
104
115
|
// 如果 Touch/Pro 在之前是锁定状态,刷新设备状态
|
|
105
116
|
// if Touch/Pro was locked before, refresh the device state
|
|
106
117
|
const needRefreshWithLocked = isModeT && locked;
|
|
@@ -111,49 +122,68 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
111
122
|
}
|
|
112
123
|
|
|
113
124
|
// Attach to pin try to fix internal state
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
125
|
+
const deviceId = device.getCurrentDeviceId();
|
|
126
|
+
device.updateInternalState(
|
|
127
|
+
device.getCurrentPassphraseProtection() ?? false,
|
|
128
|
+
passphraseState,
|
|
129
|
+
deviceId,
|
|
130
|
+
newSession,
|
|
131
|
+
device.features?.sessionId
|
|
132
|
+
);
|
|
123
133
|
|
|
124
134
|
return { passphraseState, newSession, unlockedAttachPin };
|
|
125
135
|
};
|
|
126
136
|
|
|
137
|
+
// 仅适用于 Protocol V1 的 Pro:Pro2 走独立版本线,不能套用 4.15.0 门槛
|
|
138
|
+
// (Pro2 在 getPassphraseState 中通过 isProtocolV2 直接判定支持)。
|
|
139
|
+
const supportProSeriesAttachPinPassphrase = (deviceType: IDeviceType, firmwareVersion: string) =>
|
|
140
|
+
deviceType === EDeviceType.Pro && semver.gte(firmwareVersion, '4.15.0');
|
|
141
|
+
|
|
127
142
|
export const getPassphraseState = async (
|
|
128
|
-
|
|
129
|
-
commands: DeviceCommands,
|
|
143
|
+
device: Device,
|
|
130
144
|
options?: {
|
|
131
145
|
expectPassphraseState?: string;
|
|
132
146
|
onlyMainPin?: boolean;
|
|
147
|
+
allowCreateAttachPin?: boolean;
|
|
133
148
|
}
|
|
134
149
|
): Promise<{
|
|
135
150
|
passphraseState: string | undefined;
|
|
136
151
|
newSession: string | undefined;
|
|
137
152
|
unlockedAttachPin: boolean | undefined;
|
|
138
153
|
}> => {
|
|
154
|
+
const { features, commands } = device;
|
|
155
|
+
|
|
156
|
+
// 设备尚未建立任何状态时无法判定,保持旧的空返回语义
|
|
139
157
|
if (!features)
|
|
140
158
|
return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
|
|
141
159
|
|
|
142
|
-
const firmwareVersion =
|
|
143
|
-
const deviceType =
|
|
160
|
+
const firmwareVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
161
|
+
const deviceType = device.getCurrentDeviceType();
|
|
144
162
|
|
|
145
163
|
const supportAttachPinCapability = existCapability(
|
|
146
164
|
features,
|
|
147
165
|
Enum_Capability.Capability_AttachToPin
|
|
148
166
|
);
|
|
167
|
+
// Pro2 (Protocol V2) 协议自带 GetPassphraseState(10028),固件从首个版本即支持,
|
|
168
|
+
// 不依赖 Pro 系列的 4.15.0 版本线;V2 也没有 GetAddress Testnet 探测这条 legacy 回退路径。
|
|
149
169
|
const supportGetPassphraseState =
|
|
170
|
+
device.isProtocolV2() ||
|
|
150
171
|
supportAttachPinCapability ||
|
|
151
|
-
(deviceType
|
|
172
|
+
supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
|
|
152
173
|
|
|
153
174
|
if (supportGetPassphraseState) {
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
175
|
+
const payload: GetPassphraseStateMessage = options?.onlyMainPin
|
|
176
|
+
? { _only_main_pin: true }
|
|
177
|
+
: { passphrase_state: options?.expectPassphraseState };
|
|
178
|
+
if (options?.allowCreateAttachPin) {
|
|
179
|
+
payload.allow_create_attach_pin = true;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const { message, type } = await commands.typedCall(
|
|
183
|
+
'GetPassphraseState',
|
|
184
|
+
'PassphraseState',
|
|
185
|
+
payload
|
|
186
|
+
);
|
|
157
187
|
|
|
158
188
|
// @ts-expect-error
|
|
159
189
|
if (type === 'CallMethodError') {
|
|
@@ -186,40 +216,8 @@ export const getPassphraseState = async (
|
|
|
186
216
|
};
|
|
187
217
|
};
|
|
188
218
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
options?: {
|
|
192
|
-
includeNode?: boolean;
|
|
193
|
-
}
|
|
194
|
-
): boolean => {
|
|
195
|
-
if (!features) return false;
|
|
196
|
-
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
197
|
-
|
|
198
|
-
const deviceType = getDeviceType(features);
|
|
199
|
-
// btc batch get public key
|
|
200
|
-
if (!!options?.includeNode && deviceType === EDeviceType.Pro) {
|
|
201
|
-
return semver.gte(currentVersion, '4.14.0');
|
|
202
|
-
}
|
|
203
|
-
if (!!options?.includeNode && deviceType === EDeviceType.Touch) {
|
|
204
|
-
return semver.gte(currentVersion, '4.11.0');
|
|
205
|
-
}
|
|
206
|
-
if (!!options?.includeNode && DeviceModelToTypes.model_classic1s.includes(deviceType)) {
|
|
207
|
-
return semver.gte(currentVersion, '3.12.0');
|
|
208
|
-
}
|
|
209
|
-
if (!!options?.includeNode && DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
210
|
-
return semver.gte(currentVersion, '3.10.0');
|
|
211
|
-
}
|
|
212
|
-
if (options?.includeNode) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// support batch get public key
|
|
217
|
-
if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
|
|
218
|
-
return semver.gte(currentVersion, '3.1.0');
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return semver.gte(currentVersion, '2.6.0');
|
|
222
|
-
};
|
|
219
|
+
// supportBatchPublicKey 已迁移为 device-aware 版本:
|
|
220
|
+
// 见 api/helpers/batchGetPublickeys.ts 的 supportBatchPublicKeyByDevice
|
|
223
221
|
|
|
224
222
|
export const supportModifyHomescreen = (features?: Features): SupportFeatureType => {
|
|
225
223
|
if (!features) return { support: false };
|
|
@@ -340,12 +338,8 @@ export const fixFeaturesFirmwareVersion = (features: Features): Features => {
|
|
|
340
338
|
// fix Touch、Pro device when bootloader version is lower than 2.5.2, the features returned do not have firmware_version error
|
|
341
339
|
const tempFeatures = { ...features };
|
|
342
340
|
|
|
343
|
-
if (tempFeatures.
|
|
344
|
-
tempFeatures.
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (tempFeatures.onekey_version && !semver.valid(tempFeatures.onekey_version)) {
|
|
348
|
-
tempFeatures.onekey_version = fixVersion(tempFeatures.onekey_version);
|
|
341
|
+
if (tempFeatures.firmwareVersion && !semver.valid(tempFeatures.firmwareVersion)) {
|
|
342
|
+
tempFeatures.firmwareVersion = fixVersion(tempFeatures.firmwareVersion);
|
|
349
343
|
}
|
|
350
344
|
|
|
351
345
|
return tempFeatures;
|
|
@@ -14,27 +14,12 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
14
14
|
if (!features || typeof features !== 'object') {
|
|
15
15
|
return EDeviceType.Unknown;
|
|
16
16
|
}
|
|
17
|
+
if (features.deviceType) {
|
|
18
|
+
return features.deviceType;
|
|
19
|
+
}
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
case 'CLASSIC':
|
|
21
|
-
return EDeviceType.Classic;
|
|
22
|
-
case 'CLASSIC1S':
|
|
23
|
-
return EDeviceType.Classic1s;
|
|
24
|
-
case 'MINI':
|
|
25
|
-
return EDeviceType.Mini;
|
|
26
|
-
case 'TOUCH':
|
|
27
|
-
return EDeviceType.Touch;
|
|
28
|
-
case 'PRO':
|
|
29
|
-
return EDeviceType.Pro;
|
|
30
|
-
case 'PURE':
|
|
31
|
-
return EDeviceType.ClassicPure;
|
|
32
|
-
default:
|
|
33
|
-
// future And old device onekey_device_type is empty
|
|
34
|
-
if (!isEmpty(features.onekey_serial_no)) {
|
|
35
|
-
return EDeviceType.Unknown;
|
|
36
|
-
}
|
|
37
|
-
// old device type
|
|
21
|
+
if (features.model === EDeviceType.Pro2 || features.model === 'pro2') {
|
|
22
|
+
return EDeviceType.Pro2;
|
|
38
23
|
}
|
|
39
24
|
|
|
40
25
|
// low version hardware
|
|
@@ -42,7 +27,7 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
42
27
|
const serialNo = getDeviceUUID(features);
|
|
43
28
|
|
|
44
29
|
// not exist serialNo, bootloader mode, model 1 is classic
|
|
45
|
-
if (isEmpty(serialNo) && features.
|
|
30
|
+
if (isEmpty(serialNo) && features.bootloaderMode === true && features.model === '1') {
|
|
46
31
|
return EDeviceType.Classic;
|
|
47
32
|
}
|
|
48
33
|
|
|
@@ -56,6 +41,7 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
56
41
|
if (miniFlag.toLowerCase() === 'mi') return EDeviceType.Mini;
|
|
57
42
|
if (miniFlag.toLowerCase() === 'tc') return EDeviceType.Touch;
|
|
58
43
|
if (miniFlag.toLowerCase() === 'pr') return EDeviceType.Pro;
|
|
44
|
+
if (miniFlag.toLowerCase() === 'p2') return EDeviceType.Pro2;
|
|
59
45
|
|
|
60
46
|
// unknown device
|
|
61
47
|
return EDeviceType.Unknown;
|
|
@@ -68,13 +54,14 @@ export const getDeviceType = (features?: Features): IDeviceType => {
|
|
|
68
54
|
export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
|
|
69
55
|
if (!name) return EDeviceType.Unknown;
|
|
70
56
|
|
|
71
|
-
if (
|
|
72
|
-
if (
|
|
57
|
+
if (/^BixinKey/i.test(name)) return EDeviceType.Classic;
|
|
58
|
+
if (/^K/i.test(name)) return EDeviceType.Classic;
|
|
73
59
|
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
60
|
+
if (/^T/i.test(name)) return EDeviceType.Touch;
|
|
61
|
+
if (/^Touch/i.test(name)) return EDeviceType.Touch;
|
|
76
62
|
|
|
77
|
-
if (name.
|
|
63
|
+
if (/\bPro\s*2\b/i.test(name) || /^Pro2/i.test(name)) return EDeviceType.Pro2;
|
|
64
|
+
if (/\bPro\b/i.test(name) || /^Pro/i.test(name)) return EDeviceType.Pro;
|
|
78
65
|
|
|
79
66
|
return EDeviceType.Unknown;
|
|
80
67
|
};
|
|
@@ -85,15 +72,14 @@ export const getDeviceTypeByBleName = (name?: string): IDeviceType => {
|
|
|
85
72
|
*/
|
|
86
73
|
export const getDeviceBleName = (features?: Features): string | null => {
|
|
87
74
|
if (features == null) return null;
|
|
88
|
-
return features.
|
|
75
|
+
return features.bleName || null;
|
|
89
76
|
};
|
|
90
77
|
|
|
91
78
|
/**
|
|
92
79
|
* Get Connected Device UUID by features
|
|
93
80
|
*/
|
|
94
81
|
export const getDeviceUUID = (features: Features) => {
|
|
95
|
-
|
|
96
|
-
return serialNo ?? '';
|
|
82
|
+
return features.serialNo ?? '';
|
|
97
83
|
};
|
|
98
84
|
|
|
99
85
|
/**
|
|
@@ -128,8 +114,8 @@ export const getMethodVersionRange = (
|
|
|
128
114
|
getVersionRange: (deviceModel: IDeviceType | IDeviceModel) => IVersionRange | undefined
|
|
129
115
|
): IVersionRange | undefined => {
|
|
130
116
|
const deviceType = getDeviceType(features);
|
|
131
|
-
let versionRange: IVersionRange | undefined = getVersionRange(deviceType);
|
|
132
117
|
|
|
118
|
+
const versionRange = getVersionRange(deviceType);
|
|
133
119
|
if (versionRange) {
|
|
134
120
|
return versionRange;
|
|
135
121
|
}
|
|
@@ -142,22 +128,25 @@ export const getMethodVersionRange = (
|
|
|
142
128
|
];
|
|
143
129
|
for (const model of modelFallbacks) {
|
|
144
130
|
if (DeviceModelToTypes[model].includes(deviceType)) {
|
|
145
|
-
versionRange = getVersionRange(model);
|
|
131
|
+
const versionRange = getVersionRange(model);
|
|
146
132
|
if (versionRange) {
|
|
147
133
|
return versionRange;
|
|
148
134
|
}
|
|
149
135
|
}
|
|
150
136
|
}
|
|
151
137
|
|
|
152
|
-
return
|
|
138
|
+
return undefined;
|
|
153
139
|
};
|
|
154
140
|
|
|
141
|
+
export const isMethodVersionRangeUnsupported = (versionRange?: IVersionRange): boolean =>
|
|
142
|
+
versionRange?.unsupported === true;
|
|
143
|
+
|
|
155
144
|
export const getFirmwareType = (features: Features | undefined) => {
|
|
156
145
|
if (!features) {
|
|
157
146
|
return EFirmwareType.Universal;
|
|
158
147
|
}
|
|
159
|
-
if (features.
|
|
160
|
-
return
|
|
148
|
+
if (features.firmwareType) {
|
|
149
|
+
return features.firmwareType;
|
|
161
150
|
}
|
|
162
151
|
// old firmware
|
|
163
152
|
return features?.capabilities?.length > 0 &&
|
|
@@ -8,12 +8,8 @@ import type { Features, IVersionArray } from '../types';
|
|
|
8
8
|
export const getDeviceFirmwareVersion = (features: Features | undefined): IVersionArray => {
|
|
9
9
|
if (!features) return [0, 0, 0];
|
|
10
10
|
|
|
11
|
-
if (semver.valid(features.
|
|
12
|
-
return features.
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (semver.valid(features.onekey_version)) {
|
|
16
|
-
return features.onekey_version?.split('.') as unknown as IVersionArray;
|
|
11
|
+
if (features.firmwareVersion && semver.valid(features.firmwareVersion)) {
|
|
12
|
+
return features.firmwareVersion.split('.').map(Number) as IVersionArray;
|
|
17
13
|
}
|
|
18
14
|
|
|
19
15
|
return [0, 0, 0];
|
|
@@ -23,7 +19,7 @@ export const getDeviceFirmwareVersion = (features: Features | undefined): IVersi
|
|
|
23
19
|
* Get Connected Device bluetooth firmware version by features
|
|
24
20
|
*/
|
|
25
21
|
export const getDeviceBLEFirmwareVersion = (features: Features): IVersionArray => {
|
|
26
|
-
const bleVer = features?.
|
|
22
|
+
const bleVer = features?.bleVersion;
|
|
27
23
|
|
|
28
24
|
if (!bleVer) {
|
|
29
25
|
return [0, 0, 0];
|
|
@@ -46,24 +42,10 @@ export const getDeviceBootloaderVersion = (features: Features | undefined): IVer
|
|
|
46
42
|
if (!features) return [0, 0, 0];
|
|
47
43
|
|
|
48
44
|
// classic1s 3.5.0 pro 4.6.0
|
|
49
|
-
if (semver.valid(features.
|
|
50
|
-
return features.
|
|
45
|
+
if (features.bootloaderVersion && semver.valid(features.bootloaderVersion)) {
|
|
46
|
+
return features.bootloaderVersion.split('.').map(Number) as IVersionArray;
|
|
51
47
|
}
|
|
52
48
|
|
|
53
|
-
// low version hardware
|
|
54
|
-
if (!features.bootloader_version) {
|
|
55
|
-
if (features.bootloader_mode) {
|
|
56
|
-
return [
|
|
57
|
-
features?.major_version ?? 0,
|
|
58
|
-
features?.minor_version ?? 0,
|
|
59
|
-
features?.patch_version ?? 0,
|
|
60
|
-
];
|
|
61
|
-
}
|
|
62
|
-
return [0, 0, 0];
|
|
63
|
-
}
|
|
64
|
-
if (semver.valid(features.bootloader_version)) {
|
|
65
|
-
return features.bootloader_version?.split('.') as unknown as IVersionArray;
|
|
66
|
-
}
|
|
67
49
|
return [0, 0, 0];
|
|
68
50
|
};
|
|
69
51
|
|
|
@@ -71,8 +53,8 @@ export const getDeviceBootloaderVersion = (features: Features | undefined): IVer
|
|
|
71
53
|
* Get Connected Device boardloader version by features
|
|
72
54
|
*/
|
|
73
55
|
export const getDeviceBoardloaderVersion = (features: Features): IVersionArray => {
|
|
74
|
-
if (semver.valid(features
|
|
75
|
-
return features
|
|
56
|
+
if (features?.boardVersion && semver.valid(features.boardVersion)) {
|
|
57
|
+
return features.boardVersion.split('.').map(Number) as IVersionArray;
|
|
76
58
|
}
|
|
77
59
|
|
|
78
60
|
return [0, 0, 0];
|
|
@@ -5,7 +5,7 @@ import type { Features } from '../types';
|
|
|
5
5
|
/**
|
|
6
6
|
* 检测故障固件设备
|
|
7
7
|
* 检测规则:
|
|
8
|
-
* - 序列号范围:21032200001 到 21032201500
|
|
8
|
+
* - 序列号范围:21032200001 到 21032201500
|
|
9
9
|
* - SE版本为 1.1.0.2
|
|
10
10
|
*
|
|
11
11
|
* 对齐之前版本的检测逻辑
|
|
@@ -13,13 +13,13 @@ import type { Features } from '../types';
|
|
|
13
13
|
export const findDefectiveBatchDevice = (features: Features) => {
|
|
14
14
|
if (!features) return;
|
|
15
15
|
|
|
16
|
-
const {
|
|
17
|
-
if (!
|
|
16
|
+
const { serialNo, seVersion } = features;
|
|
17
|
+
if (!serialNo) return;
|
|
18
18
|
|
|
19
|
-
const versionNum = +
|
|
19
|
+
const versionNum = +serialNo.slice(5);
|
|
20
20
|
if (Number.isNaN(versionNum)) return;
|
|
21
21
|
|
|
22
|
-
return versionNum >= 21032200001 && versionNum <= 21032201500 &&
|
|
22
|
+
return versionNum >= 21032200001 && versionNum <= 21032201500 && seVersion === '1.1.0.2';
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -29,7 +29,7 @@ export const getDefectiveDeviceInfo = (features: Features) => {
|
|
|
29
29
|
if (!findDefectiveBatchDevice(features)) return null;
|
|
30
30
|
const serialNo = getDeviceUUID(features);
|
|
31
31
|
const deviceType = getDeviceType(features);
|
|
32
|
-
const seVersion = features
|
|
32
|
+
const { seVersion } = features;
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
35
|
serialNo,
|