@onekeyfe/hd-core 1.1.27-alpha.41 → 1.1.27-alpha.6
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__/DeviceCommands.test.ts +99 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +261 -0
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/preInitialize.test.ts +22 -0
- package/dist/api/BaseMethod.d.ts +7 -1
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +0 -1
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +1 -6
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +1 -2
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumGetAddress.d.ts +6 -2
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts +5 -2
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts +5 -2
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts +9 -2
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts +9 -2
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts +8 -2
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts +8 -2
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +11 -1
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +11 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +15 -1
- 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 +11 -1
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +11 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +11 -2
- package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosSignTransaction.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/PreInitialize.d.ts +6 -0
- package/dist/api/device/PreInitialize.d.ts.map +1 -0
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts +8 -2
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTransaction.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/legacyV1/signTypedData.d.ts +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +2 -10
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -28
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
- package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
- package/dist/api/neo/NeoGetAddress.d.ts +8 -2
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts +8 -2
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts +9 -2
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts +9 -2
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts +8 -2
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts +9 -2
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignEvent.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
- package/dist/api/scdo/ScdoGetAddress.d.ts +6 -2
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts +5 -2
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts +5 -2
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +0 -1
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +0 -4
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +0 -4
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +0 -8
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +1 -2
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +1 -2
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +2 -2
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +0 -4
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +0 -4
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- package/dist/core/PollingStateManager.d.ts +8 -0
- package/dist/core/PollingStateManager.d.ts.map +1 -0
- package/dist/core/RequestQueue.d.ts +1 -1
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +4 -7
- 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 +4 -5
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +18 -5
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +8 -8
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +1 -2
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +0 -8
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +43 -292
- package/dist/index.js +1009 -16201
- package/dist/inject.d.ts.map +1 -1
- 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 +0 -7
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +1 -10
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +3 -33
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/preInitialize.d.ts +3 -0
- package/dist/types/api/preInitialize.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 +2 -6
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -2
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +3 -5
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +0 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +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/dist/utils/versionUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +82 -7
- package/src/api/FirmwareUpdateV3.ts +4 -21
- package/src/api/GetOnekeyFeatures.ts +3 -75
- package/src/api/GetPassphraseState.ts +7 -16
- package/src/api/SearchDevices.ts +2 -7
- package/src/api/alephium/AlephiumGetAddress.ts +2 -6
- package/src/api/alephium/AlephiumSignMessage.ts +2 -6
- package/src/api/alephium/AlephiumSignTransaction.ts +3 -6
- package/src/api/algo/AlgoSignTransaction.ts +1 -0
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +9 -18
- package/src/api/aptos/AptosSignInMessage.ts +1 -0
- package/src/api/aptos/AptosSignMessage.ts +1 -0
- package/src/api/aptos/AptosSignTransaction.ts +1 -0
- package/src/api/benfen/BenfenGetAddress.ts +2 -6
- package/src/api/benfen/BenfenGetPublicKey.ts +2 -6
- package/src/api/benfen/BenfenSignMessage.ts +2 -6
- package/src/api/benfen/BenfenSignTransaction.ts +2 -6
- package/src/api/btc/BTCSignMessage.ts +1 -0
- package/src/api/btc/BTCSignPsbt.ts +1 -0
- package/src/api/btc/BTCSignTransaction.ts +1 -0
- package/src/api/btc/helpers/versionLimit.ts +1 -7
- package/src/api/cardano/CardanoSignMessage.ts +1 -0
- package/src/api/cardano/CardanoSignTransaction.ts +1 -0
- package/src/api/conflux/ConfluxSignMessage.ts +1 -0
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +1 -0
- package/src/api/conflux/ConfluxSignTransaction.ts +3 -5
- package/src/api/cosmos/CosmosSignTransaction.ts +1 -0
- package/src/api/device/DeviceRebootToBoardloader.ts +1 -10
- package/src/api/device/DeviceRebootToBootloader.ts +1 -10
- package/src/api/device/PreInitialize.ts +41 -0
- package/src/api/dynex/DnxGetAddress.ts +0 -7
- package/src/api/dynex/DnxSignTransaction.ts +1 -7
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +3 -1
- package/src/api/evm/EVMSignMessageEIP712.ts +2 -14
- package/src/api/evm/EVMSignTransaction.ts +3 -1
- package/src/api/evm/EVMSignTypedData.ts +8 -6
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +1 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +4 -27
- package/src/api/index.ts +1 -30
- package/src/api/kaspa/KaspaSignTransaction.ts +1 -0
- package/src/api/near/NearSignTransaction.ts +1 -0
- package/src/api/nem/NEMSignTransaction.ts +1 -0
- package/src/api/neo/NeoGetAddress.ts +1 -6
- package/src/api/neo/NeoSignTransaction.ts +2 -6
- package/src/api/nervos/NervosGetAddress.ts +2 -6
- package/src/api/nervos/NervosSignTransaction.ts +3 -6
- package/src/api/nexa/NexaGetAddress.ts +2 -6
- package/src/api/nexa/NexaSignTransaction.ts +4 -6
- package/src/api/nostr/NostrSignEvent.ts +1 -0
- package/src/api/nostr/NostrSignSchnorr.ts +1 -0
- package/src/api/polkadot/PolkadotSignTransaction.ts +1 -0
- package/src/api/scdo/ScdoGetAddress.ts +2 -6
- package/src/api/scdo/ScdoSignMessage.ts +2 -6
- package/src/api/scdo/ScdoSignTransaction.ts +3 -6
- package/src/api/solana/SolGetAddress.ts +0 -4
- package/src/api/solana/SolSignMessage.ts +1 -4
- package/src/api/solana/SolSignOffchainMessage.ts +1 -4
- package/src/api/solana/SolSignTransaction.ts +1 -8
- package/src/api/starcoin/StarcoinSignMessage.ts +1 -0
- package/src/api/starcoin/StarcoinSignTransaction.ts +1 -0
- package/src/api/stellar/StellarGetAddress.ts +1 -10
- package/src/api/stellar/StellarSignTransaction.ts +2 -14
- package/src/api/sui/SuiSignMessage.ts +1 -0
- package/src/api/sui/SuiSignTransaction.ts +10 -12
- package/src/api/ton/TonSignData.ts +1 -0
- package/src/api/ton/TonSignMessage.ts +1 -0
- package/src/api/ton/TonSignProof.ts +1 -0
- package/src/api/tron/TronSignMessage.ts +2 -5
- package/src/api/tron/TronSignTransaction.ts +1 -4
- package/src/api/xrp/XrpSignTransaction.ts +2 -1
- package/src/core/PollingStateManager.ts +47 -0
- package/src/core/RequestQueue.ts +10 -3
- package/src/core/index.ts +153 -62
- package/src/data-manager/DataManager.ts +7 -12
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +12 -38
- package/src/device/Device.ts +82 -98
- package/src/device/DeviceCommands.ts +26 -166
- package/src/device/DeviceConnector.ts +4 -29
- package/src/device/DevicePool.ts +1 -1
- package/src/events/ui-request.ts +0 -8
- package/src/inject.ts +2 -46
- package/src/types/api/export.ts +0 -1
- package/src/types/api/firmwareUpdate.ts +0 -12
- package/src/types/api/getPassphraseState.ts +2 -13
- package/src/types/api/index.ts +3 -80
- package/src/types/api/preInitialize.ts +3 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +2 -33
- package/src/types/params.ts +2 -4
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +21 -62
- package/src/utils/deviceInfoUtils.ts +8 -15
- package/src/utils/index.ts +0 -1
- package/__tests__/protocol-v2.test.ts +0 -1688
- package/dist/api/DirList.d.ts +0 -10
- package/dist/api/DirList.d.ts.map +0 -1
- package/dist/api/DirMake.d.ts +0 -9
- package/dist/api/DirMake.d.ts.map +0 -1
- package/dist/api/DirRemove.d.ts +0 -9
- package/dist/api/DirRemove.d.ts.map +0 -1
- package/dist/api/FileDelete.d.ts +0 -9
- package/dist/api/FileDelete.d.ts.map +0 -1
- package/dist/api/FileRead.d.ts +0 -19
- package/dist/api/FileRead.d.ts.map +0 -1
- package/dist/api/FileWrite.d.ts +0 -23
- package/dist/api/FileWrite.d.ts.map +0 -1
- package/dist/api/FirmwareUpdateV4.d.ts +0 -32
- package/dist/api/FirmwareUpdateV4.d.ts.map +0 -1
- package/dist/api/GetDeviceInfo.d.ts +0 -9
- package/dist/api/GetDeviceInfo.d.ts.map +0 -1
- package/dist/api/PathInfo.d.ts +0 -9
- package/dist/api/PathInfo.d.ts.map +0 -1
- package/dist/api/helpers/deviceInfo.d.ts +0 -15
- package/dist/api/helpers/deviceInfo.d.ts.map +0 -1
- package/dist/api/helpers/filesystemValidation.d.ts +0 -7
- package/dist/api/helpers/filesystemValidation.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +0 -10
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +0 -6
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +0 -6
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +0 -1
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
- package/dist/api/protocol-v2/Ping.d.ts +0 -8
- package/dist/api/protocol-v2/Ping.d.ts.map +0 -1
- package/dist/api/protocol-v2/helpers.d.ts +0 -49
- package/dist/api/protocol-v2/helpers.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/features.d.ts +0 -104
- package/dist/protocols/protocol-v2/features.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +0 -12
- package/dist/protocols/protocol-v2/firmware.d.ts.map +0 -1
- package/dist/protocols/protocol-v2/index.d.ts +0 -3
- package/dist/protocols/protocol-v2/index.d.ts.map +0 -1
- package/dist/types/api/getDeviceInfo.d.ts +0 -84
- package/dist/types/api/getDeviceInfo.d.ts.map +0 -1
- package/dist/types/api/protocolV2.d.ts +0 -127
- package/dist/types/api/protocolV2.d.ts.map +0 -1
- package/src/api/DirList.ts +0 -29
- package/src/api/DirMake.ts +0 -21
- package/src/api/DirRemove.ts +0 -21
- package/src/api/FileDelete.ts +0 -21
- package/src/api/FileRead.ts +0 -165
- package/src/api/FileWrite.ts +0 -203
- package/src/api/FirmwareUpdateV4.ts +0 -810
- package/src/api/GetDeviceInfo.ts +0 -161
- package/src/api/PathInfo.ts +0 -25
- package/src/api/helpers/deviceInfo.ts +0 -205
- package/src/api/helpers/filesystemValidation.ts +0 -51
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +0 -50
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +0 -35
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +0 -18
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -18
- package/src/api/protocol-v2/DeviceReboot.ts +0 -22
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -27
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +0 -18
- package/src/api/protocol-v2/FilesystemDiskControl.ts +0 -34
- package/src/api/protocol-v2/FilesystemFixPermission.ts +0 -14
- package/src/api/protocol-v2/FilesystemFormat.ts +0 -14
- package/src/api/protocol-v2/GetProtoVersion.ts +0 -14
- package/src/api/protocol-v2/Ping.ts +0 -16
- package/src/api/protocol-v2/helpers.ts +0 -161
- package/src/data/messages/messages-protocol-v2.json +0 -13128
- package/src/protocols/protocol-v2/features.ts +0 -287
- package/src/protocols/protocol-v2/firmware.ts +0 -26
- package/src/protocols/protocol-v2/index.ts +0 -2
- package/src/types/api/getDeviceInfo.ts +0 -97
- package/src/types/api/protocolV2.ts +0 -226
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
2
|
-
|
|
3
|
-
import type { Features } from '../../types';
|
|
4
|
-
import type { DeviceCommands } from '../../device/DeviceCommands';
|
|
5
|
-
import type { OneKeyDeviceInfo as DeviceDescriptor } from '@onekeyfe/hd-transport';
|
|
6
|
-
|
|
7
|
-
type ProtocolV2Bytes = Uint8Array | number[] | string;
|
|
8
|
-
|
|
9
|
-
type ProtocolV2FirmwareImageInfo = {
|
|
10
|
-
version?: string;
|
|
11
|
-
build_id?: string;
|
|
12
|
-
hash?: ProtocolV2Bytes;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type ProtocolV2SEInfo = {
|
|
16
|
-
boot?: ProtocolV2FirmwareImageInfo;
|
|
17
|
-
app?: ProtocolV2FirmwareImageInfo;
|
|
18
|
-
type?: number;
|
|
19
|
-
state?: number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
type ProtocolV2DeviceInfo = {
|
|
23
|
-
protocol_version?: number;
|
|
24
|
-
hw?: {
|
|
25
|
-
Device_type?: number;
|
|
26
|
-
device_type?: number;
|
|
27
|
-
serial_no?: string;
|
|
28
|
-
hardware_version?: string;
|
|
29
|
-
hardware_version_raw_adc?: number;
|
|
30
|
-
};
|
|
31
|
-
fw?: {
|
|
32
|
-
board?: ProtocolV2FirmwareImageInfo;
|
|
33
|
-
boot?: ProtocolV2FirmwareImageInfo;
|
|
34
|
-
app?: ProtocolV2FirmwareImageInfo;
|
|
35
|
-
};
|
|
36
|
-
bt?: {
|
|
37
|
-
boot?: ProtocolV2FirmwareImageInfo;
|
|
38
|
-
app?: ProtocolV2FirmwareImageInfo;
|
|
39
|
-
adv_name?: string;
|
|
40
|
-
mac?: ProtocolV2Bytes;
|
|
41
|
-
};
|
|
42
|
-
se1?: ProtocolV2SEInfo;
|
|
43
|
-
se2?: ProtocolV2SEInfo;
|
|
44
|
-
se3?: ProtocolV2SEInfo;
|
|
45
|
-
se4?: ProtocolV2SEInfo;
|
|
46
|
-
status?: {
|
|
47
|
-
language?: string;
|
|
48
|
-
bt_enable?: boolean;
|
|
49
|
-
init_states?: boolean;
|
|
50
|
-
backup_required?: boolean;
|
|
51
|
-
passphrase_protection?: boolean;
|
|
52
|
-
label?: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST = {
|
|
57
|
-
targets: {
|
|
58
|
-
hw: true,
|
|
59
|
-
fw: true,
|
|
60
|
-
bt: true,
|
|
61
|
-
status: true,
|
|
62
|
-
},
|
|
63
|
-
types: {
|
|
64
|
-
version: true,
|
|
65
|
-
specific: true,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST = {
|
|
70
|
-
targets: {
|
|
71
|
-
hw: true,
|
|
72
|
-
fw: true,
|
|
73
|
-
bt: true,
|
|
74
|
-
se1: true,
|
|
75
|
-
se2: true,
|
|
76
|
-
se3: true,
|
|
77
|
-
se4: true,
|
|
78
|
-
status: true,
|
|
79
|
-
},
|
|
80
|
-
types: {
|
|
81
|
-
version: true,
|
|
82
|
-
build_id: true,
|
|
83
|
-
hash: true,
|
|
84
|
-
specific: true,
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export const PROTOCOL_V2_DEVICE_INFO_REQUEST = PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST;
|
|
89
|
-
|
|
90
|
-
function parseVersion(version?: string | null): [number, number, number] {
|
|
91
|
-
if (!version) return [0, 0, 0];
|
|
92
|
-
const [major = 0, minor = 0, patch = 0] = version.split('.').map(part => Number(part) || 0);
|
|
93
|
-
return [major, minor, patch];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function bytesToHex(value: unknown): string | undefined {
|
|
97
|
-
if (!value) return undefined;
|
|
98
|
-
if (typeof value === 'string') return value;
|
|
99
|
-
if (value instanceof Uint8Array) {
|
|
100
|
-
return Array.from(value)
|
|
101
|
-
.map(byte => byte.toString(16).padStart(2, '0'))
|
|
102
|
-
.join('');
|
|
103
|
-
}
|
|
104
|
-
if (Array.isArray(value)) {
|
|
105
|
-
return value.map(byte => Number(byte).toString(16).padStart(2, '0')).join('');
|
|
106
|
-
}
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getDescriptorId(descriptor: DeviceDescriptor) {
|
|
111
|
-
return descriptor.path || descriptor.id || '';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function getImageVersion(image?: ProtocolV2FirmwareImageInfo) {
|
|
115
|
-
return image?.version || undefined;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function getImageBuildId(image?: ProtocolV2FirmwareImageInfo) {
|
|
119
|
-
return image?.build_id || undefined;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function getImageHash(image?: ProtocolV2FirmwareImageInfo) {
|
|
123
|
-
return bytesToHex(image?.hash);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function getSeState(se?: ProtocolV2SEInfo) {
|
|
127
|
-
switch (se?.state) {
|
|
128
|
-
case 0:
|
|
129
|
-
return 'BOOT';
|
|
130
|
-
case 51:
|
|
131
|
-
return 'APP_FACTORY';
|
|
132
|
-
case 85:
|
|
133
|
-
return 'APP';
|
|
134
|
-
default:
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function createBaseFeatures(descriptor: DeviceDescriptor): Features {
|
|
140
|
-
const descriptorId = getDescriptorId(descriptor);
|
|
141
|
-
return {
|
|
142
|
-
vendor: 'onekey.so',
|
|
143
|
-
major_version: 0,
|
|
144
|
-
minor_version: 0,
|
|
145
|
-
patch_version: 0,
|
|
146
|
-
bootloader_mode: false,
|
|
147
|
-
device_id: descriptorId,
|
|
148
|
-
pin_protection: null,
|
|
149
|
-
passphrase_protection: null,
|
|
150
|
-
language: null,
|
|
151
|
-
label: null,
|
|
152
|
-
initialized: false,
|
|
153
|
-
revision: null,
|
|
154
|
-
bootloader_hash: null,
|
|
155
|
-
imported: null,
|
|
156
|
-
unlocked: false,
|
|
157
|
-
firmware_present: false,
|
|
158
|
-
needs_backup: null,
|
|
159
|
-
flags: null,
|
|
160
|
-
model: 'pro2',
|
|
161
|
-
fw_major: 0,
|
|
162
|
-
fw_minor: 0,
|
|
163
|
-
fw_patch: 0,
|
|
164
|
-
fw_vendor: null,
|
|
165
|
-
unfinished_backup: null,
|
|
166
|
-
no_backup: null,
|
|
167
|
-
recovery_mode: null,
|
|
168
|
-
capabilities: [],
|
|
169
|
-
backup_type: null,
|
|
170
|
-
sd_card_present: null,
|
|
171
|
-
sd_protection: null,
|
|
172
|
-
wipe_code_protection: null,
|
|
173
|
-
session_id: null,
|
|
174
|
-
passphrase_always_on_device: null,
|
|
175
|
-
safety_checks: null,
|
|
176
|
-
auto_lock_delay_ms: null,
|
|
177
|
-
display_rotation: null,
|
|
178
|
-
experimental_features: null,
|
|
179
|
-
protocol_version: null,
|
|
180
|
-
onekey_device_type: EDeviceType.Pro2,
|
|
181
|
-
onekey_serial_no: descriptorId,
|
|
182
|
-
serial_no: descriptorId,
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export function normalizeProtocolV2Features(
|
|
187
|
-
descriptor: DeviceDescriptor,
|
|
188
|
-
deviceInfo?: ProtocolV2DeviceInfo
|
|
189
|
-
): Features {
|
|
190
|
-
const features = createBaseFeatures(descriptor);
|
|
191
|
-
if (!deviceInfo) return features;
|
|
192
|
-
|
|
193
|
-
const serialNo =
|
|
194
|
-
deviceInfo.hw?.serial_no || features.onekey_serial_no || getDescriptorId(descriptor);
|
|
195
|
-
const firmwareVersion = getImageVersion(deviceInfo.fw?.app);
|
|
196
|
-
const [fwMajor, fwMinor, fwPatch] = parseVersion(firmwareVersion);
|
|
197
|
-
|
|
198
|
-
return {
|
|
199
|
-
...features,
|
|
200
|
-
major_version: fwMajor,
|
|
201
|
-
minor_version: fwMinor,
|
|
202
|
-
patch_version: fwPatch,
|
|
203
|
-
fw_major: fwMajor,
|
|
204
|
-
fw_minor: fwMinor,
|
|
205
|
-
fw_patch: fwPatch,
|
|
206
|
-
device_id: serialNo,
|
|
207
|
-
serial_no: serialNo,
|
|
208
|
-
onekey_serial_no: serialNo,
|
|
209
|
-
protocol_version: deviceInfo.protocol_version ?? features.protocol_version,
|
|
210
|
-
label: deviceInfo.status?.label ?? features.label,
|
|
211
|
-
language: deviceInfo.status?.language ?? features.language,
|
|
212
|
-
initialized: deviceInfo.status?.init_states ?? features.initialized,
|
|
213
|
-
passphrase_protection:
|
|
214
|
-
deviceInfo.status?.passphrase_protection ?? features.passphrase_protection,
|
|
215
|
-
needs_backup: deviceInfo.status?.backup_required ?? features.needs_backup,
|
|
216
|
-
ble_enable: deviceInfo.status?.bt_enable,
|
|
217
|
-
onekey_ble_name: deviceInfo.bt?.adv_name,
|
|
218
|
-
ble_name: deviceInfo.bt?.adv_name,
|
|
219
|
-
onekey_firmware_version: firmwareVersion,
|
|
220
|
-
onekey_firmware_build_id: getImageBuildId(deviceInfo.fw?.app),
|
|
221
|
-
onekey_firmware_hash: getImageHash(deviceInfo.fw?.app),
|
|
222
|
-
onekey_boot_version: getImageVersion(deviceInfo.fw?.boot),
|
|
223
|
-
bootloader_version: getImageVersion(deviceInfo.fw?.boot),
|
|
224
|
-
onekey_boot_build_id: getImageBuildId(deviceInfo.fw?.boot),
|
|
225
|
-
onekey_boot_hash: getImageHash(deviceInfo.fw?.boot),
|
|
226
|
-
onekey_board_version: getImageVersion(deviceInfo.fw?.board),
|
|
227
|
-
onekey_board_build_id: getImageBuildId(deviceInfo.fw?.board),
|
|
228
|
-
onekey_board_hash: getImageHash(deviceInfo.fw?.board),
|
|
229
|
-
onekey_ble_version: getImageVersion(deviceInfo.bt?.app),
|
|
230
|
-
ble_ver: getImageVersion(deviceInfo.bt?.app),
|
|
231
|
-
onekey_ble_build_id: getImageBuildId(deviceInfo.bt?.app),
|
|
232
|
-
onekey_ble_hash: getImageHash(deviceInfo.bt?.app),
|
|
233
|
-
onekey_se01_version: getImageVersion(deviceInfo.se1?.app),
|
|
234
|
-
onekey_se01_hash: getImageHash(deviceInfo.se1?.app),
|
|
235
|
-
onekey_se01_build_id: getImageBuildId(deviceInfo.se1?.app),
|
|
236
|
-
onekey_se01_boot_version: getImageVersion(deviceInfo.se1?.boot),
|
|
237
|
-
onekey_se01_boot_hash: getImageHash(deviceInfo.se1?.boot),
|
|
238
|
-
onekey_se01_boot_build_id: getImageBuildId(deviceInfo.se1?.boot),
|
|
239
|
-
onekey_se01_state: getSeState(deviceInfo.se1),
|
|
240
|
-
onekey_se02_version: getImageVersion(deviceInfo.se2?.app),
|
|
241
|
-
onekey_se02_hash: getImageHash(deviceInfo.se2?.app),
|
|
242
|
-
onekey_se02_build_id: getImageBuildId(deviceInfo.se2?.app),
|
|
243
|
-
onekey_se02_boot_version: getImageVersion(deviceInfo.se2?.boot),
|
|
244
|
-
onekey_se02_boot_hash: getImageHash(deviceInfo.se2?.boot),
|
|
245
|
-
onekey_se02_boot_build_id: getImageBuildId(deviceInfo.se2?.boot),
|
|
246
|
-
onekey_se02_state: getSeState(deviceInfo.se2),
|
|
247
|
-
onekey_se03_version: getImageVersion(deviceInfo.se3?.app),
|
|
248
|
-
onekey_se03_hash: getImageHash(deviceInfo.se3?.app),
|
|
249
|
-
onekey_se03_build_id: getImageBuildId(deviceInfo.se3?.app),
|
|
250
|
-
onekey_se03_boot_version: getImageVersion(deviceInfo.se3?.boot),
|
|
251
|
-
onekey_se03_boot_hash: getImageHash(deviceInfo.se3?.boot),
|
|
252
|
-
onekey_se03_boot_build_id: getImageBuildId(deviceInfo.se3?.boot),
|
|
253
|
-
onekey_se03_state: getSeState(deviceInfo.se3),
|
|
254
|
-
onekey_se04_version: getImageVersion(deviceInfo.se4?.app),
|
|
255
|
-
onekey_se04_hash: getImageHash(deviceInfo.se4?.app),
|
|
256
|
-
onekey_se04_build_id: getImageBuildId(deviceInfo.se4?.app),
|
|
257
|
-
onekey_se04_boot_version: getImageVersion(deviceInfo.se4?.boot),
|
|
258
|
-
onekey_se04_boot_hash: getImageHash(deviceInfo.se4?.boot),
|
|
259
|
-
onekey_se04_boot_build_id: getImageBuildId(deviceInfo.se4?.boot),
|
|
260
|
-
onekey_se04_state: getSeState(deviceInfo.se4),
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export async function getProtocolV2Features({
|
|
265
|
-
commands,
|
|
266
|
-
descriptor,
|
|
267
|
-
timeoutMs,
|
|
268
|
-
}: {
|
|
269
|
-
commands: DeviceCommands;
|
|
270
|
-
descriptor: DeviceDescriptor;
|
|
271
|
-
timeoutMs?: number;
|
|
272
|
-
}) {
|
|
273
|
-
const callOptions = timeoutMs ? { timeoutMs } : undefined;
|
|
274
|
-
const { message } = callOptions
|
|
275
|
-
? await commands.typedCall(
|
|
276
|
-
'DeviceGetDeviceInfo',
|
|
277
|
-
'DeviceInfo',
|
|
278
|
-
PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST,
|
|
279
|
-
callOptions
|
|
280
|
-
)
|
|
281
|
-
: await commands.typedCall(
|
|
282
|
-
'DeviceGetDeviceInfo',
|
|
283
|
-
'DeviceInfo',
|
|
284
|
-
PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST
|
|
285
|
-
);
|
|
286
|
-
return normalizeProtocolV2Features(descriptor, message as unknown as ProtocolV2DeviceInfo);
|
|
287
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Protocol V2 DeviceFirmwareTargetType enum (from messages-protocol-v2.json).
|
|
3
|
-
*/
|
|
4
|
-
export const ProtocolV2FirmwareTargetType = {
|
|
5
|
-
TARGET_INVALID: 0,
|
|
6
|
-
TARGET_ROMLOADER: 1,
|
|
7
|
-
TARGET_BOOTLOADER: 2,
|
|
8
|
-
TARGET_FIRMWARE_P1: 3,
|
|
9
|
-
TARGET_FIRMWARE_P2: 4,
|
|
10
|
-
TARGET_COPROCESSOR: 5,
|
|
11
|
-
TARGET_SE: 6,
|
|
12
|
-
TARGET_RESOURCE: 10,
|
|
13
|
-
} as const;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Map Protocol V2 firmware file name to DeviceFirmwareUpdate target_id.
|
|
17
|
-
*/
|
|
18
|
-
export function protocolV2FileNameToTargetId(fileName: string): number {
|
|
19
|
-
const normalized = fileName.toLowerCase();
|
|
20
|
-
if (normalized.includes('romloader')) return ProtocolV2FirmwareTargetType.TARGET_ROMLOADER;
|
|
21
|
-
if (normalized.includes('bootloader')) return ProtocolV2FirmwareTargetType.TARGET_BOOTLOADER;
|
|
22
|
-
if (normalized.includes('ble')) return ProtocolV2FirmwareTargetType.TARGET_COPROCESSOR;
|
|
23
|
-
if (normalized.includes('se')) return ProtocolV2FirmwareTargetType.TARGET_SE;
|
|
24
|
-
if (normalized.includes('p2')) return ProtocolV2FirmwareTargetType.TARGET_FIRMWARE_P2;
|
|
25
|
-
return ProtocolV2FirmwareTargetType.TARGET_FIRMWARE_P1;
|
|
26
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
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 { ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
5
|
-
|
|
6
|
-
export type DeviceInfoProtocol = 'V1' | 'V2' | 'unknown';
|
|
7
|
-
|
|
8
|
-
export type DeviceInfoSource = 'features' | 'onekeyFeatures' | 'deviceGetDeviceInfo';
|
|
9
|
-
|
|
10
|
-
export type DeviceInfoScope = 'basic' | 'versions' | 'verify' | 'full';
|
|
11
|
-
|
|
12
|
-
export type GetDeviceInfoParams = {
|
|
13
|
-
scope?: DeviceInfoScope;
|
|
14
|
-
refresh?: boolean;
|
|
15
|
-
includeRaw?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type DeviceInfoMode = 'normal' | 'bootloader' | 'notInitialized' | 'unknown';
|
|
19
|
-
|
|
20
|
-
export type DeviceInfoStatus = {
|
|
21
|
-
mode: DeviceInfoMode;
|
|
22
|
-
initialized: boolean | null;
|
|
23
|
-
bootloaderMode: boolean | null;
|
|
24
|
-
unlocked: boolean | null;
|
|
25
|
-
passphraseProtection: boolean | null;
|
|
26
|
-
backupRequired: boolean | null;
|
|
27
|
-
language: string | null;
|
|
28
|
-
bleEnabled?: boolean | null;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type UnifiedDeviceInfoVersions = {
|
|
32
|
-
firmware: string | null;
|
|
33
|
-
bootloader: string | null;
|
|
34
|
-
board: string | null;
|
|
35
|
-
ble: string | null;
|
|
36
|
-
se01?: string | null;
|
|
37
|
-
se02?: string | null;
|
|
38
|
-
se03?: string | null;
|
|
39
|
-
se04?: string | null;
|
|
40
|
-
se01Boot?: string | null;
|
|
41
|
-
se02Boot?: string | null;
|
|
42
|
-
se03Boot?: string | null;
|
|
43
|
-
se04Boot?: string | null;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type UnifiedDeviceInfoVerify = {
|
|
47
|
-
firmwareBuildId?: string;
|
|
48
|
-
firmwareHash?: string;
|
|
49
|
-
bootloaderBuildId?: string;
|
|
50
|
-
bootloaderHash?: string;
|
|
51
|
-
boardBuildId?: string;
|
|
52
|
-
boardHash?: string;
|
|
53
|
-
bleBuildId?: string;
|
|
54
|
-
bleHash?: string;
|
|
55
|
-
se01BuildId?: string;
|
|
56
|
-
se01Hash?: string;
|
|
57
|
-
se02BuildId?: string;
|
|
58
|
-
se02Hash?: string;
|
|
59
|
-
se03BuildId?: string;
|
|
60
|
-
se03Hash?: string;
|
|
61
|
-
se04BuildId?: string;
|
|
62
|
-
se04Hash?: string;
|
|
63
|
-
se01BootBuildId?: string;
|
|
64
|
-
se01BootHash?: string;
|
|
65
|
-
se02BootBuildId?: string;
|
|
66
|
-
se02BootHash?: string;
|
|
67
|
-
se03BootBuildId?: string;
|
|
68
|
-
se03BootHash?: string;
|
|
69
|
-
se04BootBuildId?: string;
|
|
70
|
-
se04BootHash?: string;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export type UnifiedDeviceInfoRaw = {
|
|
74
|
-
features?: Features;
|
|
75
|
-
onekeyFeatures?: OnekeyFeatures;
|
|
76
|
-
protocolV2DeviceInfo?: ProtocolV2DeviceInfo;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export type UnifiedDeviceInfo = {
|
|
80
|
-
protocol: DeviceInfoProtocol;
|
|
81
|
-
sources: DeviceInfoSource[];
|
|
82
|
-
deviceType: IDeviceType;
|
|
83
|
-
firmwareType: EFirmwareType;
|
|
84
|
-
deviceId: string;
|
|
85
|
-
serialNo: string;
|
|
86
|
-
label: string | null;
|
|
87
|
-
bleName: string | null;
|
|
88
|
-
status: DeviceInfoStatus;
|
|
89
|
-
versions: UnifiedDeviceInfoVersions;
|
|
90
|
-
verify?: UnifiedDeviceInfoVerify;
|
|
91
|
-
raw?: UnifiedDeviceInfoRaw;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export declare function getDeviceInfo(
|
|
95
|
-
connectId?: string,
|
|
96
|
-
params?: CommonParams & GetDeviceInfoParams
|
|
97
|
-
): Response<UnifiedDeviceInfo>;
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import type { CommonParams, Response } from '../params';
|
|
2
|
-
import type {
|
|
3
|
-
DeviceFirmwareTarget,
|
|
4
|
-
DeviceFirmwareUpdateStatus,
|
|
5
|
-
DeviceOnboardingStatus,
|
|
6
|
-
DeviceInfoTargets,
|
|
7
|
-
DeviceInfoTypes,
|
|
8
|
-
DeviceRebootType,
|
|
9
|
-
FactoryDeviceInfo,
|
|
10
|
-
ProtoVersion,
|
|
11
|
-
ProtocolV2DeviceInfo,
|
|
12
|
-
Success,
|
|
13
|
-
} from '@onekeyfe/hd-transport';
|
|
14
|
-
|
|
15
|
-
// ── Shared response shapes (Protocol V2 file system) ────────────────────
|
|
16
|
-
|
|
17
|
-
export type FileOpSuccess = { message?: string };
|
|
18
|
-
|
|
19
|
-
export type FileInfo = {
|
|
20
|
-
path: string;
|
|
21
|
-
offset: number;
|
|
22
|
-
total_size: number;
|
|
23
|
-
data?: Uint8Array;
|
|
24
|
-
data_hash?: number;
|
|
25
|
-
processed_byte?: number;
|
|
26
|
-
chunks?: number;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export type DirInfo = {
|
|
30
|
-
path: string;
|
|
31
|
-
child_dirs?: string;
|
|
32
|
-
child_files?: string;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type PathInfoResult = {
|
|
36
|
-
exist: boolean;
|
|
37
|
-
size: number;
|
|
38
|
-
year: number;
|
|
39
|
-
month: number;
|
|
40
|
-
day: number;
|
|
41
|
-
hour: number;
|
|
42
|
-
minute: number;
|
|
43
|
-
second: number;
|
|
44
|
-
readonly?: boolean;
|
|
45
|
-
hidden?: boolean;
|
|
46
|
-
system?: boolean;
|
|
47
|
-
archive?: boolean;
|
|
48
|
-
directory?: boolean;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type DeviceRebootParams = {
|
|
52
|
-
rebootType?: DeviceRebootType | string | number;
|
|
53
|
-
reboot_type?: DeviceRebootType | string | number;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type DeviceGetDeviceInfoParams = {
|
|
57
|
-
targets?: DeviceInfoTargets;
|
|
58
|
-
types?: DeviceInfoTypes;
|
|
59
|
-
targetHw?: boolean;
|
|
60
|
-
targetFw?: boolean;
|
|
61
|
-
targetBt?: boolean;
|
|
62
|
-
targetSe1?: boolean;
|
|
63
|
-
targetSe2?: boolean;
|
|
64
|
-
targetSe3?: boolean;
|
|
65
|
-
targetSe4?: boolean;
|
|
66
|
-
targetStatus?: boolean;
|
|
67
|
-
includeVersion?: boolean;
|
|
68
|
-
includeBuildId?: boolean;
|
|
69
|
-
includeHash?: boolean;
|
|
70
|
-
includeSpecific?: boolean;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export type DeviceFirmwareUpdateParams = {
|
|
74
|
-
targets?: DeviceFirmwareTarget[];
|
|
75
|
-
targetId?: DeviceFirmwareTarget['target_id'] | string | number;
|
|
76
|
-
target_id?: DeviceFirmwareTarget['target_id'] | string | number;
|
|
77
|
-
path?: string;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export type FactoryDeviceInfoSettingsParams = {
|
|
81
|
-
serial_no?: string;
|
|
82
|
-
serialNo?: string;
|
|
83
|
-
cpu_info?: string;
|
|
84
|
-
cpuInfo?: string;
|
|
85
|
-
pre_firmware?: string;
|
|
86
|
-
preFirmware?: string;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// ── Method signatures ─────────────────────────────────────────────────────
|
|
90
|
-
|
|
91
|
-
export declare function fileRead(
|
|
92
|
-
connectId: string,
|
|
93
|
-
params: {
|
|
94
|
-
path: string;
|
|
95
|
-
offset?: number;
|
|
96
|
-
totalSize?: number;
|
|
97
|
-
chunkLen?: number;
|
|
98
|
-
uiPercentage?: number;
|
|
99
|
-
}
|
|
100
|
-
): Response<FileInfo>;
|
|
101
|
-
|
|
102
|
-
export declare function fileWrite(
|
|
103
|
-
connectId: string,
|
|
104
|
-
params: {
|
|
105
|
-
path: string;
|
|
106
|
-
offset?: number;
|
|
107
|
-
totalSize?: number;
|
|
108
|
-
chunkSize?: number;
|
|
109
|
-
chunkLen?: number;
|
|
110
|
-
data: ArrayBuffer | Uint8Array | Blob | string;
|
|
111
|
-
overwrite?: boolean;
|
|
112
|
-
append?: boolean;
|
|
113
|
-
uiPercentage?: number;
|
|
114
|
-
}
|
|
115
|
-
): Response<FileInfo>;
|
|
116
|
-
|
|
117
|
-
export declare function fileDelete(
|
|
118
|
-
connectId: string,
|
|
119
|
-
params: { path: string }
|
|
120
|
-
): Response<FileOpSuccess>;
|
|
121
|
-
|
|
122
|
-
export declare function dirList(
|
|
123
|
-
connectId: string,
|
|
124
|
-
params: { path: string; depth?: number }
|
|
125
|
-
): Response<DirInfo>;
|
|
126
|
-
|
|
127
|
-
export declare function dirMake(
|
|
128
|
-
connectId: string,
|
|
129
|
-
params: { path: string }
|
|
130
|
-
): Response<FileOpSuccess>;
|
|
131
|
-
|
|
132
|
-
export declare function dirRemove(
|
|
133
|
-
connectId: string,
|
|
134
|
-
params: { path: string }
|
|
135
|
-
): Response<FileOpSuccess>;
|
|
136
|
-
|
|
137
|
-
export declare function pathInfo(
|
|
138
|
-
connectId: string,
|
|
139
|
-
params: { path: string }
|
|
140
|
-
): Response<PathInfoResult>;
|
|
141
|
-
|
|
142
|
-
export declare function getProtoVersion(
|
|
143
|
-
connectId: string,
|
|
144
|
-
params?: CommonParams
|
|
145
|
-
): Response<ProtoVersion>;
|
|
146
|
-
|
|
147
|
-
export declare function ping(
|
|
148
|
-
connectId: string,
|
|
149
|
-
params?: CommonParams & { message?: string }
|
|
150
|
-
): Response<Success>;
|
|
151
|
-
|
|
152
|
-
export declare function deviceReboot(
|
|
153
|
-
connectId: string,
|
|
154
|
-
params: CommonParams & DeviceRebootParams
|
|
155
|
-
): Response<Success>;
|
|
156
|
-
|
|
157
|
-
export declare function deviceGetDeviceInfo(
|
|
158
|
-
connectId: string,
|
|
159
|
-
params?: CommonParams & DeviceGetDeviceInfoParams
|
|
160
|
-
): Response<ProtocolV2DeviceInfo>;
|
|
161
|
-
|
|
162
|
-
export declare function deviceGetOnboardingStatus(
|
|
163
|
-
connectId: string,
|
|
164
|
-
params?: CommonParams
|
|
165
|
-
): Response<DeviceOnboardingStatus>;
|
|
166
|
-
|
|
167
|
-
export declare function deviceFirmwareUpdate(
|
|
168
|
-
connectId: string,
|
|
169
|
-
params: CommonParams & DeviceFirmwareUpdateParams
|
|
170
|
-
): Response<Success | DeviceFirmwareUpdateStatus>;
|
|
171
|
-
|
|
172
|
-
export declare function deviceGetFirmwareUpdateStatus(
|
|
173
|
-
connectId: string,
|
|
174
|
-
params?: CommonParams
|
|
175
|
-
): Response<DeviceFirmwareUpdateStatus>;
|
|
176
|
-
|
|
177
|
-
export declare function factoryDeviceInfoSettings(
|
|
178
|
-
connectId: string,
|
|
179
|
-
params: FactoryDeviceInfoSettingsParams
|
|
180
|
-
): Response<Success>;
|
|
181
|
-
|
|
182
|
-
export declare function factoryGetDeviceInfo(connectId: string): Response<FactoryDeviceInfo>;
|
|
183
|
-
|
|
184
|
-
export declare function filesystemFixPermission(connectId: string): Response<Success>;
|
|
185
|
-
|
|
186
|
-
export declare function filesystemFileRead(
|
|
187
|
-
connectId: string,
|
|
188
|
-
params: Parameters<typeof fileRead>[1]
|
|
189
|
-
): ReturnType<typeof fileRead>;
|
|
190
|
-
|
|
191
|
-
export declare function filesystemFileWrite(
|
|
192
|
-
connectId: string,
|
|
193
|
-
params: Parameters<typeof fileWrite>[1]
|
|
194
|
-
): ReturnType<typeof fileWrite>;
|
|
195
|
-
|
|
196
|
-
export declare function filesystemFileDelete(
|
|
197
|
-
connectId: string,
|
|
198
|
-
params: Parameters<typeof fileDelete>[1]
|
|
199
|
-
): ReturnType<typeof fileDelete>;
|
|
200
|
-
|
|
201
|
-
export declare function filesystemDirList(
|
|
202
|
-
connectId: string,
|
|
203
|
-
params: Parameters<typeof dirList>[1]
|
|
204
|
-
): ReturnType<typeof dirList>;
|
|
205
|
-
|
|
206
|
-
export declare function filesystemDirMake(
|
|
207
|
-
connectId: string,
|
|
208
|
-
params: Parameters<typeof dirMake>[1]
|
|
209
|
-
): ReturnType<typeof dirMake>;
|
|
210
|
-
|
|
211
|
-
export declare function filesystemDirRemove(
|
|
212
|
-
connectId: string,
|
|
213
|
-
params: Parameters<typeof dirRemove>[1]
|
|
214
|
-
): ReturnType<typeof dirRemove>;
|
|
215
|
-
|
|
216
|
-
export declare function filesystemPathInfoQuery(
|
|
217
|
-
connectId: string,
|
|
218
|
-
params: Parameters<typeof pathInfo>[1]
|
|
219
|
-
): ReturnType<typeof pathInfo>;
|
|
220
|
-
|
|
221
|
-
export declare function filesystemFormat(connectId: string): Response<Success>;
|
|
222
|
-
|
|
223
|
-
export declare function filesystemDiskControl(
|
|
224
|
-
connectId: string,
|
|
225
|
-
params: CommonParams & { enable: number | string; timeoutMs?: number | string }
|
|
226
|
-
): Response<Success>;
|