@onekeyfe/hd-core 1.2.0-alpha.0 → 1.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/__tests__/protocol-v2.test.ts +56 -178
  2. package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
  3. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  4. package/dist/api/FirmwareUpdateV4.d.ts +2 -2
  5. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  6. package/dist/api/GetDeviceInfo.d.ts.map +1 -1
  7. package/dist/api/GetFeatures.d.ts +1 -1
  8. package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
  9. package/dist/api/device/DeviceUnlock.d.ts +1 -1
  10. package/dist/api/firmware/bootloaderHelper.d.ts.map +1 -1
  11. package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
  12. package/dist/api/tron/TronSignMessage.d.ts +0 -1
  13. package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
  14. package/dist/api/tron/TronSignTransaction.d.ts +0 -1
  15. package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
  16. package/dist/core/index.d.ts.map +1 -1
  17. package/dist/device/Device.d.ts +10 -15
  18. package/dist/device/Device.d.ts.map +1 -1
  19. package/dist/deviceProfile/buildDeviceFeatures.d.ts +6 -0
  20. package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -0
  21. package/dist/deviceProfile/buildDeviceProfile.d.ts +3 -4
  22. package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -1
  23. package/dist/deviceProfile/index.d.ts +1 -1
  24. package/dist/deviceProfile/index.d.ts.map +1 -1
  25. package/dist/index.d.ts +571 -496
  26. package/dist/index.js +502 -571
  27. package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
  28. package/dist/types/api/getDeviceInfo.d.ts +2 -2
  29. package/dist/types/api/getDeviceInfo.d.ts.map +1 -1
  30. package/dist/types/device.d.ts +87 -8
  31. package/dist/types/device.d.ts.map +1 -1
  32. package/dist/utils/capabilitieUtils.d.ts.map +1 -1
  33. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  34. package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
  35. package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
  36. package/dist/utils/findDefectiveBatchDevice.d.ts +1 -1
  37. package/dist/utils/patch.d.ts +1 -1
  38. package/package.json +4 -4
  39. package/src/api/FirmwareUpdateV2.ts +9 -2
  40. package/src/api/FirmwareUpdateV3.ts +2 -1
  41. package/src/api/FirmwareUpdateV4.ts +24 -31
  42. package/src/api/GetDeviceInfo.ts +6 -13
  43. package/src/api/GetOnekeyFeatures.ts +3 -14
  44. package/src/api/GetPassphraseState.ts +2 -2
  45. package/src/api/firmware/bootloaderHelper.ts +3 -2
  46. package/src/api/firmware/getBinary.ts +1 -1
  47. package/src/api/firmware/releaseHelper.ts +3 -3
  48. package/src/api/firmware/uploadFirmware.ts +5 -2
  49. package/src/api/tron/TronSignMessage.ts +0 -1
  50. package/src/api/tron/TronSignTransaction.ts +0 -1
  51. package/src/core/index.ts +3 -7
  52. package/src/data-manager/DataManager.ts +4 -4
  53. package/src/device/Device.ts +74 -240
  54. package/src/device/DevicePool.ts +3 -3
  55. package/src/deviceProfile/buildDeviceFeatures.ts +367 -0
  56. package/src/deviceProfile/buildDeviceProfile.ts +102 -155
  57. package/src/deviceProfile/index.ts +4 -1
  58. package/src/protocols/protocol-v2/features.ts +6 -9
  59. package/src/types/api/getDeviceInfo.ts +2 -2
  60. package/src/types/device.ts +97 -34
  61. package/src/utils/capabilitieUtils.ts +1 -2
  62. package/src/utils/deviceFeaturesUtils.ts +11 -17
  63. package/src/utils/deviceInfoUtils.ts +11 -29
  64. package/src/utils/deviceVersionUtils.ts +7 -25
  65. package/src/utils/findDefectiveBatchDevice.ts +6 -6
  66. package/dist/deviceProfile/legacyFeaturesView.d.ts +0 -5
  67. package/dist/deviceProfile/legacyFeaturesView.d.ts.map +0 -1
  68. package/src/deviceProfile/legacyFeaturesView.ts +0 -123
