@onekeyfe/hd-core 1.2.0-alpha.77 → 1.2.0-alpha.79

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.
Files changed (57) hide show
  1. package/__tests__/check-all-firmware-release-protocol-v2.test.ts +12 -71
  2. package/__tests__/device-state-mapper.test.ts +16 -1
  3. package/__tests__/device-state-projector.test.ts +20 -0
  4. package/__tests__/device-state-store.test.ts +27 -0
  5. package/__tests__/homescreen.test.ts +17 -0
  6. package/__tests__/method-protocol-support.test.ts +13 -1
  7. package/__tests__/protocol-v2-resources.test.ts +113 -222
  8. package/__tests__/protocol-v2.test.ts +110 -380
  9. package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
  10. package/dist/api/FirmwareUpdateV4.d.ts +0 -6
  11. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  12. package/dist/api/UploadPortfolio.d.ts.map +1 -1
  13. package/dist/api/utils.d.ts +2 -0
  14. package/dist/api/utils.d.ts.map +1 -1
  15. package/dist/data-manager/DataManager.d.ts +1 -2
  16. package/dist/data-manager/DataManager.d.ts.map +1 -1
  17. package/dist/device/DeviceStateMapper.d.ts.map +1 -1
  18. package/dist/device/DeviceStateProjector.d.ts.map +1 -1
  19. package/dist/device/DeviceStateStore.d.ts.map +1 -1
  20. package/dist/index.d.ts +96 -33
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +515 -597
  23. package/dist/inject.d.ts.map +1 -1
  24. package/dist/protocols/protocol-v2/resources.d.ts +31 -28
  25. package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
  26. package/dist/types/api/checkAllFirmwareRelease.d.ts +1 -0
  27. package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
  28. package/dist/types/api/export.d.ts +1 -0
  29. package/dist/types/api/export.d.ts.map +1 -1
  30. package/dist/types/api/index.d.ts +2 -0
  31. package/dist/types/api/index.d.ts.map +1 -1
  32. package/dist/types/api/protocolV2ResourceManifest.d.ts +17 -0
  33. package/dist/types/api/protocolV2ResourceManifest.d.ts.map +1 -0
  34. package/dist/types/device.d.ts +8 -0
  35. package/dist/types/device.d.ts.map +1 -1
  36. package/dist/types/settings.d.ts +30 -21
  37. package/dist/types/settings.d.ts.map +1 -1
  38. package/dist/utils/homescreen.d.ts.map +1 -1
  39. package/package.json +4 -4
  40. package/src/api/CheckAllFirmwareRelease.ts +5 -34
  41. package/src/api/FirmwareUpdateV4.ts +48 -220
  42. package/src/api/UploadPortfolio.ts +18 -0
  43. package/src/api/utils.ts +25 -0
  44. package/src/data-manager/DataManager.ts +17 -6
  45. package/src/device/DeviceStateMapper.ts +42 -0
  46. package/src/device/DeviceStateProjector.ts +58 -0
  47. package/src/device/DeviceStateStore.ts +31 -0
  48. package/src/index.ts +8 -0
  49. package/src/inject.ts +2 -0
  50. package/src/protocols/protocol-v2/resources.ts +193 -324
  51. package/src/types/api/checkAllFirmwareRelease.ts +1 -0
  52. package/src/types/api/export.ts +4 -0
  53. package/src/types/api/index.ts +2 -0
  54. package/src/types/api/protocolV2ResourceManifest.ts +19 -0
  55. package/src/types/device.ts +16 -0
  56. package/src/types/settings.ts +30 -36
  57. package/src/utils/homescreen.ts +5 -1
@@ -5,7 +5,6 @@ import {
5
5
  DeviceSettingsPage,
6
6
  DeviceType,
7
7
  } from '@onekeyfe/hd-transport';
8
- import { sha256 } from '@noble/hashes/sha256';
9
8
 
10
9
  import * as firmwareBinaryApi from '../src/api/firmware/getBinary';
11
10
  import DnxGetAddress from '../src/api/dynex/DnxGetAddress';
@@ -79,7 +78,6 @@ import {
79
78
  requestProtocolV2ProtocolInfo,
80
79
  supportsProtocolV2Message,
81
80
  } from '../src/protocols/protocol-v2/features';
