@onekeyfe/hd-core 1.2.0-alpha.1 → 1.2.0-alpha.11
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__/DeviceCommands.test.ts +25 -0
- package/__tests__/RequestQueue.test.ts +34 -0
- 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__/pro2Wallpaper.test.ts +50 -0
- package/__tests__/protocol-v2-firmware-targets.test.ts +19 -0
- package/__tests__/protocol-v2.test.ts +3253 -1605
- package/dist/api/BaseMethod.d.ts +4 -0
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/ClearSessionCache.d.ts +9 -0
- package/dist/api/ClearSessionCache.d.ts.map +1 -0
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +20 -3
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +1 -6
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/UploadPortfolio.d.ts +18 -0
- package/dist/api/UploadPortfolio.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +1 -0
- package/dist/api/firmware/FirmwareUpdateBaseMethod.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/index.d.ts +13 -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 +6 -0
- package/dist/api/protocol-v2/DeviceSessionGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceSettingsGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts +16 -0
- package/dist/api/protocol-v2/DeviceSettingsPageShow.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceSettingsSet.d.ts +12 -0
- package/dist/api/protocol-v2/DeviceSettingsSet.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/DeviceUploadWallpaper.d.ts +26 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.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 -18
- 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/core/RequestQueue.d.ts +2 -0
- package/dist/core/RequestQueue.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -0
- 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 +6 -3
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/device/DeviceCommands.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.map +1 -1
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -1
- package/dist/events/call.d.ts +7 -0
- package/dist/events/call.d.ts.map +1 -1
- package/dist/events/core.d.ts +2 -2
- package/dist/events/core.d.ts.map +1 -1
- package/dist/events/iframe.d.ts +1 -0
- package/dist/events/iframe.d.ts.map +1 -1
- package/dist/index.d.ts +166 -70
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2659 -1750
- package/dist/inject.d.ts +3 -2
- package/dist/inject.d.ts.map +1 -1
- package/dist/lowLevelInject.d.ts +2 -1
- package/dist/lowLevelInject.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/unlockRetry.d.ts +9 -0
- package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts +13 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -0
- package/dist/topLevelInject.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +6 -6
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +2 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +2 -10
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +18 -12
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +31 -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 +1 -0
- 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 -2
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +2 -2
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- 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/pro2Wallpaper.d.ts +12 -0
- package/dist/utils/pro2Wallpaper.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +18 -0
- package/src/api/ClearSessionCache.ts +28 -0
- package/src/api/FileRead.ts +16 -3
- package/src/api/FileWrite.ts +22 -1
- package/src/api/FirmwareUpdateV4.ts +1006 -265
- package/src/api/GetOnekeyFeatures.ts +1 -1
- package/src/api/GetPassphraseState.ts +9 -15
- package/src/api/UploadPortfolio.ts +37 -0
- 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/progressThrottle.ts +44 -0
- package/src/api/index.ts +13 -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 +1 -1
- package/src/api/protocol-v2/DeviceSessionGet.ts +15 -0
- package/src/api/protocol-v2/{DeviceGetOnboardingStatus.ts → DeviceSettingsGet.ts} +3 -3
- package/src/api/protocol-v2/DeviceSettingsPageShow.ts +59 -0
- package/src/api/protocol-v2/DeviceSettingsSet.ts +39 -0
- package/src/api/protocol-v2/DeviceStatusGet.ts +14 -0
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +160 -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 +71 -47
- 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/core/RequestQueue.ts +19 -0
- package/src/core/index.ts +29 -6
- package/src/data/messages/messages-protocol-v2.json +760 -1110
- package/src/data/messages/messages.json +8 -0
- package/src/data-manager/DataManager.ts +7 -0
- package/src/data-manager/connectSettings.ts +2 -4
- package/src/device/Device.ts +103 -70
- package/src/device/DeviceCommands.ts +9 -3
- package/src/device/DeviceWalletSessionStore.ts +78 -0
- package/src/deviceProfile/buildDeviceFeatures.ts +60 -63
- package/src/deviceProfile/buildDeviceProfile.ts +77 -58
- package/src/events/call.ts +6 -0
- package/src/events/core.ts +2 -0
- package/src/events/iframe.ts +1 -0
- package/src/index.ts +4 -0
- package/src/inject.ts +26 -16
- package/src/lowLevelInject.ts +3 -0
- package/src/protocols/protocol-v2/features.ts +26 -63
- package/src/protocols/protocol-v2/firmware.ts +12 -36
- package/src/protocols/protocol-v2/index.ts +1 -0
- package/src/protocols/protocol-v2/unlockRetry.ts +46 -0
- package/src/protocols/protocol-v2/walletSession.ts +92 -0
- package/src/topLevelInject.ts +2 -0
- package/src/types/api/firmwareUpdate.ts +28 -20
- package/src/types/api/getDeviceInfo.ts +2 -0
- package/src/types/api/getPassphraseState.ts +2 -11
- package/src/types/api/index.ts +29 -21
- package/src/types/api/protocolV2.ts +74 -35
- package/src/types/api/sessionCache.ts +14 -0
- package/src/types/device.ts +1 -0
- package/src/types/params.ts +4 -0
- package/src/types/settings.ts +42 -35
- package/src/utils/deviceFeaturesUtils.ts +46 -20
- package/src/utils/index.ts +6 -0
- package/src/utils/pro2Wallpaper.ts +111 -0
- 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/src/api/protocol-v2/DevReboot.ts +0 -24
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -29
|
@@ -2,22 +2,8 @@ import { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
|
|
|
2
2
|
|
|
3
3
|
import type { Features } from '../types';
|
|
4
4
|
import type { PROTO } from '../constants';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
type ProtocolV2DeviceInfoCompat = ProtocolV2DeviceInfo & {
|
|
8
|
-
fw?: ProtocolV2DeviceInfo['fw'] & {
|
|
9
|
-
application?: DevFirmwareImageInfo | null;
|
|
10
|
-
application_data?: DevFirmwareImageInfo | null;
|
|
11
|
-
bootloader?: DevFirmwareImageInfo | null;
|
|
12
|
-
romloader?: DevFirmwareImageInfo | null;
|
|
13
|
-
};
|
|
14
|
-
coprocessor?: {
|
|
15
|
-
application?: DevFirmwareImageInfo | null;
|
|
16
|
-
bootloader?: DevFirmwareImageInfo | null;
|
|
17
|
-
bt_adv_name?: string | null;
|
|
18
|
-
bt_mac?: unknown;
|
|
19
|
-
} | null;
|
|
20
|
-
};
|
|
5
|
+
import type { DeviceFirmwareImageInfo, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
6
|
+
import { isProtocolV2BootloaderDeviceInfo } from '../protocols/protocol-v2/features';
|
|
21
7
|
|
|
22
8
|
type ProtocolV1FeaturesCompat = PROTO.Features &
|
|
23
9
|
Partial<PROTO.OnekeyFeatures> & {
|
|
@@ -26,7 +12,7 @@ type ProtocolV1FeaturesCompat = PROTO.Features &
|
|
|
26
12
|
onekey_serial?: string;
|
|
27
13
|
};
|
|
28
14
|
|
|
29
|
-
const getImageVersion = (image?:
|
|
15
|
+
const getImageVersion = (image?: DeviceFirmwareImageInfo | null) => image?.version ?? null;
|
|
30
16
|
|
|
31
17
|
const bytesToHex = (value: unknown): string | undefined => {
|
|
32
18
|
if (!value) return undefined;
|
|
@@ -42,9 +28,9 @@ const bytesToHex = (value: unknown): string | undefined => {
|
|
|
42
28
|
return undefined;
|
|
43
29
|
};
|
|
44
30
|
|
|
45
|
-
const getImageBuildId = (image?:
|
|
31
|
+
const getImageBuildId = (image?: DeviceFirmwareImageInfo | null) => image?.build_id ?? undefined;
|
|
46
32
|
|
|
47
|
-
const getImageHash = (image?:
|
|
33
|
+
const getImageHash = (image?: DeviceFirmwareImageInfo | null) => bytesToHex(image?.hash);
|
|
48
34
|
|
|
49
35
|
const firstValue = <T>(...values: Array<T | null | undefined>) =>
|
|
50
36
|
values.find(value => value !== undefined && value !== null);
|
|
@@ -226,7 +212,7 @@ export const buildProtocolV1FeaturesPayload = (
|
|
|
226
212
|
/**
|
|
227
213
|
* Protocol V2 的结构化 `Features` 构建器。
|
|
228
214
|
*
|
|
229
|
-
* 这是 Device 内部唯一缓存状态。字段只来自
|
|
215
|
+
* 这是 Device 内部唯一缓存状态。字段只来自 DeviceInfoGet 或前一次 features
|
|
230
216
|
* 缓存的同名字段级合并;不存在协议等价语义的字段保持 null/空值,不再通过
|
|
231
217
|
* DeviceProfile 或 transport path 做身份兜底。
|
|
232
218
|
*/
|
|
@@ -234,11 +220,12 @@ export const buildProtocolV2FeaturesPayload = (
|
|
|
234
220
|
deviceInfo?: ProtocolV2DeviceInfo,
|
|
235
221
|
previous?: Features
|
|
236
222
|
): Features => {
|
|
237
|
-
const info = deviceInfo
|
|
238
|
-
const fwApplication =
|
|
239
|
-
const fwBootloader =
|
|
240
|
-
const fwBoard = firstValue(info?.fw?.application_data, info?.fw?.
|
|
241
|
-
const bleApplication =
|
|
223
|
+
const info = deviceInfo;
|
|
224
|
+
const fwApplication = info?.fw?.application;
|
|
225
|
+
const fwBootloader = info?.fw?.bootloader;
|
|
226
|
+
const fwBoard = firstValue(info?.fw?.application_data, info?.fw?.romloader);
|
|
227
|
+
const bleApplication = info?.coprocessor?.application;
|
|
228
|
+
const status = info?.status;
|
|
242
229
|
|
|
243
230
|
const firmwareVersion = firstMeaningfulVersion(
|
|
244
231
|
getImageVersion(fwApplication),
|
|
@@ -250,17 +237,26 @@ export const buildProtocolV2FeaturesPayload = (
|
|
|
250
237
|
);
|
|
251
238
|
const boardVersion = firstMeaningfulVersion(getImageVersion(fwBoard), previous?.boardVersion);
|
|
252
239
|
const bleVersion = firstMeaningfulVersion(getImageVersion(bleApplication), previous?.bleVersion);
|
|
253
|
-
const deviceId =
|
|
240
|
+
const deviceId = status?.device_id ?? null;
|
|
254
241
|
const serialNo = firstValue(info?.hw?.serial_no, previous?.serialNo) ?? '';
|
|
255
|
-
const label =
|
|
256
|
-
const bleName = firstValue(info?.coprocessor?.bt_adv_name,
|
|
257
|
-
const initialized = firstValue(
|
|
258
|
-
const passphraseProtection =
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
const
|
|
242
|
+
const label = previous?.label ?? null;
|
|
243
|
+
const bleName = firstValue(info?.coprocessor?.bt_adv_name, previous?.bleName);
|
|
244
|
+
const initialized = firstValue(status?.init_states, previous?.initialized) ?? null;
|
|
245
|
+
const passphraseProtection = status?.passphrase_enabled ?? null;
|
|
246
|
+
const language = previous?.language ?? null;
|
|
247
|
+
const backupRequired = firstValue(status?.backup_required, previous?.backupRequired) ?? null;
|
|
248
|
+
const bleEnabled = previous?.bleEnabled;
|
|
249
|
+
const unlocked = firstValue(status?.unlocked, previous?.unlocked) ?? null;
|
|
250
|
+
const attachToPinEnabled = status?.attach_to_pin_enabled ?? null;
|
|
251
|
+
const unlockedAttachPin = status?.unlocked_by_attach_to_pin ?? undefined;
|
|
252
|
+
const bootloaderMode = isProtocolV2BootloaderDeviceInfo(info);
|
|
253
|
+
const mode = bootloaderMode
|
|
254
|
+
? 'bootloader'
|
|
255
|
+
: initialized === false
|
|
256
|
+
? 'notInitialized'
|
|
257
|
+
: initialized === true
|
|
258
|
+
? 'normal'
|
|
259
|
+
: 'unknown';
|
|
264
260
|
|
|
265
261
|
return {
|
|
266
262
|
protocol: 'V2',
|
|
@@ -274,10 +270,10 @@ export const buildProtocolV2FeaturesPayload = (
|
|
|
274
270
|
label,
|
|
275
271
|
bleName: bleName ?? null,
|
|
276
272
|
capabilities: [],
|
|
277
|
-
mode
|
|
273
|
+
mode,
|
|
278
274
|
initialized,
|
|
279
|
-
bootloaderMode
|
|
280
|
-
unlocked
|
|
275
|
+
bootloaderMode,
|
|
276
|
+
unlocked,
|
|
281
277
|
firmwarePresent: previous?.firmwarePresent ?? null,
|
|
282
278
|
passphraseProtection,
|
|
283
279
|
pinProtection: null,
|
|
@@ -291,6 +287,7 @@ export const buildProtocolV2FeaturesPayload = (
|
|
|
291
287
|
sdProtection: null,
|
|
292
288
|
wipeCodeProtection: null,
|
|
293
289
|
passphraseAlwaysOnDevice: null,
|
|
290
|
+
attachToPinEnabled,
|
|
294
291
|
safetyChecks: null,
|
|
295
292
|
autoLockDelayMs: null,
|
|
296
293
|
displayRotation: null,
|
|
@@ -300,35 +297,35 @@ export const buildProtocolV2FeaturesPayload = (
|
|
|
300
297
|
boardVersion,
|
|
301
298
|
bleVersion,
|
|
302
299
|
se01Version: firstMeaningfulVersion(
|
|
303
|
-
getImageVersion(
|
|
300
|
+
getImageVersion(info?.se1?.application),
|
|
304
301
|
previous?.se01Version
|
|
305
302
|
),
|
|
306
303
|
se02Version: firstMeaningfulVersion(
|
|
307
|
-
getImageVersion(
|
|
304
|
+
getImageVersion(info?.se2?.application),
|
|
308
305
|
previous?.se02Version
|
|
309
306
|
),
|
|
310
307
|
se03Version: firstMeaningfulVersion(
|
|
311
|
-
getImageVersion(
|
|
308
|
+
getImageVersion(info?.se3?.application),
|
|
312
309
|
previous?.se03Version
|
|
313
310
|
),
|
|
314
311
|
se04Version: firstMeaningfulVersion(
|
|
315
|
-
getImageVersion(
|
|
312
|
+
getImageVersion(info?.se4?.application),
|
|
316
313
|
previous?.se04Version
|
|
317
314
|
),
|
|
318
315
|
se01BootVersion: firstMeaningfulVersion(
|
|
319
|
-
getImageVersion(
|
|
316
|
+
getImageVersion(info?.se1?.bootloader),
|
|
320
317
|
previous?.se01BootVersion
|
|
321
318
|
),
|
|
322
319
|
se02BootVersion: firstMeaningfulVersion(
|
|
323
|
-
getImageVersion(
|
|
320
|
+
getImageVersion(info?.se2?.bootloader),
|
|
324
321
|
previous?.se02BootVersion
|
|
325
322
|
),
|
|
326
323
|
se03BootVersion: firstMeaningfulVersion(
|
|
327
|
-
getImageVersion(
|
|
324
|
+
getImageVersion(info?.se3?.bootloader),
|
|
328
325
|
previous?.se03BootVersion
|
|
329
326
|
),
|
|
330
327
|
se04BootVersion: firstMeaningfulVersion(
|
|
331
|
-
getImageVersion(
|
|
328
|
+
getImageVersion(info?.se4?.bootloader),
|
|
332
329
|
previous?.se04BootVersion
|
|
333
330
|
),
|
|
334
331
|
seVersion: previous?.seVersion ?? null,
|
|
@@ -341,26 +338,26 @@ export const buildProtocolV2FeaturesPayload = (
|
|
|
341
338
|
boardHash: getImageHash(fwBoard) ?? previous?.verify?.boardHash,
|
|
342
339
|
bleBuildId: getImageBuildId(bleApplication) ?? previous?.verify?.bleBuildId,
|
|
343
340
|
bleHash: getImageHash(bleApplication) ?? previous?.verify?.bleHash,
|
|
344
|
-
se01BuildId: getImageBuildId(
|
|
345
|
-
se01Hash: getImageHash(
|
|
346
|
-
se02BuildId: getImageBuildId(
|
|
347
|
-
se02Hash: getImageHash(
|
|
348
|
-
se03BuildId: getImageBuildId(
|
|
349
|
-
se03Hash: getImageHash(
|
|
350
|
-
se04BuildId: getImageBuildId(
|
|
351
|
-
se04Hash: getImageHash(
|
|
352
|
-
se01BootBuildId: getImageBuildId(
|
|
353
|
-
se01BootHash: getImageHash(
|
|
354
|
-
se02BootBuildId: getImageBuildId(
|
|
355
|
-
se02BootHash: getImageHash(
|
|
356
|
-
se03BootBuildId: getImageBuildId(
|
|
357
|
-
se03BootHash: getImageHash(
|
|
358
|
-
se04BootBuildId: getImageBuildId(
|
|
359
|
-
se04BootHash: getImageHash(
|
|
341
|
+
se01BuildId: getImageBuildId(info?.se1?.application) ?? previous?.verify?.se01BuildId,
|
|
342
|
+
se01Hash: getImageHash(info?.se1?.application) ?? previous?.verify?.se01Hash,
|
|
343
|
+
se02BuildId: getImageBuildId(info?.se2?.application) ?? previous?.verify?.se02BuildId,
|
|
344
|
+
se02Hash: getImageHash(info?.se2?.application) ?? previous?.verify?.se02Hash,
|
|
345
|
+
se03BuildId: getImageBuildId(info?.se3?.application) ?? previous?.verify?.se03BuildId,
|
|
346
|
+
se03Hash: getImageHash(info?.se3?.application) ?? previous?.verify?.se03Hash,
|
|
347
|
+
se04BuildId: getImageBuildId(info?.se4?.application) ?? previous?.verify?.se04BuildId,
|
|
348
|
+
se04Hash: getImageHash(info?.se4?.application) ?? previous?.verify?.se04Hash,
|
|
349
|
+
se01BootBuildId: getImageBuildId(info?.se1?.bootloader) ?? previous?.verify?.se01BootBuildId,
|
|
350
|
+
se01BootHash: getImageHash(info?.se1?.bootloader) ?? previous?.verify?.se01BootHash,
|
|
351
|
+
se02BootBuildId: getImageBuildId(info?.se2?.bootloader) ?? previous?.verify?.se02BootBuildId,
|
|
352
|
+
se02BootHash: getImageHash(info?.se2?.bootloader) ?? previous?.verify?.se02BootHash,
|
|
353
|
+
se03BootBuildId: getImageBuildId(info?.se3?.bootloader) ?? previous?.verify?.se03BootBuildId,
|
|
354
|
+
se03BootHash: getImageHash(info?.se3?.bootloader) ?? previous?.verify?.se03BootHash,
|
|
355
|
+
se04BootBuildId: getImageBuildId(info?.se4?.bootloader) ?? previous?.verify?.se04BootBuildId,
|
|
356
|
+
se04BootHash: getImageHash(info?.se4?.bootloader) ?? previous?.verify?.se04BootHash,
|
|
360
357
|
},
|
|
361
358
|
sessionId: previous?.sessionId ?? null,
|
|
362
359
|
passphraseState: previous?.passphraseState,
|
|
363
|
-
unlockedAttachPin
|
|
360
|
+
unlockedAttachPin,
|
|
364
361
|
raw: {
|
|
365
362
|
protocolV2DeviceInfo: deviceInfo,
|
|
366
363
|
},
|
|
@@ -25,7 +25,8 @@ import type {
|
|
|
25
25
|
GetDeviceInfoParams,
|
|
26
26
|
} from '../types/api/getDeviceInfo';
|
|
27
27
|
import type { Features, OnekeyFeatures } from '../types';
|
|
28
|
-
import type {
|
|
28
|
+
import type { DeviceFirmwareImageInfo, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
|
|
29
|
+
import { isProtocolV2BootloaderDeviceInfo } from '../protocols/protocol-v2/features';
|
|
29
30
|
|
|
30
31
|
type BuildProtocolV1ProfileParams = {
|
|
31
32
|
protocol?: DeviceInfoProtocol;
|
|
@@ -68,11 +69,11 @@ const bytesToHex = (value: unknown): string | undefined => {
|
|
|
68
69
|
return undefined;
|
|
69
70
|
};
|
|
70
71
|
|
|
71
|
-
const getImageVersion = (image?:
|
|
72
|
+
const getImageVersion = (image?: DeviceFirmwareImageInfo | null) => image?.version ?? null;
|
|
72
73
|
|
|
73
|
-
const getImageBuildId = (image?:
|
|
74
|
+
const getImageBuildId = (image?: DeviceFirmwareImageInfo | null) => image?.build_id ?? undefined;
|
|
74
75
|
|
|
75
|
-
const getImageHash = (image?:
|
|
76
|
+
const getImageHash = (image?: DeviceFirmwareImageInfo | null) => bytesToHex(image?.hash);
|
|
76
77
|
|
|
77
78
|
const shouldIncludeVerify = (scope?: GetDeviceInfoParams['scope']) =>
|
|
78
79
|
scope === 'verify' || scope === 'full';
|
|
@@ -86,6 +87,7 @@ const getDeviceMode = (features?: Features): DeviceInfoStatus['mode'] => {
|
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
const getProtocolV2Mode = (deviceInfo?: ProtocolV2DeviceInfo): DeviceInfoStatus['mode'] => {
|
|
90
|
+
if (isProtocolV2BootloaderDeviceInfo(deviceInfo)) return 'bootloader';
|
|
89
91
|
const initialized = deviceInfo?.status?.init_states;
|
|
90
92
|
if (initialized === false) return 'notInitialized';
|
|
91
93
|
if (initialized === true) return 'normal';
|
|
@@ -147,20 +149,25 @@ const normalizeV1Versions = (
|
|
|
147
149
|
),
|
|
148
150
|
});
|
|
149
151
|
|
|
150
|
-
const normalizeV2Versions = (deviceInfo?: ProtocolV2DeviceInfo): DeviceProfileVersions =>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
152
|
+
const normalizeV2Versions = (deviceInfo?: ProtocolV2DeviceInfo): DeviceProfileVersions => {
|
|
153
|
+
const info = deviceInfo;
|
|
154
|
+
return {
|
|
155
|
+
firmware: firstMeaningfulVersion(getImageVersion(info?.fw?.application)),
|
|
156
|
+
bootloader: firstMeaningfulVersion(getImageVersion(info?.fw?.bootloader)),
|
|
157
|
+
board: firstMeaningfulVersion(
|
|
158
|
+
getImageVersion(info?.fw?.application_data ?? info?.fw?.romloader)
|
|
159
|
+
),
|
|
160
|
+
ble: firstMeaningfulVersion(getImageVersion(info?.coprocessor?.application)),
|
|
161
|
+
se01: firstMeaningfulVersion(getImageVersion(info?.se1?.application)),
|
|
162
|
+
se02: firstMeaningfulVersion(getImageVersion(info?.se2?.application)),
|
|
163
|
+
se03: firstMeaningfulVersion(getImageVersion(info?.se3?.application)),
|
|
164
|
+
se04: firstMeaningfulVersion(getImageVersion(info?.se4?.application)),
|
|
165
|
+
se01Boot: firstMeaningfulVersion(getImageVersion(info?.se1?.bootloader)),
|
|
166
|
+
se02Boot: firstMeaningfulVersion(getImageVersion(info?.se2?.bootloader)),
|
|
167
|
+
se03Boot: firstMeaningfulVersion(getImageVersion(info?.se3?.bootloader)),
|
|
168
|
+
se04Boot: firstMeaningfulVersion(getImageVersion(info?.se4?.bootloader)),
|
|
169
|
+
};
|
|
170
|
+
};
|
|
164
171
|
|
|
165
172
|
// V2 状态由 normalizeV2Status 处理,这里只服务 buildProfileFromProtocolV1 的 V1 路径。
|
|
166
173
|
const normalizeV1Status = (features?: Features): DeviceInfoStatus => ({
|
|
@@ -169,23 +176,31 @@ const normalizeV1Status = (features?: Features): DeviceInfoStatus => ({
|
|
|
169
176
|
bootloaderMode: features?.bootloaderMode ?? null,
|
|
170
177
|
unlocked: features?.unlocked ?? null,
|
|
171
178
|
passphraseProtection: features?.passphraseProtection ?? null,
|
|
179
|
+
attachToPinEnabled: features?.attachToPinEnabled ?? null,
|
|
180
|
+
unlockedAttachPin: features?.unlockedAttachPin ?? null,
|
|
172
181
|
backupRequired: features?.backupRequired ?? null,
|
|
173
182
|
noBackup: features?.noBackup ?? null,
|
|
174
183
|
language: features?.language ?? null,
|
|
175
184
|
bleEnabled: features?.bleEnabled ?? null,
|
|
176
185
|
});
|
|
177
186
|
|
|
178
|
-
const normalizeV2Status = (deviceInfo?: ProtocolV2DeviceInfo): DeviceInfoStatus =>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
const normalizeV2Status = (deviceInfo?: ProtocolV2DeviceInfo): DeviceInfoStatus => {
|
|
188
|
+
const status = deviceInfo?.status;
|
|
189
|
+
const bootloaderMode = isProtocolV2BootloaderDeviceInfo(deviceInfo);
|
|
190
|
+
return {
|
|
191
|
+
mode: getProtocolV2Mode(deviceInfo),
|
|
192
|
+
initialized: status?.init_states ?? null,
|
|
193
|
+
bootloaderMode,
|
|
194
|
+
unlocked: status?.unlocked ?? null,
|
|
195
|
+
passphraseProtection: status?.passphrase_enabled ?? null,
|
|
196
|
+
attachToPinEnabled: status?.attach_to_pin_enabled ?? null,
|
|
197
|
+
unlockedAttachPin: status?.unlocked_by_attach_to_pin ?? null,
|
|
198
|
+
backupRequired: status?.backup_required ?? null,
|
|
199
|
+
noBackup: null,
|
|
200
|
+
language: null,
|
|
201
|
+
bleEnabled: null,
|
|
202
|
+
};
|
|
203
|
+
};
|
|
189
204
|
|
|
190
205
|
const normalizeV1Verify = (
|
|
191
206
|
features?: Features,
|
|
@@ -223,32 +238,35 @@ const normalizeV1Verify = (
|
|
|
223
238
|
se04BootHash: protocolV1OneKeyFeatures?.onekey_se04_boot_hash ?? features?.verify?.se04BootHash,
|
|
224
239
|
});
|
|
225
240
|
|
|
226
|
-
const normalizeV2Verify = (deviceInfo?: ProtocolV2DeviceInfo): DeviceProfileVerify =>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
241
|
+
const normalizeV2Verify = (deviceInfo?: ProtocolV2DeviceInfo): DeviceProfileVerify => {
|
|
242
|
+
const info = deviceInfo;
|
|
243
|
+
return {
|
|
244
|
+
firmwareBuildId: getImageBuildId(info?.fw?.application),
|
|
245
|
+
firmwareHash: getImageHash(info?.fw?.application),
|
|
246
|
+
bootloaderBuildId: getImageBuildId(info?.fw?.bootloader),
|
|
247
|
+
bootloaderHash: getImageHash(info?.fw?.bootloader),
|
|
248
|
+
boardBuildId: getImageBuildId(info?.fw?.application_data ?? info?.fw?.romloader),
|
|
249
|
+
boardHash: getImageHash(info?.fw?.application_data ?? info?.fw?.romloader),
|
|
250
|
+
bleBuildId: getImageBuildId(info?.coprocessor?.application),
|
|
251
|
+
bleHash: getImageHash(info?.coprocessor?.application),
|
|
252
|
+
se01BuildId: getImageBuildId(info?.se1?.application),
|
|
253
|
+
se01Hash: getImageHash(info?.se1?.application),
|
|
254
|
+
se02BuildId: getImageBuildId(info?.se2?.application),
|
|
255
|
+
se02Hash: getImageHash(info?.se2?.application),
|
|
256
|
+
se03BuildId: getImageBuildId(info?.se3?.application),
|
|
257
|
+
se03Hash: getImageHash(info?.se3?.application),
|
|
258
|
+
se04BuildId: getImageBuildId(info?.se4?.application),
|
|
259
|
+
se04Hash: getImageHash(info?.se4?.application),
|
|
260
|
+
se01BootBuildId: getImageBuildId(info?.se1?.bootloader),
|
|
261
|
+
se01BootHash: getImageHash(info?.se1?.bootloader),
|
|
262
|
+
se02BootBuildId: getImageBuildId(info?.se2?.bootloader),
|
|
263
|
+
se02BootHash: getImageHash(info?.se2?.bootloader),
|
|
264
|
+
se03BootBuildId: getImageBuildId(info?.se3?.bootloader),
|
|
265
|
+
se03BootHash: getImageHash(info?.se3?.bootloader),
|
|
266
|
+
se04BootBuildId: getImageBuildId(info?.se4?.bootloader),
|
|
267
|
+
se04BootHash: getImageHash(info?.se4?.bootloader),
|
|
268
|
+
};
|
|
269
|
+
};
|
|
252
270
|
|
|
253
271
|
const normalizeRaw = ({
|
|
254
272
|
features,
|
|
@@ -304,10 +322,11 @@ export function buildProfileFromProtocolV2({
|
|
|
304
322
|
scope = 'basic',
|
|
305
323
|
includeRaw = false,
|
|
306
324
|
}: BuildProtocolV2ProfileParams): DeviceProfile {
|
|
307
|
-
const
|
|
325
|
+
const info = deviceInfo;
|
|
326
|
+
const deviceId = info?.status?.device_id || '';
|
|
308
327
|
const serialNo = deviceInfo?.hw?.serial_no || '';
|
|
309
|
-
const label =
|
|
310
|
-
const bleName =
|
|
328
|
+
const label = null;
|
|
329
|
+
const bleName = info?.coprocessor?.bt_adv_name ?? null;
|
|
311
330
|
const verify = normalizeV2Verify(deviceInfo);
|
|
312
331
|
|
|
313
332
|
return {
|
package/src/events/call.ts
CHANGED
|
@@ -53,6 +53,12 @@ export interface IFrameCancelMessage {
|
|
|
53
53
|
payload: { connectId?: string };
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
export interface IFrameCancelOperationMessage {
|
|
57
|
+
event: typeof IFRAME.CANCEL_OPERATION;
|
|
58
|
+
type: typeof IFRAME.CANCEL_OPERATION;
|
|
59
|
+
payload: { operationId: string };
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
export interface IFrameSwitchTransportMessage {
|
|
57
63
|
event: typeof IFRAME.SWITCH_TRANSPORT;
|
|
58
64
|
type: typeof IFRAME.SWITCH_TRANSPORT;
|
package/src/events/core.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
IFrameCallMessage,
|
|
6
6
|
IFrameCallbackMessage,
|
|
7
7
|
IFrameCancelMessage,
|
|
8
|
+
IFrameCancelOperationMessage,
|
|
8
9
|
IFrameSwitchTransportMessage,
|
|
9
10
|
} from './call';
|
|
10
11
|
import type { DeviceEventMessage } from './device';
|
|
@@ -23,6 +24,7 @@ export type CoreMessage = {
|
|
|
23
24
|
| IFrameEventMessage
|
|
24
25
|
| IFrameCallMessage
|
|
25
26
|
| IFrameCancelMessage
|
|
27
|
+
| IFrameCancelOperationMessage
|
|
26
28
|
| IFrameSwitchTransportMessage
|
|
27
29
|
| IFrameCallbackMessage
|
|
28
30
|
| UiResponseMessage
|
package/src/events/iframe.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ const HardwareSdk = ({
|
|
|
27
27
|
eventEmitter,
|
|
28
28
|
uiResponse,
|
|
29
29
|
cancel,
|
|
30
|
+
cancelOperation,
|
|
30
31
|
updateSettings,
|
|
31
32
|
switchTransport,
|
|
32
33
|
}: InjectApi): CoreApi =>
|
|
@@ -37,6 +38,7 @@ const HardwareSdk = ({
|
|
|
37
38
|
eventEmitter,
|
|
38
39
|
uiResponse,
|
|
39
40
|
cancel,
|
|
41
|
+
cancelOperation,
|
|
40
42
|
updateSettings,
|
|
41
43
|
switchTransport,
|
|
42
44
|
});
|
|
@@ -49,6 +51,7 @@ const HardwareSDKLowLevel = ({
|
|
|
49
51
|
addHardwareGlobalEventListener,
|
|
50
52
|
uiResponse,
|
|
51
53
|
cancel,
|
|
54
|
+
cancelOperation,
|
|
52
55
|
updateSettings,
|
|
53
56
|
switchTransport,
|
|
54
57
|
}: LowLevelInjectApi): LowLevelCoreApi =>
|
|
@@ -60,6 +63,7 @@ const HardwareSDKLowLevel = ({
|
|
|
60
63
|
addHardwareGlobalEventListener,
|
|
61
64
|
uiResponse,
|
|
62
65
|
cancel,
|
|
66
|
+
cancelOperation,
|
|
63
67
|
updateSettings,
|
|
64
68
|
switchTransport,
|
|
65
69
|
});
|
package/src/inject.ts
CHANGED
|
@@ -36,12 +36,14 @@ export interface InjectApi {
|
|
|
36
36
|
dispose: CoreApi['dispose'];
|
|
37
37
|
uiResponse: CoreApi['uiResponse'];
|
|
38
38
|
cancel: CoreApi['cancel'];
|
|
39
|
+
cancelOperation: CoreApi['cancelOperation'];
|
|
39
40
|
switchTransport: CoreApi['switchTransport'];
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export const inject = ({
|
|
43
44
|
call,
|
|
44
45
|
cancel,
|
|
46
|
+
cancelOperation,
|
|
45
47
|
dispose,
|
|
46
48
|
eventEmitter,
|
|
47
49
|
init,
|
|
@@ -73,6 +75,7 @@ export const inject = ({
|
|
|
73
75
|
uiResponse,
|
|
74
76
|
|
|
75
77
|
cancel,
|
|
78
|
+
cancelOperation,
|
|
76
79
|
|
|
77
80
|
updateSettings,
|
|
78
81
|
|
|
@@ -96,10 +99,12 @@ export const createCoreApi = (
|
|
|
96
99
|
| 'dispose'
|
|
97
100
|
| 'uiResponse'
|
|
98
101
|
| 'cancel'
|
|
102
|
+
| 'cancelOperation'
|
|
99
103
|
| 'updateSettings'
|
|
100
104
|
| 'switchTransport'
|
|
101
105
|
> => ({
|
|
102
106
|
getLogs: () => call({ method: 'getLogs' }),
|
|
107
|
+
clearSessionCache: params => call({ ...params, method: 'clearSessionCache' }),
|
|
103
108
|
/**
|
|
104
109
|
* 搜索设备
|
|
105
110
|
*/
|
|
@@ -151,28 +156,32 @@ export const createCoreApi = (
|
|
|
151
156
|
deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
|
|
152
157
|
|
|
153
158
|
// File system & device control API (Protocol V2 only)
|
|
154
|
-
|
|
159
|
+
protocolInfoRequest: (connectId, params) =>
|
|
160
|
+
call({ ...params, connectId, method: 'protocolInfoRequest' }),
|
|
155
161
|
ping: (connectId, params) => call({ ...params, connectId, method: 'ping' }),
|
|
156
162
|
deviceReboot: (connectId, params) => call({ ...params, connectId, method: 'deviceReboot' }),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
call({ ...params, connectId, method: '
|
|
163
|
+
deviceInfoGet: (connectId, params) => call({ ...params, connectId, method: 'deviceInfoGet' }),
|
|
164
|
+
deviceStatusGet: (connectId, params) => call({ ...params, connectId, method: 'deviceStatusGet' }),
|
|
165
|
+
deviceSessionGet: (connectId, params) =>
|
|
166
|
+
call({ ...params, connectId, method: 'deviceSessionGet' }),
|
|
161
167
|
deviceFirmwareUpdate: (connectId, params) =>
|
|
162
168
|
call({ ...params, connectId, method: 'deviceFirmwareUpdate' }),
|
|
163
169
|
deviceGetFirmwareUpdateStatus: (connectId, params) =>
|
|
164
170
|
call({ ...params, connectId, method: 'deviceGetFirmwareUpdateStatus' }),
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
deviceFactoryInfoSet: (connectId, params) =>
|
|
172
|
+
call({ ...params, connectId, method: 'deviceFactoryInfoSet' }),
|
|
173
|
+
deviceFactoryInfoGet: (connectId, params) =>
|
|
174
|
+
call({ ...params, connectId, method: 'deviceFactoryInfoGet' }),
|
|
175
|
+
deviceSettingsGet: (connectId, params) =>
|
|
176
|
+
call({ ...params, connectId, method: 'deviceSettingsGet' }),
|
|
177
|
+
deviceSettingsSet: (connectId, params) =>
|
|
178
|
+
call({ ...params, connectId, method: 'deviceSettingsSet' }),
|
|
179
|
+
deviceSettingsPageShow: (connectId, params) =>
|
|
180
|
+
call({ ...params, connectId, method: 'deviceSettingsPageShow' }),
|
|
181
|
+
deviceUploadWallpaper: (connectId, params) =>
|
|
182
|
+
call({ ...params, connectId, method: 'deviceUploadWallpaper' }),
|
|
183
|
+
filesystemPermissionFix: (connectId, params) =>
|
|
184
|
+
call({ ...params, connectId, method: 'filesystemPermissionFix' }),
|
|
176
185
|
fileRead: (connectId, params) => call({ ...params, connectId, method: 'fileRead' }),
|
|
177
186
|
fileWrite: (connectId, params) => call({ ...params, connectId, method: 'fileWrite' }),
|
|
178
187
|
fileDelete: (connectId, params) => call({ ...params, connectId, method: 'fileDelete' }),
|
|
@@ -184,6 +193,7 @@ export const createCoreApi = (
|
|
|
184
193
|
call({ ...params, connectId, method: 'filesystemFileRead' }),
|
|
185
194
|
filesystemFileWrite: (connectId, params) =>
|
|
186
195
|
call({ ...params, connectId, method: 'filesystemFileWrite' }),
|
|
196
|
+
uploadPortfolio: (connectId, params) => call({ ...params, connectId, method: 'uploadPortfolio' }),
|
|
187
197
|
filesystemFileDelete: (connectId, params) =>
|
|
188
198
|
call({ ...params, connectId, method: 'filesystemFileDelete' }),
|
|
189
199
|
filesystemDirList: (connectId, params) =>
|
package/src/lowLevelInject.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface LowLevelInjectApi {
|
|
|
13
13
|
dispose: CoreApi['dispose'];
|
|
14
14
|
uiResponse: CoreApi['uiResponse'];
|
|
15
15
|
cancel: CoreApi['cancel'];
|
|
16
|
+
cancelOperation: CoreApi['cancelOperation'];
|
|
16
17
|
updateSettings: CoreApi['updateSettings'];
|
|
17
18
|
switchTransport: CoreApi['switchTransport'];
|
|
18
19
|
addHardwareGlobalEventListener: (listener: IAddHardwareGlobalEventListener) => void;
|
|
@@ -25,6 +26,7 @@ export type LowLevelCoreApi = Omit<CoreApi, 'on' | 'off'> & {
|
|
|
25
26
|
export const lowLevelInject = ({
|
|
26
27
|
call,
|
|
27
28
|
cancel,
|
|
29
|
+
cancelOperation,
|
|
28
30
|
dispose,
|
|
29
31
|
eventEmitter,
|
|
30
32
|
init,
|
|
@@ -48,6 +50,7 @@ export const lowLevelInject = ({
|
|
|
48
50
|
uiResponse,
|
|
49
51
|
|
|
50
52
|
cancel,
|
|
53
|
+
cancelOperation,
|
|
51
54
|
|
|
52
55
|
updateSettings,
|
|
53
56
|
|