@onekeyfe/hd-core 1.2.0-alpha.77 → 1.2.0-alpha.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/check-all-firmware-release-protocol-v2.test.ts +12 -71
- package/__tests__/device-state-mapper.test.ts +16 -1
- package/__tests__/device-state-projector.test.ts +20 -0
- package/__tests__/device-state-store.test.ts +27 -0
- package/__tests__/homescreen.test.ts +17 -0
- package/__tests__/method-protocol-support.test.ts +13 -1
- package/__tests__/protocol-v2-resources.test.ts +113 -222
- package/__tests__/protocol-v2.test.ts +110 -380
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +0 -6
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/UploadPortfolio.d.ts.map +1 -1
- package/dist/api/utils.d.ts +2 -0
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -2
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/device/DeviceStateMapper.d.ts.map +1 -1
- package/dist/device/DeviceStateProjector.d.ts.map +1 -1
- package/dist/device/DeviceStateStore.d.ts.map +1 -1
- package/dist/index.d.ts +96 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +515 -597
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/resources.d.ts +31 -28
- package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +1 -0
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +1 -0
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +2 -0
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2ResourceManifest.d.ts +17 -0
- package/dist/types/api/protocolV2ResourceManifest.d.ts.map +1 -0
- package/dist/types/device.d.ts +8 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/settings.d.ts +30 -21
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/homescreen.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/CheckAllFirmwareRelease.ts +5 -34
- package/src/api/FirmwareUpdateV4.ts +48 -220
- package/src/api/UploadPortfolio.ts +18 -0
- package/src/api/utils.ts +25 -0
- package/src/data-manager/DataManager.ts +17 -6
- package/src/device/DeviceStateMapper.ts +42 -0
- package/src/device/DeviceStateProjector.ts +58 -0
- package/src/device/DeviceStateStore.ts +31 -0
- package/src/index.ts +8 -0
- package/src/inject.ts +2 -0
- package/src/protocols/protocol-v2/resources.ts +193 -324
- package/src/types/api/checkAllFirmwareRelease.ts +1 -0
- package/src/types/api/export.ts +4 -0
- package/src/types/api/index.ts +2 -0
- package/src/types/api/protocolV2ResourceManifest.ts +19 -0
- package/src/types/device.ts +16 -0
- package/src/types/settings.ts +30 -36
- package/src/utils/homescreen.ts +5 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FirmwareUpdateV4Target } from './firmwareUpdate';
|
|
2
|
+
|
|
3
|
+
export type ProtocolV2ResourceManifestBinary = {
|
|
4
|
+
archivePath: string;
|
|
5
|
+
binary: ArrayBuffer;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ProtocolV2PreparedResourceFile = {
|
|
9
|
+
binary: ArrayBuffer;
|
|
10
|
+
devicePath: string;
|
|
11
|
+
size: number;
|
|
12
|
+
fileHash: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export declare function prepareProtocolV2ResourceFiles(input: {
|
|
16
|
+
manifest: unknown;
|
|
17
|
+
files: ProtocolV2ResourceManifestBinary[];
|
|
18
|
+
targetsToUpdate: readonly FirmwareUpdateV4Target[];
|
|
19
|
+
}): ProtocolV2PreparedResourceFile[];
|
package/src/types/device.ts
CHANGED
|
@@ -259,6 +259,19 @@ export type DeviceStateVersions = {
|
|
|
259
259
|
se04Boot?: string | null;
|
|
260
260
|
};
|
|
261
261
|
|
|
262
|
+
export type DeviceStateSecurityElement = {
|
|
263
|
+
type: string | null;
|
|
264
|
+
state: string | null;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export type DeviceStateSecurityElements = Partial<
|
|
268
|
+
Record<'se01' | 'se02' | 'se03' | 'se04', DeviceStateSecurityElement>
|
|
269
|
+
>;
|
|
270
|
+
|
|
271
|
+
export type DeviceStateSecurityElementsPatch = Partial<
|
|
272
|
+
Record<keyof DeviceStateSecurityElements, Partial<DeviceStateSecurityElement>>
|
|
273
|
+
>;
|
|
274
|
+
|
|
262
275
|
export type DeviceState = {
|
|
263
276
|
schemaVersion: 1;
|
|
264
277
|
revision: number;
|
|
@@ -270,6 +283,8 @@ export type DeviceState = {
|
|
|
270
283
|
status: DeviceStateStatus;
|
|
271
284
|
settings: DeviceStateSettings;
|
|
272
285
|
versions: DeviceStateVersions;
|
|
286
|
+
/** Secure-element metadata exposed by the unified firmware information read. */
|
|
287
|
+
securityElements?: DeviceStateSecurityElements;
|
|
273
288
|
capabilities: Array<number | string>;
|
|
274
289
|
verification?: Partial<DeviceFeaturesVerify>;
|
|
275
290
|
};
|
|
@@ -281,6 +296,7 @@ export type DeviceStatePatch = {
|
|
|
281
296
|
status?: Partial<DeviceStateStatus>;
|
|
282
297
|
settings?: Partial<DeviceStateSettings>;
|
|
283
298
|
versions?: Partial<DeviceStateVersions>;
|
|
299
|
+
securityElements?: DeviceStateSecurityElementsPatch;
|
|
284
300
|
capabilities?: Array<number | string>;
|
|
285
301
|
verification?: DeviceFeaturesVerify;
|
|
286
302
|
raw?: DeviceFeaturesRawPatch;
|
package/src/types/settings.ts
CHANGED
|
@@ -64,48 +64,42 @@ export type IProtocolV2FirmwareComponent = {
|
|
|
64
64
|
version?: IVersionArray;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export type
|
|
68
|
-
|
|
69
|
-
| 'animation'
|
|
70
|
-
| 'wallpaper'
|
|
71
|
-
| 'translations'
|
|
72
|
-
| 'roobert'
|
|
73
|
-
| 'noto'
|
|
74
|
-
| 'firmware_logo';
|
|
75
|
-
|
|
76
|
-
/** Pro2 RES package descriptor. Hashes identify content without a human-managed version. */
|
|
77
|
-
export type IProtocolV2Resource = {
|
|
78
|
-
type: IProtocolV2ResourceType;
|
|
79
|
-
url: string;
|
|
80
|
-
/** Complete okpkg file size in bytes. */
|
|
81
|
-
size: number;
|
|
82
|
-
/** SHA-256 of the complete okpkg file. */
|
|
83
|
-
fileHash: string;
|
|
84
|
-
/** SHA3-512 header_hash from the signed okpkg header. */
|
|
85
|
-
headerHash: string;
|
|
67
|
+
export type IProtocolV2ResourceSource = {
|
|
68
|
+
manifestUrl: string;
|
|
86
69
|
};
|
|
87
70
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
name?: string;
|
|
91
|
-
url: string;
|
|
92
|
-
devicePath: string;
|
|
93
|
-
size: number;
|
|
94
|
-
/** SHA-256 of the complete file. */
|
|
95
|
-
fileHash: string;
|
|
71
|
+
export type IProtocolV2Resources = {
|
|
72
|
+
source: IProtocolV2ResourceSource;
|
|
96
73
|
};
|
|
97
74
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
75
|
+
export type IProtocolV2ResourceManifestFile = {
|
|
76
|
+
archive_path: string;
|
|
77
|
+
original_name: string;
|
|
78
|
+
device_path: string;
|
|
79
|
+
size: number;
|
|
80
|
+
sha256: string;
|
|
81
|
+
signed: true;
|
|
82
|
+
sig_algo: 'ed25519' | 'mldsa65';
|
|
83
|
+
payload_version: string | null;
|
|
104
84
|
};
|
|
105
85
|
|
|
106
|
-
export type
|
|
107
|
-
|
|
108
|
-
|
|
86
|
+
export type IProtocolV2ResourceManifest = {
|
|
87
|
+
schema: 1;
|
|
88
|
+
artifact_name: string;
|
|
89
|
+
release_name: string;
|
|
90
|
+
variant: 'resource';
|
|
91
|
+
commit: string;
|
|
92
|
+
short_sha: string;
|
|
93
|
+
timestamp_utc: string;
|
|
94
|
+
core_version: string;
|
|
95
|
+
key_set: string;
|
|
96
|
+
device_root: 'vol0:';
|
|
97
|
+
restore_mode: 'bootloader_update';
|
|
98
|
+
trees: Array<{
|
|
99
|
+
path: string;
|
|
100
|
+
device: string;
|
|
101
|
+
}>;
|
|
102
|
+
files: IProtocolV2ResourceManifestFile[];
|
|
109
103
|
};
|
|
110
104
|
|
|
111
105
|
/** Pro2 RESC bundle okpkg descriptor for incremental FileWrite synchronization. */
|
package/src/utils/homescreen.ts
CHANGED
|
@@ -328,6 +328,10 @@ export const getNftSize = ({
|
|
|
328
328
|
full: { width: PRO2_NFT_IMAGE_WIDTH, height: PRO2_NFT_IMAGE_HEIGHT },
|
|
329
329
|
thumbnail: { width: PRO2_NFT_THUMBNAIL_WIDTH, height: PRO2_NFT_THUMBNAIL_HEIGHT },
|
|
330
330
|
},
|
|
331
|
+
neo: {
|
|
332
|
+
full: { width: PRO2_NFT_IMAGE_WIDTH, height: PRO2_NFT_IMAGE_HEIGHT },
|
|
333
|
+
thumbnail: { width: PRO2_NFT_THUMBNAIL_WIDTH, height: PRO2_NFT_THUMBNAIL_HEIGHT },
|
|
334
|
+
},
|
|
331
335
|
};
|
|
332
336
|
|
|
333
337
|
return sizes[deviceType]?.[thumbnail ? 'thumbnail' : 'full'];
|
|
@@ -342,7 +346,7 @@ export const getHomeScreenSize = ({
|
|
|
342
346
|
homeScreenType: 'WallPaper' | 'Nft';
|
|
343
347
|
thumbnail?: boolean;
|
|
344
348
|
}) => {
|
|
345
|
-
if (deviceType === EDeviceType.Pro2) {
|
|
349
|
+
if (deviceType === EDeviceType.Pro2 || deviceType === EDeviceType.Neo) {
|
|
346
350
|
return thumbnail ? undefined : { width: PRO2_WALLPAPER_WIDTH, height: PRO2_WALLPAPER_HEIGHT };
|
|
347
351
|
}
|
|
348
352
|
|