@onekeyfe/hd-core 1.1.27-alpha.4 → 1.1.27-alpha.41
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__/evmSignTransaction.test.ts +1 -1
- package/__tests__/evmSignTypedData.test.ts +1 -1
- package/__tests__/protocol-v2.test.ts +1688 -0
- package/dist/api/BaseMethod.d.ts +1 -7
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/DirList.d.ts +10 -0
- package/dist/api/DirList.d.ts.map +1 -0
- package/dist/api/DirMake.d.ts +9 -0
- package/dist/api/DirMake.d.ts.map +1 -0
- package/dist/api/DirRemove.d.ts +9 -0
- package/dist/api/DirRemove.d.ts.map +1 -0
- package/dist/api/FileDelete.d.ts +9 -0
- package/dist/api/FileDelete.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts +19 -0
- package/dist/api/FileRead.d.ts.map +1 -0
- package/dist/api/FileWrite.d.ts +23 -0
- package/dist/api/FileWrite.d.ts.map +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts +1 -0
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +32 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -0
- package/dist/api/GetDeviceInfo.d.ts +9 -0
- package/dist/api/GetDeviceInfo.d.ts.map +1 -0
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +6 -1
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts +9 -0
- package/dist/api/PathInfo.d.ts.map +1 -0
- package/dist/api/SearchDevices.d.ts +2 -1
- package/dist/api/SearchDevices.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumGetAddress.d.ts +2 -6
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts +2 -5
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts +2 -5
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts +2 -9
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts +2 -9
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts +2 -8
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts +2 -8
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +1 -11
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +1 -11
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +1 -15
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +1 -11
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +1 -11
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +2 -11
- package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts +2 -8
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts +1 -1
- package/dist/api/evm/latest/signTypedData.d.ts.map +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts +1 -1
- package/dist/api/evm/legacyV1/signTypedData.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +10 -2
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/helpers/deviceInfo.d.ts +15 -0
- package/dist/api/helpers/deviceInfo.d.ts.map +1 -0
- package/dist/api/helpers/filesystemValidation.d.ts +7 -0
- package/dist/api/helpers/filesystemValidation.d.ts.map +1 -0
- package/dist/api/index.d.ts +28 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
- package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
- package/dist/api/neo/NeoGetAddress.d.ts +2 -8
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts +2 -8
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts +2 -9
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts +2 -9
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts +2 -8
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts +2 -9
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignEvent.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +7 -0
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +1 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +6 -0
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts +10 -0
- package/dist/api/protocol-v2/FilesystemDiskControl.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +6 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +6 -0
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +1 -0
- package/dist/api/protocol-v2/Ping.d.ts +8 -0
- package/dist/api/protocol-v2/Ping.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +49 -0
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -0
- package/dist/api/scdo/ScdoGetAddress.d.ts +2 -6
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts +2 -5
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts +2 -5
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +1 -0
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +4 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +4 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +8 -0
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +2 -1
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +2 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +2 -2
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +4 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +4 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- package/dist/core/RequestQueue.d.ts +1 -1
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +7 -4
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/MessagesConfig.d.ts +2 -2
- package/dist/data-manager/MessagesConfig.d.ts.map +1 -1
- package/dist/data-manager/TransportManager.d.ts +5 -4
- package/dist/data-manager/TransportManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +5 -18
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +8 -8
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +2 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/events/ui-request.d.ts +8 -0
- package/dist/events/ui-request.d.ts.map +1 -1
- package/dist/index.d.ts +292 -43
- package/dist/index.js +16693 -1501
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +104 -0
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/firmware.d.ts +12 -0
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/index.d.ts +3 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -0
- package/dist/types/api/export.d.ts +1 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +7 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +84 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -0
- package/dist/types/api/getPassphraseState.d.ts +10 -1
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +33 -3
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +127 -0
- package/dist/types/api/protocolV2.d.ts.map +1 -0
- package/dist/types/api/searchDevices.d.ts +2 -2
- package/dist/types/api/searchDevices.d.ts.map +1 -1
- package/dist/types/device.d.ts +6 -2
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +2 -1
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +5 -3
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +1 -0
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/dist/utils/versionUtils.d.ts +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +7 -82
- package/src/api/DirList.ts +29 -0
- package/src/api/DirMake.ts +21 -0
- package/src/api/DirRemove.ts +21 -0
- package/src/api/FileDelete.ts +21 -0
- package/src/api/FileRead.ts +165 -0
- package/src/api/FileWrite.ts +203 -0
- package/src/api/FirmwareUpdateV3.ts +21 -4
- package/src/api/FirmwareUpdateV4.ts +810 -0
- package/src/api/GetDeviceInfo.ts +161 -0
- package/src/api/GetOnekeyFeatures.ts +75 -3
- package/src/api/GetPassphraseState.ts +16 -7
- package/src/api/PathInfo.ts +25 -0
- package/src/api/SearchDevices.ts +7 -2
- package/src/api/alephium/AlephiumGetAddress.ts +6 -2
- package/src/api/alephium/AlephiumSignMessage.ts +6 -2
- package/src/api/alephium/AlephiumSignTransaction.ts +6 -3
- package/src/api/algo/AlgoSignTransaction.ts +0 -1
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +18 -9
- package/src/api/aptos/AptosSignInMessage.ts +0 -1
- package/src/api/aptos/AptosSignMessage.ts +0 -1
- package/src/api/aptos/AptosSignTransaction.ts +0 -1
- package/src/api/benfen/BenfenGetAddress.ts +6 -2
- package/src/api/benfen/BenfenGetPublicKey.ts +6 -2
- package/src/api/benfen/BenfenSignMessage.ts +6 -2
- package/src/api/benfen/BenfenSignTransaction.ts +6 -2
- package/src/api/btc/BTCSignMessage.ts +0 -1
- package/src/api/btc/BTCSignPsbt.ts +0 -1
- package/src/api/btc/BTCSignTransaction.ts +0 -1
- package/src/api/btc/helpers/versionLimit.ts +7 -1
- package/src/api/cardano/CardanoSignMessage.ts +0 -1
- package/src/api/cardano/CardanoSignTransaction.ts +0 -1
- package/src/api/conflux/ConfluxSignMessage.ts +0 -1
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +0 -1
- package/src/api/conflux/ConfluxSignTransaction.ts +5 -3
- package/src/api/cosmos/CosmosSignTransaction.ts +0 -1
- package/src/api/device/DeviceRebootToBoardloader.ts +10 -1
- package/src/api/device/DeviceRebootToBootloader.ts +10 -1
- package/src/api/dynex/DnxGetAddress.ts +7 -0
- package/src/api/dynex/DnxSignTransaction.ts +7 -1
- package/src/api/evm/EVMGetAddress.ts +1 -1
- package/src/api/evm/EVMGetPublicKey.ts +1 -1
- package/src/api/evm/EVMSignMessage.ts +1 -3
- package/src/api/evm/EVMSignMessageEIP712.ts +14 -2
- package/src/api/evm/EVMSignTransaction.ts +1 -3
- package/src/api/evm/EVMSignTypedData.ts +6 -8
- package/src/api/evm/EVMVerifyMessage.ts +1 -1
- package/src/api/filecoin/FilecoinSignTransaction.ts +0 -1
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +27 -4
- package/src/api/helpers/deviceInfo.ts +205 -0
- package/src/api/helpers/filesystemValidation.ts +51 -0
- package/src/api/index.ts +30 -1
- package/src/api/kaspa/KaspaSignTransaction.ts +0 -1
- package/src/api/near/NearSignTransaction.ts +0 -1
- package/src/api/nem/NEMSignTransaction.ts +0 -1
- package/src/api/neo/NeoGetAddress.ts +6 -1
- package/src/api/neo/NeoSignTransaction.ts +6 -2
- package/src/api/nervos/NervosGetAddress.ts +6 -2
- package/src/api/nervos/NervosSignTransaction.ts +6 -3
- package/src/api/nexa/NexaGetAddress.ts +6 -2
- package/src/api/nexa/NexaSignTransaction.ts +6 -4
- package/src/api/nostr/NostrSignEvent.ts +0 -1
- package/src/api/nostr/NostrSignSchnorr.ts +0 -1
- package/src/api/polkadot/PolkadotSignTransaction.ts +0 -1
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +50 -0
- package/src/api/protocol-v2/DeviceGetDeviceInfo.ts +35 -0
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +18 -0
- package/src/api/protocol-v2/DeviceReboot.ts +22 -0
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +27 -0
- package/src/api/protocol-v2/FactoryGetDeviceInfo.ts +18 -0
- package/src/api/protocol-v2/FilesystemDiskControl.ts +34 -0
- package/src/api/protocol-v2/FilesystemFixPermission.ts +14 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +14 -0
- package/src/api/protocol-v2/GetProtoVersion.ts +14 -0
- package/src/api/protocol-v2/Ping.ts +16 -0
- package/src/api/protocol-v2/helpers.ts +161 -0
- package/src/api/scdo/ScdoGetAddress.ts +6 -2
- package/src/api/scdo/ScdoSignMessage.ts +6 -2
- package/src/api/scdo/ScdoSignTransaction.ts +6 -3
- package/src/api/solana/SolGetAddress.ts +4 -0
- package/src/api/solana/SolSignMessage.ts +4 -1
- package/src/api/solana/SolSignOffchainMessage.ts +4 -1
- package/src/api/solana/SolSignTransaction.ts +8 -1
- package/src/api/starcoin/StarcoinSignMessage.ts +0 -1
- package/src/api/starcoin/StarcoinSignTransaction.ts +0 -1
- package/src/api/stellar/StellarGetAddress.ts +10 -1
- package/src/api/stellar/StellarSignTransaction.ts +14 -2
- package/src/api/sui/SuiSignMessage.ts +0 -1
- package/src/api/sui/SuiSignTransaction.ts +12 -10
- package/src/api/ton/TonSignData.ts +0 -1
- package/src/api/ton/TonSignMessage.ts +0 -1
- package/src/api/ton/TonSignProof.ts +0 -1
- package/src/api/tron/TronSignMessage.ts +5 -2
- package/src/api/tron/TronSignTransaction.ts +4 -1
- package/src/api/xrp/XrpSignTransaction.ts +1 -2
- package/src/core/RequestQueue.ts +3 -10
- package/src/core/index.ts +62 -153
- package/src/data/messages/messages-protocol-v2.json +13128 -0
- package/src/data-manager/DataManager.ts +12 -7
- package/src/data-manager/MessagesConfig.ts +14 -14
- package/src/data-manager/TransportManager.ts +38 -12
- package/src/device/Device.ts +98 -82
- package/src/device/DeviceCommands.ts +166 -26
- package/src/device/DeviceConnector.ts +29 -4
- package/src/device/DevicePool.ts +1 -1
- package/src/events/ui-request.ts +8 -0
- package/src/inject.ts +46 -2
- package/src/protocols/protocol-v2/features.ts +287 -0
- package/src/protocols/protocol-v2/firmware.ts +26 -0
- package/src/protocols/protocol-v2/index.ts +2 -0
- package/src/types/api/export.ts +1 -0
- package/src/types/api/firmwareUpdate.ts +12 -0
- package/src/types/api/getDeviceInfo.ts +97 -0
- package/src/types/api/getPassphraseState.ts +13 -2
- package/src/types/api/index.ts +80 -3
- package/src/types/api/protocolV2.ts +226 -0
- package/src/types/api/searchDevices.ts +2 -2
- package/src/types/device.ts +33 -2
- package/src/types/params.ts +4 -2
- package/src/types/settings.ts +1 -1
- package/src/utils/deviceFeaturesUtils.ts +62 -21
- package/src/utils/deviceInfoUtils.ts +15 -8
- package/src/utils/index.ts +1 -0
- package/__tests__/DeviceCommands.test.ts +0 -99
- package/__tests__/evmLedgerLegacySafety.test.ts +0 -261
- package/__tests__/preInitialize.test.ts +0 -22
- package/dist/api/device/PreInitialize.d.ts +0 -6
- package/dist/api/device/PreInitialize.d.ts.map +0 -1
- package/dist/core/PollingStateManager.d.ts +0 -8
- package/dist/core/PollingStateManager.d.ts.map +0 -1
- package/dist/types/api/preInitialize.d.ts +0 -3
- package/dist/types/api/preInitialize.d.ts.map +0 -1
- package/src/api/device/PreInitialize.ts +0 -41
- package/src/core/PollingStateManager.ts +0 -47
- package/src/types/api/preInitialize.ts +0 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
3
|
+
export const invalidParameter = (message: string) =>
|
|
4
|
+
ERRORS.TypedError(HardwareErrorCode.CallMethodInvalidParameter, message);
|
|
5
|
+
|
|
6
|
+
export function validateNonEmptyString(value: unknown, name: string): string {
|
|
7
|
+
if (typeof value !== 'string' || value.trim().length === 0) {
|
|
8
|
+
throw invalidParameter(`Parameter [${name}] is required and must be a non-empty string.`);
|
|
9
|
+
}
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function validateNonNegativeInteger(
|
|
14
|
+
value: unknown,
|
|
15
|
+
name: string,
|
|
16
|
+
defaultValue?: number
|
|
17
|
+
): number {
|
|
18
|
+
if (value === undefined || value === null) {
|
|
19
|
+
if (defaultValue !== undefined) return defaultValue;
|
|
20
|
+
throw invalidParameter(`Missing required parameter: ${name}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const numeric = typeof value === 'string' && value.trim() !== '' ? Number(value) : value;
|
|
24
|
+
if (typeof numeric !== 'number' || !Number.isSafeInteger(numeric) || numeric < 0) {
|
|
25
|
+
throw invalidParameter(`Parameter [${name}] must be a non-negative integer.`);
|
|
26
|
+
}
|
|
27
|
+
return numeric;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function validateOptionalNonNegativeInteger(
|
|
31
|
+
value: unknown,
|
|
32
|
+
name: string
|
|
33
|
+
): number | undefined {
|
|
34
|
+
if (value === undefined || value === null) return undefined;
|
|
35
|
+
return validateNonNegativeInteger(value, name);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function validateOptionalPercentage(value: unknown, name: string): number | undefined {
|
|
39
|
+
const numeric = validateOptionalNonNegativeInteger(value, name);
|
|
40
|
+
if (numeric === undefined) return undefined;
|
|
41
|
+
if (numeric > 100) {
|
|
42
|
+
throw invalidParameter(`Parameter [${name}] must be between 0 and 100.`);
|
|
43
|
+
}
|
|
44
|
+
return numeric;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function validateRequiredData(value: unknown, name: string): void {
|
|
48
|
+
if (value === undefined || value === null) {
|
|
49
|
+
throw invalidParameter(`Missing required parameter: ${name}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/api/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as testInitializeDeviceDuration } from './test/TestInitializeDeviceDuration';
|
|
2
|
-
export { default as preInitialize } from './device/PreInitialize';
|
|
3
2
|
|
|
4
3
|
export { default as searchDevices } from './SearchDevices';
|
|
5
4
|
export { default as getFeatures } from './GetFeatures';
|
|
5
|
+
export { default as getDeviceInfo } from './GetDeviceInfo';
|
|
6
6
|
export { default as getOnekeyFeatures } from './GetOnekeyFeatures';
|
|
7
7
|
export { default as getPassphraseState } from './GetPassphraseState';
|
|
8
8
|
export { default as getLogs } from './GetLogs';
|
|
@@ -38,8 +38,37 @@ export { default as getNextU2FCounter } from './u2f/GetNextU2FCounter';
|
|
|
38
38
|
export { default as firmwareUpdate } from './FirmwareUpdate';
|
|
39
39
|
export { default as firmwareUpdateV2 } from './FirmwareUpdateV2';
|
|
40
40
|
export { default as firmwareUpdateV3 } from './FirmwareUpdateV3';
|
|
41
|
+
export { default as firmwareUpdateV4 } from './FirmwareUpdateV4';
|
|
41
42
|
export { default as promptWebDeviceAccess } from './PromptWebDeviceAccess';
|
|
42
43
|
|
|
44
|
+
// File system & device control API (Protocol V2 only)
|
|
45
|
+
export { default as getProtoVersion } from './protocol-v2/GetProtoVersion';
|
|
46
|
+
export { default as ping } from './protocol-v2/Ping';
|
|
47
|
+
export { default as deviceReboot } from './protocol-v2/DeviceReboot';
|
|
48
|
+
export { default as deviceGetDeviceInfo } from './protocol-v2/DeviceGetDeviceInfo';
|
|
49
|
+
export { default as deviceGetOnboardingStatus } from './protocol-v2/DeviceGetOnboardingStatus';
|
|
50
|
+
export { default as deviceFirmwareUpdate } from './protocol-v2/DeviceFirmwareUpdate';
|
|
51
|
+
export { default as deviceGetFirmwareUpdateStatus } from './protocol-v2/DeviceGetFirmwareUpdateStatus';
|
|
52
|
+
export { default as factoryDeviceInfoSettings } from './protocol-v2/FactoryDeviceInfoSettings';
|
|
53
|
+
export { default as factoryGetDeviceInfo } from './protocol-v2/FactoryGetDeviceInfo';
|
|
54
|
+
export { default as filesystemFixPermission } from './protocol-v2/FilesystemFixPermission';
|
|
55
|
+
export { default as filesystemFormat } from './protocol-v2/FilesystemFormat';
|
|
56
|
+
export { default as filesystemDiskControl } from './protocol-v2/FilesystemDiskControl';
|
|
57
|
+
export { default as fileRead } from './FileRead';
|
|
58
|
+
export { default as fileWrite } from './FileWrite';
|
|
59
|
+
export { default as fileDelete } from './FileDelete';
|
|
60
|
+
export { default as dirList } from './DirList';
|
|
61
|
+
export { default as dirMake } from './DirMake';
|
|
62
|
+
export { default as dirRemove } from './DirRemove';
|
|
63
|
+
export { default as pathInfo } from './PathInfo';
|
|
64
|
+
export { default as filesystemFileRead } from './FileRead';
|
|
65
|
+
export { default as filesystemFileWrite } from './FileWrite';
|
|
66
|
+
export { default as filesystemFileDelete } from './FileDelete';
|
|
67
|
+
export { default as filesystemDirList } from './DirList';
|
|
68
|
+
export { default as filesystemDirMake } from './DirMake';
|
|
69
|
+
export { default as filesystemDirRemove } from './DirRemove';
|
|
70
|
+
export { default as filesystemPathInfoQuery } from './PathInfo';
|
|
71
|
+
|
|
43
72
|
export { default as cipherKeyValue } from './CipherKeyValue';
|
|
44
73
|
|
|
45
74
|
export { default as allNetworkGetAddress } from './allnetwork/AllNetworkGetAddress';
|
|
@@ -22,7 +22,6 @@ export default class KaspaSignTransaction extends BaseMethod<KaspaSignTransactio
|
|
|
22
22
|
init() {
|
|
23
23
|
this.checkDeviceId = true;
|
|
24
24
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
25
|
-
this.allowUsePreInitialize = true;
|
|
26
25
|
|
|
27
26
|
const payload = this.payload as KaspaSignTransactionParams;
|
|
28
27
|
|
|
@@ -10,7 +10,6 @@ export default class NearSignTransaction extends BaseMethod<HardwareNearSignTx>
|
|
|
10
10
|
init() {
|
|
11
11
|
this.checkDeviceId = true;
|
|
12
12
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
-
this.allowUsePreInitialize = true;
|
|
14
13
|
|
|
15
14
|
// check payload
|
|
16
15
|
validateParams(this.payload, [
|
|
@@ -230,7 +230,6 @@ export default class NEMSignTransaction extends BaseMethod<NEMSignTx> {
|
|
|
230
230
|
init() {
|
|
231
231
|
this.checkDeviceId = true;
|
|
232
232
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
233
|
-
this.allowUsePreInitialize = true;
|
|
234
233
|
|
|
235
234
|
validateParams(this.payload, [
|
|
236
235
|
{ name: 'path', required: true },
|
|
@@ -5,6 +5,7 @@ import { UI_REQUEST } from '../../constants/ui-request';
|
|
|
5
5
|
|
|
6
6
|
import type { NeoGetAddress as HardwareNeoGetAddress } from '@onekeyfe/hd-transport';
|
|
7
7
|
import type { NeoAddress, NeoGetAddressParams } from '../../types/api/neoGetAddress';
|
|
8
|
+
import type { DeviceFirmwareRange } from '../../types';
|
|
8
9
|
|
|
9
10
|
export default class NeoGetAddress extends BaseMethod<HardwareNeoGetAddress[]> {
|
|
10
11
|
hasBundle = false;
|
|
@@ -37,8 +38,12 @@ export default class NeoGetAddress extends BaseMethod<HardwareNeoGetAddress[]> {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
getVersionRange() {
|
|
41
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
41
42
|
return {
|
|
43
|
+
pro2: {
|
|
44
|
+
min: '0.0.0',
|
|
45
|
+
unsupported: true,
|
|
46
|
+
},
|
|
42
47
|
pro: {
|
|
43
48
|
min: '4.12.0',
|
|
44
49
|
},
|
|
@@ -5,12 +5,12 @@ import { validateParams } from '../helpers/paramsValidator';
|
|
|
5
5
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
6
6
|
|
|
7
7
|
import type { NeoSignTx } from '@onekeyfe/hd-transport';
|
|
8
|
+
import type { DeviceFirmwareRange } from '../../types';
|
|
8
9
|
|
|
9
10
|
export default class NeoSignTransaction extends BaseMethod<NeoSignTx> {
|
|
10
11
|
init() {
|
|
11
12
|
this.checkDeviceId = true;
|
|
12
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
13
|
-
this.allowUsePreInitialize = true;
|
|
14
14
|
this.strictCheckDeviceSupport = true;
|
|
15
15
|
|
|
16
16
|
validateParams(this.payload, [
|
|
@@ -29,8 +29,12 @@ export default class NeoSignTransaction extends BaseMethod<NeoSignTx> {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
getVersionRange() {
|
|
32
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
33
33
|
return {
|
|
34
|
+
pro2: {
|
|
35
|
+
min: '0.0.0',
|
|
36
|
+
unsupported: true,
|
|
37
|
+
},
|
|
34
38
|
pro: {
|
|
35
39
|
min: '4.12.0',
|
|
36
40
|
},
|
|
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
|
|
6
6
|
import type { NervosGetAddress as HardwareNervosGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
-
import type { NervosAddress, NervosGetAddressParams } from '../../types';
|
|
7
|
+
import type { DeviceFirmwareRange, NervosAddress, NervosGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class NervosGetAddress extends BaseMethod<HardwareNervosGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -40,8 +40,12 @@ export default class NervosGetAddress extends BaseMethod<HardwareNervosGetAddres
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
getVersionRange() {
|
|
43
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
44
44
|
return {
|
|
45
|
+
pro2: {
|
|
46
|
+
min: '0.0.0',
|
|
47
|
+
unsupported: true,
|
|
48
|
+
},
|
|
45
49
|
model_mini: {
|
|
46
50
|
min: '3.7.0',
|
|
47
51
|
},
|
|
@@ -5,7 +5,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
5
5
|
import { validateParams } from '../helpers/paramsValidator';
|
|
6
6
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
7
7
|
|
|
8
|
-
import type { NervosSignTransactionParams, NervosSignedTx } from '../../types';
|
|
8
|
+
import type { DeviceFirmwareRange, NervosSignTransactionParams, NervosSignedTx } from '../../types';
|
|
9
9
|
import type { NervosSignTx as HardwareNervosSignTx, TypedCall } from '@onekeyfe/hd-transport';
|
|
10
10
|
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
11
11
|
|
|
@@ -19,7 +19,6 @@ export default class NervosSignTransaction extends BaseMethod<NervosSignTx> {
|
|
|
19
19
|
init() {
|
|
20
20
|
this.checkDeviceId = true;
|
|
21
21
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
22
|
-
this.allowUsePreInitialize = true;
|
|
23
22
|
|
|
24
23
|
// check payload
|
|
25
24
|
validateParams(this.payload, [
|
|
@@ -41,8 +40,12 @@ export default class NervosSignTransaction extends BaseMethod<NervosSignTx> {
|
|
|
41
40
|
};
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
getVersionRange() {
|
|
43
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
45
44
|
return {
|
|
45
|
+
pro2: {
|
|
46
|
+
min: '0.0.0',
|
|
47
|
+
unsupported: true,
|
|
48
|
+
},
|
|
46
49
|
model_mini: {
|
|
47
50
|
min: '3.7.0',
|
|
48
51
|
},
|
|
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
|
|
6
6
|
import type { NexaGetAddress as HardwareNexaGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
-
import type { NexaGetAddressParams } from '../../types';
|
|
7
|
+
import type { DeviceFirmwareRange, NexaGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class NexaGetAddress extends BaseMethod<HardwareNexaGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -43,8 +43,12 @@ export default class NexaGetAddress extends BaseMethod<HardwareNexaGetAddress[]>
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
getVersionRange() {
|
|
46
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
47
47
|
return {
|
|
48
|
+
pro2: {
|
|
49
|
+
min: '0.0.0',
|
|
50
|
+
unsupported: true,
|
|
51
|
+
},
|
|
48
52
|
model_mini: {
|
|
49
53
|
min: '3.2.0',
|
|
50
54
|
},
|
|
@@ -6,14 +6,12 @@ import { validateParams } from '../helpers/paramsValidator';
|
|
|
6
6
|
|
|
7
7
|
import type { TypedResponseMessage } from '../../device/DeviceCommands';
|
|
8
8
|
import type { TypedCall } from '@onekeyfe/hd-transport';
|
|
9
|
-
import type { NexaSignTransactionParams, NexaSignature } from '../../types';
|
|
9
|
+
import type { DeviceFirmwareRange, NexaSignTransactionParams, NexaSignature } from '../../types';
|
|
10
10
|
|
|
11
11
|
export default class NexaSignTransaction extends BaseMethod<NexaSignTransactionParams> {
|
|
12
12
|
hasBundle = false;
|
|
13
13
|
|
|
14
14
|
init() {
|
|
15
|
-
this.allowUsePreInitialize = true;
|
|
16
|
-
|
|
17
15
|
const payload = this.payload as NexaSignTransactionParams;
|
|
18
16
|
|
|
19
17
|
payload.inputs.forEach(input => {
|
|
@@ -27,8 +25,12 @@ export default class NexaSignTransaction extends BaseMethod<NexaSignTransactionP
|
|
|
27
25
|
this.params = payload;
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
getVersionRange() {
|
|
28
|
+
getVersionRange(): DeviceFirmwareRange {
|
|
31
29
|
return {
|
|
30
|
+
pro2: {
|
|
31
|
+
min: '0.0.0',
|
|
32
|
+
unsupported: true,
|
|
33
|
+
},
|
|
32
34
|
model_mini: {
|
|
33
35
|
min: '3.2.0',
|
|
34
36
|
},
|
|
@@ -15,7 +15,6 @@ export default class NostrSignEvent extends BaseMethod<SignEvent> {
|
|
|
15
15
|
init() {
|
|
16
16
|
this.checkDeviceId = true;
|
|
17
17
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
18
|
-
this.allowUsePreInitialize = true;
|
|
19
18
|
|
|
20
19
|
const { payload } = this;
|
|
21
20
|
if (!validateEvent(payload.event)) {
|
|
@@ -11,7 +11,6 @@ export default class NostrSignSchnorr extends BaseMethod<SignSchnorr> {
|
|
|
11
11
|
init() {
|
|
12
12
|
this.checkDeviceId = true;
|
|
13
13
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
-
this.allowUsePreInitialize = true;
|
|
15
14
|
|
|
16
15
|
const { payload } = this;
|
|
17
16
|
validateParams(payload, [
|
|
@@ -13,7 +13,6 @@ export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadot
|
|
|
13
13
|
init() {
|
|
14
14
|
this.checkDeviceId = true;
|
|
15
15
|
this.allowDeviceMode = [...this.allowDeviceMode];
|
|
16
|
-
this.allowUsePreInitialize = true;
|
|
17
16
|
|
|
18
17
|
// check payload
|
|
19
18
|
validateParams(this.payload, [
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
import {
|
|
3
|
+
PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS,
|
|
4
|
+
PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES,
|
|
5
|
+
normalizeFirmwareTargets,
|
|
6
|
+
} from './helpers';
|
|
7
|
+
import { UI_REQUEST, createUiMessage } from '../../events/ui-request';
|
|
8
|
+
import type { KnownDevice } from '../../types';
|
|
9
|
+
|
|
10
|
+
import type { DeviceFirmwareUpdateParams } from './helpers';
|
|
11
|
+
|
|
12
|
+
export default class DeviceFirmwareUpdate extends BaseMethod<DeviceFirmwareUpdateParams> {
|
|
13
|
+
init() {
|
|
14
|
+
this.skipForceUpdateCheck = true;
|
|
15
|
+
this.useDevicePassphraseState = false;
|
|
16
|
+
this.params = {
|
|
17
|
+
targets: this.payload.targets,
|
|
18
|
+
targetId: this.payload.targetId,
|
|
19
|
+
target_id: this.payload.target_id,
|
|
20
|
+
path: this.payload.path,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async run() {
|
|
25
|
+
const targets = normalizeFirmwareTargets(this.params);
|
|
26
|
+
const res = await this.device.commands.typedCall(
|
|
27
|
+
'DeviceFirmwareUpdate',
|
|
28
|
+
PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES,
|
|
29
|
+
{
|
|
30
|
+
targets,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
...PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS,
|
|
34
|
+
onIntermediateResponse: response => {
|
|
35
|
+
if (response.type !== 'DeviceFirmwareInstallProgress') return;
|
|
36
|
+
const progress = Number(response.message?.progress);
|
|
37
|
+
if (!Number.isFinite(progress)) return;
|
|
38
|
+
this.postMessage(
|
|
39
|
+
createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, {
|
|
40
|
+
device: this.device.toMessageObject() as KnownDevice,
|
|
41
|
+
progress: Math.min(Math.max(progress, 0), 100),
|
|
42
|
+
progressType: 'installingFirmware',
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
return Promise.resolve(res.message);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
import { buildTargets, buildTypes } from './helpers';
|
|
3
|
+
|
|
4
|
+
import type { DeviceGetDeviceInfoParams } from './helpers';
|
|
5
|
+
|
|
6
|
+
export default class DeviceGetDeviceInfo extends BaseMethod<DeviceGetDeviceInfoParams> {
|
|
7
|
+
init() {
|
|
8
|
+
this.skipForceUpdateCheck = true;
|
|
9
|
+
this.useDevicePassphraseState = false;
|
|
10
|
+
this.params = {
|
|
11
|
+
targets: this.payload.targets,
|
|
12
|
+
types: this.payload.types,
|
|
13
|
+
targetHw: this.payload.targetHw,
|
|
14
|
+
targetFw: this.payload.targetFw,
|
|
15
|
+
targetBt: this.payload.targetBt,
|
|
16
|
+
targetSe1: this.payload.targetSe1,
|
|
17
|
+
targetSe2: this.payload.targetSe2,
|
|
18
|
+
targetSe3: this.payload.targetSe3,
|
|
19
|
+
targetSe4: this.payload.targetSe4,
|
|
20
|
+
targetStatus: this.payload.targetStatus,
|
|
21
|
+
includeVersion: this.payload.includeVersion,
|
|
22
|
+
includeBuildId: this.payload.includeBuildId,
|
|
23
|
+
includeHash: this.payload.includeHash,
|
|
24
|
+
includeSpecific: this.payload.includeSpecific,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async run() {
|
|
29
|
+
const res = await this.device.commands.typedCall('DeviceGetDeviceInfo', 'DeviceInfo', {
|
|
30
|
+
targets: buildTargets(this.params),
|
|
31
|
+
types: buildTypes(this.params),
|
|
32
|
+
});
|
|
33
|
+
return Promise.resolve(res.message);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
export default class DeviceGetFirmwareUpdateStatus extends BaseMethod {
|
|
4
|
+
init() {
|
|
5
|
+
this.skipForceUpdateCheck = true;
|
|
6
|
+
this.useDevicePassphraseState = false;
|
|
7
|
+
this.params = undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run() {
|
|
11
|
+
const res = await this.device.commands.typedCall(
|
|
12
|
+
'DeviceGetFirmwareUpdateStatus',
|
|
13
|
+
'DeviceFirmwareUpdateStatus',
|
|
14
|
+
{}
|
|
15
|
+
);
|
|
16
|
+
return Promise.resolve(res.message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
export default class DeviceGetOnboardingStatus extends BaseMethod {
|
|
4
|
+
init() {
|
|
5
|
+
this.skipForceUpdateCheck = true;
|
|
6
|
+
this.useDevicePassphraseState = false;
|
|
7
|
+
this.params = undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run() {
|
|
11
|
+
const res = await this.device.commands.typedCall(
|
|
12
|
+
'DeviceGetOnboardingStatus',
|
|
13
|
+
'DeviceOnboardingStatus',
|
|
14
|
+
{}
|
|
15
|
+
);
|
|
16
|
+
return Promise.resolve(res.message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
import { normalizeRebootType } from './helpers';
|
|
3
|
+
|
|
4
|
+
import type { DeviceRebootParams } from './helpers';
|
|
5
|
+
|
|
6
|
+
export default class DeviceReboot extends BaseMethod<DeviceRebootParams> {
|
|
7
|
+
init() {
|
|
8
|
+
this.skipForceUpdateCheck = true;
|
|
9
|
+
this.useDevicePassphraseState = false;
|
|
10
|
+
this.params = {
|
|
11
|
+
rebootType: this.payload.rebootType,
|
|
12
|
+
reboot_type: this.payload.reboot_type,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async run() {
|
|
17
|
+
const res = await this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
18
|
+
reboot_type: normalizeRebootType(this.params.reboot_type ?? this.params.rebootType),
|
|
19
|
+
});
|
|
20
|
+
return Promise.resolve(res.message);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
import type { FactoryDeviceInfoSettingsParams } from './helpers';
|
|
4
|
+
|
|
5
|
+
export default class FactoryDeviceInfoSettings extends BaseMethod<FactoryDeviceInfoSettingsParams> {
|
|
6
|
+
init() {
|
|
7
|
+
this.skipForceUpdateCheck = true;
|
|
8
|
+
this.useDevicePassphraseState = false;
|
|
9
|
+
this.params = {
|
|
10
|
+
serial_no: this.payload.serial_no,
|
|
11
|
+
serialNo: this.payload.serialNo,
|
|
12
|
+
cpu_info: this.payload.cpu_info,
|
|
13
|
+
cpuInfo: this.payload.cpuInfo,
|
|
14
|
+
pre_firmware: this.payload.pre_firmware,
|
|
15
|
+
preFirmware: this.payload.preFirmware,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async run() {
|
|
20
|
+
const res = await this.device.commands.typedCall('FactoryDeviceInfoSettings', 'Success', {
|
|
21
|
+
serial_no: this.params.serial_no ?? this.params.serialNo,
|
|
22
|
+
cpu_info: this.params.cpu_info ?? this.params.cpuInfo,
|
|
23
|
+
pre_firmware: this.params.pre_firmware ?? this.params.preFirmware,
|
|
24
|
+
});
|
|
25
|
+
return Promise.resolve(res.message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
export default class FactoryGetDeviceInfo extends BaseMethod {
|
|
4
|
+
init() {
|
|
5
|
+
this.skipForceUpdateCheck = true;
|
|
6
|
+
this.useDevicePassphraseState = false;
|
|
7
|
+
this.params = undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run() {
|
|
11
|
+
const res = await this.device.commands.typedCall(
|
|
12
|
+
'FactoryGetDeviceInfo',
|
|
13
|
+
'FactoryDeviceInfo',
|
|
14
|
+
{}
|
|
15
|
+
);
|
|
16
|
+
return Promise.resolve(res.message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
import {
|
|
3
|
+
validateNonNegativeInteger,
|
|
4
|
+
validateOptionalNonNegativeInteger,
|
|
5
|
+
} from '../helpers/filesystemValidation';
|
|
6
|
+
|
|
7
|
+
export type FilesystemDiskControlParams = {
|
|
8
|
+
enable?: number | string;
|
|
9
|
+
timeoutMs?: number | string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default class FilesystemDiskControl extends BaseMethod<FilesystemDiskControlParams> {
|
|
13
|
+
init() {
|
|
14
|
+
this.skipForceUpdateCheck = true;
|
|
15
|
+
this.useDevicePassphraseState = false;
|
|
16
|
+
this.params = {
|
|
17
|
+
enable: validateNonNegativeInteger(this.payload.enable, 'enable', 0),
|
|
18
|
+
timeoutMs: validateOptionalNonNegativeInteger(this.payload.timeoutMs, 'timeoutMs'),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async run() {
|
|
23
|
+
const timeoutMs = Number(this.params.timeoutMs);
|
|
24
|
+
const res = await this.device.commands.typedCall(
|
|
25
|
+
'FilesystemDiskControl',
|
|
26
|
+
'Success',
|
|
27
|
+
{
|
|
28
|
+
enable: Number(this.params.enable ?? 0),
|
|
29
|
+
},
|
|
30
|
+
Number.isFinite(timeoutMs) && timeoutMs > 0 ? { timeoutMs } : undefined
|
|
31
|
+
);
|
|
32
|
+
return Promise.resolve(res.message);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
export default class FilesystemFixPermission extends BaseMethod {
|
|
4
|
+
init() {
|
|
5
|
+
this.skipForceUpdateCheck = true;
|
|
6
|
+
this.useDevicePassphraseState = false;
|
|
7
|
+
this.params = undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run() {
|
|
11
|
+
const res = await this.device.commands.typedCall('FilesystemFixPermission', 'Success', {});
|
|
12
|
+
return Promise.resolve(res.message);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
export default class FilesystemFormat extends BaseMethod {
|
|
4
|
+
init() {
|
|
5
|
+
this.skipForceUpdateCheck = true;
|
|
6
|
+
this.useDevicePassphraseState = false;
|
|
7
|
+
this.params = undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run() {
|
|
11
|
+
const res = await this.device.commands.typedCall('FilesystemFormat', 'Success', {});
|
|
12
|
+
return Promise.resolve(res.message);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
export default class GetProtoVersion extends BaseMethod {
|
|
4
|
+
init() {
|
|
5
|
+
this.skipForceUpdateCheck = true;
|
|
6
|
+
this.useDevicePassphraseState = false;
|
|
7
|
+
this.params = undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run() {
|
|
11
|
+
const res = await this.device.commands.typedCall('GetProtoVersion', 'ProtoVersion', {});
|
|
12
|
+
return Promise.resolve(res.message);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
|
|
3
|
+
export default class Ping extends BaseMethod<{ message?: string }> {
|
|
4
|
+
init() {
|
|
5
|
+
this.skipForceUpdateCheck = true;
|
|
6
|
+
this.useDevicePassphraseState = false;
|
|
7
|
+
this.params = { message: this.payload.message };
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async run() {
|
|
11
|
+
const res = await this.device.commands.typedCall('Ping', 'Success', {
|
|
12
|
+
message: this.params.message ?? '',
|
|
13
|
+
});
|
|
14
|
+
return Promise.resolve(res.message);
|
|
15
|
+
}
|
|
16
|
+
}
|