@onekeyfe/hd-core 1.2.0-alpha.9 → 1.2.0-alpha.91
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 +390 -0
- package/__tests__/DeviceCommands.test.ts +563 -0
- package/__tests__/DeviceEventRegistration.test.ts +49 -0
- package/__tests__/chain-params-onekey-compatibility.test.ts +229 -0
- package/__tests__/check-all-firmware-release-protocol-v2.test.ts +825 -0
- package/__tests__/check-firmware-release-protocol-v2.test.ts +199 -0
- package/__tests__/connectSettings.test.ts +45 -5
- package/__tests__/core-dispose.test.ts +34 -0
- package/__tests__/core-error-output.test.ts +39 -0
- package/__tests__/core-initialization.test.ts +23 -0
- package/__tests__/device-connector-protocol.test.ts +81 -0
- package/__tests__/device-features-state.test.ts +78 -0
- package/__tests__/device-identity.test.ts +52 -0
- package/__tests__/device-initialize-timeout.test.ts +56 -0
- package/__tests__/device-lifecycle-events.test.ts +351 -0
- package/__tests__/device-pool-state.test.ts +166 -0
- package/__tests__/device-settings.test.ts +437 -0
- package/__tests__/device-state-contract.test.ts +28 -0
- package/__tests__/device-state-events.test.ts +286 -0
- package/__tests__/device-state-mapper.test.ts +288 -0
- package/__tests__/device-state-projector.test.ts +114 -0
- package/__tests__/device-state-store.test.ts +109 -0
- package/__tests__/device-utils.test.ts +154 -0
- package/__tests__/device-wallet-session-store.test.ts +348 -1
- package/__tests__/deviceFeaturesUtils.test.ts +39 -0
- package/__tests__/devicePoolBootloaderPath.test.ts +64 -0
- package/__tests__/deviceSettings.test.ts +113 -0
- package/__tests__/deviceUploadNft.test.ts +316 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +12 -6
- package/__tests__/evmSignTransaction.test.ts +69 -0
- package/__tests__/evmSignTypedData.test.ts +80 -0
- package/__tests__/filesystemValidation.test.ts +53 -0
- package/__tests__/firmware-memory-host.test.ts +112 -0
- package/__tests__/firmware-update/check-all-firmware-release.test.ts +175 -0
- package/__tests__/firmware-update/device-update-bootloader.test.ts +91 -0
- package/__tests__/firmware-update/firmware-artifact-source.test.ts +119 -0
- package/__tests__/firmware-update/firmware-host-binding.test.ts +79 -0
- package/__tests__/firmware-update/firmware-preparation-error.test.ts +27 -0
- package/__tests__/firmware-update/firmware-prepared-host-digest.test.ts +209 -0
- package/__tests__/firmware-update/firmware-update-bootloader-poll.test.ts +200 -0
- package/__tests__/firmware-update/firmware-update-capabilities.test.ts +13 -0
- package/__tests__/firmware-update/firmware-update-plan-bootloader-identity.test.ts +394 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +654 -0
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +283 -0
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +457 -0
- package/__tests__/firmware-update/firmware-update-v3-reconnect.test.ts +121 -0
- package/__tests__/firmware-update/firmware-upload-source.test.ts +70 -0
- package/__tests__/get-device-state.test.ts +578 -0
- package/__tests__/homescreen.test.ts +81 -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 +578 -0
- package/__tests__/known-device-public-types.type-test.ts +3 -0
- package/__tests__/logBlockEvent.test.ts +128 -1
- package/__tests__/method-protocol-support.test.ts +144 -0
- package/__tests__/networkUtils.test.ts +406 -0
- package/__tests__/open-wallet-session-error-response.test.ts +43 -0
- package/__tests__/open-wallet-session.test.ts +1899 -0
- package/__tests__/pro2Nft.test.ts +108 -0
- package/__tests__/pro2Wallpaper.test.ts +39 -0
- package/__tests__/protocol-binding.test.ts +89 -0
- package/__tests__/protocol-v2-bootloader-mode.test.ts +37 -0
- package/__tests__/protocol-v2-firmware-targets.test.ts +66 -0
- package/__tests__/protocol-v2-ping.test.ts +28 -0
- package/__tests__/protocol-v2-resources.test.ts +270 -0
- package/__tests__/protocol-v2-ui-lifecycle.test.ts +91 -0
- package/__tests__/protocol-v2-unlock-policy.test.ts +308 -0
- package/__tests__/protocol-v2.test.ts +6670 -1759
- package/__tests__/protocolV2FileWrite.test.ts +285 -0
- package/__tests__/protocolV2UiInteraction.test.ts +329 -0
- package/__tests__/public-device-state-api.test.ts +275 -0
- package/__tests__/public-pro2-api-boundary.test.ts +107 -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 +145 -0
- package/__tests__/tron-sign-message-init.test.ts +74 -0
- package/__tests__/uiProgressThrottle.test.ts +74 -0
- package/__tests__/uiPromiseRegistry.test.ts +115 -0
- package/dist/api/BaseMethod.d.ts +16 -1
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts +25 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBLEFirmwareRelease.d.ts +3 -2
- package/dist/api/CheckBLEFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts +2 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts +3 -2
- 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.map +1 -1
- package/dist/api/DetectDeviceConnectProtocol.d.ts +7 -0
- package/dist/api/DetectDeviceConnectProtocol.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 +12 -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 +46 -16
- 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 +3 -2
- 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/evm/protocol.d.ts +3 -0
- package/dist/api/evm/protocol.d.ts.map +1 -0
- 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/FirmwareMemoryHost.d.ts +22 -0
- package/dist/api/firmware/FirmwareMemoryHost.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 +12 -3
- 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 +72 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +32 -0
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -0
- package/dist/api/firmware/getBinary.d.ts +14 -4
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/protocolV2Release.d.ts +33 -0
- package/dist/api/firmware/protocolV2Release.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 +43 -0
- package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -0
- package/dist/api/index.d.ts +8 -27
- 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 +2 -1
- 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/polkadot/networks.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -1
- 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 +1 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceUploadNft.d.ts +31 -0
- package/dist/api/protocol-v2/DeviceUploadNft.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 +1 -0
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +1 -1
- 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 +1 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -1
- 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 +2 -1
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +2 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +3 -2
- 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 +2 -1
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +2 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +2 -1
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +2 -1
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +2 -1
- 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 +2 -1
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +2 -1
- 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 +6 -1
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +2 -1
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/utils.d.ts +4 -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 +13 -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/core/uiPromiseRegistry.d.ts +6 -0
- package/dist/core/uiPromiseRegistry.d.ts.map +1 -0
- package/dist/data-manager/DataManager.d.ts +11 -3
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- 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 +71 -16
- 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/DeviceConnector.d.ts +4 -3
- package/dist/device/DeviceConnector.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 +6 -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 +13 -1
- package/dist/device/DeviceWalletSessionStore.d.ts.map +1 -1
- 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/deviceProfile/protocolV2DeviceIdentity.d.ts +7 -0
- package/dist/deviceProfile/protocolV2DeviceIdentity.d.ts.map +1 -0
- package/dist/events/device.d.ts +16 -2
- package/dist/events/device.d.ts.map +1 -1
- package/dist/events/logBlockEvent.d.ts +2 -0
- package/dist/events/logBlockEvent.d.ts.map +1 -1
- package/dist/events/ui-promise.d.ts +4 -2
- package/dist/events/ui-promise.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +50 -4
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/events/ui-response.d.ts +10 -2
- package/dist/events/ui-response.d.ts.map +1 -1
- package/dist/index.d.ts +1776 -778
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11563 -4498
- package/dist/inject.d.ts +6 -1
- 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 +21 -17
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/index.d.ts +2 -2
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/resources.d.ts +12 -0
- package/dist/protocols/protocol-v2/resources.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts +17 -0
- package/dist/protocols/protocol-v2/settingsUnlockPolicy.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/uiInteraction.d.ts +42 -0
- package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/unlockPolicy.d.ts +2 -0
- package/dist/protocols/protocol-v2/unlockPolicy.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts +22 -0
- package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts +18 -4
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +48 -9
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkBLEFirmwareRelease.d.ts +2 -13
- package/dist/types/api/checkBLEFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkBootloaderRelease.d.ts +2 -6
- package/dist/types/api/checkBootloaderRelease.d.ts.map +1 -1
- package/dist/types/api/checkFirmwareRelease.d.ts +2 -13
- package/dist/types/api/checkFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkFirmwareTypeAvailable.d.ts +2 -2
- package/dist/types/api/checkFirmwareTypeAvailable.d.ts.map +1 -1
- package/dist/types/api/detectDeviceConnectProtocol.d.ts +4 -0
- package/dist/types/api/detectDeviceConnectProtocol.d.ts.map +1 -0
- 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 +6 -2
- 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 +8 -3
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +68 -4
- 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 +29 -33
- 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 +35 -0
- package/dist/types/api/openWalletSession.d.ts.map +1 -0
- package/dist/types/api/protocolV2.d.ts +18 -88
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/api/sessionCache.d.ts +4 -1
- package/dist/types/api/sessionCache.d.ts.map +1 -1
- package/dist/types/device.d.ts +142 -10
- 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 +59 -16
- 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 +14 -0
- package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -0
- package/dist/utils/deviceFeaturesUtils.d.ts +10 -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 +4 -0
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/dist/utils/index.d.ts +6 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/networkUtils.d.ts +10 -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/pro2Nft.d.ts +31 -0
- package/dist/utils/pro2Nft.d.ts.map +1 -0
- package/dist/utils/pro2Wallpaper.d.ts +22 -0
- package/dist/utils/pro2Wallpaper.d.ts.map +1 -0
- package/dist/utils/tracing.d.ts.map +1 -1
- package/dist/utils/uiProgressThrottle.d.ts +3 -0
- package/dist/utils/uiProgressThrottle.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +53 -20
- package/src/api/CheckAllFirmwareRelease.ts +437 -4
- package/src/api/CheckBLEFirmwareRelease.ts +37 -5
- package/src/api/CheckBootloaderRelease.ts +36 -5
- package/src/api/CheckFirmwareRelease.ts +35 -8
- package/src/api/CipherKeyValue.ts +4 -0
- package/src/api/ClearSessionCache.ts +4 -0
- package/src/api/DetectDeviceConnectProtocol.ts +18 -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 +13 -7
- package/src/api/FileWrite.ts +26 -181
- package/src/api/FirmwareUpdate.ts +30 -15
- package/src/api/FirmwareUpdateV2.ts +390 -115
- package/src/api/FirmwareUpdateV3.ts +281 -71
- package/src/api/FirmwareUpdateV4.ts +2014 -730
- 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 +36 -21
- package/src/api/OpenWalletSession.ts +268 -0
- package/src/api/PathInfo.ts +9 -4
- package/src/api/PromptWebDeviceAccess.ts +2 -7
- package/src/api/SearchDevices.ts +31 -4
- package/src/api/UploadPortfolio.ts +58 -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/AllNetworkGetAddress.ts +21 -21
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +45 -32
- 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 +5 -0
- package/src/api/device/DeviceRebootToBootloader.ts +5 -0
- package/src/api/device/DeviceSettings.ts +195 -1
- package/src/api/device/DeviceSupportFeatures.ts +4 -0
- package/src/api/device/DeviceUnlock.ts +21 -3
- package/src/api/device/DeviceUpdateBootloader.ts +133 -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 +6 -2
- package/src/api/evm/EVMGetPublicKey.ts +6 -2
- package/src/api/evm/EVMSignMessage.ts +6 -2
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -11
- package/src/api/evm/EVMSignTransaction.ts +6 -2
- package/src/api/evm/EVMSignTypedData.ts +42 -50
- package/src/api/evm/EVMVerifyMessage.ts +6 -2
- 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/evm/protocol.ts +6 -0
- 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 +113 -0
- package/src/api/firmware/FirmwareMemoryHost.ts +142 -0
- package/src/api/firmware/FirmwarePreparationError.ts +12 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +102 -16
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +9 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +910 -0
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +456 -0
- package/src/api/firmware/getBinary.ts +8 -3
- package/src/api/firmware/protocolV2Release.ts +168 -0
- package/src/api/firmware/updateBootloader.ts +19 -4
- package/src/api/firmware/uploadFirmware.ts +157 -26
- 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 +392 -0
- package/src/api/index.ts +9 -28
- package/src/api/kaspa/KaspaGetAddress.ts +7 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +369 -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/polkadot/networks.ts +3 -3
- package/src/api/protocol-v2/DeviceFactoryInfoGet.ts +5 -2
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +5 -2
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +8 -5
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +10 -6
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +21 -0
- package/src/api/protocol-v2/DeviceInfoGet.ts +8 -15
- package/src/api/protocol-v2/DeviceReboot.ts +7 -3
- package/src/api/protocol-v2/DeviceStatusGet.ts +6 -1
- package/src/api/protocol-v2/DeviceUploadNft.ts +197 -0
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +134 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +5 -2
- package/src/api/protocol-v2/FilesystemPermissionFix.ts +5 -2
- package/src/api/protocol-v2/Ping.ts +37 -3
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +8 -3
- package/src/api/protocol-v2/helpers.ts +1 -4
- 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 +5 -1
- package/src/api/solana/SolSignOffchainMessage.ts +5 -1
- package/src/api/solana/SolSignTransaction.ts +6 -2
- 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 +5 -1
- package/src/api/sui/SuiGetPublicKey.ts +5 -1
- package/src/api/sui/SuiSignMessage.ts +5 -1
- package/src/api/sui/SuiSignTransaction.ts +5 -1
- package/src/api/ton/TonGetAddress.ts +5 -1
- package/src/api/ton/TonSignData.ts +5 -1
- package/src/api/ton/TonSignMessage.ts +5 -1
- package/src/api/ton/TonSignProof.ts +5 -1
- package/src/api/tron/TronGetAddress.ts +4 -0
- package/src/api/tron/TronSignMessage.ts +19 -8
- package/src/api/tron/TronSignTransaction.ts +5 -1
- package/src/api/utils.ts +32 -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 +27 -0
- package/src/core/index.ts +381 -152
- package/src/core/uiPromiseRegistry.ts +63 -0
- package/src/data/messages/messages-protocol-v2.json +1113 -547
- package/src/data/messages/messages.json +286 -9
- package/src/data-manager/DataManager.ts +154 -43
- package/src/data-manager/TransportManager.ts +7 -1
- package/src/data-manager/connectSettings.ts +11 -0
- package/src/device/Device.ts +858 -264
- package/src/device/DeviceCommands.ts +193 -158
- package/src/device/DeviceConnector.ts +44 -21
- package/src/device/DeviceFeaturesState.ts +25 -0
- package/src/device/DevicePool.ts +101 -23
- package/src/device/DeviceStateMapper.ts +416 -0
- package/src/device/DeviceStateProjector.ts +152 -0
- package/src/device/DeviceStateStore.ts +232 -0
- package/src/device/DeviceWalletSessionStore.ts +72 -6
- package/src/device/cloneDeviceState.ts +39 -0
- package/src/device/deviceIdentity.ts +18 -0
- package/src/deviceProfile/buildDeviceFeatures.ts +223 -189
- package/src/deviceProfile/index.ts +0 -1
- package/src/deviceProfile/protocolV2DeviceIdentity.ts +35 -0
- package/src/events/device.ts +22 -1
- package/src/events/logBlockEvent.ts +80 -2
- package/src/events/ui-promise.ts +4 -2
- package/src/events/ui-request.ts +61 -4
- package/src/events/ui-response.ts +12 -2
- package/src/index.ts +17 -0
- package/src/inject.ts +94 -47
- package/src/lowLevelInject.ts +11 -4
- package/src/protocols/protocol-v2/deviceSession.ts +24 -0
- package/src/protocols/protocol-v2/features.ts +100 -33
- package/src/protocols/protocol-v2/firmware.ts +3 -1
- package/src/protocols/protocol-v2/index.ts +7 -1
- package/src/protocols/protocol-v2/resources.ts +210 -0
- package/src/protocols/protocol-v2/settingsUnlockPolicy.ts +65 -0
- package/src/protocols/protocol-v2/uiInteraction.ts +250 -0
- package/src/protocols/protocol-v2/unlockPolicy.ts +1 -0
- package/src/protocols/protocol-v2/unlockPolicyRunner.ts +131 -0
- package/src/protocols/protocol-v2/walletSession.ts +422 -42
- package/src/topLevelInject.ts +11 -4
- package/src/types/api/checkAllFirmwareRelease.ts +72 -9
- package/src/types/api/checkBLEFirmwareRelease.ts +4 -13
- package/src/types/api/checkBootloaderRelease.ts +2 -6
- package/src/types/api/checkFirmwareRelease.ts +2 -13
- package/src/types/api/checkFirmwareTypeAvailable.ts +2 -2
- package/src/types/api/detectDeviceConnectProtocol.ts +6 -0
- package/src/types/api/deviceSettings.ts +26 -2
- package/src/types/api/deviceUnlock.ts +13 -2
- package/src/types/api/deviceUpdateBootloader.ts +6 -0
- package/src/types/api/export.ts +33 -1
- package/src/types/api/firmwareUpdate.ts +95 -11
- 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 +49 -68
- package/src/types/api/kaspaSignTransaction.ts +60 -4
- package/src/types/api/openWalletSession.ts +54 -0
- package/src/types/api/protocolV2.ts +33 -155
- package/src/types/api/sessionCache.ts +9 -4
- package/src/types/device.ts +216 -10
- package/src/types/params.ts +9 -2
- package/src/types/settings.ts +67 -25
- package/src/utils/assets.ts +4 -1
- package/src/utils/deviceFeaturesCompat.ts +191 -0
- package/src/utils/deviceFeaturesUtils.ts +45 -17
- package/src/utils/deviceInfoUtils.ts +29 -69
- package/src/utils/deviceSettings.ts +174 -39
- package/src/utils/deviceVersionUtils.ts +25 -44
- package/src/utils/findDefectiveBatchDevice.ts +3 -3
- package/src/utils/homescreen.ts +40 -0
- package/src/utils/index.ts +27 -3
- package/src/utils/networkUtils.ts +274 -16
- package/src/utils/pro2Nft.ts +142 -0
- package/src/utils/pro2Wallpaper.ts +130 -0
- package/src/utils/tracing.ts +3 -1
- package/src/utils/uiProgressThrottle.ts +63 -0
- package/tsconfig.type-tests.json +12 -0
- package/dist/api/GetDeviceInfo.d.ts +0 -9
- package/dist/api/GetDeviceInfo.d.ts.map +0 -1
- package/dist/api/firmware/progressThrottle.d.ts +0 -3
- package/dist/api/firmware/progressThrottle.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceSessionGet.d.ts +0 -9
- package/dist/api/protocol-v2/DeviceSessionGet.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/deviceProfile/buildDeviceProfile.d.ts +0 -21
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +0 -1
- package/dist/types/api/getDeviceInfo.d.ts +0 -87
- package/dist/types/api/getDeviceInfo.d.ts.map +0 -1
- package/src/api/GetDeviceInfo.ts +0 -145
- package/src/api/firmware/progressThrottle.ts +0 -44
- package/src/api/protocol-v2/DeviceSessionGet.ts +0 -26
- package/src/api/protocol-v2/FilesystemDiskControl.ts +0 -50
- package/src/deviceProfile/buildDeviceProfile.ts +0 -352
- package/src/types/api/getDeviceInfo.ts +0 -101
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
|
+
import { DeviceSessionPinType, DeviceSessionSeedDomain } from '@onekeyfe/hd-transport';
|
|
2
3
|
|
|
4
|
+
import { DEVICE } from '../../events';
|
|
5
|
+
import { assertCompleteDeviceSession } from './deviceSession';
|
|
6
|
+
|
|
7
|
+
import type { DeviceSessionAskPassphrase, DeviceSessionGet } from '@onekeyfe/hd-transport';
|
|
3
8
|
import type { Device } from '../../device/Device';
|
|
4
9
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const HOST_PASSPHRASE_MAX_BYTES = 50;
|
|
11
|
+
|
|
12
|
+
const isWalletSessionInvalidError = (error: unknown) =>
|
|
13
|
+
typeof error === 'object' &&
|
|
14
|
+
error !== null &&
|
|
15
|
+
'errorCode' in error &&
|
|
16
|
+
(error as { errorCode?: unknown }).errorCode === HardwareErrorCode.WalletSessionInvalid;
|
|
17
|
+
|
|
18
|
+
const utf8ByteLength = (value: string): number | undefined => {
|
|
19
|
+
let length = 0;
|
|
20
|
+
for (const character of value) {
|
|
21
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
22
|
+
if (codePoint >= 0xd800 && codePoint <= 0xdfff) return undefined;
|
|
23
|
+
if (codePoint <= 0x7f) length += 1;
|
|
24
|
+
else if (codePoint <= 0x7ff) length += 2;
|
|
25
|
+
else if (codePoint <= 0xffff) length += 3;
|
|
26
|
+
else length += 4;
|
|
13
27
|
}
|
|
14
|
-
return
|
|
28
|
+
return length;
|
|
15
29
|
};
|
|
16
30
|
|
|
17
|
-
export const isProtocolV2InvalidSessionError = (error: unknown) =>
|
|
18
|
-
getErrorText(error).toLowerCase().includes('failure_invalidsession');
|
|
19
|
-
|
|
20
31
|
export async function requestProtocolV2DeviceStatus(device: Device) {
|
|
21
32
|
const { message } = await device.commands.typedCall('DeviceStatusGet', 'DeviceStatus', {});
|
|
22
33
|
return message;
|
|
@@ -27,57 +38,426 @@ export async function refreshProtocolV2DeviceStatus(device: Device) {
|
|
|
27
38
|
return device.updateProtocolV2Status(status);
|
|
28
39
|
}
|
|
29
40
|
|
|
41
|
+
export async function ensureProtocolV2WalletSessionUnlocked(device: Device) {
|
|
42
|
+
if (!device.isProtocolV2() || device.isBootloader?.() || device.isRomloader?.()) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
await refreshProtocolV2DeviceStatus(device);
|
|
47
|
+
if (device.state?.status.unlocked !== false) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
await device.unlockDevice(DeviceSessionPinType.Main, {
|
|
52
|
+
source: 'unlock-coordinator',
|
|
53
|
+
reason: 'device-locked',
|
|
54
|
+
deviceOnly: true,
|
|
55
|
+
});
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const negotiateEventlessWalletSession = async (device: Device) => {
|
|
60
|
+
await device.ensureProtocolV2RuntimeContext();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getDeviceSession = async (device: Device, request: DeviceSessionGet) =>
|
|
64
|
+
device.commands.typedCall('DeviceSessionGet', 'DeviceSession', request);
|
|
65
|
+
|
|
66
|
+
const buildDeviceSessionGetRequest = ({
|
|
67
|
+
sessionId,
|
|
68
|
+
expectedPassphraseState,
|
|
69
|
+
deriveCardano,
|
|
70
|
+
}: {
|
|
71
|
+
sessionId?: string;
|
|
72
|
+
expectedPassphraseState?: string;
|
|
73
|
+
deriveCardano?: boolean;
|
|
74
|
+
} = {}): DeviceSessionGet => ({
|
|
75
|
+
...(sessionId ? { session_id: sessionId } : {}),
|
|
76
|
+
...(expectedPassphraseState ? { btc_test_address: expectedPassphraseState } : {}),
|
|
77
|
+
seed_domains:
|
|
78
|
+
deriveCardano === undefined
|
|
79
|
+
? []
|
|
80
|
+
: [
|
|
81
|
+
DeviceSessionSeedDomain.SeedDomain_Standard,
|
|
82
|
+
...(deriveCardano ? [DeviceSessionSeedDomain.SeedDomain_Cardano] : []),
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const askDevicePassphrase = async (device: Device, requestPayload: DeviceSessionAskPassphrase) => {
|
|
87
|
+
await device.commands.typedCall('DeviceSessionAskPassphrase', 'Success', requestPayload);
|
|
88
|
+
await refreshProtocolV2DeviceStatus(device);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const selectDeviceSession = async (
|
|
92
|
+
device: Device,
|
|
93
|
+
expectedPassphraseState?: string,
|
|
94
|
+
deriveCardano?: boolean
|
|
95
|
+
) => {
|
|
96
|
+
const existsAttachPinUser = device.features?.attachToPinEnabled === true;
|
|
97
|
+
const metadata = {
|
|
98
|
+
source: 'wallet-session-coordinator' as const,
|
|
99
|
+
reason: expectedPassphraseState ? ('session-recovery' as const) : ('open-wallet' as const),
|
|
100
|
+
...(expectedPassphraseState ? { expectedPassphraseState } : {}),
|
|
101
|
+
};
|
|
102
|
+
const passphraseInteraction = device.createProtocolV2UiPhaseMetadata?.('passphrase', 'start');
|
|
103
|
+
const response = await device.commands.promptPassphrase(
|
|
104
|
+
{
|
|
105
|
+
existsAttachPinUser,
|
|
106
|
+
deviceOnly: false,
|
|
107
|
+
...metadata,
|
|
108
|
+
...(passphraseInteraction ? { interaction: passphraseInteraction } : {}),
|
|
109
|
+
},
|
|
110
|
+
{ cancelDeviceOnReject: false }
|
|
111
|
+
);
|
|
112
|
+
const hostPassphrase =
|
|
113
|
+
typeof response.passphrase === 'string' ? response.passphrase.normalize('NFKD') : undefined;
|
|
114
|
+
const hasHostPassphrase = typeof hostPassphrase === 'string' && hostPassphrase.length > 0;
|
|
115
|
+
const hostPassphraseByteLength = hasHostPassphrase ? utf8ByteLength(hostPassphrase) : undefined;
|
|
116
|
+
if (
|
|
117
|
+
hasHostPassphrase &&
|
|
118
|
+
(hostPassphrase.includes('\0') ||
|
|
119
|
+
hostPassphraseByteLength === undefined ||
|
|
120
|
+
hostPassphraseByteLength > HOST_PASSPHRASE_MAX_BYTES)
|
|
121
|
+
) {
|
|
122
|
+
throw ERRORS.TypedError(
|
|
123
|
+
HardwareErrorCode.RuntimeError,
|
|
124
|
+
`Host passphrase must contain 1 to ${HOST_PASSPHRASE_MAX_BYTES} valid UTF-8 bytes without NUL.`
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
const selections = [
|
|
128
|
+
hasHostPassphrase,
|
|
129
|
+
response.passphraseOnDevice === true,
|
|
130
|
+
response.attachPinOnDevice === true,
|
|
131
|
+
].filter(Boolean).length;
|
|
132
|
+
|
|
133
|
+
if (selections !== 1) {
|
|
134
|
+
throw ERRORS.TypedError(
|
|
135
|
+
HardwareErrorCode.RuntimeError,
|
|
136
|
+
'Wallet selection must contain exactly one passphrase access mode.'
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (response.attachPinOnDevice) {
|
|
141
|
+
if (!existsAttachPinUser) {
|
|
142
|
+
throw ERRORS.TypedError(
|
|
143
|
+
HardwareErrorCode.RuntimeError,
|
|
144
|
+
'Attach PIN wallet selection is unavailable on this device.'
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
const attachPinInteraction = device.createProtocolV2UiPhaseMetadata?.('pin', 'start');
|
|
148
|
+
device.emit(DEVICE.ATTACH_PIN_ON_DEVICE, device, {
|
|
149
|
+
...metadata,
|
|
150
|
+
...(attachPinInteraction ? { interaction: attachPinInteraction } : {}),
|
|
151
|
+
});
|
|
152
|
+
await device.unlockDevice(DeviceSessionPinType.AttachToPin, {
|
|
153
|
+
emitUiEvent: false,
|
|
154
|
+
interaction: attachPinInteraction,
|
|
155
|
+
});
|
|
156
|
+
return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (hasHostPassphrase) {
|
|
160
|
+
await askDevicePassphrase(device, {
|
|
161
|
+
passphrase: hostPassphrase,
|
|
162
|
+
on_device: false,
|
|
163
|
+
});
|
|
164
|
+
return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const passphraseOnDeviceInteraction = device.createProtocolV2UiPhaseMetadata?.(
|
|
168
|
+
'passphrase-on-device',
|
|
169
|
+
'start'
|
|
170
|
+
);
|
|
171
|
+
device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, {
|
|
172
|
+
...metadata,
|
|
173
|
+
...(passphraseOnDeviceInteraction ? { interaction: passphraseOnDeviceInteraction } : {}),
|
|
174
|
+
});
|
|
175
|
+
await askDevicePassphrase(device, { on_device: true });
|
|
176
|
+
return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
|
|
177
|
+
};
|
|
178
|
+
|
|
30
179
|
export async function getProtocolV2WalletSession(
|
|
31
180
|
device: Device,
|
|
32
|
-
options?: {
|
|
181
|
+
options?: {
|
|
182
|
+
forceWalletSelection?: boolean;
|
|
183
|
+
/** @deprecated 兼容旧 getPassphraseState;新流程使用 forceWalletSelection。 */
|
|
184
|
+
initSession?: boolean;
|
|
185
|
+
expectedPassphraseState?: string;
|
|
186
|
+
onlyMainPin?: boolean;
|
|
187
|
+
/** 业务安全校验遇到 Attach PIN 上下文时直接拒绝,不主动切换钱包。 */
|
|
188
|
+
rejectAttachPinForMainWallet?: boolean;
|
|
189
|
+
selectMainWalletBeforeRestore?: boolean;
|
|
190
|
+
resumeOnly?: boolean;
|
|
191
|
+
deriveCardano?: boolean;
|
|
192
|
+
/** Read the wallet already selected by Attach PIN without reopening wallet selection. */
|
|
193
|
+
readCurrentAttachPinSession?: boolean;
|
|
194
|
+
}
|
|
33
195
|
) {
|
|
34
|
-
|
|
35
|
-
|
|
196
|
+
const forceWalletSelection =
|
|
197
|
+
options?.forceWalletSelection === true || options?.initSession === true;
|
|
198
|
+
const readCurrentAttachPinSession = options?.readCurrentAttachPinSession === true;
|
|
199
|
+
|
|
200
|
+
if (forceWalletSelection) {
|
|
201
|
+
if (options.onlyMainPin) {
|
|
202
|
+
device.clearStandardInternalState?.();
|
|
203
|
+
} else {
|
|
204
|
+
device.clearInternalState();
|
|
205
|
+
}
|
|
206
|
+
device.passphraseState = undefined;
|
|
36
207
|
}
|
|
37
208
|
|
|
38
|
-
|
|
39
|
-
|
|
209
|
+
await negotiateEventlessWalletSession(device);
|
|
210
|
+
|
|
211
|
+
if (options?.onlyMainPin || readCurrentAttachPinSession) {
|
|
212
|
+
device.passphraseState = undefined;
|
|
40
213
|
}
|
|
214
|
+
let expectedPassphraseState =
|
|
215
|
+
options?.onlyMainPin || readCurrentAttachPinSession
|
|
216
|
+
? undefined
|
|
217
|
+
: options?.expectedPassphraseState ?? device.passphraseState;
|
|
41
218
|
|
|
219
|
+
const cachedStandardSession = options?.onlyMainPin
|
|
220
|
+
? device.getStandardInternalState?.()
|
|
221
|
+
: undefined;
|
|
42
222
|
const cachedSessionId =
|
|
43
|
-
|
|
223
|
+
!options?.onlyMainPin &&
|
|
224
|
+
!readCurrentAttachPinSession &&
|
|
225
|
+
typeof device.getInternalState === 'function'
|
|
226
|
+
? device.getInternalState()
|
|
227
|
+
: undefined;
|
|
228
|
+
let response;
|
|
229
|
+
let resumed = false;
|
|
230
|
+
let mainPinSelected =
|
|
231
|
+
options?.onlyMainPin === true &&
|
|
232
|
+
device.features?.unlocked === true &&
|
|
233
|
+
device.features?.unlockedAttachPin === false;
|
|
44
234
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
235
|
+
const clearCurrentWalletSession = () => {
|
|
236
|
+
if (options?.onlyMainPin) {
|
|
237
|
+
device.clearStandardInternalState?.();
|
|
238
|
+
} else {
|
|
239
|
+
device.clearInternalState();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const rejectMismatchedAttachPinWallet = async () => {
|
|
244
|
+
const features = await refreshProtocolV2DeviceStatus(device);
|
|
245
|
+
if (features.unlockedAttachPin !== true) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
await device.lockDevice();
|
|
251
|
+
} catch {
|
|
252
|
+
// Reject the mismatched Attach PIN wallet even when older firmware cannot lock.
|
|
253
|
+
}
|
|
254
|
+
if (options?.rejectAttachPinForMainWallet) {
|
|
255
|
+
device.clearStandardInternalState?.();
|
|
256
|
+
device.clearInternalState();
|
|
257
|
+
} else {
|
|
258
|
+
clearCurrentWalletSession();
|
|
259
|
+
}
|
|
260
|
+
throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckUnlockTypeError);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
if (options?.onlyMainPin && options.rejectAttachPinForMainWallet) {
|
|
264
|
+
await rejectMismatchedAttachPinWallet();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const selectMainPin = async (force = false) => {
|
|
268
|
+
if (force || !mainPinSelected) {
|
|
269
|
+
await device.unlockDevice(DeviceSessionPinType.Main, {
|
|
270
|
+
source: 'wallet-session-coordinator',
|
|
271
|
+
reason: expectedPassphraseState ? 'session-recovery' : 'open-wallet',
|
|
272
|
+
deviceOnly: true,
|
|
273
|
+
});
|
|
274
|
+
mainPinSelected = true;
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const selectStandardWallet = async () => {
|
|
279
|
+
// Main PIN authenticates the device; an empty host passphrase selects the standard derivation.
|
|
280
|
+
await selectMainPin();
|
|
281
|
+
if (device.features?.passphraseProtection === true) {
|
|
282
|
+
await askDevicePassphrase(device, {
|
|
283
|
+
passphrase: '',
|
|
284
|
+
on_device: false,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
};
|
|
51
288
|
|
|
289
|
+
if (readCurrentAttachPinSession) {
|
|
290
|
+
const status = await requestProtocolV2DeviceStatus(device);
|
|
291
|
+
device.updateProtocolV2Status(status);
|
|
52
292
|
if (
|
|
53
|
-
|
|
54
|
-
|
|
293
|
+
status.unlocked !== true ||
|
|
294
|
+
status.passphrase_enabled !== true ||
|
|
295
|
+
status.unlocked_by_attach_to_pin !== true
|
|
55
296
|
) {
|
|
56
297
|
device.clearInternalState();
|
|
57
|
-
throw ERRORS.TypedError(HardwareErrorCode.
|
|
298
|
+
throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckUnlockTypeError);
|
|
299
|
+
}
|
|
300
|
+
response = await getDeviceSession(
|
|
301
|
+
device,
|
|
302
|
+
buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
|
|
303
|
+
);
|
|
304
|
+
} else if (options?.onlyMainPin) {
|
|
305
|
+
expectedPassphraseState = cachedStandardSession?.passphraseState;
|
|
306
|
+
if (cachedStandardSession) {
|
|
307
|
+
try {
|
|
308
|
+
if (options?.selectMainWalletBeforeRestore) {
|
|
309
|
+
await selectMainPin();
|
|
310
|
+
}
|
|
311
|
+
response = await getDeviceSession(
|
|
312
|
+
device,
|
|
313
|
+
buildDeviceSessionGetRequest({
|
|
314
|
+
sessionId: cachedStandardSession.sessionId,
|
|
315
|
+
expectedPassphraseState,
|
|
316
|
+
deriveCardano: options?.deriveCardano,
|
|
317
|
+
})
|
|
318
|
+
);
|
|
319
|
+
resumed = true;
|
|
320
|
+
} catch (error) {
|
|
321
|
+
device.clearStandardInternalState?.();
|
|
322
|
+
if (!isWalletSessionInvalidError(error)) {
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
resumed = false;
|
|
326
|
+
}
|
|
58
327
|
}
|
|
59
328
|
|
|
60
|
-
if (
|
|
61
|
-
await
|
|
329
|
+
if (!response) {
|
|
330
|
+
await selectStandardWallet();
|
|
331
|
+
response = await getDeviceSession(
|
|
332
|
+
device,
|
|
333
|
+
buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
} else if (cachedSessionId && expectedPassphraseState) {
|
|
337
|
+
try {
|
|
338
|
+
response = await getDeviceSession(
|
|
339
|
+
device,
|
|
340
|
+
buildDeviceSessionGetRequest({
|
|
341
|
+
sessionId: cachedSessionId,
|
|
342
|
+
expectedPassphraseState,
|
|
343
|
+
deriveCardano: options?.deriveCardano,
|
|
344
|
+
})
|
|
345
|
+
);
|
|
346
|
+
resumed = true;
|
|
347
|
+
} catch (error) {
|
|
348
|
+
device.clearInternalState();
|
|
349
|
+
if (options?.resumeOnly || !isWalletSessionInvalidError(error)) {
|
|
350
|
+
throw error;
|
|
351
|
+
}
|
|
352
|
+
resumed = false;
|
|
353
|
+
}
|
|
354
|
+
} else if (expectedPassphraseState) {
|
|
355
|
+
try {
|
|
356
|
+
response = await getDeviceSession(
|
|
357
|
+
device,
|
|
358
|
+
buildDeviceSessionGetRequest({
|
|
359
|
+
expectedPassphraseState,
|
|
360
|
+
deriveCardano: options?.deriveCardano,
|
|
361
|
+
})
|
|
362
|
+
);
|
|
363
|
+
} catch (error) {
|
|
364
|
+
if (options?.resumeOnly || !isWalletSessionInvalidError(error)) {
|
|
365
|
+
throw error;
|
|
366
|
+
}
|
|
62
367
|
}
|
|
368
|
+
}
|
|
63
369
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
370
|
+
if (!response) {
|
|
371
|
+
if (options?.resumeOnly) {
|
|
372
|
+
device.clearInternalState();
|
|
373
|
+
throw ERRORS.TypedError(HardwareErrorCode.WalletSessionInvalid);
|
|
374
|
+
}
|
|
375
|
+
response = await selectDeviceSession(device, expectedPassphraseState, options?.deriveCardano);
|
|
376
|
+
}
|
|
71
377
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
unlockedAttachPin: device.features?.unlockedAttachPin ?? undefined,
|
|
76
|
-
};
|
|
378
|
+
let { message } = response;
|
|
379
|
+
try {
|
|
380
|
+
assertCompleteDeviceSession(message);
|
|
77
381
|
} catch (error) {
|
|
78
|
-
if (
|
|
382
|
+
if (options?.onlyMainPin) {
|
|
383
|
+
device.clearStandardInternalState?.();
|
|
384
|
+
} else {
|
|
79
385
|
device.clearInternalState();
|
|
80
386
|
}
|
|
81
387
|
throw error;
|
|
82
388
|
}
|
|
389
|
+
if (expectedPassphraseState && expectedPassphraseState !== message.btc_test_address) {
|
|
390
|
+
resumed = false;
|
|
391
|
+
await rejectMismatchedAttachPinWallet();
|
|
392
|
+
if (options?.resumeOnly) {
|
|
393
|
+
device.clearInternalState();
|
|
394
|
+
throw ERRORS.TypedError(HardwareErrorCode.WalletSessionInvalid);
|
|
395
|
+
}
|
|
396
|
+
if (options?.onlyMainPin) {
|
|
397
|
+
device.clearStandardInternalState?.();
|
|
398
|
+
await selectStandardWallet();
|
|
399
|
+
response = await getDeviceSession(
|
|
400
|
+
device,
|
|
401
|
+
buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
|
|
402
|
+
);
|
|
403
|
+
} else {
|
|
404
|
+
device.clearInternalState();
|
|
405
|
+
response = await selectDeviceSession(device, expectedPassphraseState, options?.deriveCardano);
|
|
406
|
+
}
|
|
407
|
+
message = response.message;
|
|
408
|
+
try {
|
|
409
|
+
assertCompleteDeviceSession(message);
|
|
410
|
+
} catch (error) {
|
|
411
|
+
if (options?.onlyMainPin) {
|
|
412
|
+
device.clearStandardInternalState?.();
|
|
413
|
+
} else {
|
|
414
|
+
device.clearInternalState();
|
|
415
|
+
}
|
|
416
|
+
throw error;
|
|
417
|
+
}
|
|
418
|
+
if (expectedPassphraseState !== message.btc_test_address) {
|
|
419
|
+
await rejectMismatchedAttachPinWallet();
|
|
420
|
+
clearCurrentWalletSession();
|
|
421
|
+
throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckPassphraseStateError);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const internalStateArgs = [
|
|
426
|
+
true,
|
|
427
|
+
message.btc_test_address,
|
|
428
|
+
device.getCurrentDeviceId(),
|
|
429
|
+
message.session_id,
|
|
430
|
+
forceWalletSelection ? null : cachedSessionId ?? null,
|
|
431
|
+
] as const;
|
|
432
|
+
if (options?.onlyMainPin) {
|
|
433
|
+
device.updateInternalState(...internalStateArgs, 'standard');
|
|
434
|
+
} else {
|
|
435
|
+
device.updateInternalState(...internalStateArgs);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
let unlockedAttachPin: boolean | undefined;
|
|
439
|
+
if (readCurrentAttachPinSession) {
|
|
440
|
+
unlockedAttachPin = true;
|
|
441
|
+
} else if (mainPinSelected) {
|
|
442
|
+
unlockedAttachPin = false;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return {
|
|
446
|
+
passphraseState: message.btc_test_address,
|
|
447
|
+
newSession: message.session_id,
|
|
448
|
+
unlockedAttachPin,
|
|
449
|
+
resumed,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export async function restoreProtocolV2WalletSession(
|
|
454
|
+
device: Device,
|
|
455
|
+
expectedPassphraseState: string,
|
|
456
|
+
deriveCardano?: boolean
|
|
457
|
+
) {
|
|
458
|
+
return getProtocolV2WalletSession(device, {
|
|
459
|
+
expectedPassphraseState,
|
|
460
|
+
resumeOnly: true,
|
|
461
|
+
deriveCardano,
|
|
462
|
+
});
|
|
83
463
|
}
|
package/src/topLevelInject.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import EventEmitter from 'events';
|
|
2
2
|
|
|
3
|
-
import { createCoreApi } from './inject';
|
|
3
|
+
import { createCoreApi, createProtocolAwareCall } from './inject';
|
|
4
|
+
import { unregisterFirmwareUpdateHostBinding } from './api/firmware/FirmwareHostBinding';
|
|
4
5
|
|
|
5
6
|
import type { ConnectSettings } from './types/settings';
|
|
6
7
|
import type { CoreApi } from './types/api';
|
|
@@ -19,6 +20,7 @@ export const topLevelInject = () => {
|
|
|
19
20
|
if (!lowLevelApi) return Promise.resolve(undefined);
|
|
20
21
|
return lowLevelApi.call(params);
|
|
21
22
|
};
|
|
23
|
+
const protocolAwareCall = createProtocolAwareCall(call);
|
|
22
24
|
const api: CoreApi = {
|
|
23
25
|
on: <T extends string, P extends (...args: any[]) => any>(type: T, fn: P) => {
|
|
24
26
|
eventEmitter.on(type, fn);
|
|
@@ -37,16 +39,21 @@ export const topLevelInject = () => {
|
|
|
37
39
|
return lowLevelApi?.init(settings) ?? Promise.resolve(false);
|
|
38
40
|
},
|
|
39
41
|
|
|
40
|
-
call,
|
|
42
|
+
call: protocolAwareCall.call,
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
setDeviceConnectProtocol: protocolAwareCall.setDeviceConnectProtocol,
|
|
45
|
+
|
|
46
|
+
...createCoreApi(protocolAwareCall.call),
|
|
43
47
|
|
|
44
48
|
removeAllListeners: type => {
|
|
45
49
|
eventEmitter.removeAllListeners(type);
|
|
46
50
|
lowLevelApi?.removeAllListeners(type);
|
|
47
51
|
},
|
|
48
52
|
|
|
49
|
-
dispose: () =>
|
|
53
|
+
dispose: async () => {
|
|
54
|
+
unregisterFirmwareUpdateHostBinding();
|
|
55
|
+
await lowLevelApi?.dispose();
|
|
56
|
+
},
|
|
50
57
|
|
|
51
58
|
uiResponse: response => lowLevelApi?.uiResponse(response),
|
|
52
59
|
|
|
@@ -1,31 +1,94 @@
|
|
|
1
|
-
import type { IBLEFirmwareReleaseInfo } from '../settings';
|
|
2
1
|
import type { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
3
|
-
import type { Features } from '@onekeyfe/hd-transport';
|
|
4
2
|
import type { CommonParams, Response } from '../params';
|
|
5
|
-
import type {
|
|
3
|
+
import type { DeviceStateVersions, Features, IDeviceFirmwareStatus } from '../device';
|
|
4
|
+
import type {
|
|
5
|
+
IBLEFirmwareReleaseInfo,
|
|
6
|
+
IFirmwareReleaseInfo,
|
|
7
|
+
IProtocolV2FirmwareComponent,
|
|
8
|
+
IProtocolV2FirmwareComponentTarget,
|
|
9
|
+
IProtocolV2ResourceSource,
|
|
10
|
+
} from '../settings';
|
|
11
|
+
import type { FirmwareUpdateV4Target } from './firmwareUpdate';
|
|
12
|
+
import type { FirmwareUpdatePlan, FirmwareUpdatePlanForceTarget } from './firmwareUpdatePlan';
|
|
6
13
|
|
|
7
|
-
export type
|
|
14
|
+
export type ProtocolV2ComponentReleaseInfo = IProtocolV2FirmwareComponent & {
|
|
15
|
+
protocol: 'V2';
|
|
16
|
+
configKey: string;
|
|
17
|
+
componentTarget: IProtocolV2FirmwareComponentTarget;
|
|
18
|
+
required: boolean;
|
|
19
|
+
changelog: IFirmwareReleaseInfo['changelog'];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type FirmwareReleaseCheckResult = {
|
|
8
23
|
shouldUpdate?: boolean;
|
|
9
24
|
status: IDeviceFirmwareStatus;
|
|
10
25
|
changelog?: {
|
|
11
26
|
'zh-CN': string;
|
|
12
27
|
'en-US': string;
|
|
13
28
|
}[];
|
|
14
|
-
release:
|
|
29
|
+
release:
|
|
30
|
+
| IBLEFirmwareReleaseInfo
|
|
31
|
+
| IFirmwareReleaseInfo
|
|
32
|
+
| ProtocolV2ComponentReleaseInfo
|
|
33
|
+
| undefined;
|
|
15
34
|
bootloaderMode?: boolean;
|
|
16
35
|
};
|
|
17
36
|
|
|
37
|
+
export type BridgeReleaseCheckResult = Omit<FirmwareReleaseCheckResult, 'release'> & {
|
|
38
|
+
release: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type ProtocolV2FirmwareComponentReleaseStatus =
|
|
42
|
+
| 'valid'
|
|
43
|
+
| 'outdated'
|
|
44
|
+
| 'unknown'
|
|
45
|
+
| 'unsupported';
|
|
46
|
+
|
|
47
|
+
export type ProtocolV2FirmwareReleaseStatus =
|
|
48
|
+
| 'unavailable'
|
|
49
|
+
| 'valid'
|
|
50
|
+
| 'unknown'
|
|
51
|
+
| 'outdated'
|
|
52
|
+
| 'required';
|
|
53
|
+
|
|
54
|
+
export type ProtocolV2FirmwareComponentRelease = {
|
|
55
|
+
configKey: string;
|
|
56
|
+
componentTarget: IProtocolV2FirmwareComponentTarget;
|
|
57
|
+
updateTarget: FirmwareUpdateV4Target | null;
|
|
58
|
+
currentVersion: string | null;
|
|
59
|
+
targetVersion: string | null;
|
|
60
|
+
status: ProtocolV2FirmwareComponentReleaseStatus;
|
|
61
|
+
required: boolean;
|
|
62
|
+
};
|
|
63
|
+
|
|
18
64
|
export type AllFirmwareRelease = {
|
|
19
|
-
firmware:
|
|
20
|
-
ble:
|
|
21
|
-
bootloader?:
|
|
22
|
-
bridge?:
|
|
65
|
+
firmware: FirmwareReleaseCheckResult;
|
|
66
|
+
ble: FirmwareReleaseCheckResult;
|
|
67
|
+
bootloader?: FirmwareReleaseCheckResult;
|
|
68
|
+
bridge?: BridgeReleaseCheckResult;
|
|
23
69
|
features?: Features;
|
|
70
|
+
protocol?: 'V1' | 'V2';
|
|
71
|
+
deviceType?: 'pro2' | 'neo';
|
|
72
|
+
firmwareType?: EFirmwareType;
|
|
73
|
+
status?: ProtocolV2FirmwareReleaseStatus;
|
|
74
|
+
hasUpgrade?: boolean;
|
|
75
|
+
required?: boolean;
|
|
76
|
+
resourceStatus?: 'valid' | 'outdated' | 'unknown';
|
|
77
|
+
resourceArchive?: IProtocolV2ResourceSource;
|
|
78
|
+
currentVersions?: DeviceStateVersions;
|
|
79
|
+
components?: ProtocolV2FirmwareComponentRelease[];
|
|
80
|
+
targetsToUpdate?: FirmwareUpdateV4Target[];
|
|
81
|
+
release?: IFirmwareReleaseInfo;
|
|
82
|
+
firmwareUpdatePlan?: FirmwareUpdatePlan;
|
|
24
83
|
};
|
|
25
84
|
|
|
26
85
|
export type CheckAllFirmwareReleaseParams = {
|
|
27
86
|
checkBridgeRelease?: boolean;
|
|
87
|
+
checkFirmwareHash?: boolean;
|
|
28
88
|
firmwareType?: EFirmwareType;
|
|
89
|
+
platform?: 'native' | 'desktop' | 'ext' | 'web' | 'web-embed';
|
|
90
|
+
forceUpdateTargets?: FirmwareUpdatePlanForceTarget[];
|
|
91
|
+
protocolV2ForceUpdateTargets?: FirmwareUpdateV4Target[];
|
|
29
92
|
};
|
|
30
93
|
|
|
31
94
|
export declare function checkAllFirmwareRelease(
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import type { IBLEFirmwareReleaseInfo } from '../settings';
|
|
2
1
|
import type { Response } from '../params';
|
|
3
|
-
import type {
|
|
2
|
+
import type { FirmwareReleaseCheckResult } from './checkAllFirmwareRelease';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
'zh-CN': string;
|
|
9
|
-
'en-US': string;
|
|
10
|
-
}[];
|
|
11
|
-
release: IBLEFirmwareReleaseInfo;
|
|
12
|
-
bootloaderMode: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export declare function checkBLEFirmwareRelease(connectId?: string): Response<BleFirmwareRelease>;
|
|
4
|
+
export declare function checkBLEFirmwareRelease(
|
|
5
|
+
connectId?: string
|
|
6
|
+
): Response<FirmwareReleaseCheckResult | null>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
2
2
|
import type { CommonParams, Response } from '../params';
|
|
3
|
+
import type { FirmwareReleaseCheckResult } from './checkAllFirmwareRelease';
|
|
3
4
|
|
|
4
|
-
export type CheckBootloaderReleaseResponse =
|
|
5
|
-
shouldUpdate: boolean;
|
|
6
|
-
status: 'outdated' | 'valid';
|
|
7
|
-
release: string | undefined;
|
|
8
|
-
bootloaderMode: boolean;
|
|
9
|
-
} | null;
|
|
5
|
+
export type CheckBootloaderReleaseResponse = FirmwareReleaseCheckResult | null;
|
|
10
6
|
|
|
11
7
|
export type CheckBootloaderReleaseParams = {
|
|
12
8
|
willUpdateFirmwareVersion?: string;
|