@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
|
@@ -4,3 +4,26 @@ export const LogBlockEvent: Set<string> = new Set([
|
|
|
4
4
|
UI_RESPONSE.RECEIVE_PIN,
|
|
5
5
|
UI_RESPONSE.RECEIVE_PASSPHRASE,
|
|
6
6
|
]);
|
|
7
|
+
|
|
8
|
+
const LogBlockMethod: Set<string> = new Set(['evmSignTypedData']);
|
|
9
|
+
|
|
10
|
+
export function getLogBlockLabel(message: unknown): string | undefined {
|
|
11
|
+
if (!message || typeof message !== 'object') return undefined;
|
|
12
|
+
|
|
13
|
+
const { type, payload, method } = message as {
|
|
14
|
+
type?: string;
|
|
15
|
+
payload?: { method?: string };
|
|
16
|
+
method?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (type && LogBlockEvent.has(type)) {
|
|
20
|
+
return type;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const methodName = method ?? payload?.method;
|
|
24
|
+
if (methodName && LogBlockMethod.has(methodName)) {
|
|
25
|
+
return methodName;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
package/src/events/ui-request.ts
CHANGED
|
@@ -129,6 +129,10 @@ export interface FirmwareProgress {
|
|
|
129
129
|
device: Device;
|
|
130
130
|
progress: number;
|
|
131
131
|
progressType: IFirmwareUpdateProgressType;
|
|
132
|
+
transferredBytes?: number;
|
|
133
|
+
totalBytes?: number;
|
|
134
|
+
rateBytesPerSecond?: number;
|
|
135
|
+
elapsedMs?: number;
|
|
132
136
|
};
|
|
133
137
|
}
|
|
134
138
|
|
|
@@ -144,6 +148,10 @@ export interface DeviceProgress {
|
|
|
144
148
|
type: typeof UI_REQUEST.DEVICE_PROGRESS;
|
|
145
149
|
payload: {
|
|
146
150
|
progress?: number;
|
|
151
|
+
transferredBytes?: number;
|
|
152
|
+
totalBytes?: number;
|
|
153
|
+
rateBytesPerSecond?: number;
|
|
154
|
+
elapsedMs?: number;
|
|
147
155
|
};
|
|
148
156
|
}
|
|
149
157
|
|
package/src/inject.ts
CHANGED
|
@@ -103,12 +103,13 @@ export const createCoreApi = (
|
|
|
103
103
|
/**
|
|
104
104
|
* 搜索设备
|
|
105
105
|
*/
|
|
106
|
-
searchDevices:
|
|
106
|
+
searchDevices: params => call({ ...params, method: 'searchDevices' }),
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* 获取设备信息
|
|
110
110
|
*/
|
|
111
111
|
getFeatures: (connectId, params) => call({ ...params, connectId, method: 'getFeatures' }),
|
|
112
|
+
getDeviceInfo: (connectId, params) => call({ ...params, connectId, method: 'getDeviceInfo' }),
|
|
112
113
|
getOnekeyFeatures: (connectId, params) =>
|
|
113
114
|
call({ ...params, connectId, method: 'getOnekeyFeatures' }),
|
|
114
115
|
|
|
@@ -148,6 +149,54 @@ export const createCoreApi = (
|
|
|
148
149
|
deviceFlags: (connectId, params) => call({ ...params, connectId, method: 'deviceFlags' }),
|
|
149
150
|
deviceRebootToBoardloader: connectId => call({ connectId, method: 'deviceRebootToBoardloader' }),
|
|
150
151
|
deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
|
|
152
|
+
|
|
153
|
+
// File system & device control API (Protocol V2 only)
|
|
154
|
+
getProtoVersion: (connectId, params) => call({ ...params, connectId, method: 'getProtoVersion' }),
|
|
155
|
+
ping: (connectId, params) => call({ ...params, connectId, method: 'ping' }),
|
|
156
|
+
deviceReboot: (connectId, params) => call({ ...params, connectId, method: 'deviceReboot' }),
|
|
157
|
+
deviceGetDeviceInfo: (connectId, params) =>
|
|
158
|
+
call({ ...params, connectId, method: 'deviceGetDeviceInfo' }),
|
|
159
|
+
deviceGetOnboardingStatus: (connectId, params) =>
|
|
160
|
+
call({ ...params, connectId, method: 'deviceGetOnboardingStatus' }),
|
|
161
|
+
deviceFirmwareUpdate: (connectId, params) =>
|
|
162
|
+
call({ ...params, connectId, method: 'deviceFirmwareUpdate' }),
|
|
163
|
+
deviceGetFirmwareUpdateStatus: (connectId, params) =>
|
|
164
|
+
call({ ...params, connectId, method: 'deviceGetFirmwareUpdateStatus' }),
|
|
165
|
+
devReboot: (connectId, params) => call({ ...params, connectId, method: 'devReboot' }),
|
|
166
|
+
devGetDeviceInfo: (connectId, params) =>
|
|
167
|
+
call({ ...params, connectId, method: 'devGetDeviceInfo' }),
|
|
168
|
+
devFirmwareUpdate: (connectId, params) =>
|
|
169
|
+
call({ ...params, connectId, method: 'devFirmwareUpdate' }),
|
|
170
|
+
devGetFirmwareUpdateStatus: (connectId, params) =>
|
|
171
|
+
call({ ...params, connectId, method: 'devGetFirmwareUpdateStatus' }),
|
|
172
|
+
factoryDeviceInfoSettings: (connectId, params) =>
|
|
173
|
+
call({ ...params, connectId, method: 'factoryDeviceInfoSettings' }),
|
|
174
|
+
factoryGetDeviceInfo: connectId => call({ connectId, method: 'factoryGetDeviceInfo' }),
|
|
175
|
+
filesystemFixPermission: connectId => call({ connectId, method: 'filesystemFixPermission' }),
|
|
176
|
+
fileRead: (connectId, params) => call({ ...params, connectId, method: 'fileRead' }),
|
|
177
|
+
fileWrite: (connectId, params) => call({ ...params, connectId, method: 'fileWrite' }),
|
|
178
|
+
fileDelete: (connectId, params) => call({ ...params, connectId, method: 'fileDelete' }),
|
|
179
|
+
dirList: (connectId, params) => call({ ...params, connectId, method: 'dirList' }),
|
|
180
|
+
dirMake: (connectId, params) => call({ ...params, connectId, method: 'dirMake' }),
|
|
181
|
+
dirRemove: (connectId, params) => call({ ...params, connectId, method: 'dirRemove' }),
|
|
182
|
+
pathInfo: (connectId, params) => call({ ...params, connectId, method: 'pathInfo' }),
|
|
183
|
+
filesystemFileRead: (connectId, params) =>
|
|
184
|
+
call({ ...params, connectId, method: 'filesystemFileRead' }),
|
|
185
|
+
filesystemFileWrite: (connectId, params) =>
|
|
186
|
+
call({ ...params, connectId, method: 'filesystemFileWrite' }),
|
|
187
|
+
filesystemFileDelete: (connectId, params) =>
|
|
188
|
+
call({ ...params, connectId, method: 'filesystemFileDelete' }),
|
|
189
|
+
filesystemDirList: (connectId, params) =>
|
|
190
|
+
call({ ...params, connectId, method: 'filesystemDirList' }),
|
|
191
|
+
filesystemDirMake: (connectId, params) =>
|
|
192
|
+
call({ ...params, connectId, method: 'filesystemDirMake' }),
|
|
193
|
+
filesystemDirRemove: (connectId, params) =>
|
|
194
|
+
call({ ...params, connectId, method: 'filesystemDirRemove' }),
|
|
195
|
+
filesystemPathInfoQuery: (connectId, params) =>
|
|
196
|
+
call({ ...params, connectId, method: 'filesystemPathInfoQuery' }),
|
|
197
|
+
filesystemFormat: connectId => call({ connectId, method: 'filesystemFormat' }),
|
|
198
|
+
filesystemDiskControl: (connectId, params) =>
|
|
199
|
+
call({ ...params, connectId, method: 'filesystemDiskControl' }),
|
|
151
200
|
deviceRecovery: (connectId, params) => call({ ...params, connectId, method: 'deviceRecovery' }),
|
|
152
201
|
deviceReset: (connectId, params) => call({ ...params, connectId, method: 'deviceReset' }),
|
|
153
202
|
deviceSettings: (connectId, params) => call({ ...params, connectId, method: 'deviceSettings' }),
|
|
@@ -260,6 +309,8 @@ export const createCoreApi = (
|
|
|
260
309
|
call({ ...params, connectId, method: 'firmwareUpdateV2' }),
|
|
261
310
|
firmwareUpdateV3: (connectId, params) =>
|
|
262
311
|
call({ ...params, connectId, method: 'firmwareUpdateV3' }),
|
|
312
|
+
firmwareUpdateV4: (connectId, params) =>
|
|
313
|
+
call({ ...params, connectId, method: 'firmwareUpdateV4' }),
|
|
263
314
|
promptWebDeviceAccess: params => call({ ...params, method: 'promptWebDeviceAccess' }),
|
|
264
315
|
|
|
265
316
|
tronGetAddress: (connectId, deviceId, params) =>
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { DevSEState, DevSeType } from '@onekeyfe/hd-transport';
|
|
2
|
+
|
|
3
|
+
import type { DevGetDeviceInfo, DevSEInfo, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
4
|
+
import type { DeviceCommands } from '../../device/DeviceCommands';
|
|
5
|
+
|
|
6
|
+
// 单源类型:直接使用 hd-transport 生成的 ProtocolV2DeviceInfo / DevSEInfo /
|
|
7
|
+
// DevFirmwareImageInfo(与 firmware-pro2 proto 一致),不再维护手写副本。
|
|
8
|
+
export type { ProtocolV2DeviceInfo };
|
|
9
|
+
export type { DevFirmwareImageInfo as ProtocolV2FirmwareImageInfo } from '@onekeyfe/hd-transport';
|
|
10
|
+
export type { DevSEInfo as ProtocolV2SEInfo } from '@onekeyfe/hd-transport';
|
|
11
|
+
|
|
12
|
+
export type ProtocolV2SeStateLabel = 'BOOT' | 'APP_FACTORY' | 'APP';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 传输层解码会把 proto 枚举输出为名称字符串(见 hd-transport 的 messageToJSON),
|
|
16
|
+
* 但生成类型声明为数值枚举;这里统一兼容两种形态。
|
|
17
|
+
*/
|
|
18
|
+
const normalizeEnumValue = <T extends Record<string | number, string | number>>(
|
|
19
|
+
enumObject: T,
|
|
20
|
+
value: number | string | null | undefined
|
|
21
|
+
): string | null => {
|
|
22
|
+
if (value == null) return null;
|
|
23
|
+
if (typeof value === 'string') return value;
|
|
24
|
+
const label = enumObject[value];
|
|
25
|
+
return typeof label === 'string' ? label : null;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* DevSEInfo.state → 可读标签。SDK 内唯一的 SE 状态映射实现,
|
|
30
|
+
* DeviceProfile 与标准 Features 构建都从这里取。
|
|
31
|
+
*/
|
|
32
|
+
export const getProtocolV2SeState = (se?: DevSEInfo): ProtocolV2SeStateLabel | null => {
|
|
33
|
+
const label = normalizeEnumValue(DevSEState, se?.state);
|
|
34
|
+
switch (label) {
|
|
35
|
+
case 'BOOT':
|
|
36
|
+
return 'BOOT';
|
|
37
|
+
case 'APP_FACTORY':
|
|
38
|
+
return 'APP_FACTORY';
|
|
39
|
+
case 'APP':
|
|
40
|
+
return 'APP';
|
|
41
|
+
default:
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* DevSEInfo.type → 可读标签(如 'THD89')。DeviceProfile / Features
|
|
48
|
+
* 的 SE 类型归一化从这里取。
|
|
49
|
+
*/
|
|
50
|
+
export const getProtocolV2SeType = (se?: DevSEInfo): string | null =>
|
|
51
|
+
normalizeEnumValue(DevSeType, se?.type);
|
|
52
|
+
|
|
53
|
+
export const PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST = {
|
|
54
|
+
targets: {
|
|
55
|
+
hw: true,
|
|
56
|
+
fw: true,
|
|
57
|
+
bt: true,
|
|
58
|
+
status: true,
|
|
59
|
+
},
|
|
60
|
+
types: {
|
|
61
|
+
version: true,
|
|
62
|
+
specific: true,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 轻量状态刷新请求(每次 run 前使用)。
|
|
68
|
+
*
|
|
69
|
+
* status 提供 init_states / label / passphrase_protection 等会在设备端变化的字段;
|
|
70
|
+
* hw / bt 提供 serialNo / bleName 等身份字段;不含 fw/SE targets,单帧请求开销很小。
|
|
71
|
+
*/
|
|
72
|
+
export const PROTOCOL_V2_STATUS_DEVICE_INFO_REQUEST = {
|
|
73
|
+
targets: {
|
|
74
|
+
hw: true,
|
|
75
|
+
bt: true,
|
|
76
|
+
status: true,
|
|
77
|
+
},
|
|
78
|
+
types: {
|
|
79
|
+
version: true,
|
|
80
|
+
specific: true,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST = {
|
|
85
|
+
targets: {
|
|
86
|
+
hw: true,
|
|
87
|
+
fw: true,
|
|
88
|
+
bt: true,
|
|
89
|
+
se1: true,
|
|
90
|
+
se2: true,
|
|
91
|
+
se3: true,
|
|
92
|
+
se4: true,
|
|
93
|
+
status: true,
|
|
94
|
+
},
|
|
95
|
+
types: {
|
|
96
|
+
version: true,
|
|
97
|
+
specific: true,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST = {
|
|
102
|
+
targets: {
|
|
103
|
+
hw: true,
|
|
104
|
+
fw: true,
|
|
105
|
+
bt: true,
|
|
106
|
+
se1: true,
|
|
107
|
+
se2: true,
|
|
108
|
+
se3: true,
|
|
109
|
+
se4: true,
|
|
110
|
+
status: true,
|
|
111
|
+
},
|
|
112
|
+
types: {
|
|
113
|
+
version: true,
|
|
114
|
+
build_id: true,
|
|
115
|
+
hash: true,
|
|
116
|
+
specific: true,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const PROTOCOL_V2_DEVICE_INFO_REQUEST = PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST;
|
|
121
|
+
export const PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS = 10 * 1000;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 临时开关(默认关闭):当前正式链路直接调用 DevGetDeviceInfo。
|
|
125
|
+
* 仅当 Pro2 测试固件 / 早期工程板尚未实现 DevGetDeviceInfo 时,才显式开启 mock。
|
|
126
|
+
* 开启时跳过 wire 调用,直接返回 mock DeviceInfo;
|
|
127
|
+
* DevGetDeviceInfo 尚未返回的字段保持为空,不再用 transport path 兜底成设备身份。
|
|
128
|
+
*
|
|
129
|
+
* 固件实现 DevGetDeviceInfo 稳定后:删除开关与 mock。
|
|
130
|
+
* 注意:开启期间 FirmwareUpdateV4 的“升级完成版本比对”拿到的也是 mock 版本,
|
|
131
|
+
* 不能作为升级成功的依据。
|
|
132
|
+
*/
|
|
133
|
+
let protocolV2DeviceInfoMockEnabled = false;
|
|
134
|
+
|
|
135
|
+
export const setProtocolV2DeviceInfoMock = (enabled: boolean) => {
|
|
136
|
+
protocolV2DeviceInfoMockEnabled = enabled;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const isProtocolV2DeviceInfoMockEnabled = () => protocolV2DeviceInfoMockEnabled;
|
|
140
|
+
|
|
141
|
+
/** 每次调用返回新对象,避免调用方原地修改互相污染。 */
|
|
142
|
+
export const buildMockProtocolV2DeviceInfo = (): ProtocolV2DeviceInfo => ({
|
|
143
|
+
protocol_version: 2,
|
|
144
|
+
hw: {
|
|
145
|
+
// 留空:协议未上报时 SDK 不再用 transport path 伪造身份字段
|
|
146
|
+
serial_no: '',
|
|
147
|
+
},
|
|
148
|
+
fw: {
|
|
149
|
+
app: { version: '0.1.0' },
|
|
150
|
+
},
|
|
151
|
+
bt: {},
|
|
152
|
+
status: {
|
|
153
|
+
init_states: true,
|
|
154
|
+
language: 'en_US',
|
|
155
|
+
passphrase_protection: false,
|
|
156
|
+
bt_enable: true,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
export async function requestProtocolV2DeviceInfo({
|
|
161
|
+
commands,
|
|
162
|
+
timeoutMs = PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS,
|
|
163
|
+
request = PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST,
|
|
164
|
+
}: {
|
|
165
|
+
commands: DeviceCommands;
|
|
166
|
+
timeoutMs?: number;
|
|
167
|
+
request?: DevGetDeviceInfo;
|
|
168
|
+
}): Promise<ProtocolV2DeviceInfo> {
|
|
169
|
+
if (isProtocolV2DeviceInfoMockEnabled()) {
|
|
170
|
+
return buildMockProtocolV2DeviceInfo();
|
|
171
|
+
}
|
|
172
|
+
const { message } = await commands.typedCall('DevGetDeviceInfo', 'DeviceInfo', request, {
|
|
173
|
+
timeoutMs,
|
|
174
|
+
});
|
|
175
|
+
// 'DeviceInfo' 在生成类型里是 V1 DeviceInfo | ProtocolV2DeviceInfo 的合并;
|
|
176
|
+
// DevGetDeviceInfo 是 V2-only 消息,这里收窄到 V2 形态。
|
|
177
|
+
return message as ProtocolV2DeviceInfo;
|
|
178
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 当前 firmware-pro2 子模块的 DevFirmwareTargetType。
|
|
3
|
+
*
|
|
4
|
+
* 注意:仓库里的 hd-transport 生成物暂时仍带旧 target 名称;这里显式按
|
|
5
|
+
* submodules/firmware-pro2/sys/protobuf/onekey_protocol/latest/messages_device.proto
|
|
6
|
+
* 对齐当前子模块,避免运行时取到 undefined。
|
|
7
|
+
*/
|
|
8
|
+
export const ProtocolV2FirmwareTargetType = {
|
|
9
|
+
TARGET_MAIN_APP: 0,
|
|
10
|
+
TARGET_MAIN_BOOT: 1,
|
|
11
|
+
TARGET_BT: 2,
|
|
12
|
+
TARGET_SE1: 3,
|
|
13
|
+
TARGET_SE2: 4,
|
|
14
|
+
TARGET_SE3: 5,
|
|
15
|
+
TARGET_SE4: 6,
|
|
16
|
+
TARGET_RESOURCE: 10,
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export type ProtocolV2FirmwareTargetType =
|
|
20
|
+
(typeof ProtocolV2FirmwareTargetType)[keyof typeof ProtocolV2FirmwareTargetType];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Map Protocol V2 firmware file name to DevFirmwareUpdate target_id.
|
|
24
|
+
*/
|
|
25
|
+
export function protocolV2FileNameToTargetId(fileName: string): ProtocolV2FirmwareTargetType {
|
|
26
|
+
const normalized = fileName.toLowerCase();
|
|
27
|
+
if (normalized.includes('bootloader') || normalized.includes('update_rom')) {
|
|
28
|
+
return ProtocolV2FirmwareTargetType.TARGET_MAIN_BOOT;
|
|
29
|
+
}
|
|
30
|
+
if (
|
|
31
|
+
normalized.includes('coprocessor') ||
|
|
32
|
+
normalized.includes('ble') ||
|
|
33
|
+
normalized.includes('bluetooth') ||
|
|
34
|
+
normalized.includes('bt')
|
|
35
|
+
) {
|
|
36
|
+
return ProtocolV2FirmwareTargetType.TARGET_BT;
|
|
37
|
+
}
|
|
38
|
+
if (normalized.includes('se4')) return ProtocolV2FirmwareTargetType.TARGET_SE4;
|
|
39
|
+
if (normalized.includes('se3')) return ProtocolV2FirmwareTargetType.TARGET_SE3;
|
|
40
|
+
if (normalized.includes('se2')) return ProtocolV2FirmwareTargetType.TARGET_SE2;
|
|
41
|
+
if (normalized.includes('se')) return ProtocolV2FirmwareTargetType.TARGET_SE1;
|
|
42
|
+
return ProtocolV2FirmwareTargetType.TARGET_MAIN_APP;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
PROTOCOL_V2_DEVICE_INFO_REQUEST,
|
|
3
|
+
PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS,
|
|
4
|
+
PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST,
|
|
5
|
+
PROTOCOL_V2_STATUS_DEVICE_INFO_REQUEST,
|
|
6
|
+
PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST,
|
|
7
|
+
getProtocolV2SeState,
|
|
8
|
+
getProtocolV2SeType,
|
|
9
|
+
} from './features';
|
|
10
|
+
export type {
|
|
11
|
+
ProtocolV2DeviceInfo,
|
|
12
|
+
ProtocolV2FirmwareImageInfo,
|
|
13
|
+
ProtocolV2SEInfo,
|
|
14
|
+
ProtocolV2SeStateLabel,
|
|
15
|
+
} from './features';
|
|
16
|
+
export * from './firmware';
|
package/src/types/api/export.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare function firmwareUpdateV2(
|
|
|
41
41
|
export interface FirmwareUpdateV3Params {
|
|
42
42
|
bleVersion?: number[];
|
|
43
43
|
bleBinary?: ArrayBuffer;
|
|
44
|
+
chunkSize?: number;
|
|
44
45
|
|
|
45
46
|
firmwareVersion?: number[];
|
|
46
47
|
firmwareBinary?: ArrayBuffer;
|
|
@@ -56,6 +57,45 @@ export interface FirmwareUpdateV3Params {
|
|
|
56
57
|
platform: IPlatform;
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
/**
|
|
61
|
+
* firmwareUpdateV4(Protocol V2)按 DevFirmwareTargetType 拆分的目标二进制。
|
|
62
|
+
* 每个字段对应一个固件升级 target,可单独更新,也可任意组合一次更新。
|
|
63
|
+
*/
|
|
64
|
+
export interface FirmwareUpdateV4Params {
|
|
65
|
+
platform: IPlatform;
|
|
66
|
+
chunkSize?: number;
|
|
67
|
+
firmwareType?: EFirmwareType;
|
|
68
|
+
|
|
69
|
+
/** TARGET_MAIN_BOOT = 1 */
|
|
70
|
+
romloaderBinary?: ArrayBuffer;
|
|
71
|
+
/** TARGET_MAIN_BOOT = 1 */
|
|
72
|
+
bootloaderBinary?: ArrayBuffer;
|
|
73
|
+
/** TARGET_MAIN_APP = 0 */
|
|
74
|
+
applicationP1Binary?: ArrayBuffer;
|
|
75
|
+
/** TARGET_MAIN_APP = 0 */
|
|
76
|
+
applicationP2Binary?: ArrayBuffer;
|
|
77
|
+
/** TARGET_BT = 2 */
|
|
78
|
+
coprocessorBinary?: ArrayBuffer;
|
|
79
|
+
/** TARGET_SE1-4 = 3-6 */
|
|
80
|
+
se01Binary?: ArrayBuffer;
|
|
81
|
+
se02Binary?: ArrayBuffer;
|
|
82
|
+
se03Binary?: ArrayBuffer;
|
|
83
|
+
se04Binary?: ArrayBuffer;
|
|
84
|
+
/** TARGET_RESOURCE = 10(zip 包,解压后逐文件上传) */
|
|
85
|
+
resourceBinary?: ArrayBuffer;
|
|
86
|
+
forcedUpdateRes?: boolean;
|
|
87
|
+
|
|
88
|
+
/** 按 release 配置自动下载 */
|
|
89
|
+
firmwareVersion?: number[];
|
|
90
|
+
bleVersion?: number[];
|
|
91
|
+
bootloaderVersion?: number[];
|
|
92
|
+
|
|
93
|
+
/** legacy 别名:等价 applicationP1Binary */
|
|
94
|
+
firmwareBinary?: ArrayBuffer;
|
|
95
|
+
/** legacy 别名:等价 coprocessorBinary */
|
|
96
|
+
bleBinary?: ArrayBuffer;
|
|
97
|
+
}
|
|
98
|
+
|
|
59
99
|
export declare function firmwareUpdateV3(
|
|
60
100
|
connectId: string | undefined,
|
|
61
101
|
params: Params<FirmwareUpdateV3Params>
|
|
@@ -64,3 +104,12 @@ export declare function firmwareUpdateV3(
|
|
|
64
104
|
firmwareVersion: string;
|
|
65
105
|
bootloaderVersion: string;
|
|
66
106
|
}>;
|
|
107
|
+
|
|
108
|
+
export declare function firmwareUpdateV4(
|
|
109
|
+
connectId: string | undefined,
|
|
110
|
+
params: Params<FirmwareUpdateV4Params>
|
|
111
|
+
): Response<{
|
|
112
|
+
bleVersion: string;
|
|
113
|
+
firmwareVersion: string;
|
|
114
|
+
bootloaderVersion: string;
|
|
115
|
+
}>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { CommonParams, Response } from '../params';
|
|
2
|
+
import type { Features, IDeviceType, OnekeyFeatures } from '../device';
|
|
3
|
+
import type { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
4
|
+
import type { ProtocolType, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
5
|
+
|
|
6
|
+
// 协议类型单源:从 hd-transport 的 ProtocolType 派生,只额外允许 'unknown'。
|
|
7
|
+
export type DeviceInfoProtocol = ProtocolType | 'unknown';
|
|
8
|
+
|
|
9
|
+
export type DeviceInfoSource = 'features' | 'protocolV1OneKeyFeatures' | 'deviceInfo';
|
|
10
|
+
|
|
11
|
+
export type DeviceInfoScope = 'basic' | 'versions' | 'verify' | 'full';
|
|
12
|
+
|
|
13
|
+
export type GetDeviceInfoParams = {
|
|
14
|
+
scope?: DeviceInfoScope;
|
|
15
|
+
refresh?: boolean;
|
|
16
|
+
includeRaw?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type DeviceInfoMode = 'normal' | 'bootloader' | 'notInitialized' | 'unknown';
|
|
20
|
+
|
|
21
|
+
export type DeviceInfoStatus = {
|
|
22
|
+
mode: DeviceInfoMode;
|
|
23
|
+
initialized: boolean | null;
|
|
24
|
+
bootloaderMode: boolean | null;
|
|
25
|
+
unlocked: boolean | null;
|
|
26
|
+
passphraseProtection: boolean | null;
|
|
27
|
+
backupRequired: boolean | null;
|
|
28
|
+
noBackup: boolean | null;
|
|
29
|
+
language: string | null;
|
|
30
|
+
bleEnabled: boolean | null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type DeviceProfileVersions = {
|
|
34
|
+
firmware: string | null;
|
|
35
|
+
bootloader: string | null;
|
|
36
|
+
board: string | null;
|
|
37
|
+
ble: string | null;
|
|
38
|
+
se01?: string | null;
|
|
39
|
+
se02?: string | null;
|
|
40
|
+
se03?: string | null;
|
|
41
|
+
se04?: string | null;
|
|
42
|
+
se01Boot?: string | null;
|
|
43
|
+
se02Boot?: string | null;
|
|
44
|
+
se03Boot?: string | null;
|
|
45
|
+
se04Boot?: string | null;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type DeviceProfileVerify = {
|
|
49
|
+
firmwareBuildId?: string;
|
|
50
|
+
firmwareHash?: string;
|
|
51
|
+
bootloaderBuildId?: string;
|
|
52
|
+
bootloaderHash?: string;
|
|
53
|
+
boardBuildId?: string;
|
|
54
|
+
boardHash?: string;
|
|
55
|
+
bleBuildId?: string;
|
|
56
|
+
bleHash?: string;
|
|
57
|
+
se01BuildId?: string;
|
|
58
|
+
se01Hash?: string;
|
|
59
|
+
se02BuildId?: string;
|
|
60
|
+
se02Hash?: string;
|
|
61
|
+
se03BuildId?: string;
|
|
62
|
+
se03Hash?: string;
|
|
63
|
+
se04BuildId?: string;
|
|
64
|
+
se04Hash?: string;
|
|
65
|
+
se01BootBuildId?: string;
|
|
66
|
+
se01BootHash?: string;
|
|
67
|
+
se02BootBuildId?: string;
|
|
68
|
+
se02BootHash?: string;
|
|
69
|
+
se03BootBuildId?: string;
|
|
70
|
+
se03BootHash?: string;
|
|
71
|
+
se04BootBuildId?: string;
|
|
72
|
+
se04BootHash?: string;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type DeviceProfileRaw = {
|
|
76
|
+
features?: Features;
|
|
77
|
+
protocolV1OneKeyFeatures?: OnekeyFeatures;
|
|
78
|
+
protocolV2DeviceInfo?: ProtocolV2DeviceInfo;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type DeviceProfile = {
|
|
82
|
+
protocol: DeviceInfoProtocol;
|
|
83
|
+
sources: DeviceInfoSource[];
|
|
84
|
+
deviceType: IDeviceType;
|
|
85
|
+
firmwareType: EFirmwareType;
|
|
86
|
+
deviceId: string;
|
|
87
|
+
serialNo: string;
|
|
88
|
+
label: string | null;
|
|
89
|
+
bleName: string | null;
|
|
90
|
+
status: DeviceInfoStatus;
|
|
91
|
+
versions: DeviceProfileVersions;
|
|
92
|
+
verify?: DeviceProfileVerify;
|
|
93
|
+
raw?: DeviceProfileRaw;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export declare function getDeviceInfo(
|
|
97
|
+
connectId?: string,
|
|
98
|
+
params?: CommonParams & GetDeviceInfoParams
|
|
99
|
+
): Response<DeviceProfile>;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { CommonParams, Response } from '../params';
|
|
2
2
|
|
|
3
|
+
export type GetPassphraseStatePayload = {
|
|
4
|
+
passphraseState?: string;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
unlockedAttachPin?: boolean;
|
|
7
|
+
passphraseProtection?: boolean | null;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type GetPassphraseStateParams = CommonParams & {
|
|
11
|
+
allowCreateAttachPin?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
3
14
|
export declare function getPassphraseState(
|
|
4
15
|
connectId?: string,
|
|
5
|
-
params?:
|
|
6
|
-
): Response<
|
|
16
|
+
params?: GetPassphraseStateParams
|
|
17
|
+
): Response<GetPassphraseStatePayload>;
|