@onekeyfe/hd-core 1.2.0-alpha.54 → 1.2.0-alpha.56

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 (262) hide show
  1. package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +231 -0
  2. package/__tests__/DeviceCommands.test.ts +45 -0
  3. package/__tests__/DeviceEventRegistration.test.ts +6 -0
  4. package/__tests__/check-all-firmware-release-protocol-v2.test.ts +198 -3
  5. package/__tests__/connectSettings.test.ts +5 -47
  6. package/__tests__/device-lifecycle-events.test.ts +105 -3
  7. package/__tests__/device-state-contract.test.ts +1 -0
  8. package/__tests__/device-state-mapper.test.ts +1 -1
  9. package/__tests__/deviceSettings.test.ts +1 -1
  10. package/__tests__/deviceUploadNft.test.ts +293 -0
  11. package/__tests__/firmware-update/firmware-update-v2-download-before-boot.test.ts +31 -59
  12. package/__tests__/get-device-state.test.ts +132 -12
  13. package/__tests__/homescreen.test.ts +41 -1
  14. package/__tests__/kaspaSignTransaction.test.ts +3 -26
  15. package/__tests__/logBlockEvent.test.ts +1 -1
  16. package/__tests__/method-protocol-support.test.ts +19 -0
  17. package/__tests__/open-wallet-session.test.ts +568 -37
  18. package/__tests__/pro2Nft.test.ts +108 -0
  19. package/__tests__/protocol-binding.test.ts +89 -0
  20. package/__tests__/protocol-v2-resources.test.ts +286 -0
  21. package/__tests__/protocol-v2-ui-lifecycle.test.ts +91 -0
  22. package/__tests__/protocol-v2-unlock-policy.test.ts +201 -35
  23. package/__tests__/protocol-v2.test.ts +1353 -1011
  24. package/__tests__/protocolV2FileWrite.test.ts +39 -0
  25. package/__tests__/protocolV2UiInteraction.test.ts +63 -0
  26. package/__tests__/public-pro2-api-boundary.test.ts +1 -0
  27. package/__tests__/search-devices.test.ts +12 -3
  28. package/__tests__/uiProgressThrottle.test.ts +74 -0
  29. package/__tests__/uiPromiseRegistry.test.ts +86 -0
  30. package/dist/api/BaseMethod.d.ts +3 -1
  31. package/dist/api/BaseMethod.d.ts.map +1 -1
  32. package/dist/api/CheckAllFirmwareRelease.d.ts +2 -1
  33. package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
  34. package/dist/api/DetectDeviceConnectProtocol.d.ts +7 -0
  35. package/dist/api/DetectDeviceConnectProtocol.d.ts.map +1 -0
  36. package/dist/api/FirmwareUpdate.d.ts.map +1 -1
  37. package/dist/api/FirmwareUpdateV2.d.ts +0 -11
  38. package/dist/api/FirmwareUpdateV2.d.ts.map +1 -1
  39. package/dist/api/FirmwareUpdateV3.d.ts +3 -7
  40. package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
  41. package/dist/api/FirmwareUpdateV4.d.ts +11 -25
  42. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  43. package/dist/api/GetPassphraseState.d.ts.map +1 -1
  44. package/dist/api/OpenWalletSession.d.ts.map +1 -1
  45. package/dist/api/SearchDevices.d.ts.map +1 -1
  46. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  47. package/dist/api/device/DeviceUnlock.d.ts +2 -2
  48. package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
  49. package/dist/api/device/DeviceUpdateBootloader.d.ts +1 -5
  50. package/dist/api/device/DeviceUpdateBootloader.d.ts.map +1 -1
  51. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +0 -9
  52. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  53. package/dist/api/firmware/getBinary.d.ts +0 -7
  54. package/dist/api/firmware/getBinary.d.ts.map +1 -1
  55. package/dist/api/firmware/updateBootloader.d.ts +0 -2
  56. package/dist/api/firmware/updateBootloader.d.ts.map +1 -1
  57. package/dist/api/firmware/uploadFirmware.d.ts +1 -9
  58. package/dist/api/firmware/uploadFirmware.d.ts.map +1 -1
  59. package/dist/api/helpers/protocolV2FileWrite.d.ts +2 -0
  60. package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
  61. package/dist/api/index.d.ts +2 -0
  62. package/dist/api/index.d.ts.map +1 -1
  63. package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
  64. package/dist/api/protocol-v2/DeviceUploadNft.d.ts +31 -0
  65. package/dist/api/protocol-v2/DeviceUploadNft.d.ts.map +1 -0
  66. package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -1
  67. package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
  68. package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
  69. package/dist/core/deviceEventRegistration.d.ts +2 -0
  70. package/dist/core/deviceEventRegistration.d.ts.map +1 -1
  71. package/dist/core/index.d.ts.map +1 -1
  72. package/dist/core/uiPromiseRegistry.d.ts +4 -0
  73. package/dist/core/uiPromiseRegistry.d.ts.map +1 -0
  74. package/dist/data-manager/DataManager.d.ts +4 -2
  75. package/dist/data-manager/DataManager.d.ts.map +1 -1
  76. package/dist/data-manager/connectSettings.d.ts.map +1 -1
  77. package/dist/device/Device.d.ts +29 -6
  78. package/dist/device/Device.d.ts.map +1 -1
  79. package/dist/device/DeviceCommands.d.ts +4 -4
  80. package/dist/device/DeviceCommands.d.ts.map +1 -1
  81. package/dist/device/DevicePool.d.ts.map +1 -1
  82. package/dist/events/device.d.ts +4 -0
  83. package/dist/events/device.d.ts.map +1 -1
  84. package/dist/events/logBlockEvent.d.ts.map +1 -1
  85. package/dist/events/ui-promise.d.ts +4 -2
  86. package/dist/events/ui-promise.d.ts.map +1 -1
  87. package/dist/events/ui-request.d.ts +31 -2
  88. package/dist/events/ui-request.d.ts.map +1 -1
  89. package/dist/events/ui-response.d.ts +10 -2
  90. package/dist/events/ui-response.d.ts.map +1 -1
  91. package/dist/index.d.ts +214 -231
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +2634 -3530
  94. package/dist/inject.d.ts +6 -1
  95. package/dist/inject.d.ts.map +1 -1
  96. package/dist/lowLevelInject.d.ts.map +1 -1
  97. package/dist/protocols/protocol-v2/features.d.ts +0 -4
  98. package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
  99. package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
  100. package/dist/protocols/protocol-v2/resources.d.ts +30 -0
  101. package/dist/protocols/protocol-v2/resources.d.ts.map +1 -0
  102. package/dist/protocols/protocol-v2/uiInteraction.d.ts +7 -4
  103. package/dist/protocols/protocol-v2/uiInteraction.d.ts.map +1 -1
  104. package/dist/protocols/protocol-v2/unlockPolicy.d.ts +1 -3
  105. package/dist/protocols/protocol-v2/unlockPolicy.d.ts.map +1 -1
  106. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts +22 -0
  107. package/dist/protocols/protocol-v2/unlockPolicyRunner.d.ts.map +1 -0
  108. package/dist/protocols/protocol-v2/walletSession.d.ts +6 -1
  109. package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
  110. package/dist/topLevelInject.d.ts.map +1 -1
  111. package/dist/types/api/checkAllFirmwareRelease.d.ts +2 -4
  112. package/dist/types/api/checkAllFirmwareRelease.d.ts.map +1 -1
  113. package/dist/types/api/detectDeviceConnectProtocol.d.ts +4 -0
  114. package/dist/types/api/detectDeviceConnectProtocol.d.ts.map +1 -0
  115. package/dist/types/api/deviceUnlock.d.ts +5 -1
  116. package/dist/types/api/deviceUnlock.d.ts.map +1 -1
  117. package/dist/types/api/deviceUpdateBootloader.d.ts +0 -6
  118. package/dist/types/api/deviceUpdateBootloader.d.ts.map +1 -1
  119. package/dist/types/api/export.d.ts +2 -4
  120. package/dist/types/api/export.d.ts.map +1 -1
  121. package/dist/types/api/firmwareUpdate.d.ts +2 -70
  122. package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
  123. package/dist/types/api/index.d.ts +7 -10
  124. package/dist/types/api/index.d.ts.map +1 -1
  125. package/dist/types/api/protocolV2.d.ts +3 -0
  126. package/dist/types/api/protocolV2.d.ts.map +1 -1
  127. package/dist/types/device.d.ts.map +1 -1
  128. package/dist/types/params.d.ts +1 -0
  129. package/dist/types/params.d.ts.map +1 -1
  130. package/dist/types/settings.d.ts +22 -13
  131. package/dist/types/settings.d.ts.map +1 -1
  132. package/dist/utils/deviceFeaturesCompat.d.ts +0 -1
  133. package/dist/utils/deviceFeaturesCompat.d.ts.map +1 -1
  134. package/dist/utils/deviceFeaturesUtils.d.ts +4 -0
  135. package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
  136. package/dist/utils/homescreen.d.ts +4 -0
  137. package/dist/utils/homescreen.d.ts.map +1 -1
  138. package/dist/utils/index.d.ts +1 -1
  139. package/dist/utils/index.d.ts.map +1 -1
  140. package/dist/utils/patch.d.ts +1 -1
  141. package/dist/utils/patch.d.ts.map +1 -1
  142. package/dist/utils/pro2Nft.d.ts +31 -0
  143. package/dist/utils/pro2Nft.d.ts.map +1 -0
  144. package/dist/utils/pro2Wallpaper.d.ts +10 -0
  145. package/dist/utils/pro2Wallpaper.d.ts.map +1 -1
  146. package/dist/utils/uiProgressThrottle.d.ts +3 -0
  147. package/dist/utils/uiProgressThrottle.d.ts.map +1 -0
  148. package/package.json +4 -4
  149. package/src/api/BaseMethod.ts +8 -10
  150. package/src/api/CheckAllFirmwareRelease.ts +54 -57
  151. package/src/api/DetectDeviceConnectProtocol.ts +18 -0
  152. package/src/api/FirmwareUpdate.ts +7 -15
  153. package/src/api/FirmwareUpdateV2.ts +126 -316
  154. package/src/api/FirmwareUpdateV3.ts +63 -265
  155. package/src/api/FirmwareUpdateV4.ts +584 -975
  156. package/src/api/GetPassphraseState.ts +7 -1
  157. package/src/api/OpenWalletSession.ts +70 -17
  158. package/src/api/SearchDevices.ts +3 -1
  159. package/src/api/allnetwork/AllNetworkGetAddress.ts +21 -21
  160. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +34 -11
  161. package/src/api/device/DeviceUnlock.ts +8 -3
  162. package/src/api/device/DeviceUpdateBootloader.ts +6 -122
  163. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +16 -83
  164. package/src/api/firmware/updateBootloader.ts +4 -19
  165. package/src/api/firmware/uploadFirmware.ts +39 -144
  166. package/src/api/helpers/protocolV2FileWrite.ts +27 -7
  167. package/src/api/index.ts +2 -0
  168. package/src/api/kaspa/KaspaSignTransaction.ts +1 -12
  169. package/src/api/protocol-v2/DeviceUploadNft.ts +189 -0
  170. package/src/api/protocol-v2/ProtocolInfoRequest.ts +3 -1
  171. package/src/api/protocol-v2/helpers.ts +1 -0
  172. package/src/core/deviceEventRegistration.ts +4 -0
  173. package/src/core/index.ts +167 -83
  174. package/src/core/uiPromiseRegistry.ts +41 -0
  175. package/src/data/messages/messages-protocol-v2.json +25 -0
  176. package/src/data-manager/DataManager.ts +71 -39
  177. package/src/data-manager/connectSettings.ts +0 -11
  178. package/src/device/Device.ts +259 -43
  179. package/src/device/DeviceCommands.ts +7 -1
  180. package/src/device/DevicePool.ts +7 -2
  181. package/src/events/device.ts +4 -0
  182. package/src/events/logBlockEvent.ts +1 -0
  183. package/src/events/ui-promise.ts +4 -2
  184. package/src/events/ui-request.ts +36 -2
  185. package/src/events/ui-response.ts +12 -2
  186. package/src/index.ts +0 -5
  187. package/src/inject.ts +60 -24
  188. package/src/lowLevelInject.ts +7 -8
  189. package/src/protocols/protocol-v2/features.ts +10 -7
  190. package/src/protocols/protocol-v2/firmware.ts +2 -0
  191. package/src/protocols/protocol-v2/resources.ts +359 -0
  192. package/src/protocols/protocol-v2/uiInteraction.ts +46 -6
  193. package/src/protocols/protocol-v2/unlockPolicy.ts +1 -105
  194. package/src/protocols/protocol-v2/unlockPolicyRunner.ts +118 -0
  195. package/src/protocols/protocol-v2/walletSession.ts +214 -36
  196. package/src/topLevelInject.ts +7 -8
  197. package/src/types/api/checkAllFirmwareRelease.ts +2 -4
  198. package/src/types/api/detectDeviceConnectProtocol.ts +6 -0
  199. package/src/types/api/deviceUnlock.ts +12 -1
  200. package/src/types/api/deviceUpdateBootloader.ts +0 -6
  201. package/src/types/api/export.ts +1 -18
  202. package/src/types/api/firmwareUpdate.ts +3 -76
  203. package/src/types/api/index.ts +13 -14
  204. package/src/types/api/protocolV2.ts +13 -0
  205. package/src/types/device.ts +3 -0
  206. package/src/types/params.ts +7 -1
  207. package/src/types/settings.ts +42 -13
  208. package/src/utils/deviceFeaturesCompat.ts +0 -6
  209. package/src/utils/deviceFeaturesUtils.ts +8 -0
  210. package/src/utils/homescreen.ts +32 -6
  211. package/src/utils/index.ts +6 -1
  212. package/src/utils/pro2Nft.ts +142 -0
  213. package/src/utils/pro2Wallpaper.ts +35 -8
  214. package/src/utils/uiProgressThrottle.ts +63 -0
  215. package/__tests__/device-initialize-timeout.test.ts +0 -56
  216. package/__tests__/firmware-update/check-all-firmware-release.test.ts +0 -175
  217. package/__tests__/firmware-update/firmware-artifact-source.test.ts +0 -119
  218. package/__tests__/firmware-update/firmware-host-binding.test.ts +0 -70
  219. package/__tests__/firmware-update/firmware-preparation-error.test.ts +0 -27
  220. package/__tests__/firmware-update/firmware-update-bootloader-poll.test.ts +0 -200
  221. package/__tests__/firmware-update/firmware-update-capabilities.test.ts +0 -13
  222. package/__tests__/firmware-update/firmware-update-plan-bootloader-identity.test.ts +0 -294
  223. package/__tests__/firmware-update/firmware-update-plan.test.ts +0 -593
  224. package/__tests__/firmware-update/firmware-update-prepared-plan.test.ts +0 -213
  225. package/__tests__/firmware-update/firmware-update-v3-reconnect.test.ts +0 -58
  226. package/__tests__/firmware-update/firmware-upload-source.test.ts +0 -70
  227. package/dist/api/firmware/FirmwareArtifactSource.d.ts +0 -25
  228. package/dist/api/firmware/FirmwareArtifactSource.d.ts.map +0 -1
  229. package/dist/api/firmware/FirmwareHostBinding.d.ts +0 -6
  230. package/dist/api/firmware/FirmwareHostBinding.d.ts.map +0 -1
  231. package/dist/api/firmware/FirmwarePreparationError.d.ts +0 -3
  232. package/dist/api/firmware/FirmwarePreparationError.d.ts.map +0 -1
  233. package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts +0 -3
  234. package/dist/api/firmware/FirmwareUpdateCapabilities.d.ts.map +0 -1
  235. package/dist/api/firmware/FirmwareUpdatePlan.d.ts +0 -25
  236. package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +0 -1
  237. package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts +0 -32
  238. package/dist/api/firmware/FirmwareUpdatePreparedPlan.d.ts.map +0 -1
  239. package/dist/api/firmware/progressThrottle.d.ts +0 -3
  240. package/dist/api/firmware/progressThrottle.d.ts.map +0 -1
  241. package/dist/protocols/protocol-v2/lockedError.d.ts +0 -2
  242. package/dist/protocols/protocol-v2/lockedError.d.ts.map +0 -1
  243. package/dist/protocols/protocol-v2/unlockRetry.d.ts +0 -10
  244. package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +0 -1
  245. package/dist/types/api/firmwareUpdateCapabilities.d.ts +0 -9
  246. package/dist/types/api/firmwareUpdateCapabilities.d.ts.map +0 -1
  247. package/dist/types/api/firmwareUpdatePlan.d.ts +0 -28
  248. package/dist/types/api/firmwareUpdatePlan.d.ts.map +0 -1
  249. package/dist/types/api/firmwareUpdatePreparedPlan.d.ts +0 -42
  250. package/dist/types/api/firmwareUpdatePreparedPlan.d.ts.map +0 -1
  251. package/src/api/firmware/FirmwareArtifactSource.ts +0 -278
  252. package/src/api/firmware/FirmwareHostBinding.ts +0 -100
  253. package/src/api/firmware/FirmwarePreparationError.ts +0 -12
  254. package/src/api/firmware/FirmwareUpdateCapabilities.ts +0 -9
  255. package/src/api/firmware/FirmwareUpdatePlan.ts +0 -772
  256. package/src/api/firmware/FirmwareUpdatePreparedPlan.ts +0 -415
  257. package/src/api/firmware/progressThrottle.ts +0 -44
  258. package/src/protocols/protocol-v2/lockedError.ts +0 -10
  259. package/src/protocols/protocol-v2/unlockRetry.ts +0 -109
  260. package/src/types/api/firmwareUpdateCapabilities.ts +0 -9
  261. package/src/types/api/firmwareUpdatePlan.ts +0 -38
  262. package/src/types/api/firmwareUpdatePreparedPlan.ts +0 -53
