@onekeyfe/hd-core 1.2.0-alpha.85 → 1.2.0-alpha.86
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__/check-all-firmware-release-protocol-v2.test.ts +74 -37
- package/__tests__/check-firmware-release-protocol-v2.test.ts +1 -2
- package/__tests__/firmware-memory-host.test.ts +3 -0
- package/__tests__/firmware-update/device-update-bootloader.test.ts +4 -1
- package/__tests__/firmware-update/firmware-host-binding.test.ts +9 -0
- package/__tests__/protocol-v2-resources.test.ts +59 -1
- package/__tests__/protocol-v2.test.ts +61 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareHostBinding.d.ts +1 -1
- package/dist/api/firmware/FirmwareHostBinding.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareMemoryHost.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +3 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +51 -30
- package/dist/types/api/checkAllFirmwareRelease.d.ts +0 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +1 -0
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/settings.d.ts +3 -4
- package/dist/types/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/CheckAllFirmwareRelease.ts +2 -7
- package/src/api/FirmwareUpdateV4.ts +18 -11
- package/src/api/firmware/FirmwareHostBinding.ts +16 -3
- package/src/api/firmware/FirmwareMemoryHost.ts +4 -1
- package/src/data-manager/DataManager.ts +33 -13
- package/src/types/api/checkAllFirmwareRelease.ts +0 -1
- package/src/types/api/firmwareUpdate.ts +2 -0
- package/src/types/settings.ts +3 -5
|
@@ -319,22 +319,15 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
319
319
|
status: 'required',
|
|
320
320
|
resourceStatus: 'unknown',
|
|
321
321
|
resourceArchive: resourceSource,
|
|
322
|
-
|
|
323
|
-
targetsToUpdate: ['boot', 'app_v1', 'resource'],
|
|
322
|
+
targetsToUpdate: ['boot', 'app_v1'],
|
|
324
323
|
firmwareUpdatePlan: {
|
|
325
324
|
executor: 'v4',
|
|
326
325
|
platform: 'web',
|
|
327
326
|
artifacts: [
|
|
328
327
|
{ artifactId: 'component:boot', target: 'boot' },
|
|
329
328
|
{ artifactId: 'component:app_v1', target: 'app_v1' },
|
|
330
|
-
{
|
|
331
|
-
artifactId: 'resource:archive',
|
|
332
|
-
target: 'resource',
|
|
333
|
-
role: 'resourceBundle',
|
|
334
|
-
container: 'zip',
|
|
335
|
-
},
|
|
336
329
|
],
|
|
337
|
-
targetsToUpdate: ['boot', 'app_v1'
|
|
330
|
+
targetsToUpdate: ['boot', 'app_v1'],
|
|
338
331
|
},
|
|
339
332
|
firmware: {
|
|
340
333
|
status: 'required',
|
|
@@ -375,7 +368,7 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
375
368
|
jest.spyOn(DataManager, 'getProtocolV2ResourceSource').mockReturnValue(resourceSource);
|
|
376
369
|
|
|
377
370
|
await expect(method.run()).resolves.toMatchObject({
|
|
378
|
-
targetsToUpdate: ['boot', 'app_v1', 'se02', 'se03'
|
|
371
|
+
targetsToUpdate: ['boot', 'app_v1', 'se02', 'se03'],
|
|
379
372
|
firmwareUpdatePlan: {
|
|
380
373
|
executor: 'v4',
|
|
381
374
|
deviceIdentity: 'pro2-device-id',
|
|
@@ -385,9 +378,8 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
385
378
|
{ artifactId: 'component:app_v1', target: 'app_v1' },
|
|
386
379
|
{ artifactId: 'component:se02', target: 'se02' },
|
|
387
380
|
{ artifactId: 'component:se03', target: 'se03' },
|
|
388
|
-
{ artifactId: 'resource:archive', target: 'resource', container: 'zip' },
|
|
389
381
|
],
|
|
390
|
-
targetsToUpdate: ['boot', 'app_v1', 'se02', 'se03'
|
|
382
|
+
targetsToUpdate: ['boot', 'app_v1', 'se02', 'se03'],
|
|
391
383
|
},
|
|
392
384
|
});
|
|
393
385
|
});
|
|
@@ -437,16 +429,15 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
437
429
|
jest.spyOn(DataManager, 'getProtocolV2ResourceSource').mockReturnValue(resourceSource);
|
|
438
430
|
|
|
439
431
|
await expect(method.run()).resolves.toMatchObject({
|
|
440
|
-
targetsToUpdate: ['app_v1', 'coprocessor'
|
|
432
|
+
targetsToUpdate: ['app_v1', 'coprocessor'],
|
|
441
433
|
firmwareUpdatePlan: {
|
|
442
434
|
executor: 'v4',
|
|
443
435
|
platform: 'desktop',
|
|
444
436
|
artifacts: [
|
|
445
437
|
{ artifactId: 'component:app_v1', target: 'app_v1' },
|
|
446
438
|
{ artifactId: 'component:coprocessor', target: 'coprocessor' },
|
|
447
|
-
{ artifactId: 'resource:archive', target: 'resource', container: 'zip' },
|
|
448
439
|
],
|
|
449
|
-
targetsToUpdate: ['app_v1', 'coprocessor'
|
|
440
|
+
targetsToUpdate: ['app_v1', 'coprocessor'],
|
|
450
441
|
},
|
|
451
442
|
});
|
|
452
443
|
});
|
|
@@ -487,7 +478,7 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
487
478
|
jest.spyOn(DataManager, 'getProtocolV2ResourceSource').mockReturnValue(resourceSource);
|
|
488
479
|
|
|
489
480
|
await expect(method.run()).resolves.toMatchObject({
|
|
490
|
-
targetsToUpdate: ['app_v1'
|
|
481
|
+
targetsToUpdate: ['app_v1'],
|
|
491
482
|
firmwareUpdatePlan: undefined,
|
|
492
483
|
});
|
|
493
484
|
});
|
|
@@ -567,12 +558,12 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
567
558
|
jest.spyOn(DataManager, 'getProtocolV2ResourceSource').mockReturnValue(resourceSource);
|
|
568
559
|
|
|
569
560
|
await expect(method.run()).resolves.toMatchObject({
|
|
570
|
-
targetsToUpdate: ['se01', 'se02'
|
|
561
|
+
targetsToUpdate: ['se01', 'se02'],
|
|
571
562
|
firmwareUpdatePlan: {
|
|
572
563
|
executor: 'v4',
|
|
573
564
|
deviceModel: 'neo',
|
|
574
565
|
platform: 'native',
|
|
575
|
-
targetsToUpdate: ['se01', 'se02'
|
|
566
|
+
targetsToUpdate: ['se01', 'se02'],
|
|
576
567
|
},
|
|
577
568
|
});
|
|
578
569
|
});
|
|
@@ -603,6 +594,64 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
603
594
|
});
|
|
604
595
|
});
|
|
605
596
|
|
|
597
|
+
test('adds a Protocol V2 resource target only when explicitly forced', async () => {
|
|
598
|
+
const currentRelease: IFirmwareReleaseInfo = {
|
|
599
|
+
...release,
|
|
600
|
+
required: false,
|
|
601
|
+
installOrder: ['applicationP1'],
|
|
602
|
+
components: {
|
|
603
|
+
applicationP1: {
|
|
604
|
+
target: 'APPLICATION_P1',
|
|
605
|
+
url: 'https://example.com/application-p1.okpkg',
|
|
606
|
+
version: [1, 0, 0],
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
};
|
|
610
|
+
const method = new CheckAllFirmwareRelease({
|
|
611
|
+
id: 1,
|
|
612
|
+
payload: {
|
|
613
|
+
method: 'checkAllFirmwareRelease',
|
|
614
|
+
platform: 'desktop',
|
|
615
|
+
protocolV2ForceUpdateTargets: ['resource'],
|
|
616
|
+
},
|
|
617
|
+
});
|
|
618
|
+
method.init();
|
|
619
|
+
method.device = {
|
|
620
|
+
isProtocolV2: () => true,
|
|
621
|
+
features: {
|
|
622
|
+
deviceType: 'pro2',
|
|
623
|
+
serialNo: 'pro2-device-id',
|
|
624
|
+
firmwareVersion: '1.0.0',
|
|
625
|
+
},
|
|
626
|
+
getDeviceState: jest.fn().mockResolvedValue({
|
|
627
|
+
identity: { deviceType: 'pro2', firmwareType: EFirmwareType.Universal },
|
|
628
|
+
status: { mode: 'normal' },
|
|
629
|
+
versions: { ...currentVersions, applicationP1: '1.0.0' },
|
|
630
|
+
}),
|
|
631
|
+
} as unknown as CheckAllFirmwareRelease['device'];
|
|
632
|
+
jest.spyOn(DataManager, 'getFirmwareLatestRelease').mockReturnValue(currentRelease);
|
|
633
|
+
jest.spyOn(DataManager, 'getProtocolV2ResourceSource').mockReturnValue(resourceSource);
|
|
634
|
+
|
|
635
|
+
await expect(method.run()).resolves.toMatchObject({
|
|
636
|
+
status: 'valid',
|
|
637
|
+
hasUpgrade: true,
|
|
638
|
+
targetsToUpdate: ['resource'],
|
|
639
|
+
firmwareUpdatePlan: {
|
|
640
|
+
executor: 'v4',
|
|
641
|
+
platform: 'desktop',
|
|
642
|
+
artifacts: [
|
|
643
|
+
{
|
|
644
|
+
artifactId: 'resource:archive',
|
|
645
|
+
target: 'resource',
|
|
646
|
+
role: 'resourceBundle',
|
|
647
|
+
container: 'zip',
|
|
648
|
+
},
|
|
649
|
+
],
|
|
650
|
+
targetsToUpdate: ['resource'],
|
|
651
|
+
},
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
|
|
606
655
|
test('requests and compares firmware hashes only when explicitly enabled', async () => {
|
|
607
656
|
const packageSet: IFirmwareReleaseInfo = {
|
|
608
657
|
...release,
|
|
@@ -679,14 +728,13 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
679
728
|
protocol: 'V2',
|
|
680
729
|
resourceStatus: 'unknown',
|
|
681
730
|
resourceArchive: resourceSource,
|
|
682
|
-
|
|
683
|
-
targetsToUpdate: ['boot', 'app_v1', 'resource'],
|
|
731
|
+
targetsToUpdate: ['boot', 'app_v1'],
|
|
684
732
|
});
|
|
685
733
|
expect(typedCall).not.toHaveBeenCalled();
|
|
686
734
|
}
|
|
687
735
|
);
|
|
688
736
|
|
|
689
|
-
test('
|
|
737
|
+
test('exposes resource archive availability without reporting an unconfirmed update', async () => {
|
|
690
738
|
const currentRelease: IFirmwareReleaseInfo = {
|
|
691
739
|
...release,
|
|
692
740
|
required: false,
|
|
@@ -720,23 +768,12 @@ describe('checkAllFirmwareRelease Protocol V2 support', () => {
|
|
|
720
768
|
jest.spyOn(DataManager, 'getProtocolV2ResourceSource').mockReturnValue(resourceSource);
|
|
721
769
|
|
|
722
770
|
await expect(method.run()).resolves.toMatchObject({
|
|
723
|
-
status: '
|
|
724
|
-
hasUpgrade:
|
|
771
|
+
status: 'valid',
|
|
772
|
+
hasUpgrade: false,
|
|
725
773
|
resourceStatus: 'unknown',
|
|
726
|
-
|
|
727
|
-
targetsToUpdate: [
|
|
728
|
-
firmwareUpdatePlan:
|
|
729
|
-
executor: 'v4',
|
|
730
|
-
artifacts: [
|
|
731
|
-
{
|
|
732
|
-
artifactId: 'resource:archive',
|
|
733
|
-
target: 'resource',
|
|
734
|
-
role: 'resourceBundle',
|
|
735
|
-
container: 'zip',
|
|
736
|
-
},
|
|
737
|
-
],
|
|
738
|
-
targetsToUpdate: ['resource'],
|
|
739
|
-
},
|
|
774
|
+
resourceArchive: resourceSource,
|
|
775
|
+
targetsToUpdate: [],
|
|
776
|
+
firmwareUpdatePlan: undefined,
|
|
740
777
|
});
|
|
741
778
|
});
|
|
742
779
|
|
|
@@ -147,8 +147,7 @@ describe.each(['pro2', 'neo'] as const)('Protocol V2 release checks for %s', dev
|
|
|
147
147
|
deviceType,
|
|
148
148
|
status: 'outdated',
|
|
149
149
|
hasUpgrade: true,
|
|
150
|
-
|
|
151
|
-
targetsToUpdate: ['boot', 'app_v1', 'coprocessor', 'resource'],
|
|
150
|
+
targetsToUpdate: ['boot', 'app_v1', 'coprocessor'],
|
|
152
151
|
firmware: { status: 'outdated', shouldUpdate: true },
|
|
153
152
|
ble: {
|
|
154
153
|
status: 'outdated',
|
|
@@ -87,6 +87,9 @@ describe('prepareFirmwareUpdateV4MemoryHost', () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
expect(host.hostBindingGeneration).toBe(7);
|
|
90
|
+
expect(sdk.registerFirmwareUpdateHostBinding).toHaveBeenCalledWith(
|
|
91
|
+
expect.objectContaining({ preparedPlanDigest: host.preparedPlan.preparedPlanDigest })
|
|
92
|
+
);
|
|
90
93
|
expect(host.componentArtifacts.boot?.size).toBe(componentBinary.byteLength);
|
|
91
94
|
const opened = await artifactReader!.open({
|
|
92
95
|
artifactRef: host.componentArtifacts.boot!.artifactRef,
|
|
@@ -36,7 +36,10 @@ const createMethod = () => {
|
|
|
36
36
|
read: jest.fn(),
|
|
37
37
|
close,
|
|
38
38
|
};
|
|
39
|
-
const hostBindingGeneration = registerFirmwareUpdateHostBinding({
|
|
39
|
+
const hostBindingGeneration = registerFirmwareUpdateHostBinding({
|
|
40
|
+
artifactReader,
|
|
41
|
+
preparedPlanDigest: 'a'.repeat(64),
|
|
42
|
+
});
|
|
40
43
|
const method = new DeviceUpdateBootloader({
|
|
41
44
|
id: 1,
|
|
42
45
|
payload: {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from '../../src/api/firmware/FirmwareHostBinding';
|
|
7
7
|
|
|
8
8
|
const createBinding = () => ({
|
|
9
|
+
preparedPlanDigest: 'a'.repeat(64),
|
|
9
10
|
artifactReader: {
|
|
10
11
|
open: jest.fn(() => Promise.resolve({ readerId: 'reader-1', size: 4 })),
|
|
11
12
|
read: jest.fn(() =>
|
|
@@ -67,4 +68,12 @@ describe('firmware host binding generation', () => {
|
|
|
67
68
|
readerId: 'stale-reader',
|
|
68
69
|
});
|
|
69
70
|
});
|
|
71
|
+
|
|
72
|
+
test('rejects a prepared plan from another host generation before opening artifacts', () => {
|
|
73
|
+
const generation = registerFirmwareUpdateHostBinding(createBinding());
|
|
74
|
+
|
|
75
|
+
expect(() => resolveFirmwareUpdateHostBinding(generation, 'b'.repeat(64))).toThrow(
|
|
76
|
+
'does not match the prepared plan'
|
|
77
|
+
);
|
|
78
|
+
});
|
|
70
79
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { sha256 } from '@noble/hashes/sha256';
|
|
3
|
-
import { HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
|
+
import { EDeviceType, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
4
4
|
|
|
5
5
|
import { DataManager } from '../src/data-manager';
|
|
6
6
|
import {
|
|
@@ -25,6 +25,12 @@ const resourceSource = {
|
|
|
25
25
|
archiveSize: 16_815_479,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
const neoResourceSource = {
|
|
29
|
+
archiveUrl: 'https://example.com/resource/neo-resource.zip',
|
|
30
|
+
archiveSha256: 'b'.repeat(64),
|
|
31
|
+
archiveSize: 12_345_678,
|
|
32
|
+
};
|
|
33
|
+
|
|
28
34
|
const manifestFiles = [
|
|
29
35
|
['bundles/firmware_logo-build.okpkg', 'firmware_logo.okpkg', 'vol0:/bundles/firmware_logo.okpkg'],
|
|
30
36
|
['bundles/font/noto-build.okpkg', 'noto.okpkg', 'vol0:/bundles/font/noto.okpkg'],
|
|
@@ -103,6 +109,7 @@ const createRemoteConfig = (): RemoteConfigResponse =>
|
|
|
103
109
|
touch: { firmware: [], ble: [] },
|
|
104
110
|
pro: { firmware: [], ble: [] },
|
|
105
111
|
pro2: { firmware: [], ble: [], resources: { source: resourceSource } },
|
|
112
|
+
neo: { firmware: [], ble: [], resources: { source: neoResourceSource } },
|
|
106
113
|
bridge: {},
|
|
107
114
|
} as unknown as RemoteConfigResponse);
|
|
108
115
|
|
|
@@ -179,6 +186,34 @@ describe('Pro2 resource configuration', () => {
|
|
|
179
186
|
await expect(DataManager.load(createSettings(configFetcher))).resolves.toBe(true);
|
|
180
187
|
|
|
181
188
|
expect(DataManager.getProtocolV2ResourceSource()).toBeUndefined();
|
|
189
|
+
expect(DataManager.protocolV2ResourcesConfigError).toBeInstanceOf(Error);
|
|
190
|
+
expect(DataManager.getProtocolV2ResourceSource(EDeviceType.Neo)).toEqual(neoResourceSource);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
test('keeps Pro2 resources available when remote Neo resources are invalid', async () => {
|
|
194
|
+
const remoteConfig = createRemoteConfig();
|
|
195
|
+
(remoteConfig.neo as { resources?: unknown }).resources = { source: {} };
|
|
196
|
+
const configFetcher = jest.fn().mockResolvedValue(remoteConfig);
|
|
197
|
+
|
|
198
|
+
await expect(DataManager.load(createSettings(configFetcher))).resolves.toBe(true);
|
|
199
|
+
|
|
200
|
+
expect(DataManager.getProtocolV2ResourceSource(EDeviceType.Pro2)).toEqual(resourceSource);
|
|
201
|
+
expect(DataManager.getProtocolV2ResourceSource(EDeviceType.Neo)).toBeUndefined();
|
|
202
|
+
await expect(
|
|
203
|
+
DataManager.forceReloadData({
|
|
204
|
+
requireResources: true,
|
|
205
|
+
resourceDeviceType: EDeviceType.Pro2,
|
|
206
|
+
})
|
|
207
|
+
).resolves.toBeUndefined();
|
|
208
|
+
await expect(
|
|
209
|
+
DataManager.forceReloadData({
|
|
210
|
+
requireResources: true,
|
|
211
|
+
resourceDeviceType: EDeviceType.Neo,
|
|
212
|
+
})
|
|
213
|
+
).rejects.toMatchObject({
|
|
214
|
+
errorCode: HardwareErrorCode.FirmwareUpdateDownloadFailed,
|
|
215
|
+
message: expect.stringContaining('Invalid Neo resources config'),
|
|
216
|
+
});
|
|
182
217
|
});
|
|
183
218
|
|
|
184
219
|
test('only blocks resource mutation when the refreshed Pro2 resources are invalid', async () => {
|
|
@@ -195,6 +230,29 @@ describe('Pro2 resource configuration', () => {
|
|
|
195
230
|
expect(DataManager.lastCheckTimestamp).toBeGreaterThan(0);
|
|
196
231
|
});
|
|
197
232
|
|
|
233
|
+
test('checks resource configuration errors for the requested device only', async () => {
|
|
234
|
+
const remoteConfig = createRemoteConfig();
|
|
235
|
+
(remoteConfig.pro2 as { resources?: unknown }).resources = { source: {} };
|
|
236
|
+
const settings = createSettings(jest.fn().mockResolvedValue(remoteConfig));
|
|
237
|
+
DataManager.settings = settings;
|
|
238
|
+
|
|
239
|
+
await expect(
|
|
240
|
+
DataManager.forceReloadData({
|
|
241
|
+
requireResources: true,
|
|
242
|
+
resourceDeviceType: EDeviceType.Neo,
|
|
243
|
+
})
|
|
244
|
+
).resolves.toBeUndefined();
|
|
245
|
+
await expect(
|
|
246
|
+
DataManager.forceReloadData({
|
|
247
|
+
requireResources: true,
|
|
248
|
+
resourceDeviceType: EDeviceType.Pro2,
|
|
249
|
+
})
|
|
250
|
+
).rejects.toMatchObject({
|
|
251
|
+
errorCode: HardwareErrorCode.FirmwareUpdateDownloadFailed,
|
|
252
|
+
message: expect.stringContaining('Invalid Pro2 resources config'),
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
|
|
198
256
|
test('does not advance the cache timestamp when refresh fails', async () => {
|
|
199
257
|
jest.spyOn(axios, 'get').mockRejectedValue(new Error('offline'));
|
|
200
258
|
const settings = createSettings(jest.fn().mockResolvedValue(null));
|
|
@@ -6231,7 +6231,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
6231
6231
|
await Promise.all(sources.map(source => source.source.close()));
|
|
6232
6232
|
});
|
|
6233
6233
|
|
|
6234
|
-
test('
|
|
6234
|
+
test('binds a prepared resource archive to the selected host generation', () => {
|
|
6235
6235
|
const planWithoutDigest = {
|
|
6236
6236
|
schemaVersion: 2 as const,
|
|
6237
6237
|
executor: 'v4' as const,
|
|
@@ -6279,7 +6279,32 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
6279
6279
|
},
|
|
6280
6280
|
],
|
|
6281
6281
|
});
|
|
6282
|
+
const mismatchedHostBindingGeneration = registerFirmwareUpdateHostBinding({
|
|
6283
|
+
preparedPlanDigest: 'c'.repeat(64),
|
|
6284
|
+
artifactReader: {
|
|
6285
|
+
open: jest.fn(),
|
|
6286
|
+
read: jest.fn(),
|
|
6287
|
+
close: jest.fn(),
|
|
6288
|
+
},
|
|
6289
|
+
});
|
|
6290
|
+
try {
|
|
6291
|
+
const mismatchedMethod = new FirmwareUpdateV4({
|
|
6292
|
+
id: 1,
|
|
6293
|
+
payload: {
|
|
6294
|
+
method: 'firmwareUpdateV4',
|
|
6295
|
+
platform: 'web',
|
|
6296
|
+
targetsToUpdate: ['resource'],
|
|
6297
|
+
preparedPlan,
|
|
6298
|
+
hostBindingGeneration: mismatchedHostBindingGeneration,
|
|
6299
|
+
},
|
|
6300
|
+
});
|
|
6301
|
+
|
|
6302
|
+
expect(() => mismatchedMethod.init()).toThrow('does not match the prepared plan');
|
|
6303
|
+
} finally {
|
|
6304
|
+
unregisterFirmwareUpdateHostBinding(mismatchedHostBindingGeneration);
|
|
6305
|
+
}
|
|
6282
6306
|
const hostBindingGeneration = registerFirmwareUpdateHostBinding({
|
|
6307
|
+
preparedPlanDigest: preparedPlan.preparedPlanDigest,
|
|
6283
6308
|
artifactReader: {
|
|
6284
6309
|
open: jest.fn(),
|
|
6285
6310
|
read: jest.fn(),
|
|
@@ -7322,6 +7347,41 @@ describe('Protocol V2 firmware reconnect identity', () => {
|
|
|
7322
7347
|
});
|
|
7323
7348
|
expect((method as any).protocolV2SourceUpdateProcess).not.toHaveBeenCalled();
|
|
7324
7349
|
});
|
|
7350
|
+
|
|
7351
|
+
test('updates a resource when the installed file size differs despite matching headers', async () => {
|
|
7352
|
+
const method = new FirmwareUpdateV4({
|
|
7353
|
+
id: 1,
|
|
7354
|
+
payload: {
|
|
7355
|
+
method: 'firmwareUpdateV4',
|
|
7356
|
+
platform: 'web',
|
|
7357
|
+
},
|
|
7358
|
+
});
|
|
7359
|
+
method.init();
|
|
7360
|
+
const installedBinary = new Uint8Array(createProtocolV2OkppBinary());
|
|
7361
|
+
const typedCall = jest.fn((requestType: string) => {
|
|
7362
|
+
if (requestType === 'FilesystemPathInfoQuery') {
|
|
7363
|
+
return Promise.resolve({
|
|
7364
|
+
message: { exist: true, directory: false, size: installedBinary.byteLength + 1 },
|
|
7365
|
+
});
|
|
7366
|
+
}
|
|
7367
|
+
throw new Error(`Unexpected request: ${requestType}`);
|
|
7368
|
+
});
|
|
7369
|
+
(method as any).device = stubDevice({
|
|
7370
|
+
getCommands: () => ({ typedCall }),
|
|
7371
|
+
});
|
|
7372
|
+
|
|
7373
|
+
await expect(
|
|
7374
|
+
(method as any).isProtocolV2ResourceBundleUpToDate({
|
|
7375
|
+
name: 'images.okpkg',
|
|
7376
|
+
source: { size: installedBinary.byteLength },
|
|
7377
|
+
devicePath: 'vol0:/bundles/images/images.okpkg',
|
|
7378
|
+
version: [1, 2, 3],
|
|
7379
|
+
payloadHash: '11'.repeat(64),
|
|
7380
|
+
headerHash: '22'.repeat(64),
|
|
7381
|
+
})
|
|
7382
|
+
).resolves.toBe(false);
|
|
7383
|
+
expect(typedCall).toHaveBeenCalledTimes(1);
|
|
7384
|
+
});
|
|
7325
7385
|
});
|
|
7326
7386
|
|
|
7327
7387
|
describe('Protocol V2 explicit USB device selection', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckAllFirmwareRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckAllFirmwareRelease.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAiC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EACV,kBAAkB,EAElB,kCAAkC,EAClC,+BAA+B,EAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EAGrB,MAAM,UAAU,CAAC;AAgIlB,MAAM,MAAM,6BAA6B,GAAG;IAC1C,YAAY,EAAE,aAAa,CAAC;IAC5B,MAAM,EAAE,+BAA+B,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,mBAAmB,CAAC;IACrC,UAAU,EAAE,kCAAkC,EAAE,CAAC;I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axC,OAAO,CAAC,4BAA4B;IAyGpC,OAAO,CAAC,6BAA6B;YAcvB,uCAAuC;YA0JvC,gCAAgC;YAehC,yBAAyB;YAQzB,8BAA8B;IAQ5C,OAAO,CAAC,0BAA0B;YAkBpB,mCAAmC;YAWnC,qCAAqC;YAgDrC,yBAAyB;YA8DzB,8BAA8B;IAU5C,OAAO,CAAC,kCAAkC;YAQ5B,cAAc;YAuCd,6BAA6B;YAW7B,0BAA0B;YAS1B,6BAA6B;YAmB7B,gBAAgB;IAiB9B,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -2,5 +2,5 @@ import type { FirmwareUpdateHostBinding } from '../../types/api/firmwareUpdate';
|
|
|
2
2
|
export declare const registerFirmwareUpdateHostBinding: (binding: FirmwareUpdateHostBinding) => number;
|
|
3
3
|
export declare const unregisterFirmwareUpdateHostBinding: (generation?: number) => boolean;
|
|
4
4
|
export declare const getFirmwareUpdateHostBindingGeneration: () => number;
|
|
5
|
-
export declare const resolveFirmwareUpdateHostBinding: (generation: number | undefined) => FirmwareUpdateHostBinding;
|
|
5
|
+
export declare const resolveFirmwareUpdateHostBinding: (generation: number | undefined, preparedPlanDigest?: string) => FirmwareUpdateHostBinding;
|
|
6
6
|
//# sourceMappingURL=FirmwareHostBinding.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareHostBinding.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/FirmwareHostBinding.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"FirmwareHostBinding.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/FirmwareHostBinding.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAiGhF,eAAO,MAAM,iCAAiC,YAAa,yBAAyB,KAAG,MACxC,CAAC;AAEhD,eAAO,MAAM,mCAAm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BF,wBAAgB,iCAAiC,CAAC,EAChD,GAAG,EACH,IAAI,EACJ,SAAS,GACV,EAAE;IACD,GAAG,EAAE,IAAI,CACP,OAAO,EACL,2BAA2B,GAC3B,mCAAmC,GACnC,qCAAqC,CACxC,CAAC;IACF,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC,GAAG,0BAA0B,CAkG7B"}
|
|
@@ -15,6 +15,7 @@ export default class DataManager {
|
|
|
15
15
|
};
|
|
16
16
|
static lastCheckTimestamp: number;
|
|
17
17
|
static protocolV2ResourcesConfigError: Error | undefined;
|
|
18
|
+
private static protocolV2NeoResourcesConfigError;
|
|
18
19
|
static getFirmwareStatus: (features: Features, firmwareType: EFirmwareType) => IDeviceFirmwareStatus;
|
|
19
20
|
static getSysResourcesLatestRelease: ({ features, forcedUpdateRes, firmwareType, }: {
|
|
20
21
|
features: Features;
|
|
@@ -46,8 +47,9 @@ export default class DataManager {
|
|
|
46
47
|
private static applyRemoteConfig;
|
|
47
48
|
static updateEnv(newEnv: ConnectSettings['env']): void;
|
|
48
49
|
static checkAndReloadData(): Promise<void>;
|
|
49
|
-
static forceReloadData({ requireResources, }?: {
|
|
50
|
+
static forceReloadData({ requireResources, resourceDeviceType, }?: {
|
|
50
51
|
requireResources?: boolean;
|
|
52
|
+
resourceDeviceType?: EDeviceType.Pro2 | EDeviceType.Neo;
|
|
51
53
|
}): Promise<void>;
|
|
52
54
|
static getProtocolV2ResourceSource(deviceType?: EDeviceType.Pro2 | EDeviceType.Neo): import("../types").IProtocolV2ResourceSource | undefined;
|
|
53
55
|
static getProtobufMessages(schema?: ProtobufMessageSchema): JSON;
|
|
@@ -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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AM,CAAC,yBAAyB;WA4C3B,IAAI,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC;IA+D9D,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAiDhC,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,CAChC,UAAU,GAAE,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,GAAsB;IAKnE,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
|
@@ -300,20 +300,19 @@ type IBLEFirmwareReleaseInfo = {
|
|
|
300
300
|
};
|
|
301
301
|
};
|
|
302
302
|
type IKnownDevice = Exclude<IDeviceType, 'unknown'>;
|
|
303
|
-
type ILegacyKnownDevice = Exclude<IKnownDevice, 'neo'>;
|
|
304
303
|
type IDeviceReleaseInfo = {
|
|
305
|
-
firmware
|
|
304
|
+
firmware?: IFirmwareReleaseInfo[];
|
|
306
305
|
/** Protocol V2 payload package set */
|
|
307
306
|
'firmware-v1'?: IFirmwareReleaseInfo[];
|
|
308
307
|
'firmware-v2'?: IFirmwareReleaseInfo[];
|
|
309
308
|
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
310
309
|
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
311
|
-
ble
|
|
310
|
+
ble?: IBLEFirmwareReleaseInfo[];
|
|
312
311
|
/** Independent Protocol V2 resource release configuration. */
|
|
313
312
|
resources?: IProtocolV2Resources;
|
|
314
313
|
};
|
|
315
314
|
type DeviceTypeMap = {
|
|
316
|
-
[k in
|
|
315
|
+
[k in Exclude<IKnownDevice, 'neo'>]: IDeviceReleaseInfo;
|
|
317
316
|
} & {
|
|
318
317
|
/** Optional until every remote-config producer publishes a Neo entry. */
|
|
319
318
|
neo?: IDeviceReleaseInfo;
|
|
@@ -1340,6 +1339,8 @@ interface FirmwareArtifactReader {
|
|
|
1340
1339
|
}
|
|
1341
1340
|
interface FirmwareUpdateHostBinding {
|
|
1342
1341
|
artifactReader: FirmwareArtifactReader;
|
|
1342
|
+
/** 将读取器 generation 绑定到包含 ZIP 条目的完整 PreparedPlan。 */
|
|
1343
|
+
preparedPlanDigest: string;
|
|
1343
1344
|
}
|
|
1344
1345
|
interface FirmwareUpdateBinaryParams {
|
|
1345
1346
|
binary: ArrayBuffer;
|
|
@@ -1495,7 +1496,6 @@ type AllFirmwareRelease = {
|
|
|
1495
1496
|
required?: boolean;
|
|
1496
1497
|
resourceStatus?: 'valid' | 'outdated' | 'unknown';
|
|
1497
1498
|
resourceArchive?: IProtocolV2ResourceSource;
|
|
1498
|
-
resourcePreparationRequired?: boolean;
|
|
1499
1499
|
currentVersions?: DeviceStateVersions;
|
|
1500
1500
|
components?: ProtocolV2FirmwareComponentRelease[];
|
|
1501
1501
|
targetsToUpdate?: FirmwareUpdateV4Target[];
|
|
@@ -4699,6 +4699,7 @@ declare class DataManager {
|
|
|
4699
4699
|
};
|
|
4700
4700
|
static lastCheckTimestamp: number;
|
|
4701
4701
|
static protocolV2ResourcesConfigError: Error | undefined;
|
|
4702
|
+
private static protocolV2NeoResourcesConfigError;
|
|
4702
4703
|
static getFirmwareStatus: (features: Features, firmwareType: EFirmwareType) => IDeviceFirmwareStatus;
|
|
4703
4704
|
/**
|
|
4704
4705
|
* Touch、Pro System UI Resource Update
|
|
@@ -4739,8 +4740,9 @@ declare class DataManager {
|
|
|
4739
4740
|
static updateEnv(newEnv: ConnectSettings['env']): void;
|
|
4740
4741
|
static checkAndReloadData(): Promise<void>;
|
|
4741
4742
|
/** Force a fresh remote config before an update is allowed to mutate the device. */
|
|
4742
|
-
static forceReloadData({ requireResources, }?: {
|
|
4743
|
+
static forceReloadData({ requireResources, resourceDeviceType, }?: {
|
|
4743
4744
|
requireResources?: boolean;
|
|
4745
|
+
resourceDeviceType?: EDeviceType.Pro2 | EDeviceType.Neo;
|
|
4744
4746
|
}): Promise<void>;
|
|
4745
4747
|
static getProtocolV2ResourceSource(deviceType?: EDeviceType.Pro2 | EDeviceType.Neo): IProtocolV2ResourceSource | undefined;
|
|
4746
4748
|
static getProtobufMessages(schema?: ProtobufMessageSchema): JSON;
|