@onekeyfe/hd-core 1.1.34-alpha.2 → 1.1.34-alpha.3
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__/AllNetworkGetAddressBase.tracing.test.ts +75 -0
- package/__tests__/DeviceCommands.test.ts +217 -0
- package/__tests__/RequestQueue.test.ts +140 -0
- package/__tests__/UploadPortfolio.test.ts +46 -0
- package/__tests__/connectSettings.test.ts +61 -0
- package/__tests__/device-lifecycle-events.test.ts +117 -0
- package/__tests__/device-pool-state.test.ts +132 -0
- package/__tests__/device-settings.test.ts +286 -0
- package/__tests__/device-state-mapper.test.ts +229 -0
- package/__tests__/device-utils.test.ts +106 -0
- package/__tests__/device-wallet-session-store.test.ts +191 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +15 -4
- package/__tests__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/filesystemValidation.test.ts +53 -0
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +119 -0
- package/__tests__/firmware-update/firmware-checkpoint.test.ts +105 -0
- package/__tests__/firmware-update/firmware-host-binding.test.ts +73 -0
- package/__tests__/firmware-update/firmware-update-capabilities.test.ts +17 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +358 -0
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +200 -0
- package/__tests__/firmware-update/firmware-update-recovery.test.ts +81 -0
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +48 -31
- package/__tests__/firmware-update/firmware-upload-source.test.ts +70 -0
- package/__tests__/get-device-state.test.ts +403 -0
- package/__tests__/logBlockEvent.test.ts +61 -0
- package/__tests__/logger.test.ts +34 -0
- package/__tests__/open-wallet-session.test.ts +565 -0
- package/__tests__/preInitialize.test.ts +33 -0
- package/__tests__/pro2Wallpaper.test.ts +39 -0
- package/__tests__/protocol-v2-bootloader-mode.test.ts +37 -0
- package/__tests__/protocol-v2-firmware-targets.test.ts +19 -0
- package/__tests__/protocol-v2.test.ts +6008 -0
- package/__tests__/protocolV2FileWrite.test.ts +67 -0
- package/__tests__/public-pro2-api-boundary.test.ts +66 -0
- package/__tests__/search-devices.test.ts +136 -0
- package/dist/api/BaseMethod.d.ts +12 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/ClearSessionCache.d.ts +9 -0
- package/dist/api/ClearSessionCache.d.ts.map +1 -0
- 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 +25 -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 +14 -3
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +10 -3
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +75 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
- package/dist/api/GetDeviceState.d.ts +7 -0
- package/dist/api/GetDeviceState.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.map +1 -1
- package/dist/api/OpenWalletSession.d.ts +14 -0
- package/dist/api/OpenWalletSession.d.ts.map +1 -0
- 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 +5 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/UploadPortfolio.d.ts +18 -0
- package/dist/api/UploadPortfolio.d.ts.map +1 -0
- 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/allnetwork/AllNetworkGetAddressBase.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/DeviceCancel.d.ts.map +1 -1
- package/dist/api/device/DeviceChangePin.d.ts.map +1 -1
- package/dist/api/device/DeviceFullyUploadResource.d.ts +1 -2
- package/dist/api/device/DeviceFullyUploadResource.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/DeviceSettings.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/DeviceUnlock.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +7 -1
- package/dist/api/device/DeviceUpdateBootloader.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/device/DeviceWipe.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/FirmwareArtifactSource.d.ts +26 -0
- package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareCheckpoint.d.ts +15 -0
- package/dist/api/firmware/FirmwareCheckpoint.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareHostBinding.d.ts +6 -0
- package/dist/api/firmware/FirmwareHostBinding.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +10 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts +3 -0
- package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts +29 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +25 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/api/firmware/bootloaderHelper.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +11 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/progressThrottle.d.ts +3 -0
- package/dist/api/firmware/progressThrottle.d.ts.map +1 -0
- package/dist/api/firmware/updateBootloader.d.ts +2 -0
- package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
- package/dist/api/firmware/uploadFirmware.d.ts +9 -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 +10 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
- package/dist/api/helpers/protocolV2FileWrite.d.ts +33 -0
- package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -0
- package/dist/api/index.d.ts +29 -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/DeviceFactoryInfoGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.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/DeviceGetFirmwareUpdateStatus.d.ts +7 -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/DeviceInfoGet.d.ts +28 -0
- package/dist/api/protocol-v2/DeviceInfoGet.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/DeviceSessionOpen.d.ts +28 -0
- package/dist/api/protocol-v2/DeviceSessionOpen.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts +16 -0
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsSet.d.ts +12 -0
- package/dist/api/protocol-v2/DeviceSettingsSet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts +26 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.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/FilesystemPermissionFix.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemPermissionFix.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/ProtocolInfoRequest.d.ts +6 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +42 -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 +1 -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 +3 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +3 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/utils.d.ts +2 -1
- package/dist/api/utils.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/RequestQueue.d.ts +19 -1
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/deviceEventRegistration.d.ts +11 -0
- package/dist/core/deviceEventRegistration.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +9 -5
- 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 +60 -16
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +16 -14
- 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/device/DeviceFeaturesState.d.ts +4 -0
- package/dist/device/DeviceFeaturesState.d.ts.map +1 -0
- package/dist/device/DevicePool.d.ts +4 -2
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/device/DeviceStateMapper.d.ts +13 -0
- package/dist/device/DeviceStateMapper.d.ts.map +1 -0
- package/dist/device/DeviceStateProjector.d.ts +7 -0
- package/dist/device/DeviceStateProjector.d.ts.map +1 -0
- package/dist/device/DeviceStateStore.d.ts +21 -0
- package/dist/device/DeviceStateStore.d.ts.map +1 -0
- package/dist/device/DeviceWalletSessionStore.d.ts +15 -0
- package/dist/device/DeviceWalletSessionStore.d.ts.map +1 -0
- package/dist/device/cloneDeviceState.d.ts +2 -0
- package/dist/device/cloneDeviceState.d.ts.map +1 -0
- package/dist/device/deviceIdentity.d.ts +5 -0
- package/dist/device/deviceIdentity.d.ts.map +1 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts +12 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -0
- package/dist/deviceProfile/index.d.ts +2 -0
- package/dist/deviceProfile/index.d.ts.map +1 -0
- package/dist/events/call.d.ts +7 -0
- package/dist/events/call.d.ts.map +1 -1
- package/dist/events/core.d.ts +2 -2
- package/dist/events/core.d.ts.map +1 -1
- package/dist/events/device.d.ts +11 -2
- package/dist/events/device.d.ts.map +1 -1
- package/dist/events/iframe.d.ts +1 -0
- package/dist/events/iframe.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts +1 -0
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +26 -2
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +1797 -451
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26905 -5611
- package/dist/inject.d.ts +3 -2
- package/dist/inject.d.ts.map +1 -1
- package/dist/lowLevelInject.d.ts +2 -1
- package/dist/lowLevelInject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/deviceSession.d.ts +7 -0
- package/dist/protocols/protocol-v2/deviceSession.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/features.d.ts +88 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +15 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +5 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/lockedError.d.ts +2 -0
- package/dist/protocols/protocol-v2/lockedError.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts +16 -0
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/uiInteraction.d.ts +39 -0
- package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts +11 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts +21 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -0
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +4 -2
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceSettings.d.ts +9 -0
- package/dist/types/api/deviceSettings.d.ts.map +1 -1
- package/dist/types/api/deviceUnlock.d.ts +1 -1
- package/dist/types/api/deviceUnlock.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts +6 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +4 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +114 -1
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdateCapabilities.d.ts +13 -0
- package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts +35 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +43 -0
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/types/api/getDeviceState.d.ts +12 -0
- package/dist/types/api/getDeviceState.d.ts.map +1 -0
- package/dist/types/api/getFeatures.d.ts.map +1 -1
- package/dist/types/api/getOnekeyFeatures.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +2 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +48 -2
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/openWalletSession.d.ts +35 -0
- package/dist/types/api/openWalletSession.d.ts.map +1 -0
- package/dist/types/api/protocolV2.d.ts +113 -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/api/sessionCache.d.ts +10 -0
- package/dist/types/api/sessionCache.d.ts.map +1 -0
- package/dist/types/device.d.ts +207 -5
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +3 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +33 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/capabilitieUtils.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesCompat.d.ts +13 -0
- package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -0
- package/dist/utils/deviceFeaturesUtils.d.ts +17 -9
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +10 -8
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceSettings.d.ts +2 -0
- package/dist/utils/deviceSettings.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts +6 -5
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/findDefectiveBatchDevice.d.ts +1 -1
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/dist/utils/pro2Wallpaper.d.ts +12 -0
- package/dist/utils/pro2Wallpaper.d.ts.map +1 -0
- package/dist/utils/tracing.d.ts.map +1 -1
- package/dist/utils/versionUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +60 -23
- package/src/api/CheckAllFirmwareRelease.ts +16 -3
- package/src/api/CheckBootloaderRelease.ts +1 -2
- package/src/api/CheckFirmwareRelease.ts +1 -2
- package/src/api/ClearSessionCache.ts +28 -0
- package/src/api/DirList.ts +33 -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 +183 -0
- package/src/api/FileWrite.ts +71 -0
- package/src/api/FirmwareUpdate.ts +15 -7
- package/src/api/FirmwareUpdateV2.ts +354 -148
- package/src/api/FirmwareUpdateV3.ts +376 -62
- package/src/api/FirmwareUpdateV4.ts +2279 -0
- package/src/api/GetDeviceState.ts +55 -0
- package/src/api/GetFeatures.ts +12 -4
- package/src/api/GetOnekeyFeatures.ts +15 -3
- package/src/api/GetPassphraseState.ts +9 -10
- package/src/api/OpenWalletSession.ts +211 -0
- package/src/api/PathInfo.ts +41 -0
- package/src/api/PromptWebDeviceAccess.ts +10 -1
- package/src/api/SearchDevices.ts +33 -3
- package/src/api/UploadPortfolio.ts +50 -0
- 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 +25 -21
- 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/DeviceCancel.ts +1 -0
- package/src/api/device/DeviceChangePin.ts +24 -0
- package/src/api/device/DeviceFullyUploadResource.ts +6 -7
- package/src/api/device/DeviceLock.ts +2 -3
- package/src/api/device/DeviceRebootToBoardloader.ts +11 -1
- package/src/api/device/DeviceRebootToBootloader.ts +11 -1
- package/src/api/device/DeviceSettings.ts +121 -0
- package/src/api/device/DeviceSupportFeatures.ts +2 -13
- package/src/api/device/DeviceUnlock.ts +9 -0
- package/src/api/device/DeviceUpdateBootloader.ts +175 -11
- package/src/api/device/DeviceUploadResource.ts +4 -5
- package/src/api/device/DeviceVerify.ts +1 -2
- package/src/api/device/DeviceWipe.ts +19 -0
- 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 +30 -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/FirmwareArtifactSource.ts +278 -0
- package/src/api/firmware/FirmwareCheckpoint.ts +188 -0
- package/src/api/firmware/FirmwareHostBinding.ts +108 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +83 -15
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +13 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +729 -0
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +403 -0
- package/src/api/firmware/bootloaderHelper.ts +3 -2
- package/src/api/firmware/getBinary.ts +1 -1
- package/src/api/firmware/progressThrottle.ts +44 -0
- package/src/api/firmware/releaseHelper.ts +3 -3
- package/src/api/firmware/updateBootloader.ts +19 -4
- package/src/api/firmware/uploadFirmware.ts +148 -34
- package/src/api/helpers/batchGetPublickeys.ts +51 -6
- package/src/api/helpers/filesystemValidation.ts +112 -0
- package/src/api/helpers/protocolV2FileWrite.ts +193 -0
- package/src/api/index.ts +32 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +2 -3
- 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/DeviceFactoryInfoGet.ts +20 -0
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +32 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +61 -0
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +55 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceInfoGet.ts +145 -0
- package/src/api/protocol-v2/DeviceReboot.ts +26 -0
- package/src/api/protocol-v2/DeviceSessionOpen.ts +102 -0
- package/src/api/protocol-v2/DeviceSettingsGet.ts +18 -0
- package/src/api/protocol-v2/DeviceSettingsPageShow.ts +70 -0
- package/src/api/protocol-v2/DeviceSettingsSet.ts +44 -0
- package/src/api/protocol-v2/DeviceStatusGet.ts +16 -0
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +131 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +19 -0
- package/src/api/protocol-v2/FilesystemPermissionFix.ts +16 -0
- package/src/api/protocol-v2/Ping.ts +18 -0
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +16 -0
- package/src/api/protocol-v2/helpers.ts +203 -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 +6 -3
- package/src/api/ton/TonSignMessage.ts +6 -5
- package/src/api/ton/TonSignProof.ts +3 -0
- package/src/api/tron/TronSignMessage.ts +4 -1
- package/src/api/tron/TronSignTransaction.ts +3 -0
- package/src/api/utils.ts +7 -3
- package/src/api/xrp/XrpSignTransaction.ts +1 -1
- package/src/constants/index.ts +7 -1
- package/src/core/RequestQueue.ts +124 -4
- package/src/core/deviceEventRegistration.ts +23 -0
- package/src/core/index.ts +253 -125
- package/src/data/messages/messages-protocol-v2.json +13544 -0
- package/src/data-manager/DataManager.ts +61 -49
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +38 -12
- package/src/data-manager/connectSettings.ts +15 -0
- package/src/device/Device.ts +759 -164
- package/src/device/DeviceCommands.ts +245 -36
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DeviceFeaturesState.ts +34 -0
- package/src/device/DevicePool.ts +69 -21
- package/src/device/DeviceStateMapper.ts +348 -0
- package/src/device/DeviceStateProjector.ts +95 -0
- package/src/device/DeviceStateStore.ts +201 -0
- package/src/device/DeviceWalletSessionStore.ts +78 -0
- package/src/device/cloneDeviceState.ts +39 -0
- package/src/device/deviceIdentity.ts +18 -0
- package/src/deviceProfile/buildDeviceFeatures.ts +391 -0
- package/src/deviceProfile/index.ts +4 -0
- package/src/events/call.ts +6 -0
- package/src/events/core.ts +2 -0
- package/src/events/device.ts +17 -1
- package/src/events/iframe.ts +1 -0
- package/src/events/logBlockEvent.ts +30 -0
- package/src/events/ui-request.ts +32 -2
- package/src/index.ts +9 -0
- package/src/inject.ts +75 -3
- package/src/lowLevelInject.ts +8 -1
- package/src/protocols/protocol-v2/deviceSession.ts +24 -0
- package/src/protocols/protocol-v2/features.ts +163 -0
- package/src/protocols/protocol-v2/firmware.ts +21 -0
- package/src/protocols/protocol-v2/index.ts +18 -0
- package/src/protocols/protocol-v2/lockedError.ts +10 -0
- package/src/protocols/protocol-v2/settingsUnlockPolicy.ts +61 -0
- package/src/protocols/protocol-v2/uiInteraction.ts +210 -0
- package/src/protocols/protocol-v2/unlockRetry.ts +76 -0
- package/src/protocols/protocol-v2/walletSession.ts +202 -0
- package/src/topLevelInject.ts +7 -1
- package/src/types/api/checkAllFirmwareRelease.ts +4 -2
- package/src/types/api/deviceSettings.ts +9 -0
- package/src/types/api/deviceUnlock.ts +1 -1
- package/src/types/api/deviceUpdateBootloader.ts +10 -1
- package/src/types/api/export.ts +25 -0
- package/src/types/api/firmwareUpdate.ts +163 -1
- package/src/types/api/firmwareUpdateCapabilities.ts +13 -0
- package/src/types/api/firmwareUpdatePlan.ts +52 -0
- package/src/types/api/firmwareUpdatePreparedPlan.ts +55 -0
- package/src/types/api/getDeviceState.ts +19 -0
- package/src/types/api/getFeatures.ts +3 -0
- package/src/types/api/getOnekeyFeatures.ts +3 -0
- package/src/types/api/getPassphraseState.ts +10 -2
- package/src/types/api/index.ts +89 -2
- package/src/types/api/openWalletSession.ts +54 -0
- package/src/types/api/protocolV2.ts +244 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/api/sessionCache.ts +14 -0
- package/src/types/device.ts +266 -5
- package/src/types/params.ts +11 -0
- package/src/types/settings.ts +54 -29
- package/src/utils/capabilitieUtils.ts +1 -2
- package/src/utils/deviceFeaturesCompat.ts +173 -0
- package/src/utils/deviceFeaturesUtils.ts +122 -84
- package/src/utils/deviceInfoUtils.ts +38 -87
- package/src/utils/deviceSettings.ts +48 -0
- package/src/utils/deviceVersionUtils.ts +25 -62
- package/src/utils/findDefectiveBatchDevice.ts +8 -8
- package/src/utils/homescreen.ts +10 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/pro2Wallpaper.ts +109 -0
- package/src/utils/tracing.ts +3 -1
package/src/types/settings.ts
CHANGED
|
@@ -31,6 +31,8 @@ export type ConnectSettings = {
|
|
|
31
31
|
timestamp: number;
|
|
32
32
|
isFrame?: boolean;
|
|
33
33
|
preRelease?: boolean;
|
|
34
|
+
firmwareManifestMode?: 'sdk-managed' | 'external-only';
|
|
35
|
+
preloadedConfig?: RemoteConfigResponse;
|
|
34
36
|
fetchConfig?: boolean;
|
|
35
37
|
extension?: string;
|
|
36
38
|
configFetcher?: (url: string) => Promise<RemoteConfigResponse | null>;
|
|
@@ -40,6 +42,43 @@ export type IVersionArray = [number, number, number];
|
|
|
40
42
|
|
|
41
43
|
export type ILocale = 'zh-CN' | 'en-US';
|
|
42
44
|
|
|
45
|
+
export type IProtocolV2FirmwareComponentTarget =
|
|
46
|
+
| 'ROMLOADER'
|
|
47
|
+
| 'BOOTLOADER'
|
|
48
|
+
| 'APPLICATION_P1'
|
|
49
|
+
| 'APPLICATION_P2'
|
|
50
|
+
| 'COPROCESSOR'
|
|
51
|
+
| 'SE01'
|
|
52
|
+
| 'SE02'
|
|
53
|
+
| 'SE03'
|
|
54
|
+
| 'SE04';
|
|
55
|
+
|
|
56
|
+
export type IProtocolV2FirmwareComponent = {
|
|
57
|
+
target: IProtocolV2FirmwareComponentTarget;
|
|
58
|
+
url: string;
|
|
59
|
+
fingerprint?: string;
|
|
60
|
+
expectedSize?: number;
|
|
61
|
+
version?: IVersionArray;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** Pro2 RESC bundle okpkg descriptor for incremental FileWrite synchronization. */
|
|
65
|
+
export type IProtocolV2ResourceBundle = {
|
|
66
|
+
/** Bundle name, such as images, animation, translations, or fonts_roobert. */
|
|
67
|
+
name: string;
|
|
68
|
+
/** Download URL. */
|
|
69
|
+
url: string;
|
|
70
|
+
fingerprint?: string;
|
|
71
|
+
expectedSize?: number;
|
|
72
|
+
/** Device target path, such as vol0:/bundles/images/images.okpkg. */
|
|
73
|
+
devicePath: string;
|
|
74
|
+
/** okpkg payload_version used to skip matching content after FileRead. */
|
|
75
|
+
version?: IVersionArray;
|
|
76
|
+
/** okpkg payload_hash used for SHA3-512 comparison after FileRead. */
|
|
77
|
+
payloadHash?: string;
|
|
78
|
+
/** okpkg header_hash used for SHA3-512 comparison after FileRead. */
|
|
79
|
+
headerHash?: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
43
82
|
/** STM32 firmware config */
|
|
44
83
|
export type IFirmwareReleaseInfo = {
|
|
45
84
|
required: boolean;
|
|
@@ -51,17 +90,29 @@ export type IFirmwareReleaseInfo = {
|
|
|
51
90
|
firmwareType?: EFirmwareType;
|
|
52
91
|
/** Firmware UI resource */
|
|
53
92
|
resource?: string;
|
|
93
|
+
resourceFingerprint?: string;
|
|
94
|
+
resourceExpectedSize?: number;
|
|
54
95
|
/** Firmware full UI resource */
|
|
55
96
|
fullResource?: string;
|
|
97
|
+
fullResourceFingerprint?: string;
|
|
98
|
+
fullResourceExpectedSize?: number;
|
|
56
99
|
fullResourceRange?: string[];
|
|
57
100
|
bootloaderResource?: string;
|
|
101
|
+
bootloaderFingerprint?: string;
|
|
102
|
+
bootloaderExpectedSize?: number;
|
|
58
103
|
bootloaderVersion?: IVersionArray;
|
|
59
104
|
displayBootloaderVersion?: IVersionArray;
|
|
60
105
|
bootloaderRelatedFirmwareVersion?: IVersionArray;
|
|
106
|
+
upgradeType?: 'payload-package-set' | string;
|
|
107
|
+
components?: Record<string, IProtocolV2FirmwareComponent>;
|
|
108
|
+
installOrder?: string[];
|
|
109
|
+
/** Pro2 RESC bundles for incremental direct FileWrite synchronization. */
|
|
110
|
+
resourceBundles?: IProtocolV2ResourceBundle[];
|
|
61
111
|
bootloaderChangelog?: {
|
|
62
112
|
[k in ILocale]: string;
|
|
63
113
|
};
|
|
64
114
|
fingerprint: string;
|
|
115
|
+
expectedSize?: number;
|
|
65
116
|
version: IVersionArray;
|
|
66
117
|
changelog: {
|
|
67
118
|
[k in ILocale]: string;
|
|
@@ -77,6 +128,7 @@ export type IBLEFirmwareReleaseInfo = {
|
|
|
77
128
|
webUpdate: string;
|
|
78
129
|
fingerprint: string;
|
|
79
130
|
fingerprintWeb: string;
|
|
131
|
+
expectedSize?: number;
|
|
80
132
|
version: IVersionArray;
|
|
81
133
|
changelog: {
|
|
82
134
|
[k in ILocale]: string;
|
|
@@ -85,41 +137,14 @@ export type IBLEFirmwareReleaseInfo = {
|
|
|
85
137
|
|
|
86
138
|
type IKnownDevice = Exclude<IDeviceType, 'unknown'>;
|
|
87
139
|
|
|
88
|
-
/**
|
|
89
|
-
* Device firmware configuration map
|
|
90
|
-
*
|
|
91
|
-
* IMPORTANT: This type is used for firmware update logic.
|
|
92
|
-
* - DO NOT remove existing firmware fields
|
|
93
|
-
* - Only ADD new optional firmware fields for new versions
|
|
94
|
-
* - 'firmware' field is required for backward compatibility
|
|
95
|
-
* - 'ble' field is required for BLE firmware updates
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* // When adding firmware-v8:
|
|
99
|
-
* // {
|
|
100
|
-
* // firmware: IFirmwareReleaseInfo[];
|
|
101
|
-
* // 'firmware-v2'?: IFirmwareReleaseInfo[];
|
|
102
|
-
* // 'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
103
|
-
* // 'firmware-v8'?: IFirmwareReleaseInfo[]; // New
|
|
104
|
-
* // 'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
105
|
-
* // 'firmware-btc-v8'?: IFirmwareReleaseInfo[]; // New
|
|
106
|
-
* // ble: IBLEFirmwareReleaseInfo[];
|
|
107
|
-
* // }
|
|
108
|
-
*/
|
|
109
140
|
export type DeviceTypeMap = {
|
|
110
141
|
[k in IKnownDevice]: {
|
|
111
|
-
/** Base firmware field (required for backward compatibility) */
|
|
112
142
|
firmware: IFirmwareReleaseInfo[];
|
|
113
|
-
/**
|
|
143
|
+
/** Pro2 Protocol V2 payload package set */
|
|
144
|
+
'firmware-v1'?: IFirmwareReleaseInfo[];
|
|
114
145
|
'firmware-v2'?: IFirmwareReleaseInfo[];
|
|
115
|
-
/** Universal firmware v7 */
|
|
116
146
|
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
117
|
-
/** Bitcoin-only firmware v7 */
|
|
118
147
|
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
119
|
-
// Future firmware versions should be added here as optional fields:
|
|
120
|
-
// 'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
121
|
-
// 'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
122
|
-
/** BLE firmware (required) */
|
|
123
148
|
ble: IBLEFirmwareReleaseInfo[];
|
|
124
149
|
};
|
|
125
150
|
};
|
|
@@ -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)) {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
|
|
2
|
+
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
3
|
+
|
|
4
|
+
import type { PROTO } from '../constants';
|
|
5
|
+
import type { Features, IDeviceType } from '../types';
|
|
6
|
+
|
|
7
|
+
export type DeviceFeaturesInput = Features | PROTO.Features;
|
|
8
|
+
|
|
9
|
+
type CompatibleDeviceFeatures = Partial<Features> &
|
|
10
|
+
Partial<PROTO.Features> & {
|
|
11
|
+
onekey_serial?: string;
|
|
12
|
+
onekey_version?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const asCompatibleFeatures = (features: DeviceFeaturesInput): CompatibleDeviceFeatures =>
|
|
16
|
+
features as CompatibleDeviceFeatures;
|
|
17
|
+
|
|
18
|
+
const firstNonEmptyString = (...values: Array<string | null | undefined>) =>
|
|
19
|
+
values.find(value => typeof value === 'string' && value.length > 0);
|
|
20
|
+
|
|
21
|
+
const firstMeaningfulVersion = (...versions: Array<string | null | undefined>) =>
|
|
22
|
+
versions.find(version => Boolean(version && version !== '0.0.0')) ?? null;
|
|
23
|
+
|
|
24
|
+
const versionFromParts = (major?: number | null, minor?: number | null, patch?: number | null) =>
|
|
25
|
+
[major, minor, patch].map(part => Number(part) || 0).join('.');
|
|
26
|
+
|
|
27
|
+
export const resolveDeviceSerialNo = (features?: DeviceFeaturesInput): string => {
|
|
28
|
+
if (!features) return '';
|
|
29
|
+
const compatible = asCompatibleFeatures(features);
|
|
30
|
+
return (
|
|
31
|
+
firstNonEmptyString(
|
|
32
|
+
compatible.serialNo,
|
|
33
|
+
compatible.onekey_serial_no,
|
|
34
|
+
compatible.onekey_serial,
|
|
35
|
+
compatible.serial_no
|
|
36
|
+
) ?? ''
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const resolveDeviceType = (features?: DeviceFeaturesInput): IDeviceType => {
|
|
41
|
+
if (!features || typeof features !== 'object') {
|
|
42
|
+
return EDeviceType.Unknown;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const compatible = asCompatibleFeatures(features);
|
|
46
|
+
if (compatible.deviceType && compatible.deviceType !== EDeviceType.Unknown) {
|
|
47
|
+
return compatible.deviceType;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
switch (compatible.onekey_device_type?.toString().toUpperCase()) {
|
|
51
|
+
case 'CLASSIC':
|
|
52
|
+
return EDeviceType.Classic;
|
|
53
|
+
case 'CLASSIC1S':
|
|
54
|
+
return EDeviceType.Classic1s;
|
|
55
|
+
case 'MINI':
|
|
56
|
+
return EDeviceType.Mini;
|
|
57
|
+
case 'TOUCH':
|
|
58
|
+
return EDeviceType.Touch;
|
|
59
|
+
case 'PRO':
|
|
60
|
+
return EDeviceType.Pro;
|
|
61
|
+
case 'PRO2':
|
|
62
|
+
return EDeviceType.Pro2;
|
|
63
|
+
case 'PURE':
|
|
64
|
+
return EDeviceType.ClassicPure;
|
|
65
|
+
default:
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (compatible.model?.toString().toLowerCase() === EDeviceType.Pro2) {
|
|
70
|
+
return EDeviceType.Pro2;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const serialNo = resolveDeviceSerialNo(features);
|
|
74
|
+
const prefix = serialNo.slice(0, 2).toLowerCase();
|
|
75
|
+
if (prefix === 'bi' || prefix === 'cl') return EDeviceType.Classic;
|
|
76
|
+
if (prefix === 'cp') return EDeviceType.ClassicPure;
|
|
77
|
+
if (prefix === 'mi') return EDeviceType.Mini;
|
|
78
|
+
if (prefix === 'tc') return EDeviceType.Touch;
|
|
79
|
+
if (prefix === 'pr') return EDeviceType.Pro;
|
|
80
|
+
if (prefix === 'p2') return EDeviceType.Pro2;
|
|
81
|
+
|
|
82
|
+
const bootloaderMode = compatible.bootloaderMode ?? compatible.bootloader_mode;
|
|
83
|
+
if (!serialNo && bootloaderMode === true && compatible.model === '1') {
|
|
84
|
+
return EDeviceType.Classic;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return compatible.deviceType ?? EDeviceType.Unknown;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const resolveDeviceFirmwareType = (features?: DeviceFeaturesInput): EFirmwareType => {
|
|
91
|
+
if (!features) {
|
|
92
|
+
return EFirmwareType.Universal;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const compatible = asCompatibleFeatures(features);
|
|
96
|
+
if (compatible.firmwareType) {
|
|
97
|
+
return compatible.firmwareType;
|
|
98
|
+
}
|
|
99
|
+
if (compatible.fw_vendor === 'OneKey Bitcoin-only') {
|
|
100
|
+
return EFirmwareType.BitcoinOnly;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const capabilities = compatible.capabilities as Array<number | string> | null | undefined;
|
|
104
|
+
const supportsBitcoinLike = capabilities?.some(
|
|
105
|
+
capability =>
|
|
106
|
+
capability === Enum_Capability.Capability_Bitcoin_like ||
|
|
107
|
+
capability === 'Capability_Bitcoin_like'
|
|
108
|
+
);
|
|
109
|
+
return capabilities?.length && !supportsBitcoinLike
|
|
110
|
+
? EFirmwareType.BitcoinOnly
|
|
111
|
+
: EFirmwareType.Universal;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const resolveDeviceBleName = (features?: DeviceFeaturesInput): string | null => {
|
|
115
|
+
if (!features) return null;
|
|
116
|
+
const compatible = asCompatibleFeatures(features);
|
|
117
|
+
return (
|
|
118
|
+
firstNonEmptyString(compatible.bleName, compatible.onekey_ble_name, compatible.ble_name) ?? null
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const resolveDeviceFirmwareVersion = (features?: DeviceFeaturesInput): string | null => {
|
|
123
|
+
if (!features) return null;
|
|
124
|
+
const compatible = asCompatibleFeatures(features);
|
|
125
|
+
return firstMeaningfulVersion(
|
|
126
|
+
compatible.firmwareVersion,
|
|
127
|
+
compatible.onekey_firmware_version,
|
|
128
|
+
compatible.onekey_version,
|
|
129
|
+
versionFromParts(compatible.major_version, compatible.minor_version, compatible.patch_version)
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const resolveDeviceBootloaderVersion = (features?: DeviceFeaturesInput): string | null => {
|
|
134
|
+
if (!features) return null;
|
|
135
|
+
const compatible = asCompatibleFeatures(features);
|
|
136
|
+
const bootloaderMode = compatible.bootloaderMode ?? compatible.bootloader_mode;
|
|
137
|
+
return firstMeaningfulVersion(
|
|
138
|
+
compatible.bootloaderVersion,
|
|
139
|
+
compatible.onekey_boot_version,
|
|
140
|
+
compatible.bootloader_version,
|
|
141
|
+
compatible.onekey_bootloader_version,
|
|
142
|
+
bootloaderMode
|
|
143
|
+
? versionFromParts(
|
|
144
|
+
compatible.major_version,
|
|
145
|
+
compatible.minor_version,
|
|
146
|
+
compatible.patch_version
|
|
147
|
+
)
|
|
148
|
+
: null
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const resolveDeviceBoardVersion = (features?: DeviceFeaturesInput): string | null => {
|
|
153
|
+
if (!features) return null;
|
|
154
|
+
const compatible = asCompatibleFeatures(features);
|
|
155
|
+
return firstMeaningfulVersion(
|
|
156
|
+
compatible.boardVersion,
|
|
157
|
+
compatible.onekey_board_version,
|
|
158
|
+
compatible.boardloader_version,
|
|
159
|
+
compatible.onekey_romloader_version,
|
|
160
|
+
compatible.romloader_version
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const resolveDeviceBleFirmwareVersion = (features?: DeviceFeaturesInput): string | null => {
|
|
165
|
+
if (!features) return null;
|
|
166
|
+
const compatible = asCompatibleFeatures(features);
|
|
167
|
+
return firstMeaningfulVersion(
|
|
168
|
+
compatible.bleVersion,
|
|
169
|
+
compatible.onekey_ble_version,
|
|
170
|
+
compatible.ble_ver,
|
|
171
|
+
compatible.onekey_coprocessor_version
|
|
172
|
+
);
|
|
173
|
+
};
|
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { isNaN } from 'lodash';
|
|
3
3
|
import { EDeviceType, type EFirmwareType, ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
|
-
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
4
|
+
import { Enum_Capability, type GetPassphraseState } from '@onekeyfe/hd-transport';
|
|
5
5
|
|
|
6
6
|
import { toHardened } from '../api/helpers/pathUtils';
|
|
7
7
|
import { DeviceModelToTypes, DeviceTypeToModels } from '../types';
|
|
8
|
-
import DataManager, {
|
|
8
|
+
import DataManager, {
|
|
9
|
+
type IFirmwareField,
|
|
10
|
+
type ProtocolV1MessageSchema,
|
|
11
|
+
} from '../data-manager/DataManager';
|
|
9
12
|
import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';
|
|
10
13
|
import { getDeviceType } from './deviceInfoUtils';
|
|
11
14
|
import { getDeviceFirmwareVersion } from './deviceVersionUtils';
|
|
12
15
|
import { existCapability } from './capabilitieUtils';
|
|
16
|
+
import { getProtocolV2WalletSession } from '../protocols/protocol-v2/walletSession';
|
|
13
17
|
|
|
14
18
|
import type { Device } from '../device/Device';
|
|
15
|
-
import type {
|
|
16
|
-
import type { Features, SupportFeatureType } from '../types';
|
|
19
|
+
import type { Features, IDeviceType, SupportFeatureType } from '../types';
|
|
17
20
|
|
|
18
|
-
export const
|
|
21
|
+
export const getSupportProtocolV1MessageSchema = (
|
|
19
22
|
features: Features | undefined
|
|
20
|
-
): { messages: JSON;
|
|
23
|
+
): { messages: JSON; protocolV1MessageSchema: ProtocolV1MessageSchema } => {
|
|
21
24
|
if (!features)
|
|
22
25
|
return {
|
|
23
|
-
messages: DataManager.messages.
|
|
24
|
-
|
|
26
|
+
messages: DataManager.messages.v1CurrentSchema,
|
|
27
|
+
protocolV1MessageSchema: 'v1CurrentSchema',
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
const currentDeviceVersion = getDeviceFirmwareVersion(features).join('.');
|
|
28
31
|
const deviceType = getDeviceType(features);
|
|
29
32
|
|
|
33
|
+
// In bootloader mode the major/minor/patch fields carry the bootloader version, not the
|
|
34
|
+
// firmware version; normalizing them would mis-route to the legacy schema (e.g. 2.x < 3.3.0).
|
|
35
|
+
// The legacy getDeviceFirmwareVersion returned 0.0.0 here and landed on v1CurrentSchema, so
|
|
36
|
+
// force v1CurrentSchema for every bootloader device, including in-place upgrades on
|
|
37
|
+
// Classic1s/Touch/Pro where firmware is still present.
|
|
38
|
+
if (features.bootloaderMode === true) {
|
|
39
|
+
return {
|
|
40
|
+
messages: DataManager.messages.v1CurrentSchema,
|
|
41
|
+
protocolV1MessageSchema: 'v1CurrentSchema',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
30
45
|
const deviceVersionConfigs =
|
|
31
46
|
PROTOBUF_MESSAGE_CONFIG[deviceType] ||
|
|
32
47
|
(DeviceTypeToModels[deviceType] &&
|
|
@@ -37,26 +52,30 @@ export const getSupportMessageVersion = (
|
|
|
37
52
|
const sortedDeviceVersionConfigs =
|
|
38
53
|
deviceVersionConfigs?.sort((a, b) => semver.compare(b.minVersion, a.minVersion)) ?? [];
|
|
39
54
|
|
|
40
|
-
for (const { minVersion,
|
|
55
|
+
for (const { minVersion, protocolV1MessageSchema } of sortedDeviceVersionConfigs) {
|
|
41
56
|
if (semver.gte(currentDeviceVersion, minVersion)) {
|
|
42
57
|
return {
|
|
43
|
-
messages: DataManager.messages[
|
|
44
|
-
|
|
58
|
+
messages: DataManager.messages[protocolV1MessageSchema],
|
|
59
|
+
protocolV1MessageSchema,
|
|
45
60
|
};
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
return {
|
|
50
|
-
messages: DataManager.messages.
|
|
51
|
-
|
|
65
|
+
messages: DataManager.messages.v1CurrentSchema,
|
|
66
|
+
protocolV1MessageSchema: 'v1CurrentSchema',
|
|
52
67
|
};
|
|
53
68
|
};
|
|
54
69
|
|
|
55
|
-
export const supportInputPinOnSoftware = (features
|
|
70
|
+
export const supportInputPinOnSoftware = (features?: Features): SupportFeatureType => {
|
|
56
71
|
if (!features) return { support: false };
|
|
57
72
|
|
|
58
73
|
const deviceType = getDeviceType(features);
|
|
59
|
-
if (
|
|
74
|
+
if (
|
|
75
|
+
deviceType === EDeviceType.Touch ||
|
|
76
|
+
deviceType === EDeviceType.Pro ||
|
|
77
|
+
deviceType === EDeviceType.Pro2
|
|
78
|
+
) {
|
|
60
79
|
return { support: false };
|
|
61
80
|
}
|
|
62
81
|
|
|
@@ -68,7 +87,11 @@ export const supportNewPassphrase = (features?: Features): SupportFeatureType =>
|
|
|
68
87
|
if (!features) return { support: false };
|
|
69
88
|
|
|
70
89
|
const deviceType = getDeviceType(features);
|
|
71
|
-
if (
|
|
90
|
+
if (
|
|
91
|
+
deviceType === EDeviceType.Touch ||
|
|
92
|
+
deviceType === EDeviceType.Pro ||
|
|
93
|
+
deviceType === EDeviceType.Pro2
|
|
94
|
+
) {
|
|
72
95
|
return { support: true };
|
|
73
96
|
}
|
|
74
97
|
|
|
@@ -82,25 +105,46 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
82
105
|
options?: {
|
|
83
106
|
expectPassphraseState?: string;
|
|
84
107
|
onlyMainPin?: boolean;
|
|
108
|
+
initSession?: boolean;
|
|
85
109
|
}
|
|
86
110
|
) => {
|
|
87
|
-
|
|
111
|
+
if (device.isProtocolV2()) {
|
|
112
|
+
if (!device.features) {
|
|
113
|
+
return {
|
|
114
|
+
passphraseState: undefined,
|
|
115
|
+
newSession: undefined,
|
|
116
|
+
unlockedAttachPin: undefined,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return getProtocolV2WalletSession(device, {
|
|
121
|
+
initSession: options?.initSession,
|
|
122
|
+
expectedPassphraseState: options?.expectPassphraseState,
|
|
123
|
+
onlyMainPin: options?.onlyMainPin,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const { features } = device;
|
|
88
128
|
const locked = features?.unlocked === false;
|
|
129
|
+
const deviceType = device.getCurrentDeviceType();
|
|
89
130
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
);
|
|
131
|
+
if (options?.initSession) {
|
|
132
|
+
device.clearInternalState();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const { passphraseState, newSession, unlockedAttachPin } = await getPassphraseState(device, {
|
|
136
|
+
...options,
|
|
137
|
+
});
|
|
97
138
|
|
|
98
139
|
const isModeT =
|
|
99
|
-
|
|
140
|
+
deviceType === EDeviceType.Touch ||
|
|
141
|
+
deviceType === EDeviceType.Pro ||
|
|
142
|
+
deviceType === EDeviceType.Pro2;
|
|
100
143
|
|
|
101
144
|
// 如果可以获取到 passphraseState,但是设备 features 显示设备未开启 passphrase,需要刷新设备状态
|
|
102
145
|
// if passphraseState can be obtained, but the device features show that the device has not enabled passphrase, the device status needs to be refreshed
|
|
103
|
-
const needRefreshWithPassphrase =
|
|
146
|
+
const needRefreshWithPassphrase =
|
|
147
|
+
passphraseState && device.getCurrentPassphraseProtection() !== true;
|
|
104
148
|
// 如果 Touch/Pro 在之前是锁定状态,刷新设备状态
|
|
105
149
|
// if Touch/Pro was locked before, refresh the device state
|
|
106
150
|
const needRefreshWithLocked = isModeT && locked;
|
|
@@ -111,49 +155,72 @@ export const getPassphraseStateWithRefreshDeviceInfo = async (
|
|
|
111
155
|
}
|
|
112
156
|
|
|
113
157
|
// Attach to pin try to fix internal state
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
158
|
+
const deviceId = device.getCurrentDeviceId();
|
|
159
|
+
device.updateInternalState(
|
|
160
|
+
device.getCurrentPassphraseProtection() ?? false,
|
|
161
|
+
passphraseState,
|
|
162
|
+
deviceId,
|
|
163
|
+
newSession,
|
|
164
|
+
options?.initSession ? null : device.features?.sessionId
|
|
165
|
+
);
|
|
123
166
|
|
|
124
|
-
return {
|
|
167
|
+
return {
|
|
168
|
+
passphraseState,
|
|
169
|
+
newSession,
|
|
170
|
+
unlockedAttachPin: unlockedAttachPin ?? device.features?.unlockedAttachPin,
|
|
171
|
+
};
|
|
125
172
|
};
|
|
126
173
|
|
|
174
|
+
// Applies to Protocol V1 Pro only; Pro2 has an independent version line.
|
|
175
|
+
const supportProSeriesAttachPinPassphrase = (deviceType: IDeviceType, firmwareVersion: string) =>
|
|
176
|
+
deviceType === EDeviceType.Pro && semver.gte(firmwareVersion, '4.15.0');
|
|
177
|
+
|
|
127
178
|
export const getPassphraseState = async (
|
|
128
|
-
|
|
129
|
-
commands: DeviceCommands,
|
|
179
|
+
device: Device,
|
|
130
180
|
options?: {
|
|
131
181
|
expectPassphraseState?: string;
|
|
132
182
|
onlyMainPin?: boolean;
|
|
183
|
+
initSession?: boolean;
|
|
133
184
|
}
|
|
134
185
|
): Promise<{
|
|
135
186
|
passphraseState: string | undefined;
|
|
136
187
|
newSession: string | undefined;
|
|
137
188
|
unlockedAttachPin: boolean | undefined;
|
|
138
189
|
}> => {
|
|
190
|
+
const { features, commands } = device;
|
|
191
|
+
|
|
192
|
+
// Preserve legacy empty-result semantics until the device has established state.
|
|
139
193
|
if (!features)
|
|
140
194
|
return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
|
|
141
195
|
|
|
142
|
-
const firmwareVersion =
|
|
143
|
-
const deviceType =
|
|
196
|
+
const firmwareVersion = device.getCurrentFirmwareVersionString() ?? '0.0.0';
|
|
197
|
+
const deviceType = device.getCurrentDeviceType();
|
|
198
|
+
|
|
199
|
+
if (device.isProtocolV2()) {
|
|
200
|
+
return getProtocolV2WalletSession(device, {
|
|
201
|
+
initSession: options?.initSession,
|
|
202
|
+
expectedPassphraseState: options?.expectPassphraseState,
|
|
203
|
+
onlyMainPin: options?.onlyMainPin,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
144
206
|
|
|
145
207
|
const supportAttachPinCapability = existCapability(
|
|
146
208
|
features,
|
|
147
209
|
Enum_Capability.Capability_AttachToPin
|
|
148
210
|
);
|
|
149
211
|
const supportGetPassphraseState =
|
|
150
|
-
supportAttachPinCapability ||
|
|
151
|
-
(deviceType === EDeviceType.Pro && semver.gte(firmwareVersion.join('.'), '4.15.0'));
|
|
212
|
+
supportAttachPinCapability || supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
|
|
152
213
|
|
|
153
214
|
if (supportGetPassphraseState) {
|
|
154
|
-
const
|
|
215
|
+
const payload: GetPassphraseState = {
|
|
155
216
|
passphrase_state: options?.onlyMainPin ? undefined : options?.expectPassphraseState,
|
|
156
|
-
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const { message, type } = await commands.typedCall(
|
|
220
|
+
'GetPassphraseState',
|
|
221
|
+
'PassphraseState',
|
|
222
|
+
payload
|
|
223
|
+
);
|
|
157
224
|
|
|
158
225
|
// @ts-expect-error
|
|
159
226
|
if (type === 'CallMethodError') {
|
|
@@ -186,40 +253,8 @@ export const getPassphraseState = async (
|
|
|
186
253
|
};
|
|
187
254
|
};
|
|
188
255
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
options?: {
|
|
192
|
-
includeNode?: boolean;
|
|
193
|
-
}
|
|
194
|
-
): boolean => {
|
|
195
|
-
if (!features) return false;
|
|
196
|
-
const currentVersion = getDeviceFirmwareVersion(features).join('.');
|
|
197
|
-
|
|
198
|
-
const deviceType = getDeviceType(features);
|
|
199
|
-
// btc batch get public key
|
|
200
|
-
if (!!options?.includeNode && deviceType === EDeviceType.Pro) {
|
|
201
|
-
return semver.gte(currentVersion, '4.14.0');
|
|
202
|
-
}
|
|
203
|
-
if (!!options?.includeNode && deviceType === EDeviceType.Touch) {
|
|
204
|
-
return semver.gte(currentVersion, '4.11.0');
|
|
205
|
-
}
|
|
206
|
-
if (!!options?.includeNode && DeviceModelToTypes.model_classic1s.includes(deviceType)) {
|
|
207
|
-
return semver.gte(currentVersion, '3.12.0');
|
|
208
|
-
}
|
|
209
|
-
if (!!options?.includeNode && DeviceModelToTypes.model_mini.includes(deviceType)) {
|
|
210
|
-
return semver.gte(currentVersion, '3.10.0');
|
|
211
|
-
}
|
|
212
|
-
if (options?.includeNode) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// support batch get public key
|
|
217
|
-
if (deviceType === EDeviceType.Touch || deviceType === EDeviceType.Pro) {
|
|
218
|
-
return semver.gte(currentVersion, '3.1.0');
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return semver.gte(currentVersion, '2.6.0');
|
|
222
|
-
};
|
|
256
|
+
// supportBatchPublicKey 已迁移为 device-aware 版本:
|
|
257
|
+
// 见 api/helpers/batchGetPublickeys.ts 的 supportBatchPublicKeyByDevice
|
|
223
258
|
|
|
224
259
|
export const supportModifyHomescreen = (features?: Features): SupportFeatureType => {
|
|
225
260
|
if (!features) return { support: false };
|
|
@@ -278,6 +313,9 @@ export const getFirmwareUpdateField = ({
|
|
|
278
313
|
if (deviceType === EDeviceType.Pro) {
|
|
279
314
|
return latestFirmwareField;
|
|
280
315
|
}
|
|
316
|
+
if (deviceType === EDeviceType.Pro2) {
|
|
317
|
+
return 'firmware-v1';
|
|
318
|
+
}
|
|
281
319
|
return 'firmware';
|
|
282
320
|
};
|
|
283
321
|
/**
|
|
@@ -321,6 +359,10 @@ export const getFirmwareUpdateFieldArray = (
|
|
|
321
359
|
return ['firmware-v8'];
|
|
322
360
|
}
|
|
323
361
|
|
|
362
|
+
if (deviceType === 'pro2') {
|
|
363
|
+
return ['firmware-v1'];
|
|
364
|
+
}
|
|
365
|
+
|
|
324
366
|
return ['firmware'];
|
|
325
367
|
};
|
|
326
368
|
|
|
@@ -340,12 +382,8 @@ export const fixFeaturesFirmwareVersion = (features: Features): Features => {
|
|
|
340
382
|
// fix Touch、Pro device when bootloader version is lower than 2.5.2, the features returned do not have firmware_version error
|
|
341
383
|
const tempFeatures = { ...features };
|
|
342
384
|
|
|
343
|
-
if (tempFeatures.
|
|
344
|
-
tempFeatures.
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (tempFeatures.onekey_version && !semver.valid(tempFeatures.onekey_version)) {
|
|
348
|
-
tempFeatures.onekey_version = fixVersion(tempFeatures.onekey_version);
|
|
385
|
+
if (tempFeatures.firmwareVersion && !semver.valid(tempFeatures.firmwareVersion)) {
|
|
386
|
+
tempFeatures.firmwareVersion = fixVersion(tempFeatures.firmwareVersion);
|
|
349
387
|
}
|
|
350
388
|
|
|
351
389
|
return tempFeatures;
|