@onekeyfe/hd-core 1.2.0-alpha.97 → 1.2.0-alpha.98
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 +404 -84
- package/__tests__/check-firmware-release-protocol-v2.test.ts +199 -0
- package/__tests__/firmware-memory-host.test.ts +112 -0
- package/__tests__/firmware-update/device-update-bootloader.test.ts +13 -2
- package/__tests__/firmware-update/firmware-host-binding.test.ts +9 -0
- package/__tests__/firmware-update/firmware-prepared-host-digest.test.ts +573 -0
- package/__tests__/firmware-update/firmware-prepared-resource-archive.test.ts +150 -0
- package/__tests__/firmware-update/firmware-update-plan.test.ts +232 -70
- package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +53 -1
- package/__tests__/firmware-update/firmware-update-prepared-resource-executors.test.ts +326 -0
- package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +2 -2
- package/__tests__/protocol-v2-resources.test.ts +148 -232
- package/__tests__/protocol-v2.test.ts +1236 -516
- package/dist/api/CheckAllFirmwareRelease.d.ts +2 -3
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBLEFirmwareRelease.d.ts +3 -2
- package/dist/api/CheckBLEFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CheckBootloaderRelease.d.ts +2 -1
- package/dist/api/CheckBootloaderRelease.d.ts.map +1 -1
- package/dist/api/CheckFirmwareRelease.d.ts +3 -2
- package/dist/api/CheckFirmwareRelease.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV2.d.ts +1 -0
- package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +8 -8
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/UploadPortfolio.d.ts.map +1 -1
- package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareHostBinding.d.ts +1 -1
- package/dist/api/firmware/FirmwareHostBinding.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareMemoryHost.d.ts +22 -0
- package/dist/api/firmware/FirmwareMemoryHost.d.ts.map +1 -0
- package/dist/api/firmware/FirmwarePreparedResourceArchive.d.ts +11 -0
- package/dist/api/firmware/FirmwarePreparedResourceArchive.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts +48 -1
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +6 -1
- package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +0 -1
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/firmware/protocolV2Release.d.ts +33 -0
- package/dist/api/firmware/protocolV2Release.d.ts.map +1 -0
- package/dist/data-manager/DataManager.d.ts +4 -3
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/index.d.ts +108 -114
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1633 -967
- package/dist/protocols/protocol-v2/resources.d.ts +10 -28
- package/dist/protocols/protocol-v2/resources.d.ts.map +1 -1
- package/dist/types/api/checkAllFirmwareRelease.d.ts +20 -8
- package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkBLEFirmwareRelease.d.ts +2 -13
- package/dist/types/api/checkBLEFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkBootloaderRelease.d.ts +2 -6
- package/dist/types/api/checkBootloaderRelease.d.ts.map +1 -1
- package/dist/types/api/checkFirmwareRelease.d.ts +2 -13
- package/dist/types/api/checkFirmwareRelease.d.ts.map +1 -1
- package/dist/types/api/checkFirmwareTypeAvailable.d.ts +2 -2
- package/dist/types/api/checkFirmwareTypeAvailable.d.ts.map +1 -1
- package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +1 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +4 -12
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdatePlan.d.ts +2 -2
- package/dist/types/api/firmwareUpdatePlan.d.ts.map +1 -1
- package/dist/types/settings.d.ts +35 -36
- package/dist/types/settings.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/CheckAllFirmwareRelease.ts +108 -80
- package/src/api/CheckBLEFirmwareRelease.ts +37 -5
- package/src/api/CheckBootloaderRelease.ts +35 -3
- package/src/api/CheckFirmwareRelease.ts +35 -7
- package/src/api/FirmwareUpdateV2.ts +108 -73
- package/src/api/FirmwareUpdateV3.ts +101 -56
- package/src/api/FirmwareUpdateV4.ts +885 -403
- package/src/api/UploadPortfolio.ts +18 -0
- package/src/api/device/DeviceUpdateBootloader.ts +37 -11
- package/src/api/firmware/FirmwareHostBinding.ts +16 -3
- package/src/api/firmware/FirmwareMemoryHost.ts +142 -0
- package/src/api/firmware/FirmwarePreparedResourceArchive.ts +207 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +282 -122
- package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +27 -3
- package/src/api/firmware/protocolV2Release.ts +168 -0
- package/src/data-manager/DataManager.ts +35 -19
- package/src/index.ts +10 -0
- package/src/protocols/protocol-v2/resources.ts +157 -341
- package/src/types/api/checkAllFirmwareRelease.ts +27 -12
- package/src/types/api/checkBLEFirmwareRelease.ts +4 -13
- package/src/types/api/checkBootloaderRelease.ts +2 -6
- package/src/types/api/checkFirmwareRelease.ts +2 -13
- package/src/types/api/checkFirmwareTypeAvailable.ts +2 -2
- package/src/types/api/deviceUpdateBootloader.ts +1 -0
- package/src/types/api/export.ts +6 -1
- package/src/types/api/firmwareUpdate.ts +12 -17
- package/src/types/api/firmwareUpdatePlan.ts +2 -2
- package/src/types/settings.ts +35 -61
- package/src/utils/deviceFeaturesUtils.ts +2 -2
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import type { IFirmwareReleaseInfo } from '../settings';
|
|
2
1
|
import type { EFirmwareType } from '@onekeyfe/hd-shared';
|
|
3
2
|
import type { Response } from '../params';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
type FirmwareRelease = {
|
|
7
|
-
status: IDeviceFirmwareStatus;
|
|
8
|
-
changelog: {
|
|
9
|
-
'en-US': string;
|
|
10
|
-
'zh-CN': string;
|
|
11
|
-
}[];
|
|
12
|
-
release: IFirmwareReleaseInfo;
|
|
13
|
-
bootloaderMode: boolean;
|
|
14
|
-
};
|
|
3
|
+
import type { FirmwareReleaseCheckResult } from './checkAllFirmwareRelease';
|
|
15
4
|
|
|
16
5
|
export type CheckFirmwareReleaseParams = {
|
|
17
6
|
firmwareType?: EFirmwareType;
|
|
@@ -20,4 +9,4 @@ export type CheckFirmwareReleaseParams = {
|
|
|
20
9
|
export declare function checkFirmwareRelease(
|
|
21
10
|
connectId?: string,
|
|
22
11
|
params?: CheckFirmwareReleaseParams
|
|
23
|
-
): Response<
|
|
12
|
+
): Response<FirmwareReleaseCheckResult | null>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
|
|
2
2
|
import type { Response } from '../params';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FirmwareReleaseCheckResult } from './checkAllFirmwareRelease';
|
|
4
4
|
|
|
5
5
|
export type CheckFirmwareTypeAvailableParams = {
|
|
6
6
|
deviceType: EDeviceType;
|
|
@@ -9,4 +9,4 @@ export type CheckFirmwareTypeAvailableParams = {
|
|
|
9
9
|
|
|
10
10
|
export declare function checkFirmwareTypeAvailable(
|
|
11
11
|
params: CheckFirmwareTypeAvailableParams
|
|
12
|
-
): Response<
|
|
12
|
+
): Response<FirmwareReleaseCheckResult | undefined>;
|
|
@@ -8,6 +8,7 @@ export type DeviceUpdateBootloaderParams = {
|
|
|
8
8
|
preparedPlan?: FirmwareUpdatePreparedPlan;
|
|
9
9
|
hostBindingGeneration?: number;
|
|
10
10
|
binary?: ArrayBuffer;
|
|
11
|
+
/** @deprecated Core derives the bootloader artifact from preparedPlan. */
|
|
11
12
|
artifact?: FirmwareArtifactReference;
|
|
12
13
|
artifactReader?: FirmwareArtifactReader;
|
|
13
14
|
firmwareType?: EFirmwareType;
|
package/src/types/api/export.ts
CHANGED
|
@@ -50,7 +50,12 @@ export type {
|
|
|
50
50
|
FirmwareUpdatePreparedPlan,
|
|
51
51
|
} from './firmwareUpdatePreparedPlan';
|
|
52
52
|
export type { FirmwareUpdateCapabilities } from './firmwareUpdateCapabilities';
|
|
53
|
-
export type {
|
|
53
|
+
export type {
|
|
54
|
+
AllFirmwareRelease,
|
|
55
|
+
BridgeReleaseCheckResult,
|
|
56
|
+
FirmwareReleaseCheckResult,
|
|
57
|
+
ProtocolV2ComponentReleaseInfo,
|
|
58
|
+
} from './checkAllFirmwareRelease';
|
|
54
59
|
export type {
|
|
55
60
|
ProtocolV2FirmwareComponentRelease,
|
|
56
61
|
ProtocolV2FirmwareComponentReleaseStatus,
|
|
@@ -26,6 +26,8 @@ export interface FirmwareArtifactReader {
|
|
|
26
26
|
|
|
27
27
|
export interface FirmwareUpdateHostBinding {
|
|
28
28
|
artifactReader: FirmwareArtifactReader;
|
|
29
|
+
/** 将读取器 generation 绑定到包含 ZIP 条目的完整 PreparedPlan。 */
|
|
30
|
+
preparedPlanDigest: string;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export interface FirmwareUpdateBinaryParams {
|
|
@@ -36,7 +38,8 @@ export interface FirmwareUpdateBinaryParams {
|
|
|
36
38
|
export interface FirmwareUpdateArtifactParams {
|
|
37
39
|
preparedPlan: FirmwareUpdatePreparedPlan;
|
|
38
40
|
hostBindingGeneration: number;
|
|
39
|
-
artifact
|
|
41
|
+
/** @deprecated Core derives the component artifact from preparedPlan. */
|
|
42
|
+
artifact?: FirmwareArtifactReference;
|
|
40
43
|
resourceEntries?: Array<{
|
|
41
44
|
entryName: string;
|
|
42
45
|
artifact: FirmwareArtifactReference;
|
|
@@ -118,6 +121,7 @@ export interface FirmwareUpdateV3Params {
|
|
|
118
121
|
*/
|
|
119
122
|
export type FirmwareUpdateV4Target =
|
|
120
123
|
| 'boot'
|
|
124
|
+
/** @deprecated Use resource with resourceArchiveBinary. */
|
|
121
125
|
| 'boot_resources'
|
|
122
126
|
| 'app_v1'
|
|
123
127
|
| 'app_v2'
|
|
@@ -130,6 +134,7 @@ export type FirmwareUpdateV4Target =
|
|
|
130
134
|
|
|
131
135
|
export interface FirmwareUpdateV4Params {
|
|
132
136
|
preparedPlan?: FirmwareUpdatePreparedPlan;
|
|
137
|
+
/** Required whenever preparedPlan is present; Core resolves the reader from this digest-bound host. */
|
|
133
138
|
hostBindingGeneration?: number;
|
|
134
139
|
platform: IPlatform;
|
|
135
140
|
expectedDeviceId?: string;
|
|
@@ -153,26 +158,16 @@ export interface FirmwareUpdateV4Params {
|
|
|
153
158
|
se02Binary?: ArrayBuffer;
|
|
154
159
|
se03Binary?: ArrayBuffer;
|
|
155
160
|
se04Binary?: ArrayBuffer;
|
|
161
|
+
/** Complete Protocol V2 resource ZIP for local development; Core converts it to a local PreparedPlan. */
|
|
162
|
+
resourceArchiveBinary?: ArrayBuffer;
|
|
156
163
|
forcedUpdateRes?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* Arbitrary Protocol V2 resource files written directly with FilesystemFileWrite.
|
|
159
|
-
* Use this for manifest-driven boot resources and other non-RESC files.
|
|
160
|
-
* When provided, these files are authoritative for resource and boot_resources targets.
|
|
161
|
-
*/
|
|
162
|
-
resourceFiles?: Array<{
|
|
163
|
-
binary: ArrayBuffer;
|
|
164
|
-
devicePath: string;
|
|
165
|
-
size?: number;
|
|
166
|
-
fileHash?: string;
|
|
167
|
-
}>;
|
|
168
164
|
artifactReader?: FirmwareArtifactReader;
|
|
169
165
|
componentArtifacts?: Partial<
|
|
170
|
-
Record<
|
|
166
|
+
Record<
|
|
167
|
+
Exclude<FirmwareUpdateV4Target, 'resource' | 'boot_resources'>,
|
|
168
|
+
FirmwareArtifactReference
|
|
169
|
+
>
|
|
171
170
|
>;
|
|
172
|
-
resourceBundleArtifacts?: Array<{
|
|
173
|
-
name: string;
|
|
174
|
-
artifact: FirmwareArtifactReference;
|
|
175
|
-
}>;
|
|
176
171
|
}
|
|
177
172
|
|
|
178
173
|
export declare function registerFirmwareUpdateHostBinding(
|
|
@@ -20,8 +20,8 @@ export interface FirmwareUpdatePlanArtifact {
|
|
|
20
20
|
url: string;
|
|
21
21
|
container: 'raw' | 'zip';
|
|
22
22
|
logicalName?: string;
|
|
23
|
-
expectedSize
|
|
24
|
-
expectedSha256
|
|
23
|
+
expectedSize: number;
|
|
24
|
+
expectedSha256: string;
|
|
25
25
|
targetVersion?: string;
|
|
26
26
|
}
|
|
27
27
|
|
package/src/types/settings.ts
CHANGED
|
@@ -64,66 +64,44 @@ export type IProtocolV2FirmwareComponent = {
|
|
|
64
64
|
version?: IVersionArray;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export type
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/** A file from the Protocol V2 resource manifest, written directly with FileWrite. */
|
|
89
|
-
export type IProtocolV2ResourceFile = {
|
|
90
|
-
name?: string;
|
|
91
|
-
url: string;
|
|
92
|
-
devicePath: string;
|
|
93
|
-
size: number;
|
|
94
|
-
/** SHA-256 of the complete file. */
|
|
95
|
-
fileHash: string;
|
|
67
|
+
export type IProtocolV2ResourceSource = {
|
|
68
|
+
archiveUrl: string;
|
|
69
|
+
archiveSha256: string;
|
|
70
|
+
archiveSize: number;
|
|
96
71
|
};
|
|
97
72
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
required: false;
|
|
101
|
-
target: 'RES';
|
|
102
|
-
manifestUrl?: string;
|
|
103
|
-
files: IProtocolV2ResourceFile[];
|
|
73
|
+
export type IProtocolV2Resources = {
|
|
74
|
+
source: IProtocolV2ResourceSource;
|
|
104
75
|
};
|
|
105
76
|
|
|
106
|
-
export type
|
|
107
|
-
|
|
108
|
-
|
|
77
|
+
export type IProtocolV2ResourceManifestFile = {
|
|
78
|
+
archive_path: string;
|
|
79
|
+
original_name: string;
|
|
80
|
+
device_path: string;
|
|
81
|
+
size: number;
|
|
82
|
+
sha256: string;
|
|
83
|
+
signed: true;
|
|
84
|
+
sig_algo: 'ed25519' | 'mldsa65';
|
|
85
|
+
payload_version: string | null;
|
|
109
86
|
};
|
|
110
87
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
88
|
+
export type IProtocolV2ResourceManifest = {
|
|
89
|
+
schema: 1;
|
|
90
|
+
artifact_name: string;
|
|
91
|
+
release_name: string;
|
|
92
|
+
variant: 'resource';
|
|
93
|
+
commit: string;
|
|
94
|
+
short_sha: string;
|
|
95
|
+
timestamp_utc: string;
|
|
96
|
+
core_version: string;
|
|
97
|
+
key_set: string;
|
|
98
|
+
device_root: 'vol0:';
|
|
99
|
+
restore_mode: 'bootloader_update';
|
|
100
|
+
trees: Array<{
|
|
101
|
+
path: string;
|
|
102
|
+
device: string;
|
|
103
|
+
}>;
|
|
104
|
+
files: IProtocolV2ResourceManifestFile[];
|
|
127
105
|
};
|
|
128
106
|
|
|
129
107
|
/** STM32 firmware config */
|
|
@@ -153,8 +131,6 @@ export type IFirmwareReleaseInfo = {
|
|
|
153
131
|
upgradeType?: 'payload-package-set' | string;
|
|
154
132
|
components?: Record<string, IProtocolV2FirmwareComponent>;
|
|
155
133
|
installOrder?: string[];
|
|
156
|
-
/** Pro2 RESC bundles for incremental direct FileWrite synchronization. */
|
|
157
|
-
resourceBundles?: IProtocolV2ResourceBundle[];
|
|
158
134
|
bootloaderChangelog?: {
|
|
159
135
|
[k in ILocale]: string;
|
|
160
136
|
};
|
|
@@ -183,22 +159,20 @@ export type IBLEFirmwareReleaseInfo = {
|
|
|
183
159
|
};
|
|
184
160
|
|
|
185
161
|
type IKnownDevice = Exclude<IDeviceType, 'unknown'>;
|
|
186
|
-
type ILegacyKnownDevice = Exclude<IKnownDevice, 'neo'>;
|
|
187
|
-
|
|
188
162
|
type IDeviceReleaseInfo = {
|
|
189
|
-
firmware
|
|
163
|
+
firmware?: IFirmwareReleaseInfo[];
|
|
190
164
|
/** Protocol V2 payload package set */
|
|
191
165
|
'firmware-v1'?: IFirmwareReleaseInfo[];
|
|
192
166
|
'firmware-v2'?: IFirmwareReleaseInfo[];
|
|
193
167
|
'firmware-v8'?: IFirmwareReleaseInfo[];
|
|
194
168
|
'firmware-btc-v8'?: IFirmwareReleaseInfo[];
|
|
195
|
-
ble
|
|
169
|
+
ble?: IBLEFirmwareReleaseInfo[];
|
|
196
170
|
/** Independent Protocol V2 resource release configuration. */
|
|
197
171
|
resources?: IProtocolV2Resources;
|
|
198
172
|
};
|
|
199
173
|
|
|
200
174
|
export type DeviceTypeMap = {
|
|
201
|
-
[k in
|
|
175
|
+
[k in Exclude<IKnownDevice, 'neo'>]: IDeviceReleaseInfo;
|
|
202
176
|
} & {
|
|
203
177
|
/** Optional until every remote-config producer publishes a Neo entry. */
|
|
204
178
|
neo?: IDeviceReleaseInfo;
|
|
@@ -328,7 +328,7 @@ export const getFirmwareUpdateField = ({
|
|
|
328
328
|
if (deviceType === EDeviceType.Pro) {
|
|
329
329
|
return latestFirmwareField;
|
|
330
330
|
}
|
|
331
|
-
if (deviceType === EDeviceType.Pro2) {
|
|
331
|
+
if (deviceType === EDeviceType.Pro2 || deviceType === EDeviceType.Neo) {
|
|
332
332
|
return 'firmware-v1';
|
|
333
333
|
}
|
|
334
334
|
return 'firmware';
|
|
@@ -374,7 +374,7 @@ export const getFirmwareUpdateFieldArray = (
|
|
|
374
374
|
return ['firmware-v8'];
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
if (deviceType === 'pro2') {
|
|
377
|
+
if (deviceType === 'pro2' || deviceType === 'neo') {
|
|
378
378
|
return ['firmware-v1'];
|
|
379
379
|
}
|
|
380
380
|
|