@onekeyfe/hd-core 1.2.0-alpha.57 → 1.2.0-alpha.58

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 (596) hide show
  1. package/__tests__/AllNetworkGetAddressBase.tracing.test.ts +84 -2
  2. package/__tests__/DeviceCommands.test.ts +17 -6
  3. package/__tests__/core-initialization.test.ts +23 -0
  4. package/__tests__/device-connector-protocol.test.ts +81 -0
  5. package/__tests__/device-settings.test.ts +39 -18
  6. package/__tests__/protocol-v2-resources.test.ts +24 -0
  7. package/__tests__/protocol-v2.test.ts +49 -126
  8. package/__tests__/protocolV2FileWrite.test.ts +113 -0
  9. package/__tests__/public-pro2-api-boundary.test.ts +2 -98
  10. package/dist/api/FirmwareUpdateV4.d.ts +0 -1
  11. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  12. package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
  13. package/dist/api/device/DeviceSettings.d.ts.map +1 -1
  14. package/dist/api/device/DeviceVerify.d.ts.map +1 -1
  15. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts +4 -2
  16. package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
  17. package/dist/api/helpers/protocolV2FileWrite.d.ts +7 -0
  18. package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
  19. package/dist/api/index.d.ts +0 -3
  20. package/dist/api/index.d.ts.map +1 -1
  21. package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -1
  22. package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -1
  23. package/dist/api/protocol-v2/helpers.d.ts +5 -15
  24. package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
  25. package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
  26. package/dist/api/utils.d.ts +1 -6
  27. package/dist/api/utils.d.ts.map +1 -1
  28. package/dist/core/index.d.ts +4 -10
  29. package/dist/core/index.d.ts.map +1 -1
  30. package/dist/data-manager/DataManager.d.ts +1 -0
  31. package/dist/data-manager/DataManager.d.ts.map +1 -1
  32. package/dist/data-manager/TransportManager.d.ts.map +1 -1
  33. package/dist/device/DeviceCommands.d.ts.map +1 -1
  34. package/dist/device/DeviceConnector.d.ts +2 -1
  35. package/dist/device/DeviceConnector.d.ts.map +1 -1
  36. package/dist/index.d.ts +44 -723
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +499 -2953
  39. package/dist/inject.d.ts +2 -6
  40. package/dist/inject.d.ts.map +1 -1
  41. package/dist/types/api/index.d.ts +3 -176
  42. package/dist/types/api/index.d.ts.map +1 -1
  43. package/dist/types/api/protocolV2.d.ts +2 -8
  44. package/dist/types/api/protocolV2.d.ts.map +1 -1
  45. package/dist/utils/patch.d.ts +1 -1
  46. package/dist/utils/patch.d.ts.map +1 -1
  47. package/package.json +4 -4
  48. package/src/api/FirmwareUpdateV4.ts +39 -69
  49. package/src/api/allnetwork/AllNetworkGetAddressBase.ts +3 -1
  50. package/src/api/device/DeviceSettings.ts +5 -4
  51. package/src/api/device/DeviceVerify.ts +0 -2
  52. package/src/api/firmware/FirmwareUpdateBaseMethod.ts +12 -1
  53. package/src/api/helpers/protocolV2FileWrite.ts +192 -73
  54. package/src/api/index.ts +0 -3
  55. package/src/api/protocol-v2/DeviceFactoryInfoGet.ts +0 -3
  56. package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +7 -6
  57. package/src/api/protocol-v2/helpers.ts +5 -152
  58. package/src/api/utils.ts +1 -46
  59. package/src/core/index.ts +16 -28
  60. package/src/data-manager/DataManager.ts +25 -4
  61. package/src/data-manager/TransportManager.ts +6 -0
  62. package/src/device/DeviceCommands.ts +20 -2
  63. package/src/device/DeviceConnector.ts +33 -13
  64. package/src/index.ts +0 -5
  65. package/src/inject.ts +7 -209
  66. package/src/types/api/index.ts +2 -288
  67. package/src/types/api/protocolV2.ts +2 -43
  68. package/__tests__/public-test-api-boundary.test.ts +0 -167
  69. package/dist/api/BixinBackupDevice.d.ts +0 -7
  70. package/dist/api/BixinBackupDevice.d.ts.map +0 -1
  71. package/dist/api/BixinLoadDevice.d.ts +0 -7
  72. package/dist/api/BixinLoadDevice.d.ts.map +0 -1
  73. package/dist/api/BixinMessageSE.d.ts +0 -8
  74. package/dist/api/BixinMessageSE.d.ts.map +0 -1
  75. package/dist/api/BixinVerifyDeviceRequest.d.ts +0 -8
  76. package/dist/api/BixinVerifyDeviceRequest.d.ts.map +0 -1
  77. package/dist/api/WebAuthnAddResidentCredential.d.ts +0 -8
  78. package/dist/api/WebAuthnAddResidentCredential.d.ts.map +0 -1
  79. package/dist/api/WebAuthnListResidentCredentials.d.ts +0 -8
  80. package/dist/api/WebAuthnListResidentCredentials.d.ts.map +0 -1
  81. package/dist/api/WebAuthnRemoveResidentCredential.d.ts +0 -8
  82. package/dist/api/WebAuthnRemoveResidentCredential.d.ts.map +0 -1
  83. package/dist/api/binance/BinanceGetAddress.d.ts +0 -8
  84. package/dist/api/binance/BinanceGetAddress.d.ts.map +0 -1
  85. package/dist/api/binance/BinanceGetPublicKey.d.ts +0 -8
  86. package/dist/api/binance/BinanceGetPublicKey.d.ts.map +0 -1
  87. package/dist/api/binance/BinanceSignTx.d.ts +0 -7
  88. package/dist/api/binance/BinanceSignTx.d.ts.map +0 -1
  89. package/dist/api/btc/BTCAuthorizeCoinJoin.d.ts +0 -7
  90. package/dist/api/btc/BTCAuthorizeCoinJoin.d.ts.map +0 -1
  91. package/dist/api/btc/BTCGetOwnershipId.d.ts +0 -7
  92. package/dist/api/btc/BTCGetOwnershipId.d.ts.map +0 -1
  93. package/dist/api/btc/BTCGetOwnershipProof.d.ts +0 -7
  94. package/dist/api/btc/BTCGetOwnershipProof.d.ts.map +0 -1
  95. package/dist/api/crypto/CryptoBatchGetPublickeys.d.ts +0 -8
  96. package/dist/api/crypto/CryptoBatchGetPublickeys.d.ts.map +0 -1
  97. package/dist/api/crypto/CryptoCipherKeyValue.d.ts +0 -8
  98. package/dist/api/crypto/CryptoCipherKeyValue.d.ts.map +0 -1
  99. package/dist/api/crypto/CryptoCosiCommit.d.ts +0 -8
  100. package/dist/api/crypto/CryptoCosiCommit.d.ts.map +0 -1
  101. package/dist/api/crypto/CryptoCosiSign.d.ts +0 -8
  102. package/dist/api/crypto/CryptoCosiSign.d.ts.map +0 -1
  103. package/dist/api/crypto/CryptoGetECDHSessionKey.d.ts +0 -8
  104. package/dist/api/crypto/CryptoGetECDHSessionKey.d.ts.map +0 -1
  105. package/dist/api/crypto/CryptoSignIdentity.d.ts +0 -8
  106. package/dist/api/crypto/CryptoSignIdentity.d.ts.map +0 -1
  107. package/dist/api/debug/DebugLinkDecision.d.ts +0 -7
  108. package/dist/api/debug/DebugLinkDecision.d.ts.map +0 -1
  109. package/dist/api/debug/DebugLinkEraseSdCard.d.ts +0 -7
  110. package/dist/api/debug/DebugLinkEraseSdCard.d.ts.map +0 -1
  111. package/dist/api/debug/DebugLinkFlashErase.d.ts +0 -7
  112. package/dist/api/debug/DebugLinkFlashErase.d.ts.map +0 -1
  113. package/dist/api/debug/DebugLinkGetState.d.ts +0 -7
  114. package/dist/api/debug/DebugLinkGetState.d.ts.map +0 -1
  115. package/dist/api/debug/DebugLinkMemoryRead.d.ts +0 -7
  116. package/dist/api/debug/DebugLinkMemoryRead.d.ts.map +0 -1
  117. package/dist/api/debug/DebugLinkMemoryWrite.d.ts +0 -7
  118. package/dist/api/debug/DebugLinkMemoryWrite.d.ts.map +0 -1
  119. package/dist/api/debug/DebugLinkRecordScreen.d.ts +0 -7
  120. package/dist/api/debug/DebugLinkRecordScreen.d.ts.map +0 -1
  121. package/dist/api/debug/DebugLinkReseedRandom.d.ts +0 -7
  122. package/dist/api/debug/DebugLinkReseedRandom.d.ts.map +0 -1
  123. package/dist/api/debug/DebugLinkStop.d.ts +0 -7
  124. package/dist/api/debug/DebugLinkStop.d.ts.map +0 -1
  125. package/dist/api/debug/DebugLinkWatchLayout.d.ts +0 -7
  126. package/dist/api/debug/DebugLinkWatchLayout.d.ts.map +0 -1
  127. package/dist/api/emmc/EmmcDirList.d.ts +0 -7
  128. package/dist/api/emmc/EmmcDirList.d.ts.map +0 -1
  129. package/dist/api/emmc/EmmcDirMake.d.ts +0 -7
  130. package/dist/api/emmc/EmmcDirMake.d.ts.map +0 -1
  131. package/dist/api/emmc/EmmcDirRemove.d.ts +0 -7
  132. package/dist/api/emmc/EmmcDirRemove.d.ts.map +0 -1
  133. package/dist/api/emmc/EmmcFileDelete.d.ts +0 -7
  134. package/dist/api/emmc/EmmcFileDelete.d.ts.map +0 -1
  135. package/dist/api/emmc/EmmcFileRead.d.ts +0 -7
  136. package/dist/api/emmc/EmmcFileRead.d.ts.map +0 -1
  137. package/dist/api/emmc/EmmcFileWrite.d.ts +0 -7
  138. package/dist/api/emmc/EmmcFileWrite.d.ts.map +0 -1
  139. package/dist/api/emmc/EmmcFixPermission.d.ts +0 -7
  140. package/dist/api/emmc/EmmcFixPermission.d.ts.map +0 -1
  141. package/dist/api/emmc/EmmcPathInfo.d.ts +0 -7
  142. package/dist/api/emmc/EmmcPathInfo.d.ts.map +0 -1
  143. package/dist/api/eos/EosGetPublicKey.d.ts +0 -8
  144. package/dist/api/eos/EosGetPublicKey.d.ts.map +0 -1
  145. package/dist/api/eos/EosSignTx.d.ts +0 -12
  146. package/dist/api/eos/EosSignTx.d.ts.map +0 -1
  147. package/dist/api/evmTrezor/EVMGetAddress.d.ts +0 -10
  148. package/dist/api/evmTrezor/EVMGetAddress.d.ts.map +0 -1
  149. package/dist/api/evmTrezor/EVMGetPublicKey.d.ts +0 -16
  150. package/dist/api/evmTrezor/EVMGetPublicKey.d.ts.map +0 -1
  151. package/dist/api/evmTrezor/EVMSignMessage.d.ts +0 -7
  152. package/dist/api/evmTrezor/EVMSignMessage.d.ts.map +0 -1
  153. package/dist/api/evmTrezor/EVMSignTransaction.d.ts +0 -15
  154. package/dist/api/evmTrezor/EVMSignTransaction.d.ts.map +0 -1
  155. package/dist/api/evmTrezor/EVMSignTypedData.d.ts +0 -43
  156. package/dist/api/evmTrezor/EVMSignTypedData.d.ts.map +0 -1
  157. package/dist/api/evmTrezor/EVMVerifyMessage.d.ts +0 -7
  158. package/dist/api/evmTrezor/EVMVerifyMessage.d.ts.map +0 -1
  159. package/dist/api/evmTrezor/legacyV1/getAddress.d.ts +0 -6
  160. package/dist/api/evmTrezor/legacyV1/getAddress.d.ts.map +0 -1
  161. package/dist/api/evmTrezor/legacyV1/getPublicKey.d.ts +0 -6
  162. package/dist/api/evmTrezor/legacyV1/getPublicKey.d.ts.map +0 -1
  163. package/dist/api/evmTrezor/legacyV1/signMessage.d.ts +0 -6
  164. package/dist/api/evmTrezor/legacyV1/signMessage.d.ts.map +0 -1
  165. package/dist/api/evmTrezor/legacyV1/signTransaction.d.ts +0 -9
  166. package/dist/api/evmTrezor/legacyV1/signTransaction.d.ts.map +0 -1
  167. package/dist/api/evmTrezor/legacyV1/signTypedData.d.ts +0 -10
  168. package/dist/api/evmTrezor/legacyV1/signTypedData.d.ts.map +0 -1
  169. package/dist/api/evmTrezor/legacyV1/signTypedHash.d.ts +0 -11
  170. package/dist/api/evmTrezor/legacyV1/signTypedHash.d.ts.map +0 -1
  171. package/dist/api/evmTrezor/legacyV1/verifyMessage.d.ts +0 -6
  172. package/dist/api/evmTrezor/legacyV1/verifyMessage.d.ts.map +0 -1
  173. package/dist/api/extensionMethodNames.d.ts +0 -3
  174. package/dist/api/extensionMethodNames.d.ts.map +0 -1
  175. package/dist/api/factoryMethods.d.ts +0 -3
  176. package/dist/api/factoryMethods.d.ts.map +0 -1
  177. package/dist/api/firmware/FirmwareErase.d.ts +0 -12
  178. package/dist/api/firmware/FirmwareErase.d.ts.map +0 -1
  179. package/dist/api/firmware/FirmwareEraseEx.d.ts +0 -12
  180. package/dist/api/firmware/FirmwareEraseEx.d.ts.map +0 -1
  181. package/dist/api/firmware/FirmwareUpdateEmmcTest.d.ts +0 -7
  182. package/dist/api/firmware/FirmwareUpdateEmmcTest.d.ts.map +0 -1
  183. package/dist/api/firmware/FirmwareUploadTest.d.ts +0 -7
  184. package/dist/api/firmware/FirmwareUploadTest.d.ts.map +0 -1
  185. package/dist/api/firmware/Reboot.d.ts +0 -7
  186. package/dist/api/firmware/Reboot.d.ts.map +0 -1
  187. package/dist/api/firmware/SelfTest.d.ts +0 -7
  188. package/dist/api/firmware/SelfTest.d.ts.map +0 -1
  189. package/dist/api/manager/DeviceCancelAuthorization.d.ts +0 -7
  190. package/dist/api/manager/DeviceCancelAuthorization.d.ts.map +0 -1
  191. package/dist/api/manager/DeviceChangeWipeCode.d.ts +0 -7
  192. package/dist/api/manager/DeviceChangeWipeCode.d.ts.map +0 -1
  193. package/dist/api/manager/DeviceDoPreauthorized.d.ts +0 -7
  194. package/dist/api/manager/DeviceDoPreauthorized.d.ts.map +0 -1
  195. package/dist/api/manager/DeviceEndSession.d.ts +0 -7
  196. package/dist/api/manager/DeviceEndSession.d.ts.map +0 -1
  197. package/dist/api/manager/DeviceGetEntropy.d.ts +0 -7
  198. package/dist/api/manager/DeviceGetEntropy.d.ts.map +0 -1
  199. package/dist/api/manager/DeviceGetFirmwareHash.d.ts +0 -7
  200. package/dist/api/manager/DeviceGetFirmwareHash.d.ts.map +0 -1
  201. package/dist/api/manager/DeviceInfoSettings.d.ts +0 -7
  202. package/dist/api/manager/DeviceInfoSettings.d.ts.map +0 -1
  203. package/dist/api/manager/DeviceLoad.d.ts +0 -7
  204. package/dist/api/manager/DeviceLoad.d.ts.map +0 -1
  205. package/dist/api/manager/DevicePing.d.ts +0 -7
  206. package/dist/api/manager/DevicePing.d.ts.map +0 -1
  207. package/dist/api/manager/DeviceReadSEPublicCert.d.ts +0 -7
  208. package/dist/api/manager/DeviceReadSEPublicCert.d.ts.map +0 -1
  209. package/dist/api/manager/DeviceSESignMessage.d.ts +0 -7
  210. package/dist/api/manager/DeviceSESignMessage.d.ts.map +0 -1
  211. package/dist/api/manager/DeviceSdProtect.d.ts +0 -7
  212. package/dist/api/manager/DeviceSdProtect.d.ts.map +0 -1
  213. package/dist/api/manager/DeviceSpiFlashRead.d.ts +0 -7
  214. package/dist/api/manager/DeviceSpiFlashRead.d.ts.map +0 -1
  215. package/dist/api/manager/DeviceSpiFlashWrite.d.ts +0 -7
  216. package/dist/api/manager/DeviceSpiFlashWrite.d.ts.map +0 -1
  217. package/dist/api/manager/DeviceUnlockPath.d.ts +0 -7
  218. package/dist/api/manager/DeviceUnlockPath.d.ts.map +0 -1
  219. package/dist/api/manager/DeviceWriteSEPrivateKey.d.ts +0 -7
  220. package/dist/api/manager/DeviceWriteSEPrivateKey.d.ts.map +0 -1
  221. package/dist/api/manager/DeviceWriteSEPublicCert.d.ts +0 -7
  222. package/dist/api/manager/DeviceWriteSEPublicCert.d.ts.map +0 -1
  223. package/dist/api/manager/GetDeviceInfoSettings.d.ts +0 -7
  224. package/dist/api/manager/GetDeviceInfoSettings.d.ts.map +0 -1
  225. package/dist/api/manager/GetPublicKeyMultiple.d.ts +0 -7
  226. package/dist/api/manager/GetPublicKeyMultiple.d.ts.map +0 -1
  227. package/dist/api/manager/ListResDir.d.ts +0 -7
  228. package/dist/api/manager/ListResDir.d.ts.map +0 -1
  229. package/dist/api/manager/NFTWriteData.d.ts +0 -7
  230. package/dist/api/manager/NFTWriteData.d.ts.map +0 -1
  231. package/dist/api/manager/NFTWriteInfo.d.ts +0 -7
  232. package/dist/api/manager/NFTWriteInfo.d.ts.map +0 -1
  233. package/dist/api/manager/ReadSEPublicKey.d.ts +0 -7
  234. package/dist/api/manager/ReadSEPublicKey.d.ts.map +0 -1
  235. package/dist/api/manager/ResourceUpdate.d.ts +0 -6
  236. package/dist/api/manager/ResourceUpdate.d.ts.map +0 -1
  237. package/dist/api/methodExtension.d.ts +0 -13
  238. package/dist/api/methodExtension.d.ts.map +0 -1
  239. package/dist/api/monero/MoneroGetAddress.d.ts +0 -9
  240. package/dist/api/monero/MoneroGetAddress.d.ts.map +0 -1
  241. package/dist/api/monero/MoneroGetWatchKey.d.ts +0 -8
  242. package/dist/api/monero/MoneroGetWatchKey.d.ts.map +0 -1
  243. package/dist/api/nem/NEMDecryptMessage.d.ts +0 -8
  244. package/dist/api/nem/NEMDecryptMessage.d.ts.map +0 -1
  245. package/dist/api/protocol-v2/DeviceFactoryCertificateRead.d.ts +0 -7
  246. package/dist/api/protocol-v2/DeviceFactoryCertificateRead.d.ts.map +0 -1
  247. package/dist/api/protocol-v2/DeviceFactoryCertificateWrite.d.ts +0 -8
  248. package/dist/api/protocol-v2/DeviceFactoryCertificateWrite.d.ts.map +0 -1
  249. package/dist/api/protocol-v2/DeviceFactoryChallengeSign.d.ts +0 -8
  250. package/dist/api/protocol-v2/DeviceFactoryChallengeSign.d.ts.map +0 -1
  251. package/dist/api/testMethods.d.ts +0 -82
  252. package/dist/api/testMethods.d.ts.map +0 -1
  253. package/dist/api/tezos/TezosGetAddress.d.ts +0 -9
  254. package/dist/api/tezos/TezosGetAddress.d.ts.map +0 -1
  255. package/dist/api/tezos/TezosGetPublicKey.d.ts +0 -8
  256. package/dist/api/tezos/TezosGetPublicKey.d.ts.map +0 -1
  257. package/dist/api/tezos/TezosSignTx.d.ts +0 -12
  258. package/dist/api/tezos/TezosSignTx.d.ts.map +0 -1
  259. package/dist/types/api/binanceGetAddress.d.ts +0 -11
  260. package/dist/types/api/binanceGetAddress.d.ts.map +0 -1
  261. package/dist/types/api/binanceGetPublicKey.d.ts +0 -11
  262. package/dist/types/api/binanceGetPublicKey.d.ts.map +0 -1
  263. package/dist/types/api/binanceSignTx.d.ts +0 -7
  264. package/dist/types/api/binanceSignTx.d.ts.map +0 -1
  265. package/dist/types/api/bixinBackupDevice.d.ts +0 -4
  266. package/dist/types/api/bixinBackupDevice.d.ts.map +0 -1
  267. package/dist/types/api/bixinLoadDevice.d.ts +0 -4
  268. package/dist/types/api/bixinLoadDevice.d.ts.map +0 -1
  269. package/dist/types/api/bixinMessageSE.d.ts +0 -4
  270. package/dist/types/api/bixinMessageSE.d.ts.map +0 -1
  271. package/dist/types/api/bixinVerifyDeviceRequest.d.ts +0 -4
  272. package/dist/types/api/bixinVerifyDeviceRequest.d.ts.map +0 -1
  273. package/dist/types/api/btcAuthorizeCoinJoin.d.ts +0 -13
  274. package/dist/types/api/btcAuthorizeCoinJoin.d.ts.map +0 -1
  275. package/dist/types/api/btcGetOwnershipId.d.ts +0 -10
  276. package/dist/types/api/btcGetOwnershipId.d.ts.map +0 -1
  277. package/dist/types/api/btcGetOwnershipProof.d.ts +0 -13
  278. package/dist/types/api/btcGetOwnershipProof.d.ts.map +0 -1
  279. package/dist/types/api/cryptoBatchGetPublickeys.d.ts +0 -12
  280. package/dist/types/api/cryptoBatchGetPublickeys.d.ts.map +0 -1
  281. package/dist/types/api/cryptoCipherKeyValue.d.ts +0 -13
  282. package/dist/types/api/cryptoCipherKeyValue.d.ts.map +0 -1
  283. package/dist/types/api/cryptoCosiCommit.d.ts +0 -8
  284. package/dist/types/api/cryptoCosiCommit.d.ts.map +0 -1
  285. package/dist/types/api/cryptoCosiSign.d.ts +0 -10
  286. package/dist/types/api/cryptoCosiSign.d.ts.map +0 -1
  287. package/dist/types/api/cryptoGetECDHSessionKey.d.ts +0 -4
  288. package/dist/types/api/cryptoGetECDHSessionKey.d.ts.map +0 -1
  289. package/dist/types/api/cryptoSignIdentity.d.ts +0 -4
  290. package/dist/types/api/cryptoSignIdentity.d.ts.map +0 -1
  291. package/dist/types/api/debugLinkDecision.d.ts +0 -4
  292. package/dist/types/api/debugLinkDecision.d.ts.map +0 -1
  293. package/dist/types/api/debugLinkEraseSdCard.d.ts +0 -4
  294. package/dist/types/api/debugLinkEraseSdCard.d.ts.map +0 -1
  295. package/dist/types/api/debugLinkFlashErase.d.ts +0 -4
  296. package/dist/types/api/debugLinkFlashErase.d.ts.map +0 -1
  297. package/dist/types/api/debugLinkGetState.d.ts +0 -4
  298. package/dist/types/api/debugLinkGetState.d.ts.map +0 -1
  299. package/dist/types/api/debugLinkMemoryRead.d.ts +0 -4
  300. package/dist/types/api/debugLinkMemoryRead.d.ts.map +0 -1
  301. package/dist/types/api/debugLinkMemoryWrite.d.ts +0 -4
  302. package/dist/types/api/debugLinkMemoryWrite.d.ts.map +0 -1
  303. package/dist/types/api/debugLinkRecordScreen.d.ts +0 -4
  304. package/dist/types/api/debugLinkRecordScreen.d.ts.map +0 -1
  305. package/dist/types/api/debugLinkReseedRandom.d.ts +0 -4
  306. package/dist/types/api/debugLinkReseedRandom.d.ts.map +0 -1
  307. package/dist/types/api/debugLinkStop.d.ts +0 -4
  308. package/dist/types/api/debugLinkStop.d.ts.map +0 -1
  309. package/dist/types/api/debugLinkWatchLayout.d.ts +0 -4
  310. package/dist/types/api/debugLinkWatchLayout.d.ts.map +0 -1
  311. package/dist/types/api/deviceCancelAuthorization.d.ts +0 -4
  312. package/dist/types/api/deviceCancelAuthorization.d.ts.map +0 -1
  313. package/dist/types/api/deviceChangeWipeCode.d.ts +0 -4
  314. package/dist/types/api/deviceChangeWipeCode.d.ts.map +0 -1
  315. package/dist/types/api/deviceDoPreauthorized.d.ts +0 -4
  316. package/dist/types/api/deviceDoPreauthorized.d.ts.map +0 -1
  317. package/dist/types/api/deviceEndSession.d.ts +0 -4
  318. package/dist/types/api/deviceEndSession.d.ts.map +0 -1
  319. package/dist/types/api/deviceGetEntropy.d.ts +0 -4
  320. package/dist/types/api/deviceGetEntropy.d.ts.map +0 -1
  321. package/dist/types/api/deviceGetFirmwareHash.d.ts +0 -4
  322. package/dist/types/api/deviceGetFirmwareHash.d.ts.map +0 -1
  323. package/dist/types/api/deviceGetInfo.d.ts +0 -4
  324. package/dist/types/api/deviceGetInfo.d.ts.map +0 -1
  325. package/dist/types/api/deviceInfoSettings.d.ts +0 -4
  326. package/dist/types/api/deviceInfoSettings.d.ts.map +0 -1
  327. package/dist/types/api/deviceLoad.d.ts +0 -16
  328. package/dist/types/api/deviceLoad.d.ts.map +0 -1
  329. package/dist/types/api/devicePing.d.ts +0 -4
  330. package/dist/types/api/devicePing.d.ts.map +0 -1
  331. package/dist/types/api/deviceReadSEPublicCert.d.ts +0 -4
  332. package/dist/types/api/deviceReadSEPublicCert.d.ts.map +0 -1
  333. package/dist/types/api/deviceSESignMessage.d.ts +0 -4
  334. package/dist/types/api/deviceSESignMessage.d.ts.map +0 -1
  335. package/dist/types/api/deviceSdProtect.d.ts +0 -4
  336. package/dist/types/api/deviceSdProtect.d.ts.map +0 -1
  337. package/dist/types/api/deviceSpiFlashRead.d.ts +0 -4
  338. package/dist/types/api/deviceSpiFlashRead.d.ts.map +0 -1
  339. package/dist/types/api/deviceSpiFlashWrite.d.ts +0 -4
  340. package/dist/types/api/deviceSpiFlashWrite.d.ts.map +0 -1
  341. package/dist/types/api/deviceUnlockPath.d.ts +0 -11
  342. package/dist/types/api/deviceUnlockPath.d.ts.map +0 -1
  343. package/dist/types/api/deviceWriteSEPrivateKey.d.ts +0 -4
  344. package/dist/types/api/deviceWriteSEPrivateKey.d.ts.map +0 -1
  345. package/dist/types/api/deviceWriteSEPublicCert.d.ts +0 -4
  346. package/dist/types/api/deviceWriteSEPublicCert.d.ts.map +0 -1
  347. package/dist/types/api/emmcDirList.d.ts +0 -4
  348. package/dist/types/api/emmcDirList.d.ts.map +0 -1
  349. package/dist/types/api/emmcDirMake.d.ts +0 -4
  350. package/dist/types/api/emmcDirMake.d.ts.map +0 -1
  351. package/dist/types/api/emmcDirRemove.d.ts +0 -4
  352. package/dist/types/api/emmcDirRemove.d.ts.map +0 -1
  353. package/dist/types/api/emmcFileDelete.d.ts +0 -4
  354. package/dist/types/api/emmcFileDelete.d.ts.map +0 -1
  355. package/dist/types/api/emmcFileRead.d.ts +0 -4
  356. package/dist/types/api/emmcFileRead.d.ts.map +0 -1
  357. package/dist/types/api/emmcFileWrite.d.ts +0 -4
  358. package/dist/types/api/emmcFileWrite.d.ts.map +0 -1
  359. package/dist/types/api/emmcFixPermission.d.ts +0 -4
  360. package/dist/types/api/emmcFixPermission.d.ts.map +0 -1
  361. package/dist/types/api/emmcPathInfo.d.ts +0 -4
  362. package/dist/types/api/emmcPathInfo.d.ts.map +0 -1
  363. package/dist/types/api/eosGetPublicKey.d.ts +0 -8
  364. package/dist/types/api/eosGetPublicKey.d.ts.map +0 -1
  365. package/dist/types/api/eosSignTx.d.ts +0 -7
  366. package/dist/types/api/eosSignTx.d.ts.map +0 -1
  367. package/dist/types/api/evmGetAddressTrezor.d.ts +0 -15
  368. package/dist/types/api/evmGetAddressTrezor.d.ts.map +0 -1
  369. package/dist/types/api/evmGetPublicKeyTrezor.d.ts +0 -20
  370. package/dist/types/api/evmGetPublicKeyTrezor.d.ts.map +0 -1
  371. package/dist/types/api/evmSignMessageTrezor.d.ts +0 -9
  372. package/dist/types/api/evmSignMessageTrezor.d.ts.map +0 -1
  373. package/dist/types/api/evmSignTransactionTrezor.d.ts +0 -40
  374. package/dist/types/api/evmSignTransactionTrezor.d.ts.map +0 -1
  375. package/dist/types/api/evmSignTypedDataTrezor.d.ts +0 -34
  376. package/dist/types/api/evmSignTypedDataTrezor.d.ts.map +0 -1
  377. package/dist/types/api/evmVerifyMessageTrezor.d.ts +0 -10
  378. package/dist/types/api/evmVerifyMessageTrezor.d.ts.map +0 -1
  379. package/dist/types/api/firmwareErase.d.ts +0 -4
  380. package/dist/types/api/firmwareErase.d.ts.map +0 -1
  381. package/dist/types/api/firmwareEraseEx.d.ts +0 -4
  382. package/dist/types/api/firmwareEraseEx.d.ts.map +0 -1
  383. package/dist/types/api/firmwareUpdateEmmcTest.d.ts +0 -4
  384. package/dist/types/api/firmwareUpdateEmmcTest.d.ts.map +0 -1
  385. package/dist/types/api/firmwareUploadTest.d.ts +0 -4
  386. package/dist/types/api/firmwareUploadTest.d.ts.map +0 -1
  387. package/dist/types/api/getPublicKeyMultiple.d.ts +0 -4
  388. package/dist/types/api/getPublicKeyMultiple.d.ts.map +0 -1
  389. package/dist/types/api/listResDir.d.ts +0 -4
  390. package/dist/types/api/listResDir.d.ts.map +0 -1
  391. package/dist/types/api/moneroGetAddress.d.ts +0 -14
  392. package/dist/types/api/moneroGetAddress.d.ts.map +0 -1
  393. package/dist/types/api/moneroGetWatchKey.d.ts +0 -14
  394. package/dist/types/api/moneroGetWatchKey.d.ts.map +0 -1
  395. package/dist/types/api/nemDecryptMessage.d.ts +0 -10
  396. package/dist/types/api/nemDecryptMessage.d.ts.map +0 -1
  397. package/dist/types/api/nftWriteData.d.ts +0 -4
  398. package/dist/types/api/nftWriteData.d.ts.map +0 -1
  399. package/dist/types/api/nftWriteInfo.d.ts +0 -4
  400. package/dist/types/api/nftWriteInfo.d.ts.map +0 -1
  401. package/dist/types/api/readSEPublicKey.d.ts +0 -4
  402. package/dist/types/api/readSEPublicKey.d.ts.map +0 -1
  403. package/dist/types/api/reboot.d.ts +0 -4
  404. package/dist/types/api/reboot.d.ts.map +0 -1
  405. package/dist/types/api/resourceUpdate.d.ts +0 -7
  406. package/dist/types/api/resourceUpdate.d.ts.map +0 -1
  407. package/dist/types/api/selfTest.d.ts +0 -4
  408. package/dist/types/api/selfTest.d.ts.map +0 -1
  409. package/dist/types/api/tezosGetAddress.d.ts +0 -14
  410. package/dist/types/api/tezosGetAddress.d.ts.map +0 -1
  411. package/dist/types/api/tezosGetPublicKey.d.ts +0 -14
  412. package/dist/types/api/tezosGetPublicKey.d.ts.map +0 -1
  413. package/dist/types/api/tezosSignTx.d.ts +0 -7
  414. package/dist/types/api/tezosSignTx.d.ts.map +0 -1
  415. package/dist/types/api/webAuthnAddResidentCredential.d.ts +0 -4
  416. package/dist/types/api/webAuthnAddResidentCredential.d.ts.map +0 -1
  417. package/dist/types/api/webAuthnListResidentCredentials.d.ts +0 -4
  418. package/dist/types/api/webAuthnListResidentCredentials.d.ts.map +0 -1
  419. package/dist/types/api/webAuthnRemoveResidentCredential.d.ts +0 -4
  420. package/dist/types/api/webAuthnRemoveResidentCredential.d.ts.map +0 -1
  421. package/src/api/BixinBackupDevice.ts +0 -15
  422. package/src/api/BixinLoadDevice.ts +0 -22
  423. package/src/api/BixinMessageSE.ts +0 -22
  424. package/src/api/BixinVerifyDeviceRequest.ts +0 -22
  425. package/src/api/WebAuthnAddResidentCredential.ts +0 -22
  426. package/src/api/WebAuthnListResidentCredentials.ts +0 -24
  427. package/src/api/WebAuthnRemoveResidentCredential.ts +0 -22
  428. package/src/api/binance/BinanceGetAddress.ts +0 -26
  429. package/src/api/binance/BinanceGetPublicKey.ts +0 -26
  430. package/src/api/binance/BinanceSignTx.ts +0 -35
  431. package/src/api/btc/BTCAuthorizeCoinJoin.ts +0 -37
  432. package/src/api/btc/BTCGetOwnershipId.ts +0 -34
  433. package/src/api/btc/BTCGetOwnershipProof.ts +0 -37
  434. package/src/api/crypto/CryptoBatchGetPublickeys.ts +0 -30
  435. package/src/api/crypto/CryptoCipherKeyValue.ts +0 -29
  436. package/src/api/crypto/CryptoCosiCommit.ts +0 -24
  437. package/src/api/crypto/CryptoCosiSign.ts +0 -26
  438. package/src/api/crypto/CryptoGetECDHSessionKey.ts +0 -24
  439. package/src/api/crypto/CryptoSignIdentity.ts +0 -25
  440. package/src/api/debug/DebugLinkDecision.ts +0 -25
  441. package/src/api/debug/DebugLinkEraseSdCard.ts +0 -23
  442. package/src/api/debug/DebugLinkFlashErase.ts +0 -23
  443. package/src/api/debug/DebugLinkGetState.ts +0 -21
  444. package/src/api/debug/DebugLinkMemoryRead.ts +0 -24
  445. package/src/api/debug/DebugLinkMemoryWrite.ts +0 -25
  446. package/src/api/debug/DebugLinkRecordScreen.ts +0 -23
  447. package/src/api/debug/DebugLinkReseedRandom.ts +0 -23
  448. package/src/api/debug/DebugLinkStop.ts +0 -25
  449. package/src/api/debug/DebugLinkWatchLayout.ts +0 -23
  450. package/src/api/emmc/EmmcDirList.ts +0 -20
  451. package/src/api/emmc/EmmcDirMake.ts +0 -20
  452. package/src/api/emmc/EmmcDirRemove.ts +0 -20
  453. package/src/api/emmc/EmmcFileDelete.ts +0 -20
  454. package/src/api/emmc/EmmcFileRead.ts +0 -21
  455. package/src/api/emmc/EmmcFileWrite.ts +0 -23
  456. package/src/api/emmc/EmmcFixPermission.ts +0 -17
  457. package/src/api/emmc/EmmcPathInfo.ts +0 -20
  458. package/src/api/eos/EosGetPublicKey.ts +0 -26
  459. package/src/api/eos/EosSignTx.ts +0 -40
  460. package/src/api/evmTrezor/EVMGetAddress.ts +0 -75
  461. package/src/api/evmTrezor/EVMGetPublicKey.ts +0 -106
  462. package/src/api/evmTrezor/EVMSignMessage.ts +0 -40
  463. package/src/api/evmTrezor/EVMSignTransaction.ts +0 -83
  464. package/src/api/evmTrezor/EVMSignTypedData.ts +0 -366
  465. package/src/api/evmTrezor/EVMVerifyMessage.ts +0 -37
  466. package/src/api/evmTrezor/legacyV1/getAddress.ts +0 -16
  467. package/src/api/evmTrezor/legacyV1/getPublicKey.ts +0 -20
  468. package/src/api/evmTrezor/legacyV1/signMessage.ts +0 -22
  469. package/src/api/evmTrezor/legacyV1/signTransaction.ts +0 -24
  470. package/src/api/evmTrezor/legacyV1/signTypedData.ts +0 -36
  471. package/src/api/evmTrezor/legacyV1/signTypedHash.ts +0 -48
  472. package/src/api/evmTrezor/legacyV1/verifyMessage.ts +0 -19
  473. package/src/api/extensionMethodNames.ts +0 -88
  474. package/src/api/factoryMethods.ts +0 -2
  475. package/src/api/firmware/FirmwareErase.ts +0 -18
  476. package/src/api/firmware/FirmwareEraseEx.ts +0 -18
  477. package/src/api/firmware/FirmwareUpdateEmmcTest.ts +0 -18
  478. package/src/api/firmware/FirmwareUploadTest.ts +0 -17
  479. package/src/api/firmware/Reboot.ts +0 -17
  480. package/src/api/firmware/SelfTest.ts +0 -17
  481. package/src/api/manager/DeviceCancelAuthorization.ts +0 -15
  482. package/src/api/manager/DeviceChangeWipeCode.ts +0 -19
  483. package/src/api/manager/DeviceDoPreauthorized.ts +0 -15
  484. package/src/api/manager/DeviceEndSession.ts +0 -19
  485. package/src/api/manager/DeviceGetEntropy.ts +0 -19
  486. package/src/api/manager/DeviceGetFirmwareHash.ts +0 -23
  487. package/src/api/manager/DeviceInfoSettings.ts +0 -23
  488. package/src/api/manager/DeviceLoad.ts +0 -27
  489. package/src/api/manager/DevicePing.ts +0 -19
  490. package/src/api/manager/DeviceReadSEPublicCert.ts +0 -18
  491. package/src/api/manager/DeviceSESignMessage.ts +0 -23
  492. package/src/api/manager/DeviceSdProtect.ts +0 -18
  493. package/src/api/manager/DeviceSpiFlashRead.ts +0 -22
  494. package/src/api/manager/DeviceSpiFlashWrite.ts +0 -22
  495. package/src/api/manager/DeviceUnlockPath.ts +0 -26
  496. package/src/api/manager/DeviceWriteSEPrivateKey.ts +0 -23
  497. package/src/api/manager/DeviceWriteSEPublicCert.ts +0 -23
  498. package/src/api/manager/GetDeviceInfoSettings.ts +0 -20
  499. package/src/api/manager/GetPublicKeyMultiple.ts +0 -24
  500. package/src/api/manager/ListResDir.ts +0 -19
  501. package/src/api/manager/NFTWriteData.ts +0 -21
  502. package/src/api/manager/NFTWriteInfo.ts +0 -23
  503. package/src/api/manager/ReadSEPublicKey.ts +0 -20
  504. package/src/api/manager/ResourceUpdate.ts +0 -22
  505. package/src/api/methodExtension.ts +0 -27
  506. package/src/api/monero/MoneroGetAddress.ts +0 -64
  507. package/src/api/monero/MoneroGetWatchKey.ts +0 -59
  508. package/src/api/nem/NEMDecryptMessage.ts +0 -29
  509. package/src/api/protocol-v2/DeviceFactoryCertificateRead.ts +0 -25
  510. package/src/api/protocol-v2/DeviceFactoryCertificateWrite.ts +0 -30
  511. package/src/api/protocol-v2/DeviceFactoryChallengeSign.ts +0 -28
  512. package/src/api/testMethods.ts +0 -95
  513. package/src/api/tezos/TezosGetAddress.ts +0 -64
  514. package/src/api/tezos/TezosGetPublicKey.ts +0 -63
  515. package/src/api/tezos/TezosSignTx.ts +0 -44
  516. package/src/types/api/binanceGetAddress.ts +0 -17
  517. package/src/types/api/binanceGetPublicKey.ts +0 -17
  518. package/src/types/api/binanceSignTx.ts +0 -15
  519. package/src/types/api/bixinBackupDevice.ts +0 -8
  520. package/src/types/api/bixinLoadDevice.ts +0 -8
  521. package/src/types/api/bixinMessageSE.ts +0 -8
  522. package/src/types/api/bixinVerifyDeviceRequest.ts +0 -8
  523. package/src/types/api/btcAuthorizeCoinJoin.ts +0 -18
  524. package/src/types/api/btcGetOwnershipId.ts +0 -19
  525. package/src/types/api/btcGetOwnershipProof.ts +0 -22
  526. package/src/types/api/cryptoBatchGetPublickeys.ts +0 -18
  527. package/src/types/api/cryptoCipherKeyValue.ts +0 -18
  528. package/src/types/api/cryptoCosiCommit.ts +0 -13
  529. package/src/types/api/cryptoCosiSign.ts +0 -15
  530. package/src/types/api/cryptoGetECDHSessionKey.ts +0 -8
  531. package/src/types/api/cryptoSignIdentity.ts +0 -8
  532. package/src/types/api/debugLinkDecision.ts +0 -7
  533. package/src/types/api/debugLinkEraseSdCard.ts +0 -7
  534. package/src/types/api/debugLinkFlashErase.ts +0 -7
  535. package/src/types/api/debugLinkGetState.ts +0 -7
  536. package/src/types/api/debugLinkMemoryRead.ts +0 -7
  537. package/src/types/api/debugLinkMemoryWrite.ts +0 -7
  538. package/src/types/api/debugLinkRecordScreen.ts +0 -7
  539. package/src/types/api/debugLinkReseedRandom.ts +0 -7
  540. package/src/types/api/debugLinkStop.ts +0 -7
  541. package/src/types/api/debugLinkWatchLayout.ts +0 -7
  542. package/src/types/api/deviceCancelAuthorization.ts +0 -7
  543. package/src/types/api/deviceChangeWipeCode.ts +0 -7
  544. package/src/types/api/deviceDoPreauthorized.ts +0 -7
  545. package/src/types/api/deviceEndSession.ts +0 -7
  546. package/src/types/api/deviceGetEntropy.ts +0 -7
  547. package/src/types/api/deviceGetFirmwareHash.ts +0 -7
  548. package/src/types/api/deviceGetInfo.ts +0 -7
  549. package/src/types/api/deviceInfoSettings.ts +0 -7
  550. package/src/types/api/deviceLoad.ts +0 -19
  551. package/src/types/api/devicePing.ts +0 -7
  552. package/src/types/api/deviceReadSEPublicCert.ts +0 -7
  553. package/src/types/api/deviceSESignMessage.ts +0 -7
  554. package/src/types/api/deviceSdProtect.ts +0 -7
  555. package/src/types/api/deviceSpiFlashRead.ts +0 -7
  556. package/src/types/api/deviceSpiFlashWrite.ts +0 -7
  557. package/src/types/api/deviceUnlockPath.ts +0 -16
  558. package/src/types/api/deviceWriteSEPrivateKey.ts +0 -7
  559. package/src/types/api/deviceWriteSEPublicCert.ts +0 -7
  560. package/src/types/api/emmcDirList.ts +0 -7
  561. package/src/types/api/emmcDirMake.ts +0 -7
  562. package/src/types/api/emmcDirRemove.ts +0 -7
  563. package/src/types/api/emmcFileDelete.ts +0 -7
  564. package/src/types/api/emmcFileRead.ts +0 -7
  565. package/src/types/api/emmcFileWrite.ts +0 -7
  566. package/src/types/api/emmcFixPermission.ts +0 -7
  567. package/src/types/api/emmcPathInfo.ts +0 -7
  568. package/src/types/api/eosGetPublicKey.ts +0 -13
  569. package/src/types/api/eosSignTx.ts +0 -12
  570. package/src/types/api/evmGetAddressTrezor.ts +0 -24
  571. package/src/types/api/evmGetPublicKeyTrezor.ts +0 -31
  572. package/src/types/api/evmSignMessageTrezor.ts +0 -14
  573. package/src/types/api/evmSignTransactionTrezor.ts +0 -49
  574. package/src/types/api/evmSignTypedDataTrezor.ts +0 -42
  575. package/src/types/api/evmVerifyMessageTrezor.ts +0 -15
  576. package/src/types/api/firmwareErase.ts +0 -4
  577. package/src/types/api/firmwareEraseEx.ts +0 -7
  578. package/src/types/api/firmwareUpdateEmmcTest.ts +0 -7
  579. package/src/types/api/firmwareUploadTest.ts +0 -7
  580. package/src/types/api/getPublicKeyMultiple.ts +0 -11
  581. package/src/types/api/listResDir.ts +0 -8
  582. package/src/types/api/moneroGetAddress.ts +0 -23
  583. package/src/types/api/moneroGetWatchKey.ts +0 -26
  584. package/src/types/api/nemDecryptMessage.ts +0 -15
  585. package/src/types/api/nftWriteData.ts +0 -8
  586. package/src/types/api/nftWriteInfo.ts +0 -8
  587. package/src/types/api/readSEPublicKey.ts +0 -8
  588. package/src/types/api/reboot.ts +0 -4
  589. package/src/types/api/resourceUpdate.ts +0 -11
  590. package/src/types/api/selfTest.ts +0 -7
  591. package/src/types/api/tezosGetAddress.ts +0 -23
  592. package/src/types/api/tezosGetPublicKey.ts +0 -23
  593. package/src/types/api/tezosSignTx.ts +0 -12
  594. package/src/types/api/webAuthnAddResidentCredential.ts +0 -8
  595. package/src/types/api/webAuthnListResidentCredentials.ts +0 -8
  596. package/src/types/api/webAuthnRemoveResidentCredential.ts +0 -8
