@onekeyfe/hd-core 1.2.0-alpha.3 → 1.2.0-alpha.30
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 +77 -0
- package/__tests__/DeviceCommands.test.ts +433 -0
- package/__tests__/DeviceEventRegistration.test.ts +43 -0
- package/__tests__/chain-params-onekey-compatibility.test.ts +229 -0
- package/__tests__/connectSettings.test.ts +61 -0
- package/__tests__/core-dispose.test.ts +34 -0
- package/__tests__/core-error-output.test.ts +39 -0
- package/__tests__/device-features-state.test.ts +78 -0
- package/__tests__/device-identity.test.ts +52 -0
- package/__tests__/device-lifecycle-events.test.ts +197 -0
- package/__tests__/device-pool-state.test.ts +132 -0
- package/__tests__/device-settings.test.ts +391 -0
- package/__tests__/device-state-contract.test.ts +27 -0
- package/__tests__/device-state-events.test.ts +286 -0
- package/__tests__/device-state-mapper.test.ts +241 -0
- package/__tests__/device-state-projector.test.ts +94 -0
- package/__tests__/device-state-store.test.ts +82 -0
- package/__tests__/device-utils.test.ts +106 -0
- package/__tests__/device-wallet-session-store.test.ts +358 -0
- package/__tests__/deviceFeaturesUtils.test.ts +39 -0
- package/__tests__/deviceSettings.test.ts +103 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +12 -6
- package/__tests__/evmSignTypedData.test.ts +80 -0
- package/__tests__/filesystemValidation.test.ts +53 -0
- package/__tests__/firmware-update/check-all-firmware-release.test.ts +174 -0
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +119 -0
- package/__tests__/firmware-update/firmware-host-binding.test.ts +70 -0
- package/__tests__/firmware-update/firmware-preparation-error.test.ts +27 -0
- package/__tests__/firmware-update/firmware-update-capabilities.test.ts +13 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +593 -0
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +213 -0
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +430 -0
- package/__tests__/firmware-update/firmware-upload-source.test.ts +70 -0
- package/__tests__/get-device-state.test.ts +410 -0
- package/__tests__/homescreen.test.ts +24 -0
- package/__tests__/kaspa-public-types.type-test.ts +16 -0
- package/__tests__/kaspa-use-tweak-pro2.test.ts +20 -0
- package/__tests__/kaspaSignTransaction.test.ts +592 -0
- package/__tests__/logBlockEvent.test.ts +43 -0
- package/__tests__/method-protocol-support.test.ts +113 -0
- package/__tests__/networkUtils.test.ts +386 -0
- package/__tests__/open-wallet-session-error-response.test.ts +43 -0
- package/__tests__/open-wallet-session.test.ts +915 -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-ping.test.ts +28 -0
- package/__tests__/protocol-v2-unlock-policy.test.ts +45 -0
- package/__tests__/protocol-v2.test.ts +5310 -1856
- package/__tests__/protocolV2FileWrite.test.ts +92 -0
- package/__tests__/protocolV2UiInteraction.test.ts +266 -0
- package/__tests__/public-device-state-api.test.ts +266 -0
- package/__tests__/public-pro2-api-boundary.test.ts +106 -0
- package/__tests__/refresh-device-state.test.ts +101 -0
- package/__tests__/request-context-logging.test.ts +16 -0
- package/__tests__/search-devices.test.ts +136 -0
- package/__tests__/tron-sign-message-init.test.ts +74 -0
- package/dist/api/BaseMethod.d.ts +14 -1
- 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/CipherKeyValue.d.ts +1 -0
- package/dist/api/CipherKeyValue.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 +1 -0
- package/dist/api/DirList.d.ts.map +1 -1
- package/dist/api/DirMake.d.ts +1 -0
- package/dist/api/DirMake.d.ts.map +1 -1
- package/dist/api/DirRemove.d.ts +1 -0
- package/dist/api/DirRemove.d.ts.map +1 -1
- package/dist/api/FileDelete.d.ts +1 -0
- package/dist/api/FileDelete.d.ts.map +1 -1
- package/dist/api/FileRead.d.ts +1 -0
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts +2 -0
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +13 -2
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts +7 -3
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +47 -6
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetDeviceState.d.ts +8 -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 +2 -6
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/OpenWalletSession.d.ts +8 -0
- package/dist/api/OpenWalletSession.d.ts.map +1 -0
- package/dist/api/PathInfo.d.ts +1 -0
- package/dist/api/PathInfo.d.ts.map +1 -1
- package/dist/api/PromptWebDeviceAccess.d.ts.map +1 -1
- package/dist/api/SearchDevices.d.ts +3 -0
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/UploadPortfolio.d.ts +17 -0
- package/dist/api/UploadPortfolio.d.ts.map +1 -0
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/algo/AlgoGetAddress.d.ts +1 -0
- package/dist/api/algo/AlgoGetAddress.d.ts.map +1 -1
- package/dist/api/algo/AlgoSignTransaction.d.ts +1 -0
- package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts +1 -0
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetAddress.d.ts +1 -0
- package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetPublicKey.d.ts +1 -0
- package/dist/api/aptos/AptosGetPublicKey.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignInMessage.d.ts +1 -0
- package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignMessage.d.ts +1 -0
- package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignTransaction.d.ts +1 -0
- package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +1 -0
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +1 -0
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +1 -0
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignPsbt.d.ts +1 -0
- package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +1 -0
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +1 -0
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +2 -0
- package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
- package/dist/api/cardano/CardanoGetAddress.d.ts +1 -0
- package/dist/api/cardano/CardanoGetAddress.d.ts.map +1 -1
- package/dist/api/cardano/CardanoGetPublicKey.d.ts +1 -0
- package/dist/api/cardano/CardanoGetPublicKey.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignMessage.d.ts +1 -0
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts +1 -0
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxGetAddress.d.ts +2 -0
- package/dist/api/conflux/ConfluxGetAddress.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessage.d.ts +2 -0
- package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts +2 -0
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts +2 -0
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosGetAddress.d.ts +1 -0
- package/dist/api/cosmos/CosmosGetAddress.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosGetPublicKey.d.ts +1 -0
- package/dist/api/cosmos/CosmosGetPublicKey.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosSignTransaction.d.ts +1 -0
- package/dist/api/cosmos/CosmosSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceCancel.d.ts +1 -0
- package/dist/api/device/DeviceCancel.d.ts.map +1 -1
- package/dist/api/device/DeviceChangePin.d.ts +1 -0
- 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 +1 -0
- package/dist/api/device/DeviceLock.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -0
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts +1 -0
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSettings.d.ts +1 -0
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/device/DeviceSupportFeatures.d.ts +1 -0
- package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +1 -0
- package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts +5 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceWipe.d.ts +1 -0
- package/dist/api/device/DeviceWipe.d.ts.map +1 -1
- package/dist/api/device/PreInitialize.d.ts +1 -0
- package/dist/api/device/PreInitialize.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/EVMGetAddress.d.ts +1 -0
- package/dist/api/evm/EVMGetAddress.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts +1 -0
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.d.ts +1 -0
- package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTransaction.d.ts +1 -0
- package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts +1 -0
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/EVMVerifyMessage.d.ts +1 -0
- package/dist/api/evm/EVMVerifyMessage.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinGetAddress.d.ts +1 -0
- package/dist/api/filecoin/FilecoinGetAddress.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts +1 -0
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareArtifactSource.d.ts +25 -0
- package/dist/api/firmware/FirmwareArtifactSource.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/FirmwarePreparationError.d.ts +3 -0
- package/dist/api/firmware/FirmwarePreparationError.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +8 -0
- 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 +25 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +30 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/api/firmware/getBinary.d.ts +18 -3
- 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/filesystemValidation.d.ts +3 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -1
- package/dist/api/helpers/paramsValidator.d.ts +1 -0
- package/dist/api/helpers/paramsValidator.d.ts.map +1 -1
- 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 +6 -29
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaGetAddress.d.ts +4 -0
- package/dist/api/kaspa/KaspaGetAddress.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts +9 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/kaspa/helpers/TransferSerialize.d.ts.map +1 -1
- package/dist/api/lightning/LnurlAuth.d.ts +0 -4
- package/dist/api/lightning/LnurlAuth.d.ts.map +1 -1
- package/dist/api/near/NearGetAddress.d.ts +1 -0
- package/dist/api/near/NearGetAddress.d.ts.map +1 -1
- package/dist/api/near/NearSignTransaction.d.ts +1 -0
- package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
- package/dist/api/nem/NEMGetAddress.d.ts +1 -0
- package/dist/api/nem/NEMGetAddress.d.ts.map +1 -1
- package/dist/api/nem/NEMSignTransaction.d.ts +1 -0
- package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts +1 -0
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/nostr/NostrDecryptMessage.d.ts +1 -0
- package/dist/api/nostr/NostrDecryptMessage.d.ts.map +1 -1
- package/dist/api/nostr/NostrEncryptMessage.d.ts +1 -0
- package/dist/api/nostr/NostrEncryptMessage.d.ts.map +1 -1
- package/dist/api/nostr/NostrGetPublicKey.d.ts +1 -0
- package/dist/api/nostr/NostrGetPublicKey.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignEvent.d.ts +1 -0
- package/dist/api/nostr/NostrSignEvent.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignSchnorr.d.ts +1 -0
- package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotGetAddress.d.ts +1 -0
- package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts +1 -0
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +8 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +2 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +4 -2
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +2 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts +29 -0
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts +27 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -1
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts +7 -0
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +1 -0
- package/dist/api/protocol-v2/Ping.d.ts +3 -0
- package/dist/api/protocol-v2/Ping.d.ts.map +1 -1
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts +7 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +27 -18
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- 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 +1 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +1 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +1 -0
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinGetAddress.d.ts +1 -0
- package/dist/api/starcoin/StarcoinGetAddress.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinGetPublicKey.d.ts +1 -0
- package/dist/api/starcoin/StarcoinGetPublicKey.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignMessage.d.ts +1 -0
- package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts +1 -0
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinVerifyMessage.d.ts +1 -0
- package/dist/api/starcoin/StarcoinVerifyMessage.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +1 -2
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +2 -3
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +1 -0
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +1 -0
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +1 -0
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +1 -0
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +1 -0
- package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +2 -5
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +1 -0
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +1 -0
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronGetAddress.d.ts +1 -0
- package/dist/api/tron/TronGetAddress.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +5 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +1 -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/api/xrp/XrpGetAddress.d.ts +1 -0
- package/dist/api/xrp/XrpGetAddress.d.ts.map +1 -1
- package/dist/api/xrp/XrpSignTransaction.d.ts +1 -0
- package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.d.ts.map +1 -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 +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +2 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/device/Device.d.ts +40 -13
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +8 -6
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceFeaturesState.d.ts +3 -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 +20 -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 +9 -3
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
- package/dist/deviceProfile/index.d.ts +0 -1
- package/dist/deviceProfile/index.d.ts.map +1 -1
- package/dist/events/device.d.ts +12 -2
- package/dist/events/device.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +19 -2
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +1487 -691
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8828 -4013
- package/dist/inject.d.ts.map +1 -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 +23 -28
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +11 -9
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/index.d.ts +3 -2
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -1
- 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/unlockPolicy.d.ts +4 -0
- package/dist/protocols/protocol-v2/unlockPolicy.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts +10 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts +31 -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 +5 -2
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/deviceSettings.d.ts +11 -2
- 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 -0
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +5 -2
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +75 -6
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdateCapabilities.d.ts +9 -0
- package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts +28 -0
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +42 -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 -10
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +25 -35
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/kaspaSignTransaction.d.ts +42 -4
- package/dist/types/api/kaspaSignTransaction.d.ts.map +1 -1
- package/dist/types/api/openWalletSession.d.ts +29 -0
- package/dist/types/api/openWalletSession.d.ts.map +1 -0
- package/dist/types/api/protocolV2.d.ts +15 -89
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/api/sessionCache.d.ts +13 -0
- package/dist/types/api/sessionCache.d.ts.map +1 -0
- package/dist/types/device.d.ts +122 -6
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +34 -2
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/assets.d.ts +2 -1
- package/dist/utils/assets.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 +11 -3
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +9 -9
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceSettings.d.ts +38 -7
- package/dist/utils/deviceSettings.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts +7 -5
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/networkUtils.d.ts +9 -1
- package/dist/utils/networkUtils.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/package.json +4 -4
- package/src/api/BaseMethod.ts +52 -17
- package/src/api/CheckAllFirmwareRelease.ts +51 -4
- package/src/api/CheckBootloaderRelease.ts +1 -2
- package/src/api/CheckFirmwareRelease.ts +1 -2
- package/src/api/CipherKeyValue.ts +4 -0
- package/src/api/ClearSessionCache.ts +32 -0
- package/src/api/DirList.ts +9 -4
- package/src/api/DirMake.ts +7 -4
- package/src/api/DirRemove.ts +7 -4
- package/src/api/FileDelete.ts +7 -4
- package/src/api/FileRead.ts +27 -8
- package/src/api/FileWrite.ts +26 -168
- package/src/api/FirmwareUpdate.ts +11 -12
- package/src/api/FirmwareUpdateV2.ts +370 -112
- package/src/api/FirmwareUpdateV3.ts +261 -67
- package/src/api/FirmwareUpdateV4.ts +1687 -397
- package/src/api/GetDeviceState.ts +59 -0
- package/src/api/GetFeatures.ts +6 -4
- package/src/api/GetOnekeyFeatures.ts +1 -75
- package/src/api/GetPassphraseState.ts +21 -21
- package/src/api/OpenWalletSession.ts +202 -0
- package/src/api/PathInfo.ts +9 -4
- package/src/api/PromptWebDeviceAccess.ts +2 -3
- package/src/api/SearchDevices.ts +29 -4
- package/src/api/UploadPortfolio.ts +40 -0
- package/src/api/alephium/AlephiumGetAddress.ts +0 -4
- package/src/api/alephium/AlephiumSignMessage.ts +0 -4
- package/src/api/alephium/AlephiumSignTransaction.ts +2 -6
- package/src/api/algo/AlgoGetAddress.ts +4 -0
- package/src/api/algo/AlgoSignTransaction.ts +4 -0
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +9 -21
- package/src/api/aptos/AptosGetAddress.ts +4 -0
- package/src/api/aptos/AptosGetPublicKey.ts +4 -0
- package/src/api/aptos/AptosSignInMessage.ts +4 -0
- package/src/api/aptos/AptosSignMessage.ts +4 -0
- package/src/api/aptos/AptosSignTransaction.ts +4 -0
- package/src/api/benfen/BenfenGetAddress.ts +11 -7
- package/src/api/benfen/BenfenGetPublicKey.ts +0 -4
- package/src/api/benfen/BenfenSignMessage.ts +0 -4
- package/src/api/benfen/BenfenSignTransaction.ts +0 -4
- package/src/api/btc/BTCGetAddress.ts +8 -1
- package/src/api/btc/BTCGetPublicKey.ts +9 -2
- package/src/api/btc/BTCSignMessage.ts +8 -1
- package/src/api/btc/BTCSignPsbt.ts +4 -0
- package/src/api/btc/BTCSignTransaction.ts +8 -1
- package/src/api/btc/BTCVerifyMessage.ts +8 -1
- package/src/api/btc/helpers/versionLimit.ts +7 -4
- package/src/api/cardano/CardanoGetAddress.ts +4 -0
- package/src/api/cardano/CardanoGetPublicKey.ts +4 -0
- package/src/api/cardano/CardanoSignMessage.ts +5 -1
- package/src/api/cardano/CardanoSignTransaction.ts +5 -1
- package/src/api/conflux/ConfluxGetAddress.ts +6 -0
- package/src/api/conflux/ConfluxSignMessage.ts +6 -0
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +6 -0
- package/src/api/conflux/ConfluxSignTransaction.ts +8 -5
- package/src/api/cosmos/CosmosGetAddress.ts +4 -0
- package/src/api/cosmos/CosmosGetPublicKey.ts +4 -0
- package/src/api/cosmos/CosmosSignTransaction.ts +4 -0
- package/src/api/device/DeviceCancel.ts +5 -0
- package/src/api/device/DeviceChangePin.ts +28 -0
- package/src/api/device/DeviceFullyUploadResource.ts +4 -5
- package/src/api/device/DeviceLock.ts +5 -0
- package/src/api/device/DeviceRebootToBoardloader.ts +9 -4
- package/src/api/device/DeviceRebootToBootloader.ts +9 -4
- package/src/api/device/DeviceSettings.ts +187 -1
- package/src/api/device/DeviceSupportFeatures.ts +4 -0
- package/src/api/device/DeviceUnlock.ts +13 -0
- package/src/api/device/DeviceUpdateBootloader.ts +123 -8
- package/src/api/device/DeviceWipe.ts +25 -0
- package/src/api/device/PreInitialize.ts +4 -0
- package/src/api/dynex/DnxGetAddress.ts +0 -6
- package/src/api/dynex/DnxSignTransaction.ts +0 -6
- package/src/api/evm/EVMGetAddress.ts +4 -0
- package/src/api/evm/EVMGetPublicKey.ts +4 -0
- package/src/api/evm/EVMSignMessage.ts +4 -0
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -11
- package/src/api/evm/EVMSignTransaction.ts +4 -0
- package/src/api/evm/EVMSignTypedData.ts +7 -5
- package/src/api/evm/EVMVerifyMessage.ts +4 -0
- package/src/api/evm/legacyV1/getAddress.ts +2 -2
- package/src/api/evm/legacyV1/getPublicKey.ts +2 -2
- package/src/api/evm/legacyV1/signMessage.ts +2 -2
- package/src/api/evm/legacyV1/signTypedData.ts +2 -2
- package/src/api/evm/legacyV1/signTypedHash.ts +2 -2
- package/src/api/evm/legacyV1/verifyMessage.ts +2 -2
- package/src/api/filecoin/FilecoinGetAddress.ts +4 -0
- package/src/api/filecoin/FilecoinSignTransaction.ts +4 -0
- package/src/api/firmware/FirmwareArtifactSource.ts +278 -0
- package/src/api/firmware/FirmwareHostBinding.ts +100 -0
- package/src/api/firmware/FirmwarePreparationError.ts +12 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +71 -7
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +9 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +745 -0
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +392 -0
- package/src/api/firmware/getBinary.ts +8 -3
- package/src/api/firmware/progressThrottle.ts +44 -0
- package/src/api/firmware/updateBootloader.ts +19 -4
- package/src/api/firmware/uploadFirmware.ts +140 -22
- package/src/api/helpers/batchGetPublickeys.ts +2 -2
- package/src/api/helpers/filesystemValidation.ts +61 -0
- package/src/api/helpers/paramsValidator.ts +1 -1
- package/src/api/helpers/protocolV2FileWrite.ts +199 -0
- package/src/api/index.ts +7 -30
- package/src/api/kaspa/KaspaGetAddress.ts +7 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +373 -29
- package/src/api/kaspa/helpers/TransferSerialize.ts +17 -7
- package/src/api/lightning/LnurlAuth.ts +0 -4
- package/src/api/near/NearGetAddress.ts +4 -0
- package/src/api/near/NearSignTransaction.ts +4 -0
- package/src/api/nem/NEMGetAddress.ts +4 -0
- package/src/api/nem/NEMSignTransaction.ts +4 -0
- package/src/api/neo/NeoGetAddress.ts +0 -4
- package/src/api/neo/NeoSignTransaction.ts +0 -4
- package/src/api/nervos/NervosGetAddress.ts +0 -4
- package/src/api/nervos/NervosSignTransaction.ts +2 -6
- package/src/api/nexa/NexaGetAddress.ts +0 -4
- package/src/api/nexa/NexaSignTransaction.ts +3 -5
- package/src/api/nostr/NostrDecryptMessage.ts +4 -0
- package/src/api/nostr/NostrEncryptMessage.ts +4 -0
- package/src/api/nostr/NostrGetPublicKey.ts +4 -0
- package/src/api/nostr/NostrSignEvent.ts +4 -0
- package/src/api/nostr/NostrSignSchnorr.ts +4 -0
- package/src/api/polkadot/PolkadotGetAddress.ts +4 -0
- package/src/api/polkadot/PolkadotSignTransaction.ts +4 -0
- package/src/api/protocol-v2/{FactoryGetDeviceInfo.ts → DeviceFactoryInfoGet.ts} +8 -5
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +35 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +11 -10
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +45 -7
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +10 -5
- package/src/api/protocol-v2/DeviceInfoGet.ts +141 -0
- package/src/api/protocol-v2/DeviceReboot.ts +8 -4
- package/src/api/protocol-v2/DeviceStatusGet.ts +19 -0
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +134 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +9 -3
- package/src/api/protocol-v2/{FilesystemFixPermission.ts → FilesystemPermissionFix.ts} +7 -4
- package/src/api/protocol-v2/Ping.ts +37 -3
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +19 -0
- package/src/api/protocol-v2/helpers.ts +71 -50
- package/src/api/scdo/ScdoGetAddress.ts +0 -4
- package/src/api/scdo/ScdoSignMessage.ts +0 -4
- package/src/api/scdo/ScdoSignTransaction.ts +0 -4
- package/src/api/solana/SolGetAddress.ts +4 -0
- package/src/api/solana/SolSignMessage.ts +4 -0
- package/src/api/solana/SolSignOffchainMessage.ts +4 -0
- package/src/api/solana/SolSignTransaction.ts +4 -0
- package/src/api/starcoin/StarcoinGetAddress.ts +4 -0
- package/src/api/starcoin/StarcoinGetPublicKey.ts +4 -0
- package/src/api/starcoin/StarcoinSignMessage.ts +4 -0
- package/src/api/starcoin/StarcoinSignTransaction.ts +4 -0
- package/src/api/starcoin/StarcoinVerifyMessage.ts +4 -0
- package/src/api/stellar/StellarGetAddress.ts +1 -10
- package/src/api/stellar/StellarSignTransaction.ts +1 -14
- package/src/api/sui/SuiGetAddress.ts +4 -0
- package/src/api/sui/SuiGetPublicKey.ts +4 -0
- package/src/api/sui/SuiSignMessage.ts +4 -0
- package/src/api/sui/SuiSignTransaction.ts +4 -0
- package/src/api/ton/TonGetAddress.ts +4 -0
- package/src/api/ton/TonSignData.ts +6 -6
- package/src/api/ton/TonSignMessage.ts +4 -0
- package/src/api/ton/TonSignProof.ts +4 -0
- package/src/api/tron/TronGetAddress.ts +4 -0
- package/src/api/tron/TronSignMessage.ts +18 -7
- package/src/api/tron/TronSignTransaction.ts +4 -0
- package/src/api/utils.ts +7 -3
- package/src/api/xrp/XrpGetAddress.ts +4 -0
- package/src/api/xrp/XrpSignTransaction.ts +5 -1
- package/src/constants/index.ts +1 -4
- package/src/core/RequestQueue.ts +1 -0
- package/src/core/deviceEventRegistration.ts +23 -0
- package/src/core/index.ts +181 -58
- package/src/data/messages/messages-protocol-v2.json +796 -620
- package/src/data/messages/messages.json +286 -1
- package/src/data-manager/DataManager.ts +45 -38
- package/src/data-manager/TransportManager.ts +1 -1
- package/src/data-manager/connectSettings.ts +13 -4
- package/src/device/Device.ts +573 -278
- package/src/device/DeviceCommands.ts +154 -156
- package/src/device/DeviceFeaturesState.ts +25 -0
- package/src/device/DevicePool.ts +61 -13
- package/src/device/DeviceStateMapper.ts +366 -0
- package/src/device/DeviceStateProjector.ts +101 -0
- package/src/device/DeviceStateStore.ts +201 -0
- package/src/device/DeviceWalletSessionStore.ts +105 -0
- package/src/device/cloneDeviceState.ts +39 -0
- package/src/device/deviceIdentity.ts +18 -0
- package/src/deviceProfile/buildDeviceFeatures.ts +234 -210
- package/src/deviceProfile/index.ts +0 -1
- package/src/events/device.ts +18 -1
- package/src/events/logBlockEvent.ts +1 -7
- package/src/events/ui-request.ts +25 -2
- package/src/index.ts +5 -0
- package/src/inject.ts +35 -47
- package/src/lowLevelInject.ts +5 -1
- package/src/protocols/protocol-v2/deviceSession.ts +24 -0
- package/src/protocols/protocol-v2/features.ts +68 -83
- package/src/protocols/protocol-v2/firmware.ts +12 -36
- package/src/protocols/protocol-v2/index.ts +3 -1
- package/src/protocols/protocol-v2/lockedError.ts +10 -0
- package/src/protocols/protocol-v2/settingsUnlockPolicy.ts +60 -0
- package/src/protocols/protocol-v2/uiInteraction.ts +210 -0
- package/src/protocols/protocol-v2/unlockPolicy.ts +105 -0
- package/src/protocols/protocol-v2/unlockRetry.ts +98 -0
- package/src/protocols/protocol-v2/walletSession.ts +202 -0
- package/src/topLevelInject.ts +5 -1
- package/src/types/api/checkAllFirmwareRelease.ts +5 -2
- package/src/types/api/deviceSettings.ts +26 -2
- package/src/types/api/deviceUnlock.ts +1 -1
- package/src/types/api/deviceUpdateBootloader.ts +6 -0
- package/src/types/api/export.ts +21 -0
- package/src/types/api/firmwareUpdate.ts +103 -19
- package/src/types/api/firmwareUpdateCapabilities.ts +9 -0
- package/src/types/api/firmwareUpdatePlan.ts +38 -0
- package/src/types/api/firmwareUpdatePreparedPlan.ts +53 -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 +9 -11
- package/src/types/api/index.ts +33 -73
- package/src/types/api/kaspaSignTransaction.ts +60 -4
- package/src/types/api/openWalletSession.ts +45 -0
- package/src/types/api/protocolV2.ts +23 -162
- package/src/types/api/sessionCache.ts +19 -0
- package/src/types/device.ts +172 -5
- package/src/types/params.ts +4 -0
- package/src/types/settings.ts +55 -35
- package/src/utils/assets.ts +4 -1
- package/src/utils/deviceFeaturesCompat.ts +173 -0
- package/src/utils/deviceFeaturesUtils.ts +66 -24
- package/src/utils/deviceInfoUtils.ts +27 -69
- package/src/utils/deviceSettings.ts +171 -39
- package/src/utils/deviceVersionUtils.ts +25 -44
- package/src/utils/findDefectiveBatchDevice.ts +3 -3
- package/src/utils/homescreen.ts +10 -0
- package/src/utils/index.ts +21 -2
- package/src/utils/networkUtils.ts +270 -14
- package/src/utils/pro2Wallpaper.ts +109 -0
- package/src/utils/tracing.ts +3 -1
- package/tsconfig.type-tests.json +8 -0
- package/dist/api/GetDeviceInfo.d.ts +0 -9
- package/dist/api/GetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DevReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DevReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +0 -29
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +0 -13
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +0 -6
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
- package/dist/deviceProfile/buildDeviceProfile.d.ts +0 -21
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +0 -1
- package/dist/types/api/getDeviceInfo.d.ts +0 -85
- package/dist/types/api/getDeviceInfo.d.ts.map +0 -1
- package/src/api/GetDeviceInfo.ts +0 -145
- package/src/api/protocol-v2/DevReboot.ts +0 -24
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +0 -118
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -29
- package/src/api/protocol-v2/FilesystemDiskControl.ts +0 -50
- package/src/api/protocol-v2/GetProtoVersion.ts +0 -16
- package/src/deviceProfile/buildDeviceProfile.ts +0 -333
- package/src/types/api/getDeviceInfo.ts +0 -99
|
@@ -6,11 +6,16 @@ import { validatePath } from '../helpers/pathUtils';
|
|
|
6
6
|
import { BaseMethod } from '../BaseMethod';
|
|
7
7
|
import { validateParams } from '../helpers/paramsValidator';
|
|
8
8
|
import { stripHexPrefix } from '../helpers/hexUtils';
|
|
9
|
-
import { getFirmwareType } from '../../utils';
|
|
10
9
|
|
|
11
10
|
import type { TronSignMessage as HardwareTronSignMessage } from '@onekeyfe/hd-transport';
|
|
12
11
|
|
|
13
12
|
export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage> {
|
|
13
|
+
private isLegacyMessageType = false;
|
|
14
|
+
|
|
15
|
+
getSupportedProtocols() {
|
|
16
|
+
return ['V1', 'V2'] as const;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
init() {
|
|
15
20
|
this.checkDeviceId = true;
|
|
16
21
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -26,12 +31,8 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
26
31
|
const { path, messageHex } = this.payload;
|
|
27
32
|
const addressN = validatePath(path, 3);
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'TronSignMessage',
|
|
32
|
-
getFirmwareType(this.device?.features)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
34
|
+
this.isLegacyMessageType =
|
|
35
|
+
this.payload.messageType === 'V1' || this.payload.messageType == null;
|
|
35
36
|
|
|
36
37
|
const messageType = TronMessageType.V2;
|
|
37
38
|
|
|
@@ -56,6 +57,9 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
56
57
|
|
|
57
58
|
getMessageV2VersionRange() {
|
|
58
59
|
return {
|
|
60
|
+
pro2: {
|
|
61
|
+
min: '0.0.0',
|
|
62
|
+
},
|
|
59
63
|
pro: {
|
|
60
64
|
min: '4.16.0',
|
|
61
65
|
},
|
|
@@ -72,6 +76,13 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
async run() {
|
|
79
|
+
if (this.isLegacyMessageType) {
|
|
80
|
+
throw createDeviceNotSupportMethodError(
|
|
81
|
+
'TronSignMessage',
|
|
82
|
+
this.device.getCurrentFirmwareType()
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
75
86
|
this.checkFeatureVersionLimit(
|
|
76
87
|
() => this.params.message_type === TronMessageType.V2,
|
|
77
88
|
() => this.getMessageV2VersionRange(),
|
|
@@ -11,6 +11,10 @@ import type { TronSignTx } from '@onekeyfe/hd-transport';
|
|
|
11
11
|
import type { DeviceFirmwareRange } from '../../types';
|
|
12
12
|
|
|
13
13
|
export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
14
|
+
getSupportedProtocols() {
|
|
15
|
+
return ['V1', 'V2'] as const;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
parseTx(tx: TronTransaction, address_n: number[]): TronSignTx {
|
|
15
19
|
const unSignTx = {
|
|
16
20
|
address_n,
|
package/src/api/utils.ts
CHANGED
|
@@ -2,16 +2,20 @@ import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
|
2
2
|
|
|
3
3
|
import * as ApiMethods from './index';
|
|
4
4
|
|
|
5
|
+
import type { BaseMethod } from './BaseMethod';
|
|
5
6
|
import type { IFrameCallMessage } from '../events';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type MethodConstructor = new (message: IFrameCallMessage & { id?: number }) => BaseMethod<any>;
|
|
9
|
+
|
|
10
|
+
const publicMethodRegistry = ApiMethods as unknown as Record<string, MethodConstructor>;
|
|
11
|
+
|
|
12
|
+
export function findMethod(message: IFrameCallMessage & { id?: number }): BaseMethod<any> {
|
|
8
13
|
const { method } = message.payload;
|
|
9
14
|
if (typeof method !== 'string') {
|
|
10
15
|
throw ERRORS.TypedError(HardwareErrorCode.CallMethodInvalidParameter, 'Method is not set');
|
|
11
16
|
}
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
const MethodConstructor = ApiMethods[method];
|
|
18
|
+
const MethodConstructor = publicMethodRegistry[method];
|
|
15
19
|
if (MethodConstructor) {
|
|
16
20
|
return new MethodConstructor(message);
|
|
17
21
|
}
|
|
@@ -6,6 +6,10 @@ import { validatePath } from '../helpers/pathUtils';
|
|
|
6
6
|
import type { XrpSignTransactionParams } from '../../types/api/xrpSignTransaction';
|
|
7
7
|
|
|
8
8
|
export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams> {
|
|
9
|
+
getSupportedProtocols() {
|
|
10
|
+
return ['V1', 'V2'] as const;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
hasBundle = false;
|
|
10
14
|
|
|
11
15
|
init() {
|
|
@@ -30,7 +34,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
|
|
|
30
34
|
{ name: 'payment', type: 'object' },
|
|
31
35
|
]);
|
|
32
36
|
validateParams(transaction.payment, [
|
|
33
|
-
{ name: 'amount', type: '
|
|
37
|
+
{ name: 'amount', type: 'number', required: true },
|
|
34
38
|
{ name: 'destination', type: 'string', required: true },
|
|
35
39
|
{ name: 'destinationTag', type: 'number' },
|
|
36
40
|
]);
|
package/src/constants/index.ts
CHANGED
package/src/core/RequestQueue.ts
CHANGED
|
@@ -30,6 +30,7 @@ export default class RequestQueue {
|
|
|
30
30
|
method.responseID = requestId;
|
|
31
31
|
}
|
|
32
32
|
const abortController = new AbortController();
|
|
33
|
+
method.abortSignal = abortController.signal;
|
|
33
34
|
const task = { id: requestId, method, abortController };
|
|
34
35
|
this.requestQueue.set(requestId, task);
|
|
35
36
|
return task;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DEVICE } from '../events';
|
|
2
|
+
|
|
3
|
+
import type { Device, DeviceEvents } from '../device/Device';
|
|
4
|
+
|
|
5
|
+
export type HardwareUiEventHandlers = {
|
|
6
|
+
pin: (...event: DeviceEvents[typeof DEVICE.PIN]) => void;
|
|
7
|
+
button: (...event: DeviceEvents[typeof DEVICE.BUTTON]) => void;
|
|
8
|
+
passphrase: (...event: DeviceEvents[typeof DEVICE.PASSPHRASE]) => void;
|
|
9
|
+
passphraseOnDevice: (...event: DeviceEvents[typeof DEVICE.PASSPHRASE_ON_DEVICE]) => void;
|
|
10
|
+
attachPinOnDevice: (...event: DeviceEvents[typeof DEVICE.ATTACH_PIN_ON_DEVICE]) => void;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function registerHardwareUiEventListeners(
|
|
14
|
+
device: Pick<Device, 'on'>,
|
|
15
|
+
handlers: HardwareUiEventHandlers
|
|
16
|
+
) {
|
|
17
|
+
device.on(DEVICE.PIN, handlers.pin);
|
|
18
|
+
device.on(DEVICE.BUTTON, handlers.button);
|
|
19
|
+
device.on(DEVICE.PASSPHRASE, handlers.passphrase);
|
|
20
|
+
device.on(DEVICE.PASSPHRASE_ON_DEVICE, handlers.passphraseOnDevice);
|
|
21
|
+
device.on(DEVICE.ATTACH_PIN_ON_DEVICE, handlers.attachPinOnDevice);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
package/src/core/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
+
import { TRANSPORT_EVENT } from '@onekeyfe/hd-transport';
|
|
3
4
|
import {
|
|
4
5
|
ERRORS,
|
|
5
6
|
ERROR_CODES_REQUIRE_RELEASE,
|
|
@@ -14,14 +15,7 @@ import {
|
|
|
14
15
|
createNewFirmwareUnReleaseHardwareError,
|
|
15
16
|
} from '@onekeyfe/hd-shared';
|
|
16
17
|
|
|
17
|
-
import {
|
|
18
|
-
LoggerNames,
|
|
19
|
-
enableLog,
|
|
20
|
-
getLogger,
|
|
21
|
-
isMethodVersionRangeUnsupported,
|
|
22
|
-
setLoggerPostMessage,
|
|
23
|
-
wait,
|
|
24
|
-
} from '../utils';
|
|
18
|
+
import { LoggerNames, enableLog, getLogger, setLoggerPostMessage, wait } from '../utils';
|
|
25
19
|
import {
|
|
26
20
|
findDefectiveBatchDevice,
|
|
27
21
|
getDefectiveDeviceInfo,
|
|
@@ -36,6 +30,7 @@ import {
|
|
|
36
30
|
updateRequestContext,
|
|
37
31
|
} from '../utils/tracing';
|
|
38
32
|
import { Device } from '../device/Device';
|
|
33
|
+
import { checkLiveDeviceId } from '../device/deviceIdentity';
|
|
39
34
|
import { DeviceList } from '../device/DeviceList';
|
|
40
35
|
import { DevicePool } from '../device/DevicePool';
|
|
41
36
|
import { PollingStateManager } from './PollingStateManager';
|
|
@@ -51,19 +46,29 @@ import {
|
|
|
51
46
|
createDeviceMessage,
|
|
52
47
|
createResponseMessage,
|
|
53
48
|
createUiMessage,
|
|
49
|
+
getLogBlockLabel,
|
|
54
50
|
} from '../events';
|
|
55
51
|
import TransportManager from '../data-manager/TransportManager';
|
|
56
52
|
import DeviceConnector from '../device/DeviceConnector';
|
|
57
53
|
import RequestQueue from './RequestQueue';
|
|
54
|
+
import { registerHardwareUiEventListeners } from './deviceEventRegistration';
|
|
58
55
|
import { getSynchronize } from '../utils/getSynchronize';
|
|
59
|
-
import {
|
|
56
|
+
import { runMethodWithUnlockRetry } from '../protocols/protocol-v2/unlockRetry';
|
|
57
|
+
import {
|
|
58
|
+
ProtocolV2UiInteractionCoordinator,
|
|
59
|
+
isProtocolV2UiEnabled,
|
|
60
|
+
} from '../protocols/protocol-v2/uiInteraction';
|
|
60
61
|
|
|
61
62
|
import type { ConnectSettings, Features, KnownDevice } from '../types';
|
|
62
63
|
import type { CoreMessage, IFrameCallMessage, UiPromise, UiPromiseResponse } from '../events';
|
|
63
64
|
import type { DeviceEvents, InitOptions, RunOptions } from '../device/Device';
|
|
64
65
|
import type { SdkTracingContext } from '../utils/tracing';
|
|
65
66
|
import type { Deferred } from '@onekeyfe/hd-shared';
|
|
66
|
-
import type {
|
|
67
|
+
import type {
|
|
68
|
+
LowlevelTransportSharedPlugin,
|
|
69
|
+
OneKeyDeviceInfo,
|
|
70
|
+
TransportDeviceDisconnectEvent,
|
|
71
|
+
} from '@onekeyfe/hd-transport';
|
|
67
72
|
import type { BaseMethod } from '../api/BaseMethod';
|
|
68
73
|
|
|
69
74
|
const Log = getLogger(LoggerNames.Core);
|
|
@@ -92,13 +97,14 @@ function hasDeriveCardano(method: BaseMethod): boolean {
|
|
|
92
97
|
|
|
93
98
|
const parseInitOptions = (method?: BaseMethod): InitOptions => ({
|
|
94
99
|
initSession: method?.payload.initSession,
|
|
95
|
-
passphraseState: method?.payload.passphraseState,
|
|
100
|
+
passphraseState: method?.payload.useEmptyPassphrase ? undefined : method?.payload.passphraseState,
|
|
96
101
|
deviceId: method?.payload.deviceId,
|
|
97
102
|
deriveCardano: method && hasDeriveCardano(method),
|
|
98
103
|
connectProtocol: method?.payload.connectProtocol,
|
|
104
|
+
protocolV2DeviceInfoTimeoutMs: method?.payload.protocolV2DeviceInfoTimeoutMs,
|
|
99
105
|
});
|
|
100
106
|
|
|
101
|
-
let _core: Core;
|
|
107
|
+
let _core: Core | undefined;
|
|
102
108
|
let _deviceList: DeviceList | undefined;
|
|
103
109
|
let _connector: DeviceConnector | undefined;
|
|
104
110
|
let _uiPromises: UiPromise<UiPromiseResponse['type']>[] = []; // Waiting for ui response
|
|
@@ -142,7 +148,7 @@ export const callAPI = async (context: CoreContext, message: CoreMessage) => {
|
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
// find api method
|
|
145
|
-
let method
|
|
151
|
+
let method!: BaseMethod;
|
|
146
152
|
try {
|
|
147
153
|
method = findMethod(message as IFrameCallMessage);
|
|
148
154
|
method.connector = _connector;
|
|
@@ -158,11 +164,13 @@ export const callAPI = async (context: CoreContext, message: CoreMessage) => {
|
|
|
158
164
|
|
|
159
165
|
method.init();
|
|
160
166
|
} catch (error) {
|
|
161
|
-
|
|
167
|
+
if (method) {
|
|
168
|
+
completeMethodRequestContext(method, error);
|
|
169
|
+
method.dispose();
|
|
170
|
+
}
|
|
171
|
+
return createResponseMessage(method?.responseID ?? message.id, false, { error });
|
|
162
172
|
}
|
|
163
173
|
|
|
164
|
-
DevicePool.emitter.on(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
165
|
-
|
|
166
174
|
if (!method.useDevice) {
|
|
167
175
|
updateMethodRequestContext(method, { status: 'running' });
|
|
168
176
|
try {
|
|
@@ -223,9 +231,15 @@ const handlePreWarmSignal = async (
|
|
|
223
231
|
message: CoreMessage,
|
|
224
232
|
method: BaseMethod
|
|
225
233
|
): Promise<any> => {
|
|
234
|
+
const createAckResponse = () => {
|
|
235
|
+
completeMethodRequestContext(method);
|
|
236
|
+
method.dispose();
|
|
237
|
+
return createResponseMessage(method.responseID, true, true);
|
|
238
|
+
};
|
|
239
|
+
|
|
226
240
|
// no connectId: can't target a device safely, skip pre-warm (ack only)
|
|
227
241
|
if (!method.connectId) {
|
|
228
|
-
return
|
|
242
|
+
return createAckResponse();
|
|
229
243
|
}
|
|
230
244
|
|
|
231
245
|
const key = method.getPreWarmKey();
|
|
@@ -238,12 +252,12 @@ const handlePreWarmSignal = async (
|
|
|
238
252
|
} catch {
|
|
239
253
|
// pre-warm is best-effort; ignore its failure for the coalesced caller
|
|
240
254
|
}
|
|
241
|
-
return
|
|
255
|
+
return createAckResponse();
|
|
242
256
|
}
|
|
243
257
|
|
|
244
258
|
const doneAt = preWarmDoneAt.get(key);
|
|
245
259
|
if (typeof doneAt === 'number' && Date.now() - doneAt <= method.preWarmTtl) {
|
|
246
|
-
return
|
|
260
|
+
return createAckResponse();
|
|
247
261
|
}
|
|
248
262
|
|
|
249
263
|
const run = onCallDevice(context, message, method);
|
|
@@ -351,7 +365,7 @@ const onCallDevice = async (
|
|
|
351
365
|
);
|
|
352
366
|
} catch (e) {
|
|
353
367
|
preWarmCallbackTask?.resolve();
|
|
354
|
-
|
|
368
|
+
Log.debug('ensureConnected error: ', e);
|
|
355
369
|
|
|
356
370
|
completeMethodRequestContext(method, e);
|
|
357
371
|
|
|
@@ -388,18 +402,23 @@ const onCallDevice = async (
|
|
|
388
402
|
);
|
|
389
403
|
}
|
|
390
404
|
|
|
391
|
-
device
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
405
|
+
registerHardwareUiEventListeners(device, {
|
|
406
|
+
pin: onDevicePinHandler,
|
|
407
|
+
button: onDeviceButtonHandler,
|
|
408
|
+
passphrase: message.payload.useEmptyPassphrase
|
|
409
|
+
? onEmptyPassphraseHandler
|
|
410
|
+
: onDevicePassphraseHandler,
|
|
411
|
+
passphraseOnDevice: onEnterPassphraseOnDeviceHandler,
|
|
412
|
+
attachPinOnDevice: onEnterAttachPinOnDeviceHandler,
|
|
413
|
+
});
|
|
398
414
|
device.on(DEVICE.FEATURES, onDeviceFeaturesHandler);
|
|
415
|
+
device.on(DEVICE.STATE, onDeviceStateHandler);
|
|
399
416
|
device.on(
|
|
400
417
|
DEVICE.SELECT_DEVICE_IN_BOOTLOADER_FOR_WEB_DEVICE,
|
|
401
418
|
onSelectDeviceInBootloaderForWebDeviceHandler
|
|
402
419
|
);
|
|
420
|
+
|
|
421
|
+
const protocolV2UiCoordinator = new ProtocolV2UiInteractionCoordinator(device, postMessage);
|
|
403
422
|
device.on(
|
|
404
423
|
DEVICE.SELECT_DEVICE_FOR_SWITCH_FIRMWARE_WEB_DEVICE,
|
|
405
424
|
onSelectDeviceForSwitchFirmwareWebDeviceHandler
|
|
@@ -414,11 +433,9 @@ const onCallDevice = async (
|
|
|
414
433
|
await waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
415
434
|
|
|
416
435
|
const inner = async (): Promise<void> => {
|
|
417
|
-
// Protocol
|
|
418
|
-
//
|
|
419
|
-
|
|
420
|
-
throw createDeviceNotSupportMethodError(method.name, device.getCurrentFirmwareType());
|
|
421
|
-
}
|
|
436
|
+
// Protocol is established from an active device response during acquire/initialize.
|
|
437
|
+
// Reject unsupported methods before any method-specific device command is sent.
|
|
438
|
+
method.assertProtocolSupported(device.getProtocol(), device.getCurrentFirmwareType());
|
|
422
439
|
|
|
423
440
|
// check firmware version
|
|
424
441
|
const versionRange = device.getCurrentMethodVersionRange(
|
|
@@ -429,8 +446,8 @@ const onCallDevice = async (
|
|
|
429
446
|
const deviceFirmwareType = device.getCurrentFirmwareType();
|
|
430
447
|
let newVersionStatus: ReturnType<typeof DataManager.getFirmwareStatus> | undefined;
|
|
431
448
|
|
|
432
|
-
//
|
|
433
|
-
// Pro2
|
|
449
|
+
// Defective-batch and forced-update gates depend on V1 features/remote config.
|
|
450
|
+
// Pro2 joins after DataManager supports its profile firmwareStatus.
|
|
434
451
|
if (device.features && !device.isProtocolV2()) {
|
|
435
452
|
await DataManager.checkAndReloadData();
|
|
436
453
|
|
|
@@ -478,10 +495,6 @@ const onCallDevice = async (
|
|
|
478
495
|
}
|
|
479
496
|
}
|
|
480
497
|
|
|
481
|
-
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
482
|
-
throw createDeviceNotSupportMethodError(method.name, deviceFirmwareType);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
498
|
if (versionRange) {
|
|
486
499
|
if (semver.valid(versionRange.min) && semver.lt(currentFirmwareVersion, versionRange.min)) {
|
|
487
500
|
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
|
|
@@ -533,7 +546,7 @@ const onCallDevice = async (
|
|
|
533
546
|
}
|
|
534
547
|
|
|
535
548
|
if (method.deviceId && method.checkDeviceId) {
|
|
536
|
-
const isSameDeviceID = device
|
|
549
|
+
const isSameDeviceID = await checkLiveDeviceId(device, method.deviceId);
|
|
537
550
|
if (!isSameDeviceID) {
|
|
538
551
|
return Promise.reject(ERRORS.TypedError(HardwareErrorCode.DeviceCheckDeviceIdError));
|
|
539
552
|
}
|
|
@@ -610,7 +623,11 @@ const onCallDevice = async (
|
|
|
610
623
|
method.device?.commands?.checkDisposed();
|
|
611
624
|
|
|
612
625
|
try {
|
|
613
|
-
const response: object = await
|
|
626
|
+
const response: object = await runMethodWithUnlockRetry(
|
|
627
|
+
method,
|
|
628
|
+
device,
|
|
629
|
+
protocolV2UiCoordinator
|
|
630
|
+
);
|
|
614
631
|
messageResponse = createResponseMessage(method.responseID, true, response);
|
|
615
632
|
requestQueue.resolveRequest(method.responseID, messageResponse);
|
|
616
633
|
completeMethodRequestContext(method);
|
|
@@ -627,6 +644,8 @@ const onCallDevice = async (
|
|
|
627
644
|
) {
|
|
628
645
|
throw error;
|
|
629
646
|
}
|
|
647
|
+
} finally {
|
|
648
|
+
protocolV2UiCoordinator.close();
|
|
630
649
|
}
|
|
631
650
|
};
|
|
632
651
|
Log.debug('Call API - Device Run: ', device.mainId);
|
|
@@ -680,7 +699,9 @@ const onCallDevice = async (
|
|
|
680
699
|
|
|
681
700
|
requestQueue.releaseTask(method.responseID);
|
|
682
701
|
|
|
683
|
-
|
|
702
|
+
if (isProtocolV2UiEnabled(method)) {
|
|
703
|
+
closePopup();
|
|
704
|
+
}
|
|
684
705
|
|
|
685
706
|
cleanup();
|
|
686
707
|
|
|
@@ -732,6 +753,15 @@ function initDevice(method: BaseMethod) {
|
|
|
732
753
|
|
|
733
754
|
if (method.connectId) {
|
|
734
755
|
device = _deviceList.getDevice(method.connectId);
|
|
756
|
+
if (!device && method.name === 'firmwareUpdateV4' && allDevices.length === 1) {
|
|
757
|
+
const [singleDevice] = allDevices;
|
|
758
|
+
if (singleDevice.isBootloader()) {
|
|
759
|
+
Log.debug(
|
|
760
|
+
'firmwareUpdateV4 uses the only bootloader device when connectId changed after reboot'
|
|
761
|
+
);
|
|
762
|
+
device = singleDevice;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
735
765
|
} else if (allDevices.length === 1) {
|
|
736
766
|
[device] = allDevices;
|
|
737
767
|
} else if (allDevices.length > 1) {
|
|
@@ -833,8 +863,15 @@ function isRetryableBleProtocolV2ProbeError(method: BaseMethod, error: unknown)
|
|
|
833
863
|
*/
|
|
834
864
|
async function connectDeviceForBle(method: BaseMethod, device: Device, retryCount = 0) {
|
|
835
865
|
try {
|
|
836
|
-
|
|
866
|
+
const shouldAcquire =
|
|
867
|
+
!device.hasDeviceAcquire() || !device.commands || device.commands.disposed;
|
|
868
|
+
if (shouldAcquire) {
|
|
869
|
+
await device.acquire(method.payload.connectProtocol);
|
|
870
|
+
}
|
|
837
871
|
if (method.payload?.onlyConnectBleDevice) {
|
|
872
|
+
if (shouldAcquire) {
|
|
873
|
+
DevicePool.emitter.emit(DEVICE.CONNECT, device);
|
|
874
|
+
}
|
|
838
875
|
return;
|
|
839
876
|
}
|
|
840
877
|
// Skip initialize if conditions are met
|
|
@@ -845,6 +882,9 @@ async function connectDeviceForBle(method: BaseMethod, device: Device, retryCoun
|
|
|
845
882
|
passphraseState: initOptions.passphraseState,
|
|
846
883
|
});
|
|
847
884
|
}
|
|
885
|
+
if (shouldAcquire) {
|
|
886
|
+
DevicePool.emitter.emit(DEVICE.CONNECT, device);
|
|
887
|
+
}
|
|
848
888
|
} catch (err) {
|
|
849
889
|
if (
|
|
850
890
|
(err.errorCode === HardwareErrorCode.BleTimeoutError ||
|
|
@@ -1145,8 +1185,6 @@ const cleanup = () => {
|
|
|
1145
1185
|
|
|
1146
1186
|
const removeDeviceListener = (device: Device) => {
|
|
1147
1187
|
device.removeAllListeners();
|
|
1148
|
-
DevicePool.emitter.removeAllListeners(DEVICE.CONNECT);
|
|
1149
|
-
// DevicePool.emitter.removeListener(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
|
|
1150
1188
|
};
|
|
1151
1189
|
|
|
1152
1190
|
/**
|
|
@@ -1157,16 +1195,30 @@ const closePopup = () => {
|
|
|
1157
1195
|
};
|
|
1158
1196
|
|
|
1159
1197
|
const onDeviceConnectHandler = (device: Device) => {
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
postMessage(createDeviceMessage(DEVICE.CONNECT, { device: deviceObject
|
|
1198
|
+
const deviceObject = device.toMessageObject();
|
|
1199
|
+
if (!deviceObject) return;
|
|
1200
|
+
postMessage(createDeviceMessage(DEVICE.CONNECT, { device: deviceObject }));
|
|
1163
1201
|
};
|
|
1164
1202
|
|
|
1165
1203
|
const onDeviceDisconnectHandler = (device: Device) => {
|
|
1166
1204
|
device.clearPreInitialized();
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject
|
|
1205
|
+
const deviceObject = device.toMessageObject();
|
|
1206
|
+
if (!deviceObject) return;
|
|
1207
|
+
postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject }));
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
const onTransportDeviceDisconnectHandler = (event: TransportDeviceDisconnectEvent) => {
|
|
1211
|
+
const device =
|
|
1212
|
+
deviceCacheMap.get(event.connectId) ??
|
|
1213
|
+
DevicePool.devicesCache[event.connectId] ??
|
|
1214
|
+
DevicePool.getDeviceByPath(event.connectId);
|
|
1215
|
+
if (!device) {
|
|
1216
|
+
Log.debug('Ignoring transport disconnect for an unknown device:', event.connectId);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
device.markTransportDisconnected();
|
|
1221
|
+
DevicePool.emitter.emit(DEVICE.DISCONNECT, device);
|
|
1170
1222
|
};
|
|
1171
1223
|
|
|
1172
1224
|
const onDevicePinHandler = async (...[device, type, callback]: DeviceEvents['pin']) => {
|
|
@@ -1207,6 +1259,10 @@ const onDeviceFeaturesHandler = (...[_, features]: [...DeviceEvents['features']]
|
|
|
1207
1259
|
postMessage(createDeviceMessage(DEVICE.FEATURES, { ...features }));
|
|
1208
1260
|
};
|
|
1209
1261
|
|
|
1262
|
+
const onDeviceStateHandler = (...[_, stateEvent]: [...DeviceEvents['state']]) => {
|
|
1263
|
+
postMessage(createDeviceMessage(DEVICE.STATE, stateEvent));
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1210
1266
|
const onDevicePassphraseHandler = async (
|
|
1211
1267
|
...[device, requestPayload, callback]: DeviceEvents['passphrase']
|
|
1212
1268
|
) => {
|
|
@@ -1217,6 +1273,10 @@ const onDevicePassphraseHandler = async (
|
|
|
1217
1273
|
device: device.toMessageObject() as KnownDevice,
|
|
1218
1274
|
passphraseState: device.passphraseState,
|
|
1219
1275
|
existsAttachPinUser: requestPayload.existsAttachPinUser,
|
|
1276
|
+
deviceOnly: requestPayload.deviceOnly,
|
|
1277
|
+
source: requestPayload.source,
|
|
1278
|
+
reason: requestPayload.reason,
|
|
1279
|
+
expectedPassphraseState: requestPayload.expectedPassphraseState,
|
|
1220
1280
|
})
|
|
1221
1281
|
);
|
|
1222
1282
|
// wait for passphrase
|
|
@@ -1238,12 +1298,27 @@ const onEmptyPassphraseHandler = (...[_, , callback]: DeviceEvents['passphrase']
|
|
|
1238
1298
|
};
|
|
1239
1299
|
|
|
1240
1300
|
const onEnterPassphraseOnDeviceHandler = (
|
|
1241
|
-
...[device]: [...DeviceEvents['passphrase_on_device']]
|
|
1301
|
+
...[device, requestPayload]: [...DeviceEvents['passphrase_on_device']]
|
|
1242
1302
|
) => {
|
|
1243
1303
|
postMessage(
|
|
1244
1304
|
createUiMessage(UI_REQUEST.REQUEST_PASSPHRASE_ON_DEVICE, {
|
|
1245
1305
|
device: device.toMessageObject() as KnownDevice,
|
|
1246
1306
|
passphraseState: device.passphraseState,
|
|
1307
|
+
source: requestPayload?.source,
|
|
1308
|
+
reason: requestPayload?.reason,
|
|
1309
|
+
})
|
|
1310
|
+
);
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1313
|
+
const onEnterAttachPinOnDeviceHandler = (
|
|
1314
|
+
...[device, requestPayload]: [...DeviceEvents['attach_pin_on_device']]
|
|
1315
|
+
) => {
|
|
1316
|
+
postMessage(
|
|
1317
|
+
createUiMessage(UI_REQUEST.REQUEST_PIN, {
|
|
1318
|
+
device: device.toMessageObject() as KnownDevice,
|
|
1319
|
+
type: 'ButtonRequest_AttachPin',
|
|
1320
|
+
source: requestPayload?.source,
|
|
1321
|
+
reason: requestPayload?.reason,
|
|
1247
1322
|
})
|
|
1248
1323
|
);
|
|
1249
1324
|
};
|
|
@@ -1314,6 +1389,8 @@ export default class Core extends EventEmitter {
|
|
|
1314
1389
|
|
|
1315
1390
|
private requestQueue = new RequestQueue();
|
|
1316
1391
|
|
|
1392
|
+
private disposePromise?: Promise<void>;
|
|
1393
|
+
|
|
1317
1394
|
// background task
|
|
1318
1395
|
private prePendingCallPromise: Promise<void> | undefined;
|
|
1319
1396
|
|
|
@@ -1372,10 +1449,17 @@ export default class Core extends EventEmitter {
|
|
|
1372
1449
|
}
|
|
1373
1450
|
|
|
1374
1451
|
case IFRAME.CALL: {
|
|
1375
|
-
|
|
1452
|
+
const logBlockLabel = getLogBlockLabel(message);
|
|
1453
|
+
Log.log(
|
|
1454
|
+
`[${Date.now()}][CALL_API]`,
|
|
1455
|
+
logBlockLabel ? { method: logBlockLabel, payload: '[REDACTED]' } : message
|
|
1456
|
+
);
|
|
1376
1457
|
const response = await callAPI(this.getCoreContext(), message);
|
|
1377
1458
|
const { success, payload } = response;
|
|
1378
|
-
Log.log(
|
|
1459
|
+
Log.log(
|
|
1460
|
+
`[${Date.now()}][CALL_API_RESPONSE]`,
|
|
1461
|
+
logBlockLabel ? { method: logBlockLabel, payload: '[REDACTED]' } : response
|
|
1462
|
+
);
|
|
1379
1463
|
if (success) {
|
|
1380
1464
|
return response;
|
|
1381
1465
|
}
|
|
@@ -1405,25 +1489,65 @@ export default class Core extends EventEmitter {
|
|
|
1405
1489
|
return Promise.resolve(message);
|
|
1406
1490
|
}
|
|
1407
1491
|
|
|
1408
|
-
dispose() {
|
|
1492
|
+
dispose(): Promise<void> {
|
|
1493
|
+
if (!this.disposePromise) {
|
|
1494
|
+
this.disposePromise = this.disposeResources();
|
|
1495
|
+
}
|
|
1496
|
+
return this.disposePromise;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
private async disposeResources(): Promise<void> {
|
|
1500
|
+
Log.debug(`[Core] Disposing SDK instance: ${this.sdkInstanceId}`);
|
|
1501
|
+
pollingManager.stopAll();
|
|
1502
|
+
this.requestQueue.abortAllRequests();
|
|
1503
|
+
cleanup();
|
|
1504
|
+
|
|
1505
|
+
_connector?.stop();
|
|
1506
|
+
let transportCleanup: Promise<void>;
|
|
1507
|
+
try {
|
|
1508
|
+
transportCleanup = Promise.resolve(TransportManager.getTransport()?.stop?.()).catch(error => {
|
|
1509
|
+
Log.warn('[Core] Transport cleanup failed:', error);
|
|
1510
|
+
});
|
|
1511
|
+
} catch (error) {
|
|
1512
|
+
Log.warn('[Core] Transport cleanup failed:', error);
|
|
1513
|
+
transportCleanup = Promise.resolve();
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
// Preserve synchronous dispose semantics for in-memory state and listeners.
|
|
1409
1517
|
_deviceList = undefined;
|
|
1410
1518
|
_connector = undefined;
|
|
1519
|
+
DevicePool.resetState();
|
|
1411
1520
|
deviceCacheMap.clear();
|
|
1412
1521
|
preWarmInflight.clear();
|
|
1413
1522
|
preWarmDoneAt.clear();
|
|
1414
|
-
|
|
1523
|
+
preConnectCache = { passphraseState: undefined };
|
|
1524
|
+
this.prePendingCallPromise = undefined;
|
|
1525
|
+
this.removeAllListeners();
|
|
1415
1526
|
cleanupSdkInstance(this.sdkInstanceId);
|
|
1527
|
+
if (_core === this) _core = undefined;
|
|
1528
|
+
|
|
1529
|
+
// Transports, especially Node USB, may release native handles asynchronously.
|
|
1530
|
+
await transportCleanup;
|
|
1416
1531
|
}
|
|
1417
1532
|
}
|
|
1418
1533
|
|
|
1419
1534
|
export const initCore = () => {
|
|
1420
|
-
|
|
1421
|
-
|
|
1535
|
+
const core = new Core();
|
|
1536
|
+
_core = core;
|
|
1537
|
+
return core;
|
|
1422
1538
|
};
|
|
1423
1539
|
|
|
1424
1540
|
export const initConnector = () => {
|
|
1425
1541
|
_connector = new DeviceConnector();
|
|
1542
|
+
DevicePool.emitter.removeListener(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
1543
|
+
DevicePool.emitter.removeListener(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
|
|
1544
|
+
DevicePool.emitter.removeListener(
|
|
1545
|
+
TRANSPORT_EVENT.DEVICE_DISCONNECT,
|
|
1546
|
+
onTransportDeviceDisconnectHandler
|
|
1547
|
+
);
|
|
1548
|
+
DevicePool.emitter.on(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
1426
1549
|
DevicePool.emitter.on(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
|
|
1550
|
+
DevicePool.emitter.on(TRANSPORT_EVENT.DEVICE_DISCONNECT, onTransportDeviceDisconnectHandler);
|
|
1427
1551
|
return _connector;
|
|
1428
1552
|
};
|
|
1429
1553
|
|
|
@@ -1439,7 +1563,6 @@ export const init = async (
|
|
|
1439
1563
|
try {
|
|
1440
1564
|
try {
|
|
1441
1565
|
await DataManager.load(settings);
|
|
1442
|
-
setProtocolV2DeviceInfoMock(settings.protocolV2DeviceInfoMockEnabled ?? false);
|
|
1443
1566
|
initTransport(Transport, plugin);
|
|
1444
1567
|
} catch {
|
|
1445
1568
|
Log.error('DataManager.load error');
|