82
- import { PROTOCOL_V2_RESOURCE_DEVICE_PATHS } from '../src/protocols/protocol-v2/resources';
83
81
  import {
84
82
  getProtocolV2WalletSession,
85
83
  refreshProtocolV2DeviceStatus,
@@ -227,6 +225,17 @@ describe('DeviceUploadWallpaper', () => {
227
225
  });
228
226
 
229
227
  describe('UploadPortfolio', () => {
228
+ const portfolioProtocolInfo = {
229
+ version: 2,
230
+ supported_messages: [60805, 61400],
231
+ };
232
+
233
+ const stubPortfolioDevice = <T extends Record<string, any>>(device: T) =>
234
+ stubDevice({
235
+ ...device,
236
+ ensureProtocolV2RuntimeContext: jest.fn().mockResolvedValue(portfolioProtocolInfo),
237
+ });
238
+
230
239
  test('writes and applies the portfolio while the device is locked without unlocking', async () => {
231
240
  const packageBytes = new Uint8Array([1, 2, 3]);
232
241
  const typedCall = jest
@@ -234,7 +243,7 @@ describe('UploadPortfolio', () => {
234
243
  .mockResolvedValueOnce({ message: { processed_byte: 3 } })
235
244
  .mockResolvedValueOnce({ message: { message: 'Portfolio updated' } });
236
245
  const unlockDevice = jest.fn().mockResolvedValue(undefined);
237
- const device = stubDevice({
246
+ const device = stubPortfolioDevice({
238
247
  features: { unlocked: false },
239
248
  commands: { typedCall },
240
249
  isProtocolV2: () => true,
@@ -279,7 +288,7 @@ describe('UploadPortfolio', () => {
279
288
  packageBytes,
280
289
  },
281
290
  });
282
- (method as any).device = stubDevice({ commands: { typedCall } });
291
+ (method as any).device = stubPortfolioDevice({ commands: { typedCall } });
283
292
  method.postMessage = jest.fn();
284
293
 
285
294
  method.init();
@@ -327,7 +336,7 @@ describe('UploadPortfolio', () => {
327
336
  packageBytes: new Uint8Array([1]),
328
337
  },
329
338
  });
330
- (method as any).device = stubDevice({ commands: { typedCall } });
339
+ (method as any).device = stubPortfolioDevice({ commands: { typedCall } });
331
340
 
332
341
  method.init();
333
342
 
@@ -350,7 +359,7 @@ describe('UploadPortfolio', () => {
350
359
  },
351
360
  });
352
361
  method.abortSignal = abortController.signal;
353
- (method as any).device = stubDevice({ commands: { typedCall } });
362
+ (method as any).device = stubPortfolioDevice({ commands: { typedCall } });
354
363
 
355
364
  method.init();
356
365
 
@@ -360,6 +369,31 @@ describe('UploadPortfolio', () => {
360
369
  expect(typedCall).toHaveBeenCalledTimes(1);
361
370
  expect(typedCall).not.toHaveBeenCalledWith('PortfolioUpdate', 'Success', {});
362
371
  });
372
+
373
+ test('rejects unsupported firmware before staging the package', async () => {
374
+ const typedCall = jest.fn();
375
+ const method = new UploadPortfolio({
376
+ id: 1,
377
+ payload: {
378
+ method: 'uploadPortfolio',
379
+ packageBytes: new Uint8Array([1]),
380
+ },
381
+ });
382
+ (method as any).device = stubDevice({
383
+ commands: { typedCall },
384
+ ensureProtocolV2RuntimeContext: jest.fn().mockResolvedValue({
385
+ version: 2,
386
+ supported_messages: [60805],
387
+ }),
388
+ });
389
+
390
+ method.init();
391
+
392
+ await expect(method.run()).rejects.toMatchObject({
393
+ errorCode: HardwareErrorCode.DeviceNotSupportMethod,
394
+ });
395
+ expect(typedCall).not.toHaveBeenCalled();
396
+ });
363
397
  });
364
398
 
365
399
  const descriptor = {
@@ -3967,7 +4001,7 @@ describe('Protocol V2 firmware update targets', () => {
3967
4001
  });
3968
4002
  });
3969
4003
 
3970
- test('enters Protocol V2 bootloader before reading and downloading remote resources', async () => {
4004
+ test('requires the external host to prepare manifest resources before bootloader entry', async () => {
3971
4005
  const method = new FirmwareUpdateV4({
3972
4006
  id: 1,
3973
4007
  payload: {
@@ -3987,55 +4021,21 @@ describe('Protocol V2 firmware update targets', () => {
3987
4021
  bootloaderMode: false,
3988
4022
  capabilities: [],
3989
4023
  },
4024
+ getCurrentDeviceType: () => 'pro2',
3990
4025
  isBootloader: () => false,
3991
4026
  isRomloader: () => false,
3992
4027
  });
3993
4028
  (method as any).captureProtocolV2PhysicalIdentity = jest.fn().mockResolvedValue(undefined);
3994
- (method as any).prepareRemoteProtocolV2Binaries = jest.fn().mockResolvedValue({
3995
- bootloaderBinary: null,
3996
- fwBinaryMap: [],
3997
- installItems: [],
3998
- });
3999
-
4000
- const order: string[] = [];
4001
- (method as any).prepareProtocolV2BootResources = jest.fn().mockImplementation(() => {
4002
- order.push('prepare-startup-resources');
4003
- return Promise.resolve([]);
4004
- });
4005
- (method as any).enterProtocolV2BootloaderMode = jest.fn().mockImplementation(() => {
4006
- order.push('enter-bootloader');
4007
- return Promise.resolve(true);
4008
- });
4009
- (method as any).prepareProtocolV2ResourceBundles = jest.fn().mockImplementation(() => {
4010
- order.push('prepare-resources');
4011
- return Promise.resolve([
4012
- {
4013
- name: 'images.okpkg',
4014
- binary: new Uint8Array([1]).buffer,
4015
- devicePath: 'vol0:/bundles/images/images.okpkg',
4016
- },
4017
- ]);
4018
- });
4019
- (method as any).executeProtocolV2Update = jest.fn().mockImplementation(() => {
4020
- order.push('execute-update');
4021
- return Promise.resolve();
4022
- });
4023
- (method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
4024
- (method as any).waitForProtocolV2FinalFeatures = jest.fn().mockResolvedValue({
4025
- bootloaderVersion: '1.0.0',
4026
- bleVersion: '1.0.0',
4027
- firmwareVersion: '1.0.0',
4028
- });
4029
+ (method as any).enterProtocolV2BootloaderMode = jest.fn();
4029
4030
  method.postTipMessage = jest.fn();
4030
4031
 
4031
- await method.run();
4032
-
4033
- expect(order).toEqual([
4034
- 'prepare-startup-resources',
4035
- 'enter-bootloader',
4036
- 'prepare-resources',
4037
- 'execute-update',
4038
- ]);
4032
+ await expect(method.run()).rejects.toMatchObject({
4033
+ errorCode: HardwareErrorCode.RuntimeError,
4034
+ params: expect.objectContaining({
4035
+ firmwareUpdateCode: 'FirmwareArtifactsNotPrepared',
4036
+ }),
4037
+ });
4038
+ expect((method as any).enterProtocolV2BootloaderMode).not.toHaveBeenCalled();
4039
4039
  });
4040
4040
 
4041
4041
  test('reboots Protocol V2 normal-mode device to bootloader before transfer', async () => {
@@ -4204,9 +4204,6 @@ describe('Protocol V2 firmware update targets', () => {
4204
4204
  },
4205
4205
  });
4206
4206
  (method as any).captureProtocolV2PhysicalIdentity = jest.fn().mockResolvedValue(undefined);
4207
- const prepareResourceBundles = jest
4208
- .spyOn(method as any, 'prepareProtocolV2ResourceBundles')
4209
- .mockResolvedValue(undefined);
4210
4207
  (method as any).protocolV2Reboot = jest.fn();
4211
4208
  (method as any).executeProtocolV2Update = jest.fn().mockResolvedValue(undefined);
4212
4209
  (method as any).exitProtocolV2BootloaderToNormal = jest.fn().mockResolvedValue(undefined);
@@ -4219,7 +4216,6 @@ describe('Protocol V2 firmware update targets', () => {
4219
4216
 
4220
4217
  await method.run();
4221
4218
 
4222
- expect(prepareResourceBundles).not.toHaveBeenCalled();
4223
4219
  expect((method as any).protocolV2Reboot).not.toHaveBeenCalled();
4224
4220
  expect((method as any).executeProtocolV2Update).toHaveBeenCalledWith({
4225
4221
  bootloaderBinary: null,
@@ -5591,6 +5587,25 @@ describe('Protocol V2 firmware update targets', () => {
5591
5587
  );
5592
5588
  });
5593
5589
 
5590
+ test('installs and verifies bootloader before syncing manifest resources', () => {
5591
+ const method = new FirmwareUpdateV4({
5592
+ id: 1,
5593
+ payload: { method: 'firmwareUpdateV4' },
5594
+ });
5595
+ const phases = (method as any).buildProtocolV2ExecutionPhases({
5596
+ installSources: [{ kind: 'bootloader' }, { kind: 'component' }],
5597
+ resourceSources: [{ kind: 'resource' }],
5598
+ });
5599
+
5600
+ expect(phases.map((phase: { kind: string }) => phase.kind)).toEqual([
5601
+ 'bootloader-install',
5602
+ 'bootloader-verify',
5603
+ 'resource-sync',
5604
+ 'component-install',
5605
+ 'final-verify',
5606
+ ]);
5607
+ });
5608
+
5594
5609
  test('does not request installation when the staged file size does not match', async () => {
5595
5610
  const method = new FirmwareUpdateV4({
5596
5611
  id: 1,
@@ -6116,8 +6131,6 @@ describe('Protocol V2 firmware update targets', () => {
6116
6131
  });
6117
6132
  method.init();
6118
6133
  (method as any).captureProtocolV2PhysicalIdentity = jest.fn().mockResolvedValue(undefined);
6119
- const bootResourcesSpy = jest.spyOn(DataManager, 'getProtocolV2BootResources');
6120
-
6121
6134
  (method as any).device = stubDevice({
6122
6135
  originalDescriptor: { protocolType: 'V2' },
6123
6136
  features: { deviceType: 'pro2', firmwareVersion: '0.0.0', capabilities: [] },
@@ -6136,7 +6149,6 @@ describe('Protocol V2 firmware update targets', () => {
6136
6149
  await method.run();
6137
6150
 
6138
6151
  expect(forceReloadDataSpy).not.toHaveBeenCalled();
6139
- expect(bootResourcesSpy).not.toHaveBeenCalled();
6140
6152
  expect((method as any).prepareRemoteProtocolV2Binaries).not.toHaveBeenCalled();
6141
6153
  expect((method as any).executeProtocolV2Update).toHaveBeenCalledWith(
6142
6154
  expect.objectContaining({
@@ -6212,10 +6224,51 @@ describe('Protocol V2 firmware update targets', () => {
6212
6224
  });
6213
6225
 
6214
6226
  expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenCalledTimes(1);
6227
+ expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenCalledWith(
6228
+ expect.objectContaining({ filePath: 'vol0:/resource/images/images.okpkg' })
6229
+ );
6230
+ expect((method as any).verifyProtocolV2StagedFile).toHaveBeenCalledWith(
6231
+ 'vol0:/resource/images/images.okpkg',
6232
+ 3
6233
+ );
6215
6234
  expect((method as any).protocolV2StartFirmwareUpdate).not.toHaveBeenCalled();
6216
6235
  expect((method as any).waitForProtocolV2FirmwareUpdateComplete).not.toHaveBeenCalled();
6217
6236
  });
6218
6237
 
6238
+ test('writes the mounted boot resource package through its staging path', async () => {
6239
+ const method = new FirmwareUpdateV4({
6240
+ id: 1,
6241
+ payload: {
6242
+ method: 'firmwareUpdateV4',
6243
+ },
6244
+ });
6245
+
6246
+ method.postTipMessage = jest.fn();
6247
+ method.postProgressMessage = jest.fn();
6248
+ (method as any).protocolV2SourceUpdateProcess = jest.fn().mockResolvedValue(3);
6249
+ (method as any).enterProtocolV2BootloaderMode = jest.fn().mockResolvedValue(undefined);
6250
+ (method as any).completeProtocolV2FinalVerification = jest.fn().mockResolvedValue({});
6251
+ (method as any).verifyProtocolV2StagedFile = jest.fn().mockResolvedValue(undefined);
6252
+
6253
+ await (method as any).executeProtocolV2Update({
6254
+ resourceBundles: [
6255
+ {
6256
+ name: 'boot_resource.okpkg',
6257
+ binary: new Uint8Array([1, 2, 3]).buffer,
6258
+ devicePath: 'vol0:/loaders/bootloader/boot_resource.okpkg',
6259
+ },
6260
+ ],
6261
+ bootloaderBinary: null,
6262
+ fwBinaryMap: [],
6263
+ });
6264
+
6265
+ const stagingPath = 'vol0:/loaders/bootloader/boot_resource.okpkg.staging';
6266
+ expect((method as any).protocolV2SourceUpdateProcess).toHaveBeenCalledWith(
6267
+ expect.objectContaining({ filePath: stagingPath })
6268
+ );
6269
+ expect((method as any).verifyProtocolV2StagedFile).toHaveBeenCalledWith(stagingPath, 3);
6270
+ });
6271
+
6219
6272
  test('uses absolute processed_byte offsets and disables append for firmware file writes', async () => {
6220
6273
  const method = new FirmwareUpdateV4({
6221
6274
  id: 1,
@@ -6919,64 +6972,6 @@ describe('Protocol V2 firmware update method', () => {
6919
6972
  });
6920
6973
 
6921
6974
  describe('Protocol V2 firmware reconnect identity', () => {
6922
- const createResourceFilesystemTypedCall = (
6923
- stable: Array<{ type: string; size: number; headerHash: string }>,
6924
- missingTypes: string[] = []
6925
- ) => {
6926
- const missing = new Set(missingTypes);
6927
- const resourceByPath = new Map(
6928
- stable.map(resource => [
6929
- PROTOCOL_V2_RESOURCE_DEVICE_PATHS[
6930
- resource.type as keyof typeof PROTOCOL_V2_RESOURCE_DEVICE_PATHS
6931
- ],
6932
- resource,
6933
- ])
6934
- );
6935
- return jest.fn((requestType: string, _responseType: string, payload: Record<string, any>) => {
6936
- if (requestType === 'ResourceInventoryGet') {
6937
- throw new Error('ResourceInventoryGet is unavailable on released firmware');
6938
- }
6939
- if (requestType === 'FilesystemPathInfoQuery') {
6940
- const resource = resourceByPath.get(payload.path);
6941
- const exists = Boolean(resource && !missing.has(resource.type));
6942
- return {
6943
- message: {
6944
- exist: exists,
6945
- directory: false,
6946
- size: exists ? resource?.size : 0,
6947
- },
6948
- };
6949
- }
6950
- if (requestType === 'FilesystemFileRead') {
6951
- const resource = resourceByPath.get(payload.file.path);
6952
- if (!resource || missing.has(resource.type)) throw new Error('missing resource');
6953
- const header = new Uint8Array(0x52a0);
6954
- const view = new DataView(header.buffer);
6955
- 'OKPP'.split('').forEach((char, index) => {
6956
- header[index] = char.charCodeAt(0);
6957
- });
6958
- 'RESC'.split('').forEach((char, index) => {
6959
- header[0x08 + index] = char.charCodeAt(0);
6960
- });
6961
- view.setUint32(0x0c, header.byteLength, true);
6962
- for (let index = 0; index < resource.headerHash.length / 2; index++) {
6963
- header[0x240 + index] = Number.parseInt(
6964
- resource.headerHash.slice(index * 2, index * 2 + 2),
6965
- 16
6966
- );
6967
- }
6968
- const offset = Number(payload.file.offset);
6969
- const chunkLength = Number(payload.chunk_len);
6970
- return {
6971
- message: {
6972
- data: header.slice(offset, offset + chunkLength),
6973
- },
6974
- };
6975
- }
6976
- throw new Error(`Unexpected request: ${requestType}`);
6977
- });
6978
- };
6979
-
6980
6975
  test('keeps the host plan identity as the V4 reconnect anchor', () => {
6981
6976
  const method = new FirmwareUpdateV4({
6982
6977
  id: 1,
@@ -7091,271 +7086,6 @@ describe('Protocol V2 firmware reconnect identity', () => {
7091
7086
  expect(Math.max(...readChunkLengths)).toBe(900);
7092
7087
  });
7093
7088
 
7094
- test('uses filesystem reads instead of ResourceInventoryGet for resource comparison', async () => {
7095
- const method = new FirmwareUpdateV4({
7096
- id: 1,
7097
- payload: {
7098
- method: 'firmwareUpdateV4',
7099
- platform: 'web',
7100
- targetsToUpdate: ['resource'],
7101
- },
7102
- });
7103
- method.init();
7104
- const stable = ['images', 'animation', 'wallpaper', 'translations', 'roobert', 'noto'].map(
7105
- (type, index) => ({
7106
- type,
7107
- url: `https://example.com/${type}.okpkg`,
7108
- size: 0x52a0 + index + 1,
7109
- fileHash: 'a'.repeat(64),
7110
- headerHash: index.toString(16).padStart(128, '0'),
7111
- })
7112
- );
7113
- const typedCall = createResourceFilesystemTypedCall(stable);
7114
- (method as any).device = stubDevice({
7115
- getCommands: () => ({ typedCall }),
7116
- getCurrentDeviceType: () => 'pro2',
7117
- });
7118
- const resourcesSpy = jest
7119
- .spyOn(DataManager, 'getProtocolV2Resources')
7120
- .mockReturnValue(stable as any);
7121
- (method as any).downloadProtocolV2Resource = jest.fn();
7122
-
7123
- await expect((method as any).prepareProtocolV2ResourceBundles()).resolves.toEqual([]);
7124
- expect(typedCall.mock.calls.some(call => call[0] === 'ResourceInventoryGet')).toBe(false);
7125
- expect(typedCall.mock.calls.some(call => call[0] === 'FilesystemFileRead')).toBe(true);
7126
- expect((method as any).downloadProtocolV2Resource).not.toHaveBeenCalled();
7127
- resourcesSpy.mockRestore();
7128
- });
7129
-
7130
- test('downloads only changed resources from loader inventory', async () => {
7131
- const method = new FirmwareUpdateV4({
7132
- id: 1,
7133
- payload: { method: 'firmwareUpdateV4', platform: 'web', targetsToUpdate: ['resource'] },
7134
- });
7135
- method.init();
7136
- const stable = ['images', 'animation', 'wallpaper', 'translations', 'roobert', 'noto'].map(
7137
- (type, index) => ({
7138
- type,
7139
- url: `https://example.com/${type}.okpkg`,
7140
- size: 0x52a0 + index + 1,
7141
- fileHash: 'a'.repeat(64),
7142
- headerHash: index.toString(16).padStart(128, '0'),
7143
- })
7144
- );
7145
- const typedCall = createResourceFilesystemTypedCall(stable, ['images']);
7146
- (method as any).device = stubDevice({
7147
- getCommands: () => ({ typedCall }),
7148
- getCurrentDeviceType: () => 'pro2',
7149
- });
7150
- const resourcesSpy = jest
7151
- .spyOn(DataManager, 'getProtocolV2Resources')
7152
- .mockReturnValue(stable as any);
7153
- (method as any).downloadProtocolV2Resource = jest.fn(resource =>
7154
- Promise.resolve({
7155
- name: `${resource.type}.okpkg`,
7156
- binary: new ArrayBuffer(resource.size),
7157
- devicePath: `vol0:/${resource.type}.okpkg`,
7158
- })
7159
- );
7160
-
7161
- const bundles = await (method as any).prepareProtocolV2ResourceBundles();
7162
-
7163
- expect(bundles).toHaveLength(1);
7164
- expect((method as any).downloadProtocolV2Resource).toHaveBeenCalledWith(stable[0]);
7165
- resourcesSpy.mockRestore();
7166
- });
7167
-
7168
- test('uses filesystem inventory for incremental Bootloader recovery', async () => {
7169
- const method = new FirmwareUpdateV4({
7170
- id: 1,
7171
- payload: { method: 'firmwareUpdateV4', platform: 'web', targetsToUpdate: ['resource'] },
7172
- });
7173
- method.init();
7174
- const stable = ['images', 'animation', 'wallpaper', 'translations', 'roobert', 'noto'].map(
7175
- (type, index) => ({
7176
- type,
7177
- url: `https://example.com/${type}.okpkg`,
7178
- size: 0x52a0 + index + 1,
7179
- fileHash: 'a'.repeat(64),
7180
- headerHash: index.toString(16).padStart(128, '0'),
7181
- })
7182
- );
7183
- const typedCall = createResourceFilesystemTypedCall(stable, ['images']);
7184
- (method as any).device = stubDevice({
7185
- getCommands: () => ({ typedCall }),
7186
- getCurrentDeviceType: () => 'pro2',
7187
- });
7188
- const resourcesSpy = jest
7189
- .spyOn(DataManager, 'getProtocolV2Resources')
7190
- .mockReturnValue(stable as any);
7191
- (method as any).downloadProtocolV2Resource = jest.fn(resource =>
7192
- Promise.resolve({
7193
- name: `${resource.type}.okpkg`,
7194
- binary: new ArrayBuffer(resource.size),
7195
- devicePath: `vol0:/${resource.type}.okpkg`,
7196
- })
7197
- );
7198
-
7199
- const bundles = await (method as any).prepareProtocolV2ResourceBundles();
7200
-
7201
- expect(bundles).toHaveLength(1);
7202
- expect(typedCall.mock.calls.some(call => call[0] === 'ResourceInventoryGet')).toBe(false);
7203
- expect(typedCall.mock.calls.some(call => call[0] === 'FilesystemPathInfoQuery')).toBe(true);
7204
- expect((method as any).downloadProtocolV2Resource).toHaveBeenCalledWith(stable[0]);
7205
- resourcesSpy.mockRestore();
7206
- });
7207
-
7208
- test('does not resolve boot resources when no resource target is selected', async () => {
7209
- const method = new FirmwareUpdateV4({
7210
- id: 1,
7211
- payload: { method: 'firmwareUpdateV4', platform: 'web' },
7212
- });
7213
- method.init();
7214
- const configSpy = jest.spyOn(DataManager, 'getProtocolV2BootResources');
7215
- const downloadSpy = jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary');
7216
-
7217
- await expect((method as any).prepareProtocolV2BootResources()).resolves.toBeUndefined();
7218
-
7219
- expect(configSpy).not.toHaveBeenCalled();
7220
- expect(downloadSpy).not.toHaveBeenCalled();
7221
- });
7222
-
7223
- test('continues a normal resource update when boot resources are not configured', async () => {
7224
- const method = new FirmwareUpdateV4({
7225
- id: 1,
7226
- payload: { method: 'firmwareUpdateV4', platform: 'web', targetsToUpdate: ['resource'] },
7227
- });
7228
- method.init();
7229
- (method as any).device = stubDevice({ getCurrentDeviceType: () => 'pro2' });
7230
- jest.spyOn(DataManager, 'getProtocolV2BootResources').mockReturnValue(undefined);
7231
- const downloadSpy = jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary');
7232
-
7233
- await expect((method as any).prepareProtocolV2BootResources()).resolves.toBeUndefined();
7234
- expect(downloadSpy).not.toHaveBeenCalled();
7235
- });
7236
-
7237
- test('requires boot configuration for an explicit boot_resources target', async () => {
7238
- const method = new FirmwareUpdateV4({
7239
- id: 1,
7240
- payload: {
7241
- method: 'firmwareUpdateV4',
7242
- platform: 'web',
7243
- targetsToUpdate: ['boot_resources'],
7244
- },
7245
- });
7246
- method.init();
7247
- (method as any).device = stubDevice({ getCurrentDeviceType: () => 'pro2' });
7248
- jest.spyOn(DataManager, 'getProtocolV2BootResources').mockReturnValue(undefined);
7249
-
7250
- await expect((method as any).prepareProtocolV2BootResources()).rejects.toThrow(
7251
- 'Missing Protocol V2 boot resources configuration'
7252
- );
7253
- });
7254
-
7255
- test('skips downloading a boot resource when the installed SHA-256 matches', async () => {
7256
- const bytes = new Uint8Array([1, 2, 3, 4]);
7257
- const fileHash = Array.from(sha256(bytes), byte => byte.toString(16).padStart(2, '0')).join('');
7258
- const resource = {
7259
- required: false as const,
7260
- target: 'RES' as const,
7261
- files: [
7262
- {
7263
- name: 'bootloader_crest.bin',
7264
- url: 'https://example.com/bootloader_crest.bin',
7265
- devicePath: 'vol0:/assets/loaders/boot.staging/graphics/bootloader_crest.bin',
7266
- size: bytes.byteLength,
7267
- fileHash,
7268
- },
7269
- ],
7270
- };
7271
- const typedCall = jest.fn((name: string, _response: string, payload: any) => {
7272
- if (name === 'FilesystemPathInfoQuery') {
7273
- return Promise.resolve({
7274
- message: { exist: true, directory: false, size: bytes.byteLength },
7275
- });
7276
- }
7277
- if (name === 'FilesystemFileRead') {
7278
- const offset = Number(payload.file.offset);
7279
- return Promise.resolve({
7280
- message: { data: bytes.slice(offset, offset + Number(payload.chunk_len)) },
7281
- });
7282
- }
7283
- return Promise.reject(new Error(`Unexpected request: ${name}`));
7284
- });
7285
- const method = new FirmwareUpdateV4({
7286
- id: 1,
7287
- payload: { method: 'firmwareUpdateV4', platform: 'web', targetsToUpdate: ['resource'] },
7288
- });
7289
- method.init();
7290
- (method as any).device = stubDevice({
7291
- getCurrentDeviceType: () => 'pro2',
7292
- getCommands: () => ({ typedCall }),
7293
- });
7294
- jest.spyOn(DataManager, 'getProtocolV2BootResources').mockReturnValue(resource);
7295
- const downloadSpy = jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary');
7296
-
7297
- await expect((method as any).prepareProtocolV2BootResources()).resolves.toEqual([]);
7298
- expect(typedCall.mock.calls.map(call => call[0])).toEqual([
7299
- 'FilesystemPathInfoQuery',
7300
- 'FilesystemFileRead',
7301
- ]);
7302
- expect(downloadSpy).not.toHaveBeenCalled();
7303
- });
7304
-
7305
- test('rejects duplicate device paths across explicit and remote resource sources', () => {
7306
- const method = new FirmwareUpdateV4({
7307
- id: 1,
7308
- payload: { method: 'firmwareUpdateV4' },
7309
- });
7310
- const devicePath = 'vol0:/assets/shared.bin';
7311
-
7312
- expect(() =>
7313
- (method as any).mergeProtocolV2ResourceBundles(
7314
- [{ name: 'local.bin', binary: new ArrayBuffer(1), devicePath }],
7315
- [{ name: 'remote.bin', binary: new ArrayBuffer(1), devicePath }]
7316
- )
7317
- ).toThrow(`Duplicate Protocol V2 resource devicePath: ${devicePath}`);
7318
- });
7319
-
7320
- test('includes startup resources in the complete resource target', async () => {
7321
- const bytes = new Uint8Array([1, 2, 3, 4]);
7322
- const binary = bytes.buffer as ArrayBuffer;
7323
- const fileHash = Array.from(sha256(bytes), byte => byte.toString(16).padStart(2, '0')).join('');
7324
- const resource = {
7325
- required: false as const,
7326
- target: 'RES' as const,
7327
- files: [
7328
- {
7329
- name: 'bootloader_crest.bin',
7330
- url: 'https://example.com/bootloader_crest.bin',
7331
- devicePath: 'vol0:/assets/loaders/boot.staging/graphics/bootloader_crest.bin',
7332
- size: bytes.byteLength,
7333
- fileHash,
7334
- },
7335
- ],
7336
- };
7337
- const method = new FirmwareUpdateV4({
7338
- id: 1,
7339
- payload: {
7340
- method: 'firmwareUpdateV4',
7341
- platform: 'web',
7342
- targetsToUpdate: ['resource'],
7343
- },
7344
- });
7345
- method.init();
7346
- (method as any).device = stubDevice({ getCurrentDeviceType: () => 'pro2' });
7347
- jest.spyOn(DataManager, 'getProtocolV2BootResources').mockReturnValue(resource);
7348
- jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary').mockResolvedValue({ binary });
7349
-
7350
- await expect((method as any).prepareProtocolV2BootResources()).resolves.toEqual([
7351
- {
7352
- name: 'bootloader_crest.bin',
7353
- binary,
7354
- devicePath: 'vol0:/assets/loaders/boot.staging/graphics/bootloader_crest.bin',
7355
- },
7356
- ]);
7357
- });
7358
-
7359
7089
  test('rejects a manually supplied resource file when its manifest hash does not match', () => {
7360
7090
  const method = new FirmwareUpdateV4({
7361
7091
  id: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"CheckAllFirmwareRelease.d.ts","sourceRoot":"","sources":["../../src/api/CheckAllFirmwareRelease.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAId,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAyB1C,OAAO,KAAK,EACV,kBAAkB,EAElB,kCAAkC,EAClC,+BAA+B,EAChC,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,sBAAsB,E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 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
45
45
  private getRemoteComponentTarget;
46
46
  private downloadRemoteProtocolV2Component;
47
47
  private prepareRemoteProtocolV2Binaries;
48
- private getProtocolV2DeviceType;
49
- private prepareProtocolV2BootResources;
50
- private isProtocolV2BootResourceCurrent;
51
- private mergeProtocolV2ResourceBundles;
52
48
  private prepareExplicitProtocolV2ResourceFiles;
53
- private prepareProtocolV2ResourceBundles;
54
- private downloadProtocolV2Resource;
55
49
  private getProtocolV2ResourceFilePath;
56
50
  private readProtocolV2DeviceFileHeader;
57
51
  private isProtocolV2ResourceBundleUpToDate;
@@ -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;AAyBlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAwB/E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AA+CrC,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,sBAAsB,QAgB/B;AAgUD,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,iCAAiC,0BACrB,MAAM,uBACR,MAAM,iBACZ,MAAM,eACR,MAAM,SAsBpB,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC;IAC5F,OAAO,CAAC,8BAA8B,CAAC,CAAS;IAEhD,OAAO,CAAC,sBAAsB,CAAC,CAAS;IAExC,qBAAqB;IAIrB,OAAO,CAAC,yBAAyB,CAA4B;IAE7D,OAAO,CAAC,2BAA2B,CAAS;IAE5C,OAAO,CAAC,iCAAiC,C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;YAmB7B,gBAAgB;IAiB9B,OAAO,CAAC,qBAAqB;CAM9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"UploadPortfolio.d.ts","sourceRoot":"","sources":["../../src/api/UploadPortfolio.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAKF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAS;IACpD,IAAI;IAmBE,GAAG;;;;;;;;CASV"}
1
+ {"version":3,"file":"UploadPortfolio.d.ts","sourceRoot":"","sources":["../../src/api/UploadPortfolio.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAOF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAS;IACpD,IAAI;IAmBE,GAAG;;;;;;;;CAsBV"}
@@ -1,6 +1,8 @@
1
1
  import type { BaseMethod } from './BaseMethod';
2
2
  import type { IFrameCallMessage } from '../events';
3
+ import type { ProtocolType } from '@onekeyfe/hd-transport';
3
4
  export declare function findMethod(message: IFrameCallMessage & {
4
5
  id?: number;
5
6
  }): BaseMethod<any>;
7
+ export declare function getMethodSupportedProtocols(method: string, payload?: Record<string, unknown>): readonly ProtocolType[];
6
8
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAMnD,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAexF"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM3D,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAexF;AAOD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,SAAS,YAAY,EAAE,CAczB"}