@onekeyfe/hd-core 1.2.0-alpha.157 → 1.2.0-alpha.158
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 -4
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +3 -16
- package/__tests__/protocol-v2-resources.test.ts +2 -37
- package/__tests__/protocol-v2.test.ts +7 -11
- package/__tests__/search-devices.test.ts +3 -4
- package/dist/api/FirmwareUpdateV4.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/data-manager/TransportManager.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.js +74 -43
- 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/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +4 -9
- package/src/api/SearchDevices.ts +2 -2
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +6 -8
- package/src/core/index.ts +97 -6
- package/src/data-manager/TransportManager.ts +3 -1
- package/src/device/Device.ts +1 -3
- package/src/device/DeviceStateMapper.ts +2 -2
- package/src/deviceProfile/buildDeviceFeatures.ts +2 -7
- package/src/protocols/protocol-v2/resources.ts +12 -16
- package/src/utils/deviceFeaturesCompat.ts +4 -9
|
@@ -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,10 +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
134
|
});
|
|
139
135
|
|
|
140
136
|
test.each([EDeviceType.Pro2, EDeviceType.Neo])(
|
|
@@ -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,20 +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([
|
|
214
|
-
'loaders/rom/params.okpkg',
|
|
215
|
-
'loaders/rom/params.okpkg',
|
|
216
|
-
]),
|
|
203
|
+
artifacts: buildArtifacts(['icons/index.bin', 'fonts/index.bin']),
|
|
217
204
|
})
|
|
218
205
|
).toThrow('duplicate entry names');
|
|
219
206
|
expect(() =>
|
|
@@ -261,7 +248,7 @@ describe('FirmwareUpdatePreparedPlan', () => {
|
|
|
261
248
|
materializedEntries: [
|
|
262
249
|
...(resourceArtifact.materializedEntries ?? []),
|
|
263
250
|
{
|
|
264
|
-
entryName: '
|
|
251
|
+
entryName: 'other/index.bin',
|
|
265
252
|
artifact: artifact('d'.repeat(64), 2),
|
|
266
253
|
},
|
|
267
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,24 +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(
|
|
111
|
-
'bundles/firmware_logo-pro2-prod_resource-signed.okpkg'
|
|
112
|
-
)
|
|
113
|
-
).toBe(true);
|
|
114
|
-
expect(
|
|
115
|
-
isProtocolV2ResourceArchiveEntryName(
|
|
116
|
-
'__MACOSX/pro2-prod_resource 2/bundles/._firmware_logo-pro2-prod_resource-signed.okpkg'
|
|
117
|
-
)
|
|
118
|
-
).toBe(false);
|
|
119
|
-
expect(
|
|
120
|
-
isProtocolV2ResourceArchiveEntryName(
|
|
121
|
-
'bundles/._firmware_logo-pro2-prod_resource-signed.okpkg'
|
|
122
|
-
)
|
|
123
|
-
).toBe(false);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
107
|
test('reads the version, hashes, and direct device path from a RESC package', () => {
|
|
127
108
|
expect(
|
|
128
109
|
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/bundles/images.okpkg'))
|
|
@@ -135,30 +116,14 @@ describe('Pro2 resource configuration', () => {
|
|
|
135
116
|
});
|
|
136
117
|
});
|
|
137
118
|
|
|
138
|
-
test('
|
|
119
|
+
test('accepts the boot resource staging path and rejects paths outside resource roots', () => {
|
|
139
120
|
expect(
|
|
140
121
|
parseProtocolV2ResourcePackage(
|
|
141
122
|
createResourcePackage('vol0:/loaders/bootloader/boot_resource.okpkg.staging')
|
|
142
123
|
).devicePath
|
|
143
124
|
).toBe('vol0:/loaders/bootloader/boot_resource.okpkg.staging');
|
|
144
|
-
expect(
|
|
145
|
-
parseProtocolV2ResourcePackage(
|
|
146
|
-
createResourcePackage('vol0:/loaders/bootloader/params.okpkg.staging')
|
|
147
|
-
).devicePath
|
|
148
|
-
).toBe('vol0:/loaders/bootloader/params.okpkg.staging');
|
|
149
|
-
expect(
|
|
150
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/loaders/rom/params.okpkg'))
|
|
151
|
-
.devicePath
|
|
152
|
-
).toBe('vol0:/loaders/rom/params.okpkg');
|
|
153
|
-
expect(
|
|
154
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/unexpected/images.okpkg'))
|
|
155
|
-
.devicePath
|
|
156
|
-
).toBe('vol0:/unexpected/images.okpkg');
|
|
157
125
|
expect(() =>
|
|
158
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/
|
|
159
|
-
).toThrow('device path');
|
|
160
|
-
expect(() =>
|
|
161
|
-
parseProtocolV2ResourcePackage(createResourcePackage('vol0://bundles/images.okpkg'))
|
|
126
|
+
parseProtocolV2ResourcePackage(createResourcePackage('vol0:/unexpected/images.okpkg'))
|
|
162
127
|
).toThrow('device path');
|
|
163
128
|
});
|
|
164
129
|
|
|
@@ -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,
|
|
@@ -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
|
});
|
|
@@ -7720,10 +7720,6 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
7720
7720
|
zip.file('pro2-resource/bundles/images/images.okpkg', imagesBinary);
|
|
7721
7721
|
zip.file('pro2-resource/loaders/bootloader/boot_resource.okpkg', bootResourceBinary);
|
|
7722
7722
|
zip.file('pro2-resource/build-info.txt', 'ignored');
|
|
7723
|
-
zip.file(
|
|
7724
|
-
'__MACOSX/pro2-resource 2/bundles/._images.okpkg',
|
|
7725
|
-
new Uint8Array([0x00, 0x05, 0x16, 0x07])
|
|
7726
|
-
);
|
|
7727
7723
|
const method = new FirmwareUpdateV4({
|
|
7728
7724
|
id: 1,
|
|
7729
7725
|
payload: {
|
|
@@ -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',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"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AgB1C,OAAO,CAAC,8CAA8C;YAIxC,uCAAuC;YAiNvC,gCAAgC;YAehC,yBAAyB;IASvC,OAAO,CAAC,2BAA2B;YAMrB,8BAA8B;IAQ5C,OAAO,CAAC,0BAA0B;YAkBpB,mCAAmC;YAWnC,qCAAqC;YAmDrC,yBAAyB;YA8DzB,8BAA8B;IAU5C,OAAO,CAAC,kCAAkC;YAQ5B,cAAc;YAuCd,6BAA6B;YAW7B,0BAA0B;YAS1B,6BAA6B;YAwB7B,gBAAgB;IAiB9B,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdatePreparedPlan.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/FirmwareUpdatePreparedPlan.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,8BAA8B,EAC9B,mCAAmC,EAEnC,0BAA0B,EAC3B,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAwB7E,eAAO,MAAM,6BAA6B,UAAW,OAAO,KAAG,MA8B9D,CAAC;
|
|
1
|
+
{"version":3,"file":"FirmwareUpdatePreparedPlan.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/FirmwareUpdatePreparedPlan.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,8BAA8B,EAC9B,mCAAmC,EAEnC,0BAA0B,EAC3B,MAAM,4CAA4C,CAAC;AACpD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAwB7E,eAAO,MAAM,6BAA6B,UAAW,OAAO,KAAG,MA8B9D,CAAC;AAgGF,eAAO,MAAM,yBAAyB;UAK9B,kBAAkB;cACd,MAAM;eACL,mCAAmC,EAAE;MAC9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AgB;IAGvC,OAAO,CAAC,sBAAsB,CAAoC;IAElE,OAAO,CAAC,iBAAiB,CAAoB;;IAS7C,OAAO,CAAC,cAAc;IA6BhB,aAAa,CAAC,OAAO,EAAE,WAAW;IAuExC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAOV,gBAAgB;CAiC/B;AAED,eAAO,MAAM,QAAQ,YAIpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAYzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAiBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransportManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/TransportManager.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAgBzC,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC;IAE5B,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,UAAS;IAE/B,MAAM,CAAC,uBAAuB,EAAE,uBAAuB,CAAqB;IAE5E,MAAM,CAAC,MAAM,EAAE,6BAA6B,GAAG,IAAI,CAAQ;IAE3D,MAAM,CAAC,IAAI;WAOE,SAAS;
|
|
1
|
+
{"version":3,"file":"TransportManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/TransportManager.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAgBzC,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC;IAE5B,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnD,MAAM,CAAC,eAAe,UAAS;IAE/B,MAAM,CAAC,uBAAuB,EAAE,uBAAuB,CAAqB;IAE5E,MAAM,CAAC,MAAM,EAAE,6BAA6B,GAAG,IAAI,CAAQ;IAE3D,MAAM,CAAC,IAAI;WAOE,SAAS;WAqDT,WAAW,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAyB5C,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,6BAA6B;IA6BrF,MAAM,CAAC,YAAY;mBAIE,2BAA2B;IAShD,MAAM,CAAC,kBAAkB;IAIzB,MAAM,CAAC,kBAAkB;IAIzB,MAAM,CAAC,0BAA0B;CAGlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../src/device/Device.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAmB,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAEL,aAAa,
|
|
1
|
+
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../src/device/Device.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM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;QACjB,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAC;KAChD,GACA,yBAAyB,GAAG,SAAS;IAsBxC,yBAAyB,CACvB,KAAK,EAAE,yBAAyB,EAChC,OAAO,GAAE,yBAAyB,CAAC,SAAS,CAAe;IAQ7D,6BAA6B,CAC3B,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAC9C,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE;IAwBxC,8BAA8B;IAI9B,yBAAyB,IAAI,mBAAmB;IAS1C,YAAY,CAChB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,yBAAyB,GAAG;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE;IAmG3D,0BAA0B,CAC9B,eAAe,CAAC,EAAE,MAAM,EACxB,kBAAkB,CAAC,EAAE,OAAO,EAC5B,mBAAmB,CAAC,EAAE,OAAO,EAC7B,aAAa,CAAC,EAAE,OAAO;CAyD1B;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildDeviceFeatures.d.ts","sourceRoot":"","sources":["../../src/deviceProfile/buildDeviceFeatures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildDeviceFeatures.d.ts","sourceRoot":"","sources":["../../src/deviceProfile/buildDeviceFeatures.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAEV,YAAY,EACZ,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAsB,QAAQ,EAAE,MAAM,UAAU,CAAC;AA6C7D,eAAO,MAAM,8BAA8B,uBACrB,cAAc,aACvB,QAAQ,KAClB,QA+HF,CAAC;AASF,eAAO,MAAM,8BAA8B;;;;;MAUvC,QAsLH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -419,8 +419,7 @@ const resolveDeviceBleName = (features) => {
|
|
|
419
419
|
if (!features)
|
|
420
420
|
return null;
|
|
421
421
|
const compatible = asCompatibleFeatures(features);
|
|
422
|
-
|
|
423
|
-
return bleName ? hdShared.canonicalizePro2BleAdvertisementName(bleName) : null;
|
|
422
|
+
return ((_a = firstNonEmptyString(compatible.bleName, compatible.onekey_ble_name, compatible.ble_name)) !== null && _a !== void 0 ? _a : null);
|
|
424
423
|
};
|
|
425
424
|
const resolveDeviceFirmwareVersion = (features) => {
|
|
426
425
|
var _a;
|
|
@@ -1136,10 +1135,6 @@ const getFirmwareUpdateResourceName = (value) => {
|
|
|
1136
1135
|
}
|
|
1137
1136
|
return resourceName;
|
|
1138
1137
|
};
|
|
1139
|
-
const getPreparedEntryIdentity = (entryName) => {
|
|
1140
|
-
getFirmwareUpdateResourceName(entryName);
|
|
1141
|
-
return entryName.toLowerCase();
|
|
1142
|
-
};
|
|
1143
1138
|
const assertPreparedEntry = (value) => {
|
|
1144
1139
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
1145
1140
|
return preparedPlanError('Firmware prepared plan entry must be an object');
|
|
@@ -1192,8 +1187,7 @@ const assertPreparedArtifacts = ({ plan, artifacts, }) => {
|
|
|
1192
1187
|
return preparedPlanError('Firmware prepared plan materialization is incomplete');
|
|
1193
1188
|
}
|
|
1194
1189
|
if (materializedEntries &&
|
|
1195
|
-
new Set(materializedEntries.map(entry =>
|
|
1196
|
-
materializedEntries.length) {
|
|
1190
|
+
new Set(materializedEntries.map(entry => getFirmwareUpdateResourceName(entry.entryName).toLowerCase())).size !== materializedEntries.length) {
|
|
1197
1191
|
return preparedPlanError('Firmware prepared plan contains duplicate entry names');
|
|
1198
1192
|
}
|
|
1199
1193
|
return Object.assign(Object.assign(Object.assign(Object.assign({ artifactId: planArtifact.artifactId, role: planArtifact.role, target: planArtifact.target, container: planArtifact.container }, (planArtifact.logicalName ? { logicalName: planArtifact.logicalName } : {})), (planArtifact.targetVersion ? { targetVersion: planArtifact.targetVersion } : {})), { artifact: Object.assign(Object.assign({}, artifact), { sha256: artifact.sha256.toLowerCase() }) }), ((materializedEntries === null || materializedEntries === void 0 ? void 0 : materializedEntries.length) ? { materializedEntries } : {}));
|
|
@@ -1299,7 +1293,7 @@ const validateFirmwareUpdatePreparedPlan = (value) => {
|
|
|
1299
1293
|
assertFirmwareArtifactReference(artifact.artifact);
|
|
1300
1294
|
const materializedEntryNames = (_d = (_c = artifact.materializedEntries) === null || _c === void 0 ? void 0 : _c.map(entry => {
|
|
1301
1295
|
assertPreparedEntry(entry);
|
|
1302
|
-
return
|
|
1296
|
+
return getFirmwareUpdateResourceName(entry.entryName).toLowerCase();
|
|
1303
1297
|
})) !== null && _d !== void 0 ? _d : [];
|
|
1304
1298
|
if (new Set(materializedEntryNames).size !== materializedEntryNames.length) {
|
|
1305
1299
|
return preparedPlanError('Firmware prepared plan contains duplicate entry names');
|
|
@@ -40722,26 +40716,21 @@ function parseProtocolV2Resources(value) {
|
|
|
40722
40716
|
},
|
|
40723
40717
|
};
|
|
40724
40718
|
}
|
|
40725
|
-
|
|
40726
|
-
|
|
40727
|
-
|
|
40728
|
-
if (!normalized.toLowerCase().endsWith('.okpkg')) {
|
|
40729
|
-
return false;
|
|
40730
|
-
}
|
|
40731
|
-
const parts = normalized.split('/');
|
|
40732
|
-
const fileName = (_a = parts[parts.length - 1]) !== null && _a !== void 0 ? _a : '';
|
|
40733
|
-
return (fileName.length > 0 &&
|
|
40734
|
-
!fileName.startsWith('.') &&
|
|
40735
|
-
!parts.some(part => part === '__MACOSX' || part === '.' || part === '..' || part === ''));
|
|
40736
|
-
}
|
|
40737
|
-
function isSafeResourceDevicePath(path) {
|
|
40738
|
-
return !(path.includes('\\') ||
|
|
40719
|
+
const PROTOCOL_V2_RESOURCE_DEVICE_ROOTS = ['vol0:/bundles/', 'vol0:/loaders/rom/'];
|
|
40720
|
+
function isAllowedResourceDevicePath(path) {
|
|
40721
|
+
if (path.includes('\\') ||
|
|
40739
40722
|
path.includes('//') ||
|
|
40740
40723
|
[...path].some(char => {
|
|
40741
40724
|
const code = char.charCodeAt(0);
|
|
40742
40725
|
return code <= 0x1f || code === 0x7f;
|
|
40743
40726
|
}) ||
|
|
40744
|
-
path.split('/').some(part => part === '.' || part === '..'))
|
|
40727
|
+
path.split('/').some(part => part === '.' || part === '..')) {
|
|
40728
|
+
return false;
|
|
40729
|
+
}
|
|
40730
|
+
if (path === PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH) {
|
|
40731
|
+
return true;
|
|
40732
|
+
}
|
|
40733
|
+
return (path.endsWith('.okpkg') && PROTOCOL_V2_RESOURCE_DEVICE_ROOTS.some(root => path.startsWith(root)));
|
|
40745
40734
|
}
|
|
40746
40735
|
function readAscii(bytes, offset, length) {
|
|
40747
40736
|
return Array.from(bytes.slice(offset, offset + length))
|
|
@@ -40759,7 +40748,7 @@ function readResourceDevicePath(bytes) {
|
|
|
40759
40748
|
throw new Error('Invalid Pro2 RESOURCE package device path metadata');
|
|
40760
40749
|
}
|
|
40761
40750
|
const path = readAscii(pathBytes, 0, pathBytes.byteLength);
|
|
40762
|
-
if (!
|
|
40751
|
+
if (!isAllowedResourceDevicePath(path)) {
|
|
40763
40752
|
throw new Error(`Invalid Pro2 RESOURCE package device path: ${path}`);
|
|
40764
40753
|
}
|
|
40765
40754
|
return path;
|
|
@@ -43430,7 +43419,7 @@ class TransportManager {
|
|
|
43430
43419
|
yield this.transport.init(WebBleLogger, DevicePool.emitter);
|
|
43431
43420
|
}
|
|
43432
43421
|
else if (env === 'webusb' || env === 'desktop-webusb') {
|
|
43433
|
-
yield this.transport.init(WebUsbLogger);
|
|
43422
|
+
yield this.transport.init(WebUsbLogger, DevicePool.emitter);
|
|
43434
43423
|
}
|
|
43435
43424
|
else {
|
|
43436
43425
|
yield this.transport.init(HttpLogger);
|
|
@@ -44542,7 +44531,7 @@ const mapProtocolV2DeviceInfoToState = (info, mode = 'unknown') => {
|
|
|
44542
44531
|
vendor: 'onekey.so',
|
|
44543
44532
|
serialNo: (_b = info.hw) === null || _b === void 0 ? void 0 : _b.serial_no,
|
|
44544
44533
|
bleName: ((_c = info.coprocessor) === null || _c === void 0 ? void 0 : _c.bt_adv_name)
|
|
44545
|
-
? hdShared.
|
|
44534
|
+
? hdShared.normalizePro2FindMyAdvertisementName(info.coprocessor.bt_adv_name)
|
|
44546
44535
|
: undefined,
|
|
44547
44536
|
deviceId: loader ? null : undefined,
|
|
44548
44537
|
}),
|
|
@@ -45423,8 +45412,7 @@ class Device extends events.exports {
|
|
|
45423
45412
|
}
|
|
45424
45413
|
getCurrentBleName() {
|
|
45425
45414
|
var _a, _b;
|
|
45426
|
-
|
|
45427
|
-
return bleName ? hdShared.canonicalizePro2BleAdvertisementName(bleName) : null;
|
|
45415
|
+
return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.identity.bleName) !== null && _b !== void 0 ? _b : null;
|
|
45428
45416
|
}
|
|
45429
45417
|
getCurrentLabel() {
|
|
45430
45418
|
var _a, _b;
|
|
@@ -46935,7 +46923,7 @@ class SearchDevices extends BaseMethod {
|
|
|
46935
46923
|
if (!seenIds.has(lowerId)) {
|
|
46936
46924
|
seenIds.add(lowerId);
|
|
46937
46925
|
const rawBleName = (_e = (_d = device.name) !== null && _d !== void 0 ? _d : device.localName) !== null && _e !== void 0 ? _e : '';
|
|
46938
|
-
const bleName = hdShared.
|
|
46926
|
+
const bleName = hdShared.normalizePro2FindMyAdvertisementName(rawBleName);
|
|
46939
46927
|
devices.push(Object.assign(Object.assign({}, device), { connectId: device.id, serialNo: null, uuid: '', deviceId: null, name: bleName || device.name, deviceType: getDeviceTypeByBleName(bleName) }));
|
|
46940
46928
|
}
|
|
46941
46929
|
}
|
|
@@ -51918,12 +51906,8 @@ const PROTOCOL_V2_REMOTE_COMPONENT_TARGETS = {
|
|
|
51918
51906
|
},
|
|
51919
51907
|
};
|
|
51920
51908
|
const PROTOCOL_V2_FIRMWARE_STAGING_PATHS = new Set(Object.values(PROTOCOL_V2_REMOTE_COMPONENT_TARGETS).map(target => `${PROTOCOL_V2_FIRMWARE_STAGING_VOLUME}${target.fileName}`));
|
|
51921
|
-
const isProtocolV2BootResourcePackagePath = (devicePath) =>
|
|
51922
|
-
|
|
51923
|
-
return false;
|
|
51924
|
-
const normalized = devicePath.toLowerCase();
|
|
51925
|
-
return (normalized.startsWith('vol0:/loaders/bootloader/') && normalized.endsWith('.okpkg.staging'));
|
|
51926
|
-
};
|
|
51909
|
+
const isProtocolV2BootResourcePackagePath = (devicePath) => typeof devicePath === 'string' &&
|
|
51910
|
+
devicePath.toLowerCase() === PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH;
|
|
51927
51911
|
const PROTOCOL_V2_UPDATE_TARGET_BY_TARGET_ID = new Map([
|
|
51928
51912
|
[ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_BOOTLOADER, 'boot'],
|
|
51929
51913
|
[ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P1, 'app_v1'],
|
|
@@ -52568,7 +52552,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
52568
52552
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 resource ZIP cannot be parsed', { firmwareUpdateCode: 'FirmwareArtifactsNotPrepared' });
|
|
52569
52553
|
}
|
|
52570
52554
|
const zipEntries = Object.values(zip.files);
|
|
52571
|
-
const resourceEntries = zipEntries.filter(entry => !entry.dir &&
|
|
52555
|
+
const resourceEntries = zipEntries.filter(entry => !entry.dir && entry.name.toLowerCase().endsWith('.okpkg'));
|
|
52572
52556
|
if (resourceEntries.length === 0 ||
|
|
52573
52557
|
resourceEntries.length > PROTOCOL_V2_RESOURCE_FILE_MAX_COUNT) {
|
|
52574
52558
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 resource ZIP has no valid resource package set', { firmwareUpdateCode: 'FirmwareArtifactsNotPrepared' });
|
|
@@ -65232,6 +65216,7 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
|
|
|
65232
65216
|
if ((_g = method.payload) === null || _g === void 0 ? void 0 : _g.onlyConnectBleDevice) {
|
|
65233
65217
|
preWarmCallbackTask === null || preWarmCallbackTask === void 0 ? void 0 : preWarmCallbackTask.resolve();
|
|
65234
65218
|
Log.debug('Call API - only connect ble device: ', device === null || device === void 0 ? void 0 : device.mainId);
|
|
65219
|
+
requestQueue.releaseTask(method.responseID);
|
|
65235
65220
|
return createResponseMessage(method.responseID, true, null);
|
|
65236
65221
|
}
|
|
65237
65222
|
Log.debug('Call API - setDevice: ', device.mainId);
|
|
@@ -65607,7 +65592,31 @@ function isMissingDetectedProtocolV2Error(method, error) {
|
|
|
65607
65592
|
typeof typedError.message === 'string' &&
|
|
65608
65593
|
typedError.message.includes('Device protocol has not been detected'));
|
|
65609
65594
|
}
|
|
65610
|
-
|
|
65595
|
+
const BLE_ACQUIRE_DEADLINE_MS = 60 * 1000;
|
|
65596
|
+
function raceBleAcquire(acquirePromise, abortSignal) {
|
|
65597
|
+
return new Promise((resolve, reject) => {
|
|
65598
|
+
let settled = false;
|
|
65599
|
+
const settle = (fn) => {
|
|
65600
|
+
if (settled)
|
|
65601
|
+
return;
|
|
65602
|
+
settled = true;
|
|
65603
|
+
clearTimeout(deadline);
|
|
65604
|
+
abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.removeEventListener('abort', onAbort);
|
|
65605
|
+
fn();
|
|
65606
|
+
};
|
|
65607
|
+
const onAbort = () => settle(() => reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallQueueActionCancelled)));
|
|
65608
|
+
const deadline = setTimeout(() => settle(() => reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BleTimeoutError, `BLE acquire exceeded ${BLE_ACQUIRE_DEADLINE_MS}ms deadline`))), BLE_ACQUIRE_DEADLINE_MS);
|
|
65609
|
+
acquirePromise.then(value => settle(() => resolve(value)), error => settle(() => reject(error)));
|
|
65610
|
+
if (abortSignal) {
|
|
65611
|
+
if (abortSignal.aborted) {
|
|
65612
|
+
onAbort();
|
|
65613
|
+
return;
|
|
65614
|
+
}
|
|
65615
|
+
abortSignal.addEventListener('abort', onAbort);
|
|
65616
|
+
}
|
|
65617
|
+
});
|
|
65618
|
+
}
|
|
65619
|
+
function connectDeviceForBle(method, device, abortSignal, retryCount = 0) {
|
|
65611
65620
|
var _a;
|
|
65612
65621
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65613
65622
|
try {
|
|
@@ -65622,9 +65631,31 @@ function connectDeviceForBle(method, device, retryCount = 0) {
|
|
|
65622
65631
|
!device.commands ||
|
|
65623
65632
|
device.commands.disposed;
|
|
65624
65633
|
if (shouldAcquire) {
|
|
65625
|
-
|
|
65626
|
-
|
|
65627
|
-
|
|
65634
|
+
const useAcquireGuards = DataManager.getSettings('env') === 'desktop-web-ble';
|
|
65635
|
+
if (useAcquireGuards && (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted)) {
|
|
65636
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallQueueActionCancelled);
|
|
65637
|
+
}
|
|
65638
|
+
if (!useAcquireGuards) {
|
|
65639
|
+
yield device.acquire(method.payload.connectProtocol, {
|
|
65640
|
+
forceProtocolDetection: method.payload.forceProtocolDetection,
|
|
65641
|
+
});
|
|
65642
|
+
}
|
|
65643
|
+
else {
|
|
65644
|
+
try {
|
|
65645
|
+
yield raceBleAcquire(device.acquire(method.payload.connectProtocol, {
|
|
65646
|
+
forceProtocolDetection: method.payload.forceProtocolDetection,
|
|
65647
|
+
}), abortSignal);
|
|
65648
|
+
}
|
|
65649
|
+
catch (err) {
|
|
65650
|
+
if (err.errorCode === hdShared.HardwareErrorCode.BleTimeoutError &&
|
|
65651
|
+
device.mainId &&
|
|
65652
|
+
device.deviceConnector) {
|
|
65653
|
+
yield device.deviceConnector.disconnect(device.mainId).catch(() => undefined);
|
|
65654
|
+
device.markTransportDisconnected();
|
|
65655
|
+
}
|
|
65656
|
+
throw err;
|
|
65657
|
+
}
|
|
65658
|
+
}
|
|
65628
65659
|
}
|
|
65629
65660
|
if ((_a = method.payload) === null || _a === void 0 ? void 0 : _a.onlyConnectBleDevice) {
|
|
65630
65661
|
if (shouldAcquire) {
|
|
@@ -65655,7 +65686,7 @@ function connectDeviceForBle(method, device, retryCount = 0) {
|
|
|
65655
65686
|
const nextRetry = retryCount + 1;
|
|
65656
65687
|
Log.debug(`Bluetooth connection will retry, retry count: ${nextRetry}`);
|
|
65657
65688
|
yield wait(3000);
|
|
65658
|
-
yield connectDeviceForBle(method, device, nextRetry);
|
|
65689
|
+
yield connectDeviceForBle(method, device, abortSignal, nextRetry);
|
|
65659
65690
|
}
|
|
65660
65691
|
else {
|
|
65661
65692
|
throw err;
|
|
@@ -65740,7 +65771,7 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
|
|
|
65740
65771
|
if (tryCount === 1) {
|
|
65741
65772
|
device.beginConnectionAttempt();
|
|
65742
65773
|
}
|
|
65743
|
-
yield connectDeviceForBle(method, device);
|
|
65774
|
+
yield connectDeviceForBle(method, device, abortSignal);
|
|
65744
65775
|
}
|
|
65745
65776
|
resolve(device);
|
|
65746
65777
|
return;
|
|
@@ -4,7 +4,6 @@ export declare const PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH: string;
|
|
|
4
4
|
export declare const PROTOCOL_V2_ROM_PARAMS_PACKAGE_PATH = "vol0:/loaders/rom/params.okpkg";
|
|
5
5
|
export declare const PROTOCOL_V2_RESOURCE_PACKAGE_HEADER_SIZE = 24464;
|
|
6
6
|
export declare function parseProtocolV2Resources(value: unknown): IProtocolV2Resources | undefined;
|
|
7
|
-
export declare function isProtocolV2ResourceArchiveEntryName(entryName: string): boolean;
|
|
8
7
|
export type ProtocolV2ResourcePackageHeader = {
|
|
9
8
|
version: IVersionArray;
|
|
10
9
|
payloadLength: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,sCAAsC,iDACH,CAAC;AACjD,eAAO,MAAM,8CAA8C,QAAsD,CAAC;AAClH,eAAO,MAAM,mCAAmC,mCAAmC,CAAC;AACpF,eAAO,MAAM,wCAAwC,QAAS,CAAC;AAW/D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CA8BzF;
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,sCAAsC,iDACH,CAAC;AACjD,eAAO,MAAM,8CAA8C,QAAsD,CAAC;AAClH,eAAO,MAAM,mCAAmC,mCAAmC,CAAC;AACpF,eAAO,MAAM,wCAAwC,QAAS,CAAC;AAW/D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CA8BzF;AAoDD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,GAClB,+BAA+B,CAyCjC;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,WAAW,GAAG,UAAU,GAC/B,+BAA+B,CAGjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceFeaturesCompat.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesCompat.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deviceFeaturesCompat.d.ts","sourceRoot":"","sources":["../../src/utils/deviceFeaturesCompat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;AAoB5D,eAAO,MAAM,qBAAqB,cAAe,mBAAmB,KAAG,MAWtE,CAAC;AAEF,eAAO,MAAM,2BAA2B,cAAe,mBAAmB,KAAG,OAI5E,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAe,mBAAmB,KAAG,WAqDlE,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,mBAAmB,KAAG,aAsB1E,CAAC;AAEF,eAAO,MAAM,oBAAoB,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAM9E,CAAC;AAEF,eAAO,MAAM,4BAA4B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAgBtF,CAAC;AAEF,eAAO,MAAM,8BAA8B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAiBxF,CAAC;AAEF,eAAO,MAAM,yBAAyB,cAAe,mBAAmB,KAAG,MAAM,GAAG,IAUnF,CAAC;AAEF,eAAO,MAAM,+BAA+B,cAAe,mBAAmB,KAAG,MAAM,GAAG,IASzF,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.158",
|
|
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.158",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.158",
|
|
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": "4eff5659b79164afa0c2d070833bec4f2a477f0b"
|
|
50
50
|
}
|
|
@@ -34,7 +34,6 @@ import { requestProtocolV2DeviceInfo } from '../protocols/protocol-v2/features';
|
|
|
34
34
|
import {
|
|
35
35
|
PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH,
|
|
36
36
|
PROTOCOL_V2_RESOURCE_PACKAGE_HEADER_SIZE,
|
|
37
|
-
isProtocolV2ResourceArchiveEntryName,
|
|
38
37
|
parseProtocolV2ResourcePackage,
|
|
39
38
|
parseProtocolV2ResourcePackageHeader,
|
|
40
39
|
type ProtocolV2ResourcePackageHeader,
|
|
@@ -302,13 +301,9 @@ const PROTOCOL_V2_FIRMWARE_STAGING_PATHS = new Set(
|
|
|
302
301
|
)
|
|
303
302
|
);
|
|
304
303
|
|
|
305
|
-
const isProtocolV2BootResourcePackagePath = (devicePath: string) =>
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return (
|
|
309
|
-
normalized.startsWith('vol0:/loaders/bootloader/') && normalized.endsWith('.okpkg.staging')
|
|
310
|
-
);
|
|
311
|
-
};
|
|
304
|
+
const isProtocolV2BootResourcePackagePath = (devicePath: string) =>
|
|
305
|
+
typeof devicePath === 'string' &&
|
|
306
|
+
devicePath.toLowerCase() === PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH;
|
|
312
307
|
|
|
313
308
|
const PROTOCOL_V2_UPDATE_TARGET_BY_TARGET_ID = new Map<
|
|
314
309
|
number,
|
|
@@ -1211,7 +1206,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
1211
1206
|
}
|
|
1212
1207
|
const zipEntries = Object.values(zip.files);
|
|
1213
1208
|
const resourceEntries = zipEntries.filter(
|
|
1214
|
-
entry => !entry.dir &&
|
|
1209
|
+
entry => !entry.dir && entry.name.toLowerCase().endsWith('.okpkg')
|
|
1215
1210
|
);
|
|
1216
1211
|
if (
|
|
1217
1212
|
resourceEntries.length === 0 ||
|
package/src/api/SearchDevices.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { normalizePro2FindMyAdvertisementName } from '@onekeyfe/hd-shared';
|
|
2
2
|
|
|
3
3
|
import { BaseMethod } from './BaseMethod';
|
|
4
4
|
import TransportManager from '../data-manager/TransportManager';
|
|
@@ -40,7 +40,7 @@ export default class SearchDevices extends BaseMethod {
|
|
|
40
40
|
seenIds.add(lowerId);
|
|
41
41
|
const rawBleName =
|
|
42
42
|
device.name ?? (device as unknown as { localName?: string }).localName ?? '';
|
|
43
|
-
const bleName =
|
|
43
|
+
const bleName = normalizePro2FindMyAdvertisementName(rawBleName);
|
|
44
44
|
devices.push({
|
|
45
45
|
...device,
|
|
46
46
|
connectId: device.id,
|
|
@@ -71,11 +71,6 @@ export const getFirmwareUpdateResourceName = (value: unknown): string => {
|
|
|
71
71
|
return resourceName;
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const getPreparedEntryIdentity = (entryName: unknown): string => {
|
|
75
|
-
getFirmwareUpdateResourceName(entryName);
|
|
76
|
-
return (entryName as string).toLowerCase();
|
|
77
|
-
};
|
|
78
|
-
|
|
79
74
|
const assertPreparedEntry = (value: unknown): FirmwareUpdatePreparedEntry => {
|
|
80
75
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
81
76
|
return preparedPlanError('Firmware prepared plan entry must be an object');
|
|
@@ -146,8 +141,11 @@ const assertPreparedArtifacts = ({
|
|
|
146
141
|
}
|
|
147
142
|
if (
|
|
148
143
|
materializedEntries &&
|
|
149
|
-
new Set(
|
|
150
|
-
materializedEntries.
|
|
144
|
+
new Set(
|
|
145
|
+
materializedEntries.map(entry =>
|
|
146
|
+
getFirmwareUpdateResourceName(entry.entryName).toLowerCase()
|
|
147
|
+
)
|
|
148
|
+
).size !== materializedEntries.length
|
|
151
149
|
) {
|
|
152
150
|
return preparedPlanError('Firmware prepared plan contains duplicate entry names');
|
|
153
151
|
}
|
|
@@ -283,7 +281,7 @@ export const validateFirmwareUpdatePreparedPlan = (value: unknown): FirmwareUpda
|
|
|
283
281
|
const materializedEntryNames =
|
|
284
282
|
artifact.materializedEntries?.map(entry => {
|
|
285
283
|
assertPreparedEntry(entry);
|
|
286
|
-
return
|
|
284
|
+
return getFirmwareUpdateResourceName(entry.entryName).toLowerCase();
|
|
287
285
|
}) ?? [];
|
|
288
286
|
if (new Set(materializedEntryNames).size !== materializedEntryNames.length) {
|
|
289
287
|
return preparedPlanError('Firmware prepared plan contains duplicate entry names');
|
package/src/core/index.ts
CHANGED
|
@@ -415,6 +415,10 @@ const onCallDevice = async (
|
|
|
415
415
|
if (method.payload?.onlyConnectBleDevice) {
|
|
416
416
|
preWarmCallbackTask?.resolve();
|
|
417
417
|
Log.debug('Call API - only connect ble device: ', device?.mainId);
|
|
418
|
+
// This early return bypasses the normal-path releaseTask at the end of the
|
|
419
|
+
// call; without it the task leaks and haunts every later queue snapshot
|
|
420
|
+
// and cancel sweep (field log: a completed task lingered for 6 minutes).
|
|
421
|
+
requestQueue.releaseTask(method.responseID);
|
|
418
422
|
return createResponseMessage(method.responseID, true, null);
|
|
419
423
|
}
|
|
420
424
|
|
|
@@ -954,7 +958,60 @@ export function isMissingDetectedProtocolV2Error(method: BaseMethod, error: unkn
|
|
|
954
958
|
* If the Bluetooth connection times out, retry up to 6 times
|
|
955
959
|
* @param retryCount - Current retry count (default 0)
|
|
956
960
|
*/
|
|
957
|
-
|
|
961
|
+
// device.acquire awaits a transport reply with no deadline of its own; a
|
|
962
|
+
// transport that never settles (field case: Electron main lost an IPC reply,
|
|
963
|
+
// "reply was never sent" after 5 minutes) hangs the call forever and cancel()
|
|
964
|
+
// only takes effect at poll checkpoints. Race acquire against a deadline and
|
|
965
|
+
// the caller's abort signal so the hang is bounded and cancel is immediate.
|
|
966
|
+
const BLE_ACQUIRE_DEADLINE_MS = 60 * 1000;
|
|
967
|
+
|
|
968
|
+
function raceBleAcquire<T>(acquirePromise: Promise<T>, abortSignal?: AbortSignal): Promise<T> {
|
|
969
|
+
return new Promise<T>((resolve, reject) => {
|
|
970
|
+
let settled = false;
|
|
971
|
+
const settle = (fn: () => void) => {
|
|
972
|
+
if (settled) return;
|
|
973
|
+
settled = true;
|
|
974
|
+
clearTimeout(deadline);
|
|
975
|
+
abortSignal?.removeEventListener('abort', onAbort);
|
|
976
|
+
fn();
|
|
977
|
+
};
|
|
978
|
+
const onAbort = () =>
|
|
979
|
+
settle(() => reject(ERRORS.TypedError(HardwareErrorCode.CallQueueActionCancelled)));
|
|
980
|
+
const deadline = setTimeout(
|
|
981
|
+
() =>
|
|
982
|
+
settle(() =>
|
|
983
|
+
reject(
|
|
984
|
+
ERRORS.TypedError(
|
|
985
|
+
HardwareErrorCode.BleTimeoutError,
|
|
986
|
+
`BLE acquire exceeded ${BLE_ACQUIRE_DEADLINE_MS}ms deadline`
|
|
987
|
+
)
|
|
988
|
+
)
|
|
989
|
+
),
|
|
990
|
+
BLE_ACQUIRE_DEADLINE_MS
|
|
991
|
+
);
|
|
992
|
+
// Attach before any early return so a late settlement of acquirePromise
|
|
993
|
+
// is always consumed — an abort or deadline must never leave the acquire
|
|
994
|
+
// rejection unhandled.
|
|
995
|
+
acquirePromise.then(
|
|
996
|
+
value => settle(() => resolve(value)),
|
|
997
|
+
error => settle(() => reject(error))
|
|
998
|
+
);
|
|
999
|
+
if (abortSignal) {
|
|
1000
|
+
if (abortSignal.aborted) {
|
|
1001
|
+
onAbort();
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
abortSignal.addEventListener('abort', onAbort);
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
async function connectDeviceForBle(
|
|
1010
|
+
method: BaseMethod,
|
|
1011
|
+
device: Device,
|
|
1012
|
+
abortSignal?: AbortSignal,
|
|
1013
|
+
retryCount = 0
|
|
1014
|
+
) {
|
|
958
1015
|
try {
|
|
959
1016
|
if (device.wasInterruptedByUser()) {
|
|
960
1017
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceInterruptedFromUser);
|
|
@@ -968,9 +1025,43 @@ async function connectDeviceForBle(method: BaseMethod, device: Device, retryCoun
|
|
|
968
1025
|
!device.commands ||
|
|
969
1026
|
device.commands.disposed;
|
|
970
1027
|
if (shouldAcquire) {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1028
|
+
// The deadline/abort guards are scoped to the desktop electron
|
|
1029
|
+
// transport: its IPC acquire is the only path with a proven
|
|
1030
|
+
// never-settling failure mode, while react-native/lowlevel acquire may
|
|
1031
|
+
// legitimately block on a user-driven system bonding prompt for longer
|
|
1032
|
+
// than any sane deadline. Other envs keep the plain acquire unchanged.
|
|
1033
|
+
const useAcquireGuards = DataManager.getSettings('env') === 'desktop-web-ble';
|
|
1034
|
+
// A cancel landing during the retry backoff must not start a new acquire.
|
|
1035
|
+
if (useAcquireGuards && abortSignal?.aborted) {
|
|
1036
|
+
throw ERRORS.TypedError(HardwareErrorCode.CallQueueActionCancelled);
|
|
1037
|
+
}
|
|
1038
|
+
if (!useAcquireGuards) {
|
|
1039
|
+
await device.acquire(method.payload.connectProtocol, {
|
|
1040
|
+
forceProtocolDetection: method.payload.forceProtocolDetection,
|
|
1041
|
+
});
|
|
1042
|
+
} else {
|
|
1043
|
+
try {
|
|
1044
|
+
await raceBleAcquire(
|
|
1045
|
+
device.acquire(method.payload.connectProtocol, {
|
|
1046
|
+
forceProtocolDetection: method.payload.forceProtocolDetection,
|
|
1047
|
+
}),
|
|
1048
|
+
abortSignal
|
|
1049
|
+
);
|
|
1050
|
+
} catch (err) {
|
|
1051
|
+
// A deadline hit means the transport is wedged mid-acquire; drop the
|
|
1052
|
+
// link before the retry so it cold-connects instead of stacking a
|
|
1053
|
+
// second connect onto the half-open one.
|
|
1054
|
+
if (
|
|
1055
|
+
err.errorCode === HardwareErrorCode.BleTimeoutError &&
|
|
1056
|
+
device.mainId &&
|
|
1057
|
+
device.deviceConnector
|
|
1058
|
+
) {
|
|
1059
|
+
await device.deviceConnector.disconnect(device.mainId).catch(() => undefined);
|
|
1060
|
+
device.markTransportDisconnected();
|
|
1061
|
+
}
|
|
1062
|
+
throw err;
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
974
1065
|
}
|
|
975
1066
|
if (method.payload?.onlyConnectBleDevice) {
|
|
976
1067
|
if (shouldAcquire) {
|
|
@@ -1010,7 +1101,7 @@ async function connectDeviceForBle(method: BaseMethod, device: Device, retryCoun
|
|
|
1010
1101
|
const nextRetry = retryCount + 1;
|
|
1011
1102
|
Log.debug(`Bluetooth connection will retry, retry count: ${nextRetry}`);
|
|
1012
1103
|
await wait(3000);
|
|
1013
|
-
await connectDeviceForBle(method, device, nextRetry);
|
|
1104
|
+
await connectDeviceForBle(method, device, abortSignal, nextRetry);
|
|
1014
1105
|
} else {
|
|
1015
1106
|
throw err;
|
|
1016
1107
|
}
|
|
@@ -1120,7 +1211,7 @@ const ensureConnected = async (
|
|
|
1120
1211
|
if (tryCount === 1) {
|
|
1121
1212
|
device.beginConnectionAttempt();
|
|
1122
1213
|
}
|
|
1123
|
-
await connectDeviceForBle(method, device);
|
|
1214
|
+
await connectDeviceForBle(method, device, abortSignal);
|
|
1124
1215
|
}
|
|
1125
1216
|
resolve(device);
|
|
1126
1217
|
return;
|
|
@@ -69,7 +69,9 @@ export default class TransportManager {
|
|
|
69
69
|
} else if (env === 'desktop-web-ble') {
|
|
70
70
|
await this.transport.init(WebBleLogger, DevicePool.emitter);
|
|
71
71
|
} else if (env === 'webusb' || env === 'desktop-webusb') {
|
|
72
|
-
|
|
72
|
+
// The emitter is what turns a navigator.usb 'disconnect' into a
|
|
73
|
+
// DEVICE.DISCONNECT; without it WebUSB never reports device removal.
|
|
74
|
+
await this.transport.init(WebUsbLogger, DevicePool.emitter);
|
|
73
75
|
} else {
|
|
74
76
|
await this.transport.init(HttpLogger);
|
|
75
77
|
}
|
package/src/device/Device.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
ERROR_CODES_REQUIRE_RELEASE,
|
|
10
10
|
HardwareError,
|
|
11
11
|
HardwareErrorCode,
|
|
12
|
-
canonicalizePro2BleAdvertisementName,
|
|
13
12
|
createDeferred,
|
|
14
13
|
createDeviceNotSupportMethodError,
|
|
15
14
|
} from '@onekeyfe/hd-shared';
|
|
@@ -673,8 +672,7 @@ export class Device extends EventEmitter {
|
|
|
673
672
|
}
|
|
674
673
|
|
|
675
674
|
getCurrentBleName() {
|
|
676
|
-
|
|
677
|
-
return bleName ? canonicalizePro2BleAdvertisementName(bleName) : null;
|
|
675
|
+
return this.state?.identity.bleName ?? null;
|
|
678
676
|
}
|
|
679
677
|
|
|
680
678
|
getCurrentLabel() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EFirmwareType,
|
|
1
|
+
import { EFirmwareType, normalizePro2FindMyAdvertisementName } from '@onekeyfe/hd-shared';
|
|
2
2
|
|
|
3
3
|
import { buildProtocolV1FeaturesPayload } from '../deviceProfile/buildDeviceFeatures';
|
|
4
4
|
import { resolveProtocolV2DeviceIdentity } from '../deviceProfile/protocolV2DeviceIdentity';
|
|
@@ -248,7 +248,7 @@ export const mapProtocolV2DeviceInfoToState = (
|
|
|
248
248
|
vendor: 'onekey.so',
|
|
249
249
|
serialNo: info.hw?.serial_no,
|
|
250
250
|
bleName: info.coprocessor?.bt_adv_name
|
|
251
|
-
?
|
|
251
|
+
? normalizePro2FindMyAdvertisementName(info.coprocessor.bt_adv_name)
|
|
252
252
|
: undefined,
|
|
253
253
|
deviceId: loader ? null : undefined,
|
|
254
254
|
}),
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EDeviceType,
|
|
3
|
-
EFirmwareType,
|
|
4
|
-
canonicalizePro2BleAdvertisementName,
|
|
5
|
-
} from '@onekeyfe/hd-shared';
|
|
1
|
+
import { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
|
|
6
2
|
|
|
7
3
|
import {
|
|
8
4
|
resolveDeviceBleFirmwareVersion,
|
|
@@ -249,8 +245,7 @@ export const buildProtocolV2FeaturesPayload = ({
|
|
|
249
245
|
const deviceId = status?.device_id ?? cached?.deviceId ?? null;
|
|
250
246
|
const serialNo = firstValue(incomingSerialNo, cached?.serialNo) ?? '';
|
|
251
247
|
const label = cached?.label ?? null;
|
|
252
|
-
const
|
|
253
|
-
const bleName = rawBleName ? canonicalizePro2BleAdvertisementName(rawBleName) : rawBleName;
|
|
248
|
+
const bleName = firstValue(info?.coprocessor?.bt_adv_name, cached?.bleName);
|
|
254
249
|
const initialized = firstValue(status?.init_states, cached?.initialized) ?? null;
|
|
255
250
|
// passphrase_enabled from a locked Pro2 is not authoritative. Only DeviceStatus
|
|
256
251
|
// after PIN unlock can determine the final passphrase setting.
|
|
@@ -49,22 +49,10 @@ export function parseProtocolV2Resources(value: unknown): IProtocolV2Resources |
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
const normalized = entryName.replace(/\\/g, '/');
|
|
54
|
-
if (!normalized.toLowerCase().endsWith('.okpkg')) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
const parts = normalized.split('/');
|
|
58
|
-
const fileName = parts[parts.length - 1] ?? '';
|
|
59
|
-
return (
|
|
60
|
-
fileName.length > 0 &&
|
|
61
|
-
!fileName.startsWith('.') &&
|
|
62
|
-
!parts.some(part => part === '__MACOSX' || part === '.' || part === '..' || part === '')
|
|
63
|
-
);
|
|
64
|
-
}
|
|
52
|
+
const PROTOCOL_V2_RESOURCE_DEVICE_ROOTS = ['vol0:/bundles/', 'vol0:/loaders/rom/'] as const;
|
|
65
53
|
|
|
66
|
-
function
|
|
67
|
-
|
|
54
|
+
function isAllowedResourceDevicePath(path: string): boolean {
|
|
55
|
+
if (
|
|
68
56
|
path.includes('\\') ||
|
|
69
57
|
path.includes('//') ||
|
|
70
58
|
[...path].some(char => {
|
|
@@ -72,6 +60,14 @@ function isSafeResourceDevicePath(path: string): boolean {
|
|
|
72
60
|
return code <= 0x1f || code === 0x7f;
|
|
73
61
|
}) ||
|
|
74
62
|
path.split('/').some(part => part === '.' || part === '..')
|
|
63
|
+
) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (path === PROTOCOL_V2_BOOT_RESOURCE_PACKAGE_STAGING_PATH) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return (
|
|
70
|
+
path.endsWith('.okpkg') && PROTOCOL_V2_RESOURCE_DEVICE_ROOTS.some(root => path.startsWith(root))
|
|
75
71
|
);
|
|
76
72
|
}
|
|
77
73
|
|
|
@@ -97,7 +93,7 @@ function readResourceDevicePath(bytes: Uint8Array): string {
|
|
|
97
93
|
throw new Error('Invalid Pro2 RESOURCE package device path metadata');
|
|
98
94
|
}
|
|
99
95
|
const path = readAscii(pathBytes, 0, pathBytes.byteLength);
|
|
100
|
-
if (!
|
|
96
|
+
if (!isAllowedResourceDevicePath(path)) {
|
|
101
97
|
throw new Error(`Invalid Pro2 RESOURCE package device path: ${path}`);
|
|
102
98
|
}
|
|
103
99
|
return path;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EDeviceType,
|
|
3
|
-
EFirmwareType,
|
|
4
|
-
canonicalizePro2BleAdvertisementName,
|
|
5
|
-
} from '@onekeyfe/hd-shared';
|
|
1
|
+
import { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
|
|
6
2
|
import { Enum_Capability } from '@onekeyfe/hd-transport';
|
|
7
3
|
|
|
8
4
|
import type { PROTO } from '../constants';
|
|
@@ -129,10 +125,9 @@ export const resolveDeviceFirmwareType = (features?: DeviceFeaturesInput): EFirm
|
|
|
129
125
|
export const resolveDeviceBleName = (features?: DeviceFeaturesInput): string | null => {
|
|
130
126
|
if (!features) return null;
|
|
131
127
|
const compatible = asCompatibleFeatures(features);
|
|
132
|
-
|
|
133
|
-
firstNonEmptyString(compatible.bleName, compatible.onekey_ble_name, compatible.ble_name) ??
|
|
134
|
-
|
|
135
|
-
return bleName ? canonicalizePro2BleAdvertisementName(bleName) : null;
|
|
128
|
+
return (
|
|
129
|
+
firstNonEmptyString(compatible.bleName, compatible.onekey_ble_name, compatible.ble_name) ?? null
|
|
130
|
+
);
|
|
136
131
|
};
|
|
137
132
|
|
|
138
133
|
export const resolveDeviceFirmwareVersion = (features?: DeviceFeaturesInput): string | null => {
|