@onekeyfe/hd-core 1.2.0-alpha.126 → 1.2.0-alpha.128
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 +16 -0
- package/__tests__/deviceUploadNft.test.ts +1 -0
- package/__tests__/protocol-v2-resources.test.ts +100 -13
- package/__tests__/protocol-v2.test.ts +50 -6
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +1 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +2 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +53 -39
- package/dist/types/settings.d.ts +1 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/CheckAllFirmwareRelease.ts +2 -4
- package/src/api/FirmwareUpdateV4.ts +28 -15
- package/src/api/protocol-v2/DeviceUploadNft.ts +1 -1
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +1 -1
- package/src/data-manager/DataManager.ts +47 -39
- package/src/device/DeviceCommands.ts +1 -1
- package/src/types/settings.ts +2 -2
|
@@ -19,6 +19,22 @@ const createCommands = () => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
describe('DeviceCommands failure mapping', () => {
|
|
22
|
+
it.each(['File already exists', 'NFT already exists'])(
|
|
23
|
+
'maps duplicate file response "%s" to FileAlreadyExists',
|
|
24
|
+
async message => {
|
|
25
|
+
const commands = createCommands();
|
|
26
|
+
await expect(
|
|
27
|
+
commands._filterCommonTypes(
|
|
28
|
+
{
|
|
29
|
+
type: 'Failure',
|
|
30
|
+
message: { code: 'Failure_DataError', message },
|
|
31
|
+
} as any,
|
|
32
|
+
'NFTUpdate'
|
|
33
|
+
)
|
|
34
|
+
).rejects.toMatchObject({ errorCode: HardwareErrorCode.FileAlreadyExists });
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
22
38
|
it('logs passphrase request and canonical response without exposing the passphrase', async () => {
|
|
23
39
|
const commands = createCommands();
|
|
24
40
|
const log = getLogger(LoggerNames.DeviceCommands);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { sha256 } from '@noble/hashes/sha256';
|
|
3
|
-
import { EDeviceType, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
|
+
import { EDeviceType, EFirmwareType, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
4
|
|
|
5
5
|
import { DataManager } from '../src/data-manager';
|
|
6
6
|
import {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
parseProtocolV2Resources,
|
|
9
9
|
} from '../src/protocols/protocol-v2/resources';
|
|
10
10
|
|
|
11
|
-
import type { ConnectSettings, RemoteConfigResponse } from '../src/types';
|
|
11
|
+
import type { ConnectSettings, Features, RemoteConfigResponse } from '../src/types';
|
|
12
12
|
|
|
13
13
|
jest.mock('axios');
|
|
14
14
|
jest.mock('../src/data/config', () => ({
|
|
@@ -31,6 +31,25 @@ const neoResourceSource = {
|
|
|
31
31
|
archiveSize: 12_345_678,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
const pro2Features = {
|
|
35
|
+
deviceType: EDeviceType.Pro2,
|
|
36
|
+
firmwareVersion: '1.0.0',
|
|
37
|
+
} as unknown as Features;
|
|
38
|
+
|
|
39
|
+
const neoFeatures = {
|
|
40
|
+
deviceType: EDeviceType.Neo,
|
|
41
|
+
firmwareVersion: '1.0.0',
|
|
42
|
+
} as unknown as Features;
|
|
43
|
+
|
|
44
|
+
const createProtocolV2Release = (source: typeof resourceSource) => ({
|
|
45
|
+
required: false,
|
|
46
|
+
version: [1, 0, 0],
|
|
47
|
+
url: 'https://example.com/firmware.okpkg',
|
|
48
|
+
fingerprint: 'c'.repeat(64),
|
|
49
|
+
changelog: {},
|
|
50
|
+
resources: { source },
|
|
51
|
+
});
|
|
52
|
+
|
|
34
53
|
const manifestFiles = [
|
|
35
54
|
['bundles/firmware_logo-build.okpkg', 'firmware_logo.okpkg', 'vol0:/bundles/firmware_logo.okpkg'],
|
|
36
55
|
['bundles/font/noto-build.okpkg', 'noto.okpkg', 'vol0:/bundles/font/noto.okpkg'],
|
|
@@ -108,8 +127,8 @@ const createRemoteConfig = (): RemoteConfigResponse =>
|
|
|
108
127
|
mini: { firmware: [], ble: [] },
|
|
109
128
|
touch: { firmware: [], ble: [] },
|
|
110
129
|
pro: { firmware: [], ble: [] },
|
|
111
|
-
pro2: { firmware: []
|
|
112
|
-
neo: { firmware: []
|
|
130
|
+
pro2: { 'firmware-v1': [createProtocolV2Release(resourceSource)] },
|
|
131
|
+
neo: { 'firmware-v1': [createProtocolV2Release(neoResourceSource)] },
|
|
113
132
|
bridge: {},
|
|
114
133
|
} as unknown as RemoteConfigResponse);
|
|
115
134
|
|
|
@@ -184,10 +203,54 @@ describe('Pro2 resource configuration', () => {
|
|
|
184
203
|
expect(configFetcher).toHaveBeenCalledWith(
|
|
185
204
|
expect.stringMatching(/^https:\/\/data\.onekey\.so\/pre-config\.json\?noCache=/)
|
|
186
205
|
);
|
|
187
|
-
expect(DataManager.getProtocolV2ResourceSource()).toEqual(
|
|
206
|
+
expect(DataManager.getProtocolV2ResourceSource(pro2Features, EFirmwareType.Universal)).toEqual(
|
|
207
|
+
resourceSource
|
|
208
|
+
);
|
|
188
209
|
expect(DataManager.lastCheckTimestamp).toBeGreaterThan(0);
|
|
189
210
|
});
|
|
190
211
|
|
|
212
|
+
test('does not use a device-level resource archive outside the selected firmware release', async () => {
|
|
213
|
+
const remoteConfig = createRemoteConfig();
|
|
214
|
+
const pro2Config = remoteConfig.pro2 as {
|
|
215
|
+
resources?: unknown;
|
|
216
|
+
'firmware-v1': Array<{ resources?: unknown }>;
|
|
217
|
+
};
|
|
218
|
+
pro2Config.resources = { source: resourceSource };
|
|
219
|
+
delete pro2Config['firmware-v1'][0].resources;
|
|
220
|
+
|
|
221
|
+
await expect(
|
|
222
|
+
DataManager.load(createSettings(jest.fn().mockResolvedValue(remoteConfig)))
|
|
223
|
+
).resolves.toBe(true);
|
|
224
|
+
|
|
225
|
+
expect(
|
|
226
|
+
DataManager.getProtocolV2ResourceSource(pro2Features, EFirmwareType.Universal)
|
|
227
|
+
).toBeUndefined();
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test('uses the resource archive from the selected latest firmware release', async () => {
|
|
231
|
+
const remoteConfig = createRemoteConfig();
|
|
232
|
+
const olderRelease = {
|
|
233
|
+
...createProtocolV2Release(resourceSource),
|
|
234
|
+
version: [0, 9, 0],
|
|
235
|
+
};
|
|
236
|
+
const latestRelease = {
|
|
237
|
+
...createProtocolV2Release(neoResourceSource),
|
|
238
|
+
version: [1, 1, 0],
|
|
239
|
+
};
|
|
240
|
+
(remoteConfig.pro2 as { 'firmware-v1': unknown[] })['firmware-v1'] = [
|
|
241
|
+
olderRelease,
|
|
242
|
+
latestRelease,
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
await expect(
|
|
246
|
+
DataManager.load(createSettings(jest.fn().mockResolvedValue(remoteConfig)))
|
|
247
|
+
).resolves.toBe(true);
|
|
248
|
+
|
|
249
|
+
expect(DataManager.getProtocolV2ResourceSource(pro2Features, EFirmwareType.Universal)).toEqual(
|
|
250
|
+
neoResourceSource
|
|
251
|
+
);
|
|
252
|
+
});
|
|
253
|
+
|
|
191
254
|
test('reuses the configuration fetched during SDK initialization for an immediate update', async () => {
|
|
192
255
|
const configFetcher = jest.fn().mockResolvedValue(createRemoteConfig());
|
|
193
256
|
const settings = createSettings(configFetcher);
|
|
@@ -200,25 +263,41 @@ describe('Pro2 resource configuration', () => {
|
|
|
200
263
|
|
|
201
264
|
test('keeps base SDK initialization available when remote Pro2 resources are invalid', async () => {
|
|
202
265
|
const remoteConfig = createRemoteConfig();
|
|
203
|
-
(
|
|
266
|
+
(
|
|
267
|
+
remoteConfig.pro2 as {
|
|
268
|
+
'firmware-v1': Array<{ resources?: unknown }>;
|
|
269
|
+
}
|
|
270
|
+
)['firmware-v1'][0].resources = { source: {} };
|
|
204
271
|
const configFetcher = jest.fn().mockResolvedValue(remoteConfig);
|
|
205
272
|
|
|
206
273
|
await expect(DataManager.load(createSettings(configFetcher))).resolves.toBe(true);
|
|
207
274
|
|
|
208
|
-
expect(
|
|
275
|
+
expect(
|
|
276
|
+
DataManager.getProtocolV2ResourceSource(pro2Features, EFirmwareType.Universal)
|
|
277
|
+
).toBeUndefined();
|
|
209
278
|
expect(DataManager.protocolV2ResourcesConfigError).toBeInstanceOf(Error);
|
|
210
|
-
expect(DataManager.getProtocolV2ResourceSource(
|
|
279
|
+
expect(DataManager.getProtocolV2ResourceSource(neoFeatures, EFirmwareType.Universal)).toEqual(
|
|
280
|
+
neoResourceSource
|
|
281
|
+
);
|
|
211
282
|
});
|
|
212
283
|
|
|
213
284
|
test('keeps Pro2 resources available when remote Neo resources are invalid', async () => {
|
|
214
285
|
const remoteConfig = createRemoteConfig();
|
|
215
|
-
(
|
|
286
|
+
(
|
|
287
|
+
remoteConfig.neo as {
|
|
288
|
+
'firmware-v1': Array<{ resources?: unknown }>;
|
|
289
|
+
}
|
|
290
|
+
)['firmware-v1'][0].resources = { source: {} };
|
|
216
291
|
const configFetcher = jest.fn().mockResolvedValue(remoteConfig);
|
|
217
292
|
|
|
218
293
|
await expect(DataManager.load(createSettings(configFetcher))).resolves.toBe(true);
|
|
219
294
|
|
|
220
|
-
expect(DataManager.getProtocolV2ResourceSource(
|
|
221
|
-
|
|
295
|
+
expect(DataManager.getProtocolV2ResourceSource(pro2Features, EFirmwareType.Universal)).toEqual(
|
|
296
|
+
resourceSource
|
|
297
|
+
);
|
|
298
|
+
expect(
|
|
299
|
+
DataManager.getProtocolV2ResourceSource(neoFeatures, EFirmwareType.Universal)
|
|
300
|
+
).toBeUndefined();
|
|
222
301
|
await expect(
|
|
223
302
|
DataManager.forceReloadData({
|
|
224
303
|
requireResources: true,
|
|
@@ -238,7 +317,11 @@ describe('Pro2 resource configuration', () => {
|
|
|
238
317
|
|
|
239
318
|
test('only blocks resource mutation when the refreshed Pro2 resources are invalid', async () => {
|
|
240
319
|
const remoteConfig = createRemoteConfig();
|
|
241
|
-
(
|
|
320
|
+
(
|
|
321
|
+
remoteConfig.pro2 as {
|
|
322
|
+
'firmware-v1': Array<{ resources?: unknown }>;
|
|
323
|
+
}
|
|
324
|
+
)['firmware-v1'][0].resources = { source: {} };
|
|
242
325
|
const settings = createSettings(jest.fn().mockResolvedValue(remoteConfig));
|
|
243
326
|
DataManager.settings = settings;
|
|
244
327
|
|
|
@@ -252,7 +335,11 @@ describe('Pro2 resource configuration', () => {
|
|
|
252
335
|
|
|
253
336
|
test('checks resource configuration errors for the requested device only', async () => {
|
|
254
337
|
const remoteConfig = createRemoteConfig();
|
|
255
|
-
(
|
|
338
|
+
(
|
|
339
|
+
remoteConfig.pro2 as {
|
|
340
|
+
'firmware-v1': Array<{ resources?: unknown }>;
|
|
341
|
+
}
|
|
342
|
+
)['firmware-v1'][0].resources = { source: {} };
|
|
256
343
|
const settings = createSettings(jest.fn().mockResolvedValue(remoteConfig));
|
|
257
344
|
DataManager.settings = settings;
|
|
258
345
|
|
|
@@ -211,7 +211,7 @@ describe('DeviceUploadWallpaper', () => {
|
|
|
211
211
|
const result = await method.run();
|
|
212
212
|
|
|
213
213
|
expect(method.getSupportedProtocols()).toEqual(['V2']);
|
|
214
|
-
expect(method.unlockPolicy).toBe('
|
|
214
|
+
expect(method.unlockPolicy).toBe('unlock-before-run');
|
|
215
215
|
expect(typedCall).toHaveBeenNthCalledWith(1, 'FilesystemDirMake', 'Success', {
|
|
216
216
|
path: 'vol1:/wallpapers',
|
|
217
217
|
});
|
|
@@ -5272,8 +5272,8 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5272
5272
|
{ returnAfterWrite: true }
|
|
5273
5273
|
);
|
|
5274
5274
|
expect(typedCall.mock.invocationCallOrder[0]).toBeLessThan(call.mock.invocationCallOrder[0]);
|
|
5275
|
-
expect(method.postTipMessage).toHaveBeenCalledWith('
|
|
5276
|
-
expect(method.postProgressMessage).
|
|
5275
|
+
expect(method.postTipMessage).toHaveBeenCalledWith('ConfirmOnDevice');
|
|
5276
|
+
expect(method.postProgressMessage).not.toHaveBeenCalled();
|
|
5277
5277
|
});
|
|
5278
5278
|
|
|
5279
5279
|
test('does not send the install request when Protocol V2 staging fails', async () => {
|
|
@@ -5358,6 +5358,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5358
5358
|
(method as any).reconnectProtocolV2Device = reconnectProtocolV2Device;
|
|
5359
5359
|
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
5360
5360
|
method.postProgressMessage = jest.fn();
|
|
5361
|
+
method.postTipMessage = jest.fn();
|
|
5361
5362
|
|
|
5362
5363
|
await (method as any).waitForProtocolV2FirmwareUpdateComplete([
|
|
5363
5364
|
{ target_id: 4, path: 'vol0:/application_p1.bin' },
|
|
@@ -5409,6 +5410,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5409
5410
|
(method as any).reconnectProtocolV2Device = reconnectProtocolV2Device;
|
|
5410
5411
|
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
5411
5412
|
method.postProgressMessage = jest.fn();
|
|
5413
|
+
method.postTipMessage = jest.fn();
|
|
5412
5414
|
|
|
5413
5415
|
try {
|
|
5414
5416
|
await (method as any).waitForProtocolV2FirmwareUpdateComplete([
|
|
@@ -5463,6 +5465,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5463
5465
|
(method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
|
|
5464
5466
|
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
5465
5467
|
method.postProgressMessage = jest.fn();
|
|
5468
|
+
method.postTipMessage = jest.fn();
|
|
5466
5469
|
|
|
5467
5470
|
try {
|
|
5468
5471
|
await (method as any).waitForProtocolV2FirmwareUpdateComplete(
|
|
@@ -5474,9 +5477,50 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5474
5477
|
}
|
|
5475
5478
|
|
|
5476
5479
|
expect(typedCall).toHaveBeenCalledTimes(3);
|
|
5480
|
+
expect(method.postTipMessage).toHaveBeenCalledTimes(1);
|
|
5481
|
+
expect(method.postTipMessage).toHaveBeenCalledWith('FirmwareUpdating');
|
|
5477
5482
|
expect(method.postProgressMessage).toHaveBeenCalledWith(100, 'installingFirmware');
|
|
5478
5483
|
});
|
|
5479
5484
|
|
|
5485
|
+
test('reports missing current target records as unconfirmed device installation', async () => {
|
|
5486
|
+
const method = new FirmwareUpdateV4({
|
|
5487
|
+
id: 1,
|
|
5488
|
+
payload: {
|
|
5489
|
+
method: 'firmwareUpdateV4',
|
|
5490
|
+
},
|
|
5491
|
+
});
|
|
5492
|
+
const typedCall = jest.fn().mockResolvedValue({
|
|
5493
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5494
|
+
message: {
|
|
5495
|
+
records: [{ target_id: 7, status: 2 }],
|
|
5496
|
+
},
|
|
5497
|
+
});
|
|
5498
|
+
let now = 0;
|
|
5499
|
+
jest.spyOn(Date, 'now').mockImplementation(() => now);
|
|
5500
|
+
jest.spyOn(global, 'setTimeout').mockImplementation(((callback: () => void) => {
|
|
5501
|
+
now += 31 * 1000;
|
|
5502
|
+
callback();
|
|
5503
|
+
return 0 as any;
|
|
5504
|
+
}) as typeof setTimeout);
|
|
5505
|
+
|
|
5506
|
+
(method as any).device = stubDevice({
|
|
5507
|
+
getCommands: () => ({ typedCall }),
|
|
5508
|
+
});
|
|
5509
|
+
(method as any).reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
|
|
5510
|
+
(method as any).verifyProtocolV2ReconnectIdentity = jest.fn().mockResolvedValue(undefined);
|
|
5511
|
+
|
|
5512
|
+
await expect(
|
|
5513
|
+
(method as any).waitForProtocolV2FirmwareUpdateComplete(
|
|
5514
|
+
[{ target_id: 4, path: 'vol0:/application_p1.bin' }],
|
|
5515
|
+
true
|
|
5516
|
+
)
|
|
5517
|
+
).rejects.toMatchObject({
|
|
5518
|
+
errorCode: HardwareErrorCode.FirmwareError,
|
|
5519
|
+
message: expect.stringContaining('was not confirmed on the device'),
|
|
5520
|
+
});
|
|
5521
|
+
expect(typedCall).toHaveBeenCalledTimes(2);
|
|
5522
|
+
});
|
|
5523
|
+
|
|
5480
5524
|
test('ignores stale finished records until the current install starts', async () => {
|
|
5481
5525
|
const method = new FirmwareUpdateV4({
|
|
5482
5526
|
id: 1,
|
|
@@ -8470,8 +8514,8 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
8470
8514
|
|
|
8471
8515
|
resolveWrite?.({ type: 'WriteCompleted', message: {} });
|
|
8472
8516
|
await startPromise;
|
|
8473
|
-
expect(method.postTipMessage).toHaveBeenCalledWith('
|
|
8474
|
-
expect(method.postProgressMessage).
|
|
8517
|
+
expect(method.postTipMessage).toHaveBeenCalledWith('ConfirmOnDevice');
|
|
8518
|
+
expect(method.postProgressMessage).not.toHaveBeenCalled();
|
|
8475
8519
|
expect(method.postTipMessage).toHaveBeenCalledTimes(1);
|
|
8476
8520
|
});
|
|
8477
8521
|
|
|
@@ -8504,7 +8548,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
8504
8548
|
{},
|
|
8505
8549
|
{ returnAfterWrite: true }
|
|
8506
8550
|
);
|
|
8507
|
-
expect(method.postTipMessage).toHaveBeenCalledWith('
|
|
8551
|
+
expect(method.postTipMessage).toHaveBeenCalledWith('ConfirmOnDevice');
|
|
8508
8552
|
});
|
|
8509
8553
|
});
|
|
8510
8554
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckAllFirmwareRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckAllFirmwareRelease.ts"],"names":[],"mappings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C,yBAAyB;IASvC,OAAO,CAAC,2BAA2B;YAMrB,8BAA8B;IAQ5C,OAAO,CAAC,0BAA0B;YAkBpB,mCAAmC;YAWnC,qCAAqC;YAiDrC,yBAAyB;YA8DzB,8BAA8B;IAU5C,OAAO,CAAC,kCAAkC;YAQ5B,cAAc;YAuCd,6BAA6B;YAW7B,0BAA0B;YAS1B,6BAA6B;YAY7B,gBAAgB;IAiB9B,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -35,6 +35,7 @@ export declare const getBinary: ({ features, updateType, version, isUpdateBootlo
|
|
|
35
35
|
upgradeType?: string | undefined;
|
|
36
36
|
components?: Record<string, import("../../types").IProtocolV2FirmwareComponent> | undefined;
|
|
37
37
|
installOrder?: string[] | undefined;
|
|
38
|
+
resources?: import("../../types").IProtocolV2Resources | undefined;
|
|
38
39
|
bootloaderChangelog?: {
|
|
39
40
|
"zh-CN": string;
|
|
40
41
|
"en-US": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,aAAa,CAAC;CAC7B;AAED,UAAU,cAAe,SAAQ,YAAY;IAC3C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACrC;AAED,eAAO,MAAM,SAAS,yFAOnB,cAAc
|
|
1
|
+
{"version":3,"file":"getBinary.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/getBinary.ts"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;AAElD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC;IAC/B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,aAAa,CAAC;CAC7B;AAED,UAAU,cAAe,SAAQ,YAAY;IAC3C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACrC;AAED,eAAO,MAAM,SAAS,yFAOnB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsChB,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAAe,MAAM;;EAWrD,CAAC;AAEF,eAAO,MAAM,OAAO,0DAA2D,YAAY,kEAe1F,CAAC"}
|
|
@@ -43,6 +43,7 @@ export default class DataManager {
|
|
|
43
43
|
"en-US": string;
|
|
44
44
|
} | undefined;
|
|
45
45
|
private static enrichFirmwareReleaseInfo;
|
|
46
|
+
private static enrichProtocolV2FirmwareReleaseInfo;
|
|
46
47
|
static load(settings: ConnectSettings): Promise<boolean>;
|
|
47
48
|
private static applyRemoteConfig;
|
|
48
49
|
static updateEnv(newEnv: ConnectSettings['env']): void;
|
|
@@ -51,7 +52,7 @@ export default class DataManager {
|
|
|
51
52
|
requireResources?: boolean;
|
|
52
53
|
resourceDeviceType?: EDeviceType.Pro2 | EDeviceType.Neo;
|
|
53
54
|
}): Promise<void>;
|
|
54
|
-
static getProtocolV2ResourceSource(
|
|
55
|
+
static getProtocolV2ResourceSource(features: Features, firmwareType: EFirmwareType): import("../types").IProtocolV2ResourceSource | undefined;
|
|
55
56
|
static getProtobufMessages(schema?: ProtobufMessageSchema): JSON;
|
|
56
57
|
static getSettings(key?: undefined): ConnectSettings;
|
|
57
58
|
static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAA6B,MAAM,qBAAqB,CAAC;AAmB5F,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,QAAQ,EACR,wBAAwB,EACxB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAA6B,MAAM,qBAAqB,CAAC;AAmB5F,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,QAAQ,EACR,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EAEd,MAAM,UAAU,CAAC;AAMlB,eAAO,MAAM,eAAe,uFAMlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAC3E,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,GAAG,UAAU,CAAC;AAsBzE,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,MAAM,CAAC,SAAS,EAAE,aAAa,GAAG;QAChC,CAAC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,CAAC,kBAAkB;;;kBAAuC;IAEhE,OAAO,CAAC,MAAM,CAAC,yBAAyB;IA4CxC,OAAO,CAAC,MAAM,CAAC,mCAAmC;WAqCrC,IAAI,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IA+D9D,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAuBhC,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC;WAalC,kBAAkB;WAUlB,eAAe,CAAC,EAC3B,gBAAwB,EACxB,kBAAqC,GACtC,GAAE;QACD,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,kBAAkB,CAAC,EAAE,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC;KACpD,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCtB,MAAM,CAAC,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa;IAIlF,MAAM,CAAC,mBAAmB,CAAC,MAAM,GAAE,qBAAyC,GAAG,IAAI;IAInF,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,eAAe;IAEpD,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAU/E,MAAM,CAAC,YAAY,QAAS,eAAe,CAAC,KAAK,CAAC,aAC0B;IAG5E,MAAM,CAAC,eAAe,QAAS,eAAe,CAAC,KAAK,CAAC,aAA8B;IAGnF,MAAM,CAAC,eAAe,QAAS,eAAe,CAAC,KAAK,CAAC,aAAsB;CAC5E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -259,6 +259,8 @@ type IFirmwareReleaseInfo = {
|
|
|
259
259
|
upgradeType?: 'payload-package-set' | string;
|
|
260
260
|
components?: Record<string, IProtocolV2FirmwareComponent>;
|
|
261
261
|
installOrder?: string[];
|
|
262
|
+
/** Resource archive released together with this Protocol V2 firmware release. */
|
|
263
|
+
resources?: IProtocolV2Resources;
|
|
262
264
|
bootloaderChangelog?: {
|
|
263
265
|
[k in ILocale]: string;
|
|
264
266
|
};
|
|
@@ -293,8 +295,6 @@ type IDeviceReleaseInfo = {
|
|
|
293
295
|
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
294
296
|
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
295
297
|
ble?: IBLEFirmwareReleaseInfo[];
|
|
296
|
-
/** Independent Protocol V2 resource release configuration. */
|
|
297
|
-
resources?: IProtocolV2Resources;
|
|
298
298
|
};
|
|
299
299
|
type DeviceTypeMap = {
|
|
300
300
|
[k in Exclude<IKnownDevice, 'neo'>]: IDeviceReleaseInfo;
|
|
@@ -4725,6 +4725,7 @@ declare class DataManager {
|
|
|
4725
4725
|
"en-US": string;
|
|
4726
4726
|
} | undefined;
|
|
4727
4727
|
private static enrichFirmwareReleaseInfo;
|
|
4728
|
+
private static enrichProtocolV2FirmwareReleaseInfo;
|
|
4728
4729
|
static load(settings: ConnectSettings): Promise<boolean>;
|
|
4729
4730
|
private static applyRemoteConfig;
|
|
4730
4731
|
static updateEnv(newEnv: ConnectSettings['env']): void;
|
|
@@ -4734,7 +4735,7 @@ declare class DataManager {
|
|
|
4734
4735
|
requireResources?: boolean;
|
|
4735
4736
|
resourceDeviceType?: EDeviceType.Pro2 | EDeviceType.Neo;
|
|
4736
4737
|
}): Promise<void>;
|
|
4737
|
-
static getProtocolV2ResourceSource(
|
|
4738
|
+
static getProtocolV2ResourceSource(features: Features, firmwareType: EFirmwareType): IProtocolV2ResourceSource | undefined;
|
|
4738
4739
|
static getProtobufMessages(schema?: ProtobufMessageSchema): JSON;
|
|
4739
4740
|
static getSettings(key?: undefined): ConnectSettings;
|
|
4740
4741
|
static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
|
package/dist/index.js
CHANGED
|
@@ -40850,6 +40850,28 @@ class DataManager {
|
|
|
40850
40850
|
});
|
|
40851
40851
|
return enrichedData;
|
|
40852
40852
|
}
|
|
40853
|
+
static enrichProtocolV2FirmwareReleaseInfo(deviceData, deviceName, onResourcesConfigError) {
|
|
40854
|
+
const enrichedData = this.enrichFirmwareReleaseInfo(deviceData);
|
|
40855
|
+
const _b = enrichedData, releaseScopedData = __rest(_b, ["resources"]);
|
|
40856
|
+
const releases = releaseScopedData['firmware-v1'];
|
|
40857
|
+
if (!Array.isArray(releases)) {
|
|
40858
|
+
return releaseScopedData;
|
|
40859
|
+
}
|
|
40860
|
+
return Object.assign(Object.assign({}, releaseScopedData), { 'firmware-v1': releases.map(release => {
|
|
40861
|
+
const { resources: rawResources } = release, releaseWithoutResources = __rest(release, ["resources"]);
|
|
40862
|
+
try {
|
|
40863
|
+
const resources = parseProtocolV2Resources(rawResources);
|
|
40864
|
+
return resources
|
|
40865
|
+
? Object.assign(Object.assign({}, releaseWithoutResources), { resources }) : releaseWithoutResources;
|
|
40866
|
+
}
|
|
40867
|
+
catch (error) {
|
|
40868
|
+
const resourcesError = error instanceof Error ? error : new Error(String(error));
|
|
40869
|
+
onResourcesConfigError(resourcesError);
|
|
40870
|
+
Log$k.warn(`[DataConfig] Ignoring invalid ${deviceName} release resources config:`, error);
|
|
40871
|
+
return releaseWithoutResources;
|
|
40872
|
+
}
|
|
40873
|
+
}) });
|
|
40874
|
+
}
|
|
40853
40875
|
static load(settings) {
|
|
40854
40876
|
var _b;
|
|
40855
40877
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -40911,29 +40933,14 @@ class DataManager {
|
|
|
40911
40933
|
});
|
|
40912
40934
|
}
|
|
40913
40935
|
static applyRemoteConfig(data) {
|
|
40914
|
-
|
|
40915
|
-
|
|
40916
|
-
|
|
40917
|
-
|
|
40918
|
-
|
|
40919
|
-
|
|
40920
|
-
|
|
40921
|
-
|
|
40922
|
-
error instanceof Error ? error : new Error(String(error));
|
|
40923
|
-
Log$k.warn('[DataConfig] Ignoring invalid Pro2 resources config:', error);
|
|
40924
|
-
}
|
|
40925
|
-
try {
|
|
40926
|
-
neoResources = parseProtocolV2Resources((_c = data.neo) === null || _c === void 0 ? void 0 : _c.resources);
|
|
40927
|
-
}
|
|
40928
|
-
catch (error) {
|
|
40929
|
-
this.protocolV2NeoResourcesConfigError =
|
|
40930
|
-
error instanceof Error ? error : new Error(String(error));
|
|
40931
|
-
Log$k.warn('[DataConfig] Ignoring invalid Neo resources config:', error);
|
|
40932
|
-
}
|
|
40933
|
-
const enrichedPro2Config = this.enrichFirmwareReleaseInfo(data.pro2);
|
|
40934
|
-
const enrichedNeoConfig = this.enrichFirmwareReleaseInfo(data.neo);
|
|
40935
|
-
const pro2Config = __rest(enrichedPro2Config, ["resources"]);
|
|
40936
|
-
const neoConfig = __rest(enrichedNeoConfig, ["resources"]);
|
|
40936
|
+
const pro2Config = this.enrichProtocolV2FirmwareReleaseInfo(data.pro2, 'Pro2', error => {
|
|
40937
|
+
var _b;
|
|
40938
|
+
(_b = this.protocolV2ResourcesConfigError) !== null && _b !== void 0 ? _b : (this.protocolV2ResourcesConfigError = error);
|
|
40939
|
+
});
|
|
40940
|
+
const neoConfig = this.enrichProtocolV2FirmwareReleaseInfo(data.neo, 'Neo', error => {
|
|
40941
|
+
var _b;
|
|
40942
|
+
(_b = this.protocolV2NeoResourcesConfigError) !== null && _b !== void 0 ? _b : (this.protocolV2NeoResourcesConfigError = error);
|
|
40943
|
+
});
|
|
40937
40944
|
this.deviceMap = {
|
|
40938
40945
|
[hdShared.EDeviceType.Classic]: this.enrichFirmwareReleaseInfo(data.classic),
|
|
40939
40946
|
[hdShared.EDeviceType.Classic1s]: this.enrichFirmwareReleaseInfo(data.classic1s),
|
|
@@ -40941,8 +40948,8 @@ class DataManager {
|
|
|
40941
40948
|
[hdShared.EDeviceType.Mini]: this.enrichFirmwareReleaseInfo(data.mini),
|
|
40942
40949
|
[hdShared.EDeviceType.Touch]: this.enrichFirmwareReleaseInfo(data.touch),
|
|
40943
40950
|
[hdShared.EDeviceType.Pro]: this.enrichFirmwareReleaseInfo(data.pro),
|
|
40944
|
-
[hdShared.EDeviceType.Pro2]:
|
|
40945
|
-
[hdShared.EDeviceType.Neo]:
|
|
40951
|
+
[hdShared.EDeviceType.Pro2]: pro2Config,
|
|
40952
|
+
[hdShared.EDeviceType.Neo]: neoConfig,
|
|
40946
40953
|
};
|
|
40947
40954
|
this.assets = {
|
|
40948
40955
|
bridge: data.bridge,
|
|
@@ -40996,9 +41003,9 @@ class DataManager {
|
|
|
40996
41003
|
this.lastCheckTimestamp = getTimeStamp();
|
|
40997
41004
|
});
|
|
40998
41005
|
}
|
|
40999
|
-
static getProtocolV2ResourceSource(
|
|
41006
|
+
static getProtocolV2ResourceSource(features, firmwareType) {
|
|
41000
41007
|
var _b, _c;
|
|
41001
|
-
return (_c = (_b = this.
|
|
41008
|
+
return (_c = (_b = this.getFirmwareLatestRelease(features, firmwareType)) === null || _b === void 0 ? void 0 : _b.resources) === null || _c === void 0 ? void 0 : _c.source;
|
|
41002
41009
|
}
|
|
41003
41010
|
static getProtobufMessages(schema = 'v1CurrentSchema') {
|
|
41004
41011
|
return this.messages[schema];
|
|
@@ -43830,7 +43837,7 @@ class DeviceCommands {
|
|
|
43830
43837
|
if (message === 'Please confirm the BlindSign enabled') {
|
|
43831
43838
|
error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BlindSignDisabled);
|
|
43832
43839
|
}
|
|
43833
|
-
if (message === 'File already exists') {
|
|
43840
|
+
if (message === 'File already exists' || message === 'NFT already exists') {
|
|
43834
43841
|
error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FileAlreadyExists);
|
|
43835
43842
|
}
|
|
43836
43843
|
if (message === null || message === void 0 ? void 0 : message.includes('bytes overflow')) {
|
|
@@ -47848,8 +47855,7 @@ class CheckAllFirmwareRelease extends BaseMethod {
|
|
|
47848
47855
|
release,
|
|
47849
47856
|
deviceType: state.identity.deviceType,
|
|
47850
47857
|
});
|
|
47851
|
-
const
|
|
47852
|
-
const resourceSource = DataManager.getProtocolV2ResourceSource(resourceDeviceType);
|
|
47858
|
+
const resourceSource = DataManager.getProtocolV2ResourceSource(features, firmwareType);
|
|
47853
47859
|
const resourceStatus = 'unknown';
|
|
47854
47860
|
const detectedComponentTargets = validatedForceUpdateTargets.includes('firmware')
|
|
47855
47861
|
? plan.components.flatMap(component => component.updateTarget ? [component.updateTarget] : [])
|
|
@@ -52235,7 +52241,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
52235
52241
|
}));
|
|
52236
52242
|
}
|
|
52237
52243
|
if (wantsResources) {
|
|
52238
|
-
this.params.resourceArchiveBinary = yield this.downloadRemoteProtocolV2ResourceArchive(deviceFeatures);
|
|
52244
|
+
this.params.resourceArchiveBinary = yield this.downloadRemoteProtocolV2ResourceArchive(deviceFeatures, firmwareType);
|
|
52239
52245
|
resourceMemoryHost = yield this.prepareProtocolV2LocalMemoryHost({
|
|
52240
52246
|
features: deviceFeatures,
|
|
52241
52247
|
firmwareType,
|
|
@@ -52933,13 +52939,13 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
52933
52939
|
return Object.assign(Object.assign({}, target), { binary });
|
|
52934
52940
|
});
|
|
52935
52941
|
}
|
|
52936
|
-
downloadRemoteProtocolV2ResourceArchive(features) {
|
|
52942
|
+
downloadRemoteProtocolV2ResourceArchive(features, firmwareType) {
|
|
52937
52943
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52938
52944
|
const deviceType = getDeviceType(features);
|
|
52939
52945
|
if (deviceType !== hdShared.EDeviceType.Pro2 && deviceType !== hdShared.EDeviceType.Neo) {
|
|
52940
52946
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 resource archive requires a Pro2 or Neo device');
|
|
52941
52947
|
}
|
|
52942
|
-
const source = DataManager.getProtocolV2ResourceSource(
|
|
52948
|
+
const source = DataManager.getProtocolV2ResourceSource(features, firmwareType);
|
|
52943
52949
|
const expectedSha256 = normalizeProtocolV2Hex(source === null || source === void 0 ? void 0 : source.archiveSha256);
|
|
52944
52950
|
if (!(source === null || source === void 0 ? void 0 : source.archiveUrl) ||
|
|
52945
52951
|
!Number.isSafeInteger(source.archiveSize) ||
|
|
@@ -53507,6 +53513,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53507
53513
|
let normalModeWithoutInstallEvidenceSince;
|
|
53508
53514
|
let installEvidenceObserved = false;
|
|
53509
53515
|
let currentInstallStatusObserved = false;
|
|
53516
|
+
let firmwareUpdatingTipPosted = false;
|
|
53510
53517
|
const resetMissingTargetStatusGrace = () => {
|
|
53511
53518
|
missingTargetStatusSince = undefined;
|
|
53512
53519
|
missingTargetStatusKey = undefined;
|
|
@@ -53536,13 +53543,18 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53536
53543
|
const statusTargets = statusResponse.type === 'DeviceFirmwareUpdateStatus'
|
|
53537
53544
|
? ((_a = statusResponse.message.records) !== null && _a !== void 0 ? _a : [])
|
|
53538
53545
|
: [];
|
|
53539
|
-
|
|
53546
|
+
const hasCurrentInstallStatus = statusTargets.some(target => {
|
|
53540
53547
|
const targetId = normalizeProtocolV2TargetId(target.target_id);
|
|
53541
53548
|
return (targetId !== undefined &&
|
|
53542
53549
|
expectedTargetIds.has(targetId) &&
|
|
53543
53550
|
isProtocolV2TargetStatusInProgress(target.status));
|
|
53544
|
-
})
|
|
53551
|
+
});
|
|
53552
|
+
if (hasCurrentInstallStatus) {
|
|
53545
53553
|
currentInstallStatusObserved = true;
|
|
53554
|
+
if (!firmwareUpdatingTipPosted) {
|
|
53555
|
+
this.postTipMessage(exports.FirmwareUpdateTipMessage.FirmwareUpdating);
|
|
53556
|
+
firmwareUpdatingTipPosted = true;
|
|
53557
|
+
}
|
|
53546
53558
|
}
|
|
53547
53559
|
const hasMatchingTargetStatus = statusTargets.some(target => {
|
|
53548
53560
|
const targetId = normalizeProtocolV2TargetId(target.target_id);
|
|
@@ -53595,6 +53607,9 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53595
53607
|
}
|
|
53596
53608
|
else if (now - missingTargetStatusSince >=
|
|
53597
53609
|
PROTOCOL_V2_MISSING_TARGET_STATUS_GRACE_TIMEOUT) {
|
|
53610
|
+
if (requireCurrentInstallStatus && !currentInstallStatusObserved) {
|
|
53611
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareError, 'Protocol V2 firmware installation was not confirmed on the device');
|
|
53612
|
+
}
|
|
53598
53613
|
const reportedTargetIds = statusTargets
|
|
53599
53614
|
.map(target => normalizeProtocolV2TargetId(target.target_id))
|
|
53600
53615
|
.filter((targetId) => targetId !== undefined);
|
|
@@ -53875,8 +53890,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53875
53890
|
const commands = this.device.getCommands();
|
|
53876
53891
|
yield commands.typedCall('DeviceFirmwareUpdateStage', 'Success', { targets });
|
|
53877
53892
|
yield commands.call('DeviceFirmwareUpdateRequest', {}, { returnAfterWrite: true });
|
|
53878
|
-
this.postTipMessage(exports.FirmwareUpdateTipMessage.
|
|
53879
|
-
this.postProgressMessage(0, 'installingFirmware');
|
|
53893
|
+
this.postTipMessage(exports.FirmwareUpdateTipMessage.ConfirmOnDevice);
|
|
53880
53894
|
});
|
|
53881
53895
|
}
|
|
53882
53896
|
protocolV2Reboot(rebootType) {
|
|
@@ -54378,7 +54392,7 @@ class DeviceUploadWallpaper extends BaseMethod {
|
|
|
54378
54392
|
});
|
|
54379
54393
|
this.path = `${WALLPAPER_DIRECTORY}/${normalizeFileName(fileName, this.encoded.data)}`;
|
|
54380
54394
|
this.params = { jpegBase64, fileName, chunkSize };
|
|
54381
|
-
this.unlockPolicy = '
|
|
54395
|
+
this.unlockPolicy = 'unlock-before-run';
|
|
54382
54396
|
this.skipForceUpdateCheck = true;
|
|
54383
54397
|
this.useDevicePassphraseState = false;
|
|
54384
54398
|
}
|
|
@@ -54526,7 +54540,7 @@ class DeviceUploadNft extends BaseMethod {
|
|
|
54526
54540
|
paceMs,
|
|
54527
54541
|
timeoutMs,
|
|
54528
54542
|
};
|
|
54529
|
-
this.unlockPolicy = '
|
|
54543
|
+
this.unlockPolicy = 'unlock-before-run';
|
|
54530
54544
|
this.skipForceUpdateCheck = true;
|
|
54531
54545
|
this.useDevicePassphraseState = false;
|
|
54532
54546
|
}
|
package/dist/types/settings.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export type IFirmwareReleaseInfo = {
|
|
|
76
76
|
upgradeType?: 'payload-package-set' | string;
|
|
77
77
|
components?: Record<string, IProtocolV2FirmwareComponent>;
|
|
78
78
|
installOrder?: string[];
|
|
79
|
+
resources?: IProtocolV2Resources;
|
|
79
80
|
bootloaderChangelog?: {
|
|
80
81
|
[k in ILocale]: string;
|
|
81
82
|
};
|
|
@@ -106,7 +107,6 @@ type IDeviceReleaseInfo = {
|
|
|
106
107
|
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
107
108
|
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
108
109
|
ble?: IBLEFirmwareReleaseInfo[];
|
|
109
|
-
resources?: IProtocolV2Resources;
|
|
110
110
|
};
|
|
111
111
|
export type DeviceTypeMap = {
|
|
112
112
|
[k in Exclude<IKnownDevice, 'neo'>]: IDeviceReleaseInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,KAAK,GACL,cAAc,GACd,UAAU,GACV,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,iBAAiB,GACjB,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AACf,M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E;aACR,CAAC,IAAI,OAAO,GAAG,MAAM;SACvB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.128",
|
|
4
4
|
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.2.0-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.128",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.128",
|
|
30
30
|
"axios": "1.15.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"buffer": "^6.0.3",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/w3c-web-usb": "^1.0.10",
|
|
47
47
|
"@types/web-bluetooth": "^0.0.21"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "121180c237cddef9279041969d0d2394fac75a7a"
|
|
50
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HardwareError } from '@onekeyfe/hd-shared';
|
|
2
2
|
import semver from 'semver';
|
|
3
3
|
|
|
4
4
|
import { BaseMethod } from './BaseMethod';
|
|
@@ -411,9 +411,7 @@ export default class CheckAllFirmwareRelease extends BaseMethod {
|
|
|
411
411
|
release,
|
|
412
412
|
deviceType: state.identity.deviceType,
|
|
413
413
|
});
|
|
414
|
-
const
|
|
415
|
-
state.identity.deviceType === 'neo' ? EDeviceType.Neo : EDeviceType.Pro2;
|
|
416
|
-
const resourceSource = DataManager.getProtocolV2ResourceSource(resourceDeviceType);
|
|
414
|
+
const resourceSource = DataManager.getProtocolV2ResourceSource(features, firmwareType);
|
|
417
415
|
const resourceStatus = 'unknown' as const;
|
|
418
416
|
const detectedComponentTargets = validatedForceUpdateTargets.includes('firmware')
|
|
419
417
|
? plan.components.flatMap(component =>
|
|
@@ -914,7 +914,8 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
914
914
|
}
|
|
915
915
|
if (wantsResources) {
|
|
916
916
|
this.params.resourceArchiveBinary = await this.downloadRemoteProtocolV2ResourceArchive(
|
|
917
|
-
deviceFeatures
|
|
917
|
+
deviceFeatures,
|
|
918
|
+
firmwareType
|
|
918
919
|
);
|
|
919
920
|
resourceMemoryHost = await this.prepareProtocolV2LocalMemoryHost({
|
|
920
921
|
features: deviceFeatures,
|
|
@@ -1879,7 +1880,10 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
1879
1880
|
};
|
|
1880
1881
|
}
|
|
1881
1882
|
|
|
1882
|
-
private async downloadRemoteProtocolV2ResourceArchive(
|
|
1883
|
+
private async downloadRemoteProtocolV2ResourceArchive(
|
|
1884
|
+
features: Features,
|
|
1885
|
+
firmwareType: EFirmwareType
|
|
1886
|
+
): Promise<ArrayBuffer> {
|
|
1883
1887
|
const deviceType = getDeviceType(features);
|
|
1884
1888
|
if (deviceType !== EDeviceType.Pro2 && deviceType !== EDeviceType.Neo) {
|
|
1885
1889
|
throw ERRORS.TypedError(
|
|
@@ -1887,7 +1891,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
1887
1891
|
'Protocol V2 resource archive requires a Pro2 or Neo device'
|
|
1888
1892
|
);
|
|
1889
1893
|
}
|
|
1890
|
-
const source = DataManager.getProtocolV2ResourceSource(
|
|
1894
|
+
const source = DataManager.getProtocolV2ResourceSource(features, firmwareType);
|
|
1891
1895
|
const expectedSha256 = normalizeProtocolV2Hex(source?.archiveSha256);
|
|
1892
1896
|
if (
|
|
1893
1897
|
!source?.archiveUrl ||
|
|
@@ -2644,6 +2648,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2644
2648
|
let normalModeWithoutInstallEvidenceSince: number | undefined;
|
|
2645
2649
|
let installEvidenceObserved = false;
|
|
2646
2650
|
let currentInstallStatusObserved = false;
|
|
2651
|
+
let firmwareUpdatingTipPosted = false;
|
|
2647
2652
|
const resetMissingTargetStatusGrace = () => {
|
|
2648
2653
|
missingTargetStatusSince = undefined;
|
|
2649
2654
|
missingTargetStatusKey = undefined;
|
|
@@ -2684,17 +2689,20 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2684
2689
|
statusResponse.type === 'DeviceFirmwareUpdateStatus'
|
|
2685
2690
|
? ((statusResponse.message.records ?? []) as ProtocolV2FirmwareUpdateStatusTarget[])
|
|
2686
2691
|
: [];
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
) {
|
|
2692
|
+
const hasCurrentInstallStatus = statusTargets.some(target => {
|
|
2693
|
+
const targetId = normalizeProtocolV2TargetId(target.target_id);
|
|
2694
|
+
return (
|
|
2695
|
+
targetId !== undefined &&
|
|
2696
|
+
expectedTargetIds.has(targetId) &&
|
|
2697
|
+
isProtocolV2TargetStatusInProgress(target.status)
|
|
2698
|
+
);
|
|
2699
|
+
});
|
|
2700
|
+
if (hasCurrentInstallStatus) {
|
|
2697
2701
|
currentInstallStatusObserved = true;
|
|
2702
|
+
if (!firmwareUpdatingTipPosted) {
|
|
2703
|
+
this.postTipMessage(FirmwareUpdateTipMessage.FirmwareUpdating);
|
|
2704
|
+
firmwareUpdatingTipPosted = true;
|
|
2705
|
+
}
|
|
2698
2706
|
}
|
|
2699
2707
|
const hasMatchingTargetStatus = statusTargets.some(target => {
|
|
2700
2708
|
const targetId = normalizeProtocolV2TargetId(target.target_id);
|
|
@@ -2768,6 +2776,12 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2768
2776
|
now - missingTargetStatusSince >=
|
|
2769
2777
|
PROTOCOL_V2_MISSING_TARGET_STATUS_GRACE_TIMEOUT
|
|
2770
2778
|
) {
|
|
2779
|
+
if (requireCurrentInstallStatus && !currentInstallStatusObserved) {
|
|
2780
|
+
throw ERRORS.TypedError(
|
|
2781
|
+
HardwareErrorCode.FirmwareError,
|
|
2782
|
+
'Protocol V2 firmware installation was not confirmed on the device'
|
|
2783
|
+
);
|
|
2784
|
+
}
|
|
2771
2785
|
const reportedTargetIds = statusTargets
|
|
2772
2786
|
.map(target => normalizeProtocolV2TargetId(target.target_id))
|
|
2773
2787
|
.filter((targetId): targetId is number => targetId !== undefined);
|
|
@@ -3139,8 +3153,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
3139
3153
|
const commands = this.device.getCommands();
|
|
3140
3154
|
await commands.typedCall('DeviceFirmwareUpdateStage', 'Success', { targets });
|
|
3141
3155
|
await commands.call('DeviceFirmwareUpdateRequest', {}, { returnAfterWrite: true });
|
|
3142
|
-
this.postTipMessage(FirmwareUpdateTipMessage.
|
|
3143
|
-
this.postProgressMessage(0, 'installingFirmware');
|
|
3156
|
+
this.postTipMessage(FirmwareUpdateTipMessage.ConfirmOnDevice);
|
|
3144
3157
|
}
|
|
3145
3158
|
|
|
3146
3159
|
private async protocolV2Reboot(rebootType: DeviceRebootType) {
|
|
@@ -129,7 +129,7 @@ export default class DeviceUploadNft extends BaseMethod<DeviceUploadNftParams> {
|
|
|
129
129
|
paceMs,
|
|
130
130
|
timeoutMs,
|
|
131
131
|
};
|
|
132
|
-
this.unlockPolicy = '
|
|
132
|
+
this.unlockPolicy = 'unlock-before-run';
|
|
133
133
|
this.skipForceUpdateCheck = true;
|
|
134
134
|
this.useDevicePassphraseState = false;
|
|
135
135
|
}
|
|
@@ -76,7 +76,7 @@ export default class DeviceUploadWallpaper extends BaseMethod<DeviceUploadWallpa
|
|
|
76
76
|
});
|
|
77
77
|
this.path = `${WALLPAPER_DIRECTORY}/${normalizeFileName(fileName, this.encoded.data)}`;
|
|
78
78
|
this.params = { jpegBase64, fileName, chunkSize };
|
|
79
|
-
this.unlockPolicy = '
|
|
79
|
+
this.unlockPolicy = 'unlock-before-run';
|
|
80
80
|
this.skipForceUpdateCheck = true;
|
|
81
81
|
this.useDevicePassphraseState = false;
|
|
82
82
|
}
|
|
@@ -26,7 +26,6 @@ import type {
|
|
|
26
26
|
Features,
|
|
27
27
|
IDeviceBLEFirmwareStatus,
|
|
28
28
|
IDeviceFirmwareStatus,
|
|
29
|
-
IProtocolV2Resources,
|
|
30
29
|
ITransportStatus,
|
|
31
30
|
IVersionArray,
|
|
32
31
|
RemoteConfigResponse,
|
|
@@ -407,6 +406,43 @@ export default class DataManager {
|
|
|
407
406
|
return enrichedData;
|
|
408
407
|
}
|
|
409
408
|
|
|
409
|
+
private static enrichProtocolV2FirmwareReleaseInfo(
|
|
410
|
+
deviceData: DeviceTypeMap[keyof DeviceTypeMap] | undefined,
|
|
411
|
+
deviceName: 'Pro2' | 'Neo',
|
|
412
|
+
onResourcesConfigError: (error: Error) => void
|
|
413
|
+
): NonNullable<DeviceTypeMap[keyof DeviceTypeMap]> {
|
|
414
|
+
const enrichedData = this.enrichFirmwareReleaseInfo(deviceData);
|
|
415
|
+
const { resources: _legacyDeviceResources, ...releaseScopedData } =
|
|
416
|
+
enrichedData as typeof enrichedData & {
|
|
417
|
+
resources?: unknown;
|
|
418
|
+
};
|
|
419
|
+
const releases = releaseScopedData['firmware-v1'];
|
|
420
|
+
if (!Array.isArray(releases)) {
|
|
421
|
+
return releaseScopedData;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
...releaseScopedData,
|
|
426
|
+
'firmware-v1': releases.map(release => {
|
|
427
|
+
const { resources: rawResources, ...releaseWithoutResources } = release;
|
|
428
|
+
try {
|
|
429
|
+
const resources = parseProtocolV2Resources(rawResources);
|
|
430
|
+
return resources
|
|
431
|
+
? {
|
|
432
|
+
...releaseWithoutResources,
|
|
433
|
+
resources,
|
|
434
|
+
}
|
|
435
|
+
: releaseWithoutResources;
|
|
436
|
+
} catch (error) {
|
|
437
|
+
const resourcesError = error instanceof Error ? error : new Error(String(error));
|
|
438
|
+
onResourcesConfigError(resourcesError);
|
|
439
|
+
Log.warn(`[DataConfig] Ignoring invalid ${deviceName} release resources config:`, error);
|
|
440
|
+
return releaseWithoutResources;
|
|
441
|
+
}
|
|
442
|
+
}),
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
410
446
|
static async load(settings: ConnectSettings): Promise<boolean> {
|
|
411
447
|
this.settings = settings;
|
|
412
448
|
this.protocolV2ResourcesConfigError = undefined;
|
|
@@ -471,32 +507,12 @@ export default class DataManager {
|
|
|
471
507
|
}
|
|
472
508
|
|
|
473
509
|
private static applyRemoteConfig(data: RemoteConfigResponse) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
} catch (error) {
|
|
481
|
-
// Firmware resource metadata is not required for base communication. If the
|
|
482
|
-
// remote config is temporarily incomplete, disable this resource update only.
|
|
483
|
-
this.protocolV2ResourcesConfigError =
|
|
484
|
-
error instanceof Error ? error : new Error(String(error));
|
|
485
|
-
Log.warn('[DataConfig] Ignoring invalid Pro2 resources config:', error);
|
|
486
|
-
}
|
|
487
|
-
try {
|
|
488
|
-
neoResources = parseProtocolV2Resources(
|
|
489
|
-
(data.neo as { resources?: unknown } | undefined)?.resources
|
|
490
|
-
);
|
|
491
|
-
} catch (error) {
|
|
492
|
-
this.protocolV2NeoResourcesConfigError =
|
|
493
|
-
error instanceof Error ? error : new Error(String(error));
|
|
494
|
-
Log.warn('[DataConfig] Ignoring invalid Neo resources config:', error);
|
|
495
|
-
}
|
|
496
|
-
const enrichedPro2Config = this.enrichFirmwareReleaseInfo(data.pro2);
|
|
497
|
-
const enrichedNeoConfig = this.enrichFirmwareReleaseInfo(data.neo);
|
|
498
|
-
const { resources: _unvalidatedResources, ...pro2Config } = enrichedPro2Config;
|
|
499
|
-
const { resources: _unvalidatedNeoResources, ...neoConfig } = enrichedNeoConfig;
|
|
510
|
+
const pro2Config = this.enrichProtocolV2FirmwareReleaseInfo(data.pro2, 'Pro2', error => {
|
|
511
|
+
this.protocolV2ResourcesConfigError ??= error;
|
|
512
|
+
});
|
|
513
|
+
const neoConfig = this.enrichProtocolV2FirmwareReleaseInfo(data.neo, 'Neo', error => {
|
|
514
|
+
this.protocolV2NeoResourcesConfigError ??= error;
|
|
515
|
+
});
|
|
500
516
|
this.deviceMap = {
|
|
501
517
|
[EDeviceType.Classic]: this.enrichFirmwareReleaseInfo(data.classic),
|
|
502
518
|
[EDeviceType.Classic1s]: this.enrichFirmwareReleaseInfo(data.classic1s),
|
|
@@ -504,14 +520,8 @@ export default class DataManager {
|
|
|
504
520
|
[EDeviceType.Mini]: this.enrichFirmwareReleaseInfo(data.mini),
|
|
505
521
|
[EDeviceType.Touch]: this.enrichFirmwareReleaseInfo(data.touch),
|
|
506
522
|
[EDeviceType.Pro]: this.enrichFirmwareReleaseInfo(data.pro),
|
|
507
|
-
[EDeviceType.Pro2]:
|
|
508
|
-
|
|
509
|
-
...(pro2Resources ? { resources: pro2Resources } : undefined),
|
|
510
|
-
},
|
|
511
|
-
[EDeviceType.Neo]: {
|
|
512
|
-
...neoConfig,
|
|
513
|
-
...(neoResources ? { resources: neoResources } : undefined),
|
|
514
|
-
},
|
|
523
|
+
[EDeviceType.Pro2]: pro2Config,
|
|
524
|
+
[EDeviceType.Neo]: neoConfig,
|
|
515
525
|
};
|
|
516
526
|
this.assets = {
|
|
517
527
|
bridge: data.bridge,
|
|
@@ -589,10 +599,8 @@ export default class DataManager {
|
|
|
589
599
|
this.lastCheckTimestamp = getTimeStamp();
|
|
590
600
|
}
|
|
591
601
|
|
|
592
|
-
static getProtocolV2ResourceSource(
|
|
593
|
-
|
|
594
|
-
) {
|
|
595
|
-
return this.deviceMap[deviceType]?.resources?.source;
|
|
602
|
+
static getProtocolV2ResourceSource(features: Features, firmwareType: EFirmwareType) {
|
|
603
|
+
return this.getFirmwareLatestRelease(features, firmwareType)?.resources?.source;
|
|
596
604
|
}
|
|
597
605
|
|
|
598
606
|
static getProtobufMessages(schema: ProtobufMessageSchema = 'v1CurrentSchema'): JSON {
|
|
@@ -482,7 +482,7 @@ export class DeviceCommands {
|
|
|
482
482
|
if (message === 'Please confirm the BlindSign enabled') {
|
|
483
483
|
error = ERRORS.TypedError(HardwareErrorCode.BlindSignDisabled);
|
|
484
484
|
}
|
|
485
|
-
if (message === 'File already exists') {
|
|
485
|
+
if (message === 'File already exists' || message === 'NFT already exists') {
|
|
486
486
|
error = ERRORS.TypedError(HardwareErrorCode.FileAlreadyExists);
|
|
487
487
|
}
|
|
488
488
|
if (message?.includes('bytes overflow')) {
|
package/src/types/settings.ts
CHANGED
|
@@ -116,6 +116,8 @@ export type IFirmwareReleaseInfo = {
|
|
|
116
116
|
upgradeType?: 'payload-package-set' | string;
|
|
117
117
|
components?: Record<string, IProtocolV2FirmwareComponent>;
|
|
118
118
|
installOrder?: string[];
|
|
119
|
+
/** Resource archive released together with this Protocol V2 firmware release. */
|
|
120
|
+
resources?: IProtocolV2Resources;
|
|
119
121
|
bootloaderChangelog?: {
|
|
120
122
|
[k in ILocale]: string;
|
|
121
123
|
};
|
|
@@ -152,8 +154,6 @@ type IDeviceReleaseInfo = {
|
|
|
152
154
|
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
153
155
|
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
154
156
|
ble?: IBLEFirmwareReleaseInfo[];
|
|
155
|
-
/** Independent Protocol V2 resource release configuration. */
|
|
156
|
-
resources?: IProtocolV2Resources;
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
export type DeviceTypeMap = {
|