@@ -1,5 +1,5 @@
1
1
  import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
2
- import { DeviceSessionPinType } from '@onekeyfe/hd-transport';
2
+ import { DeviceSessionPinType, DeviceSessionSeedDomain } from '@onekeyfe/hd-transport';
3
3
 
4
4
  import { DEVICE } from '../../events';
5
5
  import { assertCompleteDeviceSession } from './deviceSession';
@@ -38,32 +38,74 @@ export async function refreshProtocolV2DeviceStatus(device: Device) {
38
38
  return device.updateProtocolV2Status(status);
39
39
  }
40
40
 
41
- const negotiateEventlessWalletSession = async (device: Device) => {
42
- await device.commands.typedCall('ProtocolInfoRequest', 'ProtocolInfo', {
43
- eventless_wallet_session: true,
41
+ export async function ensureProtocolV2WalletSessionUnlocked(device: Device) {
42
+ if (!device.isProtocolV2() || device.isBootloader?.() || device.isRomloader?.()) {
43
+ return false;
44
+ }
45
+
46
+ await refreshProtocolV2DeviceStatus(device);
47
+ if (device.state?.status.unlocked !== false) {
48
+ return false;
49
+ }
50
+
51
+ await device.unlockDevice(DeviceSessionPinType.Main, {
52
+ source: 'unlock-coordinator',
53
+ reason: 'device-locked',
54
+ deviceOnly: true,
44
55
  });
56
+ return true;
57
+ }
58
+
59
+ const negotiateEventlessWalletSession = async (device: Device) => {
60
+ await device.ensureProtocolV2RuntimeContext();
45
61
  };
46
62
 
47
63
  const getDeviceSession = async (device: Device, request: DeviceSessionGet) =>
48
64
  device.commands.typedCall('DeviceSessionGet', 'DeviceSession', request);
49
65
 
66
+ const buildDeviceSessionGetRequest = ({
67
+ sessionId,
68
+ expectedPassphraseState,
69
+ deriveCardano,
70
+ }: {
71
+ sessionId?: string;
72
+ expectedPassphraseState?: string;
73
+ deriveCardano?: boolean;
74
+ } = {}): DeviceSessionGet => ({
75
+ ...(sessionId ? { session_id: sessionId } : {}),
76
+ ...(expectedPassphraseState ? { btc_test_address: expectedPassphraseState } : {}),
77
+ seed_domains:
78
+ deriveCardano === undefined
79
+ ? []
80
+ : [
81
+ DeviceSessionSeedDomain.SeedDomain_Standard,
82
+ ...(deriveCardano ? [DeviceSessionSeedDomain.SeedDomain_Cardano] : []),
83
+ ],
84
+ });
85
+
50
86
  const askDevicePassphrase = async (device: Device, requestPayload: DeviceSessionAskPassphrase) => {
51
87
  await device.commands.typedCall('DeviceSessionAskPassphrase', 'Success', requestPayload);
52
88
  await refreshProtocolV2DeviceStatus(device);
53
89
  };
54
90
 
55
- const selectDeviceSession = async (device: Device, expectedPassphraseState?: string) => {
91
+ const selectDeviceSession = async (
92
+ device: Device,
93
+ expectedPassphraseState?: string,
94
+ deriveCardano?: boolean
95
+ ) => {
56
96
  const existsAttachPinUser = device.features?.attachToPinEnabled === true;
57
97
  const metadata = {
58
98
  source: 'wallet-session-coordinator' as const,
59
99
  reason: expectedPassphraseState ? ('session-recovery' as const) : ('open-wallet' as const),
60
100
  ...(expectedPassphraseState ? { expectedPassphraseState } : {}),
61
101
  };
102
+ const passphraseInteraction = device.createProtocolV2UiPhaseMetadata?.('passphrase', 'start');
62
103
  const response = await device.commands.promptPassphrase(
63
104
  {
64
105
  existsAttachPinUser,
65
106
  deviceOnly: false,
66
107
  ...metadata,
108
+ ...(passphraseInteraction ? { interaction: passphraseInteraction } : {}),
67
109
  },
68
110
  { cancelDeviceOnReject: false }
69
111
  );
@@ -102,9 +144,16 @@ const selectDeviceSession = async (device: Device, expectedPassphraseState?: str
102
144
  'Attach PIN wallet selection is unavailable on this device.'
103
145
  );
104
146
  }
105
- device.emit(DEVICE.ATTACH_PIN_ON_DEVICE, device, metadata);
106
- await device.unlockDevice(DeviceSessionPinType.AttachToPin);
107
- return getDeviceSession(device, {});
147
+ const attachPinInteraction = device.createProtocolV2UiPhaseMetadata?.('pin', 'start');
148
+ device.emit(DEVICE.ATTACH_PIN_ON_DEVICE, device, {
149
+ ...metadata,
150
+ ...(attachPinInteraction ? { interaction: attachPinInteraction } : {}),
151
+ });
152
+ await device.unlockDevice(DeviceSessionPinType.AttachToPin, {
153
+ emitUiEvent: false,
154
+ interaction: attachPinInteraction,
155
+ });
156
+ return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
108
157
  }
109
158
 
110
159
  if (hasHostPassphrase) {
@@ -112,12 +161,19 @@ const selectDeviceSession = async (device: Device, expectedPassphraseState?: str
112
161
  passphrase: hostPassphrase,
113
162
  on_device: false,
114
163
  });
115
- return getDeviceSession(device, {});
164
+ return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
116
165
  }
117
166
 
118
- device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, metadata);
167
+ const passphraseOnDeviceInteraction = device.createProtocolV2UiPhaseMetadata?.(
168
+ 'passphrase-on-device',
169
+ 'start'
170
+ );
171
+ device.emit(DEVICE.PASSPHRASE_ON_DEVICE, device, {
172
+ ...metadata,
173
+ ...(passphraseOnDeviceInteraction ? { interaction: passphraseOnDeviceInteraction } : {}),
174
+ });
119
175
  await askDevicePassphrase(device, { on_device: true });
120
- return getDeviceSession(device, {});
176
+ return getDeviceSession(device, buildDeviceSessionGetRequest({ deriveCardano }));
121
177
  };
