@onekeyfe/hd-core 1.2.0-alpha.162 → 1.2.0-alpha.164
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__/device-state-events.test.ts +2 -2
- package/__tests__/device-state-mapper.test.ts +2 -11
- package/__tests__/device-utils.test.ts +0 -6
- package/__tests__/firmware-memory-host.test.ts +126 -0
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +3 -13
- package/__tests__/protocol-v2-resources.test.ts +2 -35
- package/__tests__/protocol-v2.test.ts +42 -89
- package/__tests__/search-devices.test.ts +3 -4
- package/dist/api/FirmwareUpdateV4.d.ts +1 -3
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareMemoryHost.d.ts +22 -0
- package/dist/api/firmware/FirmwareMemoryHost.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts +15 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
- package/dist/index.d.ts +22 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +298 -102
- package/dist/protocols/protocol-v2/resources.d.ts +0 -1
- package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +179 -75
- package/src/api/SearchDevices.ts +2 -2
- package/src/api/firmware/FirmwareMemoryHost.ts +143 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +41 -0
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +6 -10
- package/src/core/index.ts +97 -6
- package/src/device/Device.ts +1 -3
- package/src/device/DeviceStateMapper.ts +2 -2
- package/src/deviceProfile/buildDeviceFeatures.ts +2 -7
- package/src/index.ts +6 -0
- package/src/protocols/protocol-v2/resources.ts +12 -16
- package/src/types/api/firmwareUpdate.ts +1 -1
- package/src/utils/deviceFeaturesCompat.ts +4 -9
- package/src/utils/deviceInfoUtils.ts +1 -3
|
@@ -88,9 +88,9 @@ describe('Device state events', () => {
|
|
|
88
88
|
expect(device.getCurrentDeviceType()).toBe(EDeviceType.Pro2);
|
|
89
89
|
expect(device.getCurrentDeviceId()).toBe('wallet-id');
|
|
90
90
|
expect(device.getCurrentSerialNo()).toBe('SERIAL-PRO2');
|
|
91
|
-
expect(device.getCurrentBleName()).toBe('
|
|
91
|
+
expect(device.getCurrentBleName()).toBe('Pro2 1234');
|
|
92
92
|
expect(device.getCurrentLabel()).toBeNull();
|
|
93
|
-
expect((device as any).getCurrentDisplayName()).toBe('
|
|
93
|
+
expect((device as any).getCurrentDisplayName()).toBe('Pro2 1234');
|
|
94
94
|
expect(device.getCurrentPassphraseProtection()).toBe(false);
|
|
95
95
|
expect(device.getCurrentFirmwareVersionString()).toBe('5.1.2');
|
|
96
96
|
expect(device.getCurrentBLEFirmwareVersionString()).toBe('0.0.0');
|
|
@@ -136,7 +136,7 @@ describe('DeviceStateMapper', () => {
|
|
|
136
136
|
expect(patch.identity).toMatchObject({
|
|
137
137
|
deviceType: EDeviceType.Pro2,
|
|
138
138
|
serialNo: 'SERIAL-1',
|
|
139
|
-
bleName: '
|
|
139
|
+
bleName: 'Pro2 1234',
|
|
140
140
|
});
|
|
141
141
|
expect(patch.versions).toMatchObject({
|
|
142
142
|
firmware: '5.0.0',
|
|
@@ -178,16 +178,7 @@ describe('DeviceStateMapper', () => {
|
|
|
178
178
|
coprocessor: { bt_adv_name: 'Pro2 22D8 - Fin' },
|
|
179
179
|
});
|
|
180
180
|
|
|
181
|
-
expect(patch.identity?.bleName).toBe('
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
test('canonicalizes a spaced Pro2 advertisement name from DeviceInfo', () => {
|
|
185
|
-
const patch = mapProtocolV2DeviceInfoToState({
|
|
186
|
-
hw: { Device_type: DeviceType.PRO2, serial_no: 'SERIAL-1' },
|
|
187
|
-
coprocessor: { bt_adv_name: 'Pro 2 0088 - Find My' },
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
expect(patch.identity?.bleName).toBe('Pro 2 0088');
|
|
181
|
+
expect(patch.identity?.bleName).toBe('Pro2 22D8');
|
|
191
182
|
});
|
|
192
183
|
|
|
193
184
|
test('maps the hardware model independently from Protocol V2', () => {
|
|
@@ -131,12 +131,6 @@ describe('device feature selectors', () => {
|
|
|
131
131
|
expect(getDeviceTypeByBleName('Pro2 A1B2')).toBe(EDeviceType.Pro2);
|
|
132
132
|
expect(getDeviceTypeByBleName('Pro2A1B2')).toBe(EDeviceType.Pro2);
|
|
133
133
|
expect(getDeviceTypeByBleName('OneKeyPro2A1B2')).toBe(EDeviceType.Pro2);
|
|
134
|
-
expect(getDeviceTypeByBleName('Pro 2 A1B2')).toBe(EDeviceType.Pro2);
|
|
135
|
-
expect(getDeviceTypeByBleName('Pro 2 0088')).toBe(EDeviceType.Pro2);
|
|
136
|
-
expect(getDeviceTypeByBleName('OneKey Pro 2 A1B2')).toBe(EDeviceType.Pro2);
|
|
137
|
-
expect(getDeviceTypeByBleName('Pro A1B2')).toBe(EDeviceType.Pro);
|
|
138
|
-
expect(getDeviceTypeByBleName('Pro 22D8')).toBe(EDeviceType.Pro);
|
|
139
|
-
expect(getDeviceTypeByBleName('Pro 2D8F')).toBe(EDeviceType.Pro);
|
|
140
134
|
});
|
|
141
135
|
|
|
142
136
|
test.each([EDeviceType.Pro2, EDeviceType.Neo])(
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { prepareFirmwareUpdateV4MemoryHost } from '../src/api/firmware/FirmwareMemoryHost';
|
|
2
|
+
|
|
3
|
+
import type { CoreApi } from '../src/types/api';
|
|
4
|
+
import type { FirmwareUpdatePlan } from '../src/types/api/firmwareUpdatePlan';
|
|
5
|
+
|
|
6
|
+
describe('prepareFirmwareUpdateV4MemoryHost', () => {
|
|
7
|
+
test('registers artifact-backed component and resource readers', async () => {
|
|
8
|
+
const componentBinary = new Uint8Array([1, 2, 3, 4]).buffer;
|
|
9
|
+
const archiveBinary = new Uint8Array([5, 6]).buffer;
|
|
10
|
+
const manifestBinary = new TextEncoder().encode('{"schema":1}').buffer;
|
|
11
|
+
let artifactReader: Parameters<
|
|
12
|
+
CoreApi['registerFirmwareUpdateHostBinding']
|
|
13
|
+
>[0]['artifactReader'];
|
|
14
|
+
const unregisterFirmwareUpdateHostBinding = jest.fn();
|
|
15
|
+
const sdk = {
|
|
16
|
+
prepareFirmwareUpdatePlan: jest.fn(({ plan, artifacts }) => ({
|
|
17
|
+
schemaVersion: 2,
|
|
18
|
+
preparedPlanDigest: 'b'.repeat(64),
|
|
19
|
+
planDigest: plan.planDigest,
|
|
20
|
+
networkPolicy: 'forbid',
|
|
21
|
+
executor: plan.executor,
|
|
22
|
+
deviceIdentity: plan.deviceIdentity,
|
|
23
|
+
deviceModel: plan.deviceModel,
|
|
24
|
+
firmwareType: plan.firmwareType,
|
|
25
|
+
platform: plan.platform,
|
|
26
|
+
leaseRef: 'test-lease',
|
|
27
|
+
targetsToUpdate: plan.targetsToUpdate,
|
|
28
|
+
artifacts: plan.artifacts.map(planArtifact => {
|
|
29
|
+
const input = artifacts.find(item => item.artifactId === planArtifact.artifactId);
|
|
30
|
+
return {
|
|
31
|
+
...planArtifact,
|
|
32
|
+
artifact: input?.artifact,
|
|
33
|
+
materializedEntries: input?.materializedEntries,
|
|
34
|
+
};
|
|
35
|
+
}),
|
|
36
|
+
})),
|
|
37
|
+
registerFirmwareUpdateHostBinding: jest.fn(binding => {
|
|
38
|
+
artifactReader = binding.artifactReader;
|
|
39
|
+
return 7;
|
|
40
|
+
}),
|
|
41
|
+
unregisterFirmwareUpdateHostBinding,
|
|
42
|
+
} as unknown as Pick<
|
|
43
|
+
CoreApi,
|
|
44
|
+
| 'prepareFirmwareUpdatePlan'
|
|
45
|
+
| 'registerFirmwareUpdateHostBinding'
|
|
46
|
+
| 'unregisterFirmwareUpdateHostBinding'
|
|
47
|
+
>;
|
|
48
|
+
const plan = {
|
|
49
|
+
schemaVersion: 2,
|
|
50
|
+
planDigest: 'a'.repeat(64),
|
|
51
|
+
executor: 'v4',
|
|
52
|
+
deviceIdentity: 'device-id',
|
|
53
|
+
deviceModel: 'pro2',
|
|
54
|
+
firmwareType: 0,
|
|
55
|
+
platform: 'web',
|
|
56
|
+
targetsToUpdate: ['boot', 'resource'],
|
|
57
|
+
artifacts: [
|
|
58
|
+
{
|
|
59
|
+
artifactId: 'component:boot',
|
|
60
|
+
role: 'component',
|
|
61
|
+
target: 'boot',
|
|
62
|
+
url: 'https://example.com/boot.okpkg',
|
|
63
|
+
container: 'raw',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
artifactId: 'resource:archive',
|
|
67
|
+
role: 'resourceBundle',
|
|
68
|
+
target: 'resource',
|
|
69
|
+
url: 'https://example.com/resource.zip',
|
|
70
|
+
container: 'zip',
|
|
71
|
+
logicalName: 'resource-archive',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
} as FirmwareUpdatePlan;
|
|
75
|
+
|
|
76
|
+
const host = prepareFirmwareUpdateV4MemoryHost({
|
|
77
|
+
sdk,
|
|
78
|
+
plan,
|
|
79
|
+
artifacts: [
|
|
80
|
+
{ artifactId: 'component:boot', binary: componentBinary },
|
|
81
|
+
{
|
|
82
|
+
artifactId: 'resource:archive',
|
|
83
|
+
binary: archiveBinary,
|
|
84
|
+
materializedEntries: [{ entryName: 'manifest.json', binary: manifestBinary }],
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
expect(host.hostBindingGeneration).toBe(7);
|
|
90
|
+
expect(sdk.registerFirmwareUpdateHostBinding).toHaveBeenCalledWith(
|
|
91
|
+
expect.objectContaining({ preparedPlanDigest: host.preparedPlan.preparedPlanDigest })
|
|
92
|
+
);
|
|
93
|
+
const componentArtifact = host.preparedPlan.artifacts.find(
|
|
94
|
+
artifact => artifact.target === 'boot'
|
|
95
|
+
)?.artifact;
|
|
96
|
+
const resourceEntryArtifact = host.preparedPlan.artifacts.find(
|
|
97
|
+
artifact => artifact.target === 'resource'
|
|
98
|
+
)?.materializedEntries?.[0]?.artifact;
|
|
99
|
+
expect(componentArtifact?.size).toBe(componentBinary.byteLength);
|
|
100
|
+
expect(resourceEntryArtifact?.size).toBe(manifestBinary.byteLength);
|
|
101
|
+
if (!artifactReader || !componentArtifact || !resourceEntryArtifact) {
|
|
102
|
+
throw new Error('Firmware memory host test setup is incomplete');
|
|
103
|
+
}
|
|
104
|
+
new Uint8Array(componentBinary).fill(9);
|
|
105
|
+
const opened = await artifactReader.open({
|
|
106
|
+
artifactRef: componentArtifact.artifactRef,
|
|
107
|
+
});
|
|
108
|
+
const chunk = await artifactReader.read({
|
|
109
|
+
readerId: opened.readerId,
|
|
110
|
+
offset: 1,
|
|
111
|
+
length: 2,
|
|
112
|
+
});
|
|
113
|
+
expect(Array.from(new Uint8Array(chunk.data))).toEqual([2, 3]);
|
|
114
|
+
await artifactReader.close({ readerId: opened.readerId });
|
|
115
|
+
|
|
116
|
+
// Materialized ZIP entries are receipts only. Execution opens the approved
|
|
117
|
+
// archive and re-derives these bytes, so the memory host must not retain a
|
|
118
|
+
// second readable copy of every expanded resource file.
|
|
119
|
+
expect(() => artifactReader.open({ artifactRef: resourceEntryArtifact.artifactRef })).toThrow(
|
|
120
|
+
'Firmware memory artifact is unavailable'
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
host.release();
|
|
124
|
+
expect(unregisterFirmwareUpdateHostBinding).toHaveBeenCalledWith(7);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -179,7 +179,7 @@ describe('FirmwareUpdatePreparedPlan', () => {
|
|
|
179
179
|
).toThrow('plan digest is invalid');
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
test('
|
|
182
|
+
test('projects portable archive paths to unique device resource names', () => {
|
|
183
183
|
const plan = buildPlan();
|
|
184
184
|
const buildArtifacts = (entryNames: string[]) => [
|
|
185
185
|
{
|
|
@@ -200,17 +200,7 @@ describe('FirmwareUpdatePreparedPlan', () => {
|
|
|
200
200
|
prepareFirmwareUpdatePlan({
|
|
201
201
|
plan,
|
|
202
202
|
leaseRef: 'fwlease:00000000-0000-4000-8000-000000000001',
|
|
203
|
-
artifacts: buildArtifacts([
|
|
204
|
-
'loaders/bootloader/params-pro2-prod_resource-unsigned.okpkg',
|
|
205
|
-
'loaders/rom/params-pro2-prod_resource-unsigned.okpkg',
|
|
206
|
-
]),
|
|
207
|
-
})
|
|
208
|
-
).not.toThrow();
|
|
209
|
-
expect(() =>
|
|
210
|
-
prepareFirmwareUpdatePlan({
|
|
211
|
-
plan,
|
|
212
|
-
leaseRef: 'fwlease:00000000-0000-4000-8000-000000000001',
|
|
213
|
-
artifacts: buildArtifacts(['loaders/rom/params.okpkg', 'loaders/rom/params.okpkg']),
|
|
203
|
+
artifacts: buildArtifacts(['icons/index.bin', 'fonts/index.bin']),
|
|
214
204
|
})
|
|
215
205
|
).toThrow('duplicate entry names');
|
|
216
206
|
expect(() =>
|
|
@@ -258,7 +248,7 @@ describe('FirmwareUpdatePreparedPlan', () => {
|
|
|
258
248
|
materializedEntries: [
|
|
259
249
|
...(resourceArtifact.materializedEntries ?? []),
|
|
260
250
|
{
|
|
261
|
-
entryName: '
|
|
251
|
+
entryName: 'other/index.bin',
|
|
262
252
|
artifact: artifact('d'.repeat(64), 2),
|
|
263
253
|
},
|
|
264
254
|
],
|
|
@@ -3,7 +3,6 @@ import { EDeviceType, EFirmwareType, HardwareErrorCode } from '@onekeyfe/hd-shar
|
|
|
3
3
|
|
|
4
4
|
import { DataManager } from '../src/data-manager';
|
|
5
5
|
import {
|
|
6
|
-
isProtocolV2ResourceArchiveEntryName,
|
|
7
6
|
parseProtocolV2ResourcePackage,
|
|
8
7
|
parseProtocolV2Resources,
|
|
9
8
|
} from '../src/protocols/protocol-v2/resources';
|
|
@@ -105,22 +104,6 @@ describe('Pro2 resource configuration', () => {
|
|
|
105
104
|
});
|
|
106
105
|
});
|
|
107
106
|
|
|
108
|
-
test('ignores macOS ZIP metadata that only looks like a resource package', () => {
|
|
109
|
-
expect(
|
|
110
|
-
isProtocolV2ResourceArchiveEntryName('bundles/firmware_logo-pro2-prod_resource-signed.okpkg')
|
|
111
|
-
).toBe(true);
|
|
112
|
-
expect(
|
|
113
|
-
isProtocolV2ResourceArchiveEntryName(
|
|
114
|
-
'__MACOSX/pro2-prod_resource 2/bundles/._firmware_logo-pro2-prod_resource-signed.okpkg'
|
|
115
|
-
)
|
|
116
|
-
).toBe(false);
|
|
117
|
-
expect(
|
|
118
|
-
isProtocolV2ResourceArchiveEntryName(
|
|
119
|
-
'bundles/._firmware_logo-pro2-prod_resource-signed.okpkg'
|
|
120
|
-
)
|
|
121
|
-
).toBe(false);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
107
|
test('reads the version, hashes, and direct device path from a RESC package', () => {
|
|
125
108
|
expect(
|
|
126
109
|
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/bundles/images.okpkg'))
|
|
@@ -133,30 +116,14 @@ describe('Pro2 resource configuration', () => {
|
|
|
133
116
|
});
|
|
134
117
|
});
|
|
135
118
|
|
|
136
|
-
test('
|
|
119
|
+
test('accepts the boot resource staging path and rejects paths outside resource roots', () => {
|
|
137
120
|
expect(
|
|
138
121
|
parseProtocolV2ResourcePackage(
|
|
139
122
|
createResourcePackage('vol0:/loaders/bootloader/boot_resource.okpkg.staging')
|
|
140
123
|
).devicePath
|
|
141
124
|
).toBe('vol0:/loaders/bootloader/boot_resource.okpkg.staging');
|
|
142
|
-
expect(
|
|
143
|
-
parseProtocolV2ResourcePackage(
|
|
144
|
-
createResourcePackage('vol0:/loaders/bootloader/params.okpkg.staging')
|
|
145
|
-
).devicePath
|
|
146
|
-
).toBe('vol0:/loaders/bootloader/params.okpkg.staging');
|
|
147
|
-
expect(
|
|
148
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/loaders/rom/params.okpkg'))
|
|
149
|
-
.devicePath
|
|
150
|
-
).toBe('vol0:/loaders/rom/params.okpkg');
|
|
151
|
-
expect(
|
|
152
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/unexpected/images.okpkg'))
|
|
153
|
-
.devicePath
|
|
154
|
-
).toBe('vol0:/unexpected/images.okpkg');
|
|
155
125
|
expect(() =>
|
|
156
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/
|
|
157
|
-
).toThrow('device path');
|
|
158
|
-
expect(() =>
|
|
159
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0://bundles/images.okpkg'))
|
|
126
|
+
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/unexpected/images.okpkg'))
|
|
160
127
|
).toThrow('device path');
|
|
161
128
|
});
|
|
162
129
|
|
|
@@ -724,7 +724,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
724
724
|
protocol_version: 1,
|
|
725
725
|
hw: { serial_no: 'P2-STATIC' },
|
|
726
726
|
main_mcu: { application: { version: '1.0.0' } },
|
|
727
|
-
coprocessor: { bt_adv_name: 'Pro2
|
|
727
|
+
coprocessor: { bt_adv_name: 'Pro2 STATIC' },
|
|
728
728
|
};
|
|
729
729
|
const deviceStatus: DeviceStatus = {
|
|
730
730
|
device_id: 'P2-DYNAMIC',
|
|
@@ -744,7 +744,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
744
744
|
expect(features).toMatchObject({
|
|
745
745
|
deviceId: 'P2-DYNAMIC',
|
|
746
746
|
serialNo: 'P2-STATIC',
|
|
747
|
-
bleName: '
|
|
747
|
+
bleName: 'Pro2 STATIC',
|
|
748
748
|
initialized: true,
|
|
749
749
|
unlocked: true,
|
|
750
750
|
passphraseProtection: true,
|
|
@@ -767,7 +767,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
767
767
|
const protocolV2 = buildProtocolV2FeaturesPayload({
|
|
768
768
|
deviceInfo: {
|
|
769
769
|
hw: { Device_type: DeviceType.PRO2, serial_no: 'P2-001' },
|
|
770
|
-
coprocessor: { bt_adv_name: 'Pro 2
|
|
770
|
+
coprocessor: { bt_adv_name: 'Pro 2 BLE' },
|
|
771
771
|
},
|
|
772
772
|
deviceStatus: {
|
|
773
773
|
device_id: 'v2-device',
|
|
@@ -784,7 +784,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
784
784
|
});
|
|
785
785
|
expect(protocolV2).toMatchObject({
|
|
786
786
|
device_id: 'v2-device',
|
|
787
|
-
ble_name: 'Pro 2
|
|
787
|
+
ble_name: 'Pro 2 BLE',
|
|
788
788
|
onekey_device_type: 'PRO2',
|
|
789
789
|
passphrase_protection: true,
|
|
790
790
|
});
|
|
@@ -825,7 +825,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
825
825
|
build_id: 'bt-build',
|
|
826
826
|
hash: [12, 13],
|
|
827
827
|
},
|
|
828
|
-
bt_adv_name: 'Pro2
|
|
828
|
+
bt_adv_name: 'Pro2 BLE',
|
|
829
829
|
},
|
|
830
830
|
se1: {
|
|
831
831
|
application: {
|
|
@@ -865,7 +865,7 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
865
865
|
expect(features.boardVersion).toBe('0.1.0');
|
|
866
866
|
expect(features.verify?.boardBuildId).toBe('rom-build');
|
|
867
867
|
expect(features.verify?.boardHash).toBe('0102ff');
|
|
868
|
-
expect(features.bleName).toBe('
|
|
868
|
+
expect(features.bleName).toBe('Pro2 BLE');
|
|
869
869
|
expect(features.bleVersion).toBe('4.5.6');
|
|
870
870
|
expect(features.verify?.bleHash).toBe('0c0d');
|
|
871
871
|
expect(features.se01Version).toBe('7.8.9');
|
|
@@ -2806,9 +2806,9 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
2806
2806
|
|
|
2807
2807
|
expect(device.toMessageObject()).toMatchObject({
|
|
2808
2808
|
serialNo: 'PR9999999999',
|
|
2809
|
-
bleName: '
|
|
2810
|
-
name: '
|
|
2811
|
-
label: '
|
|
2809
|
+
bleName: 'Pro2 6136',
|
|
2810
|
+
name: 'Pro2 6136',
|
|
2811
|
+
label: 'Pro2 6136',
|
|
2812
2812
|
});
|
|
2813
2813
|
expect(device.features?.label).toBeNull();
|
|
2814
2814
|
});
|
|
@@ -2823,8 +2823,8 @@ describe('Protocol V2 feature adapter', () => {
|
|
|
2823
2823
|
|
|
2824
2824
|
expect(device.getCurrentDisplayName()).toBe('My Pro 2');
|
|
2825
2825
|
expect(device.toMessageObject()).toMatchObject({
|
|
2826
|
-
bleName: '
|
|
2827
|
-
name: '
|
|
2826
|
+
bleName: 'Pro2 6136',
|
|
2827
|
+
name: 'Pro2 6136',
|
|
2828
2828
|
label: 'My Pro 2',
|
|
2829
2829
|
});
|
|
2830
2830
|
});
|
|
@@ -4509,7 +4509,9 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4509
4509
|
],
|
|
4510
4510
|
installItems: [applicationP1InstallItem],
|
|
4511
4511
|
});
|
|
4512
|
-
|
|
4512
|
+
const release = jest.fn();
|
|
4513
|
+
(method as any).prepareProtocolV2LocalMemoryHost = jest.fn().mockResolvedValue({ release });
|
|
4514
|
+
(method as any).runProtocolV2PreparedArtifacts = jest
|
|
4513
4515
|
.fn()
|
|
4514
4516
|
.mockResolvedValue('sdk-managed-resource-result');
|
|
4515
4517
|
method.postTipMessage = jest.fn();
|
|
@@ -4531,10 +4533,13 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4531
4533
|
});
|
|
4532
4534
|
expect(getSysResourceBinarySpy).toHaveBeenCalledWith('https://example.com/pro2-resource.zip');
|
|
4533
4535
|
expect((method as any).params.resourceArchiveBinary).toBe(resourceArchiveBinary);
|
|
4534
|
-
expect((method as any).
|
|
4536
|
+
expect((method as any).prepareProtocolV2LocalMemoryHost).toHaveBeenCalledWith({
|
|
4537
|
+
features: expect.objectContaining({ deviceType: 'pro2' }),
|
|
4538
|
+
firmwareType: EFirmwareType.Universal,
|
|
4535
4539
|
availableInstallItems: [applicationP1InstallItem],
|
|
4536
|
-
announceDownload: false,
|
|
4537
4540
|
});
|
|
4541
|
+
expect((method as any).runProtocolV2PreparedArtifacts).toHaveBeenCalledTimes(1);
|
|
4542
|
+
expect(release).toHaveBeenCalledTimes(1);
|
|
4538
4543
|
});
|
|
4539
4544
|
|
|
4540
4545
|
test('preserves SDK-managed resource installation errors after preparation', async () => {
|
|
@@ -4570,7 +4575,9 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4570
4575
|
(method as any).downloadRemoteProtocolV2ResourceArchive = jest
|
|
4571
4576
|
.fn()
|
|
4572
4577
|
.mockResolvedValue(resourceArchiveBinary);
|
|
4573
|
-
|
|
4578
|
+
const release = jest.fn();
|
|
4579
|
+
(method as any).prepareProtocolV2LocalMemoryHost = jest.fn().mockResolvedValue({ release });
|
|
4580
|
+
(method as any).runProtocolV2PreparedArtifacts = jest.fn().mockRejectedValue(installError);
|
|
4574
4581
|
method.postTipMessage = jest.fn();
|
|
4575
4582
|
jest.spyOn(DataManager, 'getSettings').mockReturnValue('sdk-managed' as never);
|
|
4576
4583
|
|
|
@@ -4580,7 +4587,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4580
4587
|
requireResources: true,
|
|
4581
4588
|
resourceDeviceType: EDeviceType.Pro2,
|
|
4582
4589
|
});
|
|
4583
|
-
expect(
|
|
4590
|
+
expect(release).toHaveBeenCalledTimes(1);
|
|
4584
4591
|
});
|
|
4585
4592
|
|
|
4586
4593
|
test('reboots Protocol V2 normal-mode device to bootloader before transfer', async () => {
|
|
@@ -7618,7 +7625,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
7618
7625
|
}
|
|
7619
7626
|
});
|
|
7620
7627
|
|
|
7621
|
-
test('
|
|
7628
|
+
test('converts a local resource ZIP into a local PreparedPlan without matching a remote release', async () => {
|
|
7622
7629
|
const imagesBinary = createProtocolV2OkppBinary({ version: [1, 0, 0] });
|
|
7623
7630
|
const bootResourceBinary = createProtocolV2OkppBinary({
|
|
7624
7631
|
version: [1, 0, 0],
|
|
@@ -7668,7 +7675,16 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
7668
7675
|
await expect(method.run()).resolves.toBe('local-resource-result');
|
|
7669
7676
|
expect(releaseSpy).not.toHaveBeenCalled();
|
|
7670
7677
|
expect(reloadSpy).not.toHaveBeenCalled();
|
|
7671
|
-
expect((method as any).params.preparedPlan).
|
|
7678
|
+
expect((method as any).params.preparedPlan).toMatchObject({
|
|
7679
|
+
networkPolicy: 'forbid',
|
|
7680
|
+
executor: 'v4',
|
|
7681
|
+
targetsToUpdate: ['app_v1', 'resource'],
|
|
7682
|
+
});
|
|
7683
|
+
expect(
|
|
7684
|
+
(method as any).params.preparedPlan.artifacts.some(
|
|
7685
|
+
(artifact: { target: string }) => artifact.target === 'boot'
|
|
7686
|
+
)
|
|
7687
|
+
).toBe(false);
|
|
7672
7688
|
expect((method as any).executeProtocolV2SourceUpdate).toHaveBeenCalledWith(
|
|
7673
7689
|
expect.objectContaining({
|
|
7674
7690
|
installSources: [
|
|
@@ -7704,10 +7720,6 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
7704
7720
|
zip.file('pro2-resource/bundles/images/images.okpkg', imagesBinary);
|
|
7705
7721
|
zip.file('pro2-resource/loaders/bootloader/boot_resource.okpkg', bootResourceBinary);
|
|
7706
7722
|
zip.file('pro2-resource/build-info.txt', 'ignored');
|
|
7707
|
-
zip.file(
|
|
7708
|
-
'__MACOSX/pro2-resource 2/bundles/._images.okpkg',
|
|
7709
|
-
new Uint8Array([0x00, 0x05, 0x16, 0x07])
|
|
7710
|
-
);
|
|
7711
7723
|
const method = new FirmwareUpdateV4({
|
|
7712
7724
|
id: 1,
|
|
7713
7725
|
payload: {
|
|
@@ -7723,20 +7735,11 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
7723
7735
|
await zip.generateAsync({ type: 'arraybuffer' })
|
|
7724
7736
|
)
|
|
7725
7737
|
).resolves.toMatchObject({
|
|
7726
|
-
|
|
7727
|
-
{
|
|
7728
|
-
entryName: 'pro2-resource/bundles/images/images.okpkg',
|
|
7729
|
-
binary: imagesBinary,
|
|
7730
|
-
header: expect.objectContaining({
|
|
7731
|
-
devicePath: 'vol0:/bundles/images/images.okpkg',
|
|
7732
|
-
}),
|
|
7733
|
-
},
|
|
7738
|
+
materializedEntries: [
|
|
7739
|
+
{ entryName: 'pro2-resource/bundles/images/images.okpkg', binary: imagesBinary },
|
|
7734
7740
|
{
|
|
7735
7741
|
entryName: 'pro2-resource/loaders/bootloader/boot_resource.okpkg',
|
|
7736
7742
|
binary: bootResourceBinary,
|
|
7737
|
-
header: expect.objectContaining({
|
|
7738
|
-
devicePath: 'vol0:/loaders/bootloader/boot_resource.okpkg.staging',
|
|
7739
|
-
}),
|
|
7740
7743
|
},
|
|
7741
7744
|
],
|
|
7742
7745
|
});
|
|
@@ -8032,7 +8035,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
8032
8035
|
expect((method as any).verifyProtocolV2StagedFile).toHaveBeenCalledWith(stagingPath, 3);
|
|
8033
8036
|
});
|
|
8034
8037
|
|
|
8035
|
-
test('
|
|
8038
|
+
test('rewrites the mounted boot resource staging file even when the final file is current', async () => {
|
|
8036
8039
|
const method = new FirmwareUpdateV4({
|
|
8037
8040
|
id: 1,
|
|
8038
8041
|
payload: {
|
|
@@ -8064,62 +8067,12 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
8064
8067
|
resourceSources: [resource],
|
|
8065
8068
|
});
|
|
8066
8069
|
|
|
8067
|
-
|
|
8068
|
-
expect((method as any).
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
test('compares boot resource staging against the live mounted package path', () => {
|
|
8072
|
-
const method = new FirmwareUpdateV4({
|
|
8073
|
-
id: 1,
|
|
8074
|
-
payload: {
|
|
8075
|
-
method: 'firmwareUpdateV4',
|
|
8076
|
-
},
|
|
8077
|
-
});
|
|
8078
|
-
|
|
8079
|
-
expect(
|
|
8080
|
-
(method as any).getProtocolV2ResourceComparePath(
|
|
8081
|
-
'vol0:/loaders/bootloader/boot_resource.okpkg.staging'
|
|
8082
|
-
)
|
|
8083
|
-
).toBe('vol0:/loaders/bootloader/boot_resource.okpkg');
|
|
8084
|
-
expect((method as any).getProtocolV2ResourceComparePath('vol0:/bundles/images.okpkg')).toBe(
|
|
8085
|
-
'vol0:/bundles/images.okpkg'
|
|
8070
|
+
const stagingPath = 'vol0:/loaders/bootloader/boot_resource.okpkg.staging';
|
|
8071
|
+
expect((method as any).isProtocolV2ResourceBundleUpToDate).not.toHaveBeenCalled();
|
|
8072
|
+
expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenCalledWith(
|
|
8073
|
+
expect.objectContaining({ source: resource.source, filePath: stagingPath, totalSize: 3 })
|
|
8086
8074
|
);
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
test('skips bootloader params staging when the on-device package is already current', async () => {
|
|
8090
|
-
const method = new FirmwareUpdateV4({
|
|
8091
|
-
id: 1,
|
|
8092
|
-
payload: {
|
|
8093
|
-
method: 'firmwareUpdateV4',
|
|
8094
|
-
},
|
|
8095
|
-
});
|
|
8096
|
-
|
|
8097
|
-
method.postTipMessage = jest.fn();
|
|
8098
|
-
method.postProgressMessage = jest.fn();
|
|
8099
|
-
(method as any).isProtocolV2ResourceBundleUpToDate = jest.fn().mockResolvedValue(true);
|
|
8100
|
-
(method as any).protocolV2SourceUpdateProcess = jest.fn().mockResolvedValue(3);
|
|
8101
|
-
(method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
|
|
8102
|
-
|
|
8103
|
-
const resource = {
|
|
8104
|
-
name: 'params.okpkg',
|
|
8105
|
-
source: {
|
|
8106
|
-
size: 3,
|
|
8107
|
-
readAt: jest.fn(),
|
|
8108
|
-
close: jest.fn(),
|
|
8109
|
-
},
|
|
8110
|
-
devicePath: 'vol0:/loaders/bootloader/params.okpkg.staging',
|
|
8111
|
-
version: [1, 0, 0],
|
|
8112
|
-
payloadHash: '11'.repeat(64),
|
|
8113
|
-
headerHash: '22'.repeat(64),
|
|
8114
|
-
};
|
|
8115
|
-
|
|
8116
|
-
await (method as any).executeProtocolV2TransferPhase({
|
|
8117
|
-
installSources: [],
|
|
8118
|
-
resourceSources: [resource],
|
|
8119
|
-
});
|
|
8120
|
-
|
|
8121
|
-
expect((method as any).isProtocolV2ResourceBundleUpToDate).toHaveBeenCalledWith(resource);
|
|
8122
|
-
expect((method as any).protocolV2SourceUpdateProcess).not.toHaveBeenCalled();
|
|
8075
|
+
expect((method as any).verifyProtocolV2StagedFile).toHaveBeenCalledWith(stagingPath, 3);
|
|
8123
8076
|
});
|
|
8124
8077
|
|
|
8125
8078
|
test('uses absolute processed_byte offsets and disables append for firmware file writes', async () => {
|
|
@@ -151,10 +151,9 @@ describe('SearchDevices', () => {
|
|
|
151
151
|
);
|
|
152
152
|
|
|
153
153
|
test.each([
|
|
154
|
-
['Pro2 A1B2 - Find My', undefined, '
|
|
155
|
-
['Pro2 5E9D - Finde My', undefined, '
|
|
156
|
-
['Pro2 22D8FindMy', undefined, '
|
|
157
|
-
['Pro 2 A1B2 - Find My', undefined, 'Pro 2 A1B2'],
|
|
154
|
+
['Pro2 A1B2 - Find My', undefined, 'Pro2 A1B2'],
|
|
155
|
+
['Pro2 5E9D - Finde My', undefined, 'Pro2 5E9D'],
|
|
156
|
+
['Pro2 22D8FindMy', undefined, 'Pro2 22D8'],
|
|
158
157
|
[undefined, 'OneKey Pro 2 A1B2 - Find My', 'OneKey Pro 2 A1B2'],
|
|
159
158
|
])(
|
|
160
159
|
'BLE discovery normalizes the Find My display name from name=%s localName=%s',
|
|
@@ -32,8 +32,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
32
32
|
private openProtocolV2MemorySource;
|
|
33
33
|
private closeProtocolV2PreparedSources;
|
|
34
34
|
private prepareProtocolV2InstallSources;
|
|
35
|
-
private
|
|
36
|
-
private createProtocolV2ResourceSourcesFromArchive;
|
|
35
|
+
private prepareProtocolV2LocalMemoryHost;
|
|
37
36
|
private prepareProtocolV2LocalResourceArchive;
|
|
38
37
|
private prepareProtocolV2ResourceSources;
|
|
39
38
|
private prepareProtocolV2ResourceArchiveSources;
|
|
@@ -60,7 +59,6 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
60
59
|
private downloadRemoteProtocolV2ResourceArchive;
|
|
61
60
|
private prepareRemoteProtocolV2Binaries;
|
|
62
61
|
private getProtocolV2ResourceFilePath;
|
|
63
|
-
private getProtocolV2ResourceComparePath;
|
|
64
62
|
private readProtocolV2DeviceFileHeader;
|
|
65
63
|
private isProtocolV2ResourceBundleUpToDate;
|
|
66
64
|
private isProtocolV2BootloaderMode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkD,MAAM,qBAAqB,CAAC;AA0BlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkD,MAAM,qBAAqB,CAAC;AA0BlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAqC/E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AAyErC,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,sBAAsB,EAC9B,0BAA0B,UAAQ,QAiCnC;AAwSD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
entryName: string;
|
|
5
|
+
binary: ArrayBuffer;
|
|
6
|
+
};
|
|
7
|
+
export type FirmwareMemoryArtifact = {
|
|
8
|
+
artifactId: string;
|
|
9
|
+
binary: ArrayBuffer;
|
|
10
|
+
materializedEntries?: FirmwareMemoryArtifactEntry[];
|
|
11
|
+
};
|
|
12
|
+
export type FirmwareUpdateV4MemoryHost = {
|
|
13
|
+
preparedPlan: ReturnType<CoreApi['prepareFirmwareUpdatePlan']>;
|
|
14
|
+
hostBindingGeneration: number;
|
|
15
|
+
release: () => void;
|
|
16
|
+
};
|
|
17
|
+
export declare function prepareFirmwareUpdateV4MemoryHost({ sdk, plan, artifacts, }: {
|
|
18
|
+
sdk: Pick<CoreApi, 'prepareFirmwareUpdatePlan' | 'registerFirmwareUpdateHostBinding' | 'unregisterFirmwareUpdateHostBinding'>;
|
|
19
|
+
plan: FirmwareUpdatePlan;
|
|
20
|
+
artifacts: FirmwareMemoryArtifact[];
|
|
21
|
+
}): FirmwareUpdateV4MemoryHost;
|
|
22
|
+
//# sourceMappingURL=FirmwareMemoryHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FirmwareMemoryHost.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/FirmwareMemoryHost.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAK/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,mBAAmB,CAAC,EAAE,2BAA2B,EAAE,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAC/D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAaF,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,CA0F7B"}
|
|
@@ -35,6 +35,21 @@ export declare const validateProtocolV2FirmwareUpdateTargets: (value: unknown) =
|
|
|
35
35
|
export declare const FIRMWARE_UPDATE_PLAN_TARGETS: Set<FirmwareUpdatePlanTarget>;
|
|
36
36
|
export declare const FIRMWARE_UPDATE_PLAN_ROLES: Set<string>;
|
|
37
37
|
export declare const assertFirmwareUpdatePlan: (value: unknown) => FirmwareUpdatePlan;
|
|
38
|
+
export type ProtocolV2LocalFirmwareUpdatePlanArtifact = {
|
|
39
|
+
artifactId: string;
|
|
40
|
+
target: Exclude<FirmwareUpdateV4Target, 'boot_resources'>;
|
|
41
|
+
container: 'raw' | 'zip';
|
|
42
|
+
logicalName: string;
|
|
43
|
+
expectedSize: number;
|
|
44
|
+
expectedSha256: string;
|
|
45
|
+
targetVersion?: string;
|
|
46
|
+
};
|
|
47
|
+
export declare const buildProtocolV2LocalFirmwareUpdatePlan: ({ features, firmwareType, platform, artifacts, }: {
|
|
48
|
+
features: Features;
|
|
49
|
+
firmwareType: EFirmwareType;
|
|
50
|
+
platform: FirmwareUpdatePlatform;
|
|
51
|
+
artifacts: ProtocolV2LocalFirmwareUpdatePlanArtifact[];
|
|
52
|
+
}) => FirmwareUpdatePlan;
|
|
38
53
|
export declare const buildProtocolV2FirmwareUpdatePlan: ({ features, firmwareType, platform, release, targetsToUpdate, forceUpdateTargets, resourceArchive, }: {
|
|
39
54
|
features: Features;
|
|
40
55
|
firmwareType: EFirmwareType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdatePlan.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/FirmwareUpdatePlan.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,aAAa,EAA6B,MAAM,qBAAqB,CAAC;AAU5F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EACV,kBAAkB,EAElB,6BAA6B,EAC7B,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAEvE,KAAK,sBAAsB,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,CAAC;AAEjF,KAAK,aAAa,GAAG;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,sBAAsB,C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