@onekeyfe/hd-core 1.2.0-alpha.24 → 1.2.0-alpha.25
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 +2 -0
- package/__tests__/chain-params-onekey-compatibility.test.ts +229 -0
- package/__tests__/connectSettings.test.ts +47 -5
- package/__tests__/device-state-events.test.ts +124 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +3 -1
- package/__tests__/firmware-update/check-all-firmware-release.test.ts +127 -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-update-capabilities.test.ts +13 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +354 -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 +39 -30
- package/__tests__/firmware-update/firmware-upload-source.test.ts +70 -0
- package/__tests__/kaspa-public-types.type-test.ts +16 -0
- package/__tests__/kaspaSignTransaction.test.ts +4 -3
- package/__tests__/method-protocol-support.test.ts +113 -0
- package/__tests__/protocol-v2.test.ts +271 -117
- package/__tests__/public-device-state-api.test.ts +10 -8
- package/__tests__/tron-sign-message-init.test.ts +46 -0
- package/dist/api/BaseMethod.d.ts +6 -2
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.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/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 +1 -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 +11 -0
- 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 +23 -5
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetDeviceState.d.ts +1 -0
- package/dist/api/GetDeviceState.d.ts.map +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 +1 -0
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/OpenWalletSession.d.ts +1 -0
- package/dist/api/OpenWalletSession.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts +1 -0
- package/dist/api/PathInfo.d.ts.map +1 -1
- 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 +1 -0
- package/dist/api/conflux/ConfluxGetAddress.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessage.d.ts +1 -0
- package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts +1 -0
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts +1 -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/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/FirmwareUpdateBaseMethod.d.ts +7 -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 +23 -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 +7 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- 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/kaspa/KaspaGetAddress.d.ts +1 -0
- package/dist/api/kaspa/KaspaGetAddress.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts +1 -0
- 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.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 +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 +1 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts +1 -0
- 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/DeviceUploadWallpaper.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
- 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 +1 -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/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 +1 -0
- 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 +2 -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/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/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -0
- 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 +3 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/index.d.ts +271 -87
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2844 -882
- package/dist/inject.d.ts.map +1 -1
- package/dist/lowLevelInject.d.ts.map +1 -1
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +3 -0
- package/dist/types/api/checkAllFirmwareRelease.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 +69 -0
- 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 +27 -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/index.d.ts +9 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/kaspaSignTransaction.d.ts +15 -2
- package/dist/types/api/kaspaSignTransaction.d.ts.map +1 -1
- package/dist/types/device.d.ts +0 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/settings.d.ts +13 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +0 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts +1 -0
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +21 -18
- package/src/api/CheckAllFirmwareRelease.ts +44 -4
- package/src/api/CipherKeyValue.ts +4 -0
- package/src/api/DirList.ts +4 -1
- package/src/api/DirMake.ts +4 -1
- package/src/api/DirRemove.ts +4 -1
- package/src/api/FileDelete.ts +4 -1
- package/src/api/FileRead.ts +4 -1
- package/src/api/FileWrite.ts +4 -1
- package/src/api/FirmwareUpdate.ts +0 -8
- package/src/api/FirmwareUpdateV2.ts +292 -120
- package/src/api/FirmwareUpdateV3.ts +256 -61
- package/src/api/FirmwareUpdateV4.ts +767 -289
- package/src/api/GetDeviceState.ts +4 -0
- package/src/api/GetFeatures.ts +1 -4
- package/src/api/GetOnekeyFeatures.ts +0 -5
- package/src/api/GetPassphraseState.ts +4 -0
- package/src/api/OpenWalletSession.ts +4 -0
- package/src/api/PathInfo.ts +4 -1
- package/src/api/alephium/AlephiumGetAddress.ts +0 -4
- package/src/api/alephium/AlephiumSignMessage.ts +0 -4
- package/src/api/alephium/AlephiumSignTransaction.ts +0 -4
- package/src/api/algo/AlgoGetAddress.ts +4 -0
- package/src/api/algo/AlgoSignTransaction.ts +4 -0
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +5 -13
- 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 +8 -1
- 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 +4 -0
- package/src/api/cardano/CardanoSignTransaction.ts +4 -0
- package/src/api/conflux/ConfluxGetAddress.ts +4 -0
- package/src/api/conflux/ConfluxSignMessage.ts +4 -0
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +4 -0
- package/src/api/conflux/ConfluxSignTransaction.ts +6 -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 +4 -0
- package/src/api/device/DeviceChangePin.ts +4 -0
- package/src/api/device/DeviceLock.ts +4 -0
- package/src/api/device/DeviceRebootToBoardloader.ts +4 -0
- package/src/api/device/DeviceRebootToBootloader.ts +4 -0
- package/src/api/device/DeviceSettings.ts +4 -0
- package/src/api/device/DeviceSupportFeatures.ts +4 -0
- package/src/api/device/DeviceUnlock.ts +4 -0
- package/src/api/device/DeviceUpdateBootloader.ts +122 -6
- package/src/api/device/DeviceWipe.ts +4 -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 +4 -0
- package/src/api/evm/EVMVerifyMessage.ts +4 -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 +100 -0
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +50 -0
- package/src/api/firmware/FirmwareUpdateCapabilities.ts +9 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +628 -0
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +392 -0
- package/src/api/firmware/updateBootloader.ts +19 -4
- package/src/api/firmware/uploadFirmware.ts +140 -22
- package/src/api/kaspa/KaspaGetAddress.ts +4 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +37 -15
- package/src/api/kaspa/helpers/TransferSerialize.ts +3 -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 +0 -4
- package/src/api/nexa/NexaGetAddress.ts +0 -4
- package/src/api/nexa/NexaSignTransaction.ts +0 -4
- 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/DeviceFactoryInfoGet.ts +4 -1
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +4 -1
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +4 -1
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +4 -1
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +4 -1
- package/src/api/protocol-v2/DeviceInfoGet.ts +4 -8
- package/src/api/protocol-v2/DeviceReboot.ts +4 -2
- package/src/api/protocol-v2/DeviceStatusGet.ts +4 -1
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +4 -1
- package/src/api/protocol-v2/FilesystemFormat.ts +4 -1
- package/src/api/protocol-v2/FilesystemPermissionFix.ts +4 -1
- package/src/api/protocol-v2/Ping.ts +4 -1
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +4 -1
- 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 +5 -1
- 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 +15 -7
- package/src/api/tron/TronSignTransaction.ts +4 -0
- package/src/api/xrp/XrpGetAddress.ts +4 -0
- package/src/api/xrp/XrpSignTransaction.ts +5 -1
- package/src/core/index.ts +4 -17
- package/src/data-manager/DataManager.ts +33 -33
- package/src/data-manager/connectSettings.ts +11 -0
- package/src/device/Device.ts +53 -53
- package/src/index.ts +5 -0
- package/src/inject.ts +22 -2
- package/src/lowLevelInject.ts +5 -1
- package/src/topLevelInject.ts +5 -1
- package/src/types/api/checkAllFirmwareRelease.ts +3 -0
- package/src/types/api/deviceUpdateBootloader.ts +6 -0
- package/src/types/api/export.ts +20 -0
- package/src/types/api/firmwareUpdate.ts +76 -0
- package/src/types/api/firmwareUpdateCapabilities.ts +9 -0
- package/src/types/api/firmwareUpdatePlan.ts +36 -0
- package/src/types/api/firmwareUpdatePreparedPlan.ts +53 -0
- package/src/types/api/index.ts +14 -0
- package/src/types/api/kaspaSignTransaction.ts +20 -2
- package/src/types/device.ts +0 -1
- package/src/types/settings.ts +13 -0
- package/src/utils/deviceInfoUtils.ts +0 -3
- package/src/utils/deviceVersionUtils.ts +1 -1
- package/src/utils/index.ts +0 -1
- package/tsconfig.type-tests.json +8 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
1
|
+
import { EFirmwareType, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
2
|
import { DeviceRebootType, DeviceSessionPinType, DeviceSettingsPage } from '@onekeyfe/hd-transport';
|
|
3
3
|
|
|
4
4
|
import * as firmwareBinaryApi from '../src/api/firmware/getBinary';
|
|
@@ -50,7 +50,7 @@ import TonSignProof from '../src/api/ton/TonSignProof';
|
|
|
50
50
|
import TronGetAddress from '../src/api/tron/TronGetAddress';
|
|
51
51
|
import StellarGetAddress from '../src/api/stellar/StellarGetAddress';
|
|
52
52
|
import BenfenSignMessage from '../src/api/benfen/BenfenSignMessage';
|
|
53
|
-
import {
|
|
53
|
+
import { getBitcoinForkSupportedProtocols } from '../src/api/btc/helpers/versionLimit';
|
|
54
54
|
import { DataManager } from '../src/data-manager';
|
|
55
55
|
import { createCoreApi } from '../src/inject';
|
|
56
56
|
import { Device, preloadSessionCache } from '../src/device/Device';
|
|
@@ -80,9 +80,9 @@ import {
|
|
|
80
80
|
getFirmwareUpdateField,
|
|
81
81
|
getFirmwareUpdateFieldArray,
|
|
82
82
|
getMethodVersionRange,
|
|
83
|
-
isMethodVersionRangeUnsupported,
|
|
84
83
|
} from '../src/utils';
|
|
85
84
|
import { getDeviceFirmwareVersion } from '../src/utils/deviceVersionUtils';
|
|
85
|
+
import { openFirmwareByteSource } from '../src/api/firmware/FirmwareArtifactSource';
|
|
86
86
|
import {
|
|
87
87
|
getPassphraseState,
|
|
88
88
|
getPassphraseStateWithRefreshDeviceInfo,
|
|
@@ -129,7 +129,7 @@ describe('DeviceUploadWallpaper', () => {
|
|
|
129
129
|
method.init();
|
|
130
130
|
const result = await method.run();
|
|
131
131
|
|
|
132
|
-
expect(method.
|
|
132
|
+
expect(method.getSupportedProtocols()).toEqual(['V2']);
|
|
133
133
|
expect(method.unlockPolicy).toBe('unlock-before-run');
|
|
134
134
|
expect(typedCall).toHaveBeenNthCalledWith(1, 'FilesystemDirMake', 'Success', {
|
|
135
135
|
path: 'vol1:/wallpapers',
|
|
@@ -971,7 +971,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
971
971
|
wallet_initialized: false,
|
|
972
972
|
});
|
|
973
973
|
expect(typedCall).toHaveBeenCalledWith('DevGetOnboardingStatus', 'DevOnboardingStatus', {});
|
|
974
|
-
expect(method.
|
|
974
|
+
expect(method.getSupportedProtocols()).toEqual(['V2']);
|
|
975
975
|
});
|
|
976
976
|
|
|
977
977
|
test('routes onboarding without exposing the raw session command through CoreApi', async () => {
|
|
@@ -1957,13 +1957,6 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
1957
1957
|
});
|
|
1958
1958
|
|
|
1959
1959
|
test('marks known unsupported public-chain methods as unsupported on Protocol V2', () => {
|
|
1960
|
-
const features = normalizeProtocolV2Features({ ...descriptor, protocolType: 'V2' } as any, {
|
|
1961
|
-
fw: {
|
|
1962
|
-
application: {
|
|
1963
|
-
version: '9.9.9',
|
|
1964
|
-
},
|
|
1965
|
-
},
|
|
1966
|
-
});
|
|
1967
1960
|
const stellar = new StellarGetAddress({
|
|
1968
1961
|
id: 1,
|
|
1969
1962
|
payload: {
|
|
@@ -1992,21 +1985,10 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
1992
1985
|
benfen.init();
|
|
1993
1986
|
lnurlAuth.init();
|
|
1994
1987
|
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
type => lnurlAuth.getVersionRange()[type]
|
|
2000
|
-
);
|
|
2001
|
-
const neuraiRange = getMethodVersionRange(
|
|
2002
|
-
features,
|
|
2003
|
-
type => getBitcoinForkVersionRange(['Neurai'])[type]
|
|
2004
|
-
);
|
|
2005
|
-
|
|
2006
|
-
expect(isMethodVersionRangeUnsupported(stellarRange)).toBe(true);
|
|
2007
|
-
expect(isMethodVersionRangeUnsupported(benfenRange)).toBe(true);
|
|
2008
|
-
expect(isMethodVersionRangeUnsupported(lnurlAuthRange)).toBe(true);
|
|
2009
|
-
expect(isMethodVersionRangeUnsupported(neuraiRange)).toBe(true);
|
|
1988
|
+
expect(stellar.supportsProtocol('V2')).toBe(false);
|
|
1989
|
+
expect(benfen.supportsProtocol('V2')).toBe(false);
|
|
1990
|
+
expect(lnurlAuth.supportsProtocol('V2')).toBe(false);
|
|
1991
|
+
expect(getBitcoinForkSupportedProtocols(['Neurai'])).toEqual(['V1']);
|
|
2010
1992
|
});
|
|
2011
1993
|
|
|
2012
1994
|
test('does not block batch public key support checks on Protocol V2', async () => {
|
|
@@ -2045,7 +2027,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
2045
2027
|
});
|
|
2046
2028
|
});
|
|
2047
2029
|
|
|
2048
|
-
test('
|
|
2030
|
+
test('declares legacy getOnekeyFeatures unsupported on Protocol V2', () => {
|
|
2049
2031
|
const method = new GetOnekeyFeatures({
|
|
2050
2032
|
id: 1,
|
|
2051
2033
|
payload: {
|
|
@@ -2059,9 +2041,9 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
2059
2041
|
commands: { typedCall },
|
|
2060
2042
|
});
|
|
2061
2043
|
|
|
2062
|
-
|
|
2063
|
-
errorCode:
|
|
2064
|
-
|
|
2044
|
+
expect(() => method.assertProtocolSupported('V2', EFirmwareType.Universal)).toThrow(
|
|
2045
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotSupportMethod })
|
|
2046
|
+
);
|
|
2065
2047
|
expect(typedCall).not.toHaveBeenCalled();
|
|
2066
2048
|
});
|
|
2067
2049
|
|
|
@@ -2594,16 +2576,8 @@ describe('API compatibility handling', () => {
|
|
|
2594
2576
|
|
|
2595
2577
|
polkadotGetAddressMethod.init();
|
|
2596
2578
|
|
|
2597
|
-
expect(
|
|
2598
|
-
|
|
2599
|
-
getMethodVersionRange(features, type => tronMethod.getVersionRange()[type])
|
|
2600
|
-
)
|
|
2601
|
-
).toBe(false);
|
|
2602
|
-
expect(
|
|
2603
|
-
isMethodVersionRangeUnsupported(
|
|
2604
|
-
getMethodVersionRange(features, type => solMethod.getVersionRange()[type])
|
|
2605
|
-
)
|
|
2606
|
-
).toBe(false);
|
|
2579
|
+
expect(tronMethod.supportsProtocol('V2')).toBe(true);
|
|
2580
|
+
expect(solMethod.supportsProtocol('V2')).toBe(true);
|
|
2607
2581
|
expect(
|
|
2608
2582
|
getMethodVersionRange(features, type => tonGetAddressMethod.getVersionRange()[type])
|
|
2609
2583
|
).toEqual({
|
|
@@ -2759,7 +2733,7 @@ describe('API compatibility handling', () => {
|
|
|
2759
2733
|
expect(params.data_initial_chunk).toHaveLength(2048);
|
|
2760
2734
|
});
|
|
2761
2735
|
|
|
2762
|
-
test('
|
|
2736
|
+
test('declares Dynex signing unsupported on Protocol V2', () => {
|
|
2763
2737
|
const method = new DnxSignTransaction({
|
|
2764
2738
|
id: 1,
|
|
2765
2739
|
payload: {
|
|
@@ -2781,17 +2755,14 @@ describe('API compatibility handling', () => {
|
|
|
2781
2755
|
});
|
|
2782
2756
|
|
|
2783
2757
|
method.init();
|
|
2784
|
-
(method
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
await expect(method.run()).rejects.toMatchObject({
|
|
2790
|
-
errorCode: HardwareErrorCode.DeviceNotSupportMethod,
|
|
2791
|
-
});
|
|
2758
|
+
expect(() => method.assertProtocolSupported('V2', EFirmwareType.Universal)).toThrow(
|
|
2759
|
+
expect.objectContaining({
|
|
2760
|
+
errorCode: HardwareErrorCode.DeviceNotSupportMethod,
|
|
2761
|
+
})
|
|
2762
|
+
);
|
|
2792
2763
|
});
|
|
2793
2764
|
|
|
2794
|
-
test('
|
|
2765
|
+
test('declares Dynex address unsupported on Protocol V2', () => {
|
|
2795
2766
|
const method = new DnxGetAddress({
|
|
2796
2767
|
id: 1,
|
|
2797
2768
|
payload: {
|
|
@@ -2802,14 +2773,11 @@ describe('API compatibility handling', () => {
|
|
|
2802
2773
|
});
|
|
2803
2774
|
|
|
2804
2775
|
method.init();
|
|
2805
|
-
(method
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
await expect(method.run()).rejects.toMatchObject({
|
|
2811
|
-
errorCode: HardwareErrorCode.DeviceNotSupportMethod,
|
|
2812
|
-
});
|
|
2776
|
+
expect(() => method.assertProtocolSupported('V2', EFirmwareType.Universal)).toThrow(
|
|
2777
|
+
expect.objectContaining({
|
|
2778
|
+
errorCode: HardwareErrorCode.DeviceNotSupportMethod,
|
|
2779
|
+
})
|
|
2780
|
+
);
|
|
2813
2781
|
});
|
|
2814
2782
|
});
|
|
2815
2783
|
|
|
@@ -2848,18 +2816,16 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
2848
2816
|
return header;
|
|
2849
2817
|
};
|
|
2850
2818
|
|
|
2851
|
-
test('keeps Protocol V2 firmware updates off the firmwareUpdateV3 path',
|
|
2819
|
+
test('keeps Protocol V2 firmware updates off the firmwareUpdateV3 path', () => {
|
|
2852
2820
|
const method = new FirmwareUpdateV3({
|
|
2853
2821
|
id: 1,
|
|
2854
2822
|
payload: {
|
|
2855
2823
|
method: 'firmwareUpdateV3',
|
|
2856
2824
|
},
|
|
2857
2825
|
});
|
|
2858
|
-
(method
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
await expect(method.run()).rejects.toThrow('firmwareUpdateV4');
|
|
2826
|
+
expect(() => method.assertProtocolSupported('V2', EFirmwareType.Universal)).toThrow(
|
|
2827
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotSupportMethod })
|
|
2828
|
+
);
|
|
2863
2829
|
});
|
|
2864
2830
|
|
|
2865
2831
|
test('uses Protocol V2 features after BLE final reconnect without V1 Initialize', async () => {
|
|
@@ -2946,7 +2912,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
2946
2912
|
});
|
|
2947
2913
|
});
|
|
2948
2914
|
|
|
2949
|
-
test('
|
|
2915
|
+
test('delegates Protocol V2 mode transition to the phase executor', async () => {
|
|
2950
2916
|
const method = new FirmwareUpdateV4({
|
|
2951
2917
|
id: 1,
|
|
2952
2918
|
payload: {
|
|
@@ -2981,7 +2947,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
2981
2947
|
|
|
2982
2948
|
await method.run();
|
|
2983
2949
|
|
|
2984
|
-
expect((method as any).enterProtocolV2BootloaderMode).
|
|
2950
|
+
expect((method as any).enterProtocolV2BootloaderMode).not.toHaveBeenCalled();
|
|
2985
2951
|
expect((method as any).executeProtocolV2Update).toHaveBeenCalledWith({
|
|
2986
2952
|
fwBinaryMap: [
|
|
2987
2953
|
{
|
|
@@ -3300,9 +3266,9 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3300
3266
|
const typedCall = jest
|
|
3301
3267
|
.fn()
|
|
3302
3268
|
.mockRejectedValue(
|
|
3303
|
-
|
|
3304
|
-
"Failed to execute 'open' on 'USBDevice': The device was disconnected",
|
|
3305
|
-
'NotFoundError'
|
|
3269
|
+
Object.assign(
|
|
3270
|
+
new Error("Failed to execute 'open' on 'USBDevice': The device was disconnected"),
|
|
3271
|
+
{ name: 'NotFoundError' }
|
|
3306
3272
|
)
|
|
3307
3273
|
);
|
|
3308
3274
|
|
|
@@ -3390,7 +3356,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3390
3356
|
expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
|
|
3391
3357
|
});
|
|
3392
3358
|
|
|
3393
|
-
test('
|
|
3359
|
+
test('does not treat a missing firmware status handler as install completion', async () => {
|
|
3394
3360
|
const method = new FirmwareUpdateV4({
|
|
3395
3361
|
id: 1,
|
|
3396
3362
|
payload: {
|
|
@@ -3409,12 +3375,88 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3409
3375
|
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
3410
3376
|
method.postProgressMessage = jest.fn();
|
|
3411
3377
|
|
|
3412
|
-
await (
|
|
3413
|
-
|
|
3414
|
-
|
|
3378
|
+
await expect(
|
|
3379
|
+
(method as any).waitForProtocolV2FirmwareUpdateComplete([
|
|
3380
|
+
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
3381
|
+
])
|
|
3382
|
+
).rejects.toThrow('Protocol V2 firmware install status is unavailable');
|
|
3415
3383
|
|
|
3416
3384
|
expect(reconnectProtocolV2Device).toHaveBeenCalledTimes(1);
|
|
3417
|
-
expect(typedCall.mock.calls.map(call => call[0])).toEqual([
|
|
3385
|
+
expect(typedCall.mock.calls.map(call => call[0])).toEqual([
|
|
3386
|
+
'DeviceFirmwareUpdateStatusGet',
|
|
3387
|
+
'DeviceInfoGet',
|
|
3388
|
+
]);
|
|
3389
|
+
});
|
|
3390
|
+
|
|
3391
|
+
test('rejects a finished target whose payload version conflicts with the plan', () => {
|
|
3392
|
+
const method = new FirmwareUpdateV4({
|
|
3393
|
+
id: 1,
|
|
3394
|
+
payload: {
|
|
3395
|
+
method: 'firmwareUpdateV4',
|
|
3396
|
+
platform: 'desktop',
|
|
3397
|
+
expectedTargetVersions: {
|
|
3398
|
+
app_v1: '2.0.0',
|
|
3399
|
+
},
|
|
3400
|
+
},
|
|
3401
|
+
});
|
|
3402
|
+
method.init();
|
|
3403
|
+
method.postProgressMessage = jest.fn();
|
|
3404
|
+
|
|
3405
|
+
expect(() =>
|
|
3406
|
+
(method as any).assertProtocolV2TargetStatus(
|
|
3407
|
+
[{ target_id: 4, status: 2, payload_version: 0x010000 }],
|
|
3408
|
+
new Set([4])
|
|
3409
|
+
)
|
|
3410
|
+
).toThrow('expected 131072');
|
|
3411
|
+
});
|
|
3412
|
+
|
|
3413
|
+
test('does not fail a completed multi-app install when final app versions are unobservable', () => {
|
|
3414
|
+
const method = new FirmwareUpdateV4({
|
|
3415
|
+
id: 1,
|
|
3416
|
+
payload: {
|
|
3417
|
+
method: 'firmwareUpdateV4',
|
|
3418
|
+
platform: 'desktop',
|
|
3419
|
+
targetsToUpdate: ['app_v1', 'app_v2'],
|
|
3420
|
+
expectedTargetVersions: {
|
|
3421
|
+
app_v1: '1.0.0',
|
|
3422
|
+
app_v2: '2.0.0',
|
|
3423
|
+
},
|
|
3424
|
+
},
|
|
3425
|
+
});
|
|
3426
|
+
method.init();
|
|
3427
|
+
(method as any).protocolV2LatestFinalFeatures = {
|
|
3428
|
+
major_version: 3,
|
|
3429
|
+
minor_version: 0,
|
|
3430
|
+
patch_version: 0,
|
|
3431
|
+
};
|
|
3432
|
+
(method as any).protocolV2FinalStatusVerified = true;
|
|
3433
|
+
|
|
3434
|
+
expect(() => (method as any).assertExpectedProtocolV2Versions()).not.toThrow();
|
|
3435
|
+
});
|
|
3436
|
+
|
|
3437
|
+
test('rejects unobservable final versions after the status endpoint fallback', () => {
|
|
3438
|
+
const method = new FirmwareUpdateV4({
|
|
3439
|
+
id: 1,
|
|
3440
|
+
payload: {
|
|
3441
|
+
method: 'firmwareUpdateV4',
|
|
3442
|
+
platform: 'desktop',
|
|
3443
|
+
targetsToUpdate: ['app_v1', 'app_v2'],
|
|
3444
|
+
expectedTargetVersions: {
|
|
3445
|
+
app_v1: '1.0.0',
|
|
3446
|
+
app_v2: '2.0.0',
|
|
3447
|
+
},
|
|
3448
|
+
},
|
|
3449
|
+
});
|
|
3450
|
+
method.init();
|
|
3451
|
+
(method as any).protocolV2LatestFinalFeatures = {
|
|
3452
|
+
major_version: 3,
|
|
3453
|
+
minor_version: 0,
|
|
3454
|
+
patch_version: 0,
|
|
3455
|
+
};
|
|
3456
|
+
|
|
3457
|
+
expect(() => (method as any).assertExpectedProtocolV2Versions()).toThrow(
|
|
3458
|
+
'has no observable final version after status fallback'
|
|
3459
|
+
);
|
|
3418
3460
|
});
|
|
3419
3461
|
|
|
3420
3462
|
test('polls target status after update ACK and finishes when all targets complete', async () => {
|
|
@@ -3593,10 +3635,14 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3593
3635
|
const writtenPaths: string[] = [];
|
|
3594
3636
|
method.postTipMessage = jest.fn();
|
|
3595
3637
|
method.postProgressMessage = jest.fn();
|
|
3596
|
-
(method as any).
|
|
3638
|
+
(method as any).protocolV2SourceUpdateProcess = jest.fn().mockImplementation(params => {
|
|
3597
3639
|
writtenPaths.push(params.filePath);
|
|
3598
|
-
return Number(params.processedSize ?? 0) + Number(params.
|
|
3640
|
+
return Number(params.processedSize ?? 0) + Number(params.source.size);
|
|
3599
3641
|
});
|
|
3642
|
+
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3643
|
+
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
3644
|
+
(method as any).waitForProtocolV2FinalFeatures = jest.fn().mockResolvedValue({});
|
|
3645
|
+
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
3600
3646
|
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
3601
3647
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn().mockResolvedValue(undefined);
|
|
3602
3648
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest
|
|
@@ -3636,10 +3682,12 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3636
3682
|
'vol0:/coprocessor.bin',
|
|
3637
3683
|
1
|
|
3638
3684
|
);
|
|
3639
|
-
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenCalledTimes(
|
|
3640
|
-
expect((method as any).protocolV2StartFirmwareUpdate).
|
|
3685
|
+
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenCalledTimes(2);
|
|
3686
|
+
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenNthCalledWith(1, {
|
|
3687
|
+
targets: [{ target_id: 3, path: 'vol0:/bootloader.bin' }],
|
|
3688
|
+
});
|
|
3689
|
+
expect((method as any).protocolV2StartFirmwareUpdate).toHaveBeenNthCalledWith(2, {
|
|
3641
3690
|
targets: [
|
|
3642
|
-
{ target_id: 3, path: 'vol0:/bootloader.bin' },
|
|
3643
3691
|
{ target_id: 6, path: 'vol0:/coprocessor.bin' },
|
|
3644
3692
|
{ target_id: 7, path: 'vol0:/se01.bin' },
|
|
3645
3693
|
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
@@ -3649,7 +3697,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3649
3697
|
expect((method as any).waitForProtocolV2FirmwareUpdateComplete).toHaveBeenCalled();
|
|
3650
3698
|
});
|
|
3651
3699
|
|
|
3652
|
-
test('announces
|
|
3700
|
+
test('announces separate resource and component transfer phases', async () => {
|
|
3653
3701
|
const method = new FirmwareUpdateV4({
|
|
3654
3702
|
id: 1,
|
|
3655
3703
|
payload: {
|
|
@@ -3659,11 +3707,14 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3659
3707
|
|
|
3660
3708
|
method.postTipMessage = jest.fn();
|
|
3661
3709
|
method.postProgressMessage = jest.fn();
|
|
3662
|
-
(method as any).
|
|
3710
|
+
(method as any).protocolV2SourceUpdateProcess = jest
|
|
3663
3711
|
.fn()
|
|
3664
3712
|
.mockImplementation(params =>
|
|
3665
|
-
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.
|
|
3713
|
+
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.source.size))
|
|
3666
3714
|
);
|
|
3715
|
+
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3716
|
+
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
3717
|
+
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
3667
3718
|
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
3668
3719
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn().mockResolvedValue(undefined);
|
|
3669
3720
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest
|
|
@@ -3683,21 +3734,22 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3683
3734
|
{
|
|
3684
3735
|
fileName: 'application_p1.bin',
|
|
3685
3736
|
binary: new Uint8Array([3]).buffer,
|
|
3686
|
-
targetId:
|
|
3737
|
+
targetId: 4,
|
|
3687
3738
|
},
|
|
3688
3739
|
],
|
|
3689
3740
|
});
|
|
3690
3741
|
|
|
3691
|
-
expect(method.postTipMessage).toHaveBeenCalledTimes(
|
|
3742
|
+
expect(method.postTipMessage).toHaveBeenCalledTimes(3);
|
|
3692
3743
|
expect(method.postTipMessage).toHaveBeenNthCalledWith(1, 'StartTransferData');
|
|
3693
|
-
expect(method.postTipMessage).toHaveBeenNthCalledWith(2, '
|
|
3694
|
-
expect(
|
|
3744
|
+
expect(method.postTipMessage).toHaveBeenNthCalledWith(2, 'StartTransferData');
|
|
3745
|
+
expect(method.postTipMessage).toHaveBeenNthCalledWith(3, 'ConfirmOnDevice');
|
|
3746
|
+
expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenNthCalledWith(
|
|
3695
3747
|
1,
|
|
3696
|
-
expect.objectContaining({ processedSize: 0, totalSize:
|
|
3748
|
+
expect.objectContaining({ processedSize: 0, totalSize: 2 })
|
|
3697
3749
|
);
|
|
3698
|
-
expect((method as any).
|
|
3750
|
+
expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenNthCalledWith(
|
|
3699
3751
|
2,
|
|
3700
|
-
expect.objectContaining({ processedSize:
|
|
3752
|
+
expect.objectContaining({ processedSize: 0, totalSize: 1 })
|
|
3701
3753
|
);
|
|
3702
3754
|
});
|
|
3703
3755
|
|
|
@@ -3711,7 +3763,8 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3711
3763
|
|
|
3712
3764
|
method.postTipMessage = jest.fn();
|
|
3713
3765
|
method.postProgressMessage = jest.fn();
|
|
3714
|
-
(method as any).
|
|
3766
|
+
(method as any).protocolV2SourceUpdateProcess = jest.fn().mockResolvedValue(3);
|
|
3767
|
+
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3715
3768
|
(method as any).device = stubDevice({
|
|
3716
3769
|
getCommands: () => ({
|
|
3717
3770
|
typedCall: jest.fn().mockResolvedValue({
|
|
@@ -3757,11 +3810,14 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
3757
3810
|
|
|
3758
3811
|
method.postTipMessage = jest.fn();
|
|
3759
3812
|
method.postProgressMessage = jest.fn();
|
|
3760
|
-
(method as any).
|
|
3813
|
+
(method as any).protocolV2SourceUpdateProcess = jest
|
|
3761
3814
|
.fn()
|
|
3762
3815
|
.mockImplementation(params =>
|
|
3763
|
-
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.
|
|
3816
|
+
Promise.resolve(Number(params.processedSize ?? 0) + Number(params.source.size))
|
|
3764
3817
|
);
|
|
3818
|
+
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
3819
|
+
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
3820
|
+
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
3765
3821
|
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
3766
3822
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn().mockResolvedValue(undefined);
|
|
3767
3823
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest
|
|
@@ -4028,6 +4084,58 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4028
4084
|
getFirmwareLatestReleaseSpy.mockRestore();
|
|
4029
4085
|
});
|
|
4030
4086
|
|
|
4087
|
+
test('rejects prepared RESC bundle paths before opening an artifact source', async () => {
|
|
4088
|
+
const method = new FirmwareUpdateV4({
|
|
4089
|
+
id: 1,
|
|
4090
|
+
payload: {
|
|
4091
|
+
method: 'firmwareUpdateV4',
|
|
4092
|
+
},
|
|
4093
|
+
});
|
|
4094
|
+
const openPreparedSource = jest.fn();
|
|
4095
|
+
(method as any).params = {
|
|
4096
|
+
targetsToUpdate: ['resource'],
|
|
4097
|
+
resourceBundleArtifacts: [
|
|
4098
|
+
{
|
|
4099
|
+
name: 'images',
|
|
4100
|
+
artifact: {
|
|
4101
|
+
artifactRef: `fw:${'a'.repeat(64)}`,
|
|
4102
|
+
size: 1,
|
|
4103
|
+
sha256: 'a'.repeat(64),
|
|
4104
|
+
},
|
|
4105
|
+
},
|
|
4106
|
+
],
|
|
4107
|
+
};
|
|
4108
|
+
(method as any).openProtocolV2PreparedSource = openPreparedSource;
|
|
4109
|
+
const getFirmwareLatestReleaseSpy = jest
|
|
4110
|
+
.spyOn(DataManager, 'getFirmwareLatestRelease')
|
|
4111
|
+
.mockReturnValue({
|
|
4112
|
+
required: false,
|
|
4113
|
+
version: [1, 0, 0],
|
|
4114
|
+
url: '',
|
|
4115
|
+
resourceBundles: [
|
|
4116
|
+
{
|
|
4117
|
+
name: 'images',
|
|
4118
|
+
url: 'https://example.com/images.okpkg',
|
|
4119
|
+
devicePath: 'vol0:/resource/../images.okpkg',
|
|
4120
|
+
},
|
|
4121
|
+
],
|
|
4122
|
+
fingerprint: '',
|
|
4123
|
+
changelog: {
|
|
4124
|
+
'zh-CN': '',
|
|
4125
|
+
'en-US': '',
|
|
4126
|
+
},
|
|
4127
|
+
});
|
|
4128
|
+
|
|
4129
|
+
await expect(
|
|
4130
|
+
(method as any).prepareProtocolV2ResourceSources('universal', {
|
|
4131
|
+
deviceType: 'pro2',
|
|
4132
|
+
})
|
|
4133
|
+
).rejects.toThrow('resourceBundles[].devicePath');
|
|
4134
|
+
expect(openPreparedSource).not.toHaveBeenCalled();
|
|
4135
|
+
|
|
4136
|
+
getFirmwareLatestReleaseSpy.mockRestore();
|
|
4137
|
+
});
|
|
4138
|
+
|
|
4031
4139
|
test('downloads and validates remote RESC bundles before entering bootloader', async () => {
|
|
4032
4140
|
const method = new FirmwareUpdateV4({
|
|
4033
4141
|
id: 1,
|
|
@@ -4080,7 +4188,9 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4080
4188
|
order.push('bootloader');
|
|
4081
4189
|
return Promise.resolve(true);
|
|
4082
4190
|
});
|
|
4083
|
-
(method as any
|
|
4191
|
+
const executeProtocolV2UpdateSpy = jest.spyOn(method as any, 'executeProtocolV2Update');
|
|
4192
|
+
(method as any).executeProtocolV2TransferPhase = jest.fn().mockResolvedValue(undefined);
|
|
4193
|
+
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue(undefined);
|
|
4084
4194
|
(method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
|
|
4085
4195
|
(method as any).waitForProtocolV2FinalFeatures = jest.fn().mockResolvedValue({
|
|
4086
4196
|
bootloaderVersion: '1.0.0',
|
|
@@ -4092,7 +4202,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4092
4202
|
await method.run();
|
|
4093
4203
|
|
|
4094
4204
|
expect(order).toEqual(['download', 'bootloader']);
|
|
4095
|
-
expect(
|
|
4205
|
+
expect(executeProtocolV2UpdateSpy).toHaveBeenCalledWith({
|
|
4096
4206
|
bootloaderBinary: null,
|
|
4097
4207
|
fwBinaryMap: [],
|
|
4098
4208
|
resourceBundles: [
|
|
@@ -4105,6 +4215,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4105
4215
|
],
|
|
4106
4216
|
});
|
|
4107
4217
|
|
|
4218
|
+
executeProtocolV2UpdateSpy.mockRestore();
|
|
4108
4219
|
getSysResourceBinarySpy.mockRestore();
|
|
4109
4220
|
getFirmwareLatestReleaseSpy.mockRestore();
|
|
4110
4221
|
});
|
|
@@ -4393,7 +4504,10 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4393
4504
|
|
|
4394
4505
|
method.postTipMessage = jest.fn();
|
|
4395
4506
|
method.postProgressMessage = jest.fn();
|
|
4396
|
-
(method as any).
|
|
4507
|
+
(method as any).protocolV2SourceUpdateProcess = jest.fn().mockResolvedValue(3);
|
|
4508
|
+
(method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
|
|
4509
|
+
(method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
|
|
4510
|
+
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
4397
4511
|
(method as any).protocolV2StartFirmwareUpdate = jest.fn();
|
|
4398
4512
|
(method as any).waitForProtocolV2FirmwareUpdateComplete = jest.fn();
|
|
4399
4513
|
|
|
@@ -4409,7 +4523,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4409
4523
|
fwBinaryMap: [],
|
|
4410
4524
|
});
|
|
4411
4525
|
|
|
4412
|
-
expect((method as any).
|
|
4526
|
+
expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenCalledTimes(1);
|
|
4413
4527
|
expect((method as any).protocolV2StartFirmwareUpdate).not.toHaveBeenCalled();
|
|
4414
4528
|
expect((method as any).waitForProtocolV2FirmwareUpdateComplete).not.toHaveBeenCalled();
|
|
4415
4529
|
});
|
|
@@ -4440,12 +4554,19 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4440
4554
|
});
|
|
4441
4555
|
method.postProgressMessage = jest.fn();
|
|
4442
4556
|
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
filePath: 'vol1:firmware.bin',
|
|
4446
|
-
processedSize: 0,
|
|
4447
|
-
totalSize: 4097,
|
|
4557
|
+
const source = await openFirmwareByteSource({
|
|
4558
|
+
binary: new Uint8Array(4097).buffer,
|
|
4448
4559
|
});
|
|
4560
|
+
try {
|
|
4561
|
+
await (method as any).protocolV2SourceUpdateProcess({
|
|
4562
|
+
source,
|
|
4563
|
+
filePath: 'vol1:firmware.bin',
|
|
4564
|
+
processedSize: 0,
|
|
4565
|
+
totalSize: 4097,
|
|
4566
|
+
});
|
|
4567
|
+
} finally {
|
|
4568
|
+
await source?.close();
|
|
4569
|
+
}
|
|
4449
4570
|
|
|
4450
4571
|
const writePayloads = typedCall.mock.calls.map(call => call[2]);
|
|
4451
4572
|
expect(writePayloads.map(payload => payload.file.offset)).toEqual([0, 4000]);
|
|
@@ -4496,12 +4617,16 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4496
4617
|
method.postProgressMessage = jest.fn();
|
|
4497
4618
|
|
|
4498
4619
|
try {
|
|
4499
|
-
|
|
4500
|
-
|
|
4620
|
+
const source = await openFirmwareByteSource({
|
|
4621
|
+
binary: new Uint8Array(8001).buffer,
|
|
4622
|
+
});
|
|
4623
|
+
await (method as any).protocolV2SourceUpdateProcess({
|
|
4624
|
+
source,
|
|
4501
4625
|
filePath: 'vol0:/firmware.bin',
|
|
4502
4626
|
processedSize: 0,
|
|
4503
4627
|
totalSize: 8001,
|
|
4504
4628
|
});
|
|
4629
|
+
await source?.close();
|
|
4505
4630
|
} finally {
|
|
4506
4631
|
setTimeoutSpy.mockRestore();
|
|
4507
4632
|
}
|
|
@@ -4533,16 +4658,21 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4533
4658
|
});
|
|
4534
4659
|
method.postProgressMessage = jest.fn();
|
|
4535
4660
|
method.postTipMessage = jest.fn();
|
|
4661
|
+
(method as any).recoverProtocolV2FileTransfer = jest.fn().mockResolvedValue(undefined);
|
|
4536
4662
|
|
|
4663
|
+
const source = await openFirmwareByteSource({
|
|
4664
|
+
binary: new Uint8Array(4097).buffer,
|
|
4665
|
+
});
|
|
4537
4666
|
await expect(
|
|
4538
|
-
(method as any).
|
|
4539
|
-
|
|
4667
|
+
(method as any).protocolV2SourceUpdateProcess({
|
|
4668
|
+
source,
|
|
4540
4669
|
filePath: 'vol0:/firmware.bin',
|
|
4541
4670
|
processedSize: 0,
|
|
4542
4671
|
totalSize: 4097,
|
|
4543
4672
|
})
|
|
4544
4673
|
).rejects.toMatchObject({ errorCode: HardwareErrorCode.EmmcFileWriteFirmwareError });
|
|
4545
|
-
|
|
4674
|
+
await source?.close();
|
|
4675
|
+
expect(typedCall).toHaveBeenCalledTimes(6);
|
|
4546
4676
|
});
|
|
4547
4677
|
|
|
4548
4678
|
test('caps native BLE firmware upload chunks below the WebUSB limit', async () => {
|
|
@@ -4575,12 +4705,19 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4575
4705
|
});
|
|
4576
4706
|
method.postProgressMessage = jest.fn();
|
|
4577
4707
|
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
filePath: 'vol1:ble-firmware.bin',
|
|
4581
|
-
processedSize: 0,
|
|
4582
|
-
totalSize: 1801,
|
|
4708
|
+
const source = await openFirmwareByteSource({
|
|
4709
|
+
binary: new Uint8Array(1801).buffer,
|
|
4583
4710
|
});
|
|
4711
|
+
try {
|
|
4712
|
+
await (method as any).protocolV2SourceUpdateProcess({
|
|
4713
|
+
source,
|
|
4714
|
+
filePath: 'vol1:ble-firmware.bin',
|
|
4715
|
+
processedSize: 0,
|
|
4716
|
+
totalSize: 1801,
|
|
4717
|
+
});
|
|
4718
|
+
} finally {
|
|
4719
|
+
await source?.close();
|
|
4720
|
+
}
|
|
4584
4721
|
|
|
4585
4722
|
const writePayloads = typedCall.mock.calls.map(call => call[2]);
|
|
4586
4723
|
expect(writePayloads.map(payload => payload.file.offset)).toEqual([0, 1800]);
|
|
@@ -4697,9 +4834,9 @@ describe('Protocol V2 firmware update method', () => {
|
|
|
4697
4834
|
const typedCall = jest
|
|
4698
4835
|
.fn()
|
|
4699
4836
|
.mockRejectedValue(
|
|
4700
|
-
|
|
4701
|
-
"Failed to execute 'open' on 'USBDevice': The device was disconnected",
|
|
4702
|
-
'NotFoundError'
|
|
4837
|
+
Object.assign(
|
|
4838
|
+
new Error("Failed to execute 'open' on 'USBDevice': The device was disconnected"),
|
|
4839
|
+
{ name: 'NotFoundError' }
|
|
4703
4840
|
)
|
|
4704
4841
|
);
|
|
4705
4842
|
|
|
@@ -4864,6 +5001,21 @@ describe('Protocol V2 firmware update method', () => {
|
|
|
4864
5001
|
});
|
|
4865
5002
|
|
|
4866
5003
|
describe('Protocol V2 firmware reconnect identity', () => {
|
|
5004
|
+
test('keeps the host plan identity as the V4 reconnect anchor', () => {
|
|
5005
|
+
const method = new FirmwareUpdateV4({
|
|
5006
|
+
id: 1,
|
|
5007
|
+
payload: {
|
|
5008
|
+
method: 'firmwareUpdateV4',
|
|
5009
|
+
platform: 'native',
|
|
5010
|
+
expectedDeviceId: 'persisted-device-id',
|
|
5011
|
+
},
|
|
5012
|
+
});
|
|
5013
|
+
|
|
5014
|
+
method.init();
|
|
5015
|
+
|
|
5016
|
+
expect((method as any).params.expectedDeviceId).toBe('persisted-device-id');
|
|
5017
|
+
});
|
|
5018
|
+
|
|
4867
5019
|
test('rejects a different physical serial before firmware transfer resumes', () => {
|
|
4868
5020
|
expect(() => assertProtocolV2ReconnectIdentity('expected-serial', 'other-serial')).toThrow(
|
|
4869
5021
|
'identity mismatch'
|
|
@@ -5779,7 +5931,7 @@ describe('Protocol V2 raw device info method', () => {
|
|
|
5779
5931
|
);
|
|
5780
5932
|
});
|
|
5781
5933
|
|
|
5782
|
-
test('rejects on Protocol V1 devices instead of sending an unknown message',
|
|
5934
|
+
test('rejects on Protocol V1 devices instead of sending an unknown message', () => {
|
|
5783
5935
|
const method = buildMethod();
|
|
5784
5936
|
const typedCall = jest.fn();
|
|
5785
5937
|
(method as any).device = stubDevice({
|
|
@@ -5787,7 +5939,9 @@ describe('Protocol V2 raw device info method', () => {
|
|
|
5787
5939
|
commands: { typedCall },
|
|
5788
5940
|
});
|
|
5789
5941
|
|
|
5790
|
-
|
|
5942
|
+
expect(() => method.assertProtocolSupported('V1', EFirmwareType.Universal)).toThrow(
|
|
5943
|
+
expect.objectContaining({ errorCode: HardwareErrorCode.DeviceNotSupportMethod })
|
|
5944
|
+
);
|
|
5791
5945
|
expect(typedCall).not.toHaveBeenCalled();
|
|
5792
5946
|
});
|
|
5793
5947
|
});
|