@onekeyfe/hd-core 1.1.27 → 1.2.0-alpha.0
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 +3025 -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.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/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/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 +34 -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/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 +36 -10
- 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/buildDeviceProfile.d.ts +22 -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/deviceProfile/legacyFeaturesView.d.ts +5 -0
- package/dist/deviceProfile/legacyFeaturesView.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 +720 -382
- package/dist/index.js +17634 -1201
- 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 +10 -3
- 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 +1 -1
- package/dist/types/settings.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/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 +21 -25
- package/src/api/FirmwareUpdateV3.ts +17 -4
- package/src/api/FirmwareUpdateV4.ts +827 -0
- package/src/api/GetDeviceInfo.ts +152 -0
- package/src/api/GetFeatures.ts +5 -2
- package/src/api/GetOnekeyFeatures.ts +95 -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/uploadFirmware.ts +3 -10
- 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 +207 -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/core/index.ts +87 -55
- package/src/data/messages/messages-protocol-v2.json +13369 -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 +538 -61
- package/src/device/DeviceCommands.ts +195 -29
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DevicePool.ts +7 -7
- package/src/deviceProfile/buildDeviceProfile.ts +387 -0
- package/src/deviceProfile/index.ts +2 -0
- package/src/deviceProfile/legacyFeaturesView.ts +123 -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 +180 -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 +201 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +37 -3
- package/src/types/params.ts +7 -0
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +70 -70
- package/src/utils/deviceInfoUtils.ts +15 -8
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { DevSEState, DevSeType } from '@onekeyfe/hd-transport';
|
|
2
|
+
|
|
3
|
+
import type { DeviceGetDeviceInfo, DevSEInfo, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
4
|
+
import type { DeviceCommands } from '../../device/DeviceCommands';
|
|
5
|
+
|
|
6
|
+
// 单源类型:直接使用 hd-transport 生成的 ProtocolV2DeviceInfo / DevSEInfo /
|
|
7
|
+
// DevFirmwareImageInfo(与 firmware-pro2 proto 一致),不再维护手写副本。
|
|
8
|
+
export type { ProtocolV2DeviceInfo };
|
|
9
|
+
export type { DevFirmwareImageInfo as ProtocolV2FirmwareImageInfo } from '@onekeyfe/hd-transport';
|
|
10
|
+
export type { DevSEInfo as ProtocolV2SEInfo } from '@onekeyfe/hd-transport';
|
|
11
|
+
|
|
12
|
+
export type ProtocolV2SeStateLabel = 'BOOT' | 'APP_FACTORY' | 'APP';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 传输层解码会把 proto 枚举输出为名称字符串(见 hd-transport 的 messageToJSON),
|
|
16
|
+
* 但生成类型声明为数值枚举;这里统一兼容两种形态。
|
|
17
|
+
*/
|
|
18
|
+
const normalizeEnumValue = <T extends Record<string | number, string | number>>(
|
|
19
|
+
enumObject: T,
|
|
20
|
+
value: number | string | null | undefined
|
|
21
|
+
): string | null => {
|
|
22
|
+
if (value == null) return null;
|
|
23
|
+
if (typeof value === 'string') return value;
|
|
24
|
+
const label = enumObject[value];
|
|
25
|
+
return typeof label === 'string' ? label : null;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* DevSEInfo.state → 可读标签。SDK 内唯一的 SE 状态映射实现,
|
|
30
|
+
* deviceProfile 与 legacy Features 兼容视图都从这里取。
|
|
31
|
+
*/
|
|
32
|
+
export const getProtocolV2SeState = (se?: DevSEInfo): ProtocolV2SeStateLabel | null => {
|
|
33
|
+
const label = normalizeEnumValue(DevSEState, se?.state);
|
|
34
|
+
switch (label) {
|
|
35
|
+
case 'BOOT':
|
|
36
|
+
return 'BOOT';
|
|
37
|
+
case 'APP_FACTORY':
|
|
38
|
+
return 'APP_FACTORY';
|
|
39
|
+
case 'APP':
|
|
40
|
+
return 'APP';
|
|
41
|
+
default:
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* DevSEInfo.type → 可读标签(如 'THD89')。legacy Features 兼容视图的
|
|
48
|
+
* onekey_se_type 字段从这里取。
|
|
49
|
+
*/
|
|
50
|
+
export const getProtocolV2SeType = (se?: DevSEInfo): string | null =>
|
|
51
|
+
normalizeEnumValue(DevSeType, se?.type);
|
|
52
|
+
|
|
53
|
+
export const PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST = {
|
|
54
|
+
targets: {
|
|
55
|
+
hw: true,
|
|
56
|
+
fw: true,
|
|
57
|
+
bt: true,
|
|
58
|
+
status: true,
|
|
59
|
+
},
|
|
60
|
+
types: {
|
|
61
|
+
version: true,
|
|
62
|
+
specific: true,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 轻量状态刷新请求(每次 run 前使用)。
|
|
68
|
+
*
|
|
69
|
+
* status 提供 init_states / label / passphrase_protection 等会在设备端变化的字段;
|
|
70
|
+
* hw / bt 提供 serialNo / bleName 等身份字段——applyProfileUpdate 对顶层字段是整体
|
|
71
|
+
* 覆盖语义,缺少 hw/bt 会把已有 profile 的身份字段清空。不含 fw/SE targets,
|
|
72
|
+
* 单帧请求开销很小。
|
|
73
|
+
*/
|
|
74
|
+
export const PROTOCOL_V2_STATUS_DEVICE_INFO_REQUEST = {
|
|
75
|
+
targets: {
|
|
76
|
+
hw: true,
|
|
77
|
+
bt: true,
|
|
78
|
+
status: true,
|
|
79
|
+
},
|
|
80
|
+
types: {
|
|
81
|
+
version: true,
|
|
82
|
+
specific: true,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST = {
|
|
87
|
+
targets: {
|
|
88
|
+
hw: true,
|
|
89
|
+
fw: true,
|
|
90
|
+
bt: true,
|
|
91
|
+
se1: true,
|
|
92
|
+
se2: true,
|
|
93
|
+
se3: true,
|
|
94
|
+
se4: true,
|
|
95
|
+
status: true,
|
|
96
|
+
},
|
|
97
|
+
types: {
|
|
98
|
+
version: true,
|
|
99
|
+
specific: true,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST = {
|
|
104
|
+
targets: {
|
|
105
|
+
hw: true,
|
|
106
|
+
fw: true,
|
|
107
|
+
bt: true,
|
|
108
|
+
se1: true,
|
|
109
|
+
se2: true,
|
|
110
|
+
se3: true,
|
|
111
|
+
se4: true,
|
|
112
|
+
status: true,
|
|
113
|
+
},
|
|
114
|
+
types: {
|
|
115
|
+
version: true,
|
|
116
|
+
build_id: true,
|
|
117
|
+
hash: true,
|
|
118
|
+
specific: true,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const PROTOCOL_V2_DEVICE_INFO_REQUEST = PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST;
|
|
123
|
+
export const PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS = 10 * 1000;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 临时开关(默认开启):当前 Pro2 测试固件 / 早期工程板尚未实现 DevGetDeviceInfo,
|
|
127
|
+
* 真实调用只会超时失败。开启时跳过 wire 调用,直接返回 mock DeviceInfo;
|
|
128
|
+
* profile 的身份字段(serialNo/deviceId)由 buildProfileFromProtocolV2 的
|
|
129
|
+
* fallbackSerialNo(transport path)兜底。
|
|
130
|
+
*
|
|
131
|
+
* 固件实现 DevGetDeviceInfo 后:把默认值改回 false(或直接删除开关与 mock)。
|
|
132
|
+
* 注意:开启期间 FirmwareUpdateV4 的“升级完成版本比对”拿到的也是 mock 版本,
|
|
133
|
+
* 不能作为升级成功的依据。
|
|
134
|
+
*/
|
|
135
|
+
let protocolV2DeviceInfoMockEnabled = true;
|
|
136
|
+
|
|
137
|
+
export const setProtocolV2DeviceInfoMock = (enabled: boolean) => {
|
|
138
|
+
protocolV2DeviceInfoMockEnabled = enabled;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const isProtocolV2DeviceInfoMockEnabled = () => protocolV2DeviceInfoMockEnabled;
|
|
142
|
+
|
|
143
|
+
/** 每次调用返回新对象,避免调用方原地修改互相污染。 */
|
|
144
|
+
export const buildMockProtocolV2DeviceInfo = (): ProtocolV2DeviceInfo => ({
|
|
145
|
+
protocol_version: 2,
|
|
146
|
+
hw: {
|
|
147
|
+
// 留空:profile 身份走 fallbackSerialNo(transport path)
|
|
148
|
+
serial_no: '',
|
|
149
|
+
},
|
|
150
|
+
fw: {
|
|
151
|
+
app: { version: '0.1.0' },
|
|
152
|
+
},
|
|
153
|
+
bt: {},
|
|
154
|
+
status: {
|
|
155
|
+
init_states: true,
|
|
156
|
+
language: 'en_US',
|
|
157
|
+
passphrase_protection: false,
|
|
158
|
+
bt_enable: true,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
export async function requestProtocolV2DeviceInfo({
|
|
163
|
+
commands,
|
|
164
|
+
timeoutMs = PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS,
|
|
165
|
+
request = PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST,
|
|
166
|
+
}: {
|
|
167
|
+
commands: DeviceCommands;
|
|
168
|
+
timeoutMs?: number;
|
|
169
|
+
request?: DeviceGetDeviceInfo;
|
|
170
|
+
}): Promise<ProtocolV2DeviceInfo> {
|
|
171
|
+
if (protocolV2DeviceInfoMockEnabled) {
|
|
172
|
+
return buildMockProtocolV2DeviceInfo();
|
|
173
|
+
}
|
|
174
|
+
const { message } = await commands.typedCall('DevGetDeviceInfo', 'DeviceInfo', request, {
|
|
175
|
+
timeoutMs,
|
|
176
|
+
});
|
|
177
|
+
// 'DeviceInfo' 在生成类型里是 V1 DeviceInfo | ProtocolV2DeviceInfo 的合并;
|
|
178
|
+
// DevGetDeviceInfo 是 V2-only 消息,这里收窄到 V2 形态。
|
|
179
|
+
return message as ProtocolV2DeviceInfo;
|
|
180
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 当前 firmware-pro2 子模块的 DevFirmwareTargetType。
|
|
3
|
+
*
|
|
4
|
+
* 注意:仓库里的 hd-transport 生成物暂时仍带旧 target 名称;这里显式按
|
|
5
|
+
* submodules/firmware-pro2/sys/protobuf/onekey_protocol/latest/messages_device.proto
|
|
6
|
+
* 对齐当前子模块,避免运行时取到 undefined。
|
|
7
|
+
*/
|
|
8
|
+
export const ProtocolV2FirmwareTargetType = {
|
|
9
|
+
TARGET_MAIN_APP: 0,
|
|
10
|
+
TARGET_MAIN_BOOT: 1,
|
|
11
|
+
TARGET_BT: 2,
|
|
12
|
+
TARGET_SE1: 3,
|
|
13
|
+
TARGET_SE2: 4,
|
|
14
|
+
TARGET_SE3: 5,
|
|
15
|
+
TARGET_SE4: 6,
|
|
16
|
+
TARGET_RESOURCE: 10,
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export type ProtocolV2FirmwareTargetType =
|
|
20
|
+
(typeof ProtocolV2FirmwareTargetType)[keyof typeof ProtocolV2FirmwareTargetType];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Map Protocol V2 firmware file name to DevFirmwareUpdate target_id.
|
|
24
|
+
*/
|
|
25
|
+
export function protocolV2FileNameToTargetId(fileName: string): ProtocolV2FirmwareTargetType {
|
|
26
|
+
const normalized = fileName.toLowerCase();
|
|
27
|
+
if (normalized.includes('bootloader') || normalized.includes('update_rom')) {
|
|
28
|
+
return ProtocolV2FirmwareTargetType.TARGET_MAIN_BOOT;
|
|
29
|
+
}
|
|
30
|
+
if (
|
|
31
|
+
normalized.includes('coprocessor') ||
|
|
32
|
+
normalized.includes('ble') ||
|
|
33
|
+
normalized.includes('bluetooth') ||
|
|
34
|
+
normalized.includes('bt')
|
|
35
|
+
) {
|
|
36
|
+
return ProtocolV2FirmwareTargetType.TARGET_BT;
|
|
37
|
+
}
|
|
38
|
+
if (normalized.includes('se4')) return ProtocolV2FirmwareTargetType.TARGET_SE4;
|
|
39
|
+
if (normalized.includes('se3')) return ProtocolV2FirmwareTargetType.TARGET_SE3;
|
|
40
|
+
if (normalized.includes('se2')) return ProtocolV2FirmwareTargetType.TARGET_SE2;
|
|
41
|
+
if (normalized.includes('se')) return ProtocolV2FirmwareTargetType.TARGET_SE1;
|
|
42
|
+
return ProtocolV2FirmwareTargetType.TARGET_MAIN_APP;
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
PROTOCOL_V2_DEVICE_INFO_REQUEST,
|
|
3
|
+
PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS,
|
|
4
|
+
PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST,
|
|
5
|
+
PROTOCOL_V2_STATUS_DEVICE_INFO_REQUEST,
|
|
6
|
+
PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST,
|
|
7
|
+
getProtocolV2SeState,
|
|
8
|
+
getProtocolV2SeType,
|
|
9
|
+
} from './features';
|
|
10
|
+
export type {
|
|
11
|
+
ProtocolV2DeviceInfo,
|
|
12
|
+
ProtocolV2FirmwareImageInfo,
|
|
13
|
+
ProtocolV2SEInfo,
|
|
14
|
+
ProtocolV2SeStateLabel,
|
|
15
|
+
} from './features';
|
|
16
|
+
export * from './firmware';
|
package/src/types/api/export.ts
CHANGED
|
@@ -41,6 +41,7 @@ export declare function firmwareUpdateV2(
|
|
|
41
41
|
export interface FirmwareUpdateV3Params {
|
|
42
42
|
bleVersion?: number[];
|
|
43
43
|
bleBinary?: ArrayBuffer;
|
|
44
|
+
chunkSize?: number;
|
|
44
45
|
|
|
45
46
|
firmwareVersion?: number[];
|
|
46
47
|
firmwareBinary?: ArrayBuffer;
|
|
@@ -56,6 +57,45 @@ export interface FirmwareUpdateV3Params {
|
|
|
56
57
|
platform: IPlatform;
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
/**
|
|
61
|
+
* firmwareUpdateV4(Protocol V2)按 DevFirmwareTargetType 拆分的目标二进制。
|
|
62
|
+
* 每个字段对应一个固件升级 target,可单独更新,也可任意组合一次更新。
|
|
63
|
+
*/
|
|
64
|
+
export interface FirmwareUpdateV4Params {
|
|
65
|
+
platform: IPlatform;
|
|
66
|
+
chunkSize?: number;
|
|
67
|
+
firmwareType?: EFirmwareType;
|
|
68
|
+
|
|
69
|
+
/** TARGET_MAIN_BOOT = 1 */
|
|
70
|
+
romloaderBinary?: ArrayBuffer;
|
|
71
|
+
/** TARGET_MAIN_BOOT = 1 */
|
|
72
|
+
bootloaderBinary?: ArrayBuffer;
|
|
73
|
+
/** TARGET_MAIN_APP = 0 */
|
|
74
|
+
applicationP1Binary?: ArrayBuffer;
|
|
75
|
+
/** TARGET_MAIN_APP = 0 */
|
|
76
|
+
applicationP2Binary?: ArrayBuffer;
|
|
77
|
+
/** TARGET_BT = 2 */
|
|
78
|
+
coprocessorBinary?: ArrayBuffer;
|
|
79
|
+
/** TARGET_SE1-4 = 3-6 */
|
|
80
|
+
se01Binary?: ArrayBuffer;
|
|
81
|
+
se02Binary?: ArrayBuffer;
|
|
82
|
+
se03Binary?: ArrayBuffer;
|
|
83
|
+
se04Binary?: ArrayBuffer;
|
|
84
|
+
/** TARGET_RESOURCE = 10(zip 包,解压后逐文件上传) */
|
|
85
|
+
resourceBinary?: ArrayBuffer;
|
|
86
|
+
forcedUpdateRes?: boolean;
|
|
87
|
+
|
|
88
|
+
/** 按 release 配置自动下载 */
|
|
89
|
+
firmwareVersion?: number[];
|
|
90
|
+
bleVersion?: number[];
|
|
91
|
+
bootloaderVersion?: number[];
|
|
92
|
+
|
|
93
|
+
/** legacy 别名:等价 applicationP1Binary */
|
|
94
|
+
firmwareBinary?: ArrayBuffer;
|
|
95
|
+
/** legacy 别名:等价 coprocessorBinary */
|
|
96
|
+
bleBinary?: ArrayBuffer;
|
|
97
|
+
}
|
|
98
|
+
|
|
59
99
|
export declare function firmwareUpdateV3(
|
|
60
100
|
connectId: string | undefined,
|
|
61
101
|
params: Params<FirmwareUpdateV3Params>
|
|
@@ -64,3 +104,12 @@ export declare function firmwareUpdateV3(
|
|
|
64
104
|
firmwareVersion: string;
|
|
65
105
|
bootloaderVersion: string;
|
|
66
106
|
}>;
|
|
107
|
+
|
|
108
|
+
export declare function firmwareUpdateV4(
|
|
109
|
+
connectId: string | undefined,
|
|
110
|
+
params: Params<FirmwareUpdateV4Params>
|
|
111
|
+
): Response<{
|
|
112
|
+
bleVersion: string;
|
|
113
|
+
firmwareVersion: string;
|
|
114
|
+
bootloaderVersion: string;
|
|
115
|
+
}>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { CommonParams, Response } from '../params';
|
|
2
|
+
import type { Features, IDeviceType, OnekeyFeatures } from '../device';
|
|
3
|
+
import type { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
4
|
+
import type { ProtocolType, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
5
|
+
|
|
6
|
+
// 协议类型单源:从 hd-transport 的 ProtocolType 派生,只额外允许 'unknown'。
|
|
7
|
+
export type DeviceInfoProtocol = ProtocolType | 'unknown';
|
|
8
|
+
|
|
9
|
+
export type DeviceInfoSource = 'features' | 'onekeyFeatures' | 'deviceInfo';
|
|
10
|
+
|
|
11
|
+
export type DeviceInfoScope = 'basic' | 'versions' | 'verify' | 'full';
|
|
12
|
+
|
|
13
|
+
export type GetDeviceInfoParams = {
|
|
14
|
+
scope?: DeviceInfoScope;
|
|
15
|
+
refresh?: boolean;
|
|
16
|
+
includeRaw?: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type DeviceInfoMode = 'normal' | 'bootloader' | 'notInitialized' | 'unknown';
|
|
20
|
+
|
|
21
|
+
export type DeviceInfoStatus = {
|
|
22
|
+
mode: DeviceInfoMode;
|
|
23
|
+
initialized: boolean | null;
|
|
24
|
+
bootloaderMode: boolean | null;
|
|
25
|
+
unlocked: boolean | null;
|
|
26
|
+
passphraseProtection: boolean | null;
|
|
27
|
+
backupRequired: boolean | null;
|
|
28
|
+
noBackup: boolean | null;
|
|
29
|
+
language: string | null;
|
|
30
|
+
bleEnabled: boolean | null;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type DeviceProfileVersions = {
|
|
34
|
+
firmware: string | null;
|
|
35
|
+
bootloader: string | null;
|
|
36
|
+
board: string | null;
|
|
37
|
+
ble: string | null;
|
|
38
|
+
se01?: string | null;
|
|
39
|
+
se02?: string | null;
|
|
40
|
+
se03?: string | null;
|
|
41
|
+
se04?: string | null;
|
|
42
|
+
se01Boot?: string | null;
|
|
43
|
+
se02Boot?: string | null;
|
|
44
|
+
se03Boot?: string | null;
|
|
45
|
+
se04Boot?: string | null;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type DeviceProfileVerify = {
|
|
49
|
+
firmwareBuildId?: string;
|
|
50
|
+
firmwareHash?: string;
|
|
51
|
+
bootloaderBuildId?: string;
|
|
52
|
+
bootloaderHash?: string;
|
|
53
|
+
boardBuildId?: string;
|
|
54
|
+
boardHash?: string;
|
|
55
|
+
bleBuildId?: string;
|
|
56
|
+
bleHash?: string;
|
|
57
|
+
se01BuildId?: string;
|
|
58
|
+
se01Hash?: string;
|
|
59
|
+
se02BuildId?: string;
|
|
60
|
+
se02Hash?: string;
|
|
61
|
+
se03BuildId?: string;
|
|
62
|
+
se03Hash?: string;
|
|
63
|
+
se04BuildId?: string;
|
|
64
|
+
se04Hash?: string;
|
|
65
|
+
se01BootBuildId?: string;
|
|
66
|
+
se01BootHash?: string;
|
|
67
|
+
se02BootBuildId?: string;
|
|
68
|
+
se02BootHash?: string;
|
|
69
|
+
se03BootBuildId?: string;
|
|
70
|
+
se03BootHash?: string;
|
|
71
|
+
se04BootBuildId?: string;
|
|
72
|
+
se04BootHash?: string;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type DeviceProfileRaw = {
|
|
76
|
+
features?: Features;
|
|
77
|
+
onekeyFeatures?: OnekeyFeatures;
|
|
78
|
+
protocolV2DeviceInfo?: ProtocolV2DeviceInfo;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export type DeviceProfile = {
|
|
82
|
+
protocol: DeviceInfoProtocol;
|
|
83
|
+
sources: DeviceInfoSource[];
|
|
84
|
+
deviceType: IDeviceType;
|
|
85
|
+
firmwareType: EFirmwareType;
|
|
86
|
+
deviceId: string;
|
|
87
|
+
serialNo: string;
|
|
88
|
+
label: string | null;
|
|
89
|
+
bleName: string | null;
|
|
90
|
+
status: DeviceInfoStatus;
|
|
91
|
+
versions: DeviceProfileVersions;
|
|
92
|
+
verify?: DeviceProfileVerify;
|
|
93
|
+
raw?: DeviceProfileRaw;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export declare function getDeviceInfo(
|
|
97
|
+
connectId?: string,
|
|
98
|
+
params?: CommonParams & GetDeviceInfoParams
|
|
99
|
+
): Response<DeviceProfile>;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { CommonParams, Response } from '../params';
|
|
2
2
|
|
|
3
|
+
export type GetPassphraseStatePayload = {
|
|
4
|
+
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,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
|
*/
|