package/dist/index.js CHANGED
@@ -87,94 +87,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
87
87
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
88
88
  };
89
89
 
90
- const TEST_API_METHOD_NAMES = [
91
- 'btcGetOwnershipId',
92
- 'btcGetOwnershipProof',
93
- 'btcAuthorizeCoinJoin',
94
- 'cryptoBatchGetPublickeys',
95
- 'cryptoCipherKeyValue',
96
- 'cryptoCosiCommit',
97
- 'cryptoCosiSign',
98
- 'cryptoGetECDHSessionKey',
99
- 'cryptoSignIdentity',
100
- 'evmGetAddressTrezor',
101
- 'evmGetPublicKeyTrezor',
102
- 'evmSignMessageTrezor',
103
- 'evmSignTransactionTrezor',
104
- 'evmSignTypedDataTrezor',
105
- 'evmVerifyMessageTrezor',
106
- 'nemDecryptMessage',
107
- 'deviceSpiFlashWrite',
108
- 'deviceSpiFlashRead',
109
- 'deviceInfoSettings',
110
- 'deviceGetInfo',
111
- 'deviceReadSEPublicCert',
112
- 'deviceWriteSEPrivateKey',
113
- 'deviceWriteSEPublicCert',
114
- 'deviceSESignMessage',
115
- 'devicePing',
116
- 'deviceGetEntropy',
117
- 'deviceGetFirmwareHash',
118
- 'deviceUnlockPath',
119
- 'deviceSdProtect',
120
- 'deviceChangeWipeCode',
121
- 'deviceEndSession',
122
- 'deviceLoad',
123
- 'deviceDoPreauthorized',
124
- 'deviceCancelAuthorization',
125
- 'emmcDirList',
126
- 'emmcDirMake',
127
- 'emmcDirRemove',
128
- 'emmcFileDelete',
129
- 'emmcFileRead',
130
- 'emmcFileWrite',
131
- 'emmcFixPermission',
132
- 'emmcPathInfo',
133
- 'debugLinkDecision',
134
- 'debugLinkEraseSdCard',
135
- 'debugLinkFlashErase',
136
- 'debugLinkGetState',
137
- 'debugLinkMemoryRead',
138
- 'debugLinkMemoryWrite',
139
- 'debugLinkRecordScreen',
140
- 'debugLinkReseedRandom',
141
- 'debugLinkStop',
142
- 'debugLinkWatchLayout',
143
- 'firmwareErase',
144
- 'firmwareEraseEx',
145
- 'firmwareUpdateEmmcTest',
146
- 'firmwareUploadTest',
147
- 'reboot',
148
- 'selfTest',
149
- 'tezosGetAddress',
150
- 'tezosGetPublicKey',
151
- 'tezosSignTx',
152
- 'moneroGetAddress',
153
- 'moneroGetWatchKey',
154
- 'eosGetPublicKey',
155
- 'eosSignTx',
156
- 'binanceGetAddress',
157
- 'binanceGetPublicKey',
158
- 'binanceSignTx',
159
- 'webAuthnAddResidentCredential',
160
- 'webAuthnListResidentCredentials',
161
- 'webAuthnRemoveResidentCredential',
162
- 'getPublicKeyMultiple',
163
- 'listResDir',
164
- 'nftWriteData',
165
- 'nftWriteInfo',
166
- 'readSEPublicKey',
167
- 'resourceUpdate',
168
- 'bixinBackupDevice',
169
- 'bixinLoadDevice',
170
- 'bixinMessageSE',
171
- 'bixinVerifyDeviceRequest',
172
- ];
173
- const FACTORY_API_METHOD_NAMES = [
174
- 'deviceProvisionFactoryInfo',
175
- 'deviceWriteFactoryCertificate',
176
- ];
177
-
178
90
  const callbackManager = new Map();
