@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
package/src/types/api/index.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
deviceFirmwareUpdate,
|
|
3
|
+
deviceGetDeviceInfo,
|
|
4
|
+
deviceGetFirmwareUpdateStatus,
|
|
5
|
+
deviceGetOnboardingStatus,
|
|
6
|
+
deviceReboot,
|
|
7
|
+
devFirmwareUpdate,
|
|
8
|
+
devGetDeviceInfo,
|
|
9
|
+
devGetFirmwareUpdateStatus,
|
|
10
|
+
devReboot,
|
|
11
|
+
dirList,
|
|
12
|
+
dirMake,
|
|
13
|
+
dirRemove,
|
|
14
|
+
factoryDeviceInfoSettings,
|
|
15
|
+
factoryGetDeviceInfo,
|
|
16
|
+
fileDelete,
|
|
17
|
+
fileRead,
|
|
18
|
+
fileWrite,
|
|
19
|
+
filesystemDirList,
|
|
20
|
+
filesystemDirMake,
|
|
21
|
+
filesystemDirRemove,
|
|
22
|
+
filesystemDiskControl,
|
|
23
|
+
filesystemFileDelete,
|
|
24
|
+
filesystemFileRead,
|
|
25
|
+
filesystemFileWrite,
|
|
26
|
+
filesystemFixPermission,
|
|
27
|
+
filesystemFormat,
|
|
28
|
+
filesystemPathInfoQuery,
|
|
29
|
+
getProtoVersion,
|
|
30
|
+
pathInfo,
|
|
31
|
+
ping,
|
|
32
|
+
} from './protocolV2';
|
|
1
33
|
import type { off, on, removeAllListeners } from './event';
|
|
2
34
|
import type { uiResponse } from './uiResponse';
|
|
3
35
|
import type { init, updateSettings } from './init';
|
|
@@ -11,11 +43,17 @@ import type { checkAllFirmwareRelease } from './checkAllFirmwareRelease';
|
|
|
11
43
|
import type { checkFirmwareTypeAvailable } from './checkFirmwareTypeAvailable';
|
|
12
44
|
import type { searchDevices } from './searchDevices';
|
|
13
45
|
import type { getFeatures } from './getFeatures';
|
|
46
|
+
import type { getDeviceInfo } from './getDeviceInfo';
|
|
14
47
|
import type { getOnekeyFeatures } from './getOnekeyFeatures';
|
|
15
48
|
import type { getPassphraseState } from './getPassphraseState';
|
|
16
49
|
import type { checkFirmwareRelease } from './checkFirmwareRelease';
|
|
17
50
|
import type { checkBLEFirmwareRelease } from './checkBLEFirmwareRelease';
|
|
18
|
-
import type {
|
|
51
|
+
import type {
|
|
52
|
+
firmwareUpdate,
|
|
53
|
+
firmwareUpdateV2,
|
|
54
|
+
firmwareUpdateV3,
|
|
55
|
+
firmwareUpdateV4,
|
|
56
|
+
} from './firmwareUpdate';
|
|
19
57
|
import type { promptWebDeviceAccess } from './promptWebDeviceAccess';
|
|
20
58
|
import type { deviceReset } from './deviceReset';
|
|
21
59
|
import type { deviceRecovery } from './deviceRecovery';
|
|
@@ -131,6 +169,19 @@ import type { neoSignTransaction } from './neoSignTransaction';
|
|
|
131
169
|
import type { ConnectSettings } from '../settings';
|
|
132
170
|
|
|
133
171
|
export * from './export';
|
|
172
|
+
export type {
|
|
173
|
+
DeviceInfoMode,
|
|
174
|
+
DeviceInfoProtocol,
|
|
175
|
+
DeviceInfoScope,
|
|
176
|
+
DeviceInfoSource,
|
|
177
|
+
DeviceInfoStatus,
|
|
178
|
+
DeviceProfile,
|
|
179
|
+
GetDeviceInfoParams,
|
|
180
|
+
DeviceProfileRaw,
|
|
181
|
+
DeviceProfileVerify,
|
|
182
|
+
DeviceProfileVersions,
|
|
183
|
+
} from './getDeviceInfo';
|
|
184
|
+
export type { GetPassphraseStateParams, GetPassphraseStatePayload } from './getPassphraseState';
|
|
134
185
|
|
|
135
186
|
export type CoreApi = {
|
|
136
187
|
/**
|
|
@@ -170,6 +221,7 @@ export type CoreApi = {
|
|
|
170
221
|
searchDevices: typeof searchDevices;
|
|
171
222
|
promptWebDeviceAccess: typeof promptWebDeviceAccess;
|
|
172
223
|
getFeatures: typeof getFeatures;
|
|
224
|
+
getDeviceInfo: typeof getDeviceInfo;
|
|
173
225
|
getOnekeyFeatures: typeof getOnekeyFeatures;
|
|
174
226
|
getPassphraseState: typeof getPassphraseState;
|
|
175
227
|
deviceBackup: typeof deviceBackup;
|
|
@@ -197,8 +249,43 @@ export type CoreApi = {
|
|
|
197
249
|
firmwareUpdate: typeof firmwareUpdate;
|
|
198
250
|
firmwareUpdateV2: typeof firmwareUpdateV2;
|
|
199
251
|
firmwareUpdateV3: typeof firmwareUpdateV3;
|
|
252
|
+
firmwareUpdateV4: typeof firmwareUpdateV4;
|
|
200
253
|
cipherKeyValue: typeof cipherKeyValue;
|
|
201
254
|
|
|
255
|
+
/**
|
|
256
|
+
* File system & device control API (Protocol V2 only)
|
|
257
|
+
*/
|
|
258
|
+
getProtoVersion: typeof getProtoVersion;
|
|
259
|
+
ping: typeof ping;
|
|
260
|
+
deviceReboot: typeof deviceReboot;
|
|
261
|
+
deviceGetDeviceInfo: typeof deviceGetDeviceInfo;
|
|
262
|
+
deviceGetOnboardingStatus: typeof deviceGetOnboardingStatus;
|
|
263
|
+
deviceFirmwareUpdate: typeof deviceFirmwareUpdate;
|
|
264
|
+
deviceGetFirmwareUpdateStatus: typeof deviceGetFirmwareUpdateStatus;
|
|
265
|
+
devReboot: typeof devReboot;
|
|
266
|
+
devGetDeviceInfo: typeof devGetDeviceInfo;
|
|
267
|
+
devFirmwareUpdate: typeof devFirmwareUpdate;
|
|
268
|
+
devGetFirmwareUpdateStatus: typeof devGetFirmwareUpdateStatus;
|
|
269
|
+
factoryDeviceInfoSettings: typeof factoryDeviceInfoSettings;
|
|
270
|
+
factoryGetDeviceInfo: typeof factoryGetDeviceInfo;
|
|
271
|
+
filesystemFixPermission: typeof filesystemFixPermission;
|
|
272
|
+
fileRead: typeof fileRead;
|
|
273
|
+
fileWrite: typeof fileWrite;
|
|
274
|
+
fileDelete: typeof fileDelete;
|
|
275
|
+
dirList: typeof dirList;
|
|
276
|
+
dirMake: typeof dirMake;
|
|
277
|
+
dirRemove: typeof dirRemove;
|
|
278
|
+
pathInfo: typeof pathInfo;
|
|
279
|
+
filesystemFileRead: typeof filesystemFileRead;
|
|
280
|
+
filesystemFileWrite: typeof filesystemFileWrite;
|
|
281
|
+
filesystemFileDelete: typeof filesystemFileDelete;
|
|
282
|
+
filesystemDirList: typeof filesystemDirList;
|
|
283
|
+
filesystemDirMake: typeof filesystemDirMake;
|
|
284
|
+
filesystemDirRemove: typeof filesystemDirRemove;
|
|
285
|
+
filesystemPathInfoQuery: typeof filesystemPathInfoQuery;
|
|
286
|
+
filesystemFormat: typeof filesystemFormat;
|
|
287
|
+
filesystemDiskControl: typeof filesystemDiskControl;
|
|
288
|
+
|
|
202
289
|
/**
|
|
203
290
|
* All network function
|
|
204
291
|
*/
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { CommonParams, Response } from '../params';
|
|
2
|
+
import type {
|
|
3
|
+
DevFirmwareUpdateStatus,
|
|
4
|
+
FactoryDeviceInfo,
|
|
5
|
+
OnboardingStatus,
|
|
6
|
+
ProtoVersion,
|
|
7
|
+
ProtocolV2DeviceInfo,
|
|
8
|
+
Success,
|
|
9
|
+
} from '@onekeyfe/hd-transport';
|
|
10
|
+
import type {
|
|
11
|
+
DeviceFirmwareUpdateParams,
|
|
12
|
+
DeviceRebootParams,
|
|
13
|
+
FactoryDeviceInfoSettingsParams,
|
|
14
|
+
} from '../../api/protocol-v2/helpers';
|
|
15
|
+
import type { DeviceGetDeviceInfoParams } from '../../api/protocol-v2/DeviceGetDeviceInfo';
|
|
16
|
+
|
|
17
|
+
// 参数类型单源:以 api/protocol-v2 的实现为准(type-only re-export,无运行时依赖)
|
|
18
|
+
export type {
|
|
19
|
+
DeviceFirmwareTargetInput,
|
|
20
|
+
DeviceFirmwareUpdateParams,
|
|
21
|
+
DeviceRebootParams,
|
|
22
|
+
FactoryDeviceInfoSettingsParams,
|
|
23
|
+
RebootTypeInput,
|
|
24
|
+
} from '../../api/protocol-v2/helpers';
|
|
25
|
+
export type {
|
|
26
|
+
DeviceGetDeviceInfoParams,
|
|
27
|
+
DeviceGetDeviceInfoTargets,
|
|
28
|
+
DeviceGetDeviceInfoTypes,
|
|
29
|
+
} from '../../api/protocol-v2/DeviceGetDeviceInfo';
|
|
30
|
+
|
|
31
|
+
// ── Shared response shapes (Protocol V2 file system) ────────────────────
|
|
32
|
+
|
|
33
|
+
export type FileOpSuccess = { message?: string };
|
|
34
|
+
|
|
35
|
+
export type FileInfo = {
|
|
36
|
+
path: string;
|
|
37
|
+
offset: number;
|
|
38
|
+
total_size: number;
|
|
39
|
+
data?: Uint8Array;
|
|
40
|
+
data_hash?: number;
|
|
41
|
+
processed_byte?: number;
|
|
42
|
+
chunks?: number;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type DirInfo = {
|
|
46
|
+
path: string;
|
|
47
|
+
child_dirs?: string;
|
|
48
|
+
child_files?: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// proto 中 FilesystemPathInfo 的全部字段均为 required,类型与之保持一致
|
|
52
|
+
export type PathInfoResult = {
|
|
53
|
+
exist: boolean;
|
|
54
|
+
size: number;
|
|
55
|
+
year: number;
|
|
56
|
+
month: number;
|
|
57
|
+
day: number;
|
|
58
|
+
hour: number;
|
|
59
|
+
minute: number;
|
|
60
|
+
second: number;
|
|
61
|
+
readonly: boolean;
|
|
62
|
+
hidden: boolean;
|
|
63
|
+
system: boolean;
|
|
64
|
+
archive: boolean;
|
|
65
|
+
directory: boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// ── Method signatures ─────────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
export declare function getProtoVersion(
|
|
71
|
+
connectId: string,
|
|
72
|
+
params?: CommonParams
|
|
73
|
+
): Response<ProtoVersion>;
|
|
74
|
+
|
|
75
|
+
export declare function ping(
|
|
76
|
+
connectId: string,
|
|
77
|
+
params?: CommonParams & { message?: string }
|
|
78
|
+
): Response<Success>;
|
|
79
|
+
|
|
80
|
+
export declare function deviceReboot(
|
|
81
|
+
connectId: string,
|
|
82
|
+
params: CommonParams & DeviceRebootParams
|
|
83
|
+
): Response<Success>;
|
|
84
|
+
|
|
85
|
+
export declare function deviceGetDeviceInfo(
|
|
86
|
+
connectId: string,
|
|
87
|
+
params?: CommonParams & DeviceGetDeviceInfoParams
|
|
88
|
+
): Response<ProtocolV2DeviceInfo>;
|
|
89
|
+
|
|
90
|
+
export declare function deviceGetOnboardingStatus(
|
|
91
|
+
connectId: string,
|
|
92
|
+
params?: CommonParams
|
|
93
|
+
): Response<OnboardingStatus>;
|
|
94
|
+
|
|
95
|
+
export declare function deviceFirmwareUpdate(
|
|
96
|
+
connectId: string,
|
|
97
|
+
params: CommonParams & DeviceFirmwareUpdateParams
|
|
98
|
+
): Response<Success | DevFirmwareUpdateStatus>;
|
|
99
|
+
|
|
100
|
+
export declare function deviceGetFirmwareUpdateStatus(
|
|
101
|
+
connectId: string,
|
|
102
|
+
params?: CommonParams
|
|
103
|
+
): Response<DevFirmwareUpdateStatus>;
|
|
104
|
+
|
|
105
|
+
export declare function devReboot(
|
|
106
|
+
connectId: string,
|
|
107
|
+
params: CommonParams & DeviceRebootParams
|
|
108
|
+
): Response<Success>;
|
|
109
|
+
|
|
110
|
+
export declare function devGetDeviceInfo(
|
|
111
|
+
connectId: string,
|
|
112
|
+
params?: CommonParams & DeviceGetDeviceInfoParams
|
|
113
|
+
): Response<ProtocolV2DeviceInfo>;
|
|
114
|
+
|
|
115
|
+
export declare function devFirmwareUpdate(
|
|
116
|
+
connectId: string,
|
|
117
|
+
params: CommonParams & DeviceFirmwareUpdateParams
|
|
118
|
+
): Response<Success | DevFirmwareUpdateStatus>;
|
|
119
|
+
|
|
120
|
+
export declare function devGetFirmwareUpdateStatus(
|
|
121
|
+
connectId: string,
|
|
122
|
+
params?: CommonParams
|
|
123
|
+
): Response<DevFirmwareUpdateStatus>;
|
|
124
|
+
|
|
125
|
+
export declare function factoryDeviceInfoSettings(
|
|
126
|
+
connectId: string,
|
|
127
|
+
params: FactoryDeviceInfoSettingsParams
|
|
128
|
+
): Response<Success>;
|
|
129
|
+
|
|
130
|
+
export declare function factoryGetDeviceInfo(connectId: string): Response<FactoryDeviceInfo>;
|
|
131
|
+
|
|
132
|
+
export declare function filesystemFixPermission(connectId: string): Response<Success>;
|
|
133
|
+
|
|
134
|
+
export declare function fileRead(
|
|
135
|
+
connectId: string,
|
|
136
|
+
params: {
|
|
137
|
+
path: string;
|
|
138
|
+
offset?: number;
|
|
139
|
+
totalSize?: number;
|
|
140
|
+
chunkLen?: number;
|
|
141
|
+
uiPercentage?: number;
|
|
142
|
+
}
|
|
143
|
+
): Response<FileInfo>;
|
|
144
|
+
|
|
145
|
+
export declare function fileWrite(
|
|
146
|
+
connectId: string,
|
|
147
|
+
params: {
|
|
148
|
+
path: string;
|
|
149
|
+
offset?: number;
|
|
150
|
+
totalSize?: number;
|
|
151
|
+
chunkSize?: number;
|
|
152
|
+
chunkLen?: number;
|
|
153
|
+
data: ArrayBuffer | Uint8Array | Blob | string;
|
|
154
|
+
overwrite?: boolean;
|
|
155
|
+
append?: boolean;
|
|
156
|
+
uiPercentage?: number;
|
|
157
|
+
timeoutMs?: number | string;
|
|
158
|
+
}
|
|
159
|
+
): Response<FileInfo>;
|
|
160
|
+
|
|
161
|
+
export declare function fileDelete(
|
|
162
|
+
connectId: string,
|
|
163
|
+
params: { path: string }
|
|
164
|
+
): Response<FileOpSuccess>;
|
|
165
|
+
|
|
166
|
+
export declare function dirList(
|
|
167
|
+
connectId: string,
|
|
168
|
+
params: { path: string; depth?: number }
|
|
169
|
+
): Response<DirInfo>;
|
|
170
|
+
|
|
171
|
+
export declare function dirMake(
|
|
172
|
+
connectId: string,
|
|
173
|
+
params: { path: string }
|
|
174
|
+
): Response<FileOpSuccess>;
|
|
175
|
+
|
|
176
|
+
export declare function dirRemove(
|
|
177
|
+
connectId: string,
|
|
178
|
+
params: { path: string }
|
|
179
|
+
): Response<FileOpSuccess>;
|
|
180
|
+
|
|
181
|
+
export declare function pathInfo(
|
|
182
|
+
connectId: string,
|
|
183
|
+
params: { path: string; timeoutMs?: number | string }
|
|
184
|
+
): Response<PathInfoResult>;
|
|
185
|
+
|
|
186
|
+
export declare const filesystemFileRead: typeof fileRead;
|
|
187
|
+
export declare const filesystemFileWrite: typeof fileWrite;
|
|
188
|
+
export declare const filesystemFileDelete: typeof fileDelete;
|
|
189
|
+
export declare const filesystemDirList: typeof dirList;
|
|
190
|
+
export declare const filesystemDirMake: typeof dirMake;
|
|
191
|
+
export declare const filesystemDirRemove: typeof dirRemove;
|
|
192
|
+
export declare const filesystemPathInfoQuery: typeof pathInfo;
|
|
193
|
+
|
|
194
|
+
export declare function filesystemFormat(connectId: string): Response<Success>;
|
|
195
|
+
|
|
196
|
+
export declare function filesystemDiskControl(
|
|
197
|
+
connectId: string,
|
|
198
|
+
// enable 收紧为 boolean | 0 | 1(兼容历史的 '0' / '1' 字符串输入,内部归一化为 0/1)
|
|
199
|
+
params: CommonParams & { enable: boolean | 0 | 1; timeoutMs?: number | string }
|
|
200
|
+
): Response<Success>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SearchDevice } from '../device';
|
|
2
|
-
import type { Response } from '../params';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
3
|
|
|
4
|
-
export declare function searchDevices(): Response<SearchDevice[]>;
|
|
4
|
+
export declare function searchDevices(params?: CommonParams): Response<SearchDevice[]>;
|
package/src/types/device.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
1
|
+
import { EDeviceType, type EFirmwareType } from '@onekeyfe/hd-shared';
|
|
2
2
|
|
|
3
3
|
import type { IVersionArray } from './settings';
|
|
4
4
|
import type { PROTO } from '../constants';
|
|
5
|
-
import type { OneKeyDeviceCommType } from '@onekeyfe/hd-transport';
|
|
5
|
+
import type { OneKeyDeviceCommType, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
6
6
|
|
|
7
7
|
export type DeviceStatus = 'available' | 'occupied' | 'used';
|
|
8
8
|
|
|
@@ -33,7 +33,8 @@ export type KnownDevice = {
|
|
|
33
33
|
name: string;
|
|
34
34
|
error?: typeof undefined;
|
|
35
35
|
mode: EOneKeyDeviceMode;
|
|
36
|
-
features
|
|
36
|
+
features?: Features;
|
|
37
|
+
sessionId?: string | null;
|
|
37
38
|
unavailableCapabilities: UnavailableCapabilities;
|
|
38
39
|
bleFirmwareVersion: IVersionArray | null;
|
|
39
40
|
firmwareVersion: IVersionArray | null;
|
|
@@ -85,7 +86,100 @@ export type SearchDevice = {
|
|
|
85
86
|
|
|
86
87
|
export type Device = KnownDevice;
|
|
87
88
|
|
|
88
|
-
export type
|
|
89
|
+
export type DeviceFeaturesProtocol = 'V1' | 'V2' | 'unknown';
|
|
90
|
+
|
|
91
|
+
export type DeviceFeaturesMode =
|
|
92
|
+
| 'normal'
|
|
93
|
+
| 'bootloader'
|
|
94
|
+
| 'notInitialized'
|
|
95
|
+
| 'backupMode'
|
|
96
|
+
| 'unknown';
|
|
97
|
+
|
|
98
|
+
export type DeviceFeaturesVerify = {
|
|
99
|
+
firmwareBuildId?: string;
|
|
100
|
+
firmwareHash?: string;
|
|
101
|
+
bootloaderBuildId?: string;
|
|
102
|
+
bootloaderHash?: string;
|
|
103
|
+
boardBuildId?: string;
|
|
104
|
+
boardHash?: string;
|
|
105
|
+
bleBuildId?: string;
|
|
106
|
+
bleHash?: string;
|
|
107
|
+
se01BuildId?: string;
|
|
108
|
+
se01Hash?: string;
|
|
109
|
+
se02BuildId?: string;
|
|
110
|
+
se02Hash?: string;
|
|
111
|
+
se03BuildId?: string;
|
|
112
|
+
se03Hash?: string;
|
|
113
|
+
se04BuildId?: string;
|
|
114
|
+
se04Hash?: string;
|
|
115
|
+
se01BootBuildId?: string;
|
|
116
|
+
se01BootHash?: string;
|
|
117
|
+
se02BootBuildId?: string;
|
|
118
|
+
se02BootHash?: string;
|
|
119
|
+
se03BootBuildId?: string;
|
|
120
|
+
se03BootHash?: string;
|
|
121
|
+
se04BootBuildId?: string;
|
|
122
|
+
se04BootHash?: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type DeviceFeaturesRaw = {
|
|
126
|
+
protocolV1Features?: PROTO.Features;
|
|
127
|
+
protocolV1OneKeyFeatures?: OnekeyFeatures;
|
|
128
|
+
protocolV2DeviceInfo?: ProtocolV2DeviceInfo;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type Features = {
|
|
132
|
+
protocol: DeviceFeaturesProtocol;
|
|
133
|
+
protocolVersion?: number | null;
|
|
134
|
+
deviceType: IDeviceType;
|
|
135
|
+
firmwareType: EFirmwareType;
|
|
136
|
+
model: string | null;
|
|
137
|
+
vendor: string | null;
|
|
138
|
+
deviceId: string | null;
|
|
139
|
+
serialNo: string;
|
|
140
|
+
label: string | null;
|
|
141
|
+
bleName: string | null;
|
|
142
|
+
capabilities: Array<number | string>;
|
|
143
|
+
mode: DeviceFeaturesMode;
|
|
144
|
+
initialized: boolean | null;
|
|
145
|
+
bootloaderMode: boolean | null;
|
|
146
|
+
unlocked: boolean | null;
|
|
147
|
+
firmwarePresent: boolean | null;
|
|
148
|
+
passphraseProtection: boolean | null;
|
|
149
|
+
pinProtection: boolean | null;
|
|
150
|
+
backupRequired: boolean | null;
|
|
151
|
+
noBackup: boolean | null;
|
|
152
|
+
unfinishedBackup: boolean | null;
|
|
153
|
+
recoveryMode: boolean | null;
|
|
154
|
+
language: string | null;
|
|
155
|
+
bleEnabled: boolean | null;
|
|
156
|
+
sdCardPresent: boolean | null;
|
|
157
|
+
sdProtection: boolean | null;
|
|
158
|
+
wipeCodeProtection: boolean | null;
|
|
159
|
+
passphraseAlwaysOnDevice: boolean | null;
|
|
160
|
+
safetyChecks: string | null;
|
|
161
|
+
autoLockDelayMs: number | null;
|
|
162
|
+
displayRotation: number | null;
|
|
163
|
+
experimentalFeatures: boolean | null;
|
|
164
|
+
firmwareVersion: string | null;
|
|
165
|
+
bootloaderVersion: string | null;
|
|
166
|
+
boardVersion: string | null;
|
|
167
|
+
bleVersion: string | null;
|
|
168
|
+
se01Version?: string | null;
|
|
169
|
+
se02Version?: string | null;
|
|
170
|
+
se03Version?: string | null;
|
|
171
|
+
se04Version?: string | null;
|
|
172
|
+
se01BootVersion?: string | null;
|
|
173
|
+
se02BootVersion?: string | null;
|
|
174
|
+
se03BootVersion?: string | null;
|
|
175
|
+
se04BootVersion?: string | null;
|
|
176
|
+
seVersion?: string | null;
|
|
177
|
+
verify?: DeviceFeaturesVerify;
|
|
178
|
+
sessionId: string | null;
|
|
179
|
+
passphraseState?: string;
|
|
180
|
+
unlockedAttachPin?: boolean;
|
|
181
|
+
raw?: DeviceFeaturesRaw;
|
|
182
|
+
};
|
|
89
183
|
|
|
90
184
|
export type OnekeyFeatures = PROTO.OnekeyFeatures;
|
|
91
185
|
|
|
@@ -96,7 +190,8 @@ export type IDeviceType =
|
|
|
96
190
|
| EDeviceType.ClassicPure
|
|
97
191
|
| EDeviceType.Mini
|
|
98
192
|
| EDeviceType.Touch
|
|
99
|
-
| EDeviceType.Pro
|
|
193
|
+
| EDeviceType.Pro
|
|
194
|
+
| EDeviceType.Pro2;
|
|
100
195
|
|
|
101
196
|
/**
|
|
102
197
|
* model_classic: 'classic' | 'classic1s' | 'classicpure'
|
|
@@ -124,6 +219,7 @@ export const DeviceTypeToModels: { [deviceType in IDeviceType]: IDeviceModel[] }
|
|
|
124
219
|
[EDeviceType.Mini]: ['model_mini'],
|
|
125
220
|
[EDeviceType.Touch]: ['model_touch'],
|
|
126
221
|
[EDeviceType.Pro]: ['model_touch'],
|
|
222
|
+
[EDeviceType.Pro2]: [],
|
|
127
223
|
[EDeviceType.Unknown]: [],
|
|
128
224
|
};
|
|
129
225
|
|
|
@@ -136,6 +232,7 @@ export type ITransportStatus = 'valid' | 'outdated';
|
|
|
136
232
|
export type IVersionRange = {
|
|
137
233
|
min: string;
|
|
138
234
|
max?: string;
|
|
235
|
+
unsupported?: boolean;
|
|
139
236
|
};
|
|
140
237
|
|
|
141
238
|
export type DeviceFirmwareRange = {
|
package/src/types/params.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
1
3
|
export interface CommonParams {
|
|
2
4
|
keepSession?: boolean;
|
|
3
5
|
/**
|
|
@@ -52,6 +54,11 @@ export interface CommonParams {
|
|
|
52
54
|
* Use pre-initialized device state (BLE only)
|
|
53
55
|
*/
|
|
54
56
|
usePreInitialize?: boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Expected transport protocol. If omitted, SDK probes Protocol V1 then Protocol V2.
|
|
60
|
+
*/
|
|
61
|
+
connectProtocol?: HardwareConnectProtocol;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
export type Params<T> = CommonParams & T & { bundle?: undefined };
|
package/src/types/settings.ts
CHANGED
|
@@ -34,6 +34,11 @@ export type ConnectSettings = {
|
|
|
34
34
|
fetchConfig?: boolean;
|
|
35
35
|
extension?: string;
|
|
36
36
|
configFetcher?: (url: string) => Promise<RemoteConfigResponse | null>;
|
|
37
|
+
/**
|
|
38
|
+
* 临时开关:Protocol V2 DevGetDeviceInfo 未稳定前用于 mock 设备信息。
|
|
39
|
+
* 正式 app 可显式设置为 false 以调用真实 DevGetDeviceInfo;固件稳定后删除。
|
|
40
|
+
*/
|
|
41
|
+
protocolV2DeviceInfoMockEnabled?: boolean;
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
export type IVersionArray = [number, number, number];
|
|
@@ -83,7 +88,7 @@ export type IBLEFirmwareReleaseInfo = {
|
|
|
83
88
|
};
|
|
84
89
|
};
|
|
85
90
|
|
|
86
|
-
type IKnownDevice = Exclude<IDeviceType, 'unknown'>;
|
|
91
|
+
type IKnownDevice = Exclude<IDeviceType, 'unknown' | 'pro2'>;
|
|
87
92
|
|
|
88
93
|
/**
|
|
89
94
|
* Device firmware configuration map
|
|
@@ -2,8 +2,7 @@ import type { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
|
2
2
|
import type { Features } from '../types/device';
|
|
3
3
|
|
|
4
4
|
export const existCapability = (features?: Features, capability?: Enum_Capability) =>
|
|
5
|
-
|
|
6
|
-
features?.capabilities?.includes(capability);
|
|
5
|
+
capability !== undefined && features?.capabilities?.includes(capability);
|
|
7
6
|
|
|
8
7
|
export const requireCapability = (features: Features, capability: Enum_Capability) => {
|
|
9
8
|
if (!existCapability(features, capability)) {
|