@onekeyfe/hd-core 1.2.0-alpha.43 → 1.2.0-alpha.45

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.
@@ -98,11 +98,14 @@ describe('openWalletSession', () => {
98
98
  deviceWalletSessionStore.clear();
99
99
  });
100
100
 
101
- test('reuses the authoritative Main wallet DeviceStatus', async () => {
101
+ test('selects the standard wallet explicitly when passphrase is enabled', async () => {
102
102
  const typedCall = jest.fn((request: string) => {
103
103
  if (request === 'ProtocolInfoRequest') {
104
104
  return { message: { version: 2 } };
105
105
  }
106
+ if (request === 'DeviceSessionAskPassphrase') {
107
+ return { message: {} };
108
+ }
106
109
  if (request === 'DeviceSessionGet') {
107
110
  return {
108
111
  message: {
@@ -125,6 +128,39 @@ describe('openWalletSession', () => {
125
128
  });
126
129
 
127
130
  expect(device.unlockDevice).not.toHaveBeenCalled();
131
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPassphrase', 'Success', {
132
+ passphrase: '',
133
+ on_device: false,
134
+ });
135
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
136
+ seed_domains: [],
137
+ });
138
+ });
139
+
140
+ test('opens the standard wallet directly when passphrase is disabled', async () => {
141
+ const typedCall = jest.fn((request: string) => {
142
+ if (request === 'ProtocolInfoRequest') {
143
+ return { message: { version: 2 } };
144
+ }
145
+ if (request === 'DeviceSessionGet') {
146
+ return {
147
+ message: {
148
+ btc_test_address: 'standard-state',
149
+ session_id: 'standard-session',
150
+ },
151
+ };
152
+ }
153
+ throw new Error(`Unexpected request: ${request}`);
154
+ });
155
+ const device = createDevice({ passphraseProtection: false, typedCall });
156
+
157
+ await getProtocolV2WalletSession(device as any, { onlyMainPin: true });
158
+
159
+ expect(typedCall).not.toHaveBeenCalledWith(
160
+ 'DeviceSessionAskPassphrase',
161
+ 'Success',
162
+ expect.anything()
163
+ );
128
164
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
129
165
  seed_domains: [],
130
166
  });
@@ -135,6 +171,9 @@ describe('openWalletSession', () => {
135
171
  if (request === 'ProtocolInfoRequest') {
136
172
  return { message: { version: 2 } };
137
173
  }
174
+ if (request === 'DeviceSessionAskPassphrase') {
175
+ return { message: {} };
176
+ }
138
177
  if (request === 'DeviceSessionGet') {
139
178
  return {
140
179
  message: {
@@ -865,6 +904,7 @@ describe('openWalletSession', () => {
865
904
  const typedCall = jest
866
905
  .fn()
867
906
  .mockResolvedValueOnce({ message: { version: 2 } })
907
+ .mockResolvedValueOnce({ message: {} })
868
908
  .mockResolvedValueOnce({
869
909
  message: {
870
910
  btc_test_address: 'main-wallet-state',
@@ -887,11 +927,15 @@ describe('openWalletSession', () => {
887
927
  passphraseState: null,
888
928
  resumed: false,
889
929
  });
890
- expect(typedCall).toHaveBeenCalledTimes(2);
930
+ expect(typedCall).toHaveBeenCalledTimes(3);
891
931
  expect(typedCall).toHaveBeenCalledWith('ProtocolInfoRequest', 'ProtocolInfo', {
892
932
  eventless_wallet_session: true,
893
933
  });
894
934
  expect(device.unlockDevice).not.toHaveBeenCalled();
935
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPassphrase', 'Success', {
936
+ passphrase: '',
937
+ on_device: false,
938
+ });
895
939
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
896
940
  seed_domains: [],
897
941
  });
@@ -903,6 +947,7 @@ describe('openWalletSession', () => {
903
947
  const typedCall = jest
904
948
  .fn()
905
949
  .mockResolvedValueOnce({ message: { version: 2 } })
950
+ .mockResolvedValueOnce({ message: {} })
906
951
  .mockResolvedValueOnce({
907
952
  message: {
908
953
  btc_test_address: 'main-wallet-state',
@@ -954,6 +999,7 @@ describe('openWalletSession', () => {
954
999
  const typedCall = jest
955
1000
  .fn()
956
1001
  .mockResolvedValueOnce({ message: { version: 2 } })
1002
+ .mockResolvedValueOnce({ message: {} })
957
1003
  .mockResolvedValueOnce({
958
1004
  message: {
959
1005
  btc_test_address: 'main-wallet-state',
@@ -12,7 +12,12 @@ import {
12
12
  requestProtocolV2ResourceInventory,
13
13
  } from '../src/protocols/protocol-v2/resources';
14
14
 
15
- import type { ConnectSettings, IProtocolV2Resource, RemoteConfigResponse } from '../src/types';
15
+ import type {
16
+ ConnectSettings,
17
+ IProtocolV2BootResources,
18
+ IProtocolV2Resource,
19
+ RemoteConfigResponse,
20
+ } from '../src/types';
16
21
 
17
22
  jest.mock('axios');
18
23
  jest.mock('../src/data/config', () => ({
@@ -31,6 +36,16 @@ const resources: IProtocolV2Resource[] = PROTOCOL_V2_RESOURCE_TYPES.map((type, i
31
36
  headerHash: index.toString(16).padStart(128, '0'),
32
37
  }));
33
38
 
39
+ const bootResources: IProtocolV2BootResources = {
40
+ required: false,
41
+ target: 'CRATE',
42
+ url: 'https://example.com/boot-resources.crate.okpkg',
43
+ size: 1234,
44
+ fileHash: 'ab'.repeat(32),
45
+ payloadHash: 'cd'.repeat(64),
46
+ headerHash: 'ef'.repeat(64),
47
+ };
48
+
34
49
  const createSettings = (configFetcher: ConnectSettings['configFetcher']): ConnectSettings =>
35
50
  ({
36
51
  env: 'node',
@@ -47,7 +62,7 @@ const createRemoteConfig = (): RemoteConfigResponse =>
47
62
  mini: { firmware: [], ble: [] },
48
63
  touch: { firmware: [], ble: [] },
49
64
  pro: { firmware: [], ble: [] },
50
- pro2: { firmware: [], ble: [], resources: { stable: resources } },
65
+ pro2: { firmware: [], ble: [], resources: { stable: resources, boot: bootResources } },
51
66
  bridge: {},
52
67
  } as unknown as RemoteConfigResponse);
53
68
 
@@ -58,9 +73,13 @@ describe('Pro2 resource configuration', () => {
58
73
  });
59
74
 
60
75
  test('accepts exactly six resources and normalizes their deterministic order', () => {
61
- const parsed = parseProtocolV2Resources({ stable: [...resources].reverse() });
76
+ const parsed = parseProtocolV2Resources({
77
+ stable: [...resources].reverse(),
78
+ boot: bootResources,
79
+ });
62
80
 
63
81
  expect(parsed?.stable.map(item => item.type)).toEqual(PROTOCOL_V2_RESOURCE_TYPES);
82
+ expect(parsed?.boot).toEqual(bootResources);
64
83
  expect(PROTOCOL_V2_RESOURCE_DEVICE_PATHS.translations).toBe(
65
84
  'vol0:/bundles/translations/translations.okpkg'
66
85
  );
@@ -82,6 +101,21 @@ describe('Pro2 resource configuration', () => {
82
101
  ).toThrow('headerHash');
83
102
  });
84
103
 
104
+ test('requires boot resources to remain optional and use a CRATE package', () => {
105
+ expect(() =>
106
+ parseProtocolV2Resources({
107
+ stable: resources,
108
+ boot: { ...bootResources, required: true },
109
+ })
110
+ ).toThrow('required flag');
111
+ expect(() =>
112
+ parseProtocolV2Resources({
113
+ stable: resources,
114
+ boot: { ...bootResources, target: 'RESC' },
115
+ })
116
+ ).toThrow('expected CRATE');
117
+ });
118
+
85
119
  test('downloads nothing when all resource identities match', () => {
86
120
  const inventory = resources.map(({ type, size, headerHash }) => ({ type, size, headerHash }));
87
121
 
@@ -186,6 +220,7 @@ describe('Pro2 resource configuration', () => {
186
220
  expect.stringMatching(/^https:\/\/data\.onekey\.so\/pre-config\.json\?noCache=/)
187
221
  );
188
222
  expect(DataManager.getProtocolV2Resources()).toEqual(resources);
223
+ expect(DataManager.getProtocolV2BootResources()).toEqual(bootResources);
189
224
  });
190
225
 
191
226
  test('does not advance the cache timestamp when refresh fails', async () => {
@@ -5,6 +5,7 @@ import {
5
5
  DeviceSettingsPage,
6
6
  DeviceType,
7
7
  } from '@onekeyfe/hd-transport';
8
+ import { sha256 } from '@noble/hashes/sha256';
8
9
 
9
10
  import * as firmwareBinaryApi from '../src/api/firmware/getBinary';
10
11
  import DnxGetAddress from '../src/api/dynex/DnxGetAddress';
@@ -786,6 +787,9 @@ describe('Protocol V2 feature adapter', () => {
786
787
  if (request === 'DeviceStatusGet') {
787
788
  return { type: 'DeviceStatus', message: { unlocked: true } };
788
789
  }
790
+ if (request === 'DeviceSessionAskPassphrase') {
791
+ return { type: 'Success', message: {} };
792
+ }
789
793
  if (request === 'DeviceSessionGet') {
790
794
  return {
791
795
  type: 'DeviceSession',
@@ -819,6 +823,10 @@ describe('Protocol V2 feature adapter', () => {
819
823
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPin', 'Success', {
820
824
  type: DeviceSessionPinType.Main,
821
825
  });
826
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPassphrase', 'Success', {
827
+ passphrase: '',
828
+ on_device: false,
829
+ });
822
830
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
823
831
  seed_domains: [],
824
832
  });
@@ -854,6 +862,7 @@ describe('Protocol V2 feature adapter', () => {
854
862
  },
855
863
  };
856
864
  }
865
+ if (request === 'DeviceSessionAskPassphrase') return { message: {} };
857
866
  if (request === 'DeviceSessionGet') {
858
867
  return {
859
868
  message: {
@@ -870,6 +879,9 @@ describe('Protocol V2 feature adapter', () => {
870
879
  await getProtocolV2WalletSession(device, { onlyMainPin: true });
871
880
 
872
881
  expect(typedCall.mock.calls.filter(call => call[0] === 'DeviceSessionAskPin')).toHaveLength(1);
882
+ expect(
883
+ typedCall.mock.calls.filter(call => call[0] === 'DeviceSessionAskPassphrase')
884
+ ).toHaveLength(1);
873
885
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
874
886
  seed_domains: [],
875
887
  });
@@ -918,6 +930,7 @@ describe('Protocol V2 feature adapter', () => {
918
930
  },
919
931
  };
920
932
  }
933
+ if (request === 'DeviceSessionAskPassphrase') return { message: {} };
921
934
  if (request === 'DeviceSessionAskPin') {
922
935
  return { type: 'Success', message: { message: 'PIN verified' } };
923
936
  }
@@ -1012,6 +1025,7 @@ describe('Protocol V2 feature adapter', () => {
1012
1025
  if (request === 'DeviceStatusGet') {
1013
1026
  return { message: { device_id: deviceId, unlocked: true, passphrase_enabled: true } };
1014
1027
  }
1028
+ if (request === 'DeviceSessionAskPassphrase') return { message: {} };
1015
1029
  if (request === 'DeviceSessionGet') {
1016
1030
  sessionGetCalls += 1;
1017
1031
  return {
@@ -2415,13 +2429,18 @@ describe('Protocol V2 feature adapter', () => {
2415
2429
  await expect(
2416
2430
  device.checkPassphraseStateSafety('stale-hidden-state', true, false)
2417
2431
  ).resolves.toBe(true);
2418
- expect(typedCall).toHaveBeenCalledTimes(2);
2432
+ expect(typedCall).toHaveBeenCalledTimes(4);
2419
2433
  expect(typedCall).toHaveBeenCalledWith('ProtocolInfoRequest', 'ProtocolInfo', {
2420
2434
  eventless_wallet_session: true,
2421
2435
  });
2422
2436
  expect(typedCall).toHaveBeenCalledWith('DeviceSessionGet', 'DeviceSession', {
2423
2437
  seed_domains: [],
2424
2438
  });
2439
+ expect(typedCall).toHaveBeenCalledWith('DeviceSessionAskPassphrase', 'Success', {
2440
+ passphrase: '',
2441
+ on_device: false,
2442
+ });
2443
+ expect(typedCall).toHaveBeenCalledWith('DeviceStatusGet', 'DeviceStatus', {});
2425
2444
  expect(typedCall).not.toHaveBeenCalledWith('DeviceSessionAskPin', 'Success', expect.anything());
2426
2445
  });
2427
2446
 
@@ -5965,6 +5984,100 @@ describe('Protocol V2 firmware reconnect identity', () => {
5965
5984
  expect((method as any).downloadProtocolV2Resource).toHaveBeenCalledTimes(6);
5966
5985
  resourcesSpy.mockRestore();
5967
5986
  });
5987
+
5988
+ const buildBootResourcesHeader = ({
5989
+ type = 'CRAT',
5990
+ payloadHash = 'ab'.repeat(64),
5991
+ headerHash = 'cd'.repeat(64),
5992
+ }: {
5993
+ type?: string;
5994
+ payloadHash?: string;
5995
+ headerHash?: string;
5996
+ } = {}) => {
5997
+ const header = new Uint8Array(0x52a0);
5998
+ const view = new DataView(header.buffer);
5999
+ 'OKPP'.split('').forEach((char, index) => {
6000
+ header[index] = char.charCodeAt(0);
6001
+ });
6002
+ type.split('').forEach((char, index) => {
6003
+ header[0x08 + index] = char.charCodeAt(0);
6004
+ });
6005
+ view.setUint32(0x0c, header.byteLength, true);
6006
+ const writeHex = (offset: number, hex: string) => {
6007
+ for (let index = 0; index < hex.length / 2; index++) {
6008
+ header[offset + index] = Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16);
6009
+ }
6010
+ };
6011
+ writeHex(0x200, payloadHash);
6012
+ writeHex(0x240, headerHash);
6013
+ return header;
6014
+ };
6015
+
6016
+ test('does not resolve boot resources unless the optional target is selected', async () => {
6017
+ const method = new FirmwareUpdateV4({
6018
+ id: 1,
6019
+ payload: { method: 'firmwareUpdateV4', platform: 'web' },
6020
+ });
6021
+ method.init();
6022
+ const configSpy = jest.spyOn(DataManager, 'getProtocolV2BootResources');
6023
+ const downloadSpy = jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary');
6024
+
6025
+ await expect((method as any).prepareProtocolV2BootResources()).resolves.toBeUndefined();
6026
+
6027
+ expect(configSpy).not.toHaveBeenCalled();
6028
+ expect(downloadSpy).not.toHaveBeenCalled();
6029
+ });
6030
+
6031
+ test('downloads and maps the selected boot resources CRATE target', async () => {
6032
+ const payloadHash = 'ab'.repeat(64);
6033
+ const headerHash = 'cd'.repeat(64);
6034
+ const bytes = buildBootResourcesHeader({ payloadHash, headerHash });
6035
+ const binary = bytes.buffer as ArrayBuffer;
6036
+ const fileHash = Array.from(sha256(bytes), byte => byte.toString(16).padStart(2, '0')).join('');
6037
+ const resource = {
6038
+ required: false as const,
6039
+ target: 'CRATE' as const,
6040
+ url: 'https://example.com/boot-resources.crate.okpkg',
6041
+ size: bytes.byteLength,
6042
+ fileHash,
6043
+ payloadHash,
6044
+ headerHash,
6045
+ };
6046
+ const method = new FirmwareUpdateV4({
6047
+ id: 1,
6048
+ payload: {
6049
+ method: 'firmwareUpdateV4',
6050
+ platform: 'web',
6051
+ targetsToUpdate: ['boot_resources'],
6052
+ },
6053
+ });
6054
+ method.init();
6055
+ jest.spyOn(DataManager, 'getProtocolV2BootResources').mockReturnValue(resource);
6056
+ jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary').mockResolvedValue({ binary });
6057
+
6058
+ await expect((method as any).prepareProtocolV2BootResources()).resolves.toEqual({
6059
+ fileName: 'boot_resources.crate.okpkg',
6060
+ binary,
6061
+ targetId: 1,
6062
+ kind: 'boot_resources',
6063
+ });
6064
+ });
6065
+
6066
+ test('rejects a non-CRATE manual boot resources package', async () => {
6067
+ const method = new FirmwareUpdateV4({
6068
+ id: 1,
6069
+ payload: {
6070
+ method: 'firmwareUpdateV4',
6071
+ platform: 'web',
6072
+ bootResourcesBinary: buildBootResourcesHeader({ type: 'RESC' }).buffer,
6073
+ },
6074
+ });
6075
+ method.init();
6076
+
6077
+ await expect((method as any).prepareProtocolV2BootResources()).rejects.toThrow(
6078
+ 'Invalid Pro2 boot resources CRATE header'
6079
+ );
6080
+ });
5968
6081
  });
5969
6082
 
5970
6083
  describe('Protocol V2 explicit USB device selection', () => {
@@ -26,6 +26,8 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
26
26
  private getRemoteComponentTarget;
27
27
  private downloadRemoteProtocolV2Component;
28
28
  private prepareRemoteProtocolV2Binaries;
29
+ private validateProtocolV2BootResourcesBinary;
30
+ private prepareProtocolV2BootResources;
29
31
  private prepareProtocolV2ResourceBundles;
30
32
  private downloadProtocolV2Resource;
31
33
  private syncProtocolV2ResourceBundles;
@@ -1 +1 @@
1
- {"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAkB/E,OAAO,KAAK,EAAE,sBAAsB,EAA0B,MAAM,6BAA6B,CAAC;AA+TlG,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,iCAAiC,0BACrB,MAAM,uBACR,MAAM,SAc5B,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC;IAC5F,OAAO,CAAC,8BA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B,gBAAgB;IAiB9B,OAAO,CAAC,qBAAqB;CAM9B"}
@@ -46,6 +46,7 @@ export default class DataManager {
46
46
  static checkAndReloadData(): Promise<void>;
47
47
  static forceReloadData(): Promise<void>;
48
48
  static getProtocolV2Resources(): import("../types").IProtocolV2Resource[] | undefined;
49
+ static getProtocolV2BootResources(): import("../types").IProtocolV2BootResources | undefined;
49
50
  static getProtobufMessages(schema?: ProtobufMessageSchema): JSON;
50
51
  static getSettings(key?: undefined): ConnectSettings;
51
52
  static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
@@ -1 +1 @@
1
- {"version":3,"file":"DataManager.d.ts","sourceRoot":"","sources":["../../src/data-manager/DataManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAmBjE,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,aAAa,EACb,QAAQ,EACR,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EAEd,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,eAAe,uFAMlB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAC3E,MAAM,MAAM,qBAAqB,GAAG,uBAAuB,GAAG,UAAU,CAAC;AAsBzE,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,MAAM,CAAC,SAAS,EAAE,aAAa,GAAG;QAChC,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,aAAa,CAAC,GAAG,SAAS,CAAC;KAC7D,CA6BC;IAEF,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAQ;IAEvC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEjC,MAAM,CAAC,QAAQ,EAAE;SAAG,MAAM,IAAI,qBAAqB,GAAG,IA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AAC,WAAW,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,eAAe;IAEpD,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC;IAU/E,MAAM,CAAC,YAAY,QAAS,eAAe,CAAC,KAAK,CAAC,aAC0B;IAG5E,MAAM,CAAC,eAAe,QAAS,eAAe,CAAC,KAAK,CAAC,aAA8B;IAGnF,MAAM,CAAC,eAAe,QAAS,eAAe,CAAC,KAAK,CAAC,aAAsB;CAC5E"}
package/dist/index.d.ts CHANGED
@@ -215,8 +215,23 @@ type IProtocolV2Resource = {
215
215
  /** SHA3-512 header_hash from the signed okpkg header. */
216
216
  headerHash: string;
217
217
  };
218
+ /** Optional Pro2 startup-resource CRATE installed by the bootloader updater. */
219
+ type IProtocolV2BootResources = {
220
+ required: false;
221
+ target: 'CRATE';
222
+ url: string;
223
+ /** Complete CRATE file size in bytes. */
224
+ size: number;
225
+ /** SHA-256 of the complete CRATE file. */
226
+ fileHash: string;
227
+ /** SHA3-512 payload_hash from the signed CRATE header. */
228
+ payloadHash: string;
229
+ /** SHA3-512 header_hash from the signed CRATE header. */
230
+ headerHash: string;
231
+ };
218
232
  type IProtocolV2Resources = {
219
233
  stable: IProtocolV2Resource[];
234
+ boot?: IProtocolV2BootResources;
220
235
  };
221
236
  /** Pro2 RESC bundle okpkg descriptor for incremental FileWrite synchronization. */
222
237
  type IProtocolV2ResourceBundle = {
@@ -1251,7 +1266,7 @@ interface FirmwareUpdateV3Params {
1251
1266
  * firmwareUpdateV4 target binaries grouped by DeviceFirmwareTargetType.
1252
1267
  * Except for romloader, each field maps to a target accepted by bootloader.
1253
1268
  */
1254
- type FirmwareUpdateV4Target = 'boot' | 'app_v1' | 'app_v2' | 'coprocessor' | 'resource' | 'se01' | 'se02' | 'se03' | 'se04';
1269
+ type FirmwareUpdateV4Target = 'boot' | 'boot_resources' | 'app_v1' | 'app_v2' | 'coprocessor' | 'resource' | 'se01' | 'se02' | 'se03' | 'se04';
1255
1270
  interface FirmwareUpdateV4Params {
1256
1271
  platform: IPlatform;
1257
1272
  chunkSize?: number;
@@ -1261,6 +1276,8 @@ interface FirmwareUpdateV4Params {
1261
1276
  romloaderBinary?: ArrayBuffer;
1262
1277
  /** FW_MGMT_TARGET_BOOTLOADER = 3 */
1263
1278
  bootloaderBinary?: ArrayBuffer;
1279
+ /** FW_MGMT_TARGET_CRATE = 1; optional Pro2 startup resources. */
1280
+ bootResourcesBinary?: ArrayBuffer;
1264
1281
  /** FW_MGMT_TARGET_APPLICATION_P1 = 4 */
1265
1282
  applicationP1Binary?: ArrayBuffer;
1266
1283
  /** FW_MGMT_TARGET_APPLICATION_P2 = 5 */
@@ -4531,6 +4548,7 @@ declare class DataManager {
4531
4548
  /** Force a fresh remote config before an update is allowed to mutate the device. */
4532
4549
  static forceReloadData(): Promise<void>;
4533
4550
  static getProtocolV2Resources(): IProtocolV2Resource[] | undefined;
4551
+ static getProtocolV2BootResources(): IProtocolV2BootResources | undefined;
4534
4552
  static getProtobufMessages(schema?: ProtobufMessageSchema): JSON;
4535
4553
  static getSettings(key?: undefined): ConnectSettings;
4536
4554
  static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
@@ -4643,4 +4661,4 @@ declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, can
4643
4661
  declare const HardwareSDKLowLevel: ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, updateSettings, switchTransport, }: LowLevelInjectApi) => LowLevelCoreApi;
4644
4662
  declare const HardwareTopLevelSdk: () => CoreApi;
4645
4663
 
4646
- export { AccountAddress, AccountAddresses, AlephiumAddress, AlephiumGetAddressParams, AlephiumSignMessageParams, AlephiumSignTransactionParams, AlephiumSignedTx, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AllFirmwareRelease, AllNetworkAddressParams, AllNetworkGetAddressParams, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignInMessageParams, AptosSignInMessageSignature, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BenfenAddress, BenfenGetAddressParams, BenfenGetPublicKeyParams, BenfenPublicKey, BenfenSignMessageParams, BenfenSignTransactionParams, BenfenSignedTx, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignMessageMethodParams, CardanoSignMessageParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, ClearSessionCacheParams, ClearSessionCachePayload, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DEVICE_SETTINGS_SHARED_FIELDS, DEVICE_SETTINGS_V1_ONLY_FIELDS, DEVICE_SETTINGS_V2_ONLY_FIELDS, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesMode, DeviceFeaturesPayload, DeviceFeaturesProtocol, DeviceFeaturesRaw, DeviceFeaturesRawPatch, DeviceFeaturesVerify, DeviceFirmwareRange, DeviceFlagsParams, DeviceModelToTypes, DeviceProgress, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendState, DeviceSendSupportFeatures, DeviceSettingsCapabilities, DeviceSettingsDurationOption, DeviceSettingsField, DeviceSettingsParams, DeviceSettingsProtocol, DeviceSettingsValueOption, DeviceState, DeviceStateEvent, DeviceStateIdentity, DeviceStateMode, DeviceStatePatch, DeviceStateProtocol, DeviceStateScope, DeviceStateSection, DeviceStateSettings, DeviceStateStatus, DeviceStateUpdateSource, DeviceStateVersions, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceUploadResourceResponse, DeviceVerifyParams, DeviceVerifySignature, DnxAddress, DnxGetAddressParams, DnxSignTransactionParams, DnxSignature, DnxTxKey, EOneKeyDeviceMode, EVMAccessList, EVMAddress, EVMAuthorization, EVMAuthorizationSignature, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMTransactionEIP7702, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProcessing, FirmwareProgress, FirmwareRange, FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, FirmwareUpdateTipMessage, FirmwareUpdateV3Params, FirmwareUpdateV4Params, FirmwareUpdateV4Target, GetDeviceStateParams, GetPassphraseStateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, HardwareUiInteractionMeta, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareField, IFirmwareReleaseInfo, IFirmwareUpdateProgressType, IFirmwareUpdateTipMessage, IFrameBridge, IFrameCallMessage, IFrameCallback, IFrameCallbackMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, IFrameSwitchTransport, IFrameSwitchTransportMessage, ILocale, IProtocolV2FirmwareComponent, IProtocolV2FirmwareComponentTarget, IProtocolV2Resource, IProtocolV2ResourceBundle, IProtocolV2ResourceType, IProtocolV2Resources, ITransportStatus, IVersionArray, IVersionRange, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KaspaStreamingSignInputParams, KaspaStreamingSignOutputParams, KnownDevice, LOG, LOG_EVENT, LogBlockEvent, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NervosAddress, NervosGetAddressParams, NervosSignTransactionParams, NervosSignedTx, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, NormalizedFeatures, OnekeyFeatures, OpenWalletSessionMode, OpenWalletSessionModeValue, OpenWalletSessionParams, OpenWalletSessionPayload, PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH, PROTOCOL_V2_NEVER_TIMEOUT_MS, Params, PassphraseRequestPayload, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, Pro2WallpaperColorFormat, ProtocolV2FirmwareComponentRelease, ProtocolV2FirmwareComponentReleaseStatus, ProtocolV2FirmwareReleaseStatus, ProtocolV2UiCompletion, ProtocolV2UiEventMetadata, ProtocolV2UiEventSource, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, RequestContext, Response, ScdoAddress, ScdoGetAddressParams, ScdoSignMessageParams, ScdoSignTransactionParams, ScdoSignedTx, SdkTracingContext, SearchDevice, SignedTransaction, SolSignMessageParams, SolSignMessageResponse, SolSignOffchainMessageParams, SolSignOffchainMessageResponse, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignMessageParams, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TestProtocolV2PingParams, TonAddress, TonGetAddressParams, TonSignDataParams, TonSignMessageParams, TonSignProofParams, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestFirmwareProgressing, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestSelectDeviceForSwitchFirmwareWebDevice, UiRequestSelectDeviceInBootloaderForWebDevice, UiRequestWindowClose, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UiResponseSelectDeviceForSwitchFirmwareWebDevice, UiResponseSelectDeviceInBootloaderForWebDevice, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, cleanupCallback, cleanupSdkInstance, completeRequestContext, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createRequestContext, createResponseMessage, createSdkTracingContext, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, encodePro2Wallpaper, executeCallback, formatLogMethodLabel, formatRequestContext, generateInstanceId, generateSdkInstanceId, getActiveRequestsByDeviceInstance, getAutoLockOptions, getAutoShutDownOptions, getDeviceBLEFirmwareVersion, getDeviceBleName, getDeviceBoardloaderVersion, getDeviceBootloaderVersion, getDeviceFirmwareVersion, getDeviceLabel, getDeviceSerialNo, getDeviceSettingsCapabilities, getDeviceType, getDeviceTypeByBleName, getDeviceUUID, getEnv, getFirmwareType, getFirmwareUpdateField, getFirmwareUpdateFieldArray, getHDPath, getHomeScreenDefaultList, getHomeScreenHex, getHomeScreenSize, getLanguageConfig, getLog, getLogBlockLabel, getLogger, getMethodVersionRange, getNftSize, getOutputScriptType, getSDKVersion, getSafeLogPayload, getScriptType, getTimeStamp, httpRequest, init$1 as initCore, isBleConnect, isValidVersionArray, isValidVersionString, normalizeSafetyCheckLevel, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, preloadSessionCache, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, switchTransport, transportEnv, updateRequestContext, versionCompare, versionSplit, wait, whitelist, whitelistExtension };
4664
+ export { AccountAddress, AccountAddresses, AlephiumAddress, AlephiumGetAddressParams, AlephiumSignMessageParams, AlephiumSignTransactionParams, AlephiumSignedTx, AlgoAddress, AlgoGetAddressParams, AlgoSignTransactionParams, AlgoSignedTx, AllFirmwareRelease, AllNetworkAddressParams, AllNetworkGetAddressParams, AptosAddress, AptosGetAddressParams, AptosGetPublicKeyParams, AptosMessageSignature, AptosPublicKey, AptosSignInMessageParams, AptosSignInMessageSignature, AptosSignMessageParams, AptosSignTransactionParams, AptosSignedTx, AssetsMap, BTCAddress, BTCGetAddressParams, BTCGetPublicKeyParams, BTCPublicKey, BTCSignMessageParams, BTCSignTransactionParams, BTCVerifyMessageParams, BenfenAddress, BenfenGetAddressParams, BenfenGetPublicKeyParams, BenfenPublicKey, BenfenSignMessageParams, BenfenSignTransactionParams, BenfenSignedTx, BleReleaseInfoEvent, BleReleaseInfoPayload, CORE_EVENT, CallMethod, CallMethodAnyResponse, CallMethodKeys, CallMethodPayload, CallMethodResponse, CallMethodUnion, CardanoAddress, CardanoGetAddressMethodParams, CardanoGetAddressParams, CardanoSignMessageMethodParams, CardanoSignMessageParams, CardanoSignTransaction, CardanoSignedTxData, CipheredKeyValue, CipheredKeyValueParams, ClearSessionCacheParams, ClearSessionCachePayload, CommonParams, ConfluxAddress, ConfluxGetAddressParams, ConfluxSignMessageCIP23Params, ConfluxSignMessageParams, ConfluxSignTransactionParams, ConfluxSignedTx, ConfluxTransaction, ConnectSettings, Core, CoreApi, CoreMessage, CosmosAddress, CosmosGetAddressParams, CosmosGetPublicKeyParams, CosmosPublicKey, CosmosSignTransactionParams, CosmosSignedTx, DEFAULT_PRIORITY, DEVICE, DEVICE_EVENT, DEVICE_SETTINGS_SHARED_FIELDS, DEVICE_SETTINGS_V1_ONLY_FIELDS, DEVICE_SETTINGS_V2_ONLY_FIELDS, DataManager, Device$1 as Device, DeviceButtonRequest, DeviceButtonRequestPayload, DeviceChangePinParams, DeviceConnnectRequest, DeviceDisconnnectRequest, DeviceEvent, DeviceEventListenerFn, DeviceEventMessage, DeviceFeaturesMode, DeviceFeaturesPayload, DeviceFeaturesProtocol, DeviceFeaturesRaw, DeviceFeaturesRawPatch, DeviceFeaturesVerify, DeviceFirmwareRange, DeviceFlagsParams, DeviceModelToTypes, DeviceProgress, DeviceRecoveryParams, DeviceResetParams, DeviceSendFeatures, DeviceSendState, DeviceSendSupportFeatures, DeviceSettingsCapabilities, DeviceSettingsDurationOption, DeviceSettingsField, DeviceSettingsParams, DeviceSettingsProtocol, DeviceSettingsValueOption, DeviceState, DeviceStateEvent, DeviceStateIdentity, DeviceStateMode, DeviceStatePatch, DeviceStateProtocol, DeviceStateScope, DeviceStateSection, DeviceStateSettings, DeviceStateStatus, DeviceStateUpdateSource, DeviceStateVersions, DeviceStatus, DeviceSupportFeatures, DeviceSupportFeaturesPayload, DeviceTypeMap, DeviceTypeToModels, DeviceUploadResourceParams, DeviceUploadResourceResponse, DeviceVerifyParams, DeviceVerifySignature, DnxAddress, DnxGetAddressParams, DnxSignTransactionParams, DnxSignature, DnxTxKey, EOneKeyDeviceMode, EVMAccessList, EVMAddress, EVMAuthorization, EVMAuthorizationSignature, EVMGetAddressParams, EVMGetPublicKeyParams, EVMPublicKey, EVMSignMessageEIP712Params, EVMSignMessageParams, EVMSignTransactionParams, EVMSignTypedDataParams, EVMSignedTx, EVMTransaction, EVMTransactionEIP1559, EVMTransactionEIP7702, EVMVerifyMessageParams, EthereumSignTypedDataMessage, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataTypes, FIRMWARE, FIRMWARE_EVENT, Features, FilecoinAddress, FilecoinGetAddressParams, FilecoinSignTransactionParams, FilecoinSignedTx, FirmwareEvent, FirmwareMessage, FirmwareProcessing, FirmwareProgress, FirmwareRange, FirmwareRelease, FirmwareTip, FirmwareUpdateBinaryParams, FirmwareUpdateParams, FirmwareUpdateTipMessage, FirmwareUpdateV3Params, FirmwareUpdateV4Params, FirmwareUpdateV4Target, GetDeviceStateParams, GetPassphraseStateParams, HardwareSDKLowLevel, HardwareTopLevelSdk, HardwareUiInteractionMeta, IBLEFirmwareReleaseInfo, IDeviceBLEFirmwareStatus, IDeviceFirmwareStatus, IDeviceModel, IDeviceType, IFRAME, IFirmwareField, IFirmwareReleaseInfo, IFirmwareUpdateProgressType, IFirmwareUpdateTipMessage, IFrameBridge, IFrameCallMessage, IFrameCallback, IFrameCallbackMessage, IFrameCancelMessage, IFrameEvent, IFrameEventMessage, IFrameInit, IFrameSwitchTransport, IFrameSwitchTransportMessage, ILocale, IProtocolV2BootResources, IProtocolV2FirmwareComponent, IProtocolV2FirmwareComponentTarget, IProtocolV2Resource, IProtocolV2ResourceBundle, IProtocolV2ResourceType, IProtocolV2Resources, ITransportStatus, IVersionArray, IVersionRange, KaspaAddress, KaspaGetAddressParams, KaspaSignInputParams, KaspaSignOutputParams, KaspaSignTransactionParams, KaspaSignature, KaspaStreamingSignInputParams, KaspaStreamingSignOutputParams, KnownDevice, LOG, LOG_EVENT, LogBlockEvent, LogEvent, LogEventMessage, LogOutput, LoggerNames, LowLevelCoreApi, LowLevelInjectApi, MajorVersion, MethodResponseMessage, NEMAddress, NEMAggregateModificationTransaction, NEMGetAddressParams, NEMImportanceTransaction, NEMMosaic, NEMMosaicCreationTransaction, NEMMultisigTransaction, NEMProvisionNamespaceTransaction, NEMSignTransactionParams, NEMSupplyChangeTransaction, NEMTransaction, NEMTransferTransaction, NearAddress, NearGetAddressParams, NearSignTransactionParams, NervosAddress, NervosGetAddressParams, NervosSignTransactionParams, NervosSignedTx, NexaAddress, NexaGetAddressParams, NexaSignInputParams, NexaSignOutputParams, NexaSignTransactionParams, NexaSignature, NormalizedFeatures, OnekeyFeatures, OpenWalletSessionMode, OpenWalletSessionModeValue, OpenWalletSessionParams, OpenWalletSessionPayload, PRO2_WALLPAPER_HEIGHT, PRO2_WALLPAPER_WIDTH, PROTOCOL_V2_NEVER_TIMEOUT_MS, Params, PassphraseRequestPayload, PolkadotAddress, PolkadotGetAddressParams, PolkadotSignTransactionParams, PolkadotSignedTx, PostMessageEvent, PreviousAddressResult, Pro2WallpaperColorFormat, ProtocolV2FirmwareComponentRelease, ProtocolV2FirmwareComponentReleaseStatus, ProtocolV2FirmwareReleaseStatus, ProtocolV2UiCompletion, ProtocolV2UiEventMetadata, ProtocolV2UiEventSource, RESPONSE_EVENT, RefTransaction, ReleaseInfo, ReleaseInfoEvent, ReleaseInfoPayload, RemoteConfigResponse, RequestContext, Response, ScdoAddress, ScdoGetAddressParams, ScdoSignMessageParams, ScdoSignTransactionParams, ScdoSignedTx, SdkTracingContext, SearchDevice, SignedTransaction, SolSignMessageParams, SolSignMessageResponse, SolSignOffchainMessageParams, SolSignOffchainMessageResponse, SolanaAddress, SolanaGetAddressParams, SolanaSignTransactionParams, SolanaSignedTx, StarcoinAddress, StarcoinGetAddressParams, StarcoinGetPublicKeyParams, StarcoinPublicKey, StarcoinSignMessageParams, StarcoinSignTransactionParams, StarcoinVerifyMessageParams, StellarAddress, StellarAsset, StellarGetAddressParams, StellarOperation, StellarSignTransactionParams, StellarTransaction, StrictFeatures, Success, SuiAddress, SuiGetAddressParams, SuiGetPublicKeyParams, SuiPublicKey, SuiSignMessageParams, SuiSignTransactionParams, SuiSignedTx, SupportFeatureType, SupportFeatures, TestProtocolV2PingParams, TonAddress, TonGetAddressParams, TonSignDataParams, TonSignMessageParams, TonSignProofParams, TopLevelInjectApi, TransactionOptions, TransportReleaseStatus, TronAddress, TronDelegateResourceContract, TronFreezeBalanceV2Contract, TronGetAddressParams, TronSignMessageParams, TronSignTransactionParams, TronTransaction, TronTransactionContract, TronTransferContract, TronTriggerSmartContract, TronUnDelegateResourceContract, TronUnfreezeBalanceV2Contract, TronWithdrawBalanceContract, TronWithdrawExpireUnfreezeContract, UI_EVENT, UI_REQUEST, UI_RESPONSE, UiEvent, UiEventMessage, UiPromise, UiPromiseResponse, UiRequestButton, UiRequestDeviceAction, UiRequestFirmwareProgressing, UiRequestPassphrase, UiRequestPassphraseOnDevice, UiRequestSelectDeviceForSwitchFirmwareWebDevice, UiRequestSelectDeviceInBootloaderForWebDevice, UiRequestWindowClose, UiRequestWithoutPayload, UiResponseEvent, UiResponseMessage, UiResponsePassphrase, UiResponsePin, UiResponseSelectDeviceForSwitchFirmwareWebDevice, UiResponseSelectDeviceInBootloaderForWebDevice, UnavailableCapabilities, UnavailableCapability, Unsuccessful, VersionArray, checkNeedUpdateBootForClassicAndMini, checkNeedUpdateBootForTouch, cleanupCallback, cleanupSdkInstance, completeRequestContext, corsValidator, createDeviceMessage, createErrorMessage, createFirmwareMessage, createIFrameMessage, createLogMessage, createRequestContext, createResponseMessage, createSdkTracingContext, createUiMessage, createUiResponse, HardwareSdk as default, enableLog, encodePro2Wallpaper, executeCallback, formatLogMethodLabel, formatRequestContext, generateInstanceId, generateSdkInstanceId, getActiveRequestsByDeviceInstance, getAutoLockOptions, getAutoShutDownOptions, getDeviceBLEFirmwareVersion, getDeviceBleName, getDeviceBoardloaderVersion, getDeviceBootloaderVersion, getDeviceFirmwareVersion, getDeviceLabel, getDeviceSerialNo, getDeviceSettingsCapabilities, getDeviceType, getDeviceTypeByBleName, getDeviceUUID, getEnv, getFirmwareType, getFirmwareUpdateField, getFirmwareUpdateFieldArray, getHDPath, getHomeScreenDefaultList, getHomeScreenHex, getHomeScreenSize, getLanguageConfig, getLog, getLogBlockLabel, getLogger, getMethodVersionRange, getNftSize, getOutputScriptType, getSDKVersion, getSafeLogPayload, getScriptType, getTimeStamp, httpRequest, init$1 as initCore, isBleConnect, isValidVersionArray, isValidVersionString, normalizeSafetyCheckLevel, normalizeVersionArray, parseConnectSettings, parseMessage, patchFeatures, preloadSessionCache, safeThrowError, setLoggerPostMessage, supportInputPinOnSoftware, switchTransport, transportEnv, updateRequestContext, versionCompare, versionSplit, wait, whitelist, whitelistExtension };
package/dist/index.js CHANGED
@@ -39569,6 +39569,33 @@ function validateResource(value, index) {
39569
39569
  headerHash: normalizeHex$1(resource.headerHash, SHA3_512_HEX_LENGTH, 'headerHash'),
39570
39570
  };
39571
39571
  }
39572
+ function validateBootResources(value) {
39573
+ if (!value || typeof value !== 'object') {
39574
+ throw new Error('Invalid Pro2 boot resources config');
39575
+ }
39576
+ const resource = value;
39577
+ if (resource.required !== false) {
39578
+ throw new Error('Invalid Pro2 boot resources required flag: expected false');
39579
+ }
39580
+ if (resource.target !== 'CRATE') {
39581
+ throw new Error('Invalid Pro2 boot resources target: expected CRATE');
39582
+ }
39583
+ if (typeof resource.url !== 'string' || !resource.url.startsWith('https://')) {
39584
+ throw new Error('Invalid Pro2 boot resources url');
39585
+ }
39586
+ if (!Number.isSafeInteger(resource.size) || Number(resource.size) <= 0) {
39587
+ throw new Error('Invalid Pro2 boot resources size');
39588
+ }
39589
+ return {
39590
+ required: false,
39591
+ target: 'CRATE',
39592
+ url: resource.url,
39593
+ size: Number(resource.size),
39594
+ fileHash: normalizeHex$1(resource.fileHash, SHA256_HEX_LENGTH, 'boot fileHash'),
39595
+ payloadHash: normalizeHex$1(resource.payloadHash, SHA3_512_HEX_LENGTH, 'boot payloadHash'),
39596
+ headerHash: normalizeHex$1(resource.headerHash, SHA3_512_HEX_LENGTH, 'boot headerHash'),
39597
+ };
39598
+ }
39572
39599
  function parseProtocolV2Resources(value) {
39573
39600
  if (value === undefined)
39574
39601
  return undefined;
@@ -39577,7 +39604,8 @@ function parseProtocolV2Resources(value) {
39577
39604
  !Array.isArray(value.stable)) {
39578
39605
  throw new Error('Invalid Pro2 resources config: stable must be an array');
39579
39606
  }
39580
- const stable = value.stable.map(validateResource);
39607
+ const config = value;
39608
+ const stable = config.stable.map(validateResource);
39581
39609
  const types = new Set(stable.map(resource => resource.type));
39582
39610
  if (stable.length !== PROTOCOL_V2_RESOURCE_TYPES.length || types.size !== stable.length) {
39583
39611
  throw new Error('Invalid Pro2 resources config: stable must contain six unique resource types');
@@ -39587,15 +39615,14 @@ function parseProtocolV2Resources(value) {
39587
39615
  throw new Error(`Invalid Pro2 resources config: stable is missing ${type}`);
39588
39616
  }
39589
39617
  }
39590
- return {
39591
- stable: PROTOCOL_V2_RESOURCE_TYPES.map(type => {
39618
+ const boot = config.boot === undefined ? undefined : validateBootResources(config.boot);
39619
+ return Object.assign({ stable: PROTOCOL_V2_RESOURCE_TYPES.map(type => {
39592
39620
  const resource = stable.find(item => item.type === type);
39593
39621
  if (!resource) {
39594
39622
  throw new Error(`Invalid Pro2 resources config: stable is missing ${type}`);
39595
39623
  }
39596
39624
  return resource;
39597
- }),
39598
- };
39625
+ }) }, (boot ? { boot } : undefined));
39599
39626
  }
39600
39627
  function buildProtocolV2ResourceUpdatePlan({ resources, inventory, mode, forced = false, }) {
39601
39628
  if (mode === 'bootloader-recovery' || forced) {
@@ -39777,6 +39804,10 @@ class DataManager {
39777
39804
  var _b, _c;
39778
39805
  return (_c = (_b = this.deviceMap[hdShared.EDeviceType.Pro2]) === null || _b === void 0 ? void 0 : _b.resources) === null || _c === void 0 ? void 0 : _c.stable;
39779
39806
  }
39807
+ static getProtocolV2BootResources() {
39808
+ var _b, _c;
39809
+ return (_c = (_b = this.deviceMap[hdShared.EDeviceType.Pro2]) === null || _b === void 0 ? void 0 : _b.resources) === null || _c === void 0 ? void 0 : _c.boot;
39810
+ }
39780
39811
  static getProtobufMessages(schema = 'v1CurrentSchema') {
39781
39812
  return this.messages[schema];
39782
39813
  }
@@ -40428,7 +40459,7 @@ function getProtocolV2WalletSession(device, options) {
40428
40459
  : undefined;
40429
40460
  let response;
40430
40461
  let resumed = false;
40431
- let mainWalletSelected = (options === null || options === void 0 ? void 0 : options.onlyMainPin) === true &&
40462
+ let mainPinSelected = (options === null || options === void 0 ? void 0 : options.onlyMainPin) === true &&
40432
40463
  ((_d = device.features) === null || _d === void 0 ? void 0 : _d.unlocked) === true &&
40433
40464
  ((_e = device.features) === null || _e === void 0 ? void 0 : _e.unlockedAttachPin) === false;
40434
40465
  const clearCurrentWalletSession = () => {
@@ -40453,14 +40484,24 @@ function getProtocolV2WalletSession(device, options) {
40453
40484
  clearCurrentWalletSession();
40454
40485
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckUnlockTypeError);
40455
40486
  });
40456
- const selectMainWallet = (force = false) => __awaiter(this, void 0, void 0, function* () {
40457
- if (force || !mainWalletSelected) {
40487
+ const selectMainPin = (force = false) => __awaiter(this, void 0, void 0, function* () {
40488
+ if (force || !mainPinSelected) {
40458
40489
  yield device.unlockDevice(hdTransport.DeviceSessionPinType.Main, {
40459
40490
  source: 'wallet-session-coordinator',
40460
40491
  reason: expectedPassphraseState ? 'session-recovery' : 'open-wallet',
40461
40492
  deviceOnly: true,
40462
40493
  });
40463
- mainWalletSelected = true;
40494
+ mainPinSelected = true;
40495
+ }
40496
+ });
40497
+ const selectStandardWallet = () => __awaiter(this, void 0, void 0, function* () {
40498
+ var _l;
40499
+ yield selectMainPin();
40500
+ if (((_l = device.features) === null || _l === void 0 ? void 0 : _l.passphraseProtection) === true) {
40501
+ yield askDevicePassphrase(device, {
40502
+ passphrase: '',
40503
+ on_device: false,
40504
+ });
40464
40505
  }
40465
40506
  });
40466
40507
  if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
@@ -40468,7 +40509,7 @@ function getProtocolV2WalletSession(device, options) {
40468
40509
  if (cachedStandardSession) {
40469
40510
  try {
40470
40511
  if (options === null || options === void 0 ? void 0 : options.selectMainWalletBeforeRestore) {
40471
- yield selectMainWallet();
40512
+ yield selectMainPin();
40472
40513
  }
40473
40514
  response = yield getDeviceSession(device, buildDeviceSessionGetRequest({
40474
40515
  sessionId: cachedStandardSession.sessionId,
@@ -40486,7 +40527,7 @@ function getProtocolV2WalletSession(device, options) {
40486
40527
  }
40487
40528
  }
40488
40529
  if (!response) {
40489
- yield selectMainWallet();
40530
+ yield selectStandardWallet();
40490
40531
  response = yield getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano }));
40491
40532
  }
40492
40533
  }
@@ -40549,7 +40590,7 @@ function getProtocolV2WalletSession(device, options) {
40549
40590
  }
40550
40591
  if (options === null || options === void 0 ? void 0 : options.onlyMainPin) {
40551
40592
  (_h = device.clearStandardInternalState) === null || _h === void 0 ? void 0 : _h.call(device);
40552
- yield selectMainWallet(true);
40593
+ yield selectStandardWallet();
40553
40594
  response = yield getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano: options === null || options === void 0 ? void 0 : options.deriveCardano }));
40554
40595
  }
40555
40596
  else {
@@ -40591,7 +40632,7 @@ function getProtocolV2WalletSession(device, options) {
40591
40632
  return {
40592
40633
  passphraseState: message.btc_test_address,
40593
40634
  newSession: message.session_id,
40594
- unlockedAttachPin: mainWalletSelected ? false : undefined,
40635
+ unlockedAttachPin: mainPinSelected ? false : undefined,
40595
40636
  resumed,
40596
40637
  };
40597
40638
  });
@@ -49065,6 +49106,7 @@ const PROTOCOL_V2_OKPP_HEADER_SIZE = 0x52a0;
49065
49106
  const PROTOCOL_V2_OKPP_PAYLOAD_HASH_OFFSET = 0x200;
49066
49107
  const PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET = 0x240;
49067
49108
  const PROTOCOL_V2_OKPP_HASH_SIZE = 64;
49109
+ const PROTOCOL_V2_BOOT_RESOURCES_FILE_NAME = 'boot_resources.crate.okpkg';
49068
49110
  const getProtocolV2DeviceTransferProgress = (bytesBeforeChunk, bytesAfterChunk, totalBytes) => {
49069
49111
  if (!Number.isFinite(totalBytes) || totalBytes <= 0) {
49070
49112
  return 100;
@@ -49289,6 +49331,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49289
49331
  { name: 'chunkSize', type: 'number' },
49290
49332
  { name: 'forcedUpdateRes', type: 'boolean' },
49291
49333
  { name: 'bootloaderBinary', type: 'buffer' },
49334
+ { name: 'bootResourcesBinary', type: 'buffer' },
49292
49335
  { name: 'romloaderBinary', type: 'buffer' },
49293
49336
  { name: 'applicationP1Binary', type: 'buffer' },
49294
49337
  { name: 'applicationP2Binary', type: 'buffer' },
@@ -49306,6 +49349,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49306
49349
  chunkSize: payload.chunkSize,
49307
49350
  forcedUpdateRes: payload.forcedUpdateRes,
49308
49351
  bootloaderBinary: payload.bootloaderBinary,
49352
+ bootResourcesBinary: payload.bootResourcesBinary,
49309
49353
  romloaderBinary: payload.romloaderBinary,
49310
49354
  applicationP1Binary: payload.applicationP1Binary,
49311
49355
  applicationP2Binary: payload.applicationP2Binary,
@@ -49341,7 +49385,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49341
49385
  });
49342
49386
  }
49343
49387
  runProtocolV2() {
49344
- var _a, _b, _c, _d;
49388
+ var _a, _b, _c, _d, _e;
49345
49389
  return __awaiter(this, void 0, void 0, function* () {
49346
49390
  yield this.captureProtocolV2PhysicalIdentity();
49347
49391
  const deviceFeatures = yield this.getProtocolV2DeviceFeatures();
@@ -49350,6 +49394,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49350
49394
  const resourceRecoveryMode = Boolean(this.isProtocolV2BootloaderMode() || this.isProtocolV2RomloaderMode());
49351
49395
  let fwBinaryMap = [];
49352
49396
  let bootloaderBinary = null;
49397
+ let bootResourcesInstallItem;
49353
49398
  let installItems;
49354
49399
  let resourceBundles;
49355
49400
  try {
@@ -49359,7 +49404,9 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49359
49404
  const needsRemoteFirmware = !this.hasExplicitProtocolV2Payload(fwBinaryMap);
49360
49405
  const needsRemoteResources = !((_b = this.params.resourceBundleFiles) === null || _b === void 0 ? void 0 : _b.length) &&
49361
49406
  !!((_c = this.params.targetsToUpdate) === null || _c === void 0 ? void 0 : _c.includes('resource'));
49362
- if (needsRemoteFirmware || needsRemoteResources) {
49407
+ const needsRemoteBootResources = !this.params.bootResourcesBinary &&
49408
+ !!((_d = this.params.targetsToUpdate) === null || _d === void 0 ? void 0 : _d.includes('boot_resources'));
49409
+ if (needsRemoteFirmware || needsRemoteResources || needsRemoteBootResources) {
49363
49410
  yield DataManager.forceReloadData();
49364
49411
  }
49365
49412
  if (needsRemoteFirmware) {
@@ -49368,13 +49415,23 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49368
49415
  fwBinaryMap = remoteBinaries.fwBinaryMap;
49369
49416
  installItems = remoteBinaries.installItems;
49370
49417
  }
49418
+ bootResourcesInstallItem = yield this.prepareProtocolV2BootResources();
49419
+ if (bootResourcesInstallItem) {
49420
+ installItems = [
49421
+ bootResourcesInstallItem,
49422
+ ...(installItems !== null && installItems !== void 0 ? installItems : this.buildProtocolV2InstallItems({ bootloaderBinary, fwBinaryMap })),
49423
+ ];
49424
+ }
49371
49425
  resourceBundles = yield this.prepareProtocolV2ResourceBundles(resourceRecoveryMode);
49372
49426
  this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
49373
49427
  }
49374
49428
  catch (err) {
49375
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_d = err.message) !== null && _d !== void 0 ? _d : err);
49429
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_e = err.message) !== null && _e !== void 0 ? _e : err);
49376
49430
  }
49377
- if (!bootloaderBinary && fwBinaryMap.length === 0 && !(resourceBundles === null || resourceBundles === void 0 ? void 0 : resourceBundles.length)) {
49431
+ if (!bootloaderBinary &&
49432
+ fwBinaryMap.length === 0 &&
49433
+ !(installItems === null || installItems === void 0 ? void 0 : installItems.length) &&
49434
+ !(resourceBundles === null || resourceBundles === void 0 ? void 0 : resourceBundles.length)) {
49378
49435
  if (resourceBundles !== undefined) {
49379
49436
  this.postTipMessage(exports.FirmwareUpdateTipMessage.FirmwareUpdateCompleted);
49380
49437
  return this.getProtocolV2VersionResult(deviceFeatures);
@@ -49443,6 +49500,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49443
49500
  var _a;
49444
49501
  return (!!((_a = this.params.resourceBundleFiles) === null || _a === void 0 ? void 0 : _a.length) ||
49445
49502
  !!this.params.bootloaderBinary ||
49503
+ !!this.params.bootResourcesBinary ||
49446
49504
  fwBinaryMap.length > 0);
49447
49505
  }
49448
49506
  buildProtocolV2InstallItems({ bootloaderBinary, fwBinaryMap, }) {
@@ -49557,6 +49615,50 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
49557
49615
  };
49558
49616
  });
49559
49617
  }
49618
+ validateProtocolV2BootResourcesBinary(binary, resource) {
49619
+ if (resource && !isProtocolV2ResourceFileValid(binary, resource)) {
49620
+ throw new Error('Pro2 boot resources file verification failed');
49621
+ }
49622
+ const header = parseProtocolV2OkppHeader(toProtocolV2Bytes(binary));
49623
+ if (!header || header.type !== 'CRAT') {
49624
+ throw new Error('Invalid Pro2 boot resources CRATE header');
49625
+ }
49626
+ if (resource) {
49627
+ const expectedPayloadHash = normalizeProtocolV2Hex(resource.payloadHash);
49628
+ const expectedHeaderHash = normalizeProtocolV2Hex(resource.headerHash);
49629
+ if (header.payloadHash !== expectedPayloadHash) {
49630
+ throw new Error('Pro2 boot resources payload hash mismatch');
49631
+ }
49632
+ if (header.headerHash !== expectedHeaderHash) {
49633
+ throw new Error('Pro2 boot resources header hash mismatch');
49634
+ }
49635
+ }
49636
+ }
49637
+ prepareProtocolV2BootResources() {
49638
+ var _a;
49639
+ return __awaiter(this, void 0, void 0, function* () {
49640
+ let binary = this.params.bootResourcesBinary;
49641
+ let resource;
49642
+ if (!binary) {
49643
+ if (!((_a = this.params.targetsToUpdate) === null || _a === void 0 ? void 0 : _a.includes('boot_resources'))) {
49644
+ return undefined;
49645
+ }
49646
+ resource = DataManager.getProtocolV2BootResources();
49647
+ if (!resource) {
49648
+ throw new Error('Missing Pro2 boot resources configuration');
49649
+ }
49650
+ Log$5.log('[FirmwareUpdateV4] downloading Pro2 boot resources CRATE');
49651
+ ({ binary } = yield getSysResourceBinary(resource.url));
49652
+ }
49653
+ this.validateProtocolV2BootResourcesBinary(binary, resource);
49654
+ return {
49655
+ fileName: PROTOCOL_V2_BOOT_RESOURCES_FILE_NAME,
49656
+ binary,
49657
+ targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
49658
+ kind: 'boot_resources',
49659
+ };
49660
+ });
49661
+ }
49560
49662
  prepareProtocolV2ResourceBundles(recoveryMode) {
49561
49663
  var _a, _b;
49562
49664
  return __awaiter(this, void 0, void 0, function* () {
@@ -1 +1 @@
1
- {"version":3,"file":"resources.d.ts","sour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OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;;;;;GAmNF;AAED,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,uBAAuB,EAAE,MAAM,EAC/B,aAAa,CAAC,EAAE,OAAO;;;;;GAOxB"}
1
+ {"version":3,"file":"walletSession.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/walletSession.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAuBlD,wBAAsB,6BAA6B,CAAC,MAAM,EAAE,MAAM,0DAGjE;AAED,wBAAsB,6BAA6B,CAAC,MAAM,EAAE,MAAM,qCAGjE;AAED,wBAAsB,qCAAqC,CAAC,MAAM,EAAE,MAAM,oBAgBzE;AAsHD,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE;IACR,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;;;;;GA8NF;AAED,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,uBAAuB,EAAE,MAAM,EAC/B,aAAa,CAAC,EAAE,OAAO;;;;;GAOxB"}
@@ -38,7 +38,7 @@ export interface FirmwareUpdateV3Params {
38
38
  firmwareType?: EFirmwareType;
39
39
  platform: IPlatform;
40
40
  }
41
- export type FirmwareUpdateV4Target = 'boot' | 'app_v1' | 'app_v2' | 'coprocessor' | 'resource' | 'se01' | 'se02' | 'se03' | 'se04';
41
+ export type FirmwareUpdateV4Target = 'boot' | 'boot_resources' | 'app_v1' | 'app_v2' | 'coprocessor' | 'resource' | 'se01' | 'se02' | 'se03' | 'se04';
42
42
  export interface FirmwareUpdateV4Params {
43
43
  platform: IPlatform;
44
44
  chunkSize?: number;
@@ -46,6 +46,7 @@ export interface FirmwareUpdateV4Params {
46
46
  targetsToUpdate?: FirmwareUpdateV4Target[];
47
47
  romloaderBinary?: ArrayBuffer;
48
48
  bootloaderBinary?: ArrayBuffer;
49
+ bootResourcesBinary?: ArrayBuffer;
49
50
  applicationP1Binary?: ArrayBuffer;
50
51
  applicationP2Binary?: ArrayBuffer;
51
52
  coprocessorBinary?: ArrayBuffer;
@@ -1 +1 @@
1
- {"version":3,"file":"firmwareUpdate.d.ts","sourceRoot":"","sources":["../../../src/types/api/firmwareUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAElD,KAAK,WAAW,GAAG,UAAU,GAAG,KAAK,CAAC;AAEtC,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,WAAW,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,WAAW,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAAC,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GACnE,QAAQ,CAAC,KAAK,CAAC,OAAO,CA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E9B,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAE/B,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAElC,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAElC,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAElC,iBAAiB,CAAC,EAAE,WAAW,CAAC;IAEhC,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAK1B,mBAAmB,CAAC,EAAE,KAAK,CAAC;QAC1B,MAAM,EAAE,WAAW,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,CAAC,sBAAsB,CAAC,GACrC,QAAQ,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,CAAC,sBAAsB,CAAC,GACrC,QAAQ,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC,CAAC"}
@@ -40,8 +40,18 @@ export type IProtocolV2Resource = {
40
40
  fileHash: string;
41
41
  headerHash: string;
42
42
  };
43
+ export type IProtocolV2BootResources = {
44
+ required: false;
45
+ target: 'CRATE';
46
+ url: string;
47
+ size: number;
48
+ fileHash: string;
49
+ payloadHash: string;
50
+ headerHash: string;
51
+ };
43
52
  export type IProtocolV2Resources = {
44
53
  stable: IProtocolV2Resource[];
54
+ boot?: IProtocolV2BootResources;
45
55
  };
46
56
  export type IProtocolV2ResourceBundle = {
47
57
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,KAAK,GACL,cAAc,GACd,UAAU,GACV,cAAc,GACd,QAAQ,GACR,gBAAgB,GAChB,iBAAiB,GACjB,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AACf,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,EAAE,YAAY,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CACvE,CAAC;AAEF,MAAM,MAAM,aAAa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AM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE;aACR,CAAC,IAAI,OAAO,GAAG,MAAM;SACvB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CAC7B,GAAG,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-core",
3
- "version": "1.2.0-alpha.43",
3
+ "version": "1.2.0-alpha.45",
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.43",
29
- "@onekeyfe/hd-transport": "1.2.0-alpha.43",
28
+ "@onekeyfe/hd-shared": "1.2.0-alpha.45",
29
+ "@onekeyfe/hd-transport": "1.2.0-alpha.45",
30
30
  "axios": "1.15.2",
31
31
  "bignumber.js": "^9.0.2",
32
32
  "bytebuffer": "^5.0.1",
@@ -44,5 +44,5 @@
44
44
  "@types/w3c-web-usb": "^1.0.10",
45
45
  "@types/web-bluetooth": "^0.0.21"
46
46
  },
47
- "gitHead": "2ea7c9d60472502a272a57f808aed3773ccd84c4"
47
+ "gitHead": "8fc6c0d642bfaa268d23a2aa2a98e235d1a876f6"
48
48
  }
@@ -45,6 +45,7 @@ import type { TypedResponseMessage } from '../device/DeviceCommands';
45
45
  import type {
46
46
  Features,
47
47
  IFirmwareReleaseInfo,
48
+ IProtocolV2BootResources,
48
49
  IProtocolV2FirmwareComponent,
49
50
  IProtocolV2Resource,
50
51
  IVersionArray,
@@ -74,6 +75,7 @@ const PROTOCOL_V2_OKPP_HEADER_SIZE = 0x52a0;
74
75
  const PROTOCOL_V2_OKPP_PAYLOAD_HASH_OFFSET = 0x200;
75
76
  const PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET = 0x240;
76
77
  const PROTOCOL_V2_OKPP_HASH_SIZE = 64;
78
+ const PROTOCOL_V2_BOOT_RESOURCES_FILE_NAME = 'boot_resources.crate.okpkg';
77
79
 
78
80
  const getProtocolV2DeviceTransferProgress = (
79
81
  bytesBeforeChunk: number,
@@ -108,7 +110,7 @@ type ProtocolV2FirmwareUpdateStartResponse = TypedResponseMessage<'Success'>;
108
110
 
109
111
  type ProtocolV2TargetBinary = { fileName: string; binary: ArrayBuffer; targetId: number };
110
112
  type ProtocolV2InstallItem = ProtocolV2TargetBinary & {
111
- kind: ProtocolV2RemoteComponentTarget['kind'];
113
+ kind: ProtocolV2RemoteComponentTarget['kind'] | 'boot_resources';
112
114
  };
113
115
  type ProtocolV2InstallTarget = ProtocolV2InstallItem & {
114
116
  path: string;
@@ -424,6 +426,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
424
426
  { name: 'chunkSize', type: 'number' },
425
427
  { name: 'forcedUpdateRes', type: 'boolean' },
426
428
  { name: 'bootloaderBinary', type: 'buffer' },
429
+ { name: 'bootResourcesBinary', type: 'buffer' },
427
430
  { name: 'romloaderBinary', type: 'buffer' },
428
431
  { name: 'applicationP1Binary', type: 'buffer' },
429
432
  { name: 'applicationP2Binary', type: 'buffer' },
@@ -442,6 +445,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
442
445
  chunkSize: payload.chunkSize,
443
446
  forcedUpdateRes: payload.forcedUpdateRes,
444
447
  bootloaderBinary: payload.bootloaderBinary,
448
+ bootResourcesBinary: payload.bootResourcesBinary,
445
449
  romloaderBinary: payload.romloaderBinary,
446
450
  applicationP1Binary: payload.applicationP1Binary,
447
451
  applicationP2Binary: payload.applicationP2Binary,
@@ -490,6 +494,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
490
494
 
491
495
  let fwBinaryMap: ProtocolV2TargetBinary[] = [];
492
496
  let bootloaderBinary: ArrayBuffer | null = null;
497
+ let bootResourcesInstallItem: ProtocolV2InstallItem | undefined;
493
498
  let installItems: ProtocolV2InstallItem[] | undefined;
494
499
  let resourceBundles: ProtocolV2ResourceBundleBinary[] | undefined;
495
500
  try {
@@ -500,7 +505,10 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
500
505
  const needsRemoteResources =
501
506
  !this.params.resourceBundleFiles?.length &&
502
507
  !!this.params.targetsToUpdate?.includes('resource');
503
- if (needsRemoteFirmware || needsRemoteResources) {
508
+ const needsRemoteBootResources =
509
+ !this.params.bootResourcesBinary &&
510
+ !!this.params.targetsToUpdate?.includes('boot_resources');
511
+ if (needsRemoteFirmware || needsRemoteResources || needsRemoteBootResources) {
504
512
  // Remote updates must use a freshly fetched config before any reboot or file write.
505
513
  await DataManager.forceReloadData();
506
514
  }
@@ -513,13 +521,25 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
513
521
  fwBinaryMap = remoteBinaries.fwBinaryMap;
514
522
  installItems = remoteBinaries.installItems;
515
523
  }
524
+ bootResourcesInstallItem = await this.prepareProtocolV2BootResources();
525
+ if (bootResourcesInstallItem) {
526
+ installItems = [
527
+ bootResourcesInstallItem,
528
+ ...(installItems ?? this.buildProtocolV2InstallItems({ bootloaderBinary, fwBinaryMap })),
529
+ ];
530
+ }
516
531
  resourceBundles = await this.prepareProtocolV2ResourceBundles(resourceRecoveryMode);
517
532
  this.postTipMessage(FirmwareUpdateTipMessage.FinishDownloadFirmware);
518
533
  } catch (err) {
519
534
  throw ERRORS.TypedError(HardwareErrorCode.FirmwareUpdateDownloadFailed, err.message ?? err);
520
535
  }
521
536
 
522
- if (!bootloaderBinary && fwBinaryMap.length === 0 && !resourceBundles?.length) {
537
+ if (
538
+ !bootloaderBinary &&
539
+ fwBinaryMap.length === 0 &&
540
+ !installItems?.length &&
541
+ !resourceBundles?.length
542
+ ) {
523
543
  if (resourceBundles !== undefined) {
524
544
  this.postTipMessage(FirmwareUpdateTipMessage.FirmwareUpdateCompleted);
525
545
  return this.getProtocolV2VersionResult(deviceFeatures);
@@ -599,6 +619,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
599
619
  return (
600
620
  !!this.params.resourceBundleFiles?.length ||
601
621
  !!this.params.bootloaderBinary ||
622
+ !!this.params.bootResourcesBinary ||
602
623
  fwBinaryMap.length > 0
603
624
  );
604
625
  }
@@ -748,6 +769,54 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
748
769
  };
749
770
  }
750
771
 
772
+ private validateProtocolV2BootResourcesBinary(
773
+ binary: ArrayBuffer,
774
+ resource?: IProtocolV2BootResources
775
+ ) {
776
+ if (resource && !isProtocolV2ResourceFileValid(binary, resource)) {
777
+ throw new Error('Pro2 boot resources file verification failed');
778
+ }
779
+ const header = parseProtocolV2OkppHeader(toProtocolV2Bytes(binary));
780
+ if (!header || header.type !== 'CRAT') {
781
+ throw new Error('Invalid Pro2 boot resources CRATE header');
782
+ }
783
+ if (resource) {
784
+ const expectedPayloadHash = normalizeProtocolV2Hex(resource.payloadHash);
785
+ const expectedHeaderHash = normalizeProtocolV2Hex(resource.headerHash);
786
+ if (header.payloadHash !== expectedPayloadHash) {
787
+ throw new Error('Pro2 boot resources payload hash mismatch');
788
+ }
789
+ if (header.headerHash !== expectedHeaderHash) {
790
+ throw new Error('Pro2 boot resources header hash mismatch');
791
+ }
792
+ }
793
+ }
794
+
795
+ private async prepareProtocolV2BootResources(): Promise<ProtocolV2InstallItem | undefined> {
796
+ let binary = this.params.bootResourcesBinary;
797
+ let resource: IProtocolV2BootResources | undefined;
798
+
799
+ if (!binary) {
800
+ if (!this.params.targetsToUpdate?.includes('boot_resources')) {
801
+ return undefined;
802
+ }
803
+ resource = DataManager.getProtocolV2BootResources();
804
+ if (!resource) {
805
+ throw new Error('Missing Pro2 boot resources configuration');
806
+ }
807
+ Log.log('[FirmwareUpdateV4] downloading Pro2 boot resources CRATE');
808
+ ({ binary } = await getSysResourceBinary(resource.url));
809
+ }
810
+
811
+ this.validateProtocolV2BootResourcesBinary(binary, resource);
812
+ return {
813
+ fileName: PROTOCOL_V2_BOOT_RESOURCES_FILE_NAME,
814
+ binary,
815
+ targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
816
+ kind: 'boot_resources',
817
+ };
818
+ }
819
+
751
820
  private async prepareProtocolV2ResourceBundles(
752
821
  recoveryMode: boolean
753
822
  ): Promise<ProtocolV2ResourceBundleBinary[] | undefined> {
@@ -509,6 +509,10 @@ export default class DataManager {
509
509
  return this.deviceMap[EDeviceType.Pro2]?.resources?.stable;
510
510
  }
511
511
 
512
+ static getProtocolV2BootResources() {
513
+ return this.deviceMap[EDeviceType.Pro2]?.resources?.boot;
514
+ }
515
+
512
516
  static getProtobufMessages(schema: ProtobufMessageSchema = 'v1CurrentSchema'): JSON {
513
517
  return this.messages[schema];
514
518
  }
@@ -1,6 +1,7 @@
1
1
  import { sha256 } from '@noble/hashes/sha256';
2
2
 
3
3
  import type {
4
+ IProtocolV2BootResources,
4
5
  IProtocolV2Resource,
5
6
  IProtocolV2ResourceType,
6
7
  IProtocolV2Resources,
@@ -149,6 +150,34 @@ function validateResource(value: unknown, index: number): IProtocolV2Resource {
149
150
  };
150
151
  }
151
152
 
153
+ function validateBootResources(value: unknown): IProtocolV2BootResources {
154
+ if (!value || typeof value !== 'object') {
155
+ throw new Error('Invalid Pro2 boot resources config');
156
+ }
157
+ const resource = value as Partial<IProtocolV2BootResources>;
158
+ if (resource.required !== false) {
159
+ throw new Error('Invalid Pro2 boot resources required flag: expected false');
160
+ }
161
+ if (resource.target !== 'CRATE') {
162
+ throw new Error('Invalid Pro2 boot resources target: expected CRATE');
163
+ }
164
+ if (typeof resource.url !== 'string' || !resource.url.startsWith('https://')) {
165
+ throw new Error('Invalid Pro2 boot resources url');
166
+ }
167
+ if (!Number.isSafeInteger(resource.size) || Number(resource.size) <= 0) {
168
+ throw new Error('Invalid Pro2 boot resources size');
169
+ }
170
+ return {
171
+ required: false,
172
+ target: 'CRATE',
173
+ url: resource.url,
174
+ size: Number(resource.size),
175
+ fileHash: normalizeHex(resource.fileHash, SHA256_HEX_LENGTH, 'boot fileHash'),
176
+ payloadHash: normalizeHex(resource.payloadHash, SHA3_512_HEX_LENGTH, 'boot payloadHash'),
177
+ headerHash: normalizeHex(resource.headerHash, SHA3_512_HEX_LENGTH, 'boot headerHash'),
178
+ };
179
+ }
180
+
152
181
  /** Validate a complete Pro2 stable resource set from remote configuration. */
153
182
  export function parseProtocolV2Resources(value: unknown): IProtocolV2Resources | undefined {
154
183
  if (value === undefined) return undefined;
@@ -160,7 +189,8 @@ export function parseProtocolV2Resources(value: unknown): IProtocolV2Resources |
160
189
  throw new Error('Invalid Pro2 resources config: stable must be an array');
161
190
  }
162
191
 
163
- const stable = (value as { stable: unknown[] }).stable.map(validateResource);
192
+ const config = value as { stable: unknown[]; boot?: unknown };
193
+ const stable = config.stable.map(validateResource);
164
194
  const types = new Set(stable.map(resource => resource.type));
165
195
  if (stable.length !== PROTOCOL_V2_RESOURCE_TYPES.length || types.size !== stable.length) {
166
196
  throw new Error('Invalid Pro2 resources config: stable must contain six unique resource types');
@@ -170,6 +200,7 @@ export function parseProtocolV2Resources(value: unknown): IProtocolV2Resources |
170
200
  throw new Error(`Invalid Pro2 resources config: stable is missing ${type}`);
171
201
  }
172
202
  }
203
+ const boot = config.boot === undefined ? undefined : validateBootResources(config.boot);
173
204
  return {
174
205
  stable: PROTOCOL_V2_RESOURCE_TYPES.map(type => {
175
206
  const resource = stable.find(item => item.type === type);
@@ -178,6 +209,7 @@ export function parseProtocolV2Resources(value: unknown): IProtocolV2Resources |
178
209
  }
179
210
  return resource;
180
211
  }),
212
+ ...(boot ? { boot } : undefined),
181
213
  };
182
214
  }
183
215
 
@@ -215,7 +215,7 @@ export async function getProtocolV2WalletSession(
215
215
  : undefined;
216
216
  let response;
217
217
  let resumed = false;
218
- let mainWalletSelected =
218
+ let mainPinSelected =
219
219
  options?.onlyMainPin === true &&
220
220
  device.features?.unlocked === true &&
221
221
  device.features?.unlockedAttachPin === false;
@@ -243,14 +243,25 @@ export async function getProtocolV2WalletSession(
243
243
  throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckUnlockTypeError);
244
244
  };
245
245
 
246
- const selectMainWallet = async (force = false) => {
247
- if (force || !mainWalletSelected) {
246
+ const selectMainPin = async (force = false) => {
247
+ if (force || !mainPinSelected) {
248
248
  await device.unlockDevice(DeviceSessionPinType.Main, {
249
249
  source: 'wallet-session-coordinator',
250
250
  reason: expectedPassphraseState ? 'session-recovery' : 'open-wallet',
251
251
  deviceOnly: true,
252
252
  });
253
- mainWalletSelected = true;
253
+ mainPinSelected = true;
254
+ }
255
+ };
256
+
257
+ const selectStandardWallet = async () => {
258
+ // Main PIN authenticates the device; an empty host passphrase selects the standard derivation.
259
+ await selectMainPin();
260
+ if (device.features?.passphraseProtection === true) {
261
+ await askDevicePassphrase(device, {
262
+ passphrase: '',
263
+ on_device: false,
264
+ });
254
265
  }
255
266
  };
256
267
 
@@ -259,7 +270,7 @@ export async function getProtocolV2WalletSession(
259
270
  if (cachedStandardSession) {
260
271
  try {
261
272
  if (options?.selectMainWalletBeforeRestore) {
262
- await selectMainWallet();
273
+ await selectMainPin();
263
274
  }
264
275
  response = await getDeviceSession(
265
276
  device,
@@ -280,7 +291,7 @@ export async function getProtocolV2WalletSession(
280
291
  }
281
292
 
282
293
  if (!response) {
283
- await selectMainWallet();
294
+ await selectStandardWallet();
284
295
  response = await getDeviceSession(
285
296
  device,
286
297
  buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
@@ -348,7 +359,7 @@ export async function getProtocolV2WalletSession(
348
359
  }
349
360
  if (options?.onlyMainPin) {
350
361
  device.clearStandardInternalState?.();
351
- await selectMainWallet(true);
362
+ await selectStandardWallet();
352
363
  response = await getDeviceSession(
353
364
  device,
354
365
  buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
@@ -391,7 +402,7 @@ export async function getProtocolV2WalletSession(
391
402
  return {
392
403
  passphraseState: message.btc_test_address,
393
404
  newSession: message.session_id,
394
- unlockedAttachPin: mainWalletSelected ? false : undefined,
405
+ unlockedAttachPin: mainPinSelected ? false : undefined,
395
406
  resumed,
396
407
  };
397
408
  }
@@ -63,6 +63,7 @@ export interface FirmwareUpdateV3Params {
63
63
  */
64
64
  export type FirmwareUpdateV4Target =
65
65
  | 'boot'
66
+ | 'boot_resources'
66
67
  | 'app_v1'
67
68
  | 'app_v2'
68
69
  | 'coprocessor'
@@ -82,6 +83,8 @@ export interface FirmwareUpdateV4Params {
82
83
  romloaderBinary?: ArrayBuffer;
83
84
  /** FW_MGMT_TARGET_BOOTLOADER = 3 */
84
85
  bootloaderBinary?: ArrayBuffer;
86
+ /** FW_MGMT_TARGET_CRATE = 1; optional Pro2 startup resources. */
87
+ bootResourcesBinary?: ArrayBuffer;
85
88
  /** FW_MGMT_TARGET_APPLICATION_P1 = 4 */
86
89
  applicationP1Binary?: ArrayBuffer;
87
90
  /** FW_MGMT_TARGET_APPLICATION_P2 = 5 */
@@ -81,8 +81,24 @@ export type IProtocolV2Resource = {
81
81
  headerHash: string;
82
82
  };
83
83
 
84
+ /** Optional Pro2 startup-resource CRATE installed by the bootloader updater. */
85
+ export type IProtocolV2BootResources = {
86
+ required: false;
87
+ target: 'CRATE';
88
+ url: string;
89
+ /** Complete CRATE file size in bytes. */
90
+ size: number;
91
+ /** SHA-256 of the complete CRATE file. */
92
+ fileHash: string;
93
+ /** SHA3-512 payload_hash from the signed CRATE header. */
94
+ payloadHash: string;
95
+ /** SHA3-512 header_hash from the signed CRATE header. */
96
+ headerHash: string;
97
+ };
98
+
84
99
  export type IProtocolV2Resources = {
85
100
  stable: IProtocolV2Resource[];
101
+ boot?: IProtocolV2BootResources;
86
102
  };
87
103
 
88
104
  /** Pro2 RESC bundle okpkg descriptor for incremental FileWrite synchronization. */