179
91
  const generateCallbackId = () => `callback_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
180
92
  const registerCallback = (id, callback) => {
@@ -235,7 +147,7 @@ const inject = ({ call, cancel, dispose, eventEmitter, init, updateSettings, swi
235
147
  switchTransport }, createCoreApi(protocolAwareCall.call));
236
148
  return api;
237
149
  };
238
- const createAllCoreApi = (call) => ({
150
+ const createCoreApi = (call) => ({
239
151
  getLogs: () => call({ method: 'getLogs' }),
240
152
  clearSessionCache: params => call(Object.assign(Object.assign({}, params), { method: 'clearSessionCache' })),
241
153
  searchDevices: params => call(Object.assign(Object.assign({}, params), { method: 'searchDevices' })),
@@ -268,11 +180,6 @@ const createAllCoreApi = (call) => ({
268
180
  deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
269
181
  deviceReboot: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReboot' })),
270
182
  deviceGetOnboardingStatus: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetOnboardingStatus' })),
271
- deviceProvisionFactoryInfo: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceProvisionFactoryInfo' })),
272
- deviceReadFactoryInfo: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReadFactoryInfo' })),
273
- deviceWriteFactoryCertificate: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceWriteFactoryCertificate' })),
274
- deviceReadFactoryCertificate: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReadFactoryCertificate' })),
275
- deviceSignFactoryChallenge: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSignFactoryChallenge' })),
276
183
  deviceUploadWallpaper: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceUploadWallpaper' })),
277
184
  deviceUploadNft: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceUploadNft' })),
278
185
  uploadPortfolio: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'uploadPortfolio' })),
@@ -315,27 +222,12 @@ const createAllCoreApi = (call) => ({
315
222
  evmSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTransaction' })),
316
223
  evmSignTypedData: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTypedData' })),
317
224
  evmVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmVerifyMessage' })),
318
- evmGetAddressTrezor: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetAddressTrezor' })),
319
- evmGetPublicKeyTrezor: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmGetPublicKeyTrezor' })),
320
- evmSignMessageTrezor: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignMessageTrezor' })),
321
- evmSignTransactionTrezor: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTransactionTrezor' })),
322
- evmSignTypedDataTrezor: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTypedDataTrezor' })),
323
- evmVerifyMessageTrezor: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmVerifyMessageTrezor' })),
324
225
  btcGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetAddress' })),
325
226
  btcGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetPublicKey' })),
326
227
  btcSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignMessage' })),
327
228
  btcSignPsbt: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignPsbt' })),
328
229
  btcSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignTransaction' })),
329
230
  btcVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcVerifyMessage' })),
330
- btcGetOwnershipId: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetOwnershipId' })),
331
- btcGetOwnershipProof: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetOwnershipProof' })),
332
- btcAuthorizeCoinJoin: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcAuthorizeCoinJoin' })),
333
- cryptoBatchGetPublickeys: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cryptoBatchGetPublickeys' })),
334
- cryptoCipherKeyValue: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cryptoCipherKeyValue' })),
335
- cryptoCosiCommit: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cryptoCosiCommit' })),
336
- cryptoCosiSign: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cryptoCosiSign' })),
337
- cryptoGetECDHSessionKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cryptoGetECDHSessionKey' })),
338
- cryptoSignIdentity: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'cryptoSignIdentity' })),
339
231
  starcoinGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetAddress' })),
340
232
  starcoinGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetPublicKey' })),
341
233
  starcoinSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinSignMessage' })),
@@ -343,7 +235,6 @@ const createAllCoreApi = (call) => ({
343
235
  starcoinVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinVerifyMessage' })),
344
236
  nemGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemGetAddress' })),
345
237
  nemSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemSignTransaction' })),
346
- nemDecryptMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemDecryptMessage' })),
347
238
  solGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solGetAddress' })),
348
239
  solSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solSignTransaction' })),
349
240
  solSignOffchainMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solSignOffchainMessage' })),
@@ -416,91 +307,9 @@ const createAllCoreApi = (call) => ({
416
307
  benfenGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'benfenGetPublicKey' })),
417
308
  benfenSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'benfenSignTransaction' })),
418
309
  benfenSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'benfenSignMessage' })),
419
- tezosGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tezosGetAddress' })),
420
- tezosGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tezosGetPublicKey' })),
421
- tezosSignTx: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'tezosSignTx' })),
422
- binanceGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'binanceGetAddress' })),
423
- binanceGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'binanceGetPublicKey' })),
424
- binanceSignTx: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'binanceSignTx' })),
425
- moneroGetWatchKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'moneroGetWatchKey' })),
426
- moneroGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'moneroGetAddress' })),
427
- eosGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'eosGetPublicKey' })),
428
- eosSignTx: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'eosSignTx' })),
429
- webAuthnAddResidentCredential: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'webAuthnAddResidentCredential' })),
430
- webAuthnListResidentCredentials: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'webAuthnListResidentCredentials' })),
431
- webAuthnRemoveResidentCredential: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'webAuthnRemoveResidentCredential' })),
432
- getPublicKeyMultiple: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'getPublicKeyMultiple' })),
433
- listResDir: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'listResDir' })),
434
- nftWriteData: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nftWriteData' })),
435
- nftWriteInfo: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nftWriteInfo' })),
436
- readSEPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'readSEPublicKey' })),
437
- resourceUpdate: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'resourceUpdate' })),
438
- bixinBackupDevice: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'bixinBackupDevice' })),
439
- bixinLoadDevice: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'bixinLoadDevice' })),
440
- bixinMessageSE: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'bixinMessageSE' })),
441
- bixinVerifyDeviceRequest: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'bixinVerifyDeviceRequest' })),
442
- deviceSpiFlashWrite: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSpiFlashWrite' })),
443
- deviceSpiFlashRead: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSpiFlashRead' })),
444
- deviceInfoSettings: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceInfoSettings' })),
445
- deviceGetInfo: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetInfo' })),
446
- deviceReadSEPublicCert: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReadSEPublicCert' })),
447
- deviceWriteSEPrivateKey: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceWriteSEPrivateKey' })),
448
- deviceWriteSEPublicCert: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceWriteSEPublicCert' })),
449
- deviceSESignMessage: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSESignMessage' })),
450
- deviceGetFirmwareHash: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetFirmwareHash' })),
451
- deviceUnlockPath: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceUnlockPath' })),
452
- devicePing: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'devicePing' })),
453
- deviceGetEntropy: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetEntropy' })),
454
- deviceSdProtect: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceSdProtect' })),
455
- deviceChangeWipeCode: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceChangeWipeCode' })),
456
- deviceEndSession: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceEndSession' })),
457
- deviceLoad: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceLoad' })),
458
- deviceDoPreauthorized: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceDoPreauthorized' })),
459
- deviceCancelAuthorization: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceCancelAuthorization' })),
460
- emmcDirList: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcDirList' })),
461
- emmcDirMake: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcDirMake' })),
462
- emmcDirRemove: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcDirRemove' })),
463
- emmcFileDelete: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcFileDelete' })),
464
- emmcFileRead: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcFileRead' })),
465
- emmcFileWrite: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcFileWrite' })),
466
- emmcFixPermission: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcFixPermission' })),
467
- emmcPathInfo: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'emmcPathInfo' })),
468
- debugLinkDecision: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkDecision' })),
469
- debugLinkEraseSdCard: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkEraseSdCard' })),
470
- debugLinkFlashErase: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkFlashErase' })),
471
- debugLinkGetState: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkGetState' })),
472
- debugLinkMemoryRead: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkMemoryRead' })),
473
- debugLinkMemoryWrite: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkMemoryWrite' })),
474
- debugLinkRecordScreen: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkRecordScreen' })),
475
- debugLinkReseedRandom: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkReseedRandom' })),
476
- debugLinkStop: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkStop' })),
477
- debugLinkWatchLayout: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'debugLinkWatchLayout' })),
478
- firmwareEraseEx: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareEraseEx' })),
479
- firmwareErase: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareErase' })),
480
- firmwareUpdateEmmcTest: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareUpdateEmmcTest' })),
481
- firmwareUploadTest: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'firmwareUploadTest' })),
482
- reboot: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'reboot' })),
483
- selfTest: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'selfTest' })),
484
310
  neoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'neoGetAddress' })),
485
311
  neoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'neoSignTransaction' })),
486
312
  });
487
- const pickApiMethods = (api, methodNames) => {
488
- const selected = {};
489
- methodNames.forEach(methodName => {
490
- selected[methodName] = api[methodName];
491
- });
492
- return selected;
493
- };
494
- const createCoreApi = (call) => {
495
- const api = createAllCoreApi(call);
496
- const extensionMethodNames = new Set([
497
- ...TEST_API_METHOD_NAMES,
498
- ...FACTORY_API_METHOD_NAMES,
499
- ]);
500
- return Object.fromEntries(Object.entries(api).filter(([methodName]) => !extensionMethodNames.has(methodName)));
501
- };
502
- const createTestApi = (call) => pickApiMethods(createAllCoreApi(call), TEST_API_METHOD_NAMES);
503
- const createFactoryApi = (call) => pickApiMethods(createAllCoreApi(call), FACTORY_API_METHOD_NAMES);
504
313
 
505
314
  const lowLevelInject = ({ call, cancel, dispose, eventEmitter, init, uiResponse, updateSettings, switchTransport, addHardwareGlobalEventListener, }) => {
506
315
  const protocolAwareCall = createProtocolAwareCall(call);
@@ -1028,7 +837,7 @@ const createLogMessage = (type, payload) => ({
1028
837
 
1029
838
  const MAX_ENTRIES = 500;
1030
839
  let postMessage$1;
1031
- class Log$k {
840
+ class Log$l {
1032
841
  constructor(prefix, enabled) {
1033
842
  this.prefix = prefix;
1034
843
  this.enabled = enabled;
@@ -1080,7 +889,7 @@ class Log$k {
1080
889
  }
1081
890
  const _logs = {};
1082
891
  const initLog = (prefix, enabled) => {
1083
- const instance = new Log$k(prefix, !!enabled);
892
+ const instance = new Log$l(prefix, !!enabled);
1084
893
  _logs[prefix] = instance;
1085
894
  return instance;
1086
895
  };
@@ -1478,7 +1287,7 @@ function patchFeatures(response) {
1478
1287
  return response;
1479
1288
  }
1480
1289
 
1481
- const Log$j = getLogger(exports.LoggerNames.Core);
1290
+ const Log$k = getLogger(exports.LoggerNames.Core);
1482
1291
  let globalInstanceCounter = 0;
1483
1292
  let sdkInstanceCounter = 0;
1484
1293
  function generateSdkInstanceId() {
@@ -1538,7 +1347,7 @@ function completeRequestContext(responseID, error) {
1538
1347
  context.status = error ? 'error' : 'success';
1539
1348
  if (error) {
1540
1349
  context.error = error.message;
1541
- Log$j.debug(`[RequestContext] [completeRequestContext] Error: ${formatRequestContext(context)}`);
1350
+ Log$k.debug(`[RequestContext] [completeRequestContext] Error: ${formatRequestContext(context)}`);
1542
1351
  }
1543
1352
  globalActiveRequests.delete(responseID);
1544
1353
  if (context.sdkInstanceId) {
@@ -39907,7 +39716,7 @@ function isProtocolV2ResourceFileValid(binary, resource) {
39907
39716
  }
39908
39717
 
39909
39718
  var _a$1;
39910
- const Log$i = getLogger(exports.LoggerNames.Core);
39719
+ const Log$j = getLogger(exports.LoggerNames.Core);
39911
39720
  const FIRMWARE_FIELDS = [
39912
39721
  'firmware',
39913
39722
  'firmware-v1',
@@ -39962,6 +39771,7 @@ class DataManager {
39962
39771
  var _b;
39963
39772
  return __awaiter(this, void 0, void 0, function* () {
39964
39773
  this.settings = settings;
39774
+ this.protocolV2ResourcesConfigError = undefined;
39965
39775
  if (!settings.fetchConfig) {
39966
39776
  return false;
39967
39777
  }
@@ -39972,38 +39782,48 @@ class DataManager {
39972
39782
  let data = null;
39973
39783
  let fetchMethod = 'none';
39974
39784
  if (settings.configFetcher) {
39975
- Log$i.debug('[DataConfig] Trying configFetcher (client-side fetcher)...');
39785
+ Log$j.debug('[DataConfig] Trying configFetcher (client-side fetcher)...');
39976
39786
  try {
39977
39787
  data = yield settings.configFetcher(urlWithCache);
39978
39788
  if (data) {
39979
39789
  fetchMethod = 'configFetcher';
39980
- Log$i.log('[DataConfig] ConfigFetcher success');
39790
+ Log$j.log('[DataConfig] ConfigFetcher success');
39981
39791
  }
39982
39792
  else {
39983
- Log$i.debug('[DataConfig] ConfigFetcher returned null, will fallback to axios');
39793
+ Log$j.debug('[DataConfig] ConfigFetcher returned null, will fallback to axios');
39984
39794
  }
39985
39795
  }
39986
39796
  catch (e) {
39987
- Log$i.warn('[DataConfig] ConfigFetcher error, will fallback to axios:', e);
39797
+ Log$j.warn('[DataConfig] ConfigFetcher error, will fallback to axios:', e);
39988
39798
  }
39989
39799
  }
39990
39800
  if (!data) {
39991
- Log$i.debug('[DataConfig] Trying axios (SDK default fetcher)...');
39801
+ Log$j.debug('[DataConfig] Trying axios (SDK default fetcher)...');
39992
39802
  try {
39993
39803
  const response = yield axios__default["default"].get(urlWithCache, {
39994
39804
  timeout: 7000,
39995
39805
  });
39996
39806
  data = response.data;
39997
39807
  fetchMethod = 'axios';
39998
- Log$i.log('[DataConfig] Axios fetch success');
39808
+ Log$j.log('[DataConfig] Axios fetch success');
39999
39809
  }
40000
39810
  catch (e) {
40001
- Log$i.warn('[DataConfig] Axios fetch error:', e);
39811
+ Log$j.warn('[DataConfig] Axios fetch error:', e);
40002
39812
  }
40003
39813
  }
40004
39814
  if (data) {
40005
- const pro2Resources = parseProtocolV2Resources((_b = data.pro2) === null || _b === void 0 ? void 0 : _b.resources);
40006
- Log$i.log(`[DataConfig] Config loaded successfully via [${fetchMethod}]`);
39815
+ let pro2Resources;
39816
+ try {
39817
+ pro2Resources = parseProtocolV2Resources((_b = data.pro2) === null || _b === void 0 ? void 0 : _b.resources);
39818
+ }
39819
+ catch (error) {
39820
+ this.protocolV2ResourcesConfigError =
39821
+ error instanceof Error ? error : new Error(String(error));
39822
+ Log$j.warn('[DataConfig] Ignoring invalid Pro2 resources config:', error);
39823
+ }
39824
+ const enrichedPro2Config = this.enrichFirmwareReleaseInfo(data.pro2);
39825
+ const pro2Config = __rest(enrichedPro2Config, ["resources"]);
39826
+ Log$j.log(`[DataConfig] Config loaded successfully via [${fetchMethod}]`);
40007
39827
  this.deviceMap = {
40008
39828
  [hdShared.EDeviceType.Classic]: this.enrichFirmwareReleaseInfo(data.classic),
40009
39829
  [hdShared.EDeviceType.Classic1s]: this.enrichFirmwareReleaseInfo(data.classic1s),
@@ -40011,14 +39831,14 @@ class DataManager {
40011
39831
  [hdShared.EDeviceType.Mini]: this.enrichFirmwareReleaseInfo(data.mini),
40012
39832
  [hdShared.EDeviceType.Touch]: this.enrichFirmwareReleaseInfo(data.touch),
40013
39833
  [hdShared.EDeviceType.Pro]: this.enrichFirmwareReleaseInfo(data.pro),
40014
- [hdShared.EDeviceType.Pro2]: Object.assign(Object.assign({}, this.enrichFirmwareReleaseInfo(data.pro2)), (pro2Resources ? { resources: pro2Resources } : undefined)),
39834
+ [hdShared.EDeviceType.Pro2]: Object.assign(Object.assign({}, pro2Config), (pro2Resources ? { resources: pro2Resources } : undefined)),
40015
39835
  };
40016
39836
  this.assets = {
40017
39837
  bridge: data.bridge,
40018
39838
  };
40019
39839
  return true;
40020
39840
  }
40021
- Log$i.warn('[DataConfig] All fetch methods failed, using built-in default config');
39841
+ Log$j.warn('[DataConfig] All fetch methods failed, using built-in default config');
40022
39842
  return false;
40023
39843
  });
40024
39844
  }
@@ -40048,6 +39868,9 @@ class DataManager {
40048
39868
  if (!loaded) {
40049
39869
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NetworkError, 'Unable to refresh the latest remote config');
40050
39870
  }
39871
+ if (this.protocolV2ResourcesConfigError) {
39872
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NetworkError, `Invalid Pro2 resources config: ${this.protocolV2ResourcesConfigError.message}`);
39873
+ }
40051
39874
  this.lastCheckTimestamp = getTimeStamp();
40052
39875
  });
40053
39876
  }
@@ -41600,7 +41423,7 @@ function validateNonEmptyString(value, name) {
41600
41423
  }
41601
41424
  const PROTOCOL_V2_FILESYSTEM_VOLUMES = new Set(['vol0', 'vol1']);
41602
41425
  const MAX_PROTOCOL_V2_FILESYSTEM_PATH_BYTES = 127;
41603
- function getUtf8ByteLength$2(value) {
41426
+ function getUtf8ByteLength$1(value) {
41604
41427
  return Array.from(value).reduce((length, character) => {
41605
41428
  var _a;
41606
41429
  const codePoint = (_a = character.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
@@ -41642,7 +41465,7 @@ function validateProtocolV2FilesystemPath(value, name, options = {}) {
41642
41465
  throw invalidParameter$1(`Parameter [${name}] contains an invalid path segment.`);
41643
41466
  }
41644
41467
  const canonicalPath = `${volume}:${rawSuffix.startsWith('/') ? '/' : ''}${segments.join('/')}`;
41645
- if (getUtf8ByteLength$2(canonicalPath) > MAX_PROTOCOL_V2_FILESYSTEM_PATH_BYTES) {
41468
+ if (getUtf8ByteLength$1(canonicalPath) > MAX_PROTOCOL_V2_FILESYSTEM_PATH_BYTES) {
41646
41469
  throw invalidParameter$1(`Parameter [${name}] exceeds the maximum filesystem path length.`);
41647
41470
  }
41648
41471
  return canonicalPath;
@@ -42124,7 +41947,7 @@ const getDefectiveDeviceInfo = (features) => {
42124
41947
  };
42125
41948
  };
42126
41949
 
42127
- const Log$h = getLogger(exports.LoggerNames.DevicePool);
41950
+ const Log$i = getLogger(exports.LoggerNames.DevicePool);
42128
41951
  const getDiff = (current, descriptors) => {
42129
41952
  const connected = descriptors.filter(d => current.find(x => x.path === d.path) === undefined);
42130
41953
  const disconnected = current.filter(d => descriptors.find(x => x.path === d.path) === undefined);
@@ -42182,7 +42005,7 @@ class DevicePool extends events.exports {
42182
42005
  yield this._checkDevicePool(initOptions, connectId);
42183
42006
  return { devices, deviceList };
42184
42007
  }
42185
- Log$h.debug('found device in cache, but path is different: ', connectId);
42008
+ Log$i.debug('found device in cache, but path is different: ', connectId);
42186
42009
  }
42187
42010
  }
42188
42011
  const matchedDescriptor = connectId
@@ -42274,7 +42097,7 @@ class DevicePool extends events.exports {
42274
42097
  yield device.getDeviceState({ refreshSections: ['settings'] });
42275
42098
  }
42276
42099
  catch (error) {
42277
- Log$h.debug('Unable to refresh Protocol V2 device label during discovery', error);
42100
+ Log$i.debug('Unable to refresh Protocol V2 device label during discovery', error);
42278
42101
  }
42279
42102
  });
42280
42103
  }
@@ -42290,7 +42113,7 @@ class DevicePool extends events.exports {
42290
42113
  const descriptor = this.connectedPool[i];
42291
42114
  if (!connectId || descriptor.path === connectId) {
42292
42115
  const device = yield this._createDevice(descriptor, initOptions);
42293
- Log$h.debug('emit DEVICE.CONNECT: ', device === null || device === void 0 ? void 0 : device.features);
42116
+ Log$i.debug('emit DEVICE.CONNECT: ', device === null || device === void 0 ? void 0 : device.features);
42294
42117
  this.emitter.emit(DEVICE.CONNECT, device);
42295
42118
  this.connectedPool.splice(i, 1);
42296
42119
  }
@@ -42312,9 +42135,9 @@ class DevicePool extends events.exports {
42312
42135
  const diff = getDiff(this.current || [], upcoming);
42313
42136
  this.upcoming = upcoming;
42314
42137
  this.current = this.upcoming;
42315
- Log$h.debug('device pool -> current: ', this.current);
42316
- Log$h.debug('device pool -> upcomming: ', this.upcoming);
42317
- Log$h.debug('DeviceCache.reportDeviceChange diff: ', diff);
42138
+ Log$i.debug('device pool -> current: ', this.current);
42139
+ Log$i.debug('device pool -> upcomming: ', this.upcoming);
42140
+ Log$i.debug('DeviceCache.reportDeviceChange diff: ', diff);
42318
42141
  if (!diff.didUpdate) {
42319
42142
  return;
42320
42143
  }
@@ -42324,7 +42147,7 @@ class DevicePool extends events.exports {
42324
42147
  this._addConnectedDeviceToPool(d);
42325
42148
  return;
42326
42149
  }
42327
- Log$h.debug('emit DEVICE.CONNECT: ', device.features);
42150
+ Log$i.debug('emit DEVICE.CONNECT: ', device.features);
42328
42151
  this.emitter.emit(DEVICE.CONNECT, device);
42329
42152
  });
42330
42153
  diff.disconnected.forEach(d => {
@@ -42334,7 +42157,7 @@ class DevicePool extends events.exports {
42334
42157
  this._addDisconnectedDeviceToPool(d);
42335
42158
  return;
42336
42159
  }
42337
- Log$h.debug('emit DEVICE.DISCONNECT: ', device.features);
42160
+ Log$i.debug('emit DEVICE.DISCONNECT: ', device.features);
42338
42161
  device.markTransportDisconnected();
42339
42162
  this.emitter.emit(DEVICE.DISCONNECT, device);
42340
42163
  });
@@ -42370,7 +42193,7 @@ class DevicePool extends events.exports {
42370
42193
  this.connectedPool = [];
42371
42194
  this.disconnectPool = [];
42372
42195
  this.devicesCache = {};
42373
- Log$h.debug('DevicePool state has been reset');
42196
+ Log$i.debug('DevicePool state has been reset');
42374
42197
  }
42375
42198
  static dispose() {
42376
42199
  this.resetState();
@@ -42384,7 +42207,7 @@ DevicePool.disconnectPool = [];
42384
42207
  DevicePool.devicesCache = {};
42385
42208
  DevicePool.emitter = new events.exports();
42386
42209
 
42387
- const Log$g = getLogger(exports.LoggerNames.Transport);
42210
+ const Log$h = getLogger(exports.LoggerNames.Transport);
42388
42211
  const BleLogger = getLogger(exports.LoggerNames.HdBleTransport);
42389
42212
  const HttpLogger = getLogger(exports.LoggerNames.HdTransportHttp);
42390
42213
  const LowLevelLogger = getLogger(exports.LoggerNames.HdTransportLowLevel);
@@ -42394,7 +42217,7 @@ const WebUsbLogger = getLogger(exports.LoggerNames.HdTransportWebUsb);
42394
42217
  const REACT_NATIVE_BLE_SCAN_TIMEOUT_MS = 3000;
42395
42218
  class TransportManager {
42396
42219
  static load() {
42397
- Log$g.debug('transport manager load');
42220
+ Log$h.debug('transport manager load');
42398
42221
  this.defaultMessages = DataManager.getProtobufMessages();
42399
42222
  this.currentMessages = this.defaultMessages;
42400
42223
  this.protocolV1MessageSchema = 'v1CurrentSchema';
@@ -42403,14 +42226,14 @@ class TransportManager {
42403
42226
  return __awaiter(this, void 0, void 0, function* () {
42404
42227
  try {
42405
42228
  const env = DataManager.getSettings('env');
42406
- Log$g.debug('Initializing transports', env);
42229
+ Log$h.debug('Initializing transports', env);
42407
42230
  if (env === 'react-native') {
42408
42231
  if (!this.reactNativeInit) {
42409
42232
  yield this.transport.init(BleLogger, DevicePool.emitter);
42410
42233
  this.reactNativeInit = true;
42411
42234
  }
42412
42235
  else {
42413
- Log$g.debug('React Native Do Not Initializing transports');
42236
+ Log$h.debug('React Native Do Not Initializing transports');
42414
42237
  }
42415
42238
  }
42416
42239
  else if (env === 'node-usb') {
@@ -42431,15 +42254,15 @@ class TransportManager {
42431
42254
  else {
42432
42255
  yield this.transport.init(HttpLogger);
42433
42256
  }
42434
- Log$g.debug('Configuring transports');
42257
+ Log$h.debug('Configuring transports');
42435
42258
  yield this.transport.configure(JSON.stringify(this.defaultMessages));
42436
42259
  this.currentMessages = this.defaultMessages;
42437
42260
  this.protocolV1MessageSchema = 'v1CurrentSchema';
42438
42261
  yield this.configureProtocolV2Messages();
42439
- Log$g.debug('Configuring transports done');
42262
+ Log$h.debug('Configuring transports done');
42440
42263
  }
42441
42264
  catch (error) {
42442
- Log$g.debug('Initializing transports error: ', error);
42265
+ Log$h.debug('Initializing transports error: ', error);
42443
42266
  if (error.code === 'ECONNABORTED') {
42444
42267
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.BridgeTimeoutError);
42445
42268
  }
@@ -42455,7 +42278,7 @@ class TransportManager {
42455
42278
  if (this.currentMessages === messages || !messages) {
42456
42279
  return;
42457
42280
  }
42458
- Log$g.debug(`Reconfiguring transports Protocol V1 schema:${protocolV1MessageSchema}`);
42281
+ Log$h.debug(`Reconfiguring transports Protocol V1 schema:${protocolV1MessageSchema}`);
42459
42282
  try {
42460
42283
  yield this.transport.configure(JSON.stringify(messages));
42461
42284
  this.currentMessages = messages;
@@ -42467,6 +42290,9 @@ class TransportManager {
42467
42290
  });
42468
42291
  }
42469
42292
  static setTransport(TransportConstructor, plugin) {
42293
+ if (typeof TransportConstructor !== 'function') {
42294
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured, 'Transport constructor is not available');
42295
+ }
42470
42296
  const env = DataManager.getSettings('env');
42471
42297
  if (env === 'react-native') {
42472
42298
  this.transport = new TransportConstructor({
@@ -42478,9 +42304,9 @@ class TransportManager {
42478
42304
  }
42479
42305
  if (plugin) {
42480
42306
  this.plugin = plugin;
42481
- Log$g.debug('set transport plugin: ', this.plugin);
42307
+ Log$h.debug('set transport plugin: ', this.plugin);
42482
42308
  }
42483
- Log$g.debug('set transport: ', this.transport.name, this.transport.version, this.transport.configured);
42309
+ Log$h.debug('set transport: ', this.transport.name, this.transport.version, this.transport.configured);
42484
42310
  }
42485
42311
  static getTransport() {
42486
42312
  return this.transport;
@@ -42491,7 +42317,7 @@ class TransportManager {
42491
42317
  const { configureProtocolV2 } = this.transport;
42492
42318
  if (protocolV2Messages && typeof configureProtocolV2 === 'function') {
42493
42319
  yield configureProtocolV2.call(this.transport, JSON.stringify(protocolV2Messages));
42494
- Log$g.debug('Protocol V2 messages configured');
42320
+ Log$h.debug('Protocol V2 messages configured');
42495
42321
  }
42496
42322
  });
42497
42323
  }
@@ -42524,6 +42350,7 @@ const DEVICE_SESSION_CALLS = new Set([
42524
42350
  'DeviceSessionAskPin',
42525
42351
  'DeviceSessionAskPassphrase',
42526
42352
  ]);
42353
+ const PROTOCOL_V2_ACTION_CANCELLED_SUBCODE = 1;
42527
42354
  const isProtocolV2ActionCancelledMessage = (message) => /^(?:cancel(?:led|ed)(?: on device)?|confirm dismissed|user cancel(?:led|ed)(?:\s+.*)?)$/i.test(message);
42528
42355
  function shouldReduceDebugForCall(type) {
42529
42356
  return HIGH_VOLUME_DEBUG_CALLS.has(type);
@@ -42603,7 +42430,7 @@ const cancelDeviceWithInitialize = (device) => {
42603
42430
  },
42604
42431
  }));
42605
42432
  };
42606
- const Log$f = getLogger(exports.LoggerNames.DeviceCommands);
42433
+ const Log$g = getLogger(exports.LoggerNames.DeviceCommands);
42607
42434
  const LogCore = getLogger(exports.LoggerNames.Core);
42608
42435
  class DeviceCommands {
42609
42436
  constructor(device, mainId) {
@@ -42612,7 +42439,7 @@ class DeviceCommands {
42612
42439
  this.transport = TransportManager.getTransport();
42613
42440
  this.disposed = false;
42614
42441
  this.instanceId = generateInstanceId('DeviceCommands', device.sdkInstanceId);
42615
- Log$f.debug(`[DeviceCommands] Created: ${this.instanceId}, device: ${this.device.instanceId}`);
42442
+ Log$g.debug(`[DeviceCommands] Created: ${this.instanceId}, device: ${this.device.instanceId}`);
42616
42443
  }
42617
42444
  dispose(_cancelRequest) {
42618
42445
  var _a, _b;
@@ -42692,7 +42519,7 @@ class DeviceCommands {
42692
42519
  return __awaiter(this, void 0, void 0, function* () {
42693
42520
  const shouldReduceDebug = shouldReduceDebugForCall(type);
42694
42521
  if (!shouldReduceDebug) {
42695
- Log$f.debug('[DeviceCommands] [call] Sending', type, hdTransport.getSafeTransportLogPayload(msg !== null && msg !== void 0 ? msg : {}, type));
42522
+ Log$g.debug('[DeviceCommands] [call] Sending', type, hdTransport.getSafeTransportLogPayload(msg !== null && msg !== void 0 ? msg : {}, type));
42696
42523
  }
42697
42524
  try {
42698
42525
  const promise = this.transport.call(this.mainId, type, msg !== null && msg !== void 0 ? msg : {}, options);
@@ -42754,10 +42581,10 @@ class DeviceCommands {
42754
42581
  assertType(response, resType);
42755
42582
  }
42756
42583
  catch (error) {
42757
- Log$f.debug('DeviceCommands typedcall error: ', error);
42584
+ Log$g.debug('DeviceCommands typedcall error: ', error);
42758
42585
  if (error instanceof hdShared.HardwareError) {
42759
42586
  if (error.errorCode === hdShared.HardwareErrorCode.ResponseUnexpectTypeError) {
42760
- Log$f.debug('[DeviceCommands] [typedCall] Unexpected response type', {
42587
+ Log$g.debug('[DeviceCommands] [typedCall] Unexpected response type', {
42761
42588
  request: type,
42762
42589
  expected: resType,
42763
42590
  received: response.type,
@@ -42791,7 +42618,7 @@ class DeviceCommands {
42791
42618
  var _a;
42792
42619
  try {
42793
42620
  if (!shouldReduceDebugForCall(callType)) {
42794
- Log$f.debug('_filterCommonTypes: ', {
42621
+ Log$g.debug('_filterCommonTypes: ', {
42795
42622
  request: callType,
42796
42623
  response: callType === 'DeviceFirmwareUpdateStatusGet'
42797
42624
  ? {
@@ -42843,6 +42670,11 @@ class DeviceCommands {
42843
42670
  if (code === 'Failure_ProcessError') {
42844
42671
  const normalizedMessage = (_a = message === null || message === void 0 ? void 0 : message.trim()) !== null && _a !== void 0 ? _a : '';
42845
42672
  const isProtocolV2ActionCancelledFailure = this.device.isProtocolV2() && isProtocolV2ActionCancelledMessage(normalizedMessage);
42673
+ const isProtocolV2ActionCancelledSubcode = this.device.isProtocolV2() && subcode === PROTOCOL_V2_ACTION_CANCELLED_SUBCODE;
42674
+ const isProtocolV2DeviceBusyFailure = this.device.isProtocolV2() &&
42675
+ callType.startsWith('Device') &&
42676
+ !DEVICE_SESSION_CALLS.has(callType) &&
42677
+ subcode === hdTransport.DeviceErrorCode.DeviceError_Busy;
42846
42678
  const isLegacyProtocolV2LockedFailure = this.device.isProtocolV2() && /^device (?:is )?locked$/i.test(normalizedMessage);
42847
42679
  if (DEVICE_SESSION_CALLS.has(callType) &&
42848
42680
  subcode === hdTransport.DeviceSessionErrorCode.DeviceSessionError_InvalidSession) {
@@ -42893,7 +42725,15 @@ class DeviceCommands {
42893
42725
  firmwareMessage: message,
42894
42726
  });
42895
42727
  }
42728
+ else if (isProtocolV2DeviceBusyFailure) {
42729
+ error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceBusy, message, {
42730
+ failureCode: code,
42731
+ subcode,
42732
+ firmwareMessage: message,
42733
+ });
42734
+ }
42896
42735
  else if (subcode === hdTransport.DeviceErrorCode.DeviceError_ActionCancelled ||
42736
+ isProtocolV2ActionCancelledSubcode ||
42897
42737
  isProtocolV2ActionCancelledFailure) {
42898
42738
  error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.ActionCancelled, message, {
42899
42739
  failureCode: code,
@@ -42996,7 +42836,7 @@ class DeviceCommands {
42996
42836
  reject(error);
42997
42837
  });
42998
42838
  const listenerCount = this.device.listenerCount(DEVICE.PIN);
42999
- Log$f.debug(`[${this.instanceId}] _promptPin called`, {
42839
+ Log$g.debug(`[${this.instanceId}] _promptPin called`, {
43000
42840
  responseID: this.currentResponseID,
43001
42841
  deviceInstanceId: this.device.instanceId,
43002
42842
  listenerCount,
@@ -43903,7 +43743,7 @@ const parseRunOptions = (options) => {
43903
43743
  options = {};
43904
43744
  return options;
43905
43745
  };
43906
- const Log$e = getLogger(exports.LoggerNames.Device);
43746
+ const Log$f = getLogger(exports.LoggerNames.Device);
43907
43747
  const isProtocolV2DeviceStatusUnsupportedError = (error) => {
43908
43748
  var _a, _b, _c;
43909
43749
  if (error instanceof hdShared.HardwareError) {
@@ -43964,7 +43804,7 @@ class Device extends events.exports {
43964
43804
  this.sdkInstanceId = sdkInstanceId;
43965
43805
  this.instanceId = generateInstanceId('Device', this.sdkInstanceId);
43966
43806
  this.createdAt = Date.now();
43967
- Log$e.debug(`[Device] Created: ${this.instanceId}${this.sdkInstanceId ? ` for SDK: ${this.sdkInstanceId}` : ''}`);
43807
+ Log$f.debug(`[Device] Created: ${this.instanceId}${this.sdkInstanceId ? ` for SDK: ${this.sdkInstanceId}` : ''}`);
43968
43808
  }
43969
43809
  static fromDescriptor(originalDescriptor, sdkInstanceId) {
43970
43810
  const descriptor = Object.assign({}, originalDescriptor);
@@ -44055,12 +43895,12 @@ class Device extends events.exports {
44055
43895
  if (DataManager.isBleConnect(env)) {
44056
43896
  acquireResult = yield ((_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(this.originalDescriptor.id, undefined, true, strictProtocol, undefined));
44057
43897
  this.mainId = (_b = acquireResult === null || acquireResult === void 0 ? void 0 : acquireResult.uuid) !== null && _b !== void 0 ? _b : '';
44058
- Log$e.debug('Expected uuid:', this.mainId);
43898
+ Log$f.debug('Expected uuid:', this.mainId);
44059
43899
  }
44060
43900
  else {
44061
43901
  acquireResult = yield ((_c = this.deviceConnector) === null || _c === void 0 ? void 0 : _c.acquire(this.originalDescriptor.path, this.originalDescriptor.session, undefined, strictProtocol, undefined));
44062
43902
  this.mainId = acquireResult;
44063
- Log$e.debug('Expected session id:', this.mainId);
43903
+ Log$f.debug('Expected session id:', this.mainId);
44064
43904
  }
44065
43905
  const detectedProtocol = (_d = acquireResult === null || acquireResult === void 0 ? void 0 : acquireResult.protocolType) !== null && _d !== void 0 ? _d : (_f = (_e = TransportManager.transport) === null || _e === void 0 ? void 0 : _e.getProtocolType) === null || _f === void 0 ? void 0 : _f.call(_e, DataManager.isBleConnect(env) ? this.originalDescriptor.id : this.originalDescriptor.path);
44066
43906
  if ((options === null || options === void 0 ? void 0 : options.forceProtocolDetection) && !detectedProtocol) {
@@ -44086,7 +43926,7 @@ class Device extends events.exports {
44086
43926
  yield ((_j = (_h = this.deviceConnector) === null || _h === void 0 ? void 0 : _h.release) === null || _j === void 0 ? void 0 : _j.call(_h, failedSession, false));
44087
43927
  }
44088
43928
  catch (releaseError) {
44089
- Log$e.debug('Failed to release an unsuccessful protocol probe', releaseError);
43929
+ Log$f.debug('Failed to release an unsuccessful protocol probe', releaseError);
44090
43930
  }
44091
43931
  }
44092
43932
  if (!DataManager.isBleConnect(env)) {
@@ -44115,11 +43955,11 @@ class Device extends events.exports {
44115
43955
  (this.mainId && DataManager.isBleConnect(env))) {
44116
43956
  if (this.pendingCallbackPromise) {
44117
43957
  try {
44118
- Log$e.debug('Waiting for callback tasks to complete before releasing device (in release method)');
43958
+ Log$f.debug('Waiting for callback tasks to complete before releasing device (in release method)');
44119
43959
  yield this.pendingCallbackPromise.promise;
44120
43960
  }
44121
43961
  catch (error) {
44122
- Log$e.error('Error waiting for callback tasks in release method:', error);
43962
+ Log$f.error('Error waiting for callback tasks in release method:', error);
44123
43963
  }
44124
43964
  }
44125
43965
  if (this.commands) {
@@ -44138,7 +43978,7 @@ class Device extends events.exports {
44138
43978
  this.updateDescriptor({ session: null });
44139
43979
  }
44140
43980
  catch (err) {
44141
- Log$e.error('[Device] release error: ', err);
43981
+ Log$f.error('[Device] release error: ', err);
44142
43982
  }
44143
43983
  finally {
44144
43984
  this.needReloadDevice = true;
@@ -44340,7 +44180,7 @@ class Device extends events.exports {
44340
44180
  });
44341
44181
  }
44342
44182
  getInternalState(_deviceId) {
44343
- Log$e.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `currentDeviceId: ${this.getCurrentDeviceId()}`, `hasPassphraseState: ${Boolean(this.passphraseState)}`);
44183
+ Log$f.debug('getInternalState session param: ', `device_id: ${_deviceId}`, `currentDeviceId: ${this.getCurrentDeviceId()}`, `hasPassphraseState: ${Boolean(this.passphraseState)}`);
44344
44184
  const deviceId = this.getSessionCacheDeviceKey(_deviceId);
44345
44185
  if (!deviceId)
44346
44186
  return undefined;
@@ -44355,7 +44195,7 @@ class Device extends events.exports {
44355
44195
  return deviceWalletSessionStore.getStandard(deviceId);
44356
44196
  }
44357
44197
  updateInternalState(enablePassphrase, passphraseState, deviceId, sessionId = null, featuresSessionId = null, walletType = 'hidden') {
44358
- Log$e.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `enablePassphrase: ${enablePassphrase}`, `hasPassphraseState: ${Boolean(passphraseState)}`, `hasSessionId: ${Boolean(sessionId)}`, `hasFeaturesSessionId: ${Boolean(featuresSessionId)}`);
44198
+ Log$f.debug('updateInternalState session param: ', `device_id: ${deviceId}`, `enablePassphrase: ${enablePassphrase}`, `hasPassphraseState: ${Boolean(passphraseState)}`, `hasSessionId: ${Boolean(sessionId)}`, `hasFeaturesSessionId: ${Boolean(featuresSessionId)}`);
44359
44199
  const cacheDeviceKey = this.getSessionCacheDeviceKey(deviceId);
44360
44200
  if (!cacheDeviceKey)
44361
44201
  return;
@@ -44371,7 +44211,7 @@ class Device extends events.exports {
44371
44211
  deviceWalletSessionStore.deletePending(cacheDeviceKey);
44372
44212
  }
44373
44213
  setInternalState(state, initSession) {
44374
- Log$e.debug('setInternalState session param: ', `hasState: ${Boolean(state)}`, `initSession: ${initSession}`, `deviceId: ${this.getCurrentDeviceId()}`, `hasPassphraseState: ${Boolean(this.passphraseState)}`);
44214
+ Log$f.debug('setInternalState session param: ', `hasState: ${Boolean(state)}`, `initSession: ${initSession}`, `deviceId: ${this.getCurrentDeviceId()}`, `hasPassphraseState: ${Boolean(this.passphraseState)}`);
44375
44215
  if (!this.passphraseState && !initSession)
44376
44216
  return;
44377
44217
  const deviceId = this.getSessionCacheDeviceKey();
@@ -44385,7 +44225,7 @@ class Device extends events.exports {
44385
44225
  }
44386
44226
  }
44387
44227
  clearInternalState(_deviceId) {
44388
- Log$e.debug('clearInternalState param: ', _deviceId);
44228
+ Log$f.debug('clearInternalState param: ', _deviceId);
44389
44229
  const deviceId = this.getSessionCacheDeviceKey(_deviceId);
44390
44230
  if (!deviceId)
44391
44231
  return;
@@ -44452,24 +44292,24 @@ class Device extends events.exports {
44452
44292
  yield callInitialize(payload, options === null || options === void 0 ? void 0 : options.initSession);
44453
44293
  }
44454
44294
  catch (error) {
44455
- Log$e.error('Initialization failed:', error);
44295
+ Log$f.error('Initialization failed:', error);
44456
44296
  throw error;
44457
44297
  }
44458
44298
  });
44459
44299
  }
44460
44300
  _initializeProtocolV2(options) {
44461
44301
  return __awaiter(this, void 0, void 0, function* () {
44462
- Log$e.debug('Initialize device via Protocol V2 features adapter');
44302
+ Log$f.debug('Initialize device via Protocol V2 features adapter');
44463
44303
  try {
44464
44304
  const deviceInfo = yield requestProtocolV2DeviceInfo({
44465
44305
  commands: this.commands,
44466
44306
  timeoutMs: options === null || options === void 0 ? void 0 : options.protocolV2DeviceInfoTimeoutMs,
44467
44307
  });
44468
44308
  const features = yield this.probeProtocolV2RuntimeState(deviceInfo, options === null || options === void 0 ? void 0 : options.protocolV2DeviceInfoTimeoutMs);
44469
- Log$e.debug('Protocol V2 features:', features);
44309
+ Log$f.debug('Protocol V2 features:', features);
44470
44310
  }
44471
44311
  catch (error) {
44472
- Log$e.error('Protocol V2 initialization failed:', error);
44312
+ Log$f.error('Protocol V2 initialization failed:', error);
44473
44313
  throw error;
44474
44314
  }
44475
44315
  });
@@ -44575,7 +44415,7 @@ class Device extends events.exports {
44575
44415
  source,
44576
44416
  changedKeys: result.changedKeys,
44577
44417
  };
44578
- Log$e.debug('Device state patch committed', {
44418
+ Log$f.debug('Device state patch committed', {
44579
44419
  source,
44580
44420
  keys: result.changedKeys,
44581
44421
  });
@@ -44793,7 +44633,7 @@ class Device extends events.exports {
44793
44633
  return __awaiter(this, void 0, void 0, function* () {
44794
44634
  if (this.runPromise) {
44795
44635
  yield this.interruptionFromOutside();
44796
- Log$e.debug('[Device] run error:', 'Device is running, but will cancel previous operate');
44636
+ Log$f.debug('[Device] run error:', 'Device is running, but will cancel previous operate');
44797
44637
  }
44798
44638
  options = parseRunOptions(options);
44799
44639
  const runPromise = hdShared.createDeferred();
@@ -44870,7 +44710,7 @@ class Device extends events.exports {
44870
44710
  yield ((_a = this.deviceConnector) === null || _a === void 0 ? void 0 : _a.disconnect(this.mainId));
44871
44711
  }
44872
44712
  yield this.release();
44873
- Log$e.debug(`error code ${e.errorCode} release device, mainId: ${this.mainId}`);
44713
+ Log$f.debug(`error code ${e.errorCode} release device, mainId: ${this.mainId}`);
44874
44714
  }
44875
44715
  clearRunPromise();
44876
44716
  return;
@@ -44880,7 +44720,7 @@ class Device extends events.exports {
44880
44720
  options.keepSession === false) {
44881
44721
  this.keepSession = false;
44882
44722
  yield this.release();
44883
- Log$e.debug('release device, mainId: ', this.mainId);
44723
+ Log$f.debug('release device, mainId: ', this.mainId);
44884
44724
  }
44885
44725
  runPromise.resolve();
44886
44726
  clearRunPromise();
@@ -44911,7 +44751,7 @@ class Device extends events.exports {
44911
44751
  setCancelableAction(callback) {
44912
44752
  this.cancelableAction = (e) => callback(e)
44913
44753
  .catch(e2 => {
44914
- Log$e.debug('cancelableAction error', e2);
44754
+ Log$f.debug('cancelableAction error', e2);
44915
44755
  })
44916
44756
  .finally(() => {
44917
44757
  this.clearCancelableAction();
@@ -45192,7 +45032,7 @@ class Device extends events.exports {
45192
45032
  expectedPassphraseState &&
45193
45033
  expectedPassphraseState !== newPassphraseState;
45194
45034
  const passphraseStateMismatch = !!expectedPassphraseState && expectedPassphraseState !== newPassphraseState;
45195
- Log$e.debug('Check passphrase state safety: ', {
45035
+ Log$f.debug('Check passphrase state safety: ', {
45196
45036
  hasExpectedPassphraseState: Boolean(expectedPassphraseState),
45197
45037
  hasNewPassphraseState: Boolean(newPassphraseState),
45198
45038
  passphraseStateMatches: Boolean(expectedPassphraseState) && expectedPassphraseState === newPassphraseState,
@@ -45330,7 +45170,7 @@ const getBootloaderReleaseInfo = ({ features, willUpdateFirmwareVersion, firmwar
45330
45170
  };
45331
45171
  };
45332
45172
 
45333
- const Log$d = getLogger(exports.LoggerNames.Method);
45173
+ const Log$e = getLogger(exports.LoggerNames.Method);
45334
45174
  const isEvmLedgerLegacyPathWithHighIndex = (path) => {
45335
45175
  let addressN;
45336
45176
  if (typeof path === 'string') {
@@ -45414,7 +45254,7 @@ class BaseMethod {
45414
45254
  setContext(context) {
45415
45255
  this.sdkInstanceId = context.sdkInstanceId;
45416
45256
  this.instanceId = generateInstanceId('Method', this.sdkInstanceId);
45417
- Log$d.debug(`[BaseMethod] Created: ${this.instanceId}, method: ${this.name}, SDK: ${this.sdkInstanceId}`);
45257
+ Log$e.debug(`[BaseMethod] Created: ${this.instanceId}, method: ${this.name}, SDK: ${this.sdkInstanceId}`);
45418
45258
  }
45419
45259
  setDevice(device) {
45420
45260
  var _a, _b;
@@ -45434,7 +45274,7 @@ class BaseMethod {
45434
45274
  if (device.commands) {
45435
45275
  device.commands.currentResponseID = this.responseID;
45436
45276
  }
45437
- Log$d.debug(`[${this.instanceId}] setDevice: ${device.instanceId}, commands: ${(_b = device.commands) === null || _b === void 0 ? void 0 : _b.instanceId}`);
45277
+ Log$e.debug(`[${this.instanceId}] setDevice: ${device.instanceId}, commands: ${(_b = device.commands) === null || _b === void 0 ? void 0 : _b.instanceId}`);
45438
45278
  }
45439
45279
  checkFirmwareRelease() {
45440
45280
  if (!this.device || this.device.isProtocolV2())
@@ -45509,7 +45349,7 @@ class BaseMethod {
45509
45349
  checkFlag = true;
45510
45350
  }
45511
45351
  if (checkFlag && this.device.getCurrentSafetyChecks() === hdTransport.Enum_SafetyCheckLevel.Strict) {
45512
- Log$d.debug('will change safety_checks level');
45352
+ Log$e.debug('will change safety_checks level');
45513
45353
  yield this.device.commands.typedCall('ApplySettings', 'Success', {
45514
45354
  safety_checks: hdTransport.Enum_SafetyCheckLevel.PromptTemporarily,
45515
45355
  });
@@ -45544,7 +45384,7 @@ class TestInitializeDeviceDuration extends BaseMethod {
45544
45384
  }
45545
45385
 
45546
45386
  const PROTOCOL_V2_PING_MAX_MESSAGE_BYTES = 63;
45547
- const getUtf8ByteLength$1 = (value) => Array.from(value).reduce((length, character) => {
45387
+ const getUtf8ByteLength = (value) => Array.from(value).reduce((length, character) => {
45548
45388
  var _a;
45549
45389
  const codePoint = (_a = character.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
45550
45390
  if (codePoint <= 0x7f)
@@ -45560,7 +45400,7 @@ function validateProtocolV2PingMessage(value) {
45560
45400
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Protocol V2 Ping message must be a string.');
45561
45401
  }
45562
45402
  const message = value !== null && value !== void 0 ? value : '';
45563
- if (getUtf8ByteLength$1(message) > PROTOCOL_V2_PING_MAX_MESSAGE_BYTES) {
45403
+ if (getUtf8ByteLength(message) > PROTOCOL_V2_PING_MAX_MESSAGE_BYTES) {
45564
45404
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Protocol V2 Ping message must not exceed ${PROTOCOL_V2_PING_MAX_MESSAGE_BYTES} UTF-8 bytes.`);
45565
45405
  }
45566
45406
  return message;
@@ -45585,7 +45425,7 @@ class Ping extends BaseMethod {
45585
45425
  }
45586
45426
  }
45587
45427
 
45588
- const Log$c = getLogger(exports.LoggerNames.Core);
45428
+ const Log$d = getLogger(exports.LoggerNames.Core);
45589
45429
  const parseInitOptions$1 = (payload) => ({
45590
45430
  initSession: payload === null || payload === void 0 ? void 0 : payload.initSession,
45591
45431
  passphraseState: payload === null || payload === void 0 ? void 0 : payload.passphraseState,
@@ -45611,14 +45451,14 @@ class PreInitialize extends BaseMethod {
45611
45451
  }
45612
45452
  catch (_a) {
45613
45453
  this.device.clearPreInitialized();
45614
- Log$c.debug('[PRE-INIT][FAILED]');
45454
+ Log$d.debug('[PRE-INIT][FAILED]');
45615
45455
  return false;
45616
45456
  }
45617
45457
  });
