@onekeyfe/hd-core 1.1.27-alpha.4 → 1.1.27-alpha.41
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__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/protocol-v2.test.ts +1688 -0
- package/dist/api/BaseMethod.d.ts +1 -7
- 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 +23 -0
- package/dist/api/FileWrite.d.ts.map +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +32 -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/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 +9 -0
- package/dist/api/PathInfo.d.ts.map +1 -0
- 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 +2 -5
- 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 +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/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/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 +2 -8
- 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 +10 -2
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/helpers/deviceInfo.d.ts +15 -0
- package/dist/api/helpers/deviceInfo.d.ts.map +1 -0
- 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 +28 -1
- 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 +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 +2 -9
- 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/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/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 +7 -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 +10 -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 +49 -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 +4 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +4 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +8 -0
- 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 +2 -1
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +2 -1
- 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 +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/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- 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 +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/device/Device.d.ts +5 -18
- 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 +2 -1
- package/dist/device/DeviceConnector.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 +292 -43
- package/dist/index.js +16693 -1501
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +104 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +12 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +3 -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 +7 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +84 -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 +33 -3
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +127 -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 +6 -2
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +2 -1
- 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 +5 -3
- 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/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 +7 -82
- package/src/api/DirList.ts +29 -0
- package/src/api/DirMake.ts +21 -0
- package/src/api/DirRemove.ts +21 -0
- package/src/api/FileDelete.ts +21 -0
- package/src/api/FileRead.ts +165 -0
- package/src/api/FileWrite.ts +203 -0
- package/src/api/FirmwareUpdateV3.ts +21 -4
- package/src/api/FirmwareUpdateV4.ts +810 -0
- package/src/api/GetDeviceInfo.ts +161 -0
- package/src/api/GetOnekeyFeatures.ts +75 -3
- package/src/api/GetPassphraseState.ts +16 -7
- package/src/api/PathInfo.ts +25 -0
- package/src/api/SearchDevices.ts +7 -2
- package/src/api/alephium/AlephiumGetAddress.ts +6 -2
- package/src/api/alephium/AlephiumSignMessage.ts +6 -2
- package/src/api/alephium/AlephiumSignTransaction.ts +6 -3
- package/src/api/algo/AlgoSignTransaction.ts +0 -1
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +18 -9
- package/src/api/aptos/AptosSignInMessage.ts +0 -1
- package/src/api/aptos/AptosSignMessage.ts +0 -1
- package/src/api/aptos/AptosSignTransaction.ts +0 -1
- package/src/api/benfen/BenfenGetAddress.ts +6 -2
- package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
- package/src/api/benfen/BenfenSignMessage.ts +6 -2
- package/src/api/benfen/BenfenSignTransaction.ts +6 -2
- package/src/api/btc/BTCSignMessage.ts +0 -1
- package/src/api/btc/BTCSignPsbt.ts +0 -1
- package/src/api/btc/BTCSignTransaction.ts +0 -1
- package/src/api/btc/helpers/versionLimit.ts +7 -1
- package/src/api/cardano/CardanoSignMessage.ts +0 -1
- package/src/api/cardano/CardanoSignTransaction.ts +0 -1
- package/src/api/conflux/ConfluxSignMessage.ts +0 -1
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +0 -1
- package/src/api/conflux/ConfluxSignTransaction.ts +5 -3
- package/src/api/cosmos/CosmosSignTransaction.ts +0 -1
- package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
- package/src/api/device/DeviceRebootToBootloader.ts +10 -1
- package/src/api/dynex/DnxGetAddress.ts +7 -0
- package/src/api/dynex/DnxSignTransaction.ts +7 -1
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -3
- package/src/api/evm/EVMSignMessageEIP712.ts +14 -2
- package/src/api/evm/EVMSignTransaction.ts +1 -3
- package/src/api/evm/EVMSignTypedData.ts +6 -8
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +0 -1
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +27 -4
- package/src/api/helpers/deviceInfo.ts +205 -0
- package/src/api/helpers/filesystemValidation.ts +51 -0
- package/src/api/index.ts +30 -1
- package/src/api/kaspa/KaspaSignTransaction.ts +0 -1
- package/src/api/near/NearSignTransaction.ts +0 -1
- package/src/api/nem/NEMSignTransaction.ts +0 -1
- package/src/api/neo/NeoGetAddress.ts +6 -1
- package/src/api/neo/NeoSignTransaction.ts +6 -2
- package/src/api/nervos/NervosGetAddress.ts +6 -2
- package/src/api/nervos/NervosSignTransaction.ts +6 -3
- package/src/api/nexa/NexaGetAddress.ts +6 -2
- package/src/api/nexa/NexaSignTransaction.ts +6 -4
- package/src/api/nostr/NostrSignEvent.ts +0 -1
- package/src/api/nostr/NostrSignSchnorr.ts +0 -1
- package/src/api/polkadot/PolkadotSignTransaction.ts +0 -1
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +50 -0
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +35 -0
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceReboot.ts +22 -0
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +27 -0
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +18 -0
- package/src/api/protocol-v2/FilesystemDiskControl.ts +34 -0
- package/src/api/protocol-v2/FilesystemFixPermission.ts +14 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +14 -0
- package/src/api/protocol-v2/GetProtoVersion.ts +14 -0
- package/src/api/protocol-v2/Ping.ts +16 -0
- package/src/api/protocol-v2/helpers.ts +161 -0
- package/src/api/scdo/ScdoGetAddress.ts +6 -2
- package/src/api/scdo/ScdoSignMessage.ts +6 -2
- package/src/api/scdo/ScdoSignTransaction.ts +6 -3
- package/src/api/solana/SolGetAddress.ts +4 -0
- package/src/api/solana/SolSignMessage.ts +4 -1
- package/src/api/solana/SolSignOffchainMessage.ts +4 -1
- package/src/api/solana/SolSignTransaction.ts +8 -1
- package/src/api/starcoin/StarcoinSignMessage.ts +0 -1
- package/src/api/starcoin/StarcoinSignTransaction.ts +0 -1
- package/src/api/stellar/StellarGetAddress.ts +10 -1
- package/src/api/stellar/StellarSignTransaction.ts +14 -2
- package/src/api/sui/SuiSignMessage.ts +0 -1
- package/src/api/sui/SuiSignTransaction.ts +12 -10
- package/src/api/ton/TonSignData.ts +0 -1
- package/src/api/ton/TonSignMessage.ts +0 -1
- package/src/api/ton/TonSignProof.ts +0 -1
- package/src/api/tron/TronSignMessage.ts +5 -2
- package/src/api/tron/TronSignTransaction.ts +4 -1
- package/src/api/xrp/XrpSignTransaction.ts +1 -2
- package/src/core/RequestQueue.ts +3 -10
- package/src/core/index.ts +62 -153
- package/src/data/messages/messages-protocol-v2.json +13128 -0
- package/src/data-manager/DataManager.ts +12 -7
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +38 -12
- package/src/device/Device.ts +98 -82
- package/src/device/DeviceCommands.ts +166 -26
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DevicePool.ts +1 -1
- package/src/events/ui-request.ts +8 -0
- package/src/inject.ts +46 -2
- package/src/protocols/protocol-v2/features.ts +287 -0
- package/src/protocols/protocol-v2/firmware.ts +26 -0
- package/src/protocols/protocol-v2/index.ts +2 -0
- package/src/types/api/export.ts +1 -0
- package/src/types/api/firmwareUpdate.ts +12 -0
- package/src/types/api/getDeviceInfo.ts +97 -0
- package/src/types/api/getPassphraseState.ts +13 -2
- package/src/types/api/index.ts +80 -3
- package/src/types/api/protocolV2.ts +226 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +33 -2
- package/src/types/params.ts +4 -2
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +62 -21
- package/src/utils/deviceInfoUtils.ts +15 -8
- package/src/utils/index.ts +1 -0
- package/__tests__/DeviceCommands.test.ts +0 -99
- package/__tests__/evmLedgerLegacySafety.test.ts +0 -261
- package/__tests__/preInitialize.test.ts +0 -22
- package/dist/api/device/PreInitialize.d.ts +0 -6
- package/dist/api/device/PreInitialize.d.ts.map +0 -1
- package/dist/core/PollingStateManager.d.ts +0 -8
- package/dist/core/PollingStateManager.d.ts.map +0 -1
- package/dist/types/api/preInitialize.d.ts +0 -3
- package/dist/types/api/preInitialize.d.ts.map +0 -1
- package/src/api/device/PreInitialize.ts +0 -41
- package/src/core/PollingStateManager.ts +0 -47
- package/src/types/api/preInitialize.ts +0 -3
|
@@ -0,0 +1,287 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
}
|
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,8 @@ export interface FirmwareUpdateV3Params {
|
|
|
56
57
|
platform: IPlatform;
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
export type FirmwareUpdateV4Params = FirmwareUpdateV3Params;
|
|
61
|
+
|
|
59
62
|
export declare function firmwareUpdateV3(
|
|
60
63
|
connectId: string | undefined,
|
|
61
64
|
params: Params<FirmwareUpdateV3Params>
|
|
@@ -64,3 +67,12 @@ export declare function firmwareUpdateV3(
|
|
|
64
67
|
firmwareVersion: string;
|
|
65
68
|
bootloaderVersion: string;
|
|
66
69
|
}>;
|
|
70
|
+
|
|
71
|
+
export declare function firmwareUpdateV4(
|
|
72
|
+
connectId: string | undefined,
|
|
73
|
+
params: Params<FirmwareUpdateV4Params>
|
|
74
|
+
): Response<{
|
|
75
|
+
bleVersion: string;
|
|
76
|
+
firmwareVersion: string;
|
|
77
|
+
bootloaderVersion: string;
|
|
78
|
+
}>;
|
|
@@ -0,0 +1,97 @@
|
|
|
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,6 +1,17 @@
|
|
|
1
1
|
import type { CommonParams, Response } from '../params';
|
|
2
2
|
|
|
3
|
+
export type GetPassphraseStatePayload = {
|
|
4
|
+
passphrase_state?: string;
|
|
5
|
+
session_id?: string;
|
|
6
|
+
unlocked_attach_pin?: boolean;
|
|
7
|
+
passphrase_protection?: 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>;
|
package/src/types/api/index.ts
CHANGED
|
@@ -1,8 +1,35 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
deviceFirmwareUpdate,
|
|
3
|
+
deviceGetDeviceInfo,
|
|
4
|
+
deviceGetFirmwareUpdateStatus,
|
|
5
|
+
deviceGetOnboardingStatus,
|
|
6
|
+
deviceReboot,
|
|
7
|
+
dirList,
|
|
8
|
+
dirMake,
|
|
9
|
+
dirRemove,
|
|
10
|
+
factoryDeviceInfoSettings,
|
|
11
|
+
factoryGetDeviceInfo,
|
|
12
|
+
fileDelete,
|
|
13
|
+
fileRead,
|
|
14
|
+
fileWrite,
|
|
15
|
+
filesystemDirList,
|
|
16
|
+
filesystemDirMake,
|
|
17
|
+
filesystemDirRemove,
|
|
18
|
+
filesystemDiskControl,
|
|
19
|
+
filesystemFileDelete,
|
|
20
|
+
filesystemFileRead,
|
|
21
|
+
filesystemFileWrite,
|
|
22
|
+
filesystemFixPermission,
|
|
23
|
+
filesystemFormat,
|
|
24
|
+
filesystemPathInfoQuery,
|
|
25
|
+
getProtoVersion,
|
|
26
|
+
pathInfo,
|
|
27
|
+
ping,
|
|
28
|
+
} from './protocolV2';
|
|
1
29
|
import type { off, on, removeAllListeners } from './event';
|
|
2
30
|
import type { uiResponse } from './uiResponse';
|
|
3
31
|
import type { init, updateSettings } from './init';
|
|
4
32
|
import type { testInitializeDeviceDuration } from './testInitializeDeviceDuration';
|
|
5
|
-
import type { preInitialize } from './preInitialize';
|
|
6
33
|
import type { getLogs } from './getLogs';
|
|
7
34
|
import type { checkBridgeStatus } from './checkBridgeStatus';
|
|
8
35
|
import type { checkBridgeRelease } from './checkBridgeRelease';
|
|
@@ -11,11 +38,17 @@ import type { checkAllFirmwareRelease } from './checkAllFirmwareRelease';
|
|
|
11
38
|
import type { checkFirmwareTypeAvailable } from './checkFirmwareTypeAvailable';
|
|
12
39
|
import type { searchDevices } from './searchDevices';
|
|
13
40
|
import type { getFeatures } from './getFeatures';
|
|
41
|
+
import type { getDeviceInfo } from './getDeviceInfo';
|
|
14
42
|
import type { getOnekeyFeatures } from './getOnekeyFeatures';
|
|
15
43
|
import type { getPassphraseState } from './getPassphraseState';
|
|
16
44
|
import type { checkFirmwareRelease } from './checkFirmwareRelease';
|
|
17
45
|
import type { checkBLEFirmwareRelease } from './checkBLEFirmwareRelease';
|
|
18
|
-
import type {
|
|
46
|
+
import type {
|
|
47
|
+
firmwareUpdate,
|
|
48
|
+
firmwareUpdateV2,
|
|
49
|
+
firmwareUpdateV3,
|
|
50
|
+
firmwareUpdateV4,
|
|
51
|
+
} from './firmwareUpdate';
|
|
19
52
|
import type { promptWebDeviceAccess } from './promptWebDeviceAccess';
|
|
20
53
|
import type { deviceReset } from './deviceReset';
|
|
21
54
|
import type { deviceRecovery } from './deviceRecovery';
|
|
@@ -131,6 +164,19 @@ import type { neoSignTransaction } from './neoSignTransaction';
|
|
|
131
164
|
import type { ConnectSettings } from '../settings';
|
|
132
165
|
|
|
133
166
|
export * from './export';
|
|
167
|
+
export type {
|
|
168
|
+
DeviceInfoMode,
|
|
169
|
+
DeviceInfoProtocol,
|
|
170
|
+
DeviceInfoScope,
|
|
171
|
+
DeviceInfoSource,
|
|
172
|
+
DeviceInfoStatus,
|
|
173
|
+
GetDeviceInfoParams,
|
|
174
|
+
UnifiedDeviceInfo,
|
|
175
|
+
UnifiedDeviceInfoRaw,
|
|
176
|
+
UnifiedDeviceInfoVerify,
|
|
177
|
+
UnifiedDeviceInfoVersions,
|
|
178
|
+
} from './getDeviceInfo';
|
|
179
|
+
export type { GetPassphraseStateParams, GetPassphraseStatePayload } from './getPassphraseState';
|
|
134
180
|
|
|
135
181
|
export type CoreApi = {
|
|
136
182
|
/**
|
|
@@ -153,7 +199,6 @@ export type CoreApi = {
|
|
|
153
199
|
* Test function
|
|
154
200
|
*/
|
|
155
201
|
testInitializeDeviceDuration: typeof testInitializeDeviceDuration;
|
|
156
|
-
preInitialize: typeof preInitialize;
|
|
157
202
|
|
|
158
203
|
/**
|
|
159
204
|
* Core function
|
|
@@ -170,6 +215,7 @@ export type CoreApi = {
|
|
|
170
215
|
searchDevices: typeof searchDevices;
|
|
171
216
|
promptWebDeviceAccess: typeof promptWebDeviceAccess;
|
|
172
217
|
getFeatures: typeof getFeatures;
|
|
218
|
+
getDeviceInfo: typeof getDeviceInfo;
|
|
173
219
|
getOnekeyFeatures: typeof getOnekeyFeatures;
|
|
174
220
|
getPassphraseState: typeof getPassphraseState;
|
|
175
221
|
deviceBackup: typeof deviceBackup;
|
|
@@ -197,8 +243,39 @@ export type CoreApi = {
|
|
|
197
243
|
firmwareUpdate: typeof firmwareUpdate;
|
|
198
244
|
firmwareUpdateV2: typeof firmwareUpdateV2;
|
|
199
245
|
firmwareUpdateV3: typeof firmwareUpdateV3;
|
|
246
|
+
firmwareUpdateV4: typeof firmwareUpdateV4;
|
|
200
247
|
cipherKeyValue: typeof cipherKeyValue;
|
|
201
248
|
|
|
249
|
+
/**
|
|
250
|
+
* File system & device control API (Protocol V2 only)
|
|
251
|
+
*/
|
|
252
|
+
getProtoVersion: typeof getProtoVersion;
|
|
253
|
+
ping: typeof ping;
|
|
254
|
+
deviceReboot: typeof deviceReboot;
|
|
255
|
+
deviceGetDeviceInfo: typeof deviceGetDeviceInfo;
|
|
256
|
+
deviceGetOnboardingStatus: typeof deviceGetOnboardingStatus;
|
|
257
|
+
deviceFirmwareUpdate: typeof deviceFirmwareUpdate;
|
|
258
|
+
deviceGetFirmwareUpdateStatus: typeof deviceGetFirmwareUpdateStatus;
|
|
259
|
+
factoryDeviceInfoSettings: typeof factoryDeviceInfoSettings;
|
|
260
|
+
factoryGetDeviceInfo: typeof factoryGetDeviceInfo;
|
|
261
|
+
filesystemFixPermission: typeof filesystemFixPermission;
|
|
262
|
+
fileRead: typeof fileRead;
|
|
263
|
+
fileWrite: typeof fileWrite;
|
|
264
|
+
fileDelete: typeof fileDelete;
|
|
265
|
+
dirList: typeof dirList;
|
|
266
|
+
dirMake: typeof dirMake;
|
|
267
|
+
dirRemove: typeof dirRemove;
|
|
268
|
+
pathInfo: typeof pathInfo;
|
|
269
|
+
filesystemFileRead: typeof filesystemFileRead;
|
|
270
|
+
filesystemFileWrite: typeof filesystemFileWrite;
|
|
271
|
+
filesystemFileDelete: typeof filesystemFileDelete;
|
|
272
|
+
filesystemDirList: typeof filesystemDirList;
|
|
273
|
+
filesystemDirMake: typeof filesystemDirMake;
|
|
274
|
+
filesystemDirRemove: typeof filesystemDirRemove;
|
|
275
|
+
filesystemPathInfoQuery: typeof filesystemPathInfoQuery;
|
|
276
|
+
filesystemFormat: typeof filesystemFormat;
|
|
277
|
+
filesystemDiskControl: typeof filesystemDiskControl;
|
|
278
|
+
|
|
202
279
|
/**
|
|
203
280
|
* All network function
|
|
204
281
|
*/
|