@onekeyfe/hd-core 1.2.0-alpha.0 → 1.2.0-alpha.10
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__/connectSettings.test.ts +19 -0
- package/__tests__/device-wallet-session-store.test.ts +131 -0
- package/__tests__/preInitialize.test.ts +33 -0
- package/__tests__/protocol-v2-firmware-targets.test.ts +19 -0
- package/__tests__/protocol-v2.test.ts +1930 -765
- package/dist/api/ClearSessionCache.d.ts +9 -0
- package/dist/api/ClearSessionCache.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +26 -5
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetDeviceInfo.d.ts.map +1 -1
- package/dist/api/GetFeatures.d.ts +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +4 -4
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/bootloaderHelper.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +4 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/progressThrottle.d.ts +3 -0
- package/dist/api/firmware/progressThrottle.d.ts.map +1 -0
- package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
- package/dist/api/index.d.ts +8 -10
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +3 -2
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/{DeviceGetDeviceInfo.d.ts → DeviceInfoGet.d.ts} +10 -10
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSessionGet.d.ts +9 -0
- package/dist/api/protocol-v2/DeviceSessionGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -1
- package/dist/api/protocol-v2/{FilesystemFixPermission.d.ts → FilesystemPermissionFix.d.ts} +2 -2
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +1 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts +6 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +27 -19
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +1 -5
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +0 -1
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +0 -1
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/data-manager/connectSettings.d.ts.map +1 -1
- package/dist/device/Device.d.ts +17 -18
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceWalletSessionStore.d.ts +15 -0
- package/dist/device/DeviceWalletSessionStore.d.ts.map +1 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts +6 -0
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -0
- package/dist/deviceProfile/buildDeviceProfile.d.ts +3 -4
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -1
- package/dist/deviceProfile/index.d.ts +1 -1
- package/dist/deviceProfile/index.d.ts.map +1 -1
- package/dist/index.d.ts +657 -539
- package/dist/index.js +2579 -2161
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +12 -14
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +11 -9
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/index.d.ts +1 -0
- package/dist/protocols/protocol-v2/index.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/walletSession.d.ts +13 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdate.d.ts +4 -6
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +4 -2
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +4 -4
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +11 -11
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +16 -17
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/api/sessionCache.d.ts +10 -0
- package/dist/types/api/sessionCache.d.ts.map +1 -0
- package/dist/types/device.d.ts +88 -8
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +21 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/capabilitieUtils.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +2 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/findDefectiveBatchDevice.d.ts +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/ClearSessionCache.ts +28 -0
- package/src/api/FileRead.ts +16 -3
- package/src/api/FileWrite.ts +14 -1
- package/src/api/FirmwareUpdateV2.ts +9 -2
- package/src/api/FirmwareUpdateV3.ts +2 -1
- package/src/api/FirmwareUpdateV4.ts +1089 -285
- package/src/api/GetDeviceInfo.ts +6 -13
- package/src/api/GetOnekeyFeatures.ts +3 -14
- package/src/api/GetPassphraseState.ts +7 -4
- package/src/api/device/DeviceRebootToBoardloader.ts +4 -4
- package/src/api/device/DeviceRebootToBootloader.ts +4 -4
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +18 -4
- package/src/api/firmware/bootloaderHelper.ts +3 -2
- package/src/api/firmware/getBinary.ts +1 -1
- package/src/api/firmware/progressThrottle.ts +44 -0
- package/src/api/firmware/releaseHelper.ts +3 -3
- package/src/api/firmware/uploadFirmware.ts +5 -2
- package/src/api/index.ts +8 -10
- package/src/api/protocol-v2/{FactoryGetDeviceInfo.ts → DeviceFactoryInfoGet.ts} +3 -3
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +32 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +3 -5
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +39 -5
- package/src/api/protocol-v2/{DeviceGetDeviceInfo.ts → DeviceInfoGet.ts} +52 -22
- package/src/api/protocol-v2/DeviceReboot.ts +2 -2
- package/src/api/protocol-v2/DeviceSessionGet.ts +26 -0
- package/src/api/protocol-v2/DeviceStatusGet.ts +14 -0
- package/src/api/protocol-v2/FilesystemFormat.ts +4 -1
- package/src/api/protocol-v2/{FilesystemFixPermission.ts → FilesystemPermissionFix.ts} +2 -2
- package/src/api/protocol-v2/{GetProtoVersion.ts → ProtocolInfoRequest.ts} +2 -2
- package/src/api/protocol-v2/helpers.ts +58 -59
- package/src/api/ton/TonSignData.ts +1 -5
- package/src/api/tron/TronSignMessage.ts +0 -1
- package/src/api/tron/TronSignTransaction.ts +0 -1
- package/src/constants/index.ts +10 -1
- package/src/core/index.ts +22 -10
- package/src/data/messages/messages-protocol-v2.json +992 -1420
- package/src/data/messages/messages.json +8 -0
- package/src/data-manager/DataManager.ts +11 -4
- package/src/data-manager/connectSettings.ts +4 -0
- package/src/device/Device.ts +158 -294
- package/src/device/DevicePool.ts +9 -9
- package/src/device/DeviceWalletSessionStore.ts +78 -0
- package/src/deviceProfile/buildDeviceFeatures.ts +365 -0
- package/src/deviceProfile/buildDeviceProfile.ts +165 -200
- package/src/deviceProfile/index.ts +4 -1
- package/src/inject.ts +13 -16
- package/src/protocols/protocol-v2/features.ts +28 -67
- package/src/protocols/protocol-v2/firmware.ts +12 -36
- package/src/protocols/protocol-v2/index.ts +1 -0
- package/src/protocols/protocol-v2/walletSession.ts +83 -0
- package/src/types/api/firmwareUpdate.ts +16 -20
- package/src/types/api/getDeviceInfo.ts +4 -2
- package/src/types/api/getPassphraseState.ts +4 -4
- package/src/types/api/index.ts +17 -20
- package/src/types/api/protocolV2.ts +35 -40
- package/src/types/api/sessionCache.ts +14 -0
- package/src/types/device.ts +98 -34
- package/src/types/params.ts +4 -0
- package/src/types/settings.ts +42 -30
- package/src/utils/capabilitieUtils.ts +1 -2
- package/src/utils/deviceFeaturesUtils.ts +54 -29
- package/src/utils/deviceInfoUtils.ts +11 -29
- package/src/utils/deviceVersionUtils.ts +7 -25
- package/src/utils/findDefectiveBatchDevice.ts +6 -6
- package/dist/api/protocol-v2/DevReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DevReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
- package/dist/deviceProfile/legacyFeaturesView.d.ts +0 -5
- package/dist/deviceProfile/legacyFeaturesView.d.ts.map +0 -1
- package/src/api/protocol-v2/DevReboot.ts +0 -24
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -16
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -29
- package/src/deviceProfile/legacyFeaturesView.ts +0 -123
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DeviceSEState, DeviceSeType } from '@onekeyfe/hd-transport';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { DeviceInfoGet, DeviceSEInfo, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
4
4
|
import type { DeviceCommands } from '../../device/DeviceCommands';
|
|
5
5
|
|
|
6
|
-
// 单源类型:直接使用 hd-transport 生成的 ProtocolV2DeviceInfo /
|
|
7
|
-
//
|
|
6
|
+
// 单源类型:直接使用 hd-transport 生成的 ProtocolV2DeviceInfo / DeviceSEInfo /
|
|
7
|
+
// DeviceFirmwareImageInfo(与 firmware-pro2 proto 一致),不再维护手写副本。
|
|
8
8
|
export type { ProtocolV2DeviceInfo };
|
|
9
|
-
export type {
|
|
10
|
-
export type {
|
|
9
|
+
export type { DeviceFirmwareImageInfo as ProtocolV2FirmwareImageInfo } from '@onekeyfe/hd-transport';
|
|
10
|
+
export type { DeviceSEInfo as ProtocolV2SEInfo } from '@onekeyfe/hd-transport';
|
|
11
11
|
|
|
12
12
|
export type ProtocolV2SeStateLabel = 'BOOT' | 'APP_FACTORY' | 'APP';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* 传输层沿用历史 decode 语义:单值 proto enum 输出为名称字符串。
|
|
16
|
+
* 这里按 SDK decode 后的字符串语义处理,同时接受数字枚举,便于低层调用复用。
|
|
17
17
|
*/
|
|
18
18
|
const normalizeEnumValue = <T extends Record<string | number, string | number>>(
|
|
19
19
|
enumObject: T,
|
|
@@ -26,11 +26,11 @@ const normalizeEnumValue = <T extends Record<string | number, string | number>>(
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* DeviceSEInfo.state → 可读标签。SDK 内唯一的 SE 状态映射实现,
|
|
30
|
+
* DeviceProfile 与标准 Features 构建都从这里取。
|
|
31
31
|
*/
|
|
32
|
-
export const getProtocolV2SeState = (se?:
|
|
33
|
-
const label = normalizeEnumValue(
|
|
32
|
+
export const getProtocolV2SeState = (se?: DeviceSEInfo): ProtocolV2SeStateLabel | null => {
|
|
33
|
+
const label = normalizeEnumValue(DeviceSEState, se?.state);
|
|
34
34
|
switch (label) {
|
|
35
35
|
case 'BOOT':
|
|
36
36
|
return 'BOOT';
|
|
@@ -44,17 +44,20 @@ export const getProtocolV2SeState = (se?: DevSEInfo): ProtocolV2SeStateLabel | n
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
47
|
+
* DeviceSEInfo.type → 可读标签(如 'THD89')。DeviceProfile / Features
|
|
48
|
+
* 的 SE 类型归一化从这里取。
|
|
49
49
|
*/
|
|
50
|
-
export const getProtocolV2SeType = (se?:
|
|
51
|
-
normalizeEnumValue(
|
|
50
|
+
export const getProtocolV2SeType = (se?: DeviceSEInfo): string | null =>
|
|
51
|
+
normalizeEnumValue(DeviceSeType, se?.type);
|
|
52
|
+
|
|
53
|
+
export const isProtocolV2BootloaderDeviceInfo = (deviceInfo?: ProtocolV2DeviceInfo | null) =>
|
|
54
|
+
!!deviceInfo && deviceInfo.status == null;
|
|
52
55
|
|
|
53
56
|
export const PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST = {
|
|
54
57
|
targets: {
|
|
55
58
|
hw: true,
|
|
56
59
|
fw: true,
|
|
57
|
-
|
|
60
|
+
coprocessor: true,
|
|
58
61
|
status: true,
|
|
59
62
|
},
|
|
60
63
|
types: {
|
|
@@ -66,15 +69,13 @@ export const PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST = {
|
|
|
66
69
|
/**
|
|
67
70
|
* 轻量状态刷新请求(每次 run 前使用)。
|
|
68
71
|
*
|
|
69
|
-
* status 提供 init_states /
|
|
70
|
-
* hw /
|
|
71
|
-
* 覆盖语义,缺少 hw/bt 会把已有 profile 的身份字段清空。不含 fw/SE targets,
|
|
72
|
-
* 单帧请求开销很小。
|
|
72
|
+
* status 提供 init_states / passphrase_enabled 等会在设备端变化的字段;
|
|
73
|
+
* hw / coprocessor 提供 serialNo / bleName 等身份字段;不含 fw/SE targets,单帧请求开销很小。
|
|
73
74
|
*/
|
|
74
75
|
export const PROTOCOL_V2_STATUS_DEVICE_INFO_REQUEST = {
|
|
75
76
|
targets: {
|
|
76
77
|
hw: true,
|
|
77
|
-
|
|
78
|
+
coprocessor: true,
|
|
78
79
|
status: true,
|
|
79
80
|
},
|
|
80
81
|
types: {
|
|
@@ -87,7 +88,7 @@ export const PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST = {
|
|
|
87
88
|
targets: {
|
|
88
89
|
hw: true,
|
|
89
90
|
fw: true,
|
|
90
|
-
|
|
91
|
+
coprocessor: true,
|
|
91
92
|
se1: true,
|
|
92
93
|
se2: true,
|
|
93
94
|
se3: true,
|
|
@@ -104,7 +105,7 @@ export const PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST = {
|
|
|
104
105
|
targets: {
|
|
105
106
|
hw: true,
|
|
106
107
|
fw: true,
|
|
107
|
-
|
|
108
|
+
coprocessor: true,
|
|
108
109
|
se1: true,
|
|
109
110
|
se2: true,
|
|
110
111
|
se3: true,
|
|
@@ -122,43 +123,6 @@ export const PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST = {
|
|
|
122
123
|
export const PROTOCOL_V2_DEVICE_INFO_REQUEST = PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST;
|
|
123
124
|
export const PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS = 10 * 1000;
|
|
124
125
|
|
|
125
|
-
/**
|
|
126
|
-
* 临时开关(默认开启):当前 Pro2 测试固件 / 早期工程板尚未实现 DevGetDeviceInfo,
|
|
127
|
-
* 真实调用只会超时失败。开启时跳过 wire 调用,直接返回 mock DeviceInfo;
|
|
128
|
-
* profile 的身份字段(serialNo/deviceId)由 buildProfileFromProtocolV2 的
|
|
129
|
-
* fallbackSerialNo(transport path)兜底。
|
|
130
|
-
*
|
|
131
|
-
* 固件实现 DevGetDeviceInfo 后:把默认值改回 false(或直接删除开关与 mock)。
|
|
132
|
-
* 注意:开启期间 FirmwareUpdateV4 的“升级完成版本比对”拿到的也是 mock 版本,
|
|
133
|
-
* 不能作为升级成功的依据。
|
|
134
|
-
*/
|
|
135
|
-
let protocolV2DeviceInfoMockEnabled = true;
|
|
136
|
-
|
|
137
|
-
export const setProtocolV2DeviceInfoMock = (enabled: boolean) => {
|
|
138
|
-
protocolV2DeviceInfoMockEnabled = enabled;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export const isProtocolV2DeviceInfoMockEnabled = () => protocolV2DeviceInfoMockEnabled;
|
|
142
|
-
|
|
143
|
-
/** 每次调用返回新对象,避免调用方原地修改互相污染。 */
|
|
144
|
-
export const buildMockProtocolV2DeviceInfo = (): ProtocolV2DeviceInfo => ({
|
|
145
|
-
protocol_version: 2,
|
|
146
|
-
hw: {
|
|
147
|
-
// 留空:profile 身份走 fallbackSerialNo(transport path)
|
|
148
|
-
serial_no: '',
|
|
149
|
-
},
|
|
150
|
-
fw: {
|
|
151
|
-
app: { version: '0.1.0' },
|
|
152
|
-
},
|
|
153
|
-
bt: {},
|
|
154
|
-
status: {
|
|
155
|
-
init_states: true,
|
|
156
|
-
language: 'en_US',
|
|
157
|
-
passphrase_protection: false,
|
|
158
|
-
bt_enable: true,
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
|
|
162
126
|
export async function requestProtocolV2DeviceInfo({
|
|
163
127
|
commands,
|
|
164
128
|
timeoutMs = PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS,
|
|
@@ -166,15 +130,12 @@ export async function requestProtocolV2DeviceInfo({
|
|
|
166
130
|
}: {
|
|
167
131
|
commands: DeviceCommands;
|
|
168
132
|
timeoutMs?: number;
|
|
169
|
-
request?:
|
|
133
|
+
request?: DeviceInfoGet;
|
|
170
134
|
}): Promise<ProtocolV2DeviceInfo> {
|
|
171
|
-
|
|
172
|
-
return buildMockProtocolV2DeviceInfo();
|
|
173
|
-
}
|
|
174
|
-
const { message } = await commands.typedCall('DevGetDeviceInfo', 'DeviceInfo', request, {
|
|
135
|
+
const { message } = await commands.typedCall('DeviceInfoGet', 'DeviceInfo', request, {
|
|
175
136
|
timeoutMs,
|
|
176
137
|
});
|
|
177
138
|
// 'DeviceInfo' 在生成类型里是 V1 DeviceInfo | ProtocolV2DeviceInfo 的合并;
|
|
178
|
-
//
|
|
139
|
+
// DeviceInfoGet 是 V2-only 消息,这里收窄到 V2 形态。
|
|
179
140
|
return message as ProtocolV2DeviceInfo;
|
|
180
141
|
}
|
|
@@ -1,43 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 当前 firmware-pro2 子模块的
|
|
3
|
-
*
|
|
4
|
-
* 注意:仓库里的 hd-transport 生成物暂时仍带旧 target 名称;这里显式按
|
|
5
|
-
* submodules/firmware-pro2/sys/protobuf/onekey_protocol/latest/messages_device.proto
|
|
6
|
-
* 对齐当前子模块,避免运行时取到 undefined。
|
|
2
|
+
* 当前 firmware-pro2 子模块的 DeviceFirmwareTargetType。
|
|
7
3
|
*/
|
|
8
4
|
export const ProtocolV2FirmwareTargetType = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
FW_MGMT_TARGET_INVALID: 0,
|
|
6
|
+
FW_MGMT_TARGET_CRATE: 1,
|
|
7
|
+
FW_MGMT_TARGET_ROMLOADER: 2,
|
|
8
|
+
FW_MGMT_TARGET_BOOTLOADER: 3,
|
|
9
|
+
FW_MGMT_TARGET_APPLICATION_P1: 4,
|
|
10
|
+
FW_MGMT_TARGET_APPLICATION_P2: 5,
|
|
11
|
+
FW_MGMT_TARGET_COPROCESSOR: 6,
|
|
12
|
+
FW_MGMT_TARGET_SE01: 7,
|
|
13
|
+
FW_MGMT_TARGET_SE02: 8,
|
|
14
|
+
FW_MGMT_TARGET_SE03: 9,
|
|
15
|
+
FW_MGMT_TARGET_SE04: 10,
|
|
17
16
|
} as const;
|
|
18
17
|
|
|
19
18
|
export type ProtocolV2FirmwareTargetType =
|
|
20
19
|
(typeof ProtocolV2FirmwareTargetType)[keyof typeof ProtocolV2FirmwareTargetType];
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Map Protocol V2 firmware file name to DevFirmwareUpdate target_id.
|
|
24
|
-
*/
|
|
25
|
-
export function protocolV2FileNameToTargetId(fileName: string): ProtocolV2FirmwareTargetType {
|
|
26
|
-
const normalized = fileName.toLowerCase();
|
|
27
|
-
if (normalized.includes('bootloader') || normalized.includes('update_rom')) {
|
|
28
|
-
return ProtocolV2FirmwareTargetType.TARGET_MAIN_BOOT;
|
|
29
|
-
}
|
|
30
|
-
if (
|
|
31
|
-
normalized.includes('coprocessor') ||
|
|
32
|
-
normalized.includes('ble') ||
|
|
33
|
-
normalized.includes('bluetooth') ||
|
|
34
|
-
normalized.includes('bt')
|
|
35
|
-
) {
|
|
36
|
-
return ProtocolV2FirmwareTargetType.TARGET_BT;
|
|
37
|
-
}
|
|
38
|
-
if (normalized.includes('se4')) return ProtocolV2FirmwareTargetType.TARGET_SE4;
|
|
39
|
-
if (normalized.includes('se3')) return ProtocolV2FirmwareTargetType.TARGET_SE3;
|
|
40
|
-
if (normalized.includes('se2')) return ProtocolV2FirmwareTargetType.TARGET_SE2;
|
|
41
|
-
if (normalized.includes('se')) return ProtocolV2FirmwareTargetType.TARGET_SE1;
|
|
42
|
-
return ProtocolV2FirmwareTargetType.TARGET_MAIN_APP;
|
|
43
|
-
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
3
|
+
import type { Device } from '../../device/Device';
|
|
4
|
+
|
|
5
|
+
const getErrorText = (error: unknown) => {
|
|
6
|
+
if (error instanceof Error) return `${error.name} ${error.message}`;
|
|
7
|
+
if (typeof error === 'string') return error;
|
|
8
|
+
if (error && typeof error === 'object') {
|
|
9
|
+
const record = error as Record<string, unknown>;
|
|
10
|
+
return [record.code, record.errorCode, record.message, record.reason]
|
|
11
|
+
.filter(value => value !== undefined && value !== null)
|
|
12
|
+
.join(' ');
|
|
13
|
+
}
|
|
14
|
+
return String(error ?? '');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const isProtocolV2InvalidSessionError = (error: unknown) =>
|
|
18
|
+
getErrorText(error).toLowerCase().includes('failure_invalidsession');
|
|
19
|
+
|
|
20
|
+
export async function requestProtocolV2DeviceStatus(device: Device) {
|
|
21
|
+
const { message } = await device.commands.typedCall('DeviceStatusGet', 'DeviceStatus', {});
|
|
22
|
+
return message;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function refreshProtocolV2DeviceStatus(device: Device) {
|
|
26
|
+
const status = await requestProtocolV2DeviceStatus(device);
|
|
27
|
+
return device.updateProtocolV2Status(status);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export async function getProtocolV2WalletSession(
|
|
31
|
+
device: Device,
|
|
32
|
+
options?: { initSession?: boolean; expectedPassphraseState?: string }
|
|
33
|
+
) {
|
|
34
|
+
if (device.features?.unlocked === false) {
|
|
35
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'Device is locked');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (options?.initSession) {
|
|
39
|
+
device.clearInternalState();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const cachedSessionId =
|
|
43
|
+
typeof device.getInternalState === 'function' ? device.getInternalState() : undefined;
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const { message } = await device.commands.typedCall(
|
|
47
|
+
'DeviceSessionGet',
|
|
48
|
+
'DeviceSession',
|
|
49
|
+
cachedSessionId ? { session_id: cachedSessionId } : {}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
options?.expectedPassphraseState &&
|
|
54
|
+
options.expectedPassphraseState !== message.btc_test_address
|
|
55
|
+
) {
|
|
56
|
+
device.clearInternalState();
|
|
57
|
+
throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckPassphraseStateError);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (message.btc_test_address && device.getCurrentPassphraseProtection() !== true) {
|
|
61
|
+
await refreshProtocolV2DeviceStatus(device);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
device.updateInternalState(
|
|
65
|
+
(device.getCurrentPassphraseProtection() ?? false) || Boolean(message.btc_test_address),
|
|
66
|
+
message.btc_test_address,
|
|
67
|
+
device.getCurrentDeviceId(),
|
|
68
|
+
message.session_id,
|
|
69
|
+
options?.initSession ? null : device.features?.sessionId
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
passphraseState: message.btc_test_address,
|
|
74
|
+
newSession: message.session_id,
|
|
75
|
+
unlockedAttachPin: device.features?.unlockedAttachPin ?? undefined,
|
|
76
|
+
};
|
|
77
|
+
} catch (error) {
|
|
78
|
+
if (isProtocolV2InvalidSessionError(error)) {
|
|
79
|
+
device.clearInternalState();
|
|
80
|
+
}
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -58,42 +58,38 @@ export interface FirmwareUpdateV3Params {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* firmwareUpdateV4(Protocol V2)按
|
|
62
|
-
*
|
|
61
|
+
* firmwareUpdateV4(Protocol V2)按 DeviceFirmwareTargetType 拆分的目标二进制。
|
|
62
|
+
* 除 romloader 外,每个字段对应一个 bootloader 可接受的固件升级 target。
|
|
63
63
|
*/
|
|
64
64
|
export interface FirmwareUpdateV4Params {
|
|
65
65
|
platform: IPlatform;
|
|
66
66
|
chunkSize?: number;
|
|
67
67
|
firmwareType?: EFirmwareType;
|
|
68
68
|
|
|
69
|
-
/**
|
|
69
|
+
/** FW_MGMT_TARGET_ROMLOADER = 2;当前 Pro2 bootloader 不接受通过 firmwareUpdateV4 安装 */
|
|
70
70
|
romloaderBinary?: ArrayBuffer;
|
|
71
|
-
/**
|
|
71
|
+
/** FW_MGMT_TARGET_BOOTLOADER = 3 */
|
|
72
72
|
bootloaderBinary?: ArrayBuffer;
|
|
73
|
-
/**
|
|
73
|
+
/** FW_MGMT_TARGET_APPLICATION_P1 = 4 */
|
|
74
74
|
applicationP1Binary?: ArrayBuffer;
|
|
75
|
-
/**
|
|
75
|
+
/** FW_MGMT_TARGET_APPLICATION_P2 = 5 */
|
|
76
76
|
applicationP2Binary?: ArrayBuffer;
|
|
77
|
-
/**
|
|
77
|
+
/** FW_MGMT_TARGET_COPROCESSOR = 6 */
|
|
78
78
|
coprocessorBinary?: ArrayBuffer;
|
|
79
|
-
/**
|
|
79
|
+
/** FW_MGMT_TARGET_SE01-04 = 7-10 */
|
|
80
80
|
se01Binary?: ArrayBuffer;
|
|
81
81
|
se02Binary?: ArrayBuffer;
|
|
82
82
|
se03Binary?: ArrayBuffer;
|
|
83
83
|
se04Binary?: ArrayBuffer;
|
|
84
|
-
/** TARGET_RESOURCE = 10(zip 包,解压后逐文件上传) */
|
|
85
|
-
resourceBinary?: ArrayBuffer;
|
|
86
84
|
forcedUpdateRes?: boolean;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/** legacy 别名:等价 coprocessorBinary */
|
|
96
|
-
bleBinary?: ArrayBuffer;
|
|
85
|
+
/**
|
|
86
|
+
* RESC bundle okpkg 列表,通过 FilesystemFileWrite 直写到 devicePath(vol0:/bundles/...)。
|
|
87
|
+
* 手动传入模式:SDK 直接 FileWrite 安装,不做版本比对。
|
|
88
|
+
*/
|
|
89
|
+
resourceBundleFiles?: Array<{
|
|
90
|
+
binary: ArrayBuffer;
|
|
91
|
+
devicePath: string;
|
|
92
|
+
}>;
|
|
97
93
|
}
|
|
98
94
|
|
|
99
95
|
export declare function firmwareUpdateV3(
|
|
@@ -6,7 +6,7 @@ import type { ProtocolType, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport'
|
|
|
6
6
|
// 协议类型单源:从 hd-transport 的 ProtocolType 派生,只额外允许 'unknown'。
|
|
7
7
|
export type DeviceInfoProtocol = ProtocolType | 'unknown';
|
|
8
8
|
|
|
9
|
-
export type DeviceInfoSource = 'features' | '
|
|
9
|
+
export type DeviceInfoSource = 'features' | 'protocolV1OneKeyFeatures' | 'deviceInfo';
|
|
10
10
|
|
|
11
11
|
export type DeviceInfoScope = 'basic' | 'versions' | 'verify' | 'full';
|
|
12
12
|
|
|
@@ -24,6 +24,8 @@ export type DeviceInfoStatus = {
|
|
|
24
24
|
bootloaderMode: boolean | null;
|
|
25
25
|
unlocked: boolean | null;
|
|
26
26
|
passphraseProtection: boolean | null;
|
|
27
|
+
attachToPinEnabled?: boolean | null;
|
|
28
|
+
unlockedAttachPin?: boolean | null;
|
|
27
29
|
backupRequired: boolean | null;
|
|
28
30
|
noBackup: boolean | null;
|
|
29
31
|
language: string | null;
|
|
@@ -74,7 +76,7 @@ export type DeviceProfileVerify = {
|
|
|
74
76
|
|
|
75
77
|
export type DeviceProfileRaw = {
|
|
76
78
|
features?: Features;
|
|
77
|
-
|
|
79
|
+
protocolV1OneKeyFeatures?: OnekeyFeatures;
|
|
78
80
|
protocolV2DeviceInfo?: ProtocolV2DeviceInfo;
|
|
79
81
|
};
|
|
80
82
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CommonParams, Response } from '../params';
|
|
2
2
|
|
|
3
3
|
export type GetPassphraseStatePayload = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
passphraseState?: string;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
unlockedAttachPin?: boolean;
|
|
7
|
+
passphraseProtection?: boolean | null;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export type GetPassphraseStateParams = CommonParams & {
|
package/src/types/api/index.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
deviceFactoryInfoGet,
|
|
3
|
+
deviceFactoryInfoSet,
|
|
2
4
|
deviceFirmwareUpdate,
|
|
3
|
-
deviceGetDeviceInfo,
|
|
4
5
|
deviceGetFirmwareUpdateStatus,
|
|
5
|
-
|
|
6
|
+
deviceInfoGet,
|
|
6
7
|
deviceReboot,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
devGetFirmwareUpdateStatus,
|
|
10
|
-
devReboot,
|
|
8
|
+
deviceSessionGet,
|
|
9
|
+
deviceStatusGet,
|
|
11
10
|
dirList,
|
|
12
11
|
dirMake,
|
|
13
12
|
dirRemove,
|
|
14
|
-
factoryDeviceInfoSettings,
|
|
15
|
-
factoryGetDeviceInfo,
|
|
16
13
|
fileDelete,
|
|
17
14
|
fileRead,
|
|
18
15
|
fileWrite,
|
|
@@ -23,12 +20,12 @@ import type {
|
|
|
23
20
|
filesystemFileDelete,
|
|
24
21
|
filesystemFileRead,
|
|
25
22
|
filesystemFileWrite,
|
|
26
|
-
filesystemFixPermission,
|
|
27
23
|
filesystemFormat,
|
|
28
24
|
filesystemPathInfoQuery,
|
|
29
|
-
|
|
25
|
+
filesystemPermissionFix,
|
|
30
26
|
pathInfo,
|
|
31
27
|
ping,
|
|
28
|
+
protocolInfoRequest,
|
|
32
29
|
} from './protocolV2';
|
|
33
30
|
import type { off, on, removeAllListeners } from './event';
|
|
34
31
|
import type { uiResponse } from './uiResponse';
|
|
@@ -36,6 +33,7 @@ import type { init, updateSettings } from './init';
|
|
|
36
33
|
import type { testInitializeDeviceDuration } from './testInitializeDeviceDuration';
|
|
37
34
|
import type { preInitialize } from './preInitialize';
|
|
38
35
|
import type { getLogs } from './getLogs';
|
|
36
|
+
import type { clearSessionCache } from './sessionCache';
|
|
39
37
|
import type { checkBridgeStatus } from './checkBridgeStatus';
|
|
40
38
|
import type { checkBridgeRelease } from './checkBridgeRelease';
|
|
41
39
|
import type { checkBootloaderRelease } from './checkBootloaderRelease';
|
|
@@ -182,6 +180,7 @@ export type {
|
|
|
182
180
|
DeviceProfileVersions,
|
|
183
181
|
} from './getDeviceInfo';
|
|
184
182
|
export type { GetPassphraseStateParams, GetPassphraseStatePayload } from './getPassphraseState';
|
|
183
|
+
export type { ClearSessionCacheParams, ClearSessionCachePayload } from './sessionCache';
|
|
185
184
|
|
|
186
185
|
export type CoreApi = {
|
|
187
186
|
/**
|
|
@@ -199,6 +198,7 @@ export type CoreApi = {
|
|
|
199
198
|
updateSettings: typeof updateSettings;
|
|
200
199
|
switchTransport: (env: ConnectSettings['env']) => Promise<{ success: boolean }>;
|
|
201
200
|
getLogs: typeof getLogs;
|
|
201
|
+
clearSessionCache: typeof clearSessionCache;
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
204
|
* Test function
|
|
@@ -255,20 +255,17 @@ export type CoreApi = {
|
|
|
255
255
|
/**
|
|
256
256
|
* File system & device control API (Protocol V2 only)
|
|
257
257
|
*/
|
|
258
|
-
|
|
258
|
+
protocolInfoRequest: typeof protocolInfoRequest;
|
|
259
259
|
ping: typeof ping;
|
|
260
260
|
deviceReboot: typeof deviceReboot;
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
deviceInfoGet: typeof deviceInfoGet;
|
|
262
|
+
deviceStatusGet: typeof deviceStatusGet;
|
|
263
|
+
deviceSessionGet: typeof deviceSessionGet;
|
|
263
264
|
deviceFirmwareUpdate: typeof deviceFirmwareUpdate;
|
|
264
265
|
deviceGetFirmwareUpdateStatus: typeof deviceGetFirmwareUpdateStatus;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
devGetFirmwareUpdateStatus: typeof devGetFirmwareUpdateStatus;
|
|
269
|
-
factoryDeviceInfoSettings: typeof factoryDeviceInfoSettings;
|
|
270
|
-
factoryGetDeviceInfo: typeof factoryGetDeviceInfo;
|
|
271
|
-
filesystemFixPermission: typeof filesystemFixPermission;
|
|
266
|
+
deviceFactoryInfoSet: typeof deviceFactoryInfoSet;
|
|
267
|
+
deviceFactoryInfoGet: typeof deviceFactoryInfoGet;
|
|
268
|
+
filesystemPermissionFix: typeof filesystemPermissionFix;
|
|
272
269
|
fileRead: typeof fileRead;
|
|
273
270
|
fileWrite: typeof fileWrite;
|
|
274
271
|
fileDelete: typeof fileDelete;
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
import type { CommonParams, Response } from '../params';
|
|
2
2
|
import type {
|
|
3
|
+
DeviceFactoryInfo,
|
|
3
4
|
DeviceFirmwareUpdateStatus,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ProtoVersion,
|
|
5
|
+
DeviceSession,
|
|
6
|
+
DeviceStatus,
|
|
7
|
+
ProtocolInfo,
|
|
8
8
|
ProtocolV2DeviceInfo,
|
|
9
9
|
Success,
|
|
10
10
|
} from '@onekeyfe/hd-transport';
|
|
11
11
|
import type {
|
|
12
|
+
DeviceFactoryInfoSetParams,
|
|
12
13
|
DeviceFirmwareUpdateParams,
|
|
14
|
+
DeviceFirmwareUpdateStatusGetParams,
|
|
13
15
|
DeviceRebootParams,
|
|
14
|
-
FactoryDeviceInfoSettingsParams,
|
|
15
16
|
} from '../../api/protocol-v2/helpers';
|
|
16
|
-
import type {
|
|
17
|
+
import type { DeviceInfoGetParams } from '../../api/protocol-v2/DeviceInfoGet';
|
|
18
|
+
import type { DeviceSessionGetParams } from '../../api/protocol-v2/DeviceSessionGet';
|
|
17
19
|
|
|
18
20
|
// 参数类型单源:以 api/protocol-v2 的实现为准(type-only re-export,无运行时依赖)
|
|
19
21
|
export type {
|
|
20
22
|
DeviceFirmwareTargetInput,
|
|
21
23
|
DeviceFirmwareUpdateParams,
|
|
24
|
+
DeviceFirmwareUpdateStatusGetParams,
|
|
22
25
|
DeviceRebootParams,
|
|
23
|
-
|
|
26
|
+
DeviceFactoryInfoSetParams,
|
|
24
27
|
RebootTypeInput,
|
|
25
28
|
} from '../../api/protocol-v2/helpers';
|
|
26
29
|
export type {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} from '../../api/protocol-v2/
|
|
30
|
+
DeviceInfoGetParams,
|
|
31
|
+
DeviceInfoGetTargets,
|
|
32
|
+
DeviceInfoGetTypes,
|
|
33
|
+
} from '../../api/protocol-v2/DeviceInfoGet';
|
|
34
|
+
export type { DeviceSessionGetParams } from '../../api/protocol-v2/DeviceSessionGet';
|
|
31
35
|
|
|
32
36
|
// ── Shared response shapes (Protocol V2 file system) ────────────────────
|
|
33
37
|
|
|
@@ -68,10 +72,10 @@ export type PathInfoResult = {
|
|
|
68
72
|
|
|
69
73
|
// ── Method signatures ─────────────────────────────────────────────────────
|
|
70
74
|
|
|
71
|
-
export declare function
|
|
75
|
+
export declare function protocolInfoRequest(
|
|
72
76
|
connectId: string,
|
|
73
77
|
params?: CommonParams
|
|
74
|
-
): Response<
|
|
78
|
+
): Response<ProtocolInfo>;
|
|
75
79
|
|
|
76
80
|
export declare function ping(
|
|
77
81
|
connectId: string,
|
|
@@ -83,55 +87,46 @@ export declare function deviceReboot(
|
|
|
83
87
|
params: CommonParams & DeviceRebootParams
|
|
84
88
|
): Response<Success>;
|
|
85
89
|
|
|
86
|
-
export declare function
|
|
90
|
+
export declare function deviceInfoGet(
|
|
87
91
|
connectId: string,
|
|
88
|
-
params?: CommonParams &
|
|
92
|
+
params?: CommonParams & DeviceInfoGetParams
|
|
89
93
|
): Response<ProtocolV2DeviceInfo>;
|
|
90
94
|
|
|
91
|
-
export declare function
|
|
95
|
+
export declare function deviceStatusGet(
|
|
92
96
|
connectId: string,
|
|
93
97
|
params?: CommonParams
|
|
94
|
-
): Response<
|
|
98
|
+
): Response<DeviceStatus>;
|
|
99
|
+
|
|
100
|
+
export declare function deviceSessionGet(
|
|
101
|
+
connectId: string,
|
|
102
|
+
params?: CommonParams & DeviceSessionGetParams
|
|
103
|
+
): Response<DeviceSession>;
|
|
95
104
|
|
|
96
105
|
export declare function deviceFirmwareUpdate(
|
|
97
106
|
connectId: string,
|
|
98
107
|
params: CommonParams & DeviceFirmwareUpdateParams
|
|
99
|
-
): Response<Success |
|
|
108
|
+
): Response<Success | DeviceFirmwareUpdateStatus>;
|
|
100
109
|
|
|
101
110
|
export declare function deviceGetFirmwareUpdateStatus(
|
|
102
111
|
connectId: string,
|
|
103
|
-
params?: CommonParams
|
|
104
|
-
): Response<
|
|
112
|
+
params?: CommonParams & DeviceFirmwareUpdateStatusGetParams
|
|
113
|
+
): Response<DeviceFirmwareUpdateStatus>;
|
|
105
114
|
|
|
106
|
-
export declare function
|
|
115
|
+
export declare function deviceFactoryInfoSet(
|
|
107
116
|
connectId: string,
|
|
108
|
-
params: CommonParams &
|
|
117
|
+
params: CommonParams & DeviceFactoryInfoSetParams
|
|
109
118
|
): Response<Success>;
|
|
110
119
|
|
|
111
|
-
export declare function
|
|
112
|
-
connectId: string,
|
|
113
|
-
params?: CommonParams & DeviceGetDeviceInfoParams
|
|
114
|
-
): Response<ProtocolV2DeviceInfo>;
|
|
115
|
-
|
|
116
|
-
export declare function devFirmwareUpdate(
|
|
117
|
-
connectId: string,
|
|
118
|
-
params: CommonParams & DeviceFirmwareUpdateParams
|
|
119
|
-
): Response<Success | DevFirmwareUpdateStatus>;
|
|
120
|
-
|
|
121
|
-
export declare function devGetFirmwareUpdateStatus(
|
|
120
|
+
export declare function deviceFactoryInfoGet(
|
|
122
121
|
connectId: string,
|
|
123
122
|
params?: CommonParams
|
|
124
|
-
): Response<
|
|
123
|
+
): Response<DeviceFactoryInfo>;
|
|
125
124
|
|
|
126
|
-
export declare function
|
|
125
|
+
export declare function filesystemPermissionFix(
|
|
127
126
|
connectId: string,
|
|
128
|
-
params
|
|
127
|
+
params?: CommonParams
|
|
129
128
|
): Response<Success>;
|
|
130
129
|
|
|
131
|
-
export declare function factoryGetDeviceInfo(connectId: string): Response<FactoryDeviceInfo>;
|
|
132
|
-
|
|
133
|
-
export declare function filesystemFixPermission(connectId: string): Response<Success>;
|
|
134
|
-
|
|
135
130
|
export declare function fileRead(
|
|
136
131
|
connectId: string,
|
|
137
132
|
params: {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Response } from '../params';
|
|
2
|
+
|
|
3
|
+
export type ClearSessionCacheParams = {
|
|
4
|
+
deviceId?: string;
|
|
5
|
+
passphraseState?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ClearSessionCachePayload = {
|
|
9
|
+
cleared: true;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export declare function clearSessionCache(
|
|
13
|
+
params?: ClearSessionCacheParams
|
|
14
|
+
): Response<ClearSessionCachePayload>;
|