45618
45458
  }
45619
45459
  }
45620
45460
 
45621
- const Log$b = getLogger(exports.LoggerNames.DevicePool);
45461
+ const Log$c = getLogger(exports.LoggerNames.DevicePool);
45622
45462
  class SearchDevices extends BaseMethod {
45623
45463
  init() {
45624
45464
  this.useDevice = false;
@@ -45659,7 +45499,7 @@ class SearchDevices extends BaseMethod {
45659
45499
  const errorCode = error && typeof error === 'object' && 'errorCode' in error
45660
45500
  ? error.errorCode
45661
45501
  : undefined;
45662
- Log$b.debug('Skip unavailable device during search', Object.assign({ path: descriptor.path }, (errorCode !== undefined ? { errorCode } : {})));
45502
+ Log$c.debug('Skip unavailable device during search', Object.assign({ path: descriptor.path }, (errorCode !== undefined ? { errorCode } : {})));
45663
45503
  }
45664
45504
  }
45665
45505
  return deviceList.map(device => device.toMessageObject());
@@ -46736,7 +46576,7 @@ class CheckFirmwareTypeAvailable extends BaseMethod {
46736
46576
  }
46737
46577
  }
46738
46578
 
46739
- class DeviceBackup$1 extends BaseMethod {
46579
+ class DeviceBackup extends BaseMethod {
46740
46580
  init() {
46741
46581
  this.useDevicePassphraseState = false;
46742
46582
  }
@@ -47077,6 +46917,7 @@ class DeviceSettings extends BaseMethod {
47077
46917
  return __awaiter(this, void 0, void 0, function* () {
47078
46918
  try {
47079
46919
  if (this.device.isProtocolV2()) {
46920
+ const refreshStatusAndSettings = () => this.device.getDeviceState({ refreshSections: ['status', 'settings'] });
47080
46921
  assertSettingsSupported(this.payload, DEVICE_SETTINGS_V1_ONLY_FIELDS, 'Protocol V2');
47081
46922
  const capabilities = getDeviceSettingsCapabilities(this.device.getCurrentDeviceType(), 'V2');
47082
46923
  assertProtocolV2SettingValues(this.payload, capabilities);
@@ -47099,7 +46940,7 @@ class DeviceSettings extends BaseMethod {
47099
46940
  const res = yield this.device.commands.typedCall('DeviceSettingsPageShow', 'Success', {
47100
46941
  page: hdTransport.DeviceSettingsPage.DevicePassphrase,
47101
46942
  });
47102
- const updated = yield this.device.getDeviceState({ refreshSections: ['status'] });
46943
+ const updated = yield refreshStatusAndSettings();
47103
46944
  const lockedAfterDisabling = requestedPassphrase === false &&
47104
46945
  current.status.unlocked === true &&
47105
46946
  updated.status.unlocked === false;
@@ -47117,7 +46958,7 @@ class DeviceSettings extends BaseMethod {
47117
46958
  const res = yield this.device.commands.typedCall('DeviceSettingsPageShow', 'Success', {
47118
46959
  page: hdTransport.DeviceSettingsPage.DeviceAirgap,
47119
46960
  });
47120
- const updated = yield this.device.getDeviceState({ refreshSections: ['settings'] });
46961
+ const updated = yield refreshStatusAndSettings();
47121
46962
  if (updated.settings.airgapMode !== requestedAirgap) {
47122
46963
  throw hdShared.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 air-gap setting did not reach the requested value.');
47123
46964
  }
@@ -47129,7 +46970,7 @@ class DeviceSettings extends BaseMethod {
47129
46970
  const res = yield this.device.commands.typedCall('DeviceSettingsSet', 'Success', {
47130
46971
  settings,
47131
46972
  });
47132
- this.device.updateState(mapDeviceSettingsToState(settings), 'settings-write');
46973
+ yield refreshStatusAndSettings();
47133
46974
  return res.message;
47134
46975
  }
47135
46976
  assertSettingsSupported(this.payload, DEVICE_SETTINGS_V2_ONLY_FIELDS, 'Protocol V1');
@@ -47367,7 +47208,6 @@ class DeviceSupportFeatures extends BaseMethod {
47367
47208
  class DeviceVerify extends BaseMethod {
47368
47209
  init() {
47369
47210
  this.useDevicePassphraseState = false;
47370
- this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
47371
47211
  validateParams(this.payload, [{ name: 'dataHex', type: 'hexString' }]);
47372
47212
  this.params = {
47373
47213
  data: formatAnyHex(this.payload.dataHex),
@@ -47495,7 +47335,7 @@ const getInfo = ({ features, updateType, targetVersion, firmwareType }) => {
47495
47335
  const NEW_BOOT_UPRATE_FIRMWARE_VERSION = '2.4.5';
47496
47336
  const SESSION_ERROR$2 = 'session not found';
47497
47337
  const FIRMWARE_UPDATE_CONFIRM$1 = 'Firmware install confirmed';
47498
- const Log$a = getLogger(exports.LoggerNames.Method);
47338
+ const Log$b = getLogger(exports.LoggerNames.Method);
47499
47339
  const isDeviceDisconnectedError$1 = (error) => {
47500
47340
  const message = error instanceof Error ? error.message : String(error !== null && error !== void 0 ? error : '');
47501
47341
  return (message.includes('device was disconnected') ||
@@ -47544,13 +47384,13 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, { payload, r
47544
47384
  const newFeatures = yield typedCall('GetFeatures', 'Features', {});
47545
47385
  const deviceBootloaderVersion = getDeviceBootloaderVersion(buildProtocolV1FeaturesPayload(newFeatures.message, device.features)).join('.');
47546
47386
  const supportUpgradeFileHeader = semver__default["default"].gte(deviceBootloaderVersion, '2.1.0');
47547
- Log$a.debug('supportUpgradeFileHeader:', supportUpgradeFileHeader);
47387
+ Log$b.debug('supportUpgradeFileHeader:', supportUpgradeFileHeader);
47548
47388
  if (supportUpgradeFileHeader) {
47549
47389
  const HEADER_SIZE = 1024;
47550
47390
  if (payload.byteLength < HEADER_SIZE) {
47551
47391
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `firmware payload too small: ${payload.byteLength} bytes, expected at least ${HEADER_SIZE} bytes`);
47552
47392
  }
47553
- Log$a.debug('Uploading firmware header:', {
47393
+ Log$b.debug('Uploading firmware header:', {
47554
47394
  size: HEADER_SIZE,
47555
47395
  totalSize: payload.byteLength,
47556
47396
  });
@@ -47562,18 +47402,18 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, { payload, r
47562
47402
  });
47563
47403
  const isUnknownMessage = (_b = (_a = headerRes.message) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.includes('Failure_UnknownMessage');
47564
47404
  if (headerRes.type !== 'Success' && !isUnknownMessage) {
47565
- Log$a.error('Firmware header upload failed:', headerRes);
47405
+ Log$b.error('Firmware header upload failed:', headerRes);
47566
47406
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'failed to upload firmware header');
47567
47407
  }
47568
47408
  }
47569
47409
  catch (error) {
47570
- Log$a.error('Firmware header upload failed:', error);
47410
+ Log$b.error('Firmware header upload failed:', error);
47571
47411
  const message = error instanceof Error ? error.message : String(error !== null && error !== void 0 ? error : '');
47572
47412
  if (!message.includes('Failure_UnknownMessage')) {
47573
47413
  throw error;
47574
47414
  }
47575
47415
  }
47576
- Log$a.debug('Firmware header uploaded successfully');
47416
+ Log$b.debug('Firmware header uploaded successfully');
47577
47417
  }
47578
47418
  }
47579
47419
  const eraseCommand = isFirmware ? 'FirmwareErase' : 'FirmwareErase_ex';
@@ -47591,7 +47431,7 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, { payload, r
47591
47431
  }
47592
47432
  catch (error) {
47593
47433
  if (isDeviceDisconnectedError$1(error)) {
47594
- Log$a.log('Rebooting device');
47434
+ Log$b.log('Rebooting device');
47595
47435
  updateResponse = {
47596
47436
  type: 'Success',
47597
47437
  message: { message: FIRMWARE_UPDATE_CONFIRM$1 },
@@ -47677,7 +47517,7 @@ const newTouchUpdateProcess = (updateType, postMessage, device, { payload }, reb
47677
47517
  }
47678
47518
  catch (error) {
47679
47519
  if (isDeviceDisconnectedError$1(error)) {
47680
- Log$a.log('Rebooting device');
47520
+ Log$b.log('Rebooting device');
47681
47521
  response = {
47682
47522
  type: 'Success',
47683
47523
  message: { message: FIRMWARE_UPDATE_CONFIRM$1 },
@@ -47708,7 +47548,7 @@ const newTouchUpdateProcess = (updateType, postMessage, device, { payload }, reb
47708
47548
  ]);
47709
47549
  }
47710
47550
  catch (e) {
47711
- Log$a.log('catch Bluetooth error when device is restarting: ', e);
47551
+ Log$b.log('catch Bluetooth error when device is restarting: ', e);
47712
47552
  }
47713
47553
  }
47714
47554
  else {
@@ -47729,7 +47569,7 @@ const newTouchUpdateProcess = (updateType, postMessage, device, { payload }, reb
47729
47569
  }
47730
47570
  catch (error) {
47731
47571
  console.error('Device reconnect failed: ', error);
47732
- Log$a.error('Device reconnect failed:', error);
47572
+ Log$b.error('Device reconnect failed:', error);
47733
47573
  yield wait(1000);
47734
47574
  }
47735
47575
  }
@@ -47769,7 +47609,7 @@ const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, ov
47769
47609
  return result;
47770
47610
  }
47771
47611
  catch (error) {
47772
- Log$a.error(`emmcWrite error: `, error);
47612
+ Log$b.error(`emmcWrite error: `, error);
47773
47613
  retryCount--;
47774
47614
  if (retryCount === 0) {
47775
47615
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, 'transfer data error');
@@ -47914,7 +47754,7 @@ class DeviceFullyUploadResource extends BaseMethod {
47914
47754
  }
47915
47755
  }
47916
47756
 
47917
- const Log$9 = getLogger(exports.LoggerNames.Method);
47757
+ const Log$a = getLogger(exports.LoggerNames.Method);
47918
47758
  const SESSION_ERROR$1 = 'session not found';
47919
47759
  const FIRMWARE_UPDATE_CONFIRM = 'Firmware install confirmed';
47920
47760
  const isDeviceDisconnectedError = (error) => {
@@ -47940,12 +47780,9 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
47940
47780
  type,
47941
47781
  }));
47942
47782
  };
47943
- this.postProgressMessage = (progress, progressType) => {
47944
- this.postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, {
47945
- device: this.device.toMessageObject(),
47946
- progress,
47947
- progressType,
47948
- }));
47783
+ this.postProgressMessage = (progress, progressType, metrics) => {
47784
+ this.postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, Object.assign({ device: this.device.toMessageObject(), progress,
47785
+ progressType }, metrics)));
47949
47786
  };
47950
47787
  }
47951
47788
  init() { }
@@ -47993,7 +47830,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
47993
47830
  this.checkPromise = hdShared.createDeferred();
47994
47831
  const env = DataManager.getSettings('env');
47995
47832
  const isBleReconnect = connectId && DataManager.isBleConnect(env);
47996
- Log$9.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
47833
+ Log$a.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
47997
47834
  let isFirstCheck = true;
47998
47835
  let checkCount = 0;
47999
47836
  let hasPromptedWebDevice = false;
@@ -48004,10 +47841,10 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
48004
47841
  const intervalTimer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
48005
47842
  var _c, _d, _e, _f;
48006
47843
  checkCount += 1;
48007
- Log$9.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] isFirstCheck: ', isFirstCheck);
47844
+ Log$a.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] isFirstCheck: ', isFirstCheck);
48008
47845
  if (isTouchOrProDevice && isFirstCheck) {
48009
47846
  isFirstCheck = false;
48010
- Log$9.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] wait 3000ms');
47847
+ Log$a.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] wait 3000ms');
48011
47848
  yield wait(3000);
48012
47849
  }
48013
47850
  if (checkCount > 4 &&
@@ -48027,7 +47864,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
48027
47864
  catch (e) {
48028
47865
  clearInterval(intervalTimer);
48029
47866
  clearTimeout(timeoutTimer);
48030
- Log$9.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] _promptDeviceInBootloaderForWebDevice failed: ', e);
47867
+ Log$a.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] _promptDeviceInBootloaderForWebDevice failed: ', e);
48031
47868
  (_c = this.checkPromise) === null || _c === void 0 ? void 0 : _c.reject(e);
48032
47869
  }
48033
47870
  finally {
@@ -48045,7 +47882,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
48045
47882
  }
48046
47883
  }
48047
47884
  catch (e) {
48048
- Log$9.log('catch Bluetooth error when device is restarting: ', e);
47885
+ Log$a.log('catch Bluetooth error when device is restarting: ', e);
48049
47886
  }
48050
47887
  }
48051
47888
  else {
@@ -48128,7 +47965,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
48128
47965
  }
48129
47966
  catch (error) {
48130
47967
  if (isDeviceDisconnectedError(error)) {
48131
- Log$9.log('Rebooting device');
47968
+ Log$a.log('Rebooting device');
48132
47969
  updateResponse = {
48133
47970
  type: 'Success',
48134
47971
  message: { message: FIRMWARE_UPDATE_CONFIRM },
@@ -48218,7 +48055,7 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
48218
48055
  return result;
48219
48056
  }
48220
48057
  catch (error) {
48221
- Log$9.error(`emmcWrite error: `, error);
48058
+ Log$a.error(`emmcWrite error: `, error);
48222
48059
  retryCount--;
48223
48060
  if (retryCount === 0) {
48224
48061
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, 'transfer data error');
@@ -48422,7 +48259,7 @@ class GetNextU2FCounter extends BaseMethod {
48422
48259
  }
48423
48260
  }
48424
48261
 
48425
- const Log$8 = getLogger(exports.LoggerNames.Method);
48262
+ const Log$9 = getLogger(exports.LoggerNames.Method);
48426
48263
  class FirmwareUpdate extends BaseMethod {
48427
48264
  constructor() {
48428
48265
  super(...arguments);
@@ -48460,7 +48297,7 @@ class FirmwareUpdate extends BaseMethod {
48460
48297
  this.checkPromise = hdShared.createDeferred();
48461
48298
  const env = DataManager.getSettings('env');
48462
48299
  const isBleReconnect = connectId && DataManager.isBleConnect(env);
48463
- Log$8.log('FirmwareUpdate [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
48300
+ Log$9.log('FirmwareUpdate [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
48464
48301
  const intervalTimer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
48465
48302
  var _a, _b, _c, _d, _e, _f, _g, _h;
48466
48303
  if (isBleReconnect) {
@@ -48473,7 +48310,7 @@ class FirmwareUpdate extends BaseMethod {
48473
48310
  }
48474
48311
  }
48475
48312
  catch (e) {
48476
- Log$8.log('catch Bluetooth error when device is restarting: ', e);
48313
+ Log$9.log('catch Bluetooth error when device is restarting: ', e);
48477
48314
  }
48478
48315
  }
48479
48316
  else {
@@ -48529,7 +48366,7 @@ class FirmwareUpdate extends BaseMethod {
48529
48366
  if (e instanceof hdShared.HardwareError) {
48530
48367
  return Promise.reject(e);
48531
48368
  }
48532
- Log$8.log('auto go to bootloader mode failed: ', e);
48369
+ Log$9.log('auto go to bootloader mode failed: ', e);
48533
48370
  return Promise.reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure));
48534
48371
  }
48535
48372
  }
@@ -48569,7 +48406,7 @@ class FirmwareUpdate extends BaseMethod {
48569
48406
  }
48570
48407
  }
48571
48408
 
48572
- const Log$7 = getLogger(exports.LoggerNames.Method);
48409
+ const Log$8 = getLogger(exports.LoggerNames.Method);
48573
48410
  const FIRMWARE_DOWNLOAD_REQUEST_OPTIONS = {
48574
48411
  connectTimeoutMs: 60000,
48575
48412
  readTimeoutMs: 60000,
@@ -48685,7 +48522,7 @@ class FirmwareUpdateV2 extends BaseMethod {
48685
48522
  this.checkPromise = hdShared.createDeferred();
48686
48523
  const env = DataManager.getSettings('env');
48687
48524
  const isBleReconnect = connectId && DataManager.isBleConnect(env);
48688
- Log$7.log('FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
48525
+ Log$8.log('FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
48689
48526
  let isFirstCheck = true;
48690
48527
  let checkCount = 0;
48691
48528
  let timeoutTimer;
@@ -48694,10 +48531,10 @@ class FirmwareUpdateV2 extends BaseMethod {
48694
48531
  const intervalTimer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
48695
48532
  var _b, _c, _d, _e;
48696
48533
  checkCount += 1;
48697
- Log$7.log('FirmwareUpdateV2 [checkDeviceToBootloader] isFirstCheck: ', isFirstCheck);
48534
+ Log$8.log('FirmwareUpdateV2 [checkDeviceToBootloader] isFirstCheck: ', isFirstCheck);
48698
48535
  if (isTouchOrProDevice && isFirstCheck) {
48699
48536
  isFirstCheck = false;
48700
- Log$7.log('FirmwareUpdateV2 [checkDeviceToBootloader] wait 3000ms');
48537
+ Log$8.log('FirmwareUpdateV2 [checkDeviceToBootloader] wait 3000ms');
48701
48538
  yield wait(3000);
48702
48539
  }
48703
48540
  if (checkCount > 4 &&
@@ -48713,7 +48550,7 @@ class FirmwareUpdateV2 extends BaseMethod {
48713
48550
  }
48714
48551
  }
48715
48552
  catch (e) {
48716
- Log$7.log('FirmwareUpdateV2 [checkDeviceToBootloader] promptDeviceInBootloaderForWebDevice failed: ', e);
48553
+ Log$8.log('FirmwareUpdateV2 [checkDeviceToBootloader] promptDeviceInBootloaderForWebDevice failed: ', e);
48717
48554
  (_b = this.checkPromise) === null || _b === void 0 ? void 0 : _b.reject(e);
48718
48555
  }
48719
48556
  return;
@@ -48728,7 +48565,7 @@ class FirmwareUpdateV2 extends BaseMethod {
48728
48565
  }
48729
48566
  }
48730
48567
  catch (e) {
48731
- Log$7.log('catch Bluetooth error when device is restarting: ', e);
48568
+ Log$8.log('catch Bluetooth error when device is restarting: ', e);
48732
48569
  }
48733
48570
  }
48734
48571
  else {
@@ -48911,7 +48748,7 @@ class FirmwareUpdateV2 extends BaseMethod {
48911
48748
  }
48912
48749
  }
48913
48750
 
48914
- const Log$6 = getLogger(exports.LoggerNames.Method);
48751
+ const Log$7 = getLogger(exports.LoggerNames.Method);
48915
48752
  const MIN_UPDATE_V3_BOOTLOADER_VERSION = '2.8.0';
48916
48753
  class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
48917
48754
  constructor() {
@@ -48952,7 +48789,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
48952
48789
  }
48953
48790
  run() {
48954
48791
  return __awaiter(this, void 0, void 0, function* () {
48955
- Log$6.debug('FirmwareUpdateV3 strategy: Protocol V1');
48792
+ Log$7.debug('FirmwareUpdateV3 strategy: Protocol V1');
48956
48793
  return this.runProtocolV1();
48957
48794
  });
48958
48795
  }
@@ -49023,7 +48860,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
49023
48860
  const resource = (yield getSysResourceBinary(resourceUrl)).binary;
49024
48861
  return resource;
49025
48862
  }
49026
- Log$6.warn('No resource url found');
48863
+ Log$7.warn('No resource url found');
49027
48864
  return null;
49028
48865
  });
49029
48866
  }
@@ -49148,7 +48985,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
49148
48985
  yield this.startEmmcFirmwareUpdate({ path: '0:updates' });
49149
48986
  }
49150
48987
  catch (error) {
49151
- Log$6.error('triggerFirmwareUpdateEmmc error: ', error);
48988
+ Log$7.error('triggerFirmwareUpdateEmmc error: ', error);
49152
48989
  if (error === null || error === void 0 ? void 0 : error.errorCode) {
49153
48990
  const unexpectedError = [
49154
48991
  hdShared.HardwareErrorCode.ActionCancelled,
@@ -49209,7 +49046,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
49209
49046
  yield hdShared.wait(1000);
49210
49047
  }
49211
49048
  catch (error) {
49212
- Log$6.log('getFeatures error', error);
49049
+ Log$7.log('getFeatures error', error);
49213
49050
  let shouldReconnect = true;
49214
49051
  const progress = this.extractUpdateModeProgress(error);
49215
49052
  if (progress !== null) {
@@ -49307,7 +49144,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
49307
49144
  return;
49308
49145
  }
49309
49146
  catch (e) {
49310
- Log$6.log('catch Bluetooth error when device is restarting: ', e);
49147
+ Log$7.log('catch Bluetooth error when device is restarting: ', e);
49311
49148
  }
49312
49149
  }
49313
49150
  else {
@@ -49322,7 +49159,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
49322
49159
  yield this._promptDeviceForSwitchFirmwareWebDevice();
49323
49160
  }
49324
49161
  catch (e) {
49325
- Log$6.log('WebUSB re-authorization failed: ', e);
49162
+ Log$7.log('WebUSB re-authorization failed: ', e);
49326
49163
  }
49327
49164
  webUsbCheckCount = 0;
49328
49165
  }
@@ -49345,7 +49182,7 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
49345
49182
  }
49346
49183
  catch (error) {
49347
49184
  console.error('Device reconnect failed: ', error);
49348
- Log$6.error('Device reconnect failed:', error);
49185
+ Log$7.error('Device reconnect failed:', error);
49349
49186
  yield hdShared.wait(1000);
49350
49187
  }
49351
49188
  }
@@ -49354,6 +49191,238 @@ class FirmwareUpdateV3 extends FirmwareUpdateBaseMethod {
49354
49191
  }
49355
49192
  }
49356
49193
 
49194
+ const Log$6 = getLogger(exports.LoggerNames.Method);
49195
+ const MIN_FILE_CHUNK_SIZE = 64;
49196
+ const FILE_TRANSFER_RATE_WINDOW_MS = 1000;
49197
+ const FILE_TRANSFER_LOG_INTERVAL_MS = 10000;
49198
+ const SESSION_ERROR = 'session not found';
49199
+ function formatFileTransferRate(bytesPerSecond) {
49200
+ return (Math.max(bytesPerSecond, 0) / 1024).toFixed(2);
49201
+ }
49202
+ function getAverageFileTransferRate(transferredBytes, elapsedMs) {
49203
+ if (elapsedMs <= 0)
49204
+ return 0;
49205
+ return Math.round((Math.max(transferredBytes, 0) / elapsedMs) * 1000);
49206
+ }
49207
+ function getFileTransferTransport() {
49208
+ const env = DataManager.getSettings('env');
49209
+ return env && DataManager.isBleConnect(env) ? 'BLE' : String(env !== null && env !== void 0 ? env : 'unknown');
49210
+ }
49211
+ function logFileTransferMetrics({ transport, status, transferredBytes, totalBytes, elapsedMs, rateBytesPerSecond, }) {
49212
+ Log$6.log(`[FileWrite] metrics transport=${transport} status=${status} bytes=${transferredBytes}/${totalBytes} elapsed=${(elapsedMs / 1000).toFixed(2)}s speed=${formatFileTransferRate(rateBytesPerSecond)} KiB/s`);
49213
+ }
49214
+ function isProtocolV2ResponseTimeout(error) {
49215
+ var _a, _b;
49216
+ if (!error || typeof error !== 'object')
49217
+ return false;
49218
+ const candidate = error;
49219
+ const code = (_a = candidate.errorCode) !== null && _a !== void 0 ? _a : candidate.code;
49220
+ return (code === hdShared.HardwareErrorCode.BleTimeoutError ||
49221
+ code === 'response-timeout' ||
49222
+ /(?:BLE|Lowlevel|Protocol V2) response timeout/i.test((_b = candidate.message) !== null && _b !== void 0 ? _b : ''));
49223
+ }
49224
+ function getProtocolV2FileChunkLimit() {
49225
+ const env = DataManager.getSettings('env');
49226
+ return env && DataManager.isBleConnect(env)
49227
+ ? hdTransport.PROTOCOL_V2_BLE_FILE_CHUNK_SIZE
49228
+ : hdTransport.PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE;
49229
+ }
49230
+ function dataToUint8Array(data) {
49231
+ return __awaiter(this, void 0, void 0, function* () {
49232
+ if (typeof data === 'string')
49233
+ return new TextEncoder().encode(data);
49234
+ if (data instanceof ArrayBuffer)
49235
+ return new Uint8Array(data);
49236
+ if (ArrayBuffer.isView(data)) {
49237
+ return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
49238
+ }
49239
+ if (typeof Blob !== 'undefined' && data instanceof Blob) {
49240
+ return new Uint8Array(yield data.arrayBuffer());
49241
+ }
49242
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Unsupported FilesystemFileWrite data');
49243
+ });
49244
+ }
49245
+ function normalizeChunkSize(value, maxChunkSize) {
49246
+ const numeric = Number(value);
49247
+ if (!Number.isFinite(numeric) || numeric <= 0)
49248
+ return maxChunkSize;
49249
+ return Math.min(Math.max(Math.floor(numeric), MIN_FILE_CHUNK_SIZE), maxChunkSize);
49250
+ }
49251
+ function getDeviceTransferProgress(before, after, total) {
49252
+ if (!Number.isFinite(total) || total <= 0)
49253
+ return 100;
49254
+ if (before <= 0 && after < total)
49255
+ return 0;
49256
+ if (after >= total)
49257
+ return 100;
49258
+ return Math.min(Math.max(Math.ceil((after / total) * 100), 1), 99);
49259
+ }
49260
+ function getConfirmedProgress(processed, total, written, length) {
49261
+ if (Number.isFinite(processed) && Number.isFinite(total) && total > 0) {
49262
+ if (processed >= total)
49263
+ return 100;
49264
+ return Math.min(Math.max(Math.floor((processed / total) * 100), 0), 99);
49265
+ }
49266
+ if (length > 0)
49267
+ return written >= length ? 100 : Math.floor((written / length) * 100);
49268
+ return 100;
49269
+ }
49270
+ function writeProtocolV2File(options) {
49271
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
49272
+ return __awaiter(this, void 0, void 0, function* () {
49273
+ (_a = options.throwIfAborted) === null || _a === void 0 ? void 0 : _a.call(options);
49274
+ const data = yield dataToUint8Array(options.data);
49275
+ const dataLength = data.byteLength;
49276
+ const startOffset = Number.isFinite(options.offset) && Number(options.offset) > 0 ? Number(options.offset) : 0;
49277
+ const totalSize = Number.isFinite(options.totalSize) && Number(options.totalSize) > 0
49278
+ ? Number(options.totalSize)
49279
+ : startOffset + dataLength;
49280
+ if (totalSize < startOffset + dataLength) {
49281
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `FilesystemFileWrite totalSize ${totalSize} is smaller than offset + data length ${startOffset + dataLength}`);
49282
+ }
49283
+ const chunkSize = normalizeChunkSize((_b = options.chunkSize) !== null && _b !== void 0 ? _b : options.chunkLen, getProtocolV2FileChunkLimit());
49284
+ let written = 0;
49285
+ let chunks = 0;
49286
+ let lastMessage;
49287
+ const startTime = Date.now();
49288
+ let rateWindowStartedAt = startTime;
49289
+ let rateWindowStartedBytes = 0;
49290
+ let rateBytesPerSecond;
49291
+ let lastConfirmedAt = startTime;
49292
+ let logWindowStartedAt = startTime;
49293
+ let logWindowStartedBytes = 0;
49294
+ const transport = getFileTransferTransport();
49295
+ try {
49296
+ while (written < dataLength) {
49297
+ (_c = options.throwIfAborted) === null || _c === void 0 ? void 0 : _c.call(options);
49298
+ const chunk = data.slice(written, Math.min(written + chunkSize, dataLength));
49299
+ const offset = startOffset + written;
49300
+ const progress = (_f = (_d = options.uiPercentage) !== null && _d !== void 0 ? _d : (_e = options.getUiPercentage) === null || _e === void 0 ? void 0 : _e.call(options, {
49301
+ offset,
49302
+ chunkLength: chunk.byteLength,
49303
+ totalSize,
49304
+ })) !== null && _f !== void 0 ? _f : getDeviceTransferProgress(offset, offset + chunk.byteLength, totalSize);
49305
+ const request = {
49306
+ file: { path: options.path, offset, total_size: totalSize, data: chunk },
49307
+ overwrite: chunks === 0 ? (_g = options.overwrite) !== null && _g !== void 0 ? _g : false : false,
49308
+ append: (_h = options.append) !== null && _h !== void 0 ? _h : false,
49309
+ ui_percentage: progress,
49310
+ };
49311
+ const maxChunkRetries = Math.max(Math.floor((_j = options.maxChunkRetries) !== null && _j !== void 0 ? _j : 0), 0);
49312
+ let retryCount = 0;
49313
+ let response;
49314
+ let isWritePending = true;
49315
+ while (isWritePending) {
49316
+ try {
49317
+ const callOptions = options.writeWithResponse === undefined
49318
+ ? { timeoutMs: options.timeoutMs }
49319
+ : Object.assign(Object.assign({}, (options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs })), { writeWithResponse: options.writeWithResponse });
49320
+ response = yield options.commands.typedCall('FilesystemFileWrite', 'FilesystemFile', request, callOptions);
49321
+ isWritePending = false;
49322
+ }
49323
+ catch (error) {
49324
+ if (retryCount >= maxChunkRetries || !isProtocolV2ResponseTimeout(error))
49325
+ throw error;
49326
+ retryCount += 1;
49327
+ (_k = options.throwIfAborted) === null || _k === void 0 ? void 0 : _k.call(options);
49328
+ }
49329
+ }
49330
+ if (!response) {
49331
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'FilesystemFileWrite completed without a response');
49332
+ }
49333
+ const responseType = response.type;
49334
+ if (responseType && responseType !== 'FilesystemFile') {
49335
+ const responseError = (_l = response.message) === null || _l === void 0 ? void 0 : _l.error;
49336
+ if (typeof responseError === 'string' && responseError.includes(SESSION_ERROR)) {
49337
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, SESSION_ERROR);
49338
+ }
49339
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `FilesystemFileWrite received unexpected response ${responseType}`);
49340
+ }
49341
+ (_m = options.throwIfAborted) === null || _m === void 0 ? void 0 : _m.call(options);
49342
+ lastMessage = response.message;
49343
+ const rawProcessedByte = (_o = response.message) === null || _o === void 0 ? void 0 : _o.processed_byte;
49344
+ const processedByte = Number(rawProcessedByte);
49345
+ if (rawProcessedByte !== undefined &&
49346
+ (!Number.isFinite(processedByte) ||
49347
+ processedByte <= offset ||
49348
+ processedByte > offset + chunk.byteLength)) {
49349
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `FilesystemFileWrite invalid processed_byte ${processedByte}`);
49350
+ }
49351
+ written =
49352
+ rawProcessedByte === undefined ? written + chunk.byteLength : processedByte - startOffset;
49353
+ chunks += 1;
49354
+ const now = Date.now();
49355
+ lastConfirmedAt = now;
49356
+ const elapsedMs = now - startTime;
49357
+ const transferredBytes = Math.min(written, dataLength);
49358
+ const rateWindowElapsedMs = now - rateWindowStartedAt;
49359
+ if (rateWindowElapsedMs >= FILE_TRANSFER_RATE_WINDOW_MS) {
49360
+ const rateWindowBytes = Math.max(transferredBytes - rateWindowStartedBytes, 0);
49361
+ rateBytesPerSecond = Math.round((rateWindowBytes / rateWindowElapsedMs) * 1000);
49362
+ rateWindowStartedAt = now;
49363
+ rateWindowStartedBytes = transferredBytes;
49364
+ }
49365
+ else if (rateBytesPerSecond === undefined && elapsedMs > 0) {
49366
+ rateBytesPerSecond = Math.round((transferredBytes / elapsedMs) * 1000);
49367
+ }
49368
+ (_p = options.onProgress) === null || _p === void 0 ? void 0 : _p.call(options, {
49369
+ progress: getConfirmedProgress(startOffset + written, totalSize, written, dataLength),
49370
+ transferredBytes,
49371
+ totalBytes: dataLength,
49372
+ rateBytesPerSecond,
49373
+ elapsedMs,
49374
+ });
49375
+ const logWindowElapsedMs = now - logWindowStartedAt;
49376
+ if (logWindowElapsedMs >= FILE_TRANSFER_LOG_INTERVAL_MS && transferredBytes < dataLength) {
49377
+ const logWindowBytes = Math.max(transferredBytes - logWindowStartedBytes, 0);
49378
+ logFileTransferMetrics({
49379
+ transport,
49380
+ status: 'progress',
49381
+ transferredBytes,
49382
+ totalBytes: dataLength,
49383
+ elapsedMs,
49384
+ rateBytesPerSecond: getAverageFileTransferRate(logWindowBytes, logWindowElapsedMs),
49385
+ });
49386
+ logWindowStartedAt = now;
49387
+ logWindowStartedBytes = transferredBytes;
49388
+ }
49389
+ if (options.paceMs && options.paceMs > 0) {
49390
+ yield new Promise(resolve => {
49391
+ setTimeout(resolve, options.paceMs);
49392
+ });
49393
+ }
49394
+ }
49395
+ }
49396
+ catch (error) {
49397
+ const now = Date.now();
49398
+ const elapsedMs = Math.max(now - startTime, 0);
49399
+ const logWindowElapsedMs = Math.max(now - logWindowStartedAt, 0);
49400
+ const logWindowBytes = Math.max(written - logWindowStartedBytes, 0);
49401
+ logFileTransferMetrics({
49402
+ transport,
49403
+ status: 'failed',
49404
+ transferredBytes: written,
49405
+ totalBytes: dataLength,
49406
+ elapsedMs,
49407
+ rateBytesPerSecond: getAverageFileTransferRate(logWindowBytes, logWindowElapsedMs),
49408
+ });
49409
+ throw error;
49410
+ }
49411
+ const elapsedMs = Math.max(lastConfirmedAt - startTime, 0);
49412
+ const logWindowElapsedMs = Math.max(lastConfirmedAt - logWindowStartedAt, 0);
49413
+ const logWindowBytes = Math.max(written - logWindowStartedBytes, 0);
49414
+ logFileTransferMetrics({
49415
+ transport,
49416
+ status: 'completed',
49417
+ transferredBytes: written,
49418
+ totalBytes: dataLength,
49419
+ elapsedMs,
49420
+ rateBytesPerSecond: getAverageFileTransferRate(logWindowBytes, logWindowElapsedMs),
49421
+ });
49422
+ return Object.assign(Object.assign({}, lastMessage), { path: options.path, offset: startOffset, total_size: totalSize, processed_byte: startOffset + written, chunks });
49423
+ });
49424
+ }
49425
+
49357
49426
  const ProtocolV2FirmwareTargetType = {
49358
49427
  FW_MGMT_TARGET_INVALID: 0,
49359
49428
  FW_MGMT_TARGET_CRATE: 1,
@@ -49368,99 +49437,6 @@ const ProtocolV2FirmwareTargetType = {
49368
49437
  FW_MGMT_TARGET_SE04: 10,
49369
49438
  };
49370
49439
 
49371
- const FACTORY_SERIAL_MAX_UTF8_BYTES = 24;
49372
- const FACTORY_CERTIFICATE_MAX_BYTES = 512;
49373
- const FACTORY_PRIVATE_KEY_BYTES = 32;
49374
- const FACTORY_CHALLENGE_DIGEST_BYTES = 32;
49375
- const getUtf8ByteLength = (value) => Array.from(value).reduce((length, character) => {
49376
- var _a;
49377
- const codePoint = (_a = character.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
49378
- if (codePoint <= 0x7f)
49379
- return length + 1;
49380
- if (codePoint <= 0x7ff)
49381
- return length + 2;
49382
- if (codePoint <= 0xffff)
49383
- return length + 3;
49384
- return length + 4;
49385
- }, 0);
49386
- const validateRequiredBoolean = (value, name) => {
49387
- if (typeof value !== 'boolean') {
49388
- throw invalidParameter$1(`Parameter [${name}] is required and must be a boolean.`);
49389
- }
49390
- return value;
49391
- };
49392
- const validateIntegerInRange = (value, name, minimum, maximum) => {
49393
- if (typeof value !== 'number' ||
49394
- !Number.isSafeInteger(value) ||
49395
- value < minimum ||
49396
- value > maximum) {
49397
- throw invalidParameter$1(`Parameter [${name}] must be an integer between ${minimum} and ${maximum}.`);
49398
- }
49399
- return value;
49400
- };
49401
- const validateHexBytes = (value, name, options) => {
49402
- const hex = validateNonEmptyString(value, name).trim();
49403
- if (!/^(?:[0-9a-fA-F]{2})+$/.test(hex)) {
49404
- throw invalidParameter$1(`Parameter [${name}] must be an even-length hexadecimal string.`);
49405
- }
49406
- const byteLength = hex.length / 2;
49407
- if (options.exactBytes !== undefined && byteLength !== options.exactBytes) {
49408
- throw invalidParameter$1(`Parameter [${name}] must contain exactly ${options.exactBytes} bytes.`);
49409
- }
49410
- if (options.maxBytes !== undefined && byteLength > options.maxBytes) {
49411
- throw invalidParameter$1(`Parameter [${name}] must not exceed ${options.maxBytes} bytes.`);
49412
- }
49413
- return hex;
49414
- };
49415
- function validateDeviceFactoryInfoSetParams(payload) {
49416
- const serialNumber = validateNonEmptyString(payload.serial_number, 'serial_number').trim();
49417
- if (getUtf8ByteLength(serialNumber) > FACTORY_SERIAL_MAX_UTF8_BYTES) {
49418
- throw invalidParameter$1(`Parameter [serial_number] must not exceed ${FACTORY_SERIAL_MAX_UTF8_BYTES} UTF-8 bytes.`);
49419
- }
49420
- const time = payload.manufacture_time;
49421
- if (!time || typeof time !== 'object') {
49422
- throw invalidParameter$1('Parameter [manufacture_time] is required.');
49423
- }
49424
- const manufactureTime = {
49425
- year: validateIntegerInRange(time.year, 'manufacture_time.year', 2000, 9999),
49426
- month: validateIntegerInRange(time.month, 'manufacture_time.month', 1, 12),
49427
- day: validateIntegerInRange(time.day, 'manufacture_time.day', 1, 31),
49428
- hour: validateIntegerInRange(time.hour, 'manufacture_time.hour', 0, 23),
49429
- minute: validateIntegerInRange(time.minute, 'manufacture_time.minute', 0, 59),
49430
- second: validateIntegerInRange(time.second, 'manufacture_time.second', 0, 59),
49431
- };
49432
- const normalizedDate = new Date(Date.UTC(manufactureTime.year, manufactureTime.month - 1, manufactureTime.day, manufactureTime.hour, manufactureTime.minute, manufactureTime.second));
49433
- if (normalizedDate.getUTCFullYear() !== manufactureTime.year ||
49434
- normalizedDate.getUTCMonth() + 1 !== manufactureTime.month ||
49435
- normalizedDate.getUTCDate() !== manufactureTime.day) {
49436
- throw invalidParameter$1('Parameter [manufacture_time] must be a valid calendar date.');
49437
- }
49438
- return {
49439
- version: validateIntegerInRange(payload.version, 'version', 0, 255),
49440
- serial_number: serialNumber,
49441
- burn_in_completed: validateRequiredBoolean(payload.burn_in_completed, 'burn_in_completed'),
49442
- factory_test_completed: validateRequiredBoolean(payload.factory_test_completed, 'factory_test_completed'),
49443
- manufacture_time: manufactureTime,
49444
- };
49445
- }
49446
- function validateDeviceFactoryCertificateWriteParams(payload) {
49447
- return Object.assign({ certificate: validateHexBytes(payload.certificate, 'certificate', {
49448
- maxBytes: FACTORY_CERTIFICATE_MAX_BYTES,
49449
- }) }, (payload.privateKey === undefined
49450
- ? {}
49451
- : {
49452
- privateKey: validateHexBytes(payload.privateKey, 'privateKey', {
49453
- exactBytes: FACTORY_PRIVATE_KEY_BYTES,
49454
- }),
49455
- }));
49456
- }
49457
- function validateDeviceFactoryChallengeSignParams(payload) {
49458
- return {
49459
- digest: validateHexBytes(payload.digest, 'digest', {
49460
- exactBytes: FACTORY_CHALLENGE_DIGEST_BYTES,
49461
- }),
49462
- };
49463
- }
49464
49440
  const DEVICE_REBOOT_TYPES = {
49465
49441
  Normal: hdTransport.DeviceRebootType.Normal,
49466
49442
  normal: hdTransport.DeviceRebootType.Normal,
@@ -49544,7 +49520,6 @@ const INSTALLABLE_FIRMWARE_TARGET_IDS = new Set([
49544
49520
  new Map(Object.entries(ProtocolV2FirmwareTargetType).flatMap(([key, value]) => INSTALLABLE_FIRMWARE_TARGET_IDS.has(value) ? [[key, value]] : []));
49545
49521
 
49546
49522
  const Log$5 = getLogger(exports.LoggerNames.Method);
49547
- const SESSION_ERROR = 'session not found';
49548
49523
  const PROTOCOL_V2_BOOTLOADER_RECONNECT_TIMEOUT = 90 * 1000;
49549
49524
  const PROTOCOL_V2_FINAL_RECONNECT_TIMEOUT = 3 * 60 * 1000;
49550
49525
  const PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT = 5 * 1000;
@@ -50255,14 +50230,15 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
50255
50230
  }
50256
50231
  if (this.isProtocolV2BootloaderMode()) {
50257
50232
  Log$5.debug('Protocol V2 device is already in bootloader mode, skip reboot');
50233
+ this.postTipMessage(exports.FirmwareUpdateTipMessage.GoToBootloaderSuccess);
50258
50234
  return false;
50259
50235
  }
50260
50236
  try {
50261
50237
  this.postTipMessage(exports.FirmwareUpdateTipMessage.AutoRebootToBootloader);
50262
50238
  yield this.protocolV2Reboot(hdTransport.DeviceRebootType.Bootloader);
50263
- this.postTipMessage(exports.FirmwareUpdateTipMessage.GoToBootloaderSuccess);
50264
50239
  yield hdShared.wait(1000);
50265
50240
  yield this.waitForProtocolV2BootloaderMode();
50241
+ this.postTipMessage(exports.FirmwareUpdateTipMessage.GoToBootloaderSuccess);
50266
50242
  return true;
50267
50243
  }
50268
50244
  catch (error) {
@@ -50718,29 +50694,43 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
50718
50694
  protocolV2WriteWholeFile({ payload, filePath, processedSize, totalSize, onTransferredBytes, }) {
50719
50695
  return __awaiter(this, void 0, void 0, function* () {
50720
50696
  const chunkSize = this.getProtocolV2FirmwareChunkSize();
50721
- let offset = 0;
50722
50697
  const getUploadProgress = (fileOffset) => {
50723
50698
  if (totalSize !== undefined && processedSize !== undefined) {
50724
50699
  return Math.min(Math.ceil(((processedSize + fileOffset) / totalSize) * 100), 99);
50725
50700
  }
50726
50701
  return Math.min(Math.ceil((fileOffset / payload.byteLength) * 100), 99);
50727
50702
  };
50728
- while (offset < payload.byteLength) {
50729
- const chunkEnd = Math.min(offset + chunkSize, payload.byteLength);
50730
- const chunkLength = chunkEnd - offset;
50731
- const chunk = payload.slice(offset, chunkEnd);
50732
- const overwrite = offset === 0;
50733
- const progress = getProtocolV2DeviceTransferProgress((processedSize !== null && processedSize !== void 0 ? processedSize : 0) + offset, (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + chunkEnd, totalSize !== null && totalSize !== void 0 ? totalSize : payload.byteLength);
50734
- const writeRes = yield this.fileWriteChunk(filePath, payload.byteLength, offset, chunk, overwrite, progress);
50735
- const rawProcessedByte = writeRes.message.processed_byte;
50736
- const processedByte = Number(rawProcessedByte);
50737
- const nextOffset = rawProcessedByte === undefined ? offset + chunkLength : processedByte;
50738
- if (!Number.isFinite(nextOffset) || nextOffset <= offset || nextOffset > chunkEnd) {
50739
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, `invalid processed_byte ${writeRes.message.processed_byte} for offset ${offset}`);
50703
+ try {
50704
+ yield writeProtocolV2File({
50705
+ commands: this.device.getCommands(),
50706
+ path: filePath,
50707
+ data: payload,
50708
+ totalSize: payload.byteLength,
50709
+ chunkSize,
50710
+ overwrite: true,
50711
+ append: false,
50712
+ writeWithResponse: true,
50713
+ maxChunkRetries: 0,
50714
+ getUiPercentage: ({ offset, chunkLength }) => getProtocolV2DeviceTransferProgress((processedSize !== null && processedSize !== void 0 ? processedSize : 0) + offset, (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + offset + chunkLength, totalSize !== null && totalSize !== void 0 ? totalSize : payload.byteLength),
50715
+ onProgress: progress => {
50716
+ const transferredBytes = (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + progress.transferredBytes;
50717
+ onTransferredBytes === null || onTransferredBytes === void 0 ? void 0 : onTransferredBytes(transferredBytes);
50718
+ this.postProgressMessage(getUploadProgress(progress.transferredBytes), 'transferData', {
50719
+ transferredBytes,
50720
+ totalBytes: totalSize !== null && totalSize !== void 0 ? totalSize : payload.byteLength,
50721
+ rateBytesPerSecond: progress.rateBytesPerSecond,
50722
+ elapsedMs: progress.elapsedMs,
50723
+ });
50724
+ },
50725
+ });
50726
+ }
50727
+ catch (error) {
50728
+ if (error instanceof hdShared.HardwareError &&
50729
+ error.errorCode === hdShared.HardwareErrorCode.RuntimeError &&
50730
+ error.message.includes('FilesystemFileWrite')) {
50731
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, error.message);
50740
50732
  }
50741
- offset = nextOffset;
50742
- onTransferredBytes === null || onTransferredBytes === void 0 ? void 0 : onTransferredBytes((processedSize !== null && processedSize !== void 0 ? processedSize : 0) + offset);
50743
- this.postProgressMessage(getUploadProgress(offset), 'transferData');
50733
+ throw error;
50744
50734
  }
50745
50735
  return totalSize !== undefined ? (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + payload.byteLength : 0;
50746
50736
  });
@@ -50756,32 +50746,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
50756
50746
  }
50757
50747
  return env !== null && env !== void 0 ? env : 'unknown';
50758
50748
  }
50759
- fileWriteChunk(filePath, totalFileSize, offset, chunk, overwrite, progress) {
50760
- var _a;
50761
- return __awaiter(this, void 0, void 0, function* () {
50762
- const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
50763
- const writeRes = yield typedCall('FilesystemFileWrite', 'FilesystemFile', {
50764
- file: {
50765
- path: filePath,
50766
- offset,
50767
- total_size: totalFileSize,
50768
- data: chunk,
50769
- },
50770
- overwrite,
50771
- append: false,
50772
- ui_percentage: progress !== null && progress !== void 0 ? progress : undefined,
50773
- }, { writeWithResponse: true });
50774
- if (writeRes.type !== 'FilesystemFile') {
50775
- if (writeRes.type === 'CallMethodError') {
50776
- if (((_a = writeRes.message.error) !== null && _a !== void 0 ? _a : '').indexOf(SESSION_ERROR) > -1) {
50777
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, SESSION_ERROR);
50778
- }
50779
- }
50780
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, 'transfer data error');
50781
- }
50782
- return writeRes;
50783
- });
50784
- }
50785
50749
  recoverProtocolV2FileTransfer() {
50786
50750
  return __awaiter(this, void 0, void 0, function* () {
50787
50751
  const env = DataManager.getSettings('env');
@@ -50939,215 +50903,6 @@ class DeviceGetOnboardingStatus extends BaseMethod {
50939
50903
  }
50940
50904
  }
50941
50905
 
50942
- class DeviceFactoryInfoGet extends BaseMethod {
50943
- getSupportedProtocols() {
50944
- return ['V2'];
50945
- }
50946
- init() {
50947
- this.skipForceUpdateCheck = true;
50948
- this.useDevicePassphraseState = false;
50949
- this.unlockPolicy = 'none';
50950
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
50951
- this.params = undefined;
50952
- }
50953
- run() {
50954
- return __awaiter(this, void 0, void 0, function* () {
50955
- const res = yield this.device.commands.typedCall('DeviceFactoryInfoGet', 'DeviceFactoryInfo', {});
50956
- return Promise.resolve(res.message);
50957
- });
50958
- }
50959
- }
50960
-
50961
- class DeviceFactoryCertificateRead extends BaseMethod {
50962
- getSupportedProtocols() {
50963
- return ['V2'];
50964
- }
50965
- init() {
50966
- this.skipForceUpdateCheck = true;
50967
- this.useDevicePassphraseState = false;
50968
- this.unlockPolicy = 'none';
50969
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
50970
- this.params = undefined;
50971
- }
50972
- run() {
50973
- return __awaiter(this, void 0, void 0, function* () {
50974
- const res = yield this.device.commands.typedCall('DeviceCertificateRead', 'DeviceCertificate', {});
50975
- return res.message;
50976
- });
50977
- }
50978
- }
50979
-
50980
- class DeviceFactoryChallengeSign extends BaseMethod {
50981
- getSupportedProtocols() {
50982
- return ['V2'];
50983
- }
50984
- init() {
50985
- this.skipForceUpdateCheck = true;
50986
- this.useDevicePassphraseState = false;
50987
- this.unlockPolicy = 'none';
50988
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
50989
- this.params = validateDeviceFactoryChallengeSignParams(this.payload);
50990
- }
50991
- run() {
50992
- return __awaiter(this, void 0, void 0, function* () {
50993
- const res = yield this.device.commands.typedCall('DeviceCertificateSign', 'DeviceCertificateSignature', { data: this.params.digest });
50994
- return res.message;
50995
- });
50996
- }
50997
- }
50998
-
50999
- const MIN_FILE_CHUNK_SIZE = 64;
51000
- const FILE_TRANSFER_RATE_WINDOW_MS = 1000;
51001
- function isProtocolV2ResponseTimeout(error) {
51002
- var _a, _b;
51003
- if (!error || typeof error !== 'object')
51004
- return false;
51005
- const candidate = error;
51006
- const code = (_a = candidate.errorCode) !== null && _a !== void 0 ? _a : candidate.code;
51007
- return (code === hdShared.HardwareErrorCode.BleTimeoutError ||
51008
- code === 'response-timeout' ||
51009
- /(?:BLE|Lowlevel|Protocol V2) response timeout/i.test((_b = candidate.message) !== null && _b !== void 0 ? _b : ''));
51010
- }
51011
- function getProtocolV2FileChunkLimit() {
51012
- const env = DataManager.getSettings('env');
51013
- return env && DataManager.isBleConnect(env)
51014
- ? hdTransport.PROTOCOL_V2_BLE_FILE_CHUNK_SIZE
51015
- : hdTransport.PROTOCOL_V2_WEBUSB_FILE_CHUNK_SIZE;
51016
- }
51017
- function dataToUint8Array(data) {
51018
- return __awaiter(this, void 0, void 0, function* () {
51019
- if (typeof data === 'string')
51020
- return new TextEncoder().encode(data);
51021
- if (data instanceof ArrayBuffer)
51022
- return new Uint8Array(data);
51023
- if (ArrayBuffer.isView(data)) {
51024
- return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
51025
- }
51026
- if (typeof Blob !== 'undefined' && data instanceof Blob) {
51027
- return new Uint8Array(yield data.arrayBuffer());
51028
- }
51029
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Unsupported FilesystemFileWrite data');
51030
- });
51031
- }
51032
- function normalizeChunkSize(value, maxChunkSize) {
51033
- const numeric = Number(value);
51034
- if (!Number.isFinite(numeric) || numeric <= 0)
51035
- return maxChunkSize;
51036
- return Math.min(Math.max(Math.floor(numeric), MIN_FILE_CHUNK_SIZE), maxChunkSize);
51037
- }
51038
- function getDeviceTransferProgress(before, after, total) {
51039
- if (!Number.isFinite(total) || total <= 0)
51040
- return 100;
51041
- if (before <= 0 && after < total)
51042
- return 0;
51043
- if (after >= total)
51044
- return 100;
51045
- return Math.min(Math.max(Math.ceil((after / total) * 100), 1), 99);
51046
- }
51047
- function getConfirmedProgress(processed, total, written, length) {
51048
- if (Number.isFinite(processed) && Number.isFinite(total) && total > 0) {
51049
- if (processed >= total)
51050
- return 100;
51051
- return Math.min(Math.max(Math.floor((processed / total) * 100), 0), 99);
51052
- }
51053
- if (length > 0)
51054
- return written >= length ? 100 : Math.floor((written / length) * 100);
51055
- return 100;
51056
- }
51057
- function writeProtocolV2File(options) {
51058
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
51059
- return __awaiter(this, void 0, void 0, function* () {
51060
- (_a = options.throwIfAborted) === null || _a === void 0 ? void 0 : _a.call(options);
51061
- const data = yield dataToUint8Array(options.data);
51062
- const dataLength = data.byteLength;
51063
- const startOffset = Number.isFinite(options.offset) && Number(options.offset) > 0 ? Number(options.offset) : 0;
51064
- const totalSize = Number.isFinite(options.totalSize) && Number(options.totalSize) > 0
51065
- ? Number(options.totalSize)
51066
- : startOffset + dataLength;
51067
- if (totalSize < startOffset + dataLength) {
51068
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `FilesystemFileWrite totalSize ${totalSize} is smaller than offset + data length ${startOffset + dataLength}`);
51069
- }
51070
- const chunkSize = normalizeChunkSize((_b = options.chunkSize) !== null && _b !== void 0 ? _b : options.chunkLen, getProtocolV2FileChunkLimit());
51071
- let written = 0;
51072
- let chunks = 0;
51073
- let lastMessage;
51074
- const startTime = Date.now();
51075
- let rateWindowStartedAt = startTime;
51076
- let rateWindowStartedBytes = 0;
51077
- let rateBytesPerSecond;
51078
- while (written < dataLength) {
51079
- (_c = options.throwIfAborted) === null || _c === void 0 ? void 0 : _c.call(options);
51080
- const chunk = data.slice(written, Math.min(written + chunkSize, dataLength));
51081
- const offset = startOffset + written;
51082
- const progress = (_d = options.uiPercentage) !== null && _d !== void 0 ? _d : getDeviceTransferProgress(offset, offset + chunk.byteLength, totalSize);
51083
- const request = {
51084
- file: { path: options.path, offset, total_size: totalSize, data: chunk },
51085
- overwrite: chunks === 0 ? (_e = options.overwrite) !== null && _e !== void 0 ? _e : false : false,
51086
- append: (_f = options.append) !== null && _f !== void 0 ? _f : false,
51087
- ui_percentage: progress,
51088
- };
51089
- const maxChunkRetries = Math.max(Math.floor((_g = options.maxChunkRetries) !== null && _g !== void 0 ? _g : 0), 0);
51090
- let retryCount = 0;
51091
- let response;
51092
- let isWritePending = true;
51093
- while (isWritePending) {
51094
- try {
51095
- response = yield options.commands.typedCall('FilesystemFileWrite', 'FilesystemFile', request, { timeoutMs: options.timeoutMs });
51096
- isWritePending = false;
51097
- }
51098
- catch (error) {
51099
- if (retryCount >= maxChunkRetries || !isProtocolV2ResponseTimeout(error))
51100
- throw error;
51101
- retryCount += 1;
51102
- (_h = options.throwIfAborted) === null || _h === void 0 ? void 0 : _h.call(options);
51103
- }
51104
- }
51105
- if (!response) {
51106
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'FilesystemFileWrite completed without a response');
51107
- }
51108
- (_j = options.throwIfAborted) === null || _j === void 0 ? void 0 : _j.call(options);
51109
- lastMessage = response.message;
51110
- const rawProcessedByte = (_k = response.message) === null || _k === void 0 ? void 0 : _k.processed_byte;
51111
- const processedByte = Number(rawProcessedByte);
51112
- if (rawProcessedByte !== undefined &&
51113
- (!Number.isFinite(processedByte) ||
51114
- processedByte <= offset ||
51115
- processedByte > offset + chunk.byteLength)) {
51116
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `FilesystemFileWrite invalid processed_byte ${processedByte}`);
51117
- }
51118
- written =
51119
- rawProcessedByte === undefined ? written + chunk.byteLength : processedByte - startOffset;
51120
- chunks += 1;
51121
- const now = Date.now();
51122
- const elapsedMs = now - startTime;
51123
- const transferredBytes = Math.min(written, dataLength);
51124
- const rateWindowElapsedMs = now - rateWindowStartedAt;
51125
- if (rateWindowElapsedMs >= FILE_TRANSFER_RATE_WINDOW_MS) {
51126
- const rateWindowBytes = Math.max(transferredBytes - rateWindowStartedBytes, 0);
51127
- rateBytesPerSecond = Math.round((rateWindowBytes / rateWindowElapsedMs) * 1000);
51128
- rateWindowStartedAt = now;
51129
- rateWindowStartedBytes = transferredBytes;
51130
- }
51131
- else if (rateBytesPerSecond === undefined && elapsedMs > 0) {
51132
- rateBytesPerSecond = Math.round((transferredBytes / elapsedMs) * 1000);
51133
- }
51134
- (_l = options.onProgress) === null || _l === void 0 ? void 0 : _l.call(options, {
51135
- progress: getConfirmedProgress(startOffset + written, totalSize, written, dataLength),
51136
- transferredBytes,
51137
- totalBytes: dataLength,
51138
- rateBytesPerSecond,
51139
- elapsedMs,
51140
- });
51141
- if (options.paceMs && options.paceMs > 0) {
51142
- yield new Promise(resolve => {
51143
- setTimeout(resolve, options.paceMs);
51144
- });
51145
- }
51146
- }
51147
- return Object.assign(Object.assign({}, lastMessage), { path: options.path, offset: startOffset, total_size: totalSize, processed_byte: startOffset + written, chunks });
51148
- });
51149
- }
51150
-
51151
50906
  const WALLPAPER_DIRECTORY = 'vol1:/wallpapers';
51152
50907
  const SAFE_FILE_NAME = /^[A-Za-z0-9_-]+(?:\.bin)?$/;
51153
50908
  function normalizeFileName(fileName, data) {
@@ -51961,9 +51716,10 @@ class AllNetworkGetAddressBase extends BaseMethod {
51961
51716
  }
51962
51717
  }
51963
51718
  const useEmptyPassphrase = this.payload.useEmptyPassphrase === true;
51719
+ const deriveCardano = method.name.startsWith('cardano');
51964
51720
  const shouldResumeWalletSession = useEmptyPassphrase || !!this.payload.passphraseState;
51965
51721
  if (this.device.isProtocolV2() && shouldResumeWalletSession) {
51966
- const passphraseStateSafety = yield this.device.checkPassphraseStateSafety(this.payload.passphraseState, useEmptyPassphrase, this.payload.skipPassphraseCheck);
51722
+ const passphraseStateSafety = yield this.device.checkPassphraseStateSafety(this.payload.passphraseState, useEmptyPassphrase, this.payload.skipPassphraseCheck, deriveCardano);
51967
51723
  if (!passphraseStateSafety) {
51968
51724
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceCheckPassphraseStateError);
51969
51725
  }
@@ -53644,7 +53400,7 @@ class ConfluxSignTransaction extends BaseMethod {
53644
53400
  }
53645
53401
  }
53646
53402
 
53647
- function getAddressLegacyV1$1 ({ typedCall, param, }) {
53403
+ function getAddressLegacyV1 ({ typedCall, param, }) {
53648
53404
  return __awaiter(this, void 0, void 0, function* () {
53649
53405
  const message = {
53650
53406
  address_n: param.address_n,
@@ -53663,7 +53419,7 @@ function getAddress ({ typedCall, param, }) {
53663
53419
 
53664
53420
  const shouldUseLegacyV1EvmMessages = (device) => !device.isProtocolV2() && TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema';
53665
53421
 
53666
- class EvmGetAddress$1 extends BaseMethod {
53422
+ class EvmGetAddress extends BaseMethod {
53667
53423
  constructor() {
53668
53424
  super(...arguments);
53669
53425
  this.hasBundle = false;
@@ -53698,7 +53454,7 @@ class EvmGetAddress$1 extends BaseMethod {
53698
53454
  getEvmAddress(param) {
53699
53455
  return __awaiter(this, void 0, void 0, function* () {
53700
53456
  if (shouldUseLegacyV1EvmMessages(this.device)) {
53701
- return getAddressLegacyV1$1({
53457
+ return getAddressLegacyV1({
53702
53458
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53703
53459
  param,
53704
53460
  });
@@ -53740,7 +53496,7 @@ function getPublicKey ({ typedCall, param, }) {
53740
53496
  });
53741
53497
  }
53742
53498
 
53743
- function getPublicKeyLegacyV1$1 ({ typedCall, param, }) {
53499
+ function getPublicKeyLegacyV1 ({ typedCall, param, }) {
53744
53500
  return __awaiter(this, void 0, void 0, function* () {
53745
53501
  const message = {
53746
53502
  address_n: param.address_n,
@@ -53751,7 +53507,7 @@ function getPublicKeyLegacyV1$1 ({ typedCall, param, }) {
53751
53507
  });
53752
53508
  }
53753
53509
 
53754
- class EVMGetPublicKey$1 extends BaseMethod {
53510
+ class EVMGetPublicKey extends BaseMethod {
53755
53511
  constructor() {
53756
53512
  super(...arguments);
53757
53513
  this.hasBundle = false;
@@ -53789,7 +53545,7 @@ class EVMGetPublicKey$1 extends BaseMethod {
53789
53545
  }
53790
53546
  getEvmPublicKey(param) {
53791
53547
  if (shouldUseLegacyV1EvmMessages(this.device)) {
53792
- return getPublicKeyLegacyV1$1({
53548
+ return getPublicKeyLegacyV1({
53793
53549
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53794
53550
  param,
53795
53551
  });
@@ -53841,7 +53597,7 @@ function signMessage ({ typedCall, params, }) {
53841
53597
  });
53842
53598
  }
53843
53599
 
53844
- function signMessageLegacyV1$1 ({ typedCall, params, }) {
53600
+ function signMessageLegacyV1 ({ typedCall, params, }) {
53845
53601
  return __awaiter(this, void 0, void 0, function* () {
53846
53602
  const message = {
53847
53603
  address_n: params.address_n,
@@ -53853,7 +53609,7 @@ function signMessageLegacyV1$1 ({ typedCall, params, }) {
53853
53609
  });
53854
53610
  }
53855
53611
 
53856
- class EVMSignMessage$4 extends BaseMethod {
53612
+ class EVMSignMessage$2 extends BaseMethod {
53857
53613
  getSupportedProtocols() {
53858
53614
  return ['V1', 'V2'];
53859
53615
  }
@@ -53878,7 +53634,7 @@ class EVMSignMessage$4 extends BaseMethod {
53878
53634
  run() {
53879
53635
  return __awaiter(this, void 0, void 0, function* () {
53880
53636
  if (shouldUseLegacyV1EvmMessages(this.device)) {
53881
- return signMessageLegacyV1$1({
53637
+ return signMessageLegacyV1({
53882
53638
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53883
53639
  params: this.params,
53884
53640
  });
@@ -54084,7 +53840,7 @@ const evmSignTxEip7702 = ({ typedCall, addressN, tx, supportTrezor, }) => __awai
54084
53840
  supportTrezor,
54085
53841
  });
54086
53842
  });
54087
- const signTransaction$2 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
53843
+ const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
54088
53844
  if (isEIP7702) {
54089
53845
  return evmSignTxEip7702({ typedCall, addressN, tx: tx });
54090
53846
  }
@@ -54093,7 +53849,7 @@ const signTransaction$2 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) =
54093
53849
  : evmSignTx({ typedCall, addressN, tx: tx });
54094
53850
  });
54095
53851
 
54096
- const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
53852
+ const signTransaction = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
54097
53853
  if (isEIP7702) {
54098
53854
  return evmSignTxEip7702({
54099
53855
  typedCall,
@@ -54113,7 +53869,7 @@ const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) =
54113
53869
  return evmSignTx({ typedCall, addressN, tx: tx, supportTrezor: true });
54114
53870
  });
54115
53871
 
54116
- class EVMSignTransaction$1 extends BaseMethod {
53872
+ class EVMSignTransaction extends BaseMethod {
54117
53873
  constructor() {
54118
53874
  super(...arguments);
54119
53875
  this.addressN = [];
@@ -54198,7 +53954,7 @@ class EVMSignTransaction$1 extends BaseMethod {
54198
53954
  if (formattedTx == null)
54199
53955
  throw hdShared.ERRORS.TypedError('Runtime', 'formattedTx is not set');
54200
53956
  if (shouldUseLegacyV1EvmMessages(this.device)) {
54201
- return signTransaction$1({
53957
+ return signTransaction({
54202
53958
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54203
53959
  addressN,
54204
53960
  tx: formattedTx,
@@ -54206,7 +53962,7 @@ class EVMSignTransaction$1 extends BaseMethod {
54206
53962
  isEIP7702,
54207
53963
  });
54208
53964
  }
54209
- return signTransaction$2({
53965
+ return signTransaction$1({
54210
53966
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54211
53967
  addressN,
54212
53968
  tx: formattedTx,
@@ -54217,7 +53973,7 @@ class EVMSignTransaction$1 extends BaseMethod {
54217
53973
  }
54218
53974
  }
54219
53975
 
54220
- const signTypedHash$2 = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
53976
+ const signTypedHash$1 = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
54221
53977
  var _a;
54222
53978
  const deviceType = device.getCurrentDeviceType();
54223
53979
  if (deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro) {
@@ -54236,7 +53992,7 @@ const signTypedHash$2 = ({ typedCall, addressN, device, chainId, domainHash, mes
54236
53992
  return typedCall('EthereumSignTypedHash', 'EthereumTypedDataSignature', message);
54237
53993
  });
54238
53994
 
54239
- const signTypedHash$1 = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
53995
+ const signTypedHash = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
54240
53996
  var _a;
54241
53997
  const deviceType = device.getCurrentDeviceType();
54242
53998
  if (deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro) {
@@ -54254,7 +54010,7 @@ const signTypedHash$1 = ({ typedCall, addressN, device, chainId, domainHash, mes
54254
54010
  });
54255
54011
  });
54256
54012
 
54257
- const signTypedData$2 = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
54013
+ const signTypedData$1 = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
54258
54014
  const { primaryType } = data;
54259
54015
  const message = {
54260
54016
  address_n: addressN,
@@ -54271,7 +54027,7 @@ const signTypedData$2 = ({ typedCall, addressN, data, metamaskV4Compat, chainId,
54271
54027
  return response;
54272
54028
  });
54273
54029
 
54274
- const signTypedData$1 = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
54030
+ const signTypedData = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
54275
54031
  const { primaryType } = data;
54276
54032
  return typedCall('EthereumSignTypedDataOneKey', [
54277
54033
  'EthereumTypedDataStructRequestOneKey',
@@ -54405,7 +54161,7 @@ const MINI_MAX_NAME_LENGTH = 63;
54405
54161
  const MINI_MAX_DYNAMIC_VALUE_BYTES = 1536;
54406
54162
  const MINI_MAX_ARRAY_TYPE_FIELDS = 24;
54407
54163
  const MINI_MAX_ARRAY_ELEMENTS = 24;
54408
- class EVMSignTypedData$1 extends BaseMethod {
54164
+ class EVMSignTypedData extends BaseMethod {
54409
54165
  getSupportedProtocols() {
54410
54166
  return ['V1', 'V2'];
54411
54167
  }
@@ -54560,7 +54316,7 @@ class EVMSignTypedData$1 extends BaseMethod {
54560
54316
  let response;
54561
54317
  if (shouldUseLegacyV1EvmMessages(this.device)) {
54562
54318
  supportTrezor = true;
54563
- response = yield signTypedData$2({
54319
+ response = yield signTypedData$1({
54564
54320
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54565
54321
  addressN,
54566
54322
  data,
@@ -54569,7 +54325,7 @@ class EVMSignTypedData$1 extends BaseMethod {
54569
54325
  });
54570
54326
  }
54571
54327
  else {
54572
- response = yield signTypedData$1({
54328
+ response = yield signTypedData({
54573
54329
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54574
54330
  addressN,
54575
54331
  data,
@@ -54589,7 +54345,7 @@ class EVMSignTypedData$1 extends BaseMethod {
54589
54345
  if (!domainHash)
54590
54346
  throw hdShared.ERRORS.TypedError('Runtime', 'domainHash is required');
54591
54347
  if (shouldUseLegacyV1EvmMessages(this.device)) {
54592
- return signTypedHash$2({
54348
+ return signTypedHash$1({
54593
54349
  typedCall,
54594
54350
  addressN,
54595
54351
  domainHash,
@@ -54598,7 +54354,7 @@ class EVMSignTypedData$1 extends BaseMethod {
54598
54354
  device: this.device,
54599
54355
  });
54600
54356
  }
54601
- return signTypedHash$1({
54357
+ return signTypedHash({
54602
54358
  typedCall,
54603
54359
  addressN,
54604
54360
  domainHash,
@@ -54819,7 +54575,7 @@ class EVMSignTypedData$1 extends BaseMethod {
54819
54575
  }
54820
54576
  }
54821
54577
 
54822
- function verifyMessageLegacyV1$1 ({ typedCall, params, }) {
54578
+ function verifyMessageLegacyV1 ({ typedCall, params, }) {
54823
54579
  return __awaiter(this, void 0, void 0, function* () {
54824
54580
  const message = {
54825
54581
  signature: params.signature,
@@ -54839,7 +54595,7 @@ function verifyMessage ({ typedCall, params, }) {
54839
54595
  });
54840
54596
  }
54841
54597
 
54842
- class EVMSignMessage$3 extends BaseMethod {
54598
+ class EVMSignMessage$1 extends BaseMethod {
54843
54599
  getSupportedProtocols() {
54844
54600
  return ['V1', 'V2'];
54845
54601
  }
@@ -54863,7 +54619,7 @@ class EVMSignMessage$3 extends BaseMethod {
54863
54619
  run() {
54864
54620
  return __awaiter(this, void 0, void 0, function* () {
54865
54621
  if (shouldUseLegacyV1EvmMessages(this.device)) {
54866
- return verifyMessageLegacyV1$1({
54622
+ return verifyMessageLegacyV1({
54867
54623
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54868
54624
  params: this.params,
54869
54625
  });
@@ -55027,7 +54783,7 @@ class StarcoinSignTransaction extends BaseMethod {
55027
54783
  }
55028
54784
  }
55029
54785
 
55030
- class EVMSignMessage$2 extends BaseMethod {
54786
+ class EVMSignMessage extends BaseMethod {
55031
54787
  getSupportedProtocols() {
55032
54788
  return ['V1', 'V2'];
55033
54789
  }
@@ -55054,7 +54810,7 @@ class EVMSignMessage$2 extends BaseMethod {
55054
54810
  }
55055
54811
  }
55056
54812
 
55057
- const MAINNET$1 = 0x68;
54813
+ const MAINNET = 0x68;
55058
54814
  class NEMGetAddress extends BaseMethod {
55059
54815
  constructor() {
55060
54816
  super(...arguments);
@@ -55082,7 +54838,7 @@ class NEMGetAddress extends BaseMethod {
55082
54838
  const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
55083
54839
  this.params.push({
55084
54840
  address_n: addressN,
55085
- network: batch.network || MAINNET$1,
54841
+ network: batch.network || MAINNET,
55086
54842
  show_display: showOnOneKey,
55087
54843
  });
55088
54844
  });
@@ -61182,7 +60938,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
61182
60938
  checkBootloaderRelease: CheckBootloaderRelease,
61183
60939
  checkAllFirmwareRelease: CheckAllFirmwareRelease,
61184
60940
  checkFirmwareTypeAvailable: CheckFirmwareTypeAvailable,
61185
- deviceBackup: DeviceBackup$1,
60941
+ deviceBackup: DeviceBackup,
61186
60942
  deviceChangePin: DeviceChangePin,
61187
60943
  deviceFlags: DeviceFlags,
61188
60944
  deviceRebootToBootloader: DeviceRebootToBootloader,
@@ -61209,9 +60965,6 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
61209
60965
  promptWebDeviceAccess: PromptWebDeviceAccess,
61210
60966
  deviceReboot: DeviceReboot,
61211
60967
  deviceGetOnboardingStatus: DeviceGetOnboardingStatus,
61212
- deviceReadFactoryInfo: DeviceFactoryInfoGet,
61213
- deviceReadFactoryCertificate: DeviceFactoryCertificateRead,
61214
- deviceSignFactoryChallenge: DeviceFactoryChallengeSign,
61215
60968
  deviceUploadWallpaper: DeviceUploadWallpaper,
61216
60969
  deviceUploadNft: DeviceUploadNft,
61217
60970
  uploadPortfolio: UploadPortfolio,
@@ -61228,18 +60981,18 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
61228
60981
  confluxSignMessage: ConfluxSignMessage,
61229
60982
  confluxSignMessageCIP23: ConfluxSignMessageCIP23,
61230
60983
  confluxSignTransaction: ConfluxSignTransaction,
61231
- evmGetAddress: EvmGetAddress$1,
61232
- evmGetPublicKey: EVMGetPublicKey$1,
61233
- evmSignMessage: EVMSignMessage$4,
60984
+ evmGetAddress: EvmGetAddress,
60985
+ evmGetPublicKey: EVMGetPublicKey,
60986
+ evmSignMessage: EVMSignMessage$2,
61234
60987
  evmSignMessageEIP712: EVMSignMessageEIP712,
61235
- evmSignTransaction: EVMSignTransaction$1,
61236
- evmSignTypedData: EVMSignTypedData$1,
61237
- evmVerifyMessage: EVMSignMessage$3,
60988
+ evmSignTransaction: EVMSignTransaction,
60989
+ evmSignTypedData: EVMSignTypedData,
60990
+ evmVerifyMessage: EVMSignMessage$1,
61238
60991
  starcoinGetAddress: StarcoinGetAddress,
61239
60992
  starcoinGetPublicKey: StarcoinGetPublicKey,
61240
60993
  starcoinSignMessage: StarcoinSignMessage,
61241
60994
  starcoinSignTransaction: StarcoinSignTransaction,
61242
- starcoinVerifyMessage: EVMSignMessage$2,
60995
+ starcoinVerifyMessage: EVMSignMessage,
61243
60996
  nemGetAddress: NEMGetAddress,
61244
60997
  nemSignTransaction: NEMSignTransaction,
61245
60998
  solGetAddress: SolGetAddress,
@@ -61310,25 +61063,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
61310
61063
  });
61311
61064
 
61312
61065
  const publicMethodRegistry = ApiMethods;
61313
- const findExtensionMethod = (method, extensions) => {
61314
- var _a;
61315
- let match;
61316
- for (const extension of extensions) {
61317
- const constructor = extension.methods[method];
61318
- if (constructor) {
61319
- if (match) {
61320
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Method ${method} is registered by multiple extensions`);
61321
- }
61322
- match = {
61323
- constructor,
61324
- destructive: ((_a = extension.destructiveMethods) === null || _a === void 0 ? void 0 : _a.includes(method)) === true,
61325
- };
61326
- }
61327
- }
61328
- return match;
61329
- };
61330
- function findMethod(message, options = {}) {
61331
- var _a;
61066
+ function findMethod(message) {
61332
61067
  const { method } = message.payload;
61333
61068
  if (typeof method !== 'string') {
61334
61069
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Method is not set');
@@ -61337,13 +61072,6 @@ function findMethod(message, options = {}) {
61337
61072
  if (MethodConstructor) {
61338
61073
  return new MethodConstructor(message);
61339
61074
  }
61340
- const extensionMethod = findExtensionMethod(method, (_a = options.extensions) !== null && _a !== void 0 ? _a : []);
61341
- if (extensionMethod) {
61342
- if (extensionMethod.destructive && options.allowDestructiveOperations !== true) {
61343
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Destructive method ${method} requires allowDestructiveOperations`);
61344
- }
61345
- return new extensionMethod.constructor(message);
61346
- }
61347
61075
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Method ${method} is not set`);
61348
61076
  }
61349
61077
 
@@ -61362,10 +61090,19 @@ class DeviceConnector {
61362
61090
  this.transport = TransportManager.getTransport();
61363
61091
  DevicePool.setConnector(this);
61364
61092
  }
61093
+ getActiveTransport() {
61094
+ var _a;
61095
+ const transport = (_a = this.transport) !== null && _a !== void 0 ? _a : TransportManager.getTransport();
61096
+ if (!transport) {
61097
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.TransportNotConfigured, 'Device connector was created before transport initialization');
61098
+ }
61099
+ this.transport = transport;
61100
+ return transport;
61101
+ }
61365
61102
  enumerate() {
61366
61103
  return __awaiter(this, void 0, void 0, function* () {
61367
61104
  try {
61368
- const descriptors = yield this.transport.enumerate();
61105
+ const descriptors = yield this.getActiveTransport().enumerate();
61369
61106
  this.upcoming = descriptors;
61370
61107
  this._reportDevicesChange();
61371
61108
  return { descriptors };
@@ -61382,11 +61119,10 @@ class DeviceConnector {
61382
61119
  this.listening = true;
61383
61120
  let descriptors;
61384
61121
  try {
61122
+ const transport = this.getActiveTransport();
61385
61123
  Log$2.debug('Start listening', current);
61386
61124
  this.listenTimestamp = new Date().getTime();
61387
- descriptors = waitForEvent
61388
- ? yield this.transport.listen(current)
61389
- : yield this.transport.enumerate();
61125
+ descriptors = waitForEvent ? yield transport.listen(current) : yield transport.enumerate();
61390
61126
  if (!this.listening)
61391
61127
  return;
61392
61128
  this.upcoming = descriptors;
@@ -61417,9 +61153,10 @@ class DeviceConnector {
61417
61153
  Log$2.debug('acquire', path, session, expectedProtocol, protocolHint);
61418
61154
  const env = DataManager.getSettings('env');
61419
61155
  try {
61156
+ const transport = this.getActiveTransport();
61420
61157
  let res;
61421
61158
  if (DataManager.isBleConnect(env)) {
61422
- res = yield this.transport.acquire({
61159
+ res = yield transport.acquire({
61423
61160
  uuid: path,
61424
61161
  forceCleanRunPromise,
61425
61162
  expectedProtocol,
@@ -61427,7 +61164,7 @@ class DeviceConnector {
61427
61164
  });
61428
61165
  }
61429
61166
  else {
61430
- res = yield this.transport.acquire({
61167
+ res = yield transport.acquire({
61431
61168
  path,
61432
61169
  previous: session !== null && session !== void 0 ? session : null,
61433
61170
  expectedProtocol,
@@ -61435,7 +61172,10 @@ class DeviceConnector {
61435
61172
  });
61436
61173
  }
61437
61174
  if (expectedProtocol) {
61438
- const detectedProtocol = this.transport.getProtocolType(path);
61175
+ const acquiredProtocol = typeof res === 'object' && res !== null
61176
+ ? res.protocolType
61177
+ : undefined;
61178
+ const detectedProtocol = acquiredProtocol !== null && acquiredProtocol !== void 0 ? acquiredProtocol : transport.getProtocolType(path);
61439
61179
  if (detectedProtocol !== expectedProtocol) {
61440
61180
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Device protocol mismatch: expected ${expectedProtocol}, detected ${detectedProtocol}`);
61441
61181
  }
@@ -61451,7 +61191,7 @@ class DeviceConnector {
61451
61191
  release(session, onclose) {
61452
61192
  return __awaiter(this, void 0, void 0, function* () {
61453
61193
  try {
61454
- const res = yield this.transport.release(session, onclose);
61194
+ const res = yield this.getActiveTransport().release(session, onclose);
61455
61195
  return res;
61456
61196
  }
61457
61197
  catch (error) {
@@ -61462,8 +61202,9 @@ class DeviceConnector {
61462
61202
  disconnect(session) {
61463
61203
  return __awaiter(this, void 0, void 0, function* () {
61464
61204
  try {
61465
- if (this.transport.disconnect && !!session) {
61466
- yield this.transport.disconnect(session);
61205
+ const transport = this.getActiveTransport();
61206
+ if (transport.disconnect && !!session) {
61207
+ yield transport.disconnect(session);
61467
61208
  }
61468
61209
  }
61469
61210
  catch (error) {
@@ -61472,10 +61213,11 @@ class DeviceConnector {
61472
61213
  });
61473
61214
  }
61474
61215
  promptDeviceAccess() {
61475
- if (!this.transport.promptDeviceAccess) {
61216
+ const transport = this.getActiveTransport();
61217
+ if (!transport.promptDeviceAccess) {
61476
61218
  return Promise.resolve(null);
61477
61219
  }
61478
- return this.transport.promptDeviceAccess();
61220
+ return transport.promptDeviceAccess();
61479
61221
  }
61480
61222
  _reportDevicesChange() {
61481
61223
  DevicePool.reportDeviceChange(this.upcoming);
@@ -61746,10 +61488,7 @@ const callAPI = (context, message) => __awaiter(void 0, void 0, void 0, function
61746
61488
  }
61747
61489
  let method;
61748
61490
  try {
61749
- method = findMethod(message, {
61750
- extensions: context.methodExtensions,
61751
- allowDestructiveOperations: context.allowDestructiveOperations,
61752
- });
61491
+ method = findMethod(message);
61753
61492
  method.connector = _connector;
61754
61493
  const shouldPostMessage = createUiProgressMessageFilter();
61755
61494
  method.postMessage = event => {
@@ -62074,6 +61813,10 @@ const onCallDevice = (context, message, method) => __awaiter(void 0, void 0, voi
62074
61813
  completeMethodRequestContext(method);
62075
61814
  }
62076
61815
  catch (error) {
61816
+ if (!requestQueue.getTask(method.responseID)) {
61817
+ Log.debug(`Call API - Ignore late inner method result`, error);
61818
+ return;
61819
+ }
62077
61820
  Log.debug(`Call API - Inner Method Run Error`, error);
62078
61821
  messageResponse = createResponseMessage(method.responseID, false, { error });
62079
61822
  requestQueue.resolveRequest(method.responseID, messageResponse);
@@ -62656,22 +62399,18 @@ const createUiPromise = (promiseEvent, device) => {
62656
62399
  const removeUiPromise = (promise) => {
62657
62400
  _uiPromises = _uiPromises.filter(p => p !== promise);
62658
62401
  };
62659
- class Core extends events.exports.EventEmitter {
62660
- constructor(options = {}) {
62402
+ class Core extends events.exports {
62403
+ constructor() {
62661
62404
  super();
62662
62405
  this.requestQueue = new RequestQueue();
62663
62406
  this.methodSynchronize = getSynchronize();
62664
- this.options = options;
62665
62407
  this.tracingContext = createSdkTracingContext();
62666
62408
  this.sdkInstanceId = this.tracingContext.sdkInstanceId;
62667
62409
  Log.debug(`[Core] Created SDK instance: ${this.sdkInstanceId}`);
62668
62410
  }
62669
62411
  getCoreContext() {
62670
- var _a;
62671
62412
  return {
62672
62413
  sdkInstanceId: this.sdkInstanceId,
62673
- methodExtensions: (_a = this.options.methodExtensions) !== null && _a !== void 0 ? _a : [],
62674
- allowDestructiveOperations: this.options.allowDestructiveOperations === true,
62675
62414
  tracingContext: this.tracingContext,
62676
62415
  requestQueue: this.requestQueue,
62677
62416
  methodSynchronize: this.methodSynchronize,
@@ -62780,8 +62519,8 @@ class Core extends events.exports.EventEmitter {
62780
62519
  });
62781
62520
  }
62782
62521
  }
62783
- const initCore = (options) => {
62784
- const core = new Core(options);
62522
+ const initCore = () => {
62523
+ const core = new Core();
62785
62524
  _core = core;
62786
62525
  return core;
62787
62526
  };
@@ -62798,25 +62537,21 @@ const initConnector = () => {
62798
62537
  const initTransport = (Transport, plugin) => {
62799
62538
  TransportManager.setTransport(Transport, plugin);
62800
62539
  };
62801
- const init = (settings, Transport, plugin, options) => __awaiter(void 0, void 0, void 0, function* () {
62540
+ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0, function* () {
62802
62541
  try {
62803
- try {
62804
- yield DataManager.load(settings);
62805
- initTransport(Transport, plugin);
62806
- }
62807
- catch (_s) {
62808
- Log.error('DataManager.load error');
62809
- }
62542
+ yield DataManager.load(settings);
62543
+ initTransport(Transport, plugin);
62810
62544
  enableLog(DataManager.getSettings('debug'));
62811
62545
  if (DataManager.getSettings('env') !== 'react-native') {
62812
62546
  setLoggerPostMessage(postMessage);
62813
62547
  }
62814
- initCore(options);
62548
+ initCore();
62815
62549
  initConnector();
62816
62550
  return _core;
62817
62551
  }
62818
62552
  catch (error) {
62819
62553
  Log.error('core init', error);
62554
+ throw error;
62820
62555
  }
62821
62556
  });
62822
62557
  const switchTransport = ({ env, Transport, plugin, }) => {
@@ -62828,2189 +62563,6 @@ const switchTransport = ({ env, Transport, plugin, }) => {
62828
62563
  initConnector();
62829
62564
  };
62830
62565
 
62831
- class DeviceFactoryInfoSet extends BaseMethod {
62832
- getSupportedProtocols() {
62833
- return ['V2'];
62834
- }
62835
- init() {
62836
- this.skipForceUpdateCheck = true;
62837
- this.useDevicePassphraseState = false;
62838
- this.unlockPolicy = 'none';
62839
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
62840
- this.requireDeviceMode = [UI_REQUEST.BOOTLOADER];
62841
- this.params = validateDeviceFactoryInfoSetParams(this.payload);
62842
- }
62843
- run() {
62844
- return __awaiter(this, void 0, void 0, function* () {
62845
- const res = yield this.device.commands.typedCall('DeviceFactoryInfoSet', 'Success', {
62846
- info: {
62847
- version: this.params.version,
62848
- serial_number: this.params.serial_number,
62849
- burn_in_completed: this.params.burn_in_completed,
62850
- factory_test_completed: this.params.factory_test_completed,
62851
- manufacture_time: this.params.manufacture_time,
62852
- },
62853
- });
62854
- return Promise.resolve(res.message);
62855
- });
62856
- }
62857
- }
62858
-
62859
- class DeviceFactoryCertificateWrite extends BaseMethod {
62860
- getSupportedProtocols() {
62861
- return ['V2'];
62862
- }
62863
- init() {
62864
- this.skipForceUpdateCheck = true;
62865
- this.useDevicePassphraseState = false;
62866
- this.unlockPolicy = 'none';
62867
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
62868
- this.requireDeviceMode = [UI_REQUEST.BOOTLOADER];
62869
- this.params = validateDeviceFactoryCertificateWriteParams(this.payload);
62870
- }
62871
- run() {
62872
- return __awaiter(this, void 0, void 0, function* () {
62873
- const res = yield this.device.commands.typedCall('DeviceCertificateWrite', 'Success', {
62874
- cert: {
62875
- cert_and_pubkey: this.params.certificate,
62876
- private_key: this.params.privateKey,
62877
- },
62878
- });
62879
- return res.message;
62880
- });
62881
- }
62882
- }
62883
-
62884
- var FactoryMethods = /*#__PURE__*/Object.freeze({
62885
- __proto__: null,
62886
- deviceProvisionFactoryInfo: DeviceFactoryInfoSet,
62887
- deviceWriteFactoryCertificate: DeviceFactoryCertificateWrite
62888
- });
62889
-
62890
- class BTCGetOwnershipId extends BaseMethod {
62891
- init() {
62892
- this.checkDeviceId = true;
62893
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
62894
- const { path, coin } = this.payload;
62895
- const addressN = validatePath(path);
62896
- const { coinName, scriptType } = getCoinAndScriptType(addressN, coin, false);
62897
- this.params = {
62898
- address_n: addressN,
62899
- coin_name: coinName,
62900
- multisig: this.payload.multisig,
62901
- script_type: scriptType || 'SPENDADDRESS',
62902
- };
62903
- }
62904
- run() {
62905
- return __awaiter(this, void 0, void 0, function* () {
62906
- const res = yield this.device.commands.typedCall('GetOwnershipId', 'OwnershipId', Object.assign({}, this.params));
62907
- return Promise.resolve(res.message);
62908
- });
62909
- }
62910
- }
62911
-
62912
- class BTCGetOwnershipProof extends BaseMethod {
62913
- init() {
62914
- this.checkDeviceId = true;
62915
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
62916
- const { path, coin } = this.payload;
62917
- const addressN = validatePath(path);
62918
- const { coinName, scriptType } = getCoinAndScriptType(addressN, coin, false);
62919
- this.params = {
62920
- address_n: addressN,
62921
- coin_name: coinName,
62922
- multisig: this.payload.multisig,
62923
- script_type: scriptType || 'SPENDADDRESS',
62924
- user_confirmation: this.payload.user_confirmation,
62925
- ownership_ids: this.payload.ownership_ids,
62926
- commitment_data: this.payload.commitment_data,
62927
- };
62928
- }
62929
- run() {
62930
- return __awaiter(this, void 0, void 0, function* () {
62931
- const res = yield this.device.commands.typedCall('GetOwnershipProof', 'OwnershipProof', Object.assign({}, this.params));
62932
- return Promise.resolve(res.message);
62933
- });
62934
- }
62935
- }
62936
-
62937
- class BTCAuthorizeCoinJoin extends BaseMethod {
62938
- init() {
62939
- this.checkDeviceId = true;
62940
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
62941
- const { path, coin } = this.payload;
62942
- const addressN = validatePath(path);
62943
- const { coinName, scriptType } = getCoinAndScriptType(addressN, coin, false);
62944
- this.params = {
62945
- address_n: addressN,
62946
- coin_name: coinName,
62947
- script_type: scriptType || 'SPENDADDRESS',
62948
- coordinator: this.payload.coordinator,
62949
- max_total_fee: this.payload.max_total_fee,
62950
- fee_per_anonymity: this.payload.fee_per_anonymity,
62951
- amount_unit: this.payload.amount_unit,
62952
- };
62953
- }
62954
- run() {
62955
- return __awaiter(this, void 0, void 0, function* () {
62956
- const res = yield this.device.commands.typedCall('AuthorizeCoinJoin', 'Success', Object.assign({}, this.params));
62957
- return Promise.resolve(res.message);
62958
- });
62959
- }
62960
- }
62961
-
62962
- class CryptoBatchGetPublickeys extends BaseMethod {
62963
- constructor() {
62964
- super(...arguments);
62965
- this.hasBundle = false;
62966
- }
62967
- init() {
62968
- this.checkDeviceId = true;
62969
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
62970
- this.params = {
62971
- ecdsa_curve_name: this.payload.ecdsa_curve_name,
62972
- paths: this.payload.paths.map((path) => {
62973
- const addressN = validatePath(path);
62974
- return {
62975
- address_n: addressN,
62976
- show_display: this.payload.show_display,
62977
- };
62978
- }),
62979
- };
62980
- }
62981
- run() {
62982
- return __awaiter(this, void 0, void 0, function* () {
62983
- return this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', this.params);
62984
- });
62985
- }
62986
- }
62987
-
62988
- class CryptoCipherKeyValue extends BaseMethod {
62989
- constructor() {
62990
- super(...arguments);
62991
- this.hasBundle = false;
62992
- }
62993
- init() {
62994
- this.checkDeviceId = true;
62995
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
62996
- const addressN = validatePath(this.payload.path);
62997
- this.params = {
62998
- address_n: addressN,
62999
- key: this.payload.key,
63000
- value: this.payload.key,
63001
- encrypt: this.payload.key,
63002
- ask_on_encrypt: this.payload.key,
63003
- ask_on_decrypt: this.payload.key,
63004
- iv: this.payload.key,
63005
- };
63006
- }
63007
- run() {
63008
- return __awaiter(this, void 0, void 0, function* () {
63009
- return this.device.commands.typedCall('CipherKeyValue', 'CipheredKeyValue', this.params);
63010
- });
63011
- }
63012
- }
63013
-
63014
- class CryptoCosiCommit extends BaseMethod {
63015
- constructor() {
63016
- super(...arguments);
63017
- this.hasBundle = false;
63018
- }
63019
- init() {
63020
- this.checkDeviceId = true;
63021
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63022
- const addressN = validatePath(this.payload.path);
63023
- this.params = {
63024
- address_n: addressN,
63025
- data: this.payload.data,
63026
- };
63027
- }
63028
- run() {
63029
- return __awaiter(this, void 0, void 0, function* () {
63030
- return this.device.commands.typedCall('CosiCommit', 'CosiCommitment', this.params);
63031
- });
63032
- }
63033
- }
63034
-
63035
- class CryptoCosiSign extends BaseMethod {
63036
- constructor() {
63037
- super(...arguments);
63038
- this.hasBundle = false;
63039
- }
63040
- init() {
63041
- this.checkDeviceId = true;
63042
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63043
- const addressN = validatePath(this.payload.path);
63044
- this.params = {
63045
- address_n: addressN,
63046
- data: this.payload.data,
63047
- global_commitment: this.payload.global_commitment,
63048
- global_pubkey: this.payload.global_pubkey,
63049
- };
63050
- }
63051
- run() {
63052
- return __awaiter(this, void 0, void 0, function* () {
63053
- return this.device.commands.typedCall('CosiSign', 'CosiSignature', this.params);
63054
- });
63055
- }
63056
- }
63057
-
63058
- class CryptoGetECDHSessionKey extends BaseMethod {
63059
- constructor() {
63060
- super(...arguments);
63061
- this.hasBundle = false;
63062
- }
63063
- init() {
63064
- this.checkDeviceId = true;
63065
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63066
- this.params = {
63067
- identity: this.payload.identity,
63068
- peer_public_key: this.payload.peer_public_key,
63069
- ecdsa_curve_name: this.payload.ecdsa_curve_name,
63070
- };
63071
- }
63072
- run() {
63073
- return __awaiter(this, void 0, void 0, function* () {
63074
- return this.device.commands.typedCall('GetECDHSessionKey', 'ECDHSessionKey', this.params);
63075
- });
63076
- }
63077
- }
63078
-
63079
- class CryptoSignIdentity extends BaseMethod {
63080
- constructor() {
63081
- super(...arguments);
63082
- this.hasBundle = false;
63083
- }
63084
- init() {
63085
- this.checkDeviceId = true;
63086
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63087
- this.params = {
63088
- identity: this.payload.identity,
63089
- challenge_hidden: this.payload.challenge_hidden,
63090
- challenge_visual: this.payload.challenge_visual,
63091
- ecdsa_curve_name: this.payload.ecdsa_curve_name,
63092
- };
63093
- }
63094
- run() {
63095
- return __awaiter(this, void 0, void 0, function* () {
63096
- return this.device.commands.typedCall('SignIdentity', 'ECDHSessionKey', this.params);
63097
- });
63098
- }
63099
- }
63100
-
63101
- function getAddressLegacyV1 ({ typedCall, param, }) {
63102
- return __awaiter(this, void 0, void 0, function* () {
63103
- const message = {
63104
- address_n: param.address_n,
63105
- show_display: param.show_display,
63106
- chain_id: param.chain_id,
63107
- };
63108
- return typedCall('EthereumGetAddress', 'EthereumAddress', message);
63109
- });
63110
- }
63111
-
63112
- class EvmGetAddress extends BaseMethod {
63113
- constructor() {
63114
- super(...arguments);
63115
- this.hasBundle = false;
63116
- }
63117
- init() {
63118
- var _a;
63119
- this.checkDeviceId = true;
63120
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63121
- this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
63122
- const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
63123
- validateParams(payload, [{ name: 'bundle', type: 'array' }]);
63124
- this.params = [];
63125
- payload.bundle.forEach((batch) => {
63126
- var _a;
63127
- const addressN = validatePath(batch.path, 3);
63128
- validateParams(batch, [
63129
- { name: 'path', required: true },
63130
- { name: 'showOnOneKey', type: 'boolean' },
63131
- { name: 'chainId', type: 'number' },
63132
- ]);
63133
- const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
63134
- this.params.push({
63135
- address_n: addressN,
63136
- show_display: showOnOneKey,
63137
- chain_id: batch.chainId,
63138
- });
63139
- });
63140
- }
63141
- getEvmAddress(param) {
63142
- return __awaiter(this, void 0, void 0, function* () {
63143
- return getAddressLegacyV1({
63144
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63145
- param,
63146
- });
63147
- });
63148
- }
63149
- run() {
63150
- return __awaiter(this, void 0, void 0, function* () {
63151
- const responses = [];
63152
- for (let i = 0; i < this.params.length; i++) {
63153
- const param = this.params[i];
63154
- const res = yield this.getEvmAddress(param);
63155
- const { address } = res.message;
63156
- if (!address) {
63157
- throw new Error('EthereumGetAddress: address is undefined');
63158
- }
63159
- const result = {
63160
- path: serializedPath(param.address_n),
63161
- address,
63162
- };
63163
- responses.push(result);
63164
- this.postPreviousAddressMessage(result);
63165
- }
63166
- return Promise.resolve(this.hasBundle ? responses : responses[0]);
63167
- });
63168
- }
63169
- }
63170
-
63171
- function getPublicKeyLegacyV1 ({ typedCall, param, }) {
63172
- return __awaiter(this, void 0, void 0, function* () {
63173
- const message = {
63174
- address_n: param.address_n,
63175
- show_display: param.show_display,
63176
- chain_id: param.chain_id,
63177
- };
63178
- return typedCall('EthereumGetPublicKey', 'EthereumPublicKey', message);
63179
- });
63180
- }
63181
-
63182
- class EVMGetPublicKey extends BaseMethod {
63183
- constructor() {
63184
- super(...arguments);
63185
- this.hasBundle = false;
63186
- this.confirmShowOnOneKey = false;
63187
- this.useBatch = false;
63188
- }
63189
- init() {
63190
- var _a, _b, _c;
63191
- this.checkDeviceId = true;
63192
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63193
- this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
63194
- this.confirmShowOnOneKey = (_c = (_b = this.payload) === null || _b === void 0 ? void 0 : _b.bundle) === null || _c === void 0 ? void 0 : _c.some((item) => !!item.showOnOneKey);
63195
- this.useBatch = !this.confirmShowOnOneKey && this.hasBundle && this.payload.useBatch;
63196
- const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
63197
- validateParams(payload, [{ name: 'bundle', type: 'array' }]);
63198
- this.params = [];
63199
- payload.bundle.forEach((batch) => {
63200
- var _a;
63201
- const addressN = validatePath(batch.path, 3);
63202
- validateParams(batch, [
63203
- { name: 'path', required: true },
63204
- { name: 'showOnOneKey', type: 'boolean' },
63205
- { name: 'chainId', type: 'number' },
63206
- ]);
63207
- const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
63208
- this.params.push({
63209
- address_n: addressN,
63210
- show_display: showOnOneKey,
63211
- chain_id: batch.chainId,
63212
- });
63213
- });
63214
- }
63215
- getEvmPublicKey(param) {
63216
- return getPublicKeyLegacyV1({
63217
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63218
- param,
63219
- });
63220
- }
63221
- run() {
63222
- return __awaiter(this, void 0, void 0, function* () {
63223
- const responses = [];
63224
- if (this.useBatch && supportBatchPublicKeyByDevice(this.device)) {
63225
- try {
63226
- const res = yield batchGetPublickeys(this.device, this.params, 'secp256k1', 60, {
63227
- includeNode: false,
63228
- ignoreCoinType: true,
63229
- });
63230
- const result = res.public_keys.map((publicKey, index) => ({
63231
- path: serializedPath(this.params[index].address_n),
63232
- pub: publicKey,
63233
- publicKey,
63234
- }));
63235
- validateResult(result, ['pub'], {
63236
- expectedLength: this.params.length,
63237
- });
63238
- return yield Promise.resolve(result);
63239
- }
63240
- catch (e) {
63241
- }
63242
- }
63243
- for (let i = 0; i < this.params.length; i++) {
63244
- const param = this.params[i];
63245
- const res = yield this.getEvmPublicKey(param);
63246
- responses.push(Object.assign({ path: serializedPath(param.address_n), pub: res.message.node.public_key, publicKey: res.message.node.public_key }, res.message));
63247
- }
63248
- validateResult(responses, ['pub'], {
63249
- expectedLength: this.params.length,
63250
- });
63251
- return Promise.resolve(this.hasBundle ? responses : responses[0]);
63252
- });
63253
- }
63254
- }
63255
-
63256
- function signMessageLegacyV1 ({ typedCall, params, }) {
63257
- return __awaiter(this, void 0, void 0, function* () {
63258
- const message = {
63259
- address_n: params.address_n,
63260
- message: params.message,
63261
- chain_id: params.chain_id,
63262
- };
63263
- const res = yield typedCall('EthereumSignMessage', 'EthereumMessageSignature', message);
63264
- return Promise.resolve(res.message);
63265
- });
63266
- }
63267
-
63268
- class EVMSignMessage$1 extends BaseMethod {
63269
- init() {
63270
- this.checkDeviceId = true;
63271
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63272
- validateParams(this.payload, [
63273
- { name: 'path', required: true },
63274
- { name: 'messageHex', type: 'hexString', required: true },
63275
- { name: 'chainId', type: 'number' },
63276
- ]);
63277
- const { path, messageHex, chainId } = this.payload;
63278
- const addressN = validatePath(path, 3);
63279
- this.params = {
63280
- address_n: addressN,
63281
- message: formatAnyHex(messageHex),
63282
- chain_id: chainId,
63283
- };
63284
- }
63285
- run() {
63286
- return __awaiter(this, void 0, void 0, function* () {
63287
- return signMessageLegacyV1({
63288
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63289
- params: this.params,
63290
- });
63291
- });
63292
- }
63293
- }
63294
-
63295
- const signTransaction = ({ typedCall, isEIP1559, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
63296
- return isEIP1559
63297
- ? evmSignTxEip1559({
63298
- typedCall,
63299
- addressN,
63300
- tx: tx,
63301
- supportTrezor: true,
63302
- })
63303
- : evmSignTx({ typedCall, addressN, tx: tx, supportTrezor: true });
63304
- });
63305
-
63306
- class EVMSignTransaction extends BaseMethod {
63307
- constructor() {
63308
- super(...arguments);
63309
- this.addressN = [];
63310
- this.isEIP1559 = false;
63311
- }
63312
- init() {
63313
- this.checkDeviceId = true;
63314
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63315
- validateParams(this.payload, [
63316
- { name: 'path', required: true },
63317
- { name: 'transaction', type: 'object', required: true },
63318
- ]);
63319
- const { path, transaction } = this.payload;
63320
- this.addressN = validatePath(path, 3);
63321
- const tx = transaction;
63322
- this.isEIP1559 = !!tx.maxFeePerGas && !!tx.maxPriorityFeePerGas;
63323
- const schema = [
63324
- { name: 'to', type: 'hexString', required: true },
63325
- { name: 'value', type: 'hexString', required: true },
63326
- { name: 'gasLimit', type: 'hexString', required: true },
63327
- { name: 'nonce', type: 'hexString', required: true },
63328
- { name: 'chainId', type: 'number', required: true },
63329
- { name: 'data', type: 'hexString' },
63330
- ];
63331
- if (this.isEIP1559) {
63332
- schema.push({ name: 'maxFeePerGas', type: 'hexString', required: true });
63333
- schema.push({ name: 'maxPriorityFeePerGas', type: 'hexString', required: true });
63334
- }
63335
- else {
63336
- schema.push({ name: 'gasPrice', type: 'hexString', required: true });
63337
- schema.push({ name: 'txType', type: 'number' });
63338
- }
63339
- validateParams(tx, schema);
63340
- this.formattedTx = formatAnyHex(tx);
63341
- }
63342
- getVersionRange() {
63343
- if (this.isEIP1559) {
63344
- return {
63345
- model_mini: {
63346
- min: '2.1.11',
63347
- },
63348
- };
63349
- }
63350
- return {
63351
- model_mini: {
63352
- min: '1.0.0',
63353
- },
63354
- };
63355
- }
63356
- run() {
63357
- return __awaiter(this, void 0, void 0, function* () {
63358
- const { addressN, isEIP1559, formattedTx } = this;
63359
- if (formattedTx == null)
63360
- throw hdShared.ERRORS.TypedError('Runtime', 'formattedTx is not set');
63361
- return signTransaction({
63362
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63363
- addressN,
63364
- tx: formattedTx,
63365
- isEIP1559,
63366
- });
63367
- });
63368
- }
63369
- }
63370
-
63371
- const signTypedHash = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
63372
- var _a;
63373
- const deviceType = device.getCurrentDeviceType();
63374
- if (deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro) {
63375
- const currentVersion = (_a = device.getCurrentFirmwareVersionString()) !== null && _a !== void 0 ? _a : '0.0.0';
63376
- const supportNestedArraysSignVersion = '4.2.0';
63377
- if (semver__default["default"].lt(currentVersion, supportNestedArraysSignVersion)) {
63378
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodNeedUpgradeFirmware, `Device firmware version is too low, please update to ${supportNestedArraysSignVersion}`, { current: currentVersion, require: supportNestedArraysSignVersion });
63379
- }
63380
- }
63381
- const message = {
63382
- address_n: addressN,
63383
- domain_separator_hash: domainHash !== null && domainHash !== void 0 ? domainHash : '',
63384
- message_hash: messageHash,
63385
- chain_id: chainId,
63386
- };
63387
- return typedCall('EthereumSignTypedHash', 'EthereumTypedDataSignature', message);
63388
- });
63389
-
63390
- const signTypedData = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
63391
- const { primaryType } = data;
63392
- const message = {
63393
- address_n: addressN,
63394
- primary_type: primaryType,
63395
- metamask_v4_compat: metamaskV4Compat,
63396
- chain_id: chainId,
63397
- };
63398
- const response = yield typedCall('EthereumSignTypedData', [
63399
- 'EthereumTypedDataStructRequest',
63400
- 'EthereumTypedDataValueRequest',
63401
- 'EthereumTypedDataSignature',
63402
- 'EthereumGnosisSafeTxRequest',
63403
- ], message);
63404
- return response;
63405
- });
63406
-
63407
- class EVMSignTypedData extends BaseMethod {
63408
- init() {
63409
- this.checkDeviceId = true;
63410
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63411
- validateParams(this.payload, [
63412
- { name: 'path', required: true },
63413
- { name: 'metamaskV4Compat', type: 'boolean' },
63414
- { name: 'data', type: 'object' },
63415
- { name: 'domainHash', type: 'hexString' },
63416
- { name: 'messageHash', type: 'hexString' },
63417
- { name: 'chainId', type: 'number' },
63418
- ]);
63419
- const { path, data, metamaskV4Compat, domainHash, messageHash, chainId } = this.payload;
63420
- const addressN = validatePath(path, 3);
63421
- this.params = {
63422
- addressN,
63423
- metamaskV4Compat,
63424
- data,
63425
- chainId,
63426
- };
63427
- if (domainHash) {
63428
- this.params.domainHash = formatAnyHex(domainHash);
63429
- if (messageHash) {
63430
- this.params.messageHash = formatAnyHex(messageHash);
63431
- }
63432
- else if (!!data && (!data.primaryType || data.primaryType !== 'EIP712Domain')) {
63433
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'message_hash should only be empty when data.primaryType=EIP712Domain');
63434
- }
63435
- }
63436
- }
63437
- handleSignTypedData({ typedCall, signData, response, }) {
63438
- return __awaiter(this, void 0, void 0, function* () {
63439
- const { types, primaryType, domain, message, } = signData;
63440
- while (response.type === 'EthereumTypedDataStructRequest') {
63441
- const { name: typeDefinitionName } = response.message;
63442
- const typeDefinition = types[typeDefinitionName];
63443
- if (typeDefinition === undefined) {
63444
- throw hdShared.ERRORS.TypedError('Runtime', `Type ${typeDefinitionName} was not defined in types object`);
63445
- }
63446
- const dataStruckAck = {
63447
- members: typeDefinition.map(({ name, type: typeName }) => ({
63448
- name,
63449
- type: getFieldType(typeName, types),
63450
- })),
63451
- };
63452
- response = yield typedCall('EthereumTypedDataStructAck', [
63453
- 'EthereumTypedDataStructRequest',
63454
- 'EthereumTypedDataValueRequest',
63455
- 'EthereumTypedDataSignature',
63456
- ], dataStruckAck);
63457
- }
63458
- while (response.type === 'EthereumTypedDataValueRequest') {
63459
- const { member_path } = response.message;
63460
- let memberData;
63461
- let memberTypeName;
63462
- const [rootIndex, ...nestedMemberPath] = member_path;
63463
- switch (rootIndex) {
63464
- case 0:
63465
- memberData = domain;
63466
- memberTypeName = 'EIP712Domain';
63467
- break;
63468
- case 1:
63469
- memberData = message;
63470
- memberTypeName = primaryType;
63471
- break;
63472
- default:
63473
- throw hdShared.ERRORS.TypedError('Runtime', 'Root index can only be 0 or 1');
63474
- }
63475
- for (const index of nestedMemberPath) {
63476
- if (Array.isArray(memberData)) {
63477
- memberTypeName = parseArrayType(memberTypeName).entryTypeName;
63478
- memberData = memberData[index];
63479
- }
63480
- else if (typeof memberData === 'object' && memberData !== null) {
63481
- const memberTypeDefinition = types[memberTypeName][index];
63482
- memberTypeName = memberTypeDefinition.type;
63483
- memberData = memberData[memberTypeDefinition.name];
63484
- }
63485
- else ;
63486
- }
63487
- let encodedData;
63488
- if (Array.isArray(memberData)) {
63489
- encodedData = encodeData('uint16', memberData.length);
63490
- }
63491
- else {
63492
- encodedData = encodeData(memberTypeName, memberData);
63493
- }
63494
- response = yield typedCall('EthereumTypedDataValueAck', ['EthereumTypedDataValueRequest', 'EthereumTypedDataSignature'], {
63495
- value: encodedData,
63496
- });
63497
- }
63498
- if (response.type !== 'EthereumTypedDataSignature') {
63499
- throw hdShared.ERRORS.TypedError('Runtime', 'Unexpected response type');
63500
- }
63501
- const { address, signature } = response.message;
63502
- return {
63503
- address,
63504
- signature,
63505
- };
63506
- });
63507
- }
63508
- signTypedData() {
63509
- return __awaiter(this, void 0, void 0, function* () {
63510
- const { addressN, data, metamaskV4Compat, chainId } = this.params;
63511
- const response = yield signTypedData({
63512
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63513
- addressN,
63514
- data,
63515
- metamaskV4Compat,
63516
- chainId,
63517
- });
63518
- return this.handleSignTypedData({
63519
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63520
- signData: data,
63521
- response,
63522
- });
63523
- });
63524
- }
63525
- signTypedHash({ typedCall, addressN, domainHash, messageHash, chainId, }) {
63526
- if (!domainHash)
63527
- throw hdShared.ERRORS.TypedError('Runtime', 'domainHash is required');
63528
- return signTypedHash({
63529
- typedCall,
63530
- addressN,
63531
- chainId,
63532
- domainHash,
63533
- messageHash,
63534
- device: this.device,
63535
- });
63536
- }
63537
- getVersionRange() {
63538
- return {
63539
- model_mini: {
63540
- min: '2.1.9',
63541
- },
63542
- };
63543
- }
63544
- hasBiggerData(item) {
63545
- const data = lodash.get(item.message, 'data', undefined);
63546
- if (!data)
63547
- return false;
63548
- let biggerLimit = 1024;
63549
- const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
63550
- const supportBiggerDataVersion = '4.4.0';
63551
- if (semver__default["default"].gte(currentVersion, supportBiggerDataVersion)) {
63552
- biggerLimit = 1536;
63553
- }
63554
- const startIndex = data.startsWith('0x') ? 2 : 0;
63555
- return (data.length - startIndex) / 2 > biggerLimit;
63556
- }
63557
- hasNestedArrays(item) {
63558
- if (!item)
63559
- return false;
63560
- if (Array.isArray(item)) {
63561
- for (const element of item) {
63562
- if (Array.isArray(element)) {
63563
- return true;
63564
- }
63565
- if (typeof element === 'object' && element !== null) {
63566
- if (this.hasNestedArrays(element)) {
63567
- return true;
63568
- }
63569
- }
63570
- }
63571
- }
63572
- else if (typeof item === 'object' && item !== null) {
63573
- for (const property in item) {
63574
- if (this.hasNestedArrays(item[property])) {
63575
- return true;
63576
- }
63577
- }
63578
- }
63579
- return false;
63580
- }
63581
- supportSignTyped() {
63582
- const deviceType = getDeviceType(this.device.features);
63583
- if (DeviceModelToTypes.model_mini.includes(deviceType)) {
63584
- const currentVersion = getDeviceFirmwareVersion(this.device.features).join('.');
63585
- const supportSignTypedVersion = '2.2.0';
63586
- if (semver__default["default"].lt(currentVersion, supportSignTypedVersion)) {
63587
- return false;
63588
- }
63589
- }
63590
- return true;
63591
- }
63592
- run() {
63593
- return __awaiter(this, void 0, void 0, function* () {
63594
- if (!this.device.features) {
63595
- throw hdShared.ERRORS.TypedError('Device_InitializeFailed', 'Device initialization failed. Please try again.');
63596
- }
63597
- const { addressN, chainId } = this.params;
63598
- const deviceType = getDeviceType(this.device.features);
63599
- if (DeviceModelToTypes.model_mini.includes(deviceType)) {
63600
- validateParams(this.params, [
63601
- { name: 'domainHash', type: 'hexString', required: true },
63602
- { name: 'messageHash', type: 'hexString', required: true },
63603
- ]);
63604
- const { domainHash, messageHash } = this.params;
63605
- let response;
63606
- if (this.supportSignTyped()) {
63607
- response = yield this.signTypedHash({
63608
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63609
- addressN,
63610
- chainId,
63611
- domainHash,
63612
- messageHash,
63613
- });
63614
- }
63615
- else {
63616
- response = yield this.device.commands.typedCall('EthereumSignMessageEIP712', 'EthereumMessageSignature', {
63617
- address_n: addressN,
63618
- domain_hash: domainHash !== null && domainHash !== void 0 ? domainHash : '',
63619
- message_hash: messageHash !== null && messageHash !== void 0 ? messageHash : '',
63620
- });
63621
- }
63622
- return Promise.resolve(response.message);
63623
- }
63624
- if (this.hasNestedArrays(this.params.data) || this.hasBiggerData(this.params.data)) {
63625
- validateParams(this.params, [
63626
- { name: 'domainHash', type: 'hexString', required: true },
63627
- { name: 'messageHash', type: 'hexString', required: true },
63628
- ]);
63629
- const { domainHash, messageHash } = this.params;
63630
- if (!domainHash)
63631
- throw hdShared.ERRORS.TypedError('Runtime', 'domainHash is required');
63632
- const response = yield this.signTypedHash({
63633
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63634
- addressN,
63635
- chainId,
63636
- domainHash,
63637
- messageHash,
63638
- });
63639
- return Promise.resolve(response.message);
63640
- }
63641
- return this.signTypedData();
63642
- });
63643
- }
63644
- }
63645
-
63646
- function verifyMessageLegacyV1 ({ typedCall, params, }) {
63647
- return __awaiter(this, void 0, void 0, function* () {
63648
- const message = {
63649
- signature: params.signature,
63650
- message: params.message,
63651
- address: params.address,
63652
- chain_id: params.chain_id,
63653
- };
63654
- const res = yield typedCall('EthereumVerifyMessage', 'Success', message);
63655
- return Promise.resolve(res.message);
63656
- });
63657
- }
63658
-
63659
- class EVMSignMessage extends BaseMethod {
63660
- init() {
63661
- this.checkDeviceId = true;
63662
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63663
- validateParams(this.payload, [
63664
- { name: 'address', type: 'string', required: true },
63665
- { name: 'messageHex', type: 'hexString', required: true },
63666
- { name: 'signature', type: 'hexString', required: true },
63667
- { name: 'chainId', type: 'number' },
63668
- ]);
63669
- const { address, messageHex, signature } = formatAnyHex(this.payload);
63670
- this.params = {
63671
- address,
63672
- message: messageHex,
63673
- signature,
63674
- chain_id: this.payload.chainId,
63675
- };
63676
- }
63677
- run() {
63678
- return __awaiter(this, void 0, void 0, function* () {
63679
- return verifyMessageLegacyV1({
63680
- typedCall: this.device.commands.typedCall.bind(this.device.commands),
63681
- params: this.params,
63682
- });
63683
- });
63684
- }
63685
- }
63686
-
63687
- const MAINNET = 0x68;
63688
- class NEMDecryptMessage extends BaseMethod {
63689
- constructor() {
63690
- super(...arguments);
63691
- this.hasBundle = false;
63692
- }
63693
- init() {
63694
- var _a;
63695
- this.checkDeviceId = true;
63696
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
63697
- this.params = {
63698
- address_n: validatePath(this.payload.path, 3),
63699
- network: (_a = this.payload.network) !== null && _a !== void 0 ? _a : MAINNET,
63700
- public_key: this.payload.public_key,
63701
- payload: this.payload.payload,
63702
- };
63703
- }
63704
- run() {
63705
- return __awaiter(this, void 0, void 0, function* () {
63706
- return this.device.commands.typedCall('NEMDecryptMessage', 'NEMDecryptedMessage', Object.assign({}, this.params));
63707
- });
63708
- }
63709
- }
63710
-
63711
- class DeviceSpiFlashWrite extends BaseMethod {
63712
- init() {
63713
- this.useDevicePassphraseState = false;
63714
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63715
- this.params = {
63716
- address: this.payload.address,
63717
- data: formatAnyHex(this.payload.data),
63718
- };
63719
- }
63720
- run() {
63721
- return __awaiter(this, void 0, void 0, function* () {
63722
- const res = yield this.device.commands.typedCall('SpiFlashWrite', 'Success', this.params);
63723
- return Promise.resolve(res.message);
63724
- });
63725
- }
63726
- }
63727
-
63728
- class DeviceSpiFlashRead extends BaseMethod {
63729
- init() {
63730
- this.useDevicePassphraseState = false;
63731
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63732
- this.params = {
63733
- address: this.payload.address,
63734
- len: formatAnyHex(this.payload.data),
63735
- };
63736
- }
63737
- run() {
63738
- return __awaiter(this, void 0, void 0, function* () {
63739
- const res = yield this.device.commands.typedCall('SpiFlashRead', 'SpiFlashData', this.params);
63740
- return Promise.resolve(res.message);
63741
- });
63742
- }
63743
- }
63744
-
63745
- class DeviceInfoSettings extends BaseMethod {
63746
- init() {
63747
- this.useDevicePassphraseState = false;
63748
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63749
- this.skipForceUpdateCheck = true;
63750
- this.params = {
63751
- serial_no: this.payload.serial_no,
63752
- cpu_info: this.payload.cpu_info,
63753
- pre_firmware: this.payload.pre_firmware,
63754
- };
63755
- }
63756
- run() {
63757
- return __awaiter(this, void 0, void 0, function* () {
63758
- const res = yield this.device.commands.typedCall('DeviceInfoSettings', 'Success', this.params);
63759
- return Promise.resolve(res.message);
63760
- });
63761
- }
63762
- }
63763
-
63764
- class GetDeviceInfoSettings extends BaseMethod {
63765
- init() {
63766
- this.useDevicePassphraseState = false;
63767
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63768
- this.skipForceUpdateCheck = true;
63769
- this.params = {};
63770
- }
63771
- run() {
63772
- return __awaiter(this, void 0, void 0, function* () {
63773
- const res = yield this.device.commands.typedCall('GetDeviceInfo', 'DeviceInfo');
63774
- return Promise.resolve(res.message);
63775
- });
63776
- }
63777
- }
63778
-
63779
- class DeviceReadSEPublicCert extends BaseMethod {
63780
- init() {
63781
- this.useDevicePassphraseState = false;
63782
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63783
- this.skipForceUpdateCheck = true;
63784
- }
63785
- run() {
63786
- return __awaiter(this, void 0, void 0, function* () {
63787
- const res = yield this.device.commands.typedCall('ReadSEPublicCert', 'SEPublicCert');
63788
- return Promise.resolve(res.message);
63789
- });
63790
- }
63791
- }
63792
-
63793
- class DeviceWriteSEPrivateKey extends BaseMethod {
63794
- init() {
63795
- this.useDevicePassphraseState = false;
63796
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63797
- this.params = {
63798
- private_key: this.payload.private_key,
63799
- };
63800
- this.skipForceUpdateCheck = true;
63801
- }
63802
- run() {
63803
- return __awaiter(this, void 0, void 0, function* () {
63804
- const res = yield this.device.commands.typedCall('WriteSEPrivateKey', 'Success', Object.assign({}, this.params));
63805
- return Promise.resolve(res.message);
63806
- });
63807
- }
63808
- }
63809
-
63810
- class DeviceWriteSEPublicCert extends BaseMethod {
63811
- init() {
63812
- this.useDevicePassphraseState = false;
63813
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63814
- this.params = {
63815
- public_cert: this.payload.public_cert,
63816
- };
63817
- this.skipForceUpdateCheck = true;
63818
- }
63819
- run() {
63820
- return __awaiter(this, void 0, void 0, function* () {
63821
- const res = yield this.device.commands.typedCall('WriteSEPublicCert', 'Success', Object.assign({}, this.params));
63822
- return Promise.resolve(res.message);
63823
- });
63824
- }
63825
- }
63826
-
63827
- class DeviceSESignMessage extends BaseMethod {
63828
- init() {
63829
- this.useDevicePassphraseState = false;
63830
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
63831
- this.params = {
63832
- message: this.payload.message,
63833
- };
63834
- this.skipForceUpdateCheck = true;
63835
- }
63836
- run() {
63837
- return __awaiter(this, void 0, void 0, function* () {
63838
- const res = yield this.device.commands.typedCall('SESignMessage', 'SEMessageSignature', Object.assign({}, this.params));
63839
- return Promise.resolve(res.message);
63840
- });
63841
- }
63842
- }
63843
-
63844
- class DevicePing extends BaseMethod {
63845
- init() {
63846
- this.useDevicePassphraseState = false;
63847
- this.params = {
63848
- message: this.payload.message,
63849
- button_protection: this.payload.button_protection,
63850
- };
63851
- }
63852
- run() {
63853
- return __awaiter(this, void 0, void 0, function* () {
63854
- const res = yield this.device.commands.typedCall('Ping', 'Success', this.params);
63855
- return Promise.resolve(res.message);
63856
- });
63857
- }
63858
- }
63859
-
63860
- class DeviceGetEntropy extends BaseMethod {
63861
- init() {
63862
- this.useDevicePassphraseState = false;
63863
- this.params = {
63864
- size: this.payload.size,
63865
- };
63866
- }
63867
- run() {
63868
- return __awaiter(this, void 0, void 0, function* () {
63869
- const res = yield this.device.commands.typedCall('GetEntropy', 'Entropy', this.params);
63870
- return Promise.resolve(res.message);
63871
- });
63872
- }
63873
- }
63874
-
63875
- class DeviceGetFirmwareHash extends BaseMethod {
63876
- init() {
63877
- this.useDevicePassphraseState = false;
63878
- this.params = {
63879
- challenge: this.payload.challenge,
63880
- };
63881
- }
63882
- run() {
63883
- return __awaiter(this, void 0, void 0, function* () {
63884
- const res = yield this.device.commands.typedCall('GetFirmwareHash', 'FirmwareHash', this.params);
63885
- return Promise.resolve(res.message);
63886
- });
63887
- }
63888
- }
63889
-
63890
- class DeviceUnlockPath extends BaseMethod {
63891
- init() {
63892
- this.useDevicePassphraseState = false;
63893
- const addressN = validatePath(this.payload.address_n, 3);
63894
- this.params = {
63895
- address_n: addressN,
63896
- mac: this.payload.mac,
63897
- };
63898
- }
63899
- run() {
63900
- return __awaiter(this, void 0, void 0, function* () {
63901
- const res = yield this.device.commands.typedCall('UnlockPath', 'UnlockedPathRequest', this.params);
63902
- return Promise.resolve(res.message);
63903
- });
63904
- }
63905
- }
63906
-
63907
- class DeviceSdProtect extends BaseMethod {
63908
- init() {
63909
- this.useDevicePassphraseState = false;
63910
- this.params = {
63911
- operation: this.payload.operation,
63912
- };
63913
- }
63914
- run() {
63915
- return __awaiter(this, void 0, void 0, function* () {
63916
- const res = yield this.device.commands.typedCall('SdProtect', 'Success');
63917
- return Promise.resolve(res.message);
63918
- });
63919
- }
63920
- }
63921
-
63922
- class DeviceChangeWipeCode extends BaseMethod {
63923
- init() {
63924
- this.useDevicePassphraseState = false;
63925
- this.params = {
63926
- remove: this.payload.remove,
63927
- };
63928
- }
63929
- run() {
63930
- return __awaiter(this, void 0, void 0, function* () {
63931
- const res = yield this.device.commands.typedCall('ChangeWipeCode', 'Success', this.params);
63932
- return Promise.resolve(res.message);
63933
- });
63934
- }
63935
- }
63936
-
63937
- class DeviceEndSession extends BaseMethod {
63938
- init() {
63939
- this.useDevicePassphraseState = false;
63940
- this.params = {
63941
- size: this.payload.size,
63942
- };
63943
- }
63944
- run() {
63945
- return __awaiter(this, void 0, void 0, function* () {
63946
- const res = yield this.device.commands.typedCall('EndSession', 'Success', this.params);
63947
- return Promise.resolve(res.message);
63948
- });
63949
- }
63950
- }
63951
-
63952
- class DeviceLoad extends BaseMethod {
63953
- init() {
63954
- this.useDevicePassphraseState = false;
63955
- this.params = {
63956
- mnemonics: this.payload.mnemonics.split(' '),
63957
- pin: this.payload.pin,
63958
- passphrase_protection: this.payload.passphrase_protection,
63959
- language: this.payload.language,
63960
- label: this.payload.label,
63961
- skip_checksum: this.payload.skip_checksum,
63962
- u2f_counter: this.payload.u2f_counter,
63963
- needs_backup: this.payload.needs_backup,
63964
- no_backup: this.payload.no_backup,
63965
- };
63966
- }
63967
- run() {
63968
- return __awaiter(this, void 0, void 0, function* () {
63969
- const res = yield this.device.commands.typedCall('LoadDevice', 'Success', this.params);
63970
- return Promise.resolve(res.message);
63971
- });
63972
- }
63973
- }
63974
-
63975
- class DeviceDoPreauthorized extends BaseMethod {
63976
- init() {
63977
- this.useDevicePassphraseState = false;
63978
- }
63979
- run() {
63980
- return __awaiter(this, void 0, void 0, function* () {
63981
- const res = yield this.device.commands.typedCall('DoPreauthorized', 'Success');
63982
- return Promise.resolve(res.message);
63983
- });
63984
- }
63985
- }
63986
-
63987
- class DeviceCancelAuthorization extends BaseMethod {
63988
- init() {
63989
- this.useDevicePassphraseState = false;
63990
- }
63991
- run() {
63992
- return __awaiter(this, void 0, void 0, function* () {
63993
- const res = yield this.device.commands.typedCall('CancelAuthorization', 'Success');
63994
- return Promise.resolve(res.message);
63995
- });
63996
- }
63997
- }
63998
-
63999
- class EmmcDirList extends BaseMethod {
64000
- init() {
64001
- this.useDevicePassphraseState = false;
64002
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64003
- this.params = {
64004
- path: this.payload.path,
64005
- };
64006
- }
64007
- run() {
64008
- return __awaiter(this, void 0, void 0, function* () {
64009
- const res = yield this.device.commands.typedCall('EmmcDirList', 'EmmcDir', this.params);
64010
- return Promise.resolve(res.message);
64011
- });
64012
- }
64013
- }
64014
-
64015
- class EmmcDirMake extends BaseMethod {
64016
- init() {
64017
- this.useDevicePassphraseState = false;
64018
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64019
- this.params = {
64020
- path: this.payload.path,
64021
- };
64022
- }
64023
- run() {
64024
- return __awaiter(this, void 0, void 0, function* () {
64025
- const res = yield this.device.commands.typedCall('EmmcDirMake', 'Success', this.params);
64026
- return Promise.resolve(res.message);
64027
- });
64028
- }
64029
- }
64030
-
64031
- class EmmcDirRemove extends BaseMethod {
64032
- init() {
64033
- this.useDevicePassphraseState = false;
64034
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64035
- this.params = {
64036
- path: this.payload.path,
64037
- };
64038
- }
64039
- run() {
64040
- return __awaiter(this, void 0, void 0, function* () {
64041
- const res = yield this.device.commands.typedCall('EmmcDirRemove', 'Success', this.params);
64042
- return Promise.resolve(res.message);
64043
- });
64044
- }
64045
- }
64046
-
64047
- class EmmcFileDelete extends BaseMethod {
64048
- init() {
64049
- this.useDevicePassphraseState = false;
64050
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64051
- this.params = {
64052
- path: this.payload.path,
64053
- };
64054
- }
64055
- run() {
64056
- return __awaiter(this, void 0, void 0, function* () {
64057
- const res = yield this.device.commands.typedCall('EmmcFileDelete', 'Success', this.params);
64058
- return Promise.resolve(res.message);
64059
- });
64060
- }
64061
- }
64062
-
64063
- class EmmcFileRead extends BaseMethod {
64064
- init() {
64065
- this.useDevicePassphraseState = false;
64066
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64067
- this.params = {
64068
- file: this.payload.file,
64069
- ui_percentage: this.payload.ui_percentage,
64070
- };
64071
- }
64072
- run() {
64073
- return __awaiter(this, void 0, void 0, function* () {
64074
- const res = yield this.device.commands.typedCall('EmmcFileRead', 'EmmcFile', this.params);
64075
- return Promise.resolve(res.message);
64076
- });
64077
- }
64078
- }
64079
-
64080
- class EmmcFileWrite extends BaseMethod {
64081
- init() {
64082
- this.useDevicePassphraseState = false;
64083
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64084
- this.params = {
64085
- file: this.payload.file,
64086
- overwrite: this.payload.overwrite,
64087
- append: this.payload.append,
64088
- ui_percentage: this.payload.ui_percentage,
64089
- };
64090
- }
64091
- run() {
64092
- return __awaiter(this, void 0, void 0, function* () {
64093
- const res = yield this.device.commands.typedCall('EmmcFileWrite', 'EmmcFile', this.params);
64094
- return Promise.resolve(res.message);
64095
- });
64096
- }
64097
- }
64098
-
64099
- class EmmcFixPermission extends BaseMethod {
64100
- init() {
64101
- this.useDevicePassphraseState = false;
64102
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64103
- }
64104
- run() {
64105
- return __awaiter(this, void 0, void 0, function* () {
64106
- const res = yield this.device.commands.typedCall('EmmcFixPermission', 'Success');
64107
- return Promise.resolve(res.message);
64108
- });
64109
- }
64110
- }
64111
-
64112
- class EmmcPathInfo extends BaseMethod {
64113
- init() {
64114
- this.useDevicePassphraseState = false;
64115
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64116
- this.params = {
64117
- path: this.payload.path,
64118
- };
64119
- }
64120
- run() {
64121
- return __awaiter(this, void 0, void 0, function* () {
64122
- const res = yield this.device.commands.typedCall('EmmcPathInfo', 'EmmcFile');
64123
- return Promise.resolve(res.message);
64124
- });
64125
- }
64126
- }
64127
-
64128
- class DebugLinkDecision extends BaseMethod {
64129
- init() {
64130
- this.useDevicePassphraseState = false;
64131
- this.params = {
64132
- yes_no: this.payload.yes_no,
64133
- swipe: this.payload.swipe,
64134
- input: this.payload.input,
64135
- x: this.payload.x,
64136
- y: this.payload.y,
64137
- wait: this.payload.wait,
64138
- hold_ms: this.payload.hold_ms,
64139
- };
64140
- }
64141
- run() {
64142
- return __awaiter(this, void 0, void 0, function* () {
64143
- const res = yield this.device.commands.typedCall('DebugLinkDecision', 'Success', this.params);
64144
- return Promise.resolve(res.message);
64145
- });
64146
- }
64147
- }
64148
-
64149
- class DebugLinkEraseSdCard extends BaseMethod {
64150
- init() {
64151
- this.useDevicePassphraseState = false;
64152
- this.params = {
64153
- format: this.payload.format,
64154
- };
64155
- }
64156
- run() {
64157
- return __awaiter(this, void 0, void 0, function* () {
64158
- const res = yield this.device.commands.typedCall('DebugLinkEraseSdCard', 'Success', this.params);
64159
- return Promise.resolve(res.message);
64160
- });
64161
- }
64162
- }
64163
-
64164
- class DebugLinkFlashErase extends BaseMethod {
64165
- init() {
64166
- this.useDevicePassphraseState = false;
64167
- this.params = {
64168
- sector: this.payload.sector,
64169
- };
64170
- }
64171
- run() {
64172
- return __awaiter(this, void 0, void 0, function* () {
64173
- const res = yield this.device.commands.typedCall('DebugLinkFlashErase', 'DebugLinkLayout', this.params);
64174
- return Promise.resolve(res.message);
64175
- });
64176
- }
64177
- }
64178
-
64179
- class DebugLinkGetState extends BaseMethod {
64180
- init() {
64181
- this.useDevicePassphraseState = false;
64182
- this.params = {};
64183
- }
64184
- run() {
64185
- return __awaiter(this, void 0, void 0, function* () {
64186
- const res = yield this.device.commands.typedCall('DebugLinkGetState', 'DebugLinkLog', this.params);
64187
- return Promise.resolve(res.message);
64188
- });
64189
- }
64190
- }
64191
-
64192
- class DebugLinkMemoryRead extends BaseMethod {
64193
- init() {
64194
- this.useDevicePassphraseState = false;
64195
- this.params = {
64196
- address: this.payload.address,
64197
- length: this.payload.length,
64198
- };
64199
- }
64200
- run() {
64201
- return __awaiter(this, void 0, void 0, function* () {
64202
- const res = yield this.device.commands.typedCall('DebugLinkMemoryRead', 'DebugLinkMemory', this.params);
64203
- return Promise.resolve(res.message);
64204
- });
64205
- }
64206
- }
64207
-
64208
- class DebugLinkMemoryWrite extends BaseMethod {
64209
- init() {
64210
- this.useDevicePassphraseState = false;
64211
- this.params = {
64212
- address: this.payload.address,
64213
- memory: this.payload.memory,
64214
- flash: this.payload.flash,
64215
- };
64216
- }
64217
- run() {
64218
- return __awaiter(this, void 0, void 0, function* () {
64219
- const res = yield this.device.commands.typedCall('DebugLinkMemoryWrite', 'Success', this.params);
64220
- return Promise.resolve(res.message);
64221
- });
64222
- }
64223
- }
64224
-
64225
- class DebugLinkRecordScreen extends BaseMethod {
64226
- init() {
64227
- this.useDevicePassphraseState = false;
64228
- this.params = {
64229
- target_directory: this.payload.target_directory,
64230
- };
64231
- }
64232
- run() {
64233
- return __awaiter(this, void 0, void 0, function* () {
64234
- const res = yield this.device.commands.typedCall('DebugLinkRecordScreen', 'Success', this.params);
64235
- return Promise.resolve(res.message);
64236
- });
64237
- }
64238
- }
64239
-
64240
- class DebugLinkReseedRandom extends BaseMethod {
64241
- init() {
64242
- this.useDevicePassphraseState = false;
64243
- this.params = {
64244
- value: this.payload.value,
64245
- };
64246
- }
64247
- run() {
64248
- return __awaiter(this, void 0, void 0, function* () {
64249
- const res = yield this.device.commands.typedCall('DebugLinkReseedRandom', 'Success', this.params);
64250
- return Promise.resolve(res.message);
64251
- });
64252
- }
64253
- }
64254
-
64255
- class DebugLinkStop extends BaseMethod {
64256
- init() {
64257
- this.useDevicePassphraseState = false;
64258
- this.params = {
64259
- wait_word_list: this.payload.wait_word_list,
64260
- wait_word_pos: this.payload.wait_word_pos,
64261
- wait_layout: this.payload.wait_layout,
64262
- };
64263
- }
64264
- run() {
64265
- return __awaiter(this, void 0, void 0, function* () {
64266
- const res = yield this.device.commands.typedCall('DebugLinkGetState', 'DebugLinkState', this.params);
64267
- return Promise.resolve(res.message);
64268
- });
64269
- }
64270
- }
64271
-
64272
- class DebugLinkWatchLayout extends BaseMethod {
64273
- init() {
64274
- this.useDevicePassphraseState = false;
64275
- this.params = {
64276
- watch: this.payload.watch,
64277
- };
64278
- }
64279
- run() {
64280
- return __awaiter(this, void 0, void 0, function* () {
64281
- const res = yield this.device.commands.typedCall('DebugLinkWatchLayout', 'Success', this.params);
64282
- return Promise.resolve(res.message);
64283
- });
64284
- }
64285
- }
64286
-
64287
- class FirmwareErase extends BaseMethod {
64288
- init() {
64289
- this.useDevicePassphraseState = false;
64290
- this.skipForceUpdateCheck = true;
64291
- }
64292
- run() {
64293
- return __awaiter(this, void 0, void 0, function* () {
64294
- return this.device.getCommands().typedCall('FirmwareErase', 'Success');
64295
- });
64296
- }
64297
- }
64298
-
64299
- class FirmwareEraseEx extends BaseMethod {
64300
- init() {
64301
- this.useDevicePassphraseState = false;
64302
- this.skipForceUpdateCheck = true;
64303
- }
64304
- run() {
64305
- return __awaiter(this, void 0, void 0, function* () {
64306
- return this.device.getCommands().typedCall('FirmwareErase_ex', 'Success');
64307
- });
64308
- }
64309
- }
64310
-
64311
- class FirmwareUpdateEmmcTest extends BaseMethod {
64312
- init() {
64313
- this.useDevicePassphraseState = false;
64314
- this.skipForceUpdateCheck = true;
64315
- this.params = {
64316
- path: this.payload.path,
64317
- reboot_on_success: this.payload.reboot_on_success,
64318
- };
64319
- }
64320
- run() {
64321
- return __awaiter(this, void 0, void 0, function* () {
64322
- return this.device.getCommands().typedCall('FirmwareUpdateEmmc', 'Success', this.params);
64323
- });
64324
- }
64325
- }
64326
-
64327
- class FirmwareUploadTest extends BaseMethod {
64328
- init() {
64329
- this.useDevicePassphraseState = false;
64330
- this.skipForceUpdateCheck = true;
64331
- this.params = {
64332
- payload: new ArrayBuffer(0),
64333
- };
64334
- }
64335
- run() {
64336
- return __awaiter(this, void 0, void 0, function* () {
64337
- return this.device.getCommands().typedCall('FirmwareUpload', 'Success', this.params);
64338
- });
64339
- }
64340
- }
64341
-
64342
- class Reboot extends BaseMethod {
64343
- init() {
64344
- this.useDevicePassphraseState = false;
64345
- this.skipForceUpdateCheck = true;
64346
- this.params = {
64347
- reboot_type: this.payload.reboot_type,
64348
- };
64349
- }
64350
- run() {
64351
- return __awaiter(this, void 0, void 0, function* () {
64352
- return this.device.getCommands().typedCall('Reboot', 'Success', this.params);
64353
- });
64354
- }
64355
- }
64356
-
64357
- class SelfTest extends BaseMethod {
64358
- init() {
64359
- this.useDevicePassphraseState = false;
64360
- this.skipForceUpdateCheck = true;
64361
- this.params = {
64362
- payload: this.payload.payload,
64363
- };
64364
- }
64365
- run() {
64366
- return __awaiter(this, void 0, void 0, function* () {
64367
- return this.device.getCommands().typedCall('SelfTest', 'Success', this.params);
64368
- });
64369
- }
64370
- }
64371
-
64372
- class TezosGetAddress extends BaseMethod {
64373
- constructor() {
64374
- super(...arguments);
64375
- this.hasBundle = false;
64376
- }
64377
- init() {
64378
- var _a;
64379
- this.checkDeviceId = true;
64380
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64381
- this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
64382
- const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
64383
- validateParams(payload, [{ name: 'bundle', type: 'array' }]);
64384
- this.params = [];
64385
- payload.bundle.forEach((batch) => {
64386
- var _a;
64387
- const addressN = validatePath(batch.path, 3);
64388
- validateParams(batch, [
64389
- { name: 'path', required: true },
64390
- { name: 'showOnOneKey', type: 'boolean' },
64391
- ]);
64392
- const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
64393
- this.params.push({
64394
- address_n: addressN,
64395
- show_display: showOnOneKey,
64396
- });
64397
- });
64398
- }
64399
- run() {
64400
- return __awaiter(this, void 0, void 0, function* () {
64401
- const responses = [];
64402
- for (let i = 0; i < this.params.length; i++) {
64403
- const param = this.params[i];
64404
- const res = yield this.device.commands.typedCall('TezosGetAddress', 'TezosAddress', Object.assign({}, param));
64405
- const { address } = res.message;
64406
- const result = {
64407
- path: serializedPath(param.address_n),
64408
- address,
64409
- };
64410
- responses.push(result);
64411
- this.postPreviousAddressMessage(result);
64412
- }
64413
- return Promise.resolve(this.hasBundle ? responses : responses[0]);
64414
- });
64415
- }
64416
- }
64417
-
64418
- class TezosGetPublicKey extends BaseMethod {
64419
- constructor() {
64420
- super(...arguments);
64421
- this.hasBundle = false;
64422
- }
64423
- init() {
64424
- var _a;
64425
- this.checkDeviceId = true;
64426
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64427
- this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
64428
- const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
64429
- validateParams(payload, [{ name: 'bundle', type: 'array' }]);
64430
- this.params = [];
64431
- payload.bundle.forEach((batch) => {
64432
- var _a;
64433
- const addressN = validatePath(batch.path, 3);
64434
- validateParams(batch, [
64435
- { name: 'path', required: true },
64436
- { name: 'showOnOneKey', type: 'boolean' },
64437
- ]);
64438
- const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
64439
- this.params.push({
64440
- address_n: addressN,
64441
- show_display: showOnOneKey,
64442
- });
64443
- });
64444
- }
64445
- run() {
64446
- return __awaiter(this, void 0, void 0, function* () {
64447
- const responses = [];
64448
- for (let i = 0; i < this.params.length; i++) {
64449
- const param = this.params[i];
64450
- const res = yield this.device.commands.typedCall('TezosGetPublicKey', 'TezosPublicKey', Object.assign({}, param));
64451
- const { public_key } = res.message;
64452
- const result = {
64453
- path: serializedPath(param.address_n),
64454
- public_key,
64455
- };
64456
- responses.push(result);
64457
- this.postPreviousAddressMessage(result);
64458
- }
64459
- return Promise.resolve(this.hasBundle ? responses : responses[0]);
64460
- });
64461
- }
64462
- }
64463
-
64464
- class TezosSignTx extends BaseMethod {
64465
- init() {
64466
- this.checkDeviceId = true;
64467
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64468
- const { path } = this.payload;
64469
- const addressN = validatePath(path, 3);
64470
- this.params = {
64471
- address_n: addressN,
64472
- branch: new Uint8Array(4),
64473
- reveal: this.payload.reveal,
64474
- transaction: this.payload.transaction,
64475
- origination: this.payload.origination,
64476
- delegation: this.payload.delegation,
64477
- proposal: this.payload.proposal,
64478
- ballot: this.payload.ballot,
64479
- };
64480
- }
64481
- getVersionRange() {
64482
- return {
64483
- model_mini: {
64484
- min: '2.5.0',
64485
- },
64486
- };
64487
- }
64488
- run() {
64489
- return __awaiter(this, void 0, void 0, function* () {
64490
- const res = yield this.device.commands.typedCall('TezosSignTx', 'TezosSignedTx', Object.assign({}, this.params));
64491
- return Promise.resolve(res.message);
64492
- });
64493
- }
64494
- }
64495
-
64496
- class MoneroGetAddress extends BaseMethod {
64497
- constructor() {
64498
- super(...arguments);
64499
- this.hasBundle = false;
64500
- }
64501
- init() {
64502
- var _a;
64503
- this.checkDeviceId = true;
64504
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64505
- this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
64506
- const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
64507
- validateParams(payload, [{ name: 'bundle', type: 'array' }]);
64508
- this.params = [];
64509
- payload.bundle.forEach((batch) => {
64510
- var _a;
64511
- const addressN = validatePath(batch.path, 3);
64512
- validateParams(batch, [
64513
- { name: 'path', required: true },
64514
- { name: 'showOnOneKey', type: 'boolean' },
64515
- ]);
64516
- const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
64517
- this.params.push({
64518
- address_n: addressN,
64519
- show_display: showOnOneKey,
64520
- });
64521
- });
64522
- }
64523
- run() {
64524
- return __awaiter(this, void 0, void 0, function* () {
64525
- const responses = [];
64526
- for (let i = 0; i < this.params.length; i++) {
64527
- const param = this.params[i];
64528
- const res = yield this.device.commands.typedCall('MoneroGetAddress', 'MoneroAddress', Object.assign({}, param));
64529
- const { address } = res.message;
64530
- const result = {
64531
- path: serializedPath(param.address_n),
64532
- address,
64533
- };
64534
- responses.push(result);
64535
- this.postPreviousAddressMessage(result);
64536
- }
64537
- return Promise.resolve(this.hasBundle ? responses : responses[0]);
64538
- });
64539
- }
64540
- }
64541
-
64542
- class MoneroGetWatchKey extends BaseMethod {
64543
- constructor() {
64544
- super(...arguments);
64545
- this.hasBundle = false;
64546
- }
64547
- init() {
64548
- var _a;
64549
- this.checkDeviceId = true;
64550
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64551
- this.hasBundle = !!((_a = this.payload) === null || _a === void 0 ? void 0 : _a.bundle);
64552
- const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
64553
- validateParams(payload, [{ name: 'bundle', type: 'array' }]);
64554
- this.params = [];
64555
- payload.bundle.forEach((batch) => {
64556
- const addressN = validatePath(batch.path, 3);
64557
- const { network_type } = batch;
64558
- this.params.push({
64559
- address_n: addressN,
64560
- network_type,
64561
- });
64562
- });
64563
- }
64564
- run() {
64565
- return __awaiter(this, void 0, void 0, function* () {
64566
- const responses = [];
64567
- for (let i = 0; i < this.params.length; i++) {
64568
- const param = this.params[i];
64569
- const res = yield this.device.commands.typedCall('MoneroGetWatchKey', 'MoneroWatchKey', Object.assign({}, param));
64570
- const { address, watch_key } = res.message;
64571
- const result = {
64572
- path: serializedPath(param.address_n),
64573
- address,
64574
- watch_key,
64575
- };
64576
- responses.push(result);
64577
- this.postPreviousAddressMessage(result);
64578
- }
64579
- return Promise.resolve(this.hasBundle ? responses : responses[0]);
64580
- });
64581
- }
64582
- }
64583
-
64584
- class EosGetPublicKey extends BaseMethod {
64585
- constructor() {
64586
- super(...arguments);
64587
- this.hasBundle = false;
64588
- }
64589
- init() {
64590
- var _a;
64591
- this.checkDeviceId = true;
64592
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64593
- this.params = {
64594
- address_n: validatePath(this.payload.path, 3),
64595
- show_display: (_a = this.payload.showOnOneKey) !== null && _a !== void 0 ? _a : true,
64596
- };
64597
- }
64598
- run() {
64599
- return __awaiter(this, void 0, void 0, function* () {
64600
- return this.device.commands.typedCall('EosGetPublicKey', 'EosPublicKey', Object.assign({}, this.params));
64601
- });
64602
- }
64603
- }
64604
-
64605
- class EosSignTx extends BaseMethod {
64606
- init() {
64607
- this.checkDeviceId = true;
64608
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64609
- const { path } = this.payload;
64610
- const addressN = validatePath(path, 3);
64611
- this.params = {
64612
- address_n: addressN,
64613
- chain_id: this.payload.chain_id,
64614
- header: this.payload.header,
64615
- num_actions: this.payload.num_actions,
64616
- };
64617
- }
64618
- getVersionRange() {
64619
- return {
64620
- model_mini: {
64621
- min: '2.5.0',
64622
- },
64623
- };
64624
- }
64625
- run() {
64626
- return __awaiter(this, void 0, void 0, function* () {
64627
- const res = yield this.device.commands.typedCall('EosSignTx', 'EosTxActionRequest', Object.assign({}, this.params));
64628
- return Promise.resolve(res.message);
64629
- });
64630
- }
64631
- }
64632
-
64633
- class BinanceGetAddress extends BaseMethod {
64634
- constructor() {
64635
- super(...arguments);
64636
- this.hasBundle = false;
64637
- }
64638
- init() {
64639
- var _a;
64640
- this.checkDeviceId = true;
64641
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64642
- this.params = {
64643
- address_n: validatePath(this.payload.path, 3),
64644
- show_display: (_a = this.payload.showOnOneKey) !== null && _a !== void 0 ? _a : true,
64645
- };
64646
- }
64647
- run() {
64648
- return __awaiter(this, void 0, void 0, function* () {
64649
- return this.device.commands.typedCall('BinanceGetAddress', 'BinanceAddress', Object.assign({}, this.params));
64650
- });
64651
- }
64652
- }
64653
-
64654
- class BinanceGetPublicKey extends BaseMethod {
64655
- constructor() {
64656
- super(...arguments);
64657
- this.hasBundle = false;
64658
- }
64659
- init() {
64660
- var _a;
64661
- this.checkDeviceId = true;
64662
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64663
- this.params = {
64664
- address_n: validatePath(this.payload.path, 3),
64665
- show_display: (_a = this.payload.showOnOneKey) !== null && _a !== void 0 ? _a : true,
64666
- };
64667
- }
64668
- run() {
64669
- return __awaiter(this, void 0, void 0, function* () {
64670
- return this.device.commands.typedCall('BinanceGetPublicKey', 'BinancePublicKey', Object.assign({}, this.params));
64671
- });
64672
- }
64673
- }
64674
-
64675
- class BinanceSignTx extends BaseMethod {
64676
- init() {
64677
- this.checkDeviceId = true;
64678
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
64679
- const { path } = this.payload;
64680
- const addressN = validatePath(path, 3);
64681
- this.params = {
64682
- address_n: addressN,
64683
- msg_count: this.payload.msg_count,
64684
- account_number: this.payload.account_number,
64685
- chain_id: this.payload.chain_id,
64686
- memo: this.payload.memo,
64687
- sequence: this.payload.sequence,
64688
- source: this.payload.source,
64689
- };
64690
- }
64691
- run() {
64692
- return __awaiter(this, void 0, void 0, function* () {
64693
- const res = yield this.device.commands.typedCall('BinanceSignTx', 'BinanceTxRequest', Object.assign({}, this.params));
64694
- return Promise.resolve(res.message);
64695
- });
64696
- }
64697
- }
64698
-
64699
- class WebAuthnAddResidentCredential extends BaseMethod {
64700
- constructor() {
64701
- super(...arguments);
64702
- this.hasBundle = false;
64703
- }
64704
- init() {
64705
- this.checkDeviceId = true;
64706
- this.params = {
64707
- credential_id: this.payload.credential_id,
64708
- };
64709
- }
64710
- run() {
64711
- return __awaiter(this, void 0, void 0, function* () {
64712
- return this.device.commands.typedCall('WebAuthnAddResidentCredential', 'Success', Object.assign({}, this.params));
64713
- });
64714
- }
64715
- }
64716
-
64717
- class WebAuthnListResidentCredentials extends BaseMethod {
64718
- constructor() {
64719
- super(...arguments);
64720
- this.hasBundle = false;
64721
- }
64722
- init() {
64723
- this.checkDeviceId = true;
64724
- this.params = {};
64725
- }
64726
- run() {
64727
- return __awaiter(this, void 0, void 0, function* () {
64728
- return this.device.commands.typedCall('WebAuthnListResidentCredentials', 'WebAuthnCredentials', Object.assign({}, this.params));
64729
- });
64730
- }
64731
- }
64732
-
64733
- class WebAuthnRemoveResidentCredential extends BaseMethod {
64734
- constructor() {
64735
- super(...arguments);
64736
- this.hasBundle = false;
64737
- }
64738
- init() {
64739
- this.checkDeviceId = true;
64740
- this.params = {
64741
- index: this.payload.index,
64742
- };
64743
- }
64744
- run() {
64745
- return __awaiter(this, void 0, void 0, function* () {
64746
- return this.device.commands.typedCall('WebAuthnRemoveResidentCredential', 'Success', Object.assign({}, this.params));
64747
- });
64748
- }
64749
- }
64750
-
64751
- class GetPublicKeyMultiple extends BaseMethod {
64752
- init() {
64753
- this.useDevicePassphraseState = false;
64754
- this.params = {
64755
- addresses: this.payload.addresses,
64756
- ecdsa_curve_name: this.payload.ecdsa_curve_name,
64757
- show_display: this.payload.show_display,
64758
- coin_name: this.payload.coin_name,
64759
- script_type: this.payload.script_type,
64760
- ignore_xpub_magic: this.payload.ignore_xpub_magic,
64761
- };
64762
- }
64763
- run() {
64764
- return __awaiter(this, void 0, void 0, function* () {
64765
- const res = yield this.device.commands.typedCall('GetPublicKeyMultiple', 'PublicKeyMultiple');
64766
- return Promise.resolve(res.message);
64767
- });
64768
- }
64769
- }
64770
-
64771
- class ListResDir extends BaseMethod {
64772
- init() {
64773
- this.useDevicePassphraseState = false;
64774
- this.params = {
64775
- path: this.payload.path,
64776
- };
64777
- }
64778
- run() {
64779
- return __awaiter(this, void 0, void 0, function* () {
64780
- const res = yield this.device.commands.typedCall('ListResDir', 'FileInfoList');
64781
- return Promise.resolve(res.message);
64782
- });
64783
- }
64784
- }
64785
-
64786
- class NFTWriteData extends BaseMethod {
64787
- init() {
64788
- this.useDevicePassphraseState = false;
64789
- this.params = {
64790
- index: this.payload.index,
64791
- data: this.payload.data,
64792
- offset: this.payload.offset,
64793
- };
64794
- }
64795
- run() {
64796
- return __awaiter(this, void 0, void 0, function* () {
64797
- const res = yield this.device.commands.typedCall('NFTWriteData', 'Success');
64798
- return Promise.resolve(res.message);
64799
- });
64800
- }
64801
- }
64802
-
64803
- class NFTWriteInfo extends BaseMethod {
64804
- init() {
64805
- this.useDevicePassphraseState = false;
64806
- this.params = {
64807
- index: this.payload.index,
64808
- width: this.payload.width,
64809
- height: this.payload.height,
64810
- name_zh: this.payload.name_zh,
64811
- name_en: this.payload.name_en,
64812
- };
64813
- }
64814
- run() {
64815
- return __awaiter(this, void 0, void 0, function* () {
64816
- const res = yield this.device.commands.typedCall('NFTWriteInfo', 'Success');
64817
- return Promise.resolve(res.message);
64818
- });
64819
- }
64820
- }
64821
-
64822
- class ReadSEPublicKey extends BaseMethod {
64823
- init() {
64824
- this.useDevicePassphraseState = false;
64825
- this.skipForceUpdateCheck = true;
64826
- this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.BOOTLOADER];
64827
- this.params = {};
64828
- }
64829
- run() {
64830
- return __awaiter(this, void 0, void 0, function* () {
64831
- const res = yield this.device.commands.typedCall('ReadSEPublicKey', 'SEPublicKey');
64832
- return Promise.resolve(res.message);
64833
- });
64834
- }
64835
- }
64836
-
64837
- class ResourceUpdate extends BaseMethod {
64838
- init() {
64839
- this.useDevicePassphraseState = false;
64840
- this.params = {
64841
- name: this.payload.name,
64842
- data: this.payload.data,
64843
- };
64844
- }
64845
- run() {
64846
- return __awaiter(this, void 0, void 0, function* () {
64847
- yield updateResource(this.device.commands.typedCall.bind(this.device.commands), this.payload.name, this.payload.data);
64848
- return Promise.resolve(true);
64849
- });
64850
- }
64851
- }
64852
-
64853
- class DeviceBackup extends BaseMethod {
64854
- init() {
64855
- this.useDevicePassphraseState = false;
64856
- }
64857
- run() {
64858
- return __awaiter(this, void 0, void 0, function* () {
64859
- const res = yield this.device.commands.typedCall('BixinBackupDevice', 'Success');
64860
- return Promise.resolve(res.message);
64861
- });
64862
- }
64863
- }
64864
-
64865
- class BixinLoadDevice extends BaseMethod {
64866
- init() {
64867
- this.useDevicePassphraseState = false;
64868
- this.params = {
64869
- mnemonics: this.payload.mnemonics,
64870
- language: this.payload.language,
64871
- label: this.payload.label,
64872
- skip_checksum: this.payload.skip_checksum,
64873
- };
64874
- }
64875
- run() {
64876
- return __awaiter(this, void 0, void 0, function* () {
64877
- const res = yield this.device.commands.typedCall('BixinLoadDevice', 'Success', this.params);
64878
- return Promise.resolve(res.message);
64879
- });
64880
- }
64881
- }
64882
-
64883
- class BixinMessageSE extends BaseMethod {
64884
- constructor() {
64885
- super(...arguments);
64886
- this.hasBundle = false;
64887
- }
64888
- init() {
64889
- this.checkDeviceId = true;
64890
- this.params = {
64891
- inputmessage: this.payload.inputmessage,
64892
- };
64893
- }
64894
- run() {
64895
- return __awaiter(this, void 0, void 0, function* () {
64896
- return this.device.commands.typedCall('BixinMessageSE', 'BixinOutMessageSE', Object.assign({}, this.params));
64897
- });
64898
- }
64899
- }
64900
-
64901
- class BixinVerifyDeviceRequest extends BaseMethod {
64902
- constructor() {
64903
- super(...arguments);
64904
- this.hasBundle = false;
64905
- }
64906
- init() {
64907
- this.checkDeviceId = true;
64908
- this.params = {
64909
- data: this.payload.data,
64910
- };
64911
- }
64912
- run() {
64913
- return __awaiter(this, void 0, void 0, function* () {
64914
- return this.device.commands.typedCall('BixinVerifyDeviceRequest', 'BixinVerifyDeviceAck', Object.assign({}, this.params));
64915
- });
64916
- }
64917
- }
64918
-
64919
- var TestMethods = /*#__PURE__*/Object.freeze({
64920
- __proto__: null,
64921
- btcGetOwnershipId: BTCGetOwnershipId,
64922
- btcGetOwnershipProof: BTCGetOwnershipProof,
64923
- btcAuthorizeCoinJoin: BTCAuthorizeCoinJoin,
64924
- cryptoBatchGetPublickeys: CryptoBatchGetPublickeys,
64925
- cryptoCipherKeyValue: CryptoCipherKeyValue,
64926
- cryptoCosiCommit: CryptoCosiCommit,
64927
- cryptoCosiSign: CryptoCosiSign,
64928
- cryptoGetECDHSessionKey: CryptoGetECDHSessionKey,
64929
- cryptoSignIdentity: CryptoSignIdentity,
64930
- evmGetAddressTrezor: EvmGetAddress,
64931
- evmGetPublicKeyTrezor: EVMGetPublicKey,
64932
- evmSignMessageTrezor: EVMSignMessage$1,
64933
- evmSignTransactionTrezor: EVMSignTransaction,
64934
- evmSignTypedDataTrezor: EVMSignTypedData,
64935
- evmVerifyMessageTrezor: EVMSignMessage,
64936
- nemDecryptMessage: NEMDecryptMessage,
64937
- deviceSpiFlashWrite: DeviceSpiFlashWrite,
64938
- deviceSpiFlashRead: DeviceSpiFlashRead,
64939
- deviceInfoSettings: DeviceInfoSettings,
64940
- deviceGetInfo: GetDeviceInfoSettings,
64941
- deviceReadSEPublicCert: DeviceReadSEPublicCert,
64942
- deviceWriteSEPrivateKey: DeviceWriteSEPrivateKey,
64943
- deviceWriteSEPublicCert: DeviceWriteSEPublicCert,
64944
- deviceSESignMessage: DeviceSESignMessage,
64945
- devicePing: DevicePing,
64946
- deviceGetEntropy: DeviceGetEntropy,
64947
- deviceGetFirmwareHash: DeviceGetFirmwareHash,
64948
- deviceUnlockPath: DeviceUnlockPath,
64949
- deviceSdProtect: DeviceSdProtect,
64950
- deviceChangeWipeCode: DeviceChangeWipeCode,
64951
- deviceEndSession: DeviceEndSession,
64952
- deviceLoad: DeviceLoad,
64953
- deviceDoPreauthorized: DeviceDoPreauthorized,
64954
- deviceCancelAuthorization: DeviceCancelAuthorization,
64955
- emmcDirList: EmmcDirList,
64956
- emmcDirMake: EmmcDirMake,
64957
- emmcDirRemove: EmmcDirRemove,
64958
- emmcFileDelete: EmmcFileDelete,
64959
- emmcFileRead: EmmcFileRead,
64960
- emmcFileWrite: EmmcFileWrite,
64961
- emmcFixPermission: EmmcFixPermission,
64962
- emmcPathInfo: EmmcPathInfo,
64963
- debugLinkDecision: DebugLinkDecision,
64964
- debugLinkEraseSdCard: DebugLinkEraseSdCard,
64965
- debugLinkFlashErase: DebugLinkFlashErase,
64966
- debugLinkGetState: DebugLinkGetState,
64967
- debugLinkMemoryRead: DebugLinkMemoryRead,
64968
- debugLinkMemoryWrite: DebugLinkMemoryWrite,
64969
- debugLinkRecordScreen: DebugLinkRecordScreen,
64970
- debugLinkReseedRandom: DebugLinkReseedRandom,
64971
- debugLinkStop: DebugLinkStop,
64972
- debugLinkWatchLayout: DebugLinkWatchLayout,
64973
- firmwareErase: FirmwareErase,
64974
- firmwareEraseEx: FirmwareEraseEx,
64975
- firmwareUpdateEmmcTest: FirmwareUpdateEmmcTest,
64976
- firmwareUploadTest: FirmwareUploadTest,
64977
- reboot: Reboot,
64978
- selfTest: SelfTest,
64979
- tezosGetAddress: TezosGetAddress,
64980
- tezosGetPublicKey: TezosGetPublicKey,
64981
- tezosSignTx: TezosSignTx,
64982
- moneroGetAddress: MoneroGetAddress,
64983
- moneroGetWatchKey: MoneroGetWatchKey,
64984
- eosGetPublicKey: EosGetPublicKey,
64985
- eosSignTx: EosSignTx,
64986
- binanceGetAddress: BinanceGetAddress,
64987
- binanceGetPublicKey: BinanceGetPublicKey,
64988
- binanceSignTx: BinanceSignTx,
64989
- webAuthnAddResidentCredential: WebAuthnAddResidentCredential,
64990
- webAuthnListResidentCredentials: WebAuthnListResidentCredentials,
64991
- webAuthnRemoveResidentCredential: WebAuthnRemoveResidentCredential,
64992
- getPublicKeyMultiple: GetPublicKeyMultiple,
64993
- listResDir: ListResDir,
64994
- nftWriteData: NFTWriteData,
64995
- nftWriteInfo: NFTWriteInfo,
64996
- readSEPublicKey: ReadSEPublicKey,
64997
- resourceUpdate: ResourceUpdate,
64998
- bixinBackupDevice: DeviceBackup,
64999
- bixinLoadDevice: BixinLoadDevice,
65000
- bixinMessageSE: BixinMessageSE,
65001
- bixinVerifyDeviceRequest: BixinVerifyDeviceRequest
65002
- });
65003
-
65004
- const testApiMethodExtension = {
65005
- name: 'test-api',
65006
- methods: TestMethods,
65007
- };
65008
- const factoryApiMethodExtension = {
65009
- name: 'factory-api',
65010
- methods: FactoryMethods,
65011
- destructiveMethods: FACTORY_API_METHOD_NAMES,
65012
- };
65013
-
65014
62566
  const HardwareSdk = ({ init, call, dispose, eventEmitter, uiResponse, cancel, updateSettings, switchTransport, }) => inject({
65015
62567
  init,
65016
62568
  call,
@@ -65061,7 +62613,6 @@ exports.DEVICE_SETTINGS_V2_ONLY_FIELDS = DEVICE_SETTINGS_V2_ONLY_FIELDS;
65061
62613
  exports.DataManager = DataManager;
65062
62614
  exports.DeviceModelToTypes = DeviceModelToTypes;
65063
62615
  exports.DeviceTypeToModels = DeviceTypeToModels;
65064
- exports.FACTORY_API_METHOD_NAMES = FACTORY_API_METHOD_NAMES;
65065
62616
  exports.FIRMWARE = FIRMWARE;
65066
62617
  exports.FIRMWARE_EVENT = FIRMWARE_EVENT;
65067
62618
  exports.HardwareSDKLowLevel = HardwareSDKLowLevel;
@@ -65075,7 +62626,6 @@ exports.PRO2_WALLPAPER_HEIGHT = PRO2_WALLPAPER_HEIGHT;
65075
62626
  exports.PRO2_WALLPAPER_WIDTH = PRO2_WALLPAPER_WIDTH;
65076
62627
  exports.PROTOCOL_V2_NEVER_TIMEOUT_MS = PROTOCOL_V2_NEVER_TIMEOUT_MS;
65077
62628
  exports.RESPONSE_EVENT = RESPONSE_EVENT;
65078
- exports.TEST_API_METHOD_NAMES = TEST_API_METHOD_NAMES;
65079
62629
  exports.UI_EVENT = UI_EVENT;
65080
62630
  exports.UI_REQUEST = UI_REQUEST;
65081
62631
  exports.UI_RESPONSE = UI_RESPONSE;
@@ -65087,21 +62637,18 @@ exports.completeRequestContext = completeRequestContext;
65087
62637
  exports.corsValidator = corsValidator;
65088
62638
  exports.createDeviceMessage = createDeviceMessage;
65089
62639
  exports.createErrorMessage = createErrorMessage;
65090
- exports.createFactoryApi = createFactoryApi;
65091
62640
  exports.createFirmwareMessage = createFirmwareMessage;
65092
62641
  exports.createIFrameMessage = createIFrameMessage;
65093
62642
  exports.createLogMessage = createLogMessage;
65094
62643
  exports.createRequestContext = createRequestContext;
65095
62644
  exports.createResponseMessage = createResponseMessage;
65096
62645
  exports.createSdkTracingContext = createSdkTracingContext;
65097
- exports.createTestApi = createTestApi;
65098
62646
  exports.createUiMessage = createUiMessage;
65099
62647
  exports.createUiResponse = createUiResponse;
65100
62648
  exports["default"] = HardwareSdk;
65101
62649
  exports.enableLog = enableLog;
65102
62650
  exports.encodePro2Wallpaper = encodePro2Wallpaper;
65103
62651
  exports.executeCallback = executeCallback;
65104
- exports.factoryApiMethodExtension = factoryApiMethodExtension;
65105
62652
  exports.formatLogMethodLabel = formatLogMethodLabel;
65106
62653
  exports.formatRequestContext = formatRequestContext;
65107
62654
  exports.generateInstanceId = generateInstanceId;
@@ -65154,7 +62701,6 @@ exports.safeThrowError = safeThrowError;
65154
62701
  exports.setLoggerPostMessage = setLoggerPostMessage;
65155
62702
  exports.supportInputPinOnSoftware = supportInputPinOnSoftware;
65156
62703
  exports.switchTransport = switchTransport;
65157
- exports.testApiMethodExtension = testApiMethodExtension;
65158
62704
  exports.updateRequestContext = updateRequestContext;
65159
62705
  exports.versionCompare = versionCompare;
65160
62706
  exports.versionSplit = versionSplit;