@onekeyfe/hd-core 1.2.0-alpha.46 → 1.2.0-alpha.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/protocol-v2-resources.test.ts +38 -3
- package/__tests__/protocol-v2.test.ts +95 -0
- package/dist/api/FirmwareUpdateV4.d.ts +2 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -0
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +101 -9
- package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +2 -1
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/settings.d.ts +10 -0
- package/dist/types/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +72 -3
- package/src/data-manager/DataManager.ts +4 -0
- package/src/protocols/protocol-v2/resources.ts +33 -1
- package/src/types/api/firmwareUpdate.ts +3 -0
- package/src/types/settings.ts +16 -0
|
@@ -12,7 +12,12 @@ import {
|
|
|
12
12
|
requestProtocolV2ResourceInventory,
|
|
13
13
|
} from '../src/protocols/protocol-v2/resources';
|
|
14
14
|
|
|
15
|
-
import type {
|
|
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({
|
|
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';
|
|
@@ -5976,6 +5977,100 @@ describe('Protocol V2 firmware reconnect identity', () => {
|
|
|
5976
5977
|
expect((method as any).downloadProtocolV2Resource).toHaveBeenCalledTimes(6);
|
|
5977
5978
|
resourcesSpy.mockRestore();
|
|
5978
5979
|
});
|
|
5980
|
+
|
|
5981
|
+
const buildBootResourcesHeader = ({
|
|
5982
|
+
type = 'CRAT',
|
|
5983
|
+
payloadHash = 'ab'.repeat(64),
|
|
5984
|
+
headerHash = 'cd'.repeat(64),
|
|
5985
|
+
}: {
|
|
5986
|
+
type?: string;
|
|
5987
|
+
payloadHash?: string;
|
|
5988
|
+
headerHash?: string;
|
|
5989
|
+
} = {}) => {
|
|
5990
|
+
const header = new Uint8Array(0x52a0);
|
|
5991
|
+
const view = new DataView(header.buffer);
|
|
5992
|
+
'OKPP'.split('').forEach((char, index) => {
|
|
5993
|
+
header[index] = char.charCodeAt(0);
|
|
5994
|
+
});
|
|
5995
|
+
type.split('').forEach((char, index) => {
|
|
5996
|
+
header[0x08 + index] = char.charCodeAt(0);
|
|
5997
|
+
});
|
|
5998
|
+
view.setUint32(0x0c, header.byteLength, true);
|
|
5999
|
+
const writeHex = (offset: number, hex: string) => {
|
|
6000
|
+
for (let index = 0; index < hex.length / 2; index++) {
|
|
6001
|
+
header[offset + index] = Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16);
|
|
6002
|
+
}
|
|
6003
|
+
};
|
|
6004
|
+
writeHex(0x200, payloadHash);
|
|
6005
|
+
writeHex(0x240, headerHash);
|
|
6006
|
+
return header;
|
|
6007
|
+
};
|
|
6008
|
+
|
|
6009
|
+
test('does not resolve boot resources unless the optional target is selected', async () => {
|
|
6010
|
+
const method = new FirmwareUpdateV4({
|
|
6011
|
+
id: 1,
|
|
6012
|
+
payload: { method: 'firmwareUpdateV4', platform: 'web' },
|
|
6013
|
+
});
|
|
6014
|
+
method.init();
|
|
6015
|
+
const configSpy = jest.spyOn(DataManager, 'getProtocolV2BootResources');
|
|
6016
|
+
const downloadSpy = jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary');
|
|
6017
|
+
|
|
6018
|
+
await expect((method as any).prepareProtocolV2BootResources()).resolves.toBeUndefined();
|
|
6019
|
+
|
|
6020
|
+
expect(configSpy).not.toHaveBeenCalled();
|
|
6021
|
+
expect(downloadSpy).not.toHaveBeenCalled();
|
|
6022
|
+
});
|
|
6023
|
+
|
|
6024
|
+
test('downloads and maps the selected boot resources CRATE target', async () => {
|
|
6025
|
+
const payloadHash = 'ab'.repeat(64);
|
|
6026
|
+
const headerHash = 'cd'.repeat(64);
|
|
6027
|
+
const bytes = buildBootResourcesHeader({ payloadHash, headerHash });
|
|
6028
|
+
const binary = bytes.buffer as ArrayBuffer;
|
|
6029
|
+
const fileHash = Array.from(sha256(bytes), byte => byte.toString(16).padStart(2, '0')).join('');
|
|
6030
|
+
const resource = {
|
|
6031
|
+
required: false as const,
|
|
6032
|
+
target: 'CRATE' as const,
|
|
6033
|
+
url: 'https://example.com/boot-resources.crate.okpkg',
|
|
6034
|
+
size: bytes.byteLength,
|
|
6035
|
+
fileHash,
|
|
6036
|
+
payloadHash,
|
|
6037
|
+
headerHash,
|
|
6038
|
+
};
|
|
6039
|
+
const method = new FirmwareUpdateV4({
|
|
6040
|
+
id: 1,
|
|
6041
|
+
payload: {
|
|
6042
|
+
method: 'firmwareUpdateV4',
|
|
6043
|
+
platform: 'web',
|
|
6044
|
+
targetsToUpdate: ['boot_resources'],
|
|
6045
|
+
},
|
|
6046
|
+
});
|
|
6047
|
+
method.init();
|
|
6048
|
+
jest.spyOn(DataManager, 'getProtocolV2BootResources').mockReturnValue(resource);
|
|
6049
|
+
jest.spyOn(firmwareBinaryApi, 'getSysResourceBinary').mockResolvedValue({ binary });
|
|
6050
|
+
|
|
6051
|
+
await expect((method as any).prepareProtocolV2BootResources()).resolves.toEqual({
|
|
6052
|
+
fileName: 'boot_resources.crate.okpkg',
|
|
6053
|
+
binary,
|
|
6054
|
+
targetId: 1,
|
|
6055
|
+
kind: 'boot_resources',
|
|
6056
|
+
});
|
|
6057
|
+
});
|
|
6058
|
+
|
|
6059
|
+
test('rejects a non-CRATE manual boot resources package', async () => {
|
|
6060
|
+
const method = new FirmwareUpdateV4({
|
|
6061
|
+
id: 1,
|
|
6062
|
+
payload: {
|
|
6063
|
+
method: 'firmwareUpdateV4',
|
|
6064
|
+
platform: 'web',
|
|
6065
|
+
bootResourcesBinary: buildBootResourcesHeader({ type: 'RESC' }).buffer,
|
|
6066
|
+
},
|
|
6067
|
+
});
|
|
6068
|
+
method.init();
|
|
6069
|
+
|
|
6070
|
+
await expect((method as any).prepareProtocolV2BootResources()).rejects.toThrow(
|
|
6071
|
+
'Invalid Pro2 boot resources CRATE header'
|
|
6072
|
+
);
|
|
6073
|
+
});
|
|
5979
6074
|
});
|
|
5980
6075
|
|
|
5981
6076
|
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;
|
|
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;AAiUlG,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,i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
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,IAAI;KAAE,CAI1D;IAEF,M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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 */
|
|
@@ -4543,6 +4560,7 @@ declare class DataManager {
|
|
|
4543
4560
|
/** Force a fresh remote config before an update is allowed to mutate the device. */
|
|
4544
4561
|
static forceReloadData(): Promise<void>;
|
|
4545
4562
|
static getProtocolV2Resources(): IProtocolV2Resource[] | undefined;
|
|
4563
|
+
static getProtocolV2BootResources(): IProtocolV2BootResources | undefined;
|
|
4546
4564
|
static getProtobufMessages(schema?: ProtobufMessageSchema): JSON;
|
|
4547
4565
|
static getSettings(key?: undefined): ConnectSettings;
|
|
4548
4566
|
static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
|
|
@@ -4655,4 +4673,4 @@ declare const HardwareSdk: ({ init, call, dispose, eventEmitter, uiResponse, can
|
|
|
4655
4673
|
declare const HardwareSDKLowLevel: ({ init, call, dispose, eventEmitter, addHardwareGlobalEventListener, uiResponse, cancel, updateSettings, switchTransport, }: LowLevelInjectApi) => LowLevelCoreApi;
|
|
4656
4674
|
declare const HardwareTopLevelSdk: () => CoreApi;
|
|
4657
4675
|
|
|
4658
|
-
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, UiResponseCorrelation, UiResponseCorrelationFields, 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 };
|
|
4676
|
+
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, UiResponseCorrelation, UiResponseCorrelationFields, 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
|
|
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
|
-
|
|
39591
|
-
|
|
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
|
}
|
|
@@ -49076,6 +49107,7 @@ const PROTOCOL_V2_OKPP_HEADER_SIZE = 0x52a0;
|
|
|
49076
49107
|
const PROTOCOL_V2_OKPP_PAYLOAD_HASH_OFFSET = 0x200;
|
|
49077
49108
|
const PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET = 0x240;
|
|
49078
49109
|
const PROTOCOL_V2_OKPP_HASH_SIZE = 64;
|
|
49110
|
+
const PROTOCOL_V2_BOOT_RESOURCES_FILE_NAME = 'boot_resources.crate.okpkg';
|
|
49079
49111
|
const getProtocolV2DeviceTransferProgress = (bytesBeforeChunk, bytesAfterChunk, totalBytes) => {
|
|
49080
49112
|
if (!Number.isFinite(totalBytes) || totalBytes <= 0) {
|
|
49081
49113
|
return 100;
|
|
@@ -49300,6 +49332,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49300
49332
|
{ name: 'chunkSize', type: 'number' },
|
|
49301
49333
|
{ name: 'forcedUpdateRes', type: 'boolean' },
|
|
49302
49334
|
{ name: 'bootloaderBinary', type: 'buffer' },
|
|
49335
|
+
{ name: 'bootResourcesBinary', type: 'buffer' },
|
|
49303
49336
|
{ name: 'romloaderBinary', type: 'buffer' },
|
|
49304
49337
|
{ name: 'applicationP1Binary', type: 'buffer' },
|
|
49305
49338
|
{ name: 'applicationP2Binary', type: 'buffer' },
|
|
@@ -49317,6 +49350,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49317
49350
|
chunkSize: payload.chunkSize,
|
|
49318
49351
|
forcedUpdateRes: payload.forcedUpdateRes,
|
|
49319
49352
|
bootloaderBinary: payload.bootloaderBinary,
|
|
49353
|
+
bootResourcesBinary: payload.bootResourcesBinary,
|
|
49320
49354
|
romloaderBinary: payload.romloaderBinary,
|
|
49321
49355
|
applicationP1Binary: payload.applicationP1Binary,
|
|
49322
49356
|
applicationP2Binary: payload.applicationP2Binary,
|
|
@@ -49352,7 +49386,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49352
49386
|
});
|
|
49353
49387
|
}
|
|
49354
49388
|
runProtocolV2() {
|
|
49355
|
-
var _a, _b, _c, _d;
|
|
49389
|
+
var _a, _b, _c, _d, _e;
|
|
49356
49390
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49357
49391
|
yield this.captureProtocolV2PhysicalIdentity();
|
|
49358
49392
|
const deviceFeatures = yield this.getProtocolV2DeviceFeatures();
|
|
@@ -49361,6 +49395,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49361
49395
|
const resourceRecoveryMode = Boolean(this.isProtocolV2BootloaderMode() || this.isProtocolV2RomloaderMode());
|
|
49362
49396
|
let fwBinaryMap = [];
|
|
49363
49397
|
let bootloaderBinary = null;
|
|
49398
|
+
let bootResourcesInstallItem;
|
|
49364
49399
|
let installItems;
|
|
49365
49400
|
let resourceBundles;
|
|
49366
49401
|
try {
|
|
@@ -49370,7 +49405,9 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49370
49405
|
const needsRemoteFirmware = !this.hasExplicitProtocolV2Payload(fwBinaryMap);
|
|
49371
49406
|
const needsRemoteResources = !((_b = this.params.resourceBundleFiles) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
49372
49407
|
!!((_c = this.params.targetsToUpdate) === null || _c === void 0 ? void 0 : _c.includes('resource'));
|
|
49373
|
-
|
|
49408
|
+
const needsRemoteBootResources = !this.params.bootResourcesBinary &&
|
|
49409
|
+
!!((_d = this.params.targetsToUpdate) === null || _d === void 0 ? void 0 : _d.includes('boot_resources'));
|
|
49410
|
+
if (needsRemoteFirmware || needsRemoteResources || needsRemoteBootResources) {
|
|
49374
49411
|
yield DataManager.forceReloadData();
|
|
49375
49412
|
}
|
|
49376
49413
|
if (needsRemoteFirmware) {
|
|
@@ -49379,13 +49416,23 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49379
49416
|
fwBinaryMap = remoteBinaries.fwBinaryMap;
|
|
49380
49417
|
installItems = remoteBinaries.installItems;
|
|
49381
49418
|
}
|
|
49419
|
+
bootResourcesInstallItem = yield this.prepareProtocolV2BootResources();
|
|
49420
|
+
if (bootResourcesInstallItem) {
|
|
49421
|
+
installItems = [
|
|
49422
|
+
bootResourcesInstallItem,
|
|
49423
|
+
...(installItems !== null && installItems !== void 0 ? installItems : this.buildProtocolV2InstallItems({ bootloaderBinary, fwBinaryMap })),
|
|
49424
|
+
];
|
|
49425
|
+
}
|
|
49382
49426
|
resourceBundles = yield this.prepareProtocolV2ResourceBundles(resourceRecoveryMode);
|
|
49383
49427
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
|
|
49384
49428
|
}
|
|
49385
49429
|
catch (err) {
|
|
49386
|
-
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (
|
|
49430
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_e = err.message) !== null && _e !== void 0 ? _e : err);
|
|
49387
49431
|
}
|
|
49388
|
-
if (!bootloaderBinary &&
|
|
49432
|
+
if (!bootloaderBinary &&
|
|
49433
|
+
fwBinaryMap.length === 0 &&
|
|
49434
|
+
!(installItems === null || installItems === void 0 ? void 0 : installItems.length) &&
|
|
49435
|
+
!(resourceBundles === null || resourceBundles === void 0 ? void 0 : resourceBundles.length)) {
|
|
49389
49436
|
if (resourceBundles !== undefined) {
|
|
49390
49437
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.FirmwareUpdateCompleted);
|
|
49391
49438
|
return this.getProtocolV2VersionResult(deviceFeatures);
|
|
@@ -49454,6 +49501,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49454
49501
|
var _a;
|
|
49455
49502
|
return (!!((_a = this.params.resourceBundleFiles) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
49456
49503
|
!!this.params.bootloaderBinary ||
|
|
49504
|
+
!!this.params.bootResourcesBinary ||
|
|
49457
49505
|
fwBinaryMap.length > 0);
|
|
49458
49506
|
}
|
|
49459
49507
|
buildProtocolV2InstallItems({ bootloaderBinary, fwBinaryMap, }) {
|
|
@@ -49568,6 +49616,50 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
49568
49616
|
};
|
|
49569
49617
|
});
|
|
49570
49618
|
}
|
|
49619
|
+
validateProtocolV2BootResourcesBinary(binary, resource) {
|
|
49620
|
+
if (resource && !isProtocolV2ResourceFileValid(binary, resource)) {
|
|
49621
|
+
throw new Error('Pro2 boot resources file verification failed');
|
|
49622
|
+
}
|
|
49623
|
+
const header = parseProtocolV2OkppHeader(toProtocolV2Bytes(binary));
|
|
49624
|
+
if (!header || header.type !== 'CRAT') {
|
|
49625
|
+
throw new Error('Invalid Pro2 boot resources CRATE header');
|
|
49626
|
+
}
|
|
49627
|
+
if (resource) {
|
|
49628
|
+
const expectedPayloadHash = normalizeProtocolV2Hex(resource.payloadHash);
|
|
49629
|
+
const expectedHeaderHash = normalizeProtocolV2Hex(resource.headerHash);
|
|
49630
|
+
if (header.payloadHash !== expectedPayloadHash) {
|
|
49631
|
+
throw new Error('Pro2 boot resources payload hash mismatch');
|
|
49632
|
+
}
|
|
49633
|
+
if (header.headerHash !== expectedHeaderHash) {
|
|
49634
|
+
throw new Error('Pro2 boot resources header hash mismatch');
|
|
49635
|
+
}
|
|
49636
|
+
}
|
|
49637
|
+
}
|
|
49638
|
+
prepareProtocolV2BootResources() {
|
|
49639
|
+
var _a;
|
|
49640
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49641
|
+
let binary = this.params.bootResourcesBinary;
|
|
49642
|
+
let resource;
|
|
49643
|
+
if (!binary) {
|
|
49644
|
+
if (!((_a = this.params.targetsToUpdate) === null || _a === void 0 ? void 0 : _a.includes('boot_resources'))) {
|
|
49645
|
+
return undefined;
|
|
49646
|
+
}
|
|
49647
|
+
resource = DataManager.getProtocolV2BootResources();
|
|
49648
|
+
if (!resource) {
|
|
49649
|
+
throw new Error('Missing Pro2 boot resources configuration');
|
|
49650
|
+
}
|
|
49651
|
+
Log$5.log('[FirmwareUpdateV4] downloading Pro2 boot resources CRATE');
|
|
49652
|
+
({ binary } = yield getSysResourceBinary(resource.url));
|
|
49653
|
+
}
|
|
49654
|
+
this.validateProtocolV2BootResourcesBinary(binary, resource);
|
|
49655
|
+
return {
|
|
49656
|
+
fileName: PROTOCOL_V2_BOOT_RESOURCES_FILE_NAME,
|
|
49657
|
+
binary,
|
|
49658
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
|
|
49659
|
+
kind: 'boot_resources',
|
|
49660
|
+
};
|
|
49661
|
+
});
|
|
49662
|
+
}
|
|
49571
49663
|
prepareProtocolV2ResourceBundles(recoveryMode) {
|
|
49572
49664
|
var _a, _b;
|
|
49573
49665
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/protocols/protocol-v2/resources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,eAAO,MAAM,0BAA0B,kFAOgB,CAAC;AAExD,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,MAAM,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UpdateV3Params {
|
|
|
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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EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC,CAAC"}
|
package/dist/types/settings.d.ts
CHANGED
|
@@ -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,CAA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S,EAAE;SACR,CAAC,IAAI,OAAO,GAAG,MAAM;KACvB,CAAC;CACH,CAAC;AAEF,KAAK,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAEpD,MAAM,MAAM,aAAa,GAAG;KACzB,CAAC,IAAI,YAAY,GAAG;QACnB,QAAQ,EAAE,oBAAoB,EAAE,CAAC;QAEjC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;QACvC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;QACvC,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;QACvC,iBAAiB,CAAC,EAAE,oBAAoB,EAAE,CAAC;QAC3C,GAAG,EAAE,uBAAuB,EAAE,CAAC;QAE/B,SAAS,CAAC,EAAE,oBAAoB,CAAC;KAClC;CACF,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE;QACN,OAAO,EAAE,aAAa,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,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.
|
|
3
|
+
"version": "1.2.0-alpha.47",
|
|
4
4
|
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.2.0-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.47",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.47",
|
|
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": "
|
|
47
|
+
"gitHead": "a4ddb3d56a31645d31345c7b3c222270d3b02ec0"
|
|
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;
|
|
@@ -423,6 +425,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
423
425
|
{ name: 'chunkSize', type: 'number' },
|
|
424
426
|
{ name: 'forcedUpdateRes', type: 'boolean' },
|
|
425
427
|
{ name: 'bootloaderBinary', type: 'buffer' },
|
|
428
|
+
{ name: 'bootResourcesBinary', type: 'buffer' },
|
|
426
429
|
{ name: 'romloaderBinary', type: 'buffer' },
|
|
427
430
|
{ name: 'applicationP1Binary', type: 'buffer' },
|
|
428
431
|
{ name: 'applicationP2Binary', type: 'buffer' },
|
|
@@ -441,6 +444,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
441
444
|
chunkSize: payload.chunkSize,
|
|
442
445
|
forcedUpdateRes: payload.forcedUpdateRes,
|
|
443
446
|
bootloaderBinary: payload.bootloaderBinary,
|
|
447
|
+
bootResourcesBinary: payload.bootResourcesBinary,
|
|
444
448
|
romloaderBinary: payload.romloaderBinary,
|
|
445
449
|
applicationP1Binary: payload.applicationP1Binary,
|
|
446
450
|
applicationP2Binary: payload.applicationP2Binary,
|
|
@@ -489,6 +493,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
489
493
|
|
|
490
494
|
let fwBinaryMap: ProtocolV2TargetBinary[] = [];
|
|
491
495
|
let bootloaderBinary: ArrayBuffer | null = null;
|
|
496
|
+
let bootResourcesInstallItem: ProtocolV2InstallItem | undefined;
|
|
492
497
|
let installItems: ProtocolV2InstallItem[] | undefined;
|
|
493
498
|
let resourceBundles: ProtocolV2ResourceBundleBinary[] | undefined;
|
|
494
499
|
try {
|
|
@@ -499,7 +504,10 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
499
504
|
const needsRemoteResources =
|
|
500
505
|
!this.params.resourceBundleFiles?.length &&
|
|
501
506
|
!!this.params.targetsToUpdate?.includes('resource');
|
|
502
|
-
|
|
507
|
+
const needsRemoteBootResources =
|
|
508
|
+
!this.params.bootResourcesBinary &&
|
|
509
|
+
!!this.params.targetsToUpdate?.includes('boot_resources');
|
|
510
|
+
if (needsRemoteFirmware || needsRemoteResources || needsRemoteBootResources) {
|
|
503
511
|
// Remote updates must use a freshly fetched config before any reboot or file write.
|
|
504
512
|
await DataManager.forceReloadData();
|
|
505
513
|
}
|
|
@@ -512,13 +520,25 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
512
520
|
fwBinaryMap = remoteBinaries.fwBinaryMap;
|
|
513
521
|
installItems = remoteBinaries.installItems;
|
|
514
522
|
}
|
|
523
|
+
bootResourcesInstallItem = await this.prepareProtocolV2BootResources();
|
|
524
|
+
if (bootResourcesInstallItem) {
|
|
525
|
+
installItems = [
|
|
526
|
+
bootResourcesInstallItem,
|
|
527
|
+
...(installItems ?? this.buildProtocolV2InstallItems({ bootloaderBinary, fwBinaryMap })),
|
|
528
|
+
];
|
|
529
|
+
}
|
|
515
530
|
resourceBundles = await this.prepareProtocolV2ResourceBundles(resourceRecoveryMode);
|
|
516
531
|
this.postTipMessage(FirmwareUpdateTipMessage.FinishDownloadFirmware);
|
|
517
532
|
} catch (err) {
|
|
518
533
|
throw ERRORS.TypedError(HardwareErrorCode.FirmwareUpdateDownloadFailed, err.message ?? err);
|
|
519
534
|
}
|
|
520
535
|
|
|
521
|
-
if (
|
|
536
|
+
if (
|
|
537
|
+
!bootloaderBinary &&
|
|
538
|
+
fwBinaryMap.length === 0 &&
|
|
539
|
+
!installItems?.length &&
|
|
540
|
+
!resourceBundles?.length
|
|
541
|
+
) {
|
|
522
542
|
if (resourceBundles !== undefined) {
|
|
523
543
|
this.postTipMessage(FirmwareUpdateTipMessage.FirmwareUpdateCompleted);
|
|
524
544
|
return this.getProtocolV2VersionResult(deviceFeatures);
|
|
@@ -598,6 +618,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
598
618
|
return (
|
|
599
619
|
!!this.params.resourceBundleFiles?.length ||
|
|
600
620
|
!!this.params.bootloaderBinary ||
|
|
621
|
+
!!this.params.bootResourcesBinary ||
|
|
601
622
|
fwBinaryMap.length > 0
|
|
602
623
|
);
|
|
603
624
|
}
|
|
@@ -747,6 +768,54 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
747
768
|
};
|
|
748
769
|
}
|
|
749
770
|
|
|
771
|
+
private validateProtocolV2BootResourcesBinary(
|
|
772
|
+
binary: ArrayBuffer,
|
|
773
|
+
resource?: IProtocolV2BootResources
|
|
774
|
+
) {
|
|
775
|
+
if (resource && !isProtocolV2ResourceFileValid(binary, resource)) {
|
|
776
|
+
throw new Error('Pro2 boot resources file verification failed');
|
|
777
|
+
}
|
|
778
|
+
const header = parseProtocolV2OkppHeader(toProtocolV2Bytes(binary));
|
|
779
|
+
if (!header || header.type !== 'CRAT') {
|
|
780
|
+
throw new Error('Invalid Pro2 boot resources CRATE header');
|
|
781
|
+
}
|
|
782
|
+
if (resource) {
|
|
783
|
+
const expectedPayloadHash = normalizeProtocolV2Hex(resource.payloadHash);
|
|
784
|
+
const expectedHeaderHash = normalizeProtocolV2Hex(resource.headerHash);
|
|
785
|
+
if (header.payloadHash !== expectedPayloadHash) {
|
|
786
|
+
throw new Error('Pro2 boot resources payload hash mismatch');
|
|
787
|
+
}
|
|
788
|
+
if (header.headerHash !== expectedHeaderHash) {
|
|
789
|
+
throw new Error('Pro2 boot resources header hash mismatch');
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
private async prepareProtocolV2BootResources(): Promise<ProtocolV2InstallItem | undefined> {
|
|
795
|
+
let binary = this.params.bootResourcesBinary;
|
|
796
|
+
let resource: IProtocolV2BootResources | undefined;
|
|
797
|
+
|
|
798
|
+
if (!binary) {
|
|
799
|
+
if (!this.params.targetsToUpdate?.includes('boot_resources')) {
|
|
800
|
+
return undefined;
|
|
801
|
+
}
|
|
802
|
+
resource = DataManager.getProtocolV2BootResources();
|
|
803
|
+
if (!resource) {
|
|
804
|
+
throw new Error('Missing Pro2 boot resources configuration');
|
|
805
|
+
}
|
|
806
|
+
Log.log('[FirmwareUpdateV4] downloading Pro2 boot resources CRATE');
|
|
807
|
+
({ binary } = await getSysResourceBinary(resource.url));
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
this.validateProtocolV2BootResourcesBinary(binary, resource);
|
|
811
|
+
return {
|
|
812
|
+
fileName: PROTOCOL_V2_BOOT_RESOURCES_FILE_NAME,
|
|
813
|
+
binary,
|
|
814
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
|
|
815
|
+
kind: 'boot_resources',
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
|
|
750
819
|
private async prepareProtocolV2ResourceBundles(
|
|
751
820
|
recoveryMode: boolean
|
|
752
821
|
): 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
|
|
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
|
|
|
@@ -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 */
|
package/src/types/settings.ts
CHANGED
|
@@ -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. */
|