122
178
 
123
179
  export async function getProtocolV2WalletSession(
@@ -128,11 +184,18 @@ export async function getProtocolV2WalletSession(
128
184
  initSession?: boolean;
129
185
  expectedPassphraseState?: string;
130
186
  onlyMainPin?: boolean;
187
+ /** 业务安全校验遇到 Attach PIN 上下文时直接拒绝,不主动切换钱包。 */
188
+ rejectAttachPinForMainWallet?: boolean;
189
+ selectMainWalletBeforeRestore?: boolean;
131
190
  resumeOnly?: boolean;
191
+ deriveCardano?: boolean;
192
+ /** Read the wallet already selected by Attach PIN without reopening wallet selection. */
193
+ readCurrentAttachPinSession?: boolean;
132
194
  }
133
195
  ) {
134
196
  const forceWalletSelection =
135
197
  options?.forceWalletSelection === true || options?.initSession === true;
198
+ const readCurrentAttachPinSession = options?.readCurrentAttachPinSession === true;
136
199
 
137
200
  if (forceWalletSelection) {
138
201
  if (options.onlyMainPin) {
@@ -145,33 +208,114 @@ export async function getProtocolV2WalletSession(
145
208
 
146
209
  await negotiateEventlessWalletSession(device);
147
210
 
148
- if (options?.onlyMainPin) {
211
+ if (options?.onlyMainPin || readCurrentAttachPinSession) {
149
212
  device.passphraseState = undefined;
150
213
  }
151
- let expectedPassphraseState = options?.onlyMainPin
152
- ? undefined
153
- : options?.expectedPassphraseState ?? device.passphraseState;
214
+ let expectedPassphraseState =
215
+ options?.onlyMainPin || readCurrentAttachPinSession
216
+ ? undefined
217
+ : options?.expectedPassphraseState ?? device.passphraseState;
154
218
 
155
219
  const cachedStandardSession = options?.onlyMainPin
156
220
  ? device.getStandardInternalState?.()
157
221
  : undefined;
158
222
  const cachedSessionId =
159
- !options?.onlyMainPin && typeof device.getInternalState === 'function'
223
+ !options?.onlyMainPin &&
224
+ !readCurrentAttachPinSession &&
225
+ typeof device.getInternalState === 'function'
160
226
  ? device.getInternalState()
161
227
  : undefined;
162
228
  let response;
163
229
  let resumed = false;
230
+ let mainPinSelected =
231
+ options?.onlyMainPin === true &&
232
+ device.features?.unlocked === true &&
233
+ device.features?.unlockedAttachPin === false;
164
234
 
165
- if (options?.onlyMainPin) {
235
+ const clearCurrentWalletSession = () => {
236
+ if (options?.onlyMainPin) {
237
+ device.clearStandardInternalState?.();
238
+ } else {
239
+ device.clearInternalState();
240
+ }
241
+ };
242
+
243
+ const rejectMismatchedAttachPinWallet = async () => {
244
+ const features = await refreshProtocolV2DeviceStatus(device);
245
+ if (features.unlockedAttachPin !== true) {
246
+ return;
247
+ }
248
+
249
+ try {
250
+ await device.lockDevice();
251
+ } catch {
252
+ // Reject the mismatched Attach PIN wallet even when older firmware cannot lock.
253
+ }
254
+ if (options?.rejectAttachPinForMainWallet) {
255
+ device.clearStandardInternalState?.();
256
+ device.clearInternalState();
257
+ } else {
258
+ clearCurrentWalletSession();
259
+ }
260
+ throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckUnlockTypeError);
261
+ };
262
+
263
+ if (options?.onlyMainPin && options.rejectAttachPinForMainWallet) {
264
+ await rejectMismatchedAttachPinWallet();
265
+ }
266
+
267
+ const selectMainPin = async (force = false) => {
268
+ if (force || !mainPinSelected) {
269
+ await device.unlockDevice(DeviceSessionPinType.Main, {
270
+ source: 'wallet-session-coordinator',
271
+ reason: expectedPassphraseState ? 'session-recovery' : 'open-wallet',
272
+ deviceOnly: true,
273
+ });
274
+ mainPinSelected = true;
275
+ }
276
+ };
277
+
278
+ const selectStandardWallet = async () => {
279
+ // Main PIN authenticates the device; an empty host passphrase selects the standard derivation.
280
+ await selectMainPin();
281
+ if (device.features?.passphraseProtection === true) {
282
+ await askDevicePassphrase(device, {
283
+ passphrase: '',
284
+ on_device: false,
285
+ });
286
+ }
287
+ };
288
+
289
+ if (readCurrentAttachPinSession) {
290
+ const status = await requestProtocolV2DeviceStatus(device);
291
+ device.updateProtocolV2Status(status);
292
+ if (
293
+ status.unlocked !== true ||
294
+ status.passphrase_enabled !== true ||
295
+ status.unlocked_by_attach_to_pin !== true
296
+ ) {
297
+ device.clearInternalState();
298
+ throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckUnlockTypeError);
299
+ }
300
+ response = await getDeviceSession(
301
+ device,
302
+ buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
303
+ );
304
+ } else if (options?.onlyMainPin) {
166
305
  expectedPassphraseState = cachedStandardSession?.passphraseState;
167
306
  if (cachedStandardSession) {
168
307
  try {
169
- if (device.features?.unlockedAttachPin === true) {
170
- await device.unlockDevice(DeviceSessionPinType.Main);
308
+ if (options?.selectMainWalletBeforeRestore) {
309
+ await selectMainPin();
171
310
  }
172
- response = await getDeviceSession(device, {
173
- session_id: cachedStandardSession.sessionId,
174
- });
311
+ response = await getDeviceSession(
312
+ device,
313
+ buildDeviceSessionGetRequest({
314
+ sessionId: cachedStandardSession.sessionId,
315
+ expectedPassphraseState,
316
+ deriveCardano: options?.deriveCardano,
317
+ })
318
+ );
175
319
  resumed = true;
176
320
  } catch (error) {
177
321
  device.clearStandardInternalState?.();
@@ -183,12 +327,22 @@ export async function getProtocolV2WalletSession(
183
327
  }
184
328
 
185
329
  if (!response) {
186
- await device.unlockDevice(DeviceSessionPinType.Main);
187
- response = await getDeviceSession(device, {});
330
+ await selectStandardWallet();
331
+ response = await getDeviceSession(
332
+ device,
333
+ buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
334
+ );
188
335
  }
189
336
  } else if (cachedSessionId && expectedPassphraseState) {
190
337
  try {
191
- response = await getDeviceSession(device, { session_id: cachedSessionId });
338
+ response = await getDeviceSession(
339
+ device,
340
+ buildDeviceSessionGetRequest({
341
+ sessionId: cachedSessionId,
342
+ expectedPassphraseState,
343
+ deriveCardano: options?.deriveCardano,
344
+ })
345
+ );
192
346
  resumed = true;
193
347
  } catch (error) {
194
348
  device.clearInternalState();
@@ -197,6 +351,20 @@ export async function getProtocolV2WalletSession(
197
351
  }
198
352
  resumed = false;
199
353
  }
354
+ } else if (expectedPassphraseState) {
355
+ try {
356
+ response = await getDeviceSession(
357
+ device,
358
+ buildDeviceSessionGetRequest({
359
+ expectedPassphraseState,
360
+ deriveCardano: options?.deriveCardano,
361
+ })
362
+ );
363
+ } catch (error) {
364
+ if (options?.resumeOnly || !isWalletSessionInvalidError(error)) {
365
+ throw error;
366
+ }
367
+ }
200
368
  }
201
369
 
202
370
  if (!response) {
@@ -204,7 +372,7 @@ export async function getProtocolV2WalletSession(
204
372
  device.clearInternalState();
205
373
  throw ERRORS.TypedError(HardwareErrorCode.WalletSessionInvalid);
206
374
  }
207
- response = await selectDeviceSession(device, expectedPassphraseState);
375
+ response = await selectDeviceSession(device, expectedPassphraseState, options?.deriveCardano);
208
376
  }
209
377
 
210
378
  let { message } = response;
@@ -220,17 +388,21 @@ export async function getProtocolV2WalletSession(
220
388
  }
221
389
  if (expectedPassphraseState && expectedPassphraseState !== message.btc_test_address) {
222
390
  resumed = false;
391
+ await rejectMismatchedAttachPinWallet();
223
392
  if (options?.resumeOnly) {
224
393
  device.clearInternalState();
225
394
  throw ERRORS.TypedError(HardwareErrorCode.WalletSessionInvalid);
226
395
  }
227
396
  if (options?.onlyMainPin) {
228
397
  device.clearStandardInternalState?.();
229
- await device.unlockDevice(DeviceSessionPinType.Main);
230
- response = await getDeviceSession(device, {});
398
+ await selectStandardWallet();
399
+ response = await getDeviceSession(
400
+ device,
401
+ buildDeviceSessionGetRequest({ deriveCardano: options?.deriveCardano })
402
+ );
231
403
  } else {
232
404
  device.clearInternalState();
233
- response = await selectDeviceSession(device, expectedPassphraseState);
405
+ response = await selectDeviceSession(device, expectedPassphraseState, options?.deriveCardano);
234
406
  }
235
407
  message = response.message;
236
408
  try {
@@ -244,11 +416,8 @@ export async function getProtocolV2WalletSession(
244
416
  throw error;
245
417
  }
246
418
  if (expectedPassphraseState !== message.btc_test_address) {
247
- if (options?.onlyMainPin) {
248
- device.clearStandardInternalState?.();
249
- } else {
250
- device.clearInternalState();
251
- }
419
+ await rejectMismatchedAttachPinWallet();
420
+ clearCurrentWalletSession();
252
421
  throw ERRORS.TypedError(HardwareErrorCode.DeviceCheckPassphraseStateError);
253
422
  }
254
423
  }
@@ -266,20 +435,29 @@ export async function getProtocolV2WalletSession(
266
435
  device.updateInternalState(...internalStateArgs);
267
436
  }
268
437
 
438
+ let unlockedAttachPin: boolean | undefined;
439
+ if (readCurrentAttachPinSession) {
440
+ unlockedAttachPin = true;
441
+ } else if (mainPinSelected) {
442
+ unlockedAttachPin = false;
443
+ }
444
+
269
445
  return {
270
446
  passphraseState: message.btc_test_address,
271
447
  newSession: message.session_id,
272
- unlockedAttachPin: device.features?.unlockedAttachPin ?? undefined,
448
+ unlockedAttachPin,
273
449
  resumed,
274
450
  };
275
451
  }
276
452
 
277
453
  export async function restoreProtocolV2WalletSession(
278
454
  device: Device,
279
- expectedPassphraseState: string
455
+ expectedPassphraseState: string,
456
+ deriveCardano?: boolean
280
457
  ) {
281
458
  return getProtocolV2WalletSession(device, {
282
459
  expectedPassphraseState,
283
460
  resumeOnly: true,
461
+ deriveCardano,
284
462
  });
285
463
  }
@@ -1,7 +1,6 @@
1
1
  import EventEmitter from 'events';
2
2
 
3
- import { createCoreApi } from './inject';
4
- import { unregisterFirmwareUpdateHostBinding } from './api/firmware/FirmwareHostBinding';
3
+ import { createCoreApi, createProtocolAwareCall } from './inject';
5
4
 
6
5
  import type { ConnectSettings } from './types/settings';
7
6
  import type { CoreApi } from './types/api';
@@ -20,6 +19,7 @@ export const topLevelInject = () => {
20
19
  if (!lowLevelApi) return Promise.resolve(undefined);
21
20
  return lowLevelApi.call(params);
22
21
  };
22
+ const protocolAwareCall = createProtocolAwareCall(call);
23
23
  const api: CoreApi = {
24
24
  on: <T extends string, P extends (...args: any[]) => any>(type: T, fn: P) => {
25
25
  eventEmitter.on(type, fn);
@@ -38,19 +38,18 @@ export const topLevelInject = () => {
38
38
  return lowLevelApi?.init(settings) ?? Promise.resolve(false);
39
39
  },
40
40
 
41
- call,
41
+ call: protocolAwareCall.call,
42
42
 
43
- ...createCoreApi(call),
43
+ setDeviceConnectProtocol: protocolAwareCall.setDeviceConnectProtocol,
44
+
45
+ ...createCoreApi(protocolAwareCall.call),
44
46
 
45
47
  removeAllListeners: type => {
46
48
  eventEmitter.removeAllListeners(type);
47
49
  lowLevelApi?.removeAllListeners(type);
48
50
  },
49
51
 
50
- dispose: async () => {
51
- unregisterFirmwareUpdateHostBinding();
52
- await lowLevelApi?.dispose();
53
- },
52
+ dispose: () => lowLevelApi?.dispose(),
54
53
 
55
54
  uiResponse: response => lowLevelApi?.uiResponse(response),
56
55
 
@@ -12,7 +12,6 @@ import type {
12
12
  IProtocolV2FirmwareComponentTarget,
13
13
  } from '../settings';
14
14
  import type { FirmwareUpdateV4Target } from './firmwareUpdate';
15
- import type { FirmwareUpdatePlan, FirmwareUpdatePlanForceTarget } from './firmwareUpdatePlan';
16
15
 
17
16
  export type FirmwareRelease = {
18
17
  shouldUpdate?: boolean;
@@ -60,18 +59,17 @@ export type AllFirmwareRelease = {
60
59
  status?: ProtocolV2FirmwareReleaseStatus;
61
60
  hasUpgrade?: boolean;
62
61
  required?: boolean;
62
+ resourceStatus?: 'valid' | 'outdated' | 'unknown';
63
63
  currentVersions?: DeviceStateVersions;
64
64
  components?: ProtocolV2FirmwareComponentRelease[];
65
65
  targetsToUpdate?: FirmwareUpdateV4Target[];
66
66
  release?: IFirmwareReleaseInfo;
67
- firmwareUpdatePlan?: FirmwareUpdatePlan;
68
67
  };
69
68
 
70
69
  export type CheckAllFirmwareReleaseParams = {
71
70
  checkBridgeRelease?: boolean;
71
+ checkFirmwareHash?: boolean;
72
72
  firmwareType?: EFirmwareType;
73
- platform?: 'native' | 'desktop' | 'ext' | 'web' | 'web-embed';
74
- forceUpdateTargets?: FirmwareUpdatePlanForceTarget[];
75
73
  };
76
74
 
77
75
  export declare function checkAllFirmwareRelease(
@@ -0,0 +1,6 @@
1
+ import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
2
+ import type { Response } from '../params';
3
+
4
+ export declare function detectDeviceConnectProtocol(
5
+ connectId: string
6
+ ): Response<HardwareConnectProtocol>;
@@ -1,4 +1,15 @@
1
+ import type { DeviceSessionPinType } from '@onekeyfe/hd-transport';
1
2
  import type { Features } from '../device';
2
3
  import type { CommonParams, Response } from '../params';
3
4
 
4
- export declare function deviceUnlock(connectId: string, params?: CommonParams): Response<Features>;
5
+ export type DeviceUnlockParams = {
6
+ /**
7
+ * 限定本次解锁允许使用的 PIN 类型。省略时保持兼容行为,仅允许主 PIN。
8
+ */
9
+ pinType?: DeviceSessionPinType;
10
+ };
11
+
12
+ export declare function deviceUnlock(
13
+ connectId: string,
14
+ params?: CommonParams & DeviceUnlockParams
15
+ ): Response<Features>;
@@ -1,15 +1,9 @@
1
1
  import type { Success } from '@onekeyfe/hd-transport';
2
2
  import type { EFirmwareType } from '@onekeyfe/hd-shared';
3
- import type { FirmwareArtifactReader, FirmwareArtifactReference } from './firmwareUpdate';
4
- import type { FirmwareUpdatePreparedPlan } from './firmwareUpdatePreparedPlan';
5
3
  import type { Response } from '../params';
6
4
 
7
5
  export type DeviceUpdateBootloaderParams = {
8
- preparedPlan?: FirmwareUpdatePreparedPlan;
9
- hostBindingGeneration?: number;
10
6
  binary?: ArrayBuffer;
11
- artifact?: FirmwareArtifactReference;
12
- artifactReader?: FirmwareArtifactReader;
13
7
  firmwareType?: EFirmwareType;
14
8
  };
15
9
 
@@ -14,6 +14,7 @@ export type {
14
14
  export type { CipheredKeyValue, CipheredKeyValueParams } from './cipherKeyValue';
15
15
 
16
16
  export type { DeviceChangePinParams } from './deviceChangePin';
17
+ export type { DeviceUnlockParams } from './deviceUnlock';
17
18
  export type { DeviceFlagsParams } from './deviceFlags';
18
19
  export type { DeviceRecoveryParams } from './deviceRecovery';
19
20
  export type { DeviceResetParams } from './deviceReset';
@@ -25,30 +26,12 @@ export type {
25
26
  DeviceUploadResourceResponse,
26
27
  } from './deviceUploadResource';
27
28
  export type {
28
- FirmwareArtifactReader,
29
- FirmwareArtifactReference,
30
- FirmwareUpdateHostBinding,
31
- FirmwareUpdateArtifactParams,
32
29
  FirmwareUpdateParams,
33
30
  FirmwareUpdateBinaryParams,
34
31
  FirmwareUpdateV3Params,
35
32
  FirmwareUpdateV4Params,
36
33
  FirmwareUpdateV4Target,
37
34
  } from './firmwareUpdate';
38
- export type {
39
- FirmwareUpdatePlan,
40
- FirmwareUpdatePlanArtifact,
41
- FirmwareUpdatePlanArtifactRole,
42
- FirmwareUpdatePlanForceTarget,
43
- FirmwareUpdatePlanTarget,
44
- } from './firmwareUpdatePlan';
45
- export type {
46
- FirmwareUpdatePreparedArtifact,
47
- FirmwareUpdatePreparedArtifactInput,
48
- FirmwareUpdatePreparedEntry,
49
- FirmwareUpdatePreparedPlan,
50
- } from './firmwareUpdatePreparedPlan';
51
- export type { FirmwareUpdateCapabilities } from './firmwareUpdateCapabilities';
52
35
  export type { AllFirmwareRelease } from './checkAllFirmwareRelease';
53
36
  export type {
54
37
  ProtocolV2FirmwareComponentRelease,
@@ -1,53 +1,14 @@
1
1
  import type { EFirmwareType } from '@onekeyfe/hd-shared';
2
2
  import type { PROTO } from '../../constants';
3
3
  import type { Params, Response } from '../params';
4
- import type { FirmwareUpdatePreparedPlan } from './firmwareUpdatePreparedPlan';
5
4
 
6
5
  type IUpdateType = 'firmware' | 'ble';
7
6
 
8
- export interface FirmwareArtifactReference {
9
- artifactRef: string;
10
- size: number;
11
- sha256: string;
12
- }
13
-
14
- export interface FirmwareArtifactReader {
15
- open(input: { artifactRef: string }): Promise<{
16
- readerId: string;
17
- size: number;
18
- }>;
19
- read(input: { readerId: string; offset: number; length: number }): Promise<{
20
- data: ArrayBuffer;
21
- bytesRead: number;
22
- eof: boolean;
23
- }>;
24
- close(input: { readerId: string }): Promise<void>;
25
- }
26
-
27
- export interface FirmwareUpdateHostBinding {
28
- artifactReader: FirmwareArtifactReader;
29
- }
30
-
31
7
  export interface FirmwareUpdateBinaryParams {
32
8
  binary: ArrayBuffer;
33
9
  updateType: IUpdateType;
34
10
  }
35
11
 
36
- export interface FirmwareUpdateArtifactParams {
37
- preparedPlan: FirmwareUpdatePreparedPlan;
38
- hostBindingGeneration: number;
39
- artifact: FirmwareArtifactReference;
40
- resourceArtifact?: FirmwareArtifactReference;
41
- resourceEntries?: Array<{
42
- entryName: string;
43
- artifact: FirmwareArtifactReference;
44
- }>;
45
- updateType: IUpdateType;
46
- forcedUpdateRes?: boolean;
47
- isUpdateBootloader?: boolean;
48
- firmwareType?: EFirmwareType;
49
- }
50
-
51
12
  export interface FirmwareUpdateParams {
52
13
  version?: number[];
53
14
  updateType: IUpdateType;
@@ -76,14 +37,8 @@ export declare function firmwareUpdateV2(
76
37
  connectId: string | undefined,
77
38
  params: Params<FirmwareUpdateBinaryParams & Platform>
78
39
  ): Response<PROTO.Success>;
79
- export declare function firmwareUpdateV2(
80
- connectId: string | undefined,
81
- params: Params<FirmwareUpdateArtifactParams & Platform>
82
- ): Response<PROTO.Success>;
83
40
 
84
41
  export interface FirmwareUpdateV3Params {
85
- preparedPlan?: FirmwareUpdatePreparedPlan;
86
- hostBindingGeneration?: number;
87
42
  bleVersion?: number[];
88
43
  bleBinary?: ArrayBuffer;
89
44
  chunkSize?: number;
@@ -100,17 +55,6 @@ export interface FirmwareUpdateV3Params {
100
55
  firmwareType?: EFirmwareType;
101
56
 
102
57
  platform: IPlatform;
103
-
104
- artifactReader?: FirmwareArtifactReader;
105
- artifacts?: {
106
- ble?: FirmwareArtifactReference;
107
- firmware?: FirmwareArtifactReference;
108
- bootloader?: FirmwareArtifactReference;
109
- resourceEntries?: Array<{
110
- entryName: string;
111
- artifact: FirmwareArtifactReference;
112
- }>;
113
- };
114
58
  }
115
59
 
116
60
  /**
@@ -119,6 +63,7 @@ export interface FirmwareUpdateV3Params {
119
63
  */
120
64
  export type FirmwareUpdateV4Target =
121
65
  | 'boot'
66
+ | 'boot_resources'
122
67
  | 'app_v1'
123
68
  | 'app_v2'
124
69
  | 'coprocessor'
@@ -129,19 +74,17 @@ export type FirmwareUpdateV4Target =
129
74
  | 'se04';
130
75
 
131
76
  export interface FirmwareUpdateV4Params {
132
- preparedPlan?: FirmwareUpdatePreparedPlan;
133
- hostBindingGeneration?: number;
134
77
  platform: IPlatform;
135
- expectedDeviceId?: string;
136
78
  chunkSize?: number;
137
79
  firmwareType?: EFirmwareType;
138
80
  targetsToUpdate?: FirmwareUpdateV4Target[];
139
- expectedTargetVersions?: Partial<Record<FirmwareUpdateV4Target, string>>;
140
81
 
141
82
  /** FW_MGMT_TARGET_ROMLOADER = 2; Pro2 cannot install it through firmwareUpdateV4. */
142
83
  romloaderBinary?: ArrayBuffer;
143
84
  /** FW_MGMT_TARGET_BOOTLOADER = 3 */
144
85
  bootloaderBinary?: ArrayBuffer;
86
+ /** FW_MGMT_TARGET_CRATE = 1; optional Pro2 startup resources. */
87
+ bootResourcesBinary?: ArrayBuffer;
145
88
  /** FW_MGMT_TARGET_APPLICATION_P1 = 4 */
146
89
  applicationP1Binary?: ArrayBuffer;
147
90
  /** FW_MGMT_TARGET_APPLICATION_P2 = 5 */
@@ -162,24 +105,8 @@ export interface FirmwareUpdateV4Params {
162
105
  binary: ArrayBuffer;
163
106
  devicePath: string;
164
107
  }>;
165
- artifactReader?: FirmwareArtifactReader;
166
- componentArtifacts?: Partial<
167
- Record<Exclude<FirmwareUpdateV4Target, 'resource'>, FirmwareArtifactReference>
168
- >;
169
- resourceBundleArtifacts?: Array<{
170
- name: string;
171
- artifact: FirmwareArtifactReference;
172
- }>;
173
108
  }
174
109
 
175
- export declare function registerFirmwareUpdateHostBinding(
176
- binding: FirmwareUpdateHostBinding
177
- ): number;
178
-
179
- export declare function unregisterFirmwareUpdateHostBinding(generation?: number): boolean;
180
-
181
- export declare function getFirmwareUpdateHostBindingGeneration(): number;
182
-
183
110
  export declare function firmwareUpdateV3(
184
111
  connectId: string | undefined,
185
112
  params: Params<FirmwareUpdateV3Params>