@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/core/index.ts
CHANGED
|
@@ -17,11 +17,8 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
LoggerNames,
|
|
19
19
|
enableLog,
|
|
20
|
-
getDeviceBLEFirmwareVersion,
|
|
21
|
-
getDeviceFirmwareVersion,
|
|
22
|
-
getFirmwareType,
|
|
23
20
|
getLogger,
|
|
24
|
-
|
|
21
|
+
isMethodVersionRangeUnsupported,
|
|
25
22
|
setLoggerPostMessage,
|
|
26
23
|
wait,
|
|
27
24
|
} from '../utils';
|
|
@@ -29,7 +26,6 @@ import {
|
|
|
29
26
|
findDefectiveBatchDevice,
|
|
30
27
|
getDefectiveDeviceInfo,
|
|
31
28
|
} from '../utils/findDefectiveBatchDevice';
|
|
32
|
-
import { supportNewPassphrase } from '../utils/deviceFeaturesUtils';
|
|
33
29
|
import {
|
|
34
30
|
cleanupSdkInstance,
|
|
35
31
|
completeRequestContext,
|
|
@@ -60,17 +56,14 @@ import TransportManager from '../data-manager/TransportManager';
|
|
|
60
56
|
import DeviceConnector from '../device/DeviceConnector';
|
|
61
57
|
import RequestQueue from './RequestQueue';
|
|
62
58
|
import { getSynchronize } from '../utils/getSynchronize';
|
|
59
|
+
import { setProtocolV2DeviceInfoMock } from '../protocols/protocol-v2/features';
|
|
63
60
|
|
|
64
|
-
import type { ConnectSettings, KnownDevice } from '../types';
|
|
61
|
+
import type { ConnectSettings, Features, KnownDevice } from '../types';
|
|
65
62
|
import type { CoreMessage, IFrameCallMessage, UiPromise, UiPromiseResponse } from '../events';
|
|
66
63
|
import type { DeviceEvents, InitOptions, RunOptions } from '../device/Device';
|
|
67
64
|
import type { SdkTracingContext } from '../utils/tracing';
|
|
68
65
|
import type { Deferred } from '@onekeyfe/hd-shared';
|
|
69
|
-
import type {
|
|
70
|
-
Features,
|
|
71
|
-
LowlevelTransportSharedPlugin,
|
|
72
|
-
OneKeyDeviceInfo,
|
|
73
|
-
} from '@onekeyfe/hd-transport';
|
|
66
|
+
import type { LowlevelTransportSharedPlugin, OneKeyDeviceInfo } from '@onekeyfe/hd-transport';
|
|
74
67
|
import type { BaseMethod } from '../api/BaseMethod';
|
|
75
68
|
|
|
76
69
|
const Log = getLogger(LoggerNames.Core);
|
|
@@ -102,6 +95,7 @@ const parseInitOptions = (method?: BaseMethod): InitOptions => ({
|
|
|
102
95
|
passphraseState: method?.payload.passphraseState,
|
|
103
96
|
deviceId: method?.payload.deviceId,
|
|
104
97
|
deriveCardano: method && hasDeriveCardano(method),
|
|
98
|
+
connectProtocol: method?.payload.connectProtocol,
|
|
105
99
|
});
|
|
106
100
|
|
|
107
101
|
let _core: Core;
|
|
@@ -420,13 +414,24 @@ const onCallDevice = async (
|
|
|
420
414
|
await waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
421
415
|
|
|
422
416
|
const inner = async (): Promise<void> => {
|
|
417
|
+
// Protocol V2 专属方法统一守卫:协议在 acquire/initialize 后已确定,
|
|
418
|
+
// 非 V2 设备直接抛出明确的 NotSupport 错误(见 BaseMethod.requireProtocolV2)。
|
|
419
|
+
if (method.requireProtocolV2 && !device.isProtocolV2()) {
|
|
420
|
+
throw createDeviceNotSupportMethodError(method.name, device.getCurrentFirmwareType());
|
|
421
|
+
}
|
|
422
|
+
|
|
423
423
|
// check firmware version
|
|
424
|
-
const versionRange =
|
|
425
|
-
device.features,
|
|
424
|
+
const versionRange = device.getCurrentMethodVersionRange(
|
|
426
425
|
type => method.getVersionRange()[type]
|
|
427
426
|
);
|
|
428
|
-
|
|
429
|
-
|
|
427
|
+
const currentFirmwareVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
428
|
+
const currentBleVersion = device.getCurrentBLEFirmwareVersionString() ?? '0.0.0';
|
|
429
|
+
const deviceFirmwareType = device.getCurrentFirmwareType();
|
|
430
|
+
let newVersionStatus: ReturnType<typeof DataManager.getFirmwareStatus> | undefined;
|
|
431
|
+
|
|
432
|
+
// 故障批次检测与远端强制升级门禁基于 V1 features/remote config,
|
|
433
|
+
// Pro2(V2) 暂不参与:profile 版的 firmwareStatus 需要 DataManager 支持后再接入。
|
|
434
|
+
if (device.features && !device.isProtocolV2()) {
|
|
430
435
|
await DataManager.checkAndReloadData();
|
|
431
436
|
|
|
432
437
|
// 检测故障固件设备
|
|
@@ -443,12 +448,9 @@ const onCallDevice = async (
|
|
|
443
448
|
}
|
|
444
449
|
}
|
|
445
450
|
|
|
446
|
-
|
|
447
|
-
const newVersionStatus = DataManager.getFirmwareStatus(device.features, deviceFirmwareType);
|
|
451
|
+
newVersionStatus = DataManager.getFirmwareStatus(device.features, deviceFirmwareType);
|
|
448
452
|
const bleVersionStatus = DataManager.getBLEFirmwareStatus(device.features);
|
|
449
453
|
|
|
450
|
-
const currentFirmwareVersion = getDeviceFirmwareVersion(device.features).join('.');
|
|
451
|
-
const currentBleVersion = getDeviceBLEFirmwareVersion(device.features).join('.');
|
|
452
454
|
if (
|
|
453
455
|
(newVersionStatus === 'required' || bleVersionStatus === 'required') &&
|
|
454
456
|
method.skipForceUpdateCheck === false
|
|
@@ -474,42 +476,43 @@ const onCallDevice = async (
|
|
|
474
476
|
currentVersions
|
|
475
477
|
);
|
|
476
478
|
}
|
|
479
|
+
}
|
|
477
480
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
semver.lt(currentFirmwareVersion, versionRange.min)
|
|
482
|
-
) {
|
|
483
|
-
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
|
|
484
|
-
throw createNewFirmwareUnReleaseHardwareError({
|
|
485
|
-
currentVersion: currentFirmwareVersion,
|
|
486
|
-
requireVersion: versionRange.min,
|
|
487
|
-
methodName: method.name,
|
|
488
|
-
firmwareType: getFirmwareType(device.features),
|
|
489
|
-
});
|
|
490
|
-
}
|
|
481
|
+
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
482
|
+
throw createDeviceNotSupportMethodError(method.name, deviceFirmwareType);
|
|
483
|
+
}
|
|
491
484
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (
|
|
502
|
-
versionRange.max &&
|
|
503
|
-
semver.valid(versionRange.max) &&
|
|
504
|
-
semver.gte(currentFirmwareVersion, versionRange.max)
|
|
505
|
-
) {
|
|
506
|
-
return Promise.reject(
|
|
507
|
-
createDeprecatedHardwareError(currentFirmwareVersion, versionRange.max, method.name)
|
|
508
|
-
);
|
|
485
|
+
if (versionRange) {
|
|
486
|
+
if (semver.valid(versionRange.min) && semver.lt(currentFirmwareVersion, versionRange.min)) {
|
|
487
|
+
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
|
|
488
|
+
throw createNewFirmwareUnReleaseHardwareError({
|
|
489
|
+
currentVersion: currentFirmwareVersion,
|
|
490
|
+
requireVersion: versionRange.min,
|
|
491
|
+
methodName: method.name,
|
|
492
|
+
firmwareType: deviceFirmwareType,
|
|
493
|
+
});
|
|
509
494
|
}
|
|
510
|
-
|
|
511
|
-
|
|
495
|
+
|
|
496
|
+
return Promise.reject(
|
|
497
|
+
createNeedUpgradeFirmwareHardwareError({
|
|
498
|
+
currentVersion: currentFirmwareVersion,
|
|
499
|
+
requireVersion: versionRange.min,
|
|
500
|
+
methodName: method.name,
|
|
501
|
+
firmwareType: deviceFirmwareType,
|
|
502
|
+
})
|
|
503
|
+
);
|
|
512
504
|
}
|
|
505
|
+
if (
|
|
506
|
+
versionRange.max &&
|
|
507
|
+
semver.valid(versionRange.max) &&
|
|
508
|
+
semver.gte(currentFirmwareVersion, versionRange.max)
|
|
509
|
+
) {
|
|
510
|
+
return Promise.reject(
|
|
511
|
+
createDeprecatedHardwareError(currentFirmwareVersion, versionRange.max, method.name)
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
} else if (method.strictCheckDeviceSupport) {
|
|
515
|
+
throw createDeviceNotSupportMethodError(method.name, deviceFirmwareType);
|
|
513
516
|
}
|
|
514
517
|
|
|
515
518
|
// check call method mode
|
|
@@ -547,16 +550,16 @@ const onCallDevice = async (
|
|
|
547
550
|
method.checkDeviceSupportFeature();
|
|
548
551
|
|
|
549
552
|
// reconfigure messages
|
|
550
|
-
if (_deviceList) {
|
|
553
|
+
if (_deviceList && device.features && !device.isProtocolV2()) {
|
|
551
554
|
await TransportManager.reconfigure(device.features);
|
|
552
555
|
}
|
|
553
556
|
|
|
554
557
|
// Check to see if it is safe to use Passphrase
|
|
555
558
|
checkPassphraseEnableState(method, device.features);
|
|
556
559
|
|
|
557
|
-
if (
|
|
560
|
+
if (shouldCheckPassphraseState(method, device)) {
|
|
558
561
|
// check version
|
|
559
|
-
const support = supportNewPassphrase(
|
|
562
|
+
const support = device.supportNewPassphrase();
|
|
560
563
|
if (!support.support) {
|
|
561
564
|
return Promise.reject(
|
|
562
565
|
ERRORS.TypedError(
|
|
@@ -723,7 +726,7 @@ function initDevice(method: BaseMethod) {
|
|
|
723
726
|
let device: Device | typeof undefined;
|
|
724
727
|
const allDevices = _deviceList.allDevices();
|
|
725
728
|
|
|
726
|
-
if (method.payload?.detectBootloaderDevice && allDevices.some(d => d.
|
|
729
|
+
if (method.payload?.detectBootloaderDevice && allDevices.some(d => d.isBootloader())) {
|
|
727
730
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceDetectInBootloaderMode);
|
|
728
731
|
}
|
|
729
732
|
|
|
@@ -734,6 +737,7 @@ function initDevice(method: BaseMethod) {
|
|
|
734
737
|
} else if (allDevices.length > 1) {
|
|
735
738
|
throw ERRORS.TypedError(
|
|
736
739
|
[
|
|
740
|
+
'firmwareUpdateV4',
|
|
737
741
|
'firmwareUpdateV3',
|
|
738
742
|
'firmwareUpdateV2',
|
|
739
743
|
'checkFirmwareRelease',
|
|
@@ -796,8 +800,8 @@ function canSkipInitialize(method: BaseMethod, device: Device): boolean {
|
|
|
796
800
|
if (!method.connectId) reasons.push('connectId.missing');
|
|
797
801
|
// passphrase state must match the pre-initialize
|
|
798
802
|
if (!device.isPreInitializeMetaMatch(method.payload)) reasons.push('meta.mismatch');
|
|
799
|
-
// device must have been initialized before
|
|
800
|
-
if (
|
|
803
|
+
// device must have been initialized before.
|
|
804
|
+
if (device.isUnacquired()) reasons.push('deviceInfo.missing');
|
|
801
805
|
// within pre-initialize TTL
|
|
802
806
|
if (!device.isPreInitializedValid(PRE_INITIALIZE_TTL_MS)) reasons.push('ttl.expired');
|
|
803
807
|
|
|
@@ -813,13 +817,23 @@ function canSkipInitialize(method: BaseMethod, device: Device): boolean {
|
|
|
813
817
|
return true;
|
|
814
818
|
}
|
|
815
819
|
|
|
820
|
+
function isRetryableBleProtocolV2ProbeError(method: BaseMethod, error: unknown) {
|
|
821
|
+
const message = error instanceof Error ? error.message : String(error ?? '');
|
|
822
|
+
return (
|
|
823
|
+
method.payload.connectProtocol === 'V2' &&
|
|
824
|
+
message.includes('Device protocol mismatch') &&
|
|
825
|
+
message.includes('expected V2') &&
|
|
826
|
+
message.includes('did not respond to expected protocol')
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
|
|
816
830
|
/**
|
|
817
831
|
* If the Bluetooth connection times out, retry up to 6 times
|
|
818
832
|
* @param retryCount - Current retry count (default 0)
|
|
819
833
|
*/
|
|
820
834
|
async function connectDeviceForBle(method: BaseMethod, device: Device, retryCount = 0) {
|
|
821
835
|
try {
|
|
822
|
-
await device.acquire();
|
|
836
|
+
await device.acquire(method.payload.connectProtocol);
|
|
823
837
|
if (method.payload?.onlyConnectBleDevice) {
|
|
824
838
|
return;
|
|
825
839
|
}
|
|
@@ -832,7 +846,12 @@ async function connectDeviceForBle(method: BaseMethod, device: Device, retryCoun
|
|
|
832
846
|
});
|
|
833
847
|
}
|
|
834
848
|
} catch (err) {
|
|
835
|
-
if (
|
|
849
|
+
if (
|
|
850
|
+
(err.errorCode === HardwareErrorCode.BleTimeoutError ||
|
|
851
|
+
err.errorCode === HardwareErrorCode.BleConnectedError ||
|
|
852
|
+
isRetryableBleProtocolV2ProbeError(method, err)) &&
|
|
853
|
+
retryCount < 6
|
|
854
|
+
) {
|
|
836
855
|
const nextRetry = retryCount + 1;
|
|
837
856
|
Log.debug(`Bluetooth connect timeout and will retry, retry count: ${nextRetry}`);
|
|
838
857
|
await wait(3000);
|
|
@@ -1091,7 +1110,11 @@ export const cancel = (context: CoreContext, connectId?: string) => {
|
|
|
1091
1110
|
const checkPassphraseEnableState = (method: BaseMethod, features?: Features) => {
|
|
1092
1111
|
if (!method.useDevicePassphraseState) return;
|
|
1093
1112
|
|
|
1094
|
-
|
|
1113
|
+
const passphraseProtection = method.device
|
|
1114
|
+
? method.device.getCurrentPassphraseProtection()
|
|
1115
|
+
: features?.passphraseProtection;
|
|
1116
|
+
|
|
1117
|
+
if (passphraseProtection === true) {
|
|
1095
1118
|
const hasNoPassphraseState =
|
|
1096
1119
|
method.payload.passphraseState == null || method.payload.passphraseState === '';
|
|
1097
1120
|
const shouldRequirePassphrase =
|
|
@@ -1103,12 +1126,18 @@ const checkPassphraseEnableState = (method: BaseMethod, features?: Features) =>
|
|
|
1103
1126
|
}
|
|
1104
1127
|
}
|
|
1105
1128
|
|
|
1106
|
-
if (
|
|
1129
|
+
if (passphraseProtection === false && method.payload.passphraseState) {
|
|
1107
1130
|
DevicePool.clearDeviceCache(method.payload.connectId);
|
|
1108
1131
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceNotOpenedPassphrase);
|
|
1109
1132
|
}
|
|
1110
1133
|
};
|
|
1111
1134
|
|
|
1135
|
+
const shouldCheckPassphraseState = (method: BaseMethod, device: Device) => {
|
|
1136
|
+
if (!method.useDevicePassphraseState) return false;
|
|
1137
|
+
|
|
1138
|
+
return device.hasUsePassphrase();
|
|
1139
|
+
};
|
|
1140
|
+
|
|
1112
1141
|
const cleanup = () => {
|
|
1113
1142
|
_uiPromises = [];
|
|
1114
1143
|
Log.debug('Cleanup...');
|
|
@@ -1410,6 +1439,7 @@ export const init = async (
|
|
|
1410
1439
|
try {
|
|
1411
1440
|
try {
|
|
1412
1441
|
await DataManager.load(settings);
|
|
1442
|
+
setProtocolV2DeviceInfoMock(settings.protocolV2DeviceInfoMockEnabled ?? false);
|
|
1413
1443
|
initTransport(Transport, plugin);
|
|
1414
1444
|
} catch {
|
|
1415
1445
|
Log.error('DataManager.load error');
|