@@ -0,0 +1,367 @@
1
+ import { EDeviceType, EFirmwareType } from '@onekeyfe/hd-shared';
2
+
3
+ import type { Features } from '../types';
4
+ import type { PROTO } from '../constants';
5
+ import type { DevFirmwareImageInfo, ProtocolV2DeviceInfo } from '@onekeyfe/hd-transport';
6
+
7
+ type ProtocolV2DeviceInfoCompat = ProtocolV2DeviceInfo & {
8
+ fw?: ProtocolV2DeviceInfo['fw'] & {
9
+ application?: DevFirmwareImageInfo | null;
10
+ application_data?: DevFirmwareImageInfo | null;
11
+ bootloader?: DevFirmwareImageInfo | null;
12
+ romloader?: DevFirmwareImageInfo | null;
13
+ };
14
+ coprocessor?: {
15
+ application?: DevFirmwareImageInfo | null;
16
+ bootloader?: DevFirmwareImageInfo | null;
17
+ bt_adv_name?: string | null;
18
+ bt_mac?: unknown;
19
+ } | null;
20
+ };
21
+
22
+ type ProtocolV1FeaturesCompat = PROTO.Features &
23
+ Partial<PROTO.OnekeyFeatures> & {
24
+ protocol_version?: number | null;
25
+ onekey_version?: string;
26
+ onekey_serial?: string;
27
+ };
28
+
29
+ const getImageVersion = (image?: DevFirmwareImageInfo | null) => image?.version ?? null;
30
+
31
+ const bytesToHex = (value: unknown): string | undefined => {
32
+ if (!value) return undefined;
33
+ if (typeof value === 'string') return value;
34
+ if (value instanceof Uint8Array) {
35
+ return Array.from(value)
36
+ .map(byte => byte.toString(16).padStart(2, '0'))
37
+ .join('');
38
+ }
39
+ if (Array.isArray(value)) {
40
+ return value.map(byte => Number(byte).toString(16).padStart(2, '0')).join('');
41
+ }
42
+ return undefined;
43
+ };
44
+
45
+ const getImageBuildId = (image?: DevFirmwareImageInfo | null) => image?.build_id ?? undefined;
46
+
47
+ const getImageHash = (image?: DevFirmwareImageInfo | null) => bytesToHex(image?.hash);
48
+
49
+ const firstValue = <T>(...values: Array<T | null | undefined>) =>
50
+ values.find(value => value !== undefined && value !== null);
51
+
52
+ const firstMeaningfulVersion = (...versions: Array<string | null | undefined>) =>
53
+ versions.find(version => Boolean(version && version !== '0.0.0')) ?? null;
54
+
55
+ const versionFromParts = (major?: number | null, minor?: number | null, patch?: number | null) =>
56
+ [major, minor, patch].map(part => Number(part) || 0).join('.');
57
+
58
+ const getProtocolV1Mode = (features: ProtocolV1FeaturesCompat): Features['mode'] => {
59
+ if (features.bootloader_mode === true) return 'bootloader';
60
+ if (features.initialized === false) return 'notInitialized';
61
+ if (features.initialized === true) return 'normal';
62
+ return 'unknown';
63
+ };
64
+
65
+ const getProtocolV1DeviceType = (features: ProtocolV1FeaturesCompat): Features['deviceType'] => {
66
+ const onekeyDeviceType = features.onekey_device_type as string | null | undefined;
67
+ switch (onekeyDeviceType) {
68
+ case 'CLASSIC':
69
+ return EDeviceType.Classic;
70
+ case 'CLASSIC1S':
71
+ return EDeviceType.Classic1s;
72
+ case 'MINI':
73
+ return EDeviceType.Mini;
74
+ case 'TOUCH':
75
+ return EDeviceType.Touch;
76
+ case 'PRO':
77
+ return EDeviceType.Pro;
78
+ case 'PRO2':
79
+ case 'pro2':
80
+ return EDeviceType.Pro2;
81
+ case 'PURE':
82
+ return EDeviceType.ClassicPure;
83
+ default:
84
+ break;
85
+ }
86
+
87
+ const serialNo = features.onekey_serial_no || features.onekey_serial || features.serial_no || '';
88
+ const prefix = serialNo.slice(0, 2).toLowerCase();
89
+ if (prefix === 'bi' || prefix === 'cl') return EDeviceType.Classic;
90
+ if (prefix === 'cp') return EDeviceType.ClassicPure;
91
+ if (prefix === 'mi') return EDeviceType.Mini;
92
+ if (prefix === 'tc') return EDeviceType.Touch;
93
+ if (prefix === 'pr') return EDeviceType.Pro;
94
+ if (prefix === 'p2') return EDeviceType.Pro2;
95
+ if (!serialNo && features.bootloader_mode === true && features.model === '1') {
96
+ return EDeviceType.Classic;
97
+ }
98
+ return EDeviceType.Unknown;
99
+ };
100
+
101
+ const getProtocolV1FirmwareType = (
102
+ features: ProtocolV1FeaturesCompat
103
+ ): Features['firmwareType'] => {
104
+ if (features.fw_vendor === 'OneKey Bitcoin-only') return EFirmwareType.BitcoinOnly;
105
+ return EFirmwareType.Universal;
106
+ };
107
+
108
+ const getProtocolV1Label = (
109
+ features: ProtocolV1FeaturesCompat,
110
+ deviceType: Features['deviceType'],
111
+ bleName: string | null
112
+ ) => {
113
+ if (features.label) return features.label;
114
+ if (bleName) return bleName;
115
+ if (deviceType === EDeviceType.Unknown) return null;
116
+ if (deviceType === EDeviceType.ClassicPure) return 'OneKey Classic 1S';
117
+ return `OneKey ${deviceType.charAt(0).toUpperCase()}${deviceType.slice(1)}`;
118
+ };
119
+
120
+ export const buildProtocolV1FeaturesPayload = (
121
+ protocolV1Features: PROTO.Features,
122
+ previous?: Features
123
+ ): Features => {
124
+ const features = protocolV1Features as ProtocolV1FeaturesCompat;
125
+ const firmwareVersion = firstMeaningfulVersion(
126
+ features.onekey_firmware_version,
127
+ features.onekey_version,
128
+ versionFromParts(features.major_version, features.minor_version, features.patch_version)
129
+ );
130
+ const bootloaderVersion = firstMeaningfulVersion(
131
+ features.onekey_boot_version,
132
+ features.bootloader_version,
133
+ features.bootloader_mode
134
+ ? versionFromParts(features.major_version, features.minor_version, features.patch_version)
135
+ : null
136
+ );
137
+ const boardVersion = firstMeaningfulVersion(
138
+ features.onekey_board_version,
139
+ features.boardloader_version
140
+ );
141
+ const bleVersion = firstMeaningfulVersion(features.onekey_ble_version, features.ble_ver);
142
+ const serialNo = features.onekey_serial_no || features.onekey_serial || features.serial_no || '';
143
+ const bleName = features.onekey_ble_name || features.ble_name || null;
144
+ const deviceType = getProtocolV1DeviceType(features);
145
+ const sessionId = features.session_id ?? previous?.sessionId ?? null;
146
+
147
+ return {
148
+ protocol: 'V1',
149
+ protocolVersion: features.protocol_version ?? previous?.protocolVersion ?? 1,
150
+ deviceType,
151
+ firmwareType: getProtocolV1FirmwareType(features),
152
+ model: features.model ?? null,
153
+ vendor: features.vendor ?? null,
154
+ deviceId: features.device_id ?? null,
155
+ serialNo,
156
+ label: getProtocolV1Label(features, deviceType, bleName),
157
+ bleName,
158
+ capabilities: features.capabilities ?? [],
159
+ mode: getProtocolV1Mode(features),
160
+ initialized: features.initialized ?? null,
161
+ bootloaderMode: features.bootloader_mode ?? null,
162
+ unlocked: features.unlocked ?? true,
163
+ firmwarePresent: features.firmware_present ?? null,
164
+ passphraseProtection: features.passphrase_protection ?? null,
165
+ pinProtection: features.pin_protection ?? null,
166
+ backupRequired: features.needs_backup ?? null,
167
+ noBackup: features.no_backup ?? null,
168
+ unfinishedBackup: features.unfinished_backup ?? null,
169
+ recoveryMode: features.recovery_mode ?? null,
170
+ language: features.language ?? null,
171
+ bleEnabled: features.ble_enable ?? null,
172
+ sdCardPresent: features.sd_card_present ?? null,
173
+ sdProtection: features.sd_protection ?? null,
174
+ wipeCodeProtection: features.wipe_code_protection ?? null,
175
+ passphraseAlwaysOnDevice: features.passphrase_always_on_device ?? null,
176
+ safetyChecks: features.safety_checks ?? null,
177
+ autoLockDelayMs: features.auto_lock_delay_ms ?? null,
178
+ displayRotation: features.display_rotation ?? null,
179
+ experimentalFeatures: features.experimental_features ?? null,
180
+ firmwareVersion,
181
+ bootloaderVersion,
182
+ boardVersion,
183
+ bleVersion,
184
+ se01Version: firstMeaningfulVersion(features.onekey_se01_version),
185
+ se02Version: firstMeaningfulVersion(features.onekey_se02_version),
186
+ se03Version: firstMeaningfulVersion(features.onekey_se03_version),
187
+ se04Version: firstMeaningfulVersion(features.onekey_se04_version),
188
+ se01BootVersion: firstMeaningfulVersion(features.onekey_se01_boot_version),
189
+ se02BootVersion: firstMeaningfulVersion(features.onekey_se02_boot_version),
190
+ se03BootVersion: firstMeaningfulVersion(features.onekey_se03_boot_version),
191
+ se04BootVersion: firstMeaningfulVersion(features.onekey_se04_boot_version),
192
+ seVersion: features.se_ver ?? null,
193
+ verify: {
194
+ firmwareBuildId: features.onekey_firmware_build_id,
195
+ firmwareHash: features.onekey_firmware_hash,
196
+ bootloaderBuildId: features.onekey_boot_build_id,
197
+ bootloaderHash: features.onekey_boot_hash,
198
+ boardBuildId: features.onekey_board_build_id,
199
+ boardHash: features.onekey_board_hash,
200
+ bleBuildId: features.onekey_ble_build_id,
201
+ bleHash: features.onekey_ble_hash,
202
+ se01BuildId: features.onekey_se01_build_id,
203
+ se01Hash: features.onekey_se01_hash,
204
+ se02BuildId: features.onekey_se02_build_id,
205
+ se02Hash: features.onekey_se02_hash,
206
+ se03BuildId: features.onekey_se03_build_id,
207
+ se03Hash: features.onekey_se03_hash,
208
+ se04BuildId: features.onekey_se04_build_id,
209
+ se04Hash: features.onekey_se04_hash,
210
+ se01BootBuildId: features.onekey_se01_boot_build_id,
211
+ se01BootHash: features.onekey_se01_boot_hash,
212
+ se02BootBuildId: features.onekey_se02_boot_build_id,
213
+ se02BootHash: features.onekey_se02_boot_hash,
214
+ se03BootBuildId: features.onekey_se03_boot_build_id,
215
+ se03BootHash: features.onekey_se03_boot_hash,
216
+ se04BootBuildId: features.onekey_se04_boot_build_id,
217
+ se04BootHash: features.onekey_se04_boot_hash,
218
+ },
219
+ sessionId,
220
+ raw: {
221
+ protocolV1Features: protocolV1Features,
222
+ },
223
+ };
224
+ };
225
+
226
+ /**
227
+ * Protocol V2 的结构化 `Features` 构建器。
228
+ *
229
+ * 这是 Device 内部唯一缓存状态。字段只来自 DevGetDeviceInfo 或前一次 features
230
+ * 缓存的同名字段级合并;不存在协议等价语义的字段保持 null/空值,不再通过
231
+ * DeviceProfile 或 transport path 做身份兜底。
232
+ */
233
+ export const buildProtocolV2FeaturesPayload = (
234
+ deviceInfo?: ProtocolV2DeviceInfo,
235
+ previous?: Features
236
+ ): Features => {
237
+ const info = deviceInfo as ProtocolV2DeviceInfoCompat | undefined;
238
+ const fwApplication = firstValue(info?.fw?.application, info?.fw?.app);
239
+ const fwBootloader = firstValue(info?.fw?.bootloader, info?.fw?.boot);
240
+ const fwBoard = firstValue(info?.fw?.application_data, info?.fw?.board);
241
+ const bleApplication = firstValue(info?.coprocessor?.application, info?.bt?.app);
242
+
243
+ const firmwareVersion = firstMeaningfulVersion(
244
+ getImageVersion(fwApplication),
245
+ previous?.firmwareVersion
246
+ );
247
+ const bootloaderVersion = firstMeaningfulVersion(
248
+ getImageVersion(fwBootloader),
249
+ previous?.bootloaderVersion
250
+ );
251
+ const boardVersion = firstMeaningfulVersion(getImageVersion(fwBoard), previous?.boardVersion);
252
+ const bleVersion = firstMeaningfulVersion(getImageVersion(bleApplication), previous?.bleVersion);
253
+ const serialNo = firstValue(info?.hw?.serial_no, previous?.serialNo) ?? '';
254
+ const label = firstValue(deviceInfo?.status?.label, previous?.label) ?? null;
255
+ const bleName = firstValue(info?.coprocessor?.bt_adv_name, info?.bt?.adv_name, previous?.bleName);
256
+ const initialized = firstValue(deviceInfo?.status?.init_states, previous?.initialized) ?? null;
257
+ const passphraseProtection =
258
+ firstValue(deviceInfo?.status?.passphrase_protection, previous?.passphraseProtection) ?? null;
259
+ const language = firstValue(deviceInfo?.status?.language, previous?.language) ?? null;
260
+ const backupRequired =
261
+ firstValue(deviceInfo?.status?.backup_required, previous?.backupRequired) ?? null;
262
+ const bleEnabled = firstValue(deviceInfo?.status?.bt_enable, previous?.bleEnabled);
263
+
264
+ return {
265
+ protocol: 'V2',
266
+ protocolVersion: deviceInfo?.protocol_version ?? previous?.protocolVersion ?? null,
267
+ deviceType: EDeviceType.Pro2,
268
+ firmwareType: previous?.firmwareType ?? EFirmwareType.Universal,
269
+ model: 'pro2',
270
+ vendor: 'onekey.so',
271
+ deviceId: null,
272
+ serialNo,
273
+ label,
274
+ bleName: bleName ?? null,
275
+ capabilities: [],
276
+ mode: initialized === false ? 'notInitialized' : initialized === true ? 'normal' : 'unknown',
277
+ initialized,
278
+ bootloaderMode: false,
279
+ unlocked: previous?.unlocked ?? null,
280
+ firmwarePresent: previous?.firmwarePresent ?? null,
281
+ passphraseProtection,
282
+ pinProtection: null,
283
+ backupRequired,
284
+ noBackup: null,
285
+ unfinishedBackup: null,
286
+ recoveryMode: null,
287
+ language,
288
+ bleEnabled: bleEnabled ?? null,
289
+ sdCardPresent: null,
290
+ sdProtection: null,
291
+ wipeCodeProtection: null,
292
+ passphraseAlwaysOnDevice: null,
293
+ safetyChecks: null,
294
+ autoLockDelayMs: null,
295
+ displayRotation: null,
296
+ experimentalFeatures: null,
297
+ firmwareVersion,
298
+ bootloaderVersion,
299
+ boardVersion,
300
+ bleVersion,
301
+ se01Version: firstMeaningfulVersion(
302
+ getImageVersion(deviceInfo?.se1?.app),
303
+ previous?.se01Version
304
+ ),
305
+ se02Version: firstMeaningfulVersion(
306
+ getImageVersion(deviceInfo?.se2?.app),
307
+ previous?.se02Version
308
+ ),
309
+ se03Version: firstMeaningfulVersion(
310
+ getImageVersion(deviceInfo?.se3?.app),
311
+ previous?.se03Version
312
+ ),
313
+ se04Version: firstMeaningfulVersion(
314
+ getImageVersion(deviceInfo?.se4?.app),
315
+ previous?.se04Version
316
+ ),
317
+ se01BootVersion: firstMeaningfulVersion(
318
+ getImageVersion(deviceInfo?.se1?.boot),
319
+ previous?.se01BootVersion
320
+ ),
321
+ se02BootVersion: firstMeaningfulVersion(
322
+ getImageVersion(deviceInfo?.se2?.boot),
323
+ previous?.se02BootVersion
324
+ ),
325
+ se03BootVersion: firstMeaningfulVersion(
326
+ getImageVersion(deviceInfo?.se3?.boot),
327
+ previous?.se03BootVersion
328
+ ),
329
+ se04BootVersion: firstMeaningfulVersion(
330
+ getImageVersion(deviceInfo?.se4?.boot),
331
+ previous?.se04BootVersion
332
+ ),
333
+ seVersion: previous?.seVersion ?? null,
334
+ verify: {
335
+ firmwareBuildId: getImageBuildId(fwApplication) ?? previous?.verify?.firmwareBuildId,
336
+ firmwareHash: getImageHash(fwApplication) ?? previous?.verify?.firmwareHash,
337
+ bootloaderBuildId: getImageBuildId(fwBootloader) ?? previous?.verify?.bootloaderBuildId,
338
+ bootloaderHash: getImageHash(fwBootloader) ?? previous?.verify?.bootloaderHash,
339
+ boardBuildId: getImageBuildId(fwBoard) ?? previous?.verify?.boardBuildId,
340
+ boardHash: getImageHash(fwBoard) ?? previous?.verify?.boardHash,
341
+ bleBuildId: getImageBuildId(bleApplication) ?? previous?.verify?.bleBuildId,
342
+ bleHash: getImageHash(bleApplication) ?? previous?.verify?.bleHash,
343
+ se01BuildId: getImageBuildId(deviceInfo?.se1?.app) ?? previous?.verify?.se01BuildId,
344
+ se01Hash: getImageHash(deviceInfo?.se1?.app) ?? previous?.verify?.se01Hash,
345
+ se02BuildId: getImageBuildId(deviceInfo?.se2?.app) ?? previous?.verify?.se02BuildId,
346
+ se02Hash: getImageHash(deviceInfo?.se2?.app) ?? previous?.verify?.se02Hash,
347
+ se03BuildId: getImageBuildId(deviceInfo?.se3?.app) ?? previous?.verify?.se03BuildId,
348
+ se03Hash: getImageHash(deviceInfo?.se3?.app) ?? previous?.verify?.se03Hash,
349
+ se04BuildId: getImageBuildId(deviceInfo?.se4?.app) ?? previous?.verify?.se04BuildId,
350
+ se04Hash: getImageHash(deviceInfo?.se4?.app) ?? previous?.verify?.se04Hash,
351
+ se01BootBuildId: getImageBuildId(deviceInfo?.se1?.boot) ?? previous?.verify?.se01BootBuildId,
352
+ se01BootHash: getImageHash(deviceInfo?.se1?.boot) ?? previous?.verify?.se01BootHash,
353
+ se02BootBuildId: getImageBuildId(deviceInfo?.se2?.boot) ?? previous?.verify?.se02BootBuildId,
354
+ se02BootHash: getImageHash(deviceInfo?.se2?.boot) ?? previous?.verify?.se02BootHash,
355
+ se03BootBuildId: getImageBuildId(deviceInfo?.se3?.boot) ?? previous?.verify?.se03BootBuildId,
356
+ se03BootHash: getImageHash(deviceInfo?.se3?.boot) ?? previous?.verify?.se03BootHash,
357
+ se04BootBuildId: getImageBuildId(deviceInfo?.se4?.boot) ?? previous?.verify?.se04BootBuildId,
358
+ se04BootHash: getImageHash(deviceInfo?.se4?.boot) ?? previous?.verify?.se04BootHash,
359
+ },
360
+ sessionId: previous?.sessionId ?? null,
361
+ passphraseState: previous?.passphraseState,
362
+ unlockedAttachPin: previous?.unlockedAttachPin,
363
+ raw: {
364
+ protocolV2DeviceInfo: deviceInfo,
365
+ },
366
+ };
367
+ };