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

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 (578) hide show
  1. package/__tests__/device-state-contract.test.ts +1 -0
  2. package/__tests__/device-state-mapper.test.ts +1 -1
  3. package/__tests__/deviceSettings.test.ts +1 -1
  4. package/__tests__/protocol-v2.test.ts +129 -3
  5. package/__tests__/protocolV2FileWrite.test.ts +39 -0
  6. package/__tests__/public-pro2-api-boundary.test.ts +98 -2
  7. package/__tests__/public-test-api-boundary.test.ts +167 -0
  8. package/dist/api/BixinBackupDevice.d.ts +7 -0
  9. package/dist/api/BixinBackupDevice.d.ts.map +1 -0
  10. package/dist/api/BixinLoadDevice.d.ts +7 -0
  11. package/dist/api/BixinLoadDevice.d.ts.map +1 -0
  12. package/dist/api/BixinMessageSE.d.ts +8 -0
  13. package/dist/api/BixinMessageSE.d.ts.map +1 -0
  14. package/dist/api/BixinVerifyDeviceRequest.d.ts +8 -0
  15. package/dist/api/BixinVerifyDeviceRequest.d.ts.map +1 -0
  16. package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
  17. package/dist/api/WebAuthnAddResidentCredential.d.ts +8 -0
  18. package/dist/api/WebAuthnAddResidentCredential.d.ts.map +1 -0
  19. package/dist/api/WebAuthnListResidentCredentials.d.ts +8 -0
  20. package/dist/api/WebAuthnListResidentCredentials.d.ts.map +1 -0
  21. package/dist/api/WebAuthnRemoveResidentCredential.d.ts +8 -0
  22. package/dist/api/WebAuthnRemoveResidentCredential.d.ts.map +1 -0
  23. package/dist/api/binance/BinanceGetAddress.d.ts +8 -0
  24. package/dist/api/binance/BinanceGetAddress.d.ts.map +1 -0
  25. package/dist/api/binance/BinanceGetPublicKey.d.ts +8 -0
  26. package/dist/api/binance/BinanceGetPublicKey.d.ts.map +1 -0
  27. package/dist/api/binance/BinanceSignTx.d.ts +7 -0
  28. package/dist/api/binance/BinanceSignTx.d.ts.map +1 -0
  29. package/dist/api/btc/BTCAuthorizeCoinJoin.d.ts +7 -0
  30. package/dist/api/btc/BTCAuthorizeCoinJoin.d.ts.map +1 -0
  31. package/dist/api/btc/BTCGetOwnershipId.d.ts +7 -0
  32. package/dist/api/btc/BTCGetOwnershipId.d.ts.map +1 -0
  33. package/dist/api/btc/BTCGetOwnershipProof.d.ts +7 -0
  34. package/dist/api/btc/BTCGetOwnershipProof.d.ts.map +1 -0
  35. package/dist/api/crypto/CryptoBatchGetPublickeys.d.ts +8 -0
  36. package/dist/api/crypto/CryptoBatchGetPublickeys.d.ts.map +1 -0
  37. package/dist/api/crypto/CryptoCipherKeyValue.d.ts +8 -0
  38. package/dist/api/crypto/CryptoCipherKeyValue.d.ts.map +1 -0
  39. package/dist/api/crypto/CryptoCosiCommit.d.ts +8 -0
  40. package/dist/api/crypto/CryptoCosiCommit.d.ts.map +1 -0
  41. package/dist/api/crypto/CryptoCosiSign.d.ts +8 -0
  42. package/dist/api/crypto/CryptoCosiSign.d.ts.map +1 -0
  43. package/dist/api/crypto/CryptoGetECDHSessionKey.d.ts +8 -0
  44. package/dist/api/crypto/CryptoGetECDHSessionKey.d.ts.map +1 -0
  45. package/dist/api/crypto/CryptoSignIdentity.d.ts +8 -0
  46. package/dist/api/crypto/CryptoSignIdentity.d.ts.map +1 -0
  47. package/dist/api/debug/DebugLinkDecision.d.ts +7 -0
  48. package/dist/api/debug/DebugLinkDecision.d.ts.map +1 -0
  49. package/dist/api/debug/DebugLinkEraseSdCard.d.ts +7 -0
  50. package/dist/api/debug/DebugLinkEraseSdCard.d.ts.map +1 -0
  51. package/dist/api/debug/DebugLinkFlashErase.d.ts +7 -0
  52. package/dist/api/debug/DebugLinkFlashErase.d.ts.map +1 -0
  53. package/dist/api/debug/DebugLinkGetState.d.ts +7 -0
  54. package/dist/api/debug/DebugLinkGetState.d.ts.map +1 -0
  55. package/dist/api/debug/DebugLinkMemoryRead.d.ts +7 -0
  56. package/dist/api/debug/DebugLinkMemoryRead.d.ts.map +1 -0
  57. package/dist/api/debug/DebugLinkMemoryWrite.d.ts +7 -0
  58. package/dist/api/debug/DebugLinkMemoryWrite.d.ts.map +1 -0
  59. package/dist/api/debug/DebugLinkRecordScreen.d.ts +7 -0
  60. package/dist/api/debug/DebugLinkRecordScreen.d.ts.map +1 -0
  61. package/dist/api/debug/DebugLinkReseedRandom.d.ts +7 -0
  62. package/dist/api/debug/DebugLinkReseedRandom.d.ts.map +1 -0
  63. package/dist/api/debug/DebugLinkStop.d.ts +7 -0
  64. package/dist/api/debug/DebugLinkStop.d.ts.map +1 -0
  65. package/dist/api/debug/DebugLinkWatchLayout.d.ts +7 -0
  66. package/dist/api/debug/DebugLinkWatchLayout.d.ts.map +1 -0
  67. package/dist/api/device/DeviceVerify.d.ts.map +1 -1
  68. package/dist/api/emmc/EmmcDirList.d.ts +7 -0
  69. package/dist/api/emmc/EmmcDirList.d.ts.map +1 -0
  70. package/dist/api/emmc/EmmcDirMake.d.ts +7 -0
  71. package/dist/api/emmc/EmmcDirMake.d.ts.map +1 -0
  72. package/dist/api/emmc/EmmcDirRemove.d.ts +7 -0
  73. package/dist/api/emmc/EmmcDirRemove.d.ts.map +1 -0
  74. package/dist/api/emmc/EmmcFileDelete.d.ts +7 -0
  75. package/dist/api/emmc/EmmcFileDelete.d.ts.map +1 -0
  76. package/dist/api/emmc/EmmcFileRead.d.ts +7 -0
  77. package/dist/api/emmc/EmmcFileRead.d.ts.map +1 -0
  78. package/dist/api/emmc/EmmcFileWrite.d.ts +7 -0
  79. package/dist/api/emmc/EmmcFileWrite.d.ts.map +1 -0
  80. package/dist/api/emmc/EmmcFixPermission.d.ts +7 -0
  81. package/dist/api/emmc/EmmcFixPermission.d.ts.map +1 -0
  82. package/dist/api/emmc/EmmcPathInfo.d.ts +7 -0
  83. package/dist/api/emmc/EmmcPathInfo.d.ts.map +1 -0
  84. package/dist/api/eos/EosGetPublicKey.d.ts +8 -0
  85. package/dist/api/eos/EosGetPublicKey.d.ts.map +1 -0
  86. package/dist/api/eos/EosSignTx.d.ts +12 -0
  87. package/dist/api/eos/EosSignTx.d.ts.map +1 -0
  88. package/dist/api/evmTrezor/EVMGetAddress.d.ts +10 -0
  89. package/dist/api/evmTrezor/EVMGetAddress.d.ts.map +1 -0
  90. package/dist/api/evmTrezor/EVMGetPublicKey.d.ts +16 -0
  91. package/dist/api/evmTrezor/EVMGetPublicKey.d.ts.map +1 -0
  92. package/dist/api/evmTrezor/EVMSignMessage.d.ts +7 -0
  93. package/dist/api/evmTrezor/EVMSignMessage.d.ts.map +1 -0
  94. package/dist/api/evmTrezor/EVMSignTransaction.d.ts +15 -0
  95. package/dist/api/evmTrezor/EVMSignTransaction.d.ts.map +1 -0
  96. package/dist/api/evmTrezor/EVMSignTypedData.d.ts +43 -0
  97. package/dist/api/evmTrezor/EVMSignTypedData.d.ts.map +1 -0
  98. package/dist/api/evmTrezor/EVMVerifyMessage.d.ts +7 -0
  99. package/dist/api/evmTrezor/EVMVerifyMessage.d.ts.map +1 -0
  100. package/dist/api/evmTrezor/legacyV1/getAddress.d.ts +6 -0
  101. package/dist/api/evmTrezor/legacyV1/getAddress.d.ts.map +1 -0
  102. package/dist/api/evmTrezor/legacyV1/getPublicKey.d.ts +6 -0
  103. package/dist/api/evmTrezor/legacyV1/getPublicKey.d.ts.map +1 -0
  104. package/dist/api/evmTrezor/legacyV1/signMessage.d.ts +6 -0
  105. package/dist/api/evmTrezor/legacyV1/signMessage.d.ts.map +1 -0
  106. package/dist/api/evmTrezor/legacyV1/signTransaction.d.ts +9 -0
  107. package/dist/api/evmTrezor/legacyV1/signTransaction.d.ts.map +1 -0
  108. package/dist/api/evmTrezor/legacyV1/signTypedData.d.ts +10 -0
  109. package/dist/api/evmTrezor/legacyV1/signTypedData.d.ts.map +1 -0
  110. package/dist/api/evmTrezor/legacyV1/signTypedHash.d.ts +11 -0
  111. package/dist/api/evmTrezor/legacyV1/signTypedHash.d.ts.map +1 -0
  112. package/dist/api/evmTrezor/legacyV1/verifyMessage.d.ts +6 -0
  113. package/dist/api/evmTrezor/legacyV1/verifyMessage.d.ts.map +1 -0
  114. package/dist/api/extensionMethodNames.d.ts +3 -0
  115. package/dist/api/extensionMethodNames.d.ts.map +1 -0
  116. package/dist/api/factoryMethods.d.ts +3 -0
  117. package/dist/api/factoryMethods.d.ts.map +1 -0
  118. package/dist/api/firmware/FirmwareErase.d.ts +12 -0
  119. package/dist/api/firmware/FirmwareErase.d.ts.map +1 -0
  120. package/dist/api/firmware/FirmwareEraseEx.d.ts +12 -0
  121. package/dist/api/firmware/FirmwareEraseEx.d.ts.map +1 -0
  122. package/dist/api/firmware/FirmwareUpdateEmmcTest.d.ts +7 -0
  123. package/dist/api/firmware/FirmwareUpdateEmmcTest.d.ts.map +1 -0
  124. package/dist/api/firmware/FirmwareUploadTest.d.ts +7 -0
  125. package/dist/api/firmware/FirmwareUploadTest.d.ts.map +1 -0
  126. package/dist/api/firmware/Reboot.d.ts +7 -0
  127. package/dist/api/firmware/Reboot.d.ts.map +1 -0
  128. package/dist/api/firmware/SelfTest.d.ts +7 -0
  129. package/dist/api/firmware/SelfTest.d.ts.map +1 -0
  130. package/dist/api/helpers/protocolV2FileWrite.d.ts.map +1 -1
  131. package/dist/api/index.d.ts +3 -0
  132. package/dist/api/index.d.ts.map +1 -1
  133. package/dist/api/manager/DeviceCancelAuthorization.d.ts +7 -0
  134. package/dist/api/manager/DeviceCancelAuthorization.d.ts.map +1 -0
  135. package/dist/api/manager/DeviceChangeWipeCode.d.ts +7 -0
  136. package/dist/api/manager/DeviceChangeWipeCode.d.ts.map +1 -0
  137. package/dist/api/manager/DeviceDoPreauthorized.d.ts +7 -0
  138. package/dist/api/manager/DeviceDoPreauthorized.d.ts.map +1 -0
  139. package/dist/api/manager/DeviceEndSession.d.ts +7 -0
  140. package/dist/api/manager/DeviceEndSession.d.ts.map +1 -0
  141. package/dist/api/manager/DeviceGetEntropy.d.ts +7 -0
  142. package/dist/api/manager/DeviceGetEntropy.d.ts.map +1 -0
  143. package/dist/api/manager/DeviceGetFirmwareHash.d.ts +7 -0
  144. package/dist/api/manager/DeviceGetFirmwareHash.d.ts.map +1 -0
  145. package/dist/api/manager/DeviceInfoSettings.d.ts +7 -0
  146. package/dist/api/manager/DeviceInfoSettings.d.ts.map +1 -0
  147. package/dist/api/manager/DeviceLoad.d.ts +7 -0
  148. package/dist/api/manager/DeviceLoad.d.ts.map +1 -0
  149. package/dist/api/manager/DevicePing.d.ts +7 -0
  150. package/dist/api/manager/DevicePing.d.ts.map +1 -0
  151. package/dist/api/manager/DeviceReadSEPublicCert.d.ts +7 -0
  152. package/dist/api/manager/DeviceReadSEPublicCert.d.ts.map +1 -0
  153. package/dist/api/manager/DeviceSESignMessage.d.ts +7 -0
  154. package/dist/api/manager/DeviceSESignMessage.d.ts.map +1 -0
  155. package/dist/api/manager/DeviceSdProtect.d.ts +7 -0
  156. package/dist/api/manager/DeviceSdProtect.d.ts.map +1 -0
  157. package/dist/api/manager/DeviceSpiFlashRead.d.ts +7 -0
  158. package/dist/api/manager/DeviceSpiFlashRead.d.ts.map +1 -0
  159. package/dist/api/manager/DeviceSpiFlashWrite.d.ts +7 -0
  160. package/dist/api/manager/DeviceSpiFlashWrite.d.ts.map +1 -0
  161. package/dist/api/manager/DeviceUnlockPath.d.ts +7 -0
  162. package/dist/api/manager/DeviceUnlockPath.d.ts.map +1 -0
  163. package/dist/api/manager/DeviceWriteSEPrivateKey.d.ts +7 -0
  164. package/dist/api/manager/DeviceWriteSEPrivateKey.d.ts.map +1 -0
  165. package/dist/api/manager/DeviceWriteSEPublicCert.d.ts +7 -0
  166. package/dist/api/manager/DeviceWriteSEPublicCert.d.ts.map +1 -0
  167. package/dist/api/manager/GetDeviceInfoSettings.d.ts +7 -0
  168. package/dist/api/manager/GetDeviceInfoSettings.d.ts.map +1 -0
  169. package/dist/api/manager/GetPublicKeyMultiple.d.ts +7 -0
  170. package/dist/api/manager/GetPublicKeyMultiple.d.ts.map +1 -0
  171. package/dist/api/manager/ListResDir.d.ts +7 -0
  172. package/dist/api/manager/ListResDir.d.ts.map +1 -0
  173. package/dist/api/manager/NFTWriteData.d.ts +7 -0
  174. package/dist/api/manager/NFTWriteData.d.ts.map +1 -0
  175. package/dist/api/manager/NFTWriteInfo.d.ts +7 -0
  176. package/dist/api/manager/NFTWriteInfo.d.ts.map +1 -0
  177. package/dist/api/manager/ReadSEPublicKey.d.ts +7 -0
  178. package/dist/api/manager/ReadSEPublicKey.d.ts.map +1 -0
  179. package/dist/api/manager/ResourceUpdate.d.ts +6 -0
  180. package/dist/api/manager/ResourceUpdate.d.ts.map +1 -0
  181. package/dist/api/methodExtension.d.ts +13 -0
  182. package/dist/api/methodExtension.d.ts.map +1 -0
  183. package/dist/api/monero/MoneroGetAddress.d.ts +9 -0
  184. package/dist/api/monero/MoneroGetAddress.d.ts.map +1 -0
  185. package/dist/api/monero/MoneroGetWatchKey.d.ts +8 -0
  186. package/dist/api/monero/MoneroGetWatchKey.d.ts.map +1 -0
  187. package/dist/api/nem/NEMDecryptMessage.d.ts +8 -0
  188. package/dist/api/nem/NEMDecryptMessage.d.ts.map +1 -0
  189. package/dist/api/protocol-v2/DeviceFactoryCertificateRead.d.ts +7 -0
  190. package/dist/api/protocol-v2/DeviceFactoryCertificateRead.d.ts.map +1 -0
  191. package/dist/api/protocol-v2/DeviceFactoryCertificateWrite.d.ts +8 -0
  192. package/dist/api/protocol-v2/DeviceFactoryCertificateWrite.d.ts.map +1 -0
  193. package/dist/api/protocol-v2/DeviceFactoryChallengeSign.d.ts +8 -0
  194. package/dist/api/protocol-v2/DeviceFactoryChallengeSign.d.ts.map +1 -0
  195. package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -1
  196. package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -1
  197. package/dist/api/protocol-v2/helpers.d.ts +15 -5
  198. package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
  199. package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
  200. package/dist/api/testMethods.d.ts +82 -0
  201. package/dist/api/testMethods.d.ts.map +1 -0
  202. package/dist/api/tezos/TezosGetAddress.d.ts +9 -0
  203. package/dist/api/tezos/TezosGetAddress.d.ts.map +1 -0
  204. package/dist/api/tezos/TezosGetPublicKey.d.ts +8 -0
  205. package/dist/api/tezos/TezosGetPublicKey.d.ts.map +1 -0
  206. package/dist/api/tezos/TezosSignTx.d.ts +12 -0
  207. package/dist/api/tezos/TezosSignTx.d.ts.map +1 -0
  208. package/dist/api/utils.d.ts +6 -1
  209. package/dist/api/utils.d.ts.map +1 -1
  210. package/dist/core/index.d.ts +10 -4
  211. package/dist/core/index.d.ts.map +1 -1
  212. package/dist/index.d.ts +722 -41
  213. package/dist/index.d.ts.map +1 -1
  214. package/dist/index.js +2635 -54
  215. package/dist/inject.d.ts +6 -2
  216. package/dist/inject.d.ts.map +1 -1
  217. package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
  218. package/dist/types/api/binanceGetAddress.d.ts +11 -0
  219. package/dist/types/api/binanceGetAddress.d.ts.map +1 -0
  220. package/dist/types/api/binanceGetPublicKey.d.ts +11 -0
  221. package/dist/types/api/binanceGetPublicKey.d.ts.map +1 -0
  222. package/dist/types/api/binanceSignTx.d.ts +7 -0
  223. package/dist/types/api/binanceSignTx.d.ts.map +1 -0
  224. package/dist/types/api/bixinBackupDevice.d.ts +4 -0
  225. package/dist/types/api/bixinBackupDevice.d.ts.map +1 -0
  226. package/dist/types/api/bixinLoadDevice.d.ts +4 -0
  227. package/dist/types/api/bixinLoadDevice.d.ts.map +1 -0
  228. package/dist/types/api/bixinMessageSE.d.ts +4 -0
  229. package/dist/types/api/bixinMessageSE.d.ts.map +1 -0
  230. package/dist/types/api/bixinVerifyDeviceRequest.d.ts +4 -0
  231. package/dist/types/api/bixinVerifyDeviceRequest.d.ts.map +1 -0
  232. package/dist/types/api/btcAuthorizeCoinJoin.d.ts +13 -0
  233. package/dist/types/api/btcAuthorizeCoinJoin.d.ts.map +1 -0
  234. package/dist/types/api/btcGetOwnershipId.d.ts +10 -0
  235. package/dist/types/api/btcGetOwnershipId.d.ts.map +1 -0
  236. package/dist/types/api/btcGetOwnershipProof.d.ts +13 -0
  237. package/dist/types/api/btcGetOwnershipProof.d.ts.map +1 -0
  238. package/dist/types/api/cryptoBatchGetPublickeys.d.ts +12 -0
  239. package/dist/types/api/cryptoBatchGetPublickeys.d.ts.map +1 -0
  240. package/dist/types/api/cryptoCipherKeyValue.d.ts +13 -0
  241. package/dist/types/api/cryptoCipherKeyValue.d.ts.map +1 -0
  242. package/dist/types/api/cryptoCosiCommit.d.ts +8 -0
  243. package/dist/types/api/cryptoCosiCommit.d.ts.map +1 -0
  244. package/dist/types/api/cryptoCosiSign.d.ts +10 -0
  245. package/dist/types/api/cryptoCosiSign.d.ts.map +1 -0
  246. package/dist/types/api/cryptoGetECDHSessionKey.d.ts +4 -0
  247. package/dist/types/api/cryptoGetECDHSessionKey.d.ts.map +1 -0
  248. package/dist/types/api/cryptoSignIdentity.d.ts +4 -0
  249. package/dist/types/api/cryptoSignIdentity.d.ts.map +1 -0
  250. package/dist/types/api/debugLinkDecision.d.ts +4 -0
  251. package/dist/types/api/debugLinkDecision.d.ts.map +1 -0
  252. package/dist/types/api/debugLinkEraseSdCard.d.ts +4 -0
  253. package/dist/types/api/debugLinkEraseSdCard.d.ts.map +1 -0
  254. package/dist/types/api/debugLinkFlashErase.d.ts +4 -0
  255. package/dist/types/api/debugLinkFlashErase.d.ts.map +1 -0
  256. package/dist/types/api/debugLinkGetState.d.ts +4 -0
  257. package/dist/types/api/debugLinkGetState.d.ts.map +1 -0
  258. package/dist/types/api/debugLinkMemoryRead.d.ts +4 -0
  259. package/dist/types/api/debugLinkMemoryRead.d.ts.map +1 -0
  260. package/dist/types/api/debugLinkMemoryWrite.d.ts +4 -0
  261. package/dist/types/api/debugLinkMemoryWrite.d.ts.map +1 -0
  262. package/dist/types/api/debugLinkRecordScreen.d.ts +4 -0
  263. package/dist/types/api/debugLinkRecordScreen.d.ts.map +1 -0
  264. package/dist/types/api/debugLinkReseedRandom.d.ts +4 -0
  265. package/dist/types/api/debugLinkReseedRandom.d.ts.map +1 -0
  266. package/dist/types/api/debugLinkStop.d.ts +4 -0
  267. package/dist/types/api/debugLinkStop.d.ts.map +1 -0
  268. package/dist/types/api/debugLinkWatchLayout.d.ts +4 -0
  269. package/dist/types/api/debugLinkWatchLayout.d.ts.map +1 -0
  270. package/dist/types/api/detectDeviceConnectProtocol.d.ts.map +1 -1
  271. package/dist/types/api/deviceCancelAuthorization.d.ts +4 -0
  272. package/dist/types/api/deviceCancelAuthorization.d.ts.map +1 -0
  273. package/dist/types/api/deviceChangeWipeCode.d.ts +4 -0
  274. package/dist/types/api/deviceChangeWipeCode.d.ts.map +1 -0
  275. package/dist/types/api/deviceDoPreauthorized.d.ts +4 -0
  276. package/dist/types/api/deviceDoPreauthorized.d.ts.map +1 -0
  277. package/dist/types/api/deviceEndSession.d.ts +4 -0
  278. package/dist/types/api/deviceEndSession.d.ts.map +1 -0
  279. package/dist/types/api/deviceGetEntropy.d.ts +4 -0
  280. package/dist/types/api/deviceGetEntropy.d.ts.map +1 -0
  281. package/dist/types/api/deviceGetFirmwareHash.d.ts +4 -0
  282. package/dist/types/api/deviceGetFirmwareHash.d.ts.map +1 -0
  283. package/dist/types/api/deviceGetInfo.d.ts +4 -0
  284. package/dist/types/api/deviceGetInfo.d.ts.map +1 -0
  285. package/dist/types/api/deviceInfoSettings.d.ts +4 -0
  286. package/dist/types/api/deviceInfoSettings.d.ts.map +1 -0
  287. package/dist/types/api/deviceLoad.d.ts +16 -0
  288. package/dist/types/api/deviceLoad.d.ts.map +1 -0
  289. package/dist/types/api/devicePing.d.ts +4 -0
  290. package/dist/types/api/devicePing.d.ts.map +1 -0
  291. package/dist/types/api/deviceReadSEPublicCert.d.ts +4 -0
  292. package/dist/types/api/deviceReadSEPublicCert.d.ts.map +1 -0
  293. package/dist/types/api/deviceSESignMessage.d.ts +4 -0
  294. package/dist/types/api/deviceSESignMessage.d.ts.map +1 -0
  295. package/dist/types/api/deviceSdProtect.d.ts +4 -0
  296. package/dist/types/api/deviceSdProtect.d.ts.map +1 -0
  297. package/dist/types/api/deviceSpiFlashRead.d.ts +4 -0
  298. package/dist/types/api/deviceSpiFlashRead.d.ts.map +1 -0
  299. package/dist/types/api/deviceSpiFlashWrite.d.ts +4 -0
  300. package/dist/types/api/deviceSpiFlashWrite.d.ts.map +1 -0
  301. package/dist/types/api/deviceUnlockPath.d.ts +11 -0
  302. package/dist/types/api/deviceUnlockPath.d.ts.map +1 -0
  303. package/dist/types/api/deviceWriteSEPrivateKey.d.ts +4 -0
  304. package/dist/types/api/deviceWriteSEPrivateKey.d.ts.map +1 -0
  305. package/dist/types/api/deviceWriteSEPublicCert.d.ts +4 -0
  306. package/dist/types/api/deviceWriteSEPublicCert.d.ts.map +1 -0
  307. package/dist/types/api/emmcDirList.d.ts +4 -0
  308. package/dist/types/api/emmcDirList.d.ts.map +1 -0
  309. package/dist/types/api/emmcDirMake.d.ts +4 -0
  310. package/dist/types/api/emmcDirMake.d.ts.map +1 -0
  311. package/dist/types/api/emmcDirRemove.d.ts +4 -0
  312. package/dist/types/api/emmcDirRemove.d.ts.map +1 -0
  313. package/dist/types/api/emmcFileDelete.d.ts +4 -0
  314. package/dist/types/api/emmcFileDelete.d.ts.map +1 -0
  315. package/dist/types/api/emmcFileRead.d.ts +4 -0
  316. package/dist/types/api/emmcFileRead.d.ts.map +1 -0
  317. package/dist/types/api/emmcFileWrite.d.ts +4 -0
  318. package/dist/types/api/emmcFileWrite.d.ts.map +1 -0
  319. package/dist/types/api/emmcFixPermission.d.ts +4 -0
  320. package/dist/types/api/emmcFixPermission.d.ts.map +1 -0
  321. package/dist/types/api/emmcPathInfo.d.ts +4 -0
  322. package/dist/types/api/emmcPathInfo.d.ts.map +1 -0
  323. package/dist/types/api/eosGetPublicKey.d.ts +8 -0
  324. package/dist/types/api/eosGetPublicKey.d.ts.map +1 -0
  325. package/dist/types/api/eosSignTx.d.ts +7 -0
  326. package/dist/types/api/eosSignTx.d.ts.map +1 -0
  327. package/dist/types/api/evmGetAddressTrezor.d.ts +15 -0
  328. package/dist/types/api/evmGetAddressTrezor.d.ts.map +1 -0
  329. package/dist/types/api/evmGetPublicKeyTrezor.d.ts +20 -0
  330. package/dist/types/api/evmGetPublicKeyTrezor.d.ts.map +1 -0
  331. package/dist/types/api/evmSignMessageTrezor.d.ts +9 -0
  332. package/dist/types/api/evmSignMessageTrezor.d.ts.map +1 -0
  333. package/dist/types/api/evmSignTransactionTrezor.d.ts +40 -0
  334. package/dist/types/api/evmSignTransactionTrezor.d.ts.map +1 -0
  335. package/dist/types/api/evmSignTypedDataTrezor.d.ts +34 -0
  336. package/dist/types/api/evmSignTypedDataTrezor.d.ts.map +1 -0
  337. package/dist/types/api/evmVerifyMessageTrezor.d.ts +10 -0
  338. package/dist/types/api/evmVerifyMessageTrezor.d.ts.map +1 -0
  339. package/dist/types/api/firmwareErase.d.ts +4 -0
  340. package/dist/types/api/firmwareErase.d.ts.map +1 -0
  341. package/dist/types/api/firmwareEraseEx.d.ts +4 -0
  342. package/dist/types/api/firmwareEraseEx.d.ts.map +1 -0
  343. package/dist/types/api/firmwareUpdateEmmcTest.d.ts +4 -0
  344. package/dist/types/api/firmwareUpdateEmmcTest.d.ts.map +1 -0
  345. package/dist/types/api/firmwareUploadTest.d.ts +4 -0
  346. package/dist/types/api/firmwareUploadTest.d.ts.map +1 -0
  347. package/dist/types/api/getPublicKeyMultiple.d.ts +4 -0
  348. package/dist/types/api/getPublicKeyMultiple.d.ts.map +1 -0
  349. package/dist/types/api/index.d.ts +176 -3
  350. package/dist/types/api/index.d.ts.map +1 -1
  351. package/dist/types/api/listResDir.d.ts +4 -0
  352. package/dist/types/api/listResDir.d.ts.map +1 -0
  353. package/dist/types/api/moneroGetAddress.d.ts +14 -0
  354. package/dist/types/api/moneroGetAddress.d.ts.map +1 -0
  355. package/dist/types/api/moneroGetWatchKey.d.ts +14 -0
  356. package/dist/types/api/moneroGetWatchKey.d.ts.map +1 -0
  357. package/dist/types/api/nemDecryptMessage.d.ts +10 -0
  358. package/dist/types/api/nemDecryptMessage.d.ts.map +1 -0
  359. package/dist/types/api/nftWriteData.d.ts +4 -0
  360. package/dist/types/api/nftWriteData.d.ts.map +1 -0
  361. package/dist/types/api/nftWriteInfo.d.ts +4 -0
  362. package/dist/types/api/nftWriteInfo.d.ts.map +1 -0
  363. package/dist/types/api/protocolV2.d.ts +8 -2
  364. package/dist/types/api/protocolV2.d.ts.map +1 -1
  365. package/dist/types/api/readSEPublicKey.d.ts +4 -0
  366. package/dist/types/api/readSEPublicKey.d.ts.map +1 -0
  367. package/dist/types/api/reboot.d.ts +4 -0
  368. package/dist/types/api/reboot.d.ts.map +1 -0
  369. package/dist/types/api/resourceUpdate.d.ts +7 -0
  370. package/dist/types/api/resourceUpdate.d.ts.map +1 -0
  371. package/dist/types/api/selfTest.d.ts +4 -0
  372. package/dist/types/api/selfTest.d.ts.map +1 -0
  373. package/dist/types/api/tezosGetAddress.d.ts +14 -0
  374. package/dist/types/api/tezosGetAddress.d.ts.map +1 -0
  375. package/dist/types/api/tezosGetPublicKey.d.ts +14 -0
  376. package/dist/types/api/tezosGetPublicKey.d.ts.map +1 -0
  377. package/dist/types/api/tezosSignTx.d.ts +7 -0
  378. package/dist/types/api/tezosSignTx.d.ts.map +1 -0
  379. package/dist/types/api/webAuthnAddResidentCredential.d.ts +4 -0
  380. package/dist/types/api/webAuthnAddResidentCredential.d.ts.map +1 -0
  381. package/dist/types/api/webAuthnListResidentCredentials.d.ts +4 -0
  382. package/dist/types/api/webAuthnListResidentCredentials.d.ts.map +1 -0
  383. package/dist/types/api/webAuthnRemoveResidentCredential.d.ts +4 -0
  384. package/dist/types/api/webAuthnRemoveResidentCredential.d.ts.map +1 -0
  385. package/dist/utils/patch.d.ts +1 -1
  386. package/dist/utils/patch.d.ts.map +1 -1
  387. package/package.json +4 -4
  388. package/src/api/BixinBackupDevice.ts +15 -0
  389. package/src/api/BixinLoadDevice.ts +22 -0
  390. package/src/api/BixinMessageSE.ts +22 -0
  391. package/src/api/BixinVerifyDeviceRequest.ts +22 -0
  392. package/src/api/FirmwareUpdateV4.ts +15 -10
  393. package/src/api/WebAuthnAddResidentCredential.ts +22 -0
  394. package/src/api/WebAuthnListResidentCredentials.ts +24 -0
  395. package/src/api/WebAuthnRemoveResidentCredential.ts +22 -0
  396. package/src/api/binance/BinanceGetAddress.ts +26 -0
  397. package/src/api/binance/BinanceGetPublicKey.ts +26 -0
  398. package/src/api/binance/BinanceSignTx.ts +35 -0
  399. package/src/api/btc/BTCAuthorizeCoinJoin.ts +37 -0
  400. package/src/api/btc/BTCGetOwnershipId.ts +34 -0
  401. package/src/api/btc/BTCGetOwnershipProof.ts +37 -0
  402. package/src/api/crypto/CryptoBatchGetPublickeys.ts +30 -0
  403. package/src/api/crypto/CryptoCipherKeyValue.ts +29 -0
  404. package/src/api/crypto/CryptoCosiCommit.ts +24 -0
  405. package/src/api/crypto/CryptoCosiSign.ts +26 -0
  406. package/src/api/crypto/CryptoGetECDHSessionKey.ts +24 -0
  407. package/src/api/crypto/CryptoSignIdentity.ts +25 -0
  408. package/src/api/debug/DebugLinkDecision.ts +25 -0
  409. package/src/api/debug/DebugLinkEraseSdCard.ts +23 -0
  410. package/src/api/debug/DebugLinkFlashErase.ts +23 -0
  411. package/src/api/debug/DebugLinkGetState.ts +21 -0
  412. package/src/api/debug/DebugLinkMemoryRead.ts +24 -0
  413. package/src/api/debug/DebugLinkMemoryWrite.ts +25 -0
  414. package/src/api/debug/DebugLinkRecordScreen.ts +23 -0
  415. package/src/api/debug/DebugLinkReseedRandom.ts +23 -0
  416. package/src/api/debug/DebugLinkStop.ts +25 -0
  417. package/src/api/debug/DebugLinkWatchLayout.ts +23 -0
  418. package/src/api/device/DeviceVerify.ts +2 -0
  419. package/src/api/emmc/EmmcDirList.ts +20 -0
  420. package/src/api/emmc/EmmcDirMake.ts +20 -0
  421. package/src/api/emmc/EmmcDirRemove.ts +20 -0
  422. package/src/api/emmc/EmmcFileDelete.ts +20 -0
  423. package/src/api/emmc/EmmcFileRead.ts +21 -0
  424. package/src/api/emmc/EmmcFileWrite.ts +23 -0
  425. package/src/api/emmc/EmmcFixPermission.ts +17 -0
  426. package/src/api/emmc/EmmcPathInfo.ts +20 -0
  427. package/src/api/eos/EosGetPublicKey.ts +26 -0
  428. package/src/api/eos/EosSignTx.ts +40 -0
  429. package/src/api/evmTrezor/EVMGetAddress.ts +75 -0
  430. package/src/api/evmTrezor/EVMGetPublicKey.ts +106 -0
  431. package/src/api/evmTrezor/EVMSignMessage.ts +40 -0
  432. package/src/api/evmTrezor/EVMSignTransaction.ts +83 -0
  433. package/src/api/evmTrezor/EVMSignTypedData.ts +366 -0
  434. package/src/api/evmTrezor/EVMVerifyMessage.ts +37 -0
  435. package/src/api/evmTrezor/legacyV1/getAddress.ts +16 -0
  436. package/src/api/evmTrezor/legacyV1/getPublicKey.ts +20 -0
  437. package/src/api/evmTrezor/legacyV1/signMessage.ts +22 -0
  438. package/src/api/evmTrezor/legacyV1/signTransaction.ts +24 -0
  439. package/src/api/evmTrezor/legacyV1/signTypedData.ts +36 -0
  440. package/src/api/evmTrezor/legacyV1/signTypedHash.ts +48 -0
  441. package/src/api/evmTrezor/legacyV1/verifyMessage.ts +19 -0
  442. package/src/api/extensionMethodNames.ts +88 -0
  443. package/src/api/factoryMethods.ts +2 -0
  444. package/src/api/firmware/FirmwareErase.ts +18 -0
  445. package/src/api/firmware/FirmwareEraseEx.ts +18 -0
  446. package/src/api/firmware/FirmwareUpdateEmmcTest.ts +18 -0
  447. package/src/api/firmware/FirmwareUploadTest.ts +17 -0
  448. package/src/api/firmware/Reboot.ts +17 -0
  449. package/src/api/firmware/SelfTest.ts +17 -0
  450. package/src/api/helpers/protocolV2FileWrite.ts +16 -3
  451. package/src/api/index.ts +3 -0
  452. package/src/api/manager/DeviceCancelAuthorization.ts +15 -0
  453. package/src/api/manager/DeviceChangeWipeCode.ts +19 -0
  454. package/src/api/manager/DeviceDoPreauthorized.ts +15 -0
  455. package/src/api/manager/DeviceEndSession.ts +19 -0
  456. package/src/api/manager/DeviceGetEntropy.ts +19 -0
  457. package/src/api/manager/DeviceGetFirmwareHash.ts +23 -0
  458. package/src/api/manager/DeviceInfoSettings.ts +23 -0
  459. package/src/api/manager/DeviceLoad.ts +27 -0
  460. package/src/api/manager/DevicePing.ts +19 -0
  461. package/src/api/manager/DeviceReadSEPublicCert.ts +18 -0
  462. package/src/api/manager/DeviceSESignMessage.ts +23 -0
  463. package/src/api/manager/DeviceSdProtect.ts +18 -0
  464. package/src/api/manager/DeviceSpiFlashRead.ts +22 -0
  465. package/src/api/manager/DeviceSpiFlashWrite.ts +22 -0
  466. package/src/api/manager/DeviceUnlockPath.ts +26 -0
  467. package/src/api/manager/DeviceWriteSEPrivateKey.ts +23 -0
  468. package/src/api/manager/DeviceWriteSEPublicCert.ts +23 -0
  469. package/src/api/manager/GetDeviceInfoSettings.ts +20 -0
  470. package/src/api/manager/GetPublicKeyMultiple.ts +24 -0
  471. package/src/api/manager/ListResDir.ts +19 -0
  472. package/src/api/manager/NFTWriteData.ts +21 -0
  473. package/src/api/manager/NFTWriteInfo.ts +23 -0
  474. package/src/api/manager/ReadSEPublicKey.ts +20 -0
  475. package/src/api/manager/ResourceUpdate.ts +22 -0
  476. package/src/api/methodExtension.ts +27 -0
  477. package/src/api/monero/MoneroGetAddress.ts +64 -0
  478. package/src/api/monero/MoneroGetWatchKey.ts +59 -0
  479. package/src/api/nem/NEMDecryptMessage.ts +29 -0
  480. package/src/api/protocol-v2/DeviceFactoryCertificateRead.ts +25 -0
  481. package/src/api/protocol-v2/DeviceFactoryCertificateWrite.ts +30 -0
  482. package/src/api/protocol-v2/DeviceFactoryChallengeSign.ts +28 -0
  483. package/src/api/protocol-v2/DeviceFactoryInfoGet.ts +3 -0
  484. package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +6 -7
  485. package/src/api/protocol-v2/helpers.ts +152 -5
  486. package/src/api/testMethods.ts +95 -0
  487. package/src/api/tezos/TezosGetAddress.ts +64 -0
  488. package/src/api/tezos/TezosGetPublicKey.ts +63 -0
  489. package/src/api/tezos/TezosSignTx.ts +44 -0
  490. package/src/api/utils.ts +46 -1
  491. package/src/core/index.ts +22 -7
  492. package/src/index.ts +5 -0
  493. package/src/inject.ts +209 -7
  494. package/src/protocols/protocol-v2/firmware.ts +2 -0
  495. package/src/types/api/binanceGetAddress.ts +17 -0
  496. package/src/types/api/binanceGetPublicKey.ts +17 -0
  497. package/src/types/api/binanceSignTx.ts +15 -0
  498. package/src/types/api/bixinBackupDevice.ts +8 -0
  499. package/src/types/api/bixinLoadDevice.ts +8 -0
  500. package/src/types/api/bixinMessageSE.ts +8 -0
  501. package/src/types/api/bixinVerifyDeviceRequest.ts +8 -0
  502. package/src/types/api/btcAuthorizeCoinJoin.ts +18 -0
  503. package/src/types/api/btcGetOwnershipId.ts +19 -0
  504. package/src/types/api/btcGetOwnershipProof.ts +22 -0
  505. package/src/types/api/cryptoBatchGetPublickeys.ts +18 -0
  506. package/src/types/api/cryptoCipherKeyValue.ts +18 -0
  507. package/src/types/api/cryptoCosiCommit.ts +13 -0
  508. package/src/types/api/cryptoCosiSign.ts +15 -0
  509. package/src/types/api/cryptoGetECDHSessionKey.ts +8 -0
  510. package/src/types/api/cryptoSignIdentity.ts +8 -0
  511. package/src/types/api/debugLinkDecision.ts +7 -0
  512. package/src/types/api/debugLinkEraseSdCard.ts +7 -0
  513. package/src/types/api/debugLinkFlashErase.ts +7 -0
  514. package/src/types/api/debugLinkGetState.ts +7 -0
  515. package/src/types/api/debugLinkMemoryRead.ts +7 -0
  516. package/src/types/api/debugLinkMemoryWrite.ts +7 -0
  517. package/src/types/api/debugLinkRecordScreen.ts +7 -0
  518. package/src/types/api/debugLinkReseedRandom.ts +7 -0
  519. package/src/types/api/debugLinkStop.ts +7 -0
  520. package/src/types/api/debugLinkWatchLayout.ts +7 -0
  521. package/src/types/api/detectDeviceConnectProtocol.ts +0 -1
  522. package/src/types/api/deviceCancelAuthorization.ts +7 -0
  523. package/src/types/api/deviceChangeWipeCode.ts +7 -0
  524. package/src/types/api/deviceDoPreauthorized.ts +7 -0
  525. package/src/types/api/deviceEndSession.ts +7 -0
  526. package/src/types/api/deviceGetEntropy.ts +7 -0
  527. package/src/types/api/deviceGetFirmwareHash.ts +7 -0
  528. package/src/types/api/deviceGetInfo.ts +7 -0
  529. package/src/types/api/deviceInfoSettings.ts +7 -0
  530. package/src/types/api/deviceLoad.ts +19 -0
  531. package/src/types/api/devicePing.ts +7 -0
  532. package/src/types/api/deviceReadSEPublicCert.ts +7 -0
  533. package/src/types/api/deviceSESignMessage.ts +7 -0
  534. package/src/types/api/deviceSdProtect.ts +7 -0
  535. package/src/types/api/deviceSpiFlashRead.ts +7 -0
  536. package/src/types/api/deviceSpiFlashWrite.ts +7 -0
  537. package/src/types/api/deviceUnlockPath.ts +16 -0
  538. package/src/types/api/deviceWriteSEPrivateKey.ts +7 -0
  539. package/src/types/api/deviceWriteSEPublicCert.ts +7 -0
  540. package/src/types/api/emmcDirList.ts +7 -0
  541. package/src/types/api/emmcDirMake.ts +7 -0
  542. package/src/types/api/emmcDirRemove.ts +7 -0
  543. package/src/types/api/emmcFileDelete.ts +7 -0
  544. package/src/types/api/emmcFileRead.ts +7 -0
  545. package/src/types/api/emmcFileWrite.ts +7 -0
  546. package/src/types/api/emmcFixPermission.ts +7 -0
  547. package/src/types/api/emmcPathInfo.ts +7 -0
  548. package/src/types/api/eosGetPublicKey.ts +13 -0
  549. package/src/types/api/eosSignTx.ts +12 -0
  550. package/src/types/api/evmGetAddressTrezor.ts +24 -0
  551. package/src/types/api/evmGetPublicKeyTrezor.ts +31 -0
  552. package/src/types/api/evmSignMessageTrezor.ts +14 -0
  553. package/src/types/api/evmSignTransactionTrezor.ts +49 -0
  554. package/src/types/api/evmSignTypedDataTrezor.ts +42 -0
  555. package/src/types/api/evmVerifyMessageTrezor.ts +15 -0
  556. package/src/types/api/firmwareErase.ts +4 -0
  557. package/src/types/api/firmwareEraseEx.ts +7 -0
  558. package/src/types/api/firmwareUpdateEmmcTest.ts +7 -0
  559. package/src/types/api/firmwareUploadTest.ts +7 -0
  560. package/src/types/api/getPublicKeyMultiple.ts +11 -0
  561. package/src/types/api/index.ts +288 -2
  562. package/src/types/api/listResDir.ts +8 -0
  563. package/src/types/api/moneroGetAddress.ts +23 -0
  564. package/src/types/api/moneroGetWatchKey.ts +26 -0
  565. package/src/types/api/nemDecryptMessage.ts +15 -0
  566. package/src/types/api/nftWriteData.ts +8 -0
  567. package/src/types/api/nftWriteInfo.ts +8 -0
  568. package/src/types/api/protocolV2.ts +43 -2
  569. package/src/types/api/readSEPublicKey.ts +8 -0
  570. package/src/types/api/reboot.ts +4 -0
  571. package/src/types/api/resourceUpdate.ts +11 -0
  572. package/src/types/api/selfTest.ts +7 -0
  573. package/src/types/api/tezosGetAddress.ts +23 -0
  574. package/src/types/api/tezosGetPublicKey.ts +23 -0
  575. package/src/types/api/tezosSignTx.ts +12 -0
  576. package/src/types/api/webAuthnAddResidentCredential.ts +8 -0
  577. package/src/types/api/webAuthnListResidentCredentials.ts +8 -0
  578. package/src/types/api/webAuthnRemoveResidentCredential.ts +8 -0
package/dist/index.js CHANGED
@@ -87,6 +87,94 @@ 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
+
90
178
  const callbackManager = new Map();
91
179
  const generateCallbackId = () => `callback_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
92
180
  const registerCallback = (id, callback) => {
@@ -147,7 +235,7 @@ const inject = ({ call, cancel, dispose, eventEmitter, init, updateSettings, swi
147
235
  switchTransport }, createCoreApi(protocolAwareCall.call));
148
236
  return api;
149
237
  };
150
- const createCoreApi = (call) => ({
238
+ const createAllCoreApi = (call) => ({
151
239
  getLogs: () => call({ method: 'getLogs' }),
152
240
  clearSessionCache: params => call(Object.assign(Object.assign({}, params), { method: 'clearSessionCache' })),
153
241
  searchDevices: params => call(Object.assign(Object.assign({}, params), { method: 'searchDevices' })),
@@ -180,6 +268,11 @@ const createCoreApi = (call) => ({
180
268
  deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
181
269
  deviceReboot: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReboot' })),
182
270
  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' })),
183
276
  deviceUploadWallpaper: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceUploadWallpaper' })),
184
277
  deviceUploadNft: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceUploadNft' })),
185
278
  uploadPortfolio: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'uploadPortfolio' })),
@@ -222,12 +315,27 @@ const createCoreApi = (call) => ({
222
315
  evmSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTransaction' })),
223
316
  evmSignTypedData: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'evmSignTypedData' })),
224
317
  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' })),
225
324
  btcGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetAddress' })),
226
325
  btcGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcGetPublicKey' })),
227
326
  btcSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignMessage' })),
228
327
  btcSignPsbt: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignPsbt' })),
229
328
  btcSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'btcSignTransaction' })),
230
329
  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' })),
231
339
  starcoinGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetAddress' })),
232
340
  starcoinGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinGetPublicKey' })),
233
341
  starcoinSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinSignMessage' })),
@@ -235,6 +343,7 @@ const createCoreApi = (call) => ({
235
343
  starcoinVerifyMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'starcoinVerifyMessage' })),
236
344
  nemGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'nemGetAddress' })),
237
345
  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' })),
238
347
  solGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solGetAddress' })),
239
348
  solSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solSignTransaction' })),
240
349
  solSignOffchainMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'solSignOffchainMessage' })),
@@ -307,9 +416,91 @@ const createCoreApi = (call) => ({
307
416
  benfenGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'benfenGetPublicKey' })),
308
417
  benfenSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'benfenSignTransaction' })),
309
418
  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' })),
310
484
  neoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'neoGetAddress' })),
311
485
  neoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'neoSignTransaction' })),
312
486
  });
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);
313
504
 
314
505
  const lowLevelInject = ({ call, cancel, dispose, eventEmitter, init, uiResponse, updateSettings, switchTransport, addHardwareGlobalEventListener, }) => {
315
506
  const protocolAwareCall = createProtocolAwareCall(call);
@@ -41409,7 +41600,7 @@ function validateNonEmptyString(value, name) {
41409
41600
  }
41410
41601
  const PROTOCOL_V2_FILESYSTEM_VOLUMES = new Set(['vol0', 'vol1']);
41411
41602
  const MAX_PROTOCOL_V2_FILESYSTEM_PATH_BYTES = 127;
41412
- function getUtf8ByteLength$1(value) {
41603
+ function getUtf8ByteLength$2(value) {
41413
41604
  return Array.from(value).reduce((length, character) => {
41414
41605
  var _a;
41415
41606
  const codePoint = (_a = character.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
@@ -41451,7 +41642,7 @@ function validateProtocolV2FilesystemPath(value, name, options = {}) {
41451
41642
  throw invalidParameter$1(`Parameter [${name}] contains an invalid path segment.`);
41452
41643
  }
41453
41644
  const canonicalPath = `${volume}:${rawSuffix.startsWith('/') ? '/' : ''}${segments.join('/')}`;
41454
- if (getUtf8ByteLength$1(canonicalPath) > MAX_PROTOCOL_V2_FILESYSTEM_PATH_BYTES) {
41645
+ if (getUtf8ByteLength$2(canonicalPath) > MAX_PROTOCOL_V2_FILESYSTEM_PATH_BYTES) {
41455
41646
  throw invalidParameter$1(`Parameter [${name}] exceeds the maximum filesystem path length.`);
41456
41647
  }
41457
41648
  return canonicalPath;
@@ -45353,7 +45544,7 @@ class TestInitializeDeviceDuration extends BaseMethod {
45353
45544
  }
45354
45545
 
45355
45546
  const PROTOCOL_V2_PING_MAX_MESSAGE_BYTES = 63;
45356
- const getUtf8ByteLength = (value) => Array.from(value).reduce((length, character) => {
45547
+ const getUtf8ByteLength$1 = (value) => Array.from(value).reduce((length, character) => {
45357
45548
  var _a;
45358
45549
  const codePoint = (_a = character.codePointAt(0)) !== null && _a !== void 0 ? _a : 0;
45359
45550
  if (codePoint <= 0x7f)
@@ -45369,7 +45560,7 @@ function validateProtocolV2PingMessage(value) {
45369
45560
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Protocol V2 Ping message must be a string.');
45370
45561
  }
45371
45562
  const message = value !== null && value !== void 0 ? value : '';
45372
- if (getUtf8ByteLength(message) > PROTOCOL_V2_PING_MAX_MESSAGE_BYTES) {
45563
+ if (getUtf8ByteLength$1(message) > PROTOCOL_V2_PING_MAX_MESSAGE_BYTES) {
45373
45564
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Protocol V2 Ping message must not exceed ${PROTOCOL_V2_PING_MAX_MESSAGE_BYTES} UTF-8 bytes.`);
45374
45565
  }
45375
45566
  return message;
@@ -46545,7 +46736,7 @@ class CheckFirmwareTypeAvailable extends BaseMethod {
46545
46736
  }
46546
46737
  }
46547
46738
 
46548
- class DeviceBackup extends BaseMethod {
46739
+ class DeviceBackup$1 extends BaseMethod {
46549
46740
  init() {
46550
46741
  this.useDevicePassphraseState = false;
46551
46742
  }
@@ -47176,6 +47367,7 @@ class DeviceSupportFeatures extends BaseMethod {
47176
47367
  class DeviceVerify extends BaseMethod {
47177
47368
  init() {
47178
47369
  this.useDevicePassphraseState = false;
47370
+ this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
47179
47371
  validateParams(this.payload, [{ name: 'dataHex', type: 'hexString' }]);
47180
47372
  this.params = {
47181
47373
  data: formatAnyHex(this.payload.dataHex),
@@ -49176,6 +49368,99 @@ const ProtocolV2FirmwareTargetType = {
49176
49368
  FW_MGMT_TARGET_SE04: 10,
49177
49369
  };
49178
49370
 
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
+ }
49179
49464
  const DEVICE_REBOOT_TYPES = {
49180
49465
  Normal: hdTransport.DeviceRebootType.Normal,
49181
49466
  normal: hdTransport.DeviceRebootType.Normal,
@@ -50485,7 +50770,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
50485
50770
  overwrite,
50486
50771
  append: false,
50487
50772
  ui_percentage: progress !== null && progress !== void 0 ? progress : undefined,
50488
- });
50773
+ }, { writeWithResponse: true });
50489
50774
  if (writeRes.type !== 'FilesystemFile') {
50490
50775
  if (writeRes.type === 'CallMethodError') {
50491
50776
  if (((_a = writeRes.message.error) !== null && _a !== void 0 ? _a : '').indexOf(SESSION_ERROR) > -1) {
@@ -50654,7 +50939,65 @@ class DeviceGetOnboardingStatus extends BaseMethod {
50654
50939
  }
50655
50940
  }
50656
50941
 
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
+
50657
50999
  const MIN_FILE_CHUNK_SIZE = 64;
51000
+ const FILE_TRANSFER_RATE_WINDOW_MS = 1000;
50658
51001
  function isProtocolV2ResponseTimeout(error) {
50659
51002
  var _a, _b;
50660
51003
  if (!error || typeof error !== 'object')
@@ -50729,6 +51072,9 @@ function writeProtocolV2File(options) {
50729
51072
  let chunks = 0;
50730
51073
  let lastMessage;
50731
51074
  const startTime = Date.now();
51075
+ let rateWindowStartedAt = startTime;
51076
+ let rateWindowStartedBytes = 0;
51077
+ let rateBytesPerSecond;
50732
51078
  while (written < dataLength) {
50733
51079
  (_c = options.throwIfAborted) === null || _c === void 0 ? void 0 : _c.call(options);
50734
51080
  const chunk = data.slice(written, Math.min(written + chunkSize, dataLength));
@@ -50772,13 +51118,24 @@ function writeProtocolV2File(options) {
50772
51118
  written =
50773
51119
  rawProcessedByte === undefined ? written + chunk.byteLength : processedByte - startOffset;
50774
51120
  chunks += 1;
50775
- const elapsedMs = Date.now() - startTime;
51121
+ const now = Date.now();
51122
+ const elapsedMs = now - startTime;
50776
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
+ }
50777
51134
  (_l = options.onProgress) === null || _l === void 0 ? void 0 : _l.call(options, {
50778
51135
  progress: getConfirmedProgress(startOffset + written, totalSize, written, dataLength),
50779
51136
  transferredBytes,
50780
51137
  totalBytes: dataLength,
50781
- rateBytesPerSecond: elapsedMs > 0 ? Math.round((transferredBytes / elapsedMs) * 1000) : undefined,
51138
+ rateBytesPerSecond,
50782
51139
  elapsedMs,
50783
51140
  });
50784
51141
  if (options.paceMs && options.paceMs > 0) {
@@ -53287,7 +53644,7 @@ class ConfluxSignTransaction extends BaseMethod {
53287
53644
  }
53288
53645
  }
53289
53646
 
53290
- function getAddressLegacyV1 ({ typedCall, param, }) {
53647
+ function getAddressLegacyV1$1 ({ typedCall, param, }) {
53291
53648
  return __awaiter(this, void 0, void 0, function* () {
53292
53649
  const message = {
53293
53650
  address_n: param.address_n,
@@ -53306,7 +53663,7 @@ function getAddress ({ typedCall, param, }) {
53306
53663
 
53307
53664
  const shouldUseLegacyV1EvmMessages = (device) => !device.isProtocolV2() && TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema';
53308
53665
 
53309
- class EvmGetAddress extends BaseMethod {
53666
+ class EvmGetAddress$1 extends BaseMethod {
53310
53667
  constructor() {
53311
53668
  super(...arguments);
53312
53669
  this.hasBundle = false;
@@ -53341,7 +53698,7 @@ class EvmGetAddress extends BaseMethod {
53341
53698
  getEvmAddress(param) {
53342
53699
  return __awaiter(this, void 0, void 0, function* () {
53343
53700
  if (shouldUseLegacyV1EvmMessages(this.device)) {
53344
- return getAddressLegacyV1({
53701
+ return getAddressLegacyV1$1({
53345
53702
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53346
53703
  param,
53347
53704
  });
@@ -53383,7 +53740,7 @@ function getPublicKey ({ typedCall, param, }) {
53383
53740
  });
53384
53741
  }
53385
53742
 
53386
- function getPublicKeyLegacyV1 ({ typedCall, param, }) {
53743
+ function getPublicKeyLegacyV1$1 ({ typedCall, param, }) {
53387
53744
  return __awaiter(this, void 0, void 0, function* () {
53388
53745
  const message = {
53389
53746
  address_n: param.address_n,
@@ -53394,7 +53751,7 @@ function getPublicKeyLegacyV1 ({ typedCall, param, }) {
53394
53751
  });
53395
53752
  }
53396
53753
 
53397
- class EVMGetPublicKey extends BaseMethod {
53754
+ class EVMGetPublicKey$1 extends BaseMethod {
53398
53755
  constructor() {
53399
53756
  super(...arguments);
53400
53757
  this.hasBundle = false;
@@ -53432,7 +53789,7 @@ class EVMGetPublicKey extends BaseMethod {
53432
53789
  }
53433
53790
  getEvmPublicKey(param) {
53434
53791
  if (shouldUseLegacyV1EvmMessages(this.device)) {
53435
- return getPublicKeyLegacyV1({
53792
+ return getPublicKeyLegacyV1$1({
53436
53793
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53437
53794
  param,
53438
53795
  });
@@ -53484,7 +53841,7 @@ function signMessage ({ typedCall, params, }) {
53484
53841
  });
53485
53842
  }
53486
53843
 
53487
- function signMessageLegacyV1 ({ typedCall, params, }) {
53844
+ function signMessageLegacyV1$1 ({ typedCall, params, }) {
53488
53845
  return __awaiter(this, void 0, void 0, function* () {
53489
53846
  const message = {
53490
53847
  address_n: params.address_n,
@@ -53496,7 +53853,7 @@ function signMessageLegacyV1 ({ typedCall, params, }) {
53496
53853
  });
53497
53854
  }
53498
53855
 
53499
- class EVMSignMessage$2 extends BaseMethod {
53856
+ class EVMSignMessage$4 extends BaseMethod {
53500
53857
  getSupportedProtocols() {
53501
53858
  return ['V1', 'V2'];
53502
53859
  }
@@ -53521,7 +53878,7 @@ class EVMSignMessage$2 extends BaseMethod {
53521
53878
  run() {
53522
53879
  return __awaiter(this, void 0, void 0, function* () {
53523
53880
  if (shouldUseLegacyV1EvmMessages(this.device)) {
53524
- return signMessageLegacyV1({
53881
+ return signMessageLegacyV1$1({
53525
53882
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53526
53883
  params: this.params,
53527
53884
  });
@@ -53727,7 +54084,7 @@ const evmSignTxEip7702 = ({ typedCall, addressN, tx, supportTrezor, }) => __awai
53727
54084
  supportTrezor,
53728
54085
  });
53729
54086
  });
53730
- const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
54087
+ const signTransaction$2 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
53731
54088
  if (isEIP7702) {
53732
54089
  return evmSignTxEip7702({ typedCall, addressN, tx: tx });
53733
54090
  }
@@ -53736,7 +54093,7 @@ const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) =
53736
54093
  : evmSignTx({ typedCall, addressN, tx: tx });
53737
54094
  });
53738
54095
 
53739
- const signTransaction = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
54096
+ const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
53740
54097
  if (isEIP7702) {
53741
54098
  return evmSignTxEip7702({
53742
54099
  typedCall,
@@ -53756,7 +54113,7 @@ const signTransaction = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) =>
53756
54113
  return evmSignTx({ typedCall, addressN, tx: tx, supportTrezor: true });
53757
54114
  });
53758
54115
 
53759
- class EVMSignTransaction extends BaseMethod {
54116
+ class EVMSignTransaction$1 extends BaseMethod {
53760
54117
  constructor() {
53761
54118
  super(...arguments);
53762
54119
  this.addressN = [];
@@ -53841,7 +54198,7 @@ class EVMSignTransaction extends BaseMethod {
53841
54198
  if (formattedTx == null)
53842
54199
  throw hdShared.ERRORS.TypedError('Runtime', 'formattedTx is not set');
53843
54200
  if (shouldUseLegacyV1EvmMessages(this.device)) {
53844
- return signTransaction({
54201
+ return signTransaction$1({
53845
54202
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53846
54203
  addressN,
53847
54204
  tx: formattedTx,
@@ -53849,7 +54206,7 @@ class EVMSignTransaction extends BaseMethod {
53849
54206
  isEIP7702,
53850
54207
  });
53851
54208
  }
53852
- return signTransaction$1({
54209
+ return signTransaction$2({
53853
54210
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
53854
54211
  addressN,
53855
54212
  tx: formattedTx,
@@ -53860,7 +54217,7 @@ class EVMSignTransaction extends BaseMethod {
53860
54217
  }
53861
54218
  }
53862
54219
 
53863
- const signTypedHash$1 = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
54220
+ const signTypedHash$2 = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
53864
54221
  var _a;
53865
54222
  const deviceType = device.getCurrentDeviceType();
53866
54223
  if (deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro) {
@@ -53879,7 +54236,7 @@ const signTypedHash$1 = ({ typedCall, addressN, device, chainId, domainHash, mes
53879
54236
  return typedCall('EthereumSignTypedHash', 'EthereumTypedDataSignature', message);
53880
54237
  });
53881
54238
 
53882
- const signTypedHash = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
54239
+ const signTypedHash$1 = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
53883
54240
  var _a;
53884
54241
  const deviceType = device.getCurrentDeviceType();
53885
54242
  if (deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro) {
@@ -53897,7 +54254,7 @@ const signTypedHash = ({ typedCall, addressN, device, chainId, domainHash, messa
53897
54254
  });
53898
54255
  });
53899
54256
 
53900
- const signTypedData$1 = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
54257
+ const signTypedData$2 = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
53901
54258
  const { primaryType } = data;
53902
54259
  const message = {
53903
54260
  address_n: addressN,
@@ -53914,7 +54271,7 @@ const signTypedData$1 = ({ typedCall, addressN, data, metamaskV4Compat, chainId,
53914
54271
  return response;
53915
54272
  });
53916
54273
 
53917
- const signTypedData = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
54274
+ const signTypedData$1 = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
53918
54275
  const { primaryType } = data;
53919
54276
  return typedCall('EthereumSignTypedDataOneKey', [
53920
54277
  'EthereumTypedDataStructRequestOneKey',
@@ -54048,7 +54405,7 @@ const MINI_MAX_NAME_LENGTH = 63;
54048
54405
  const MINI_MAX_DYNAMIC_VALUE_BYTES = 1536;
54049
54406
  const MINI_MAX_ARRAY_TYPE_FIELDS = 24;
54050
54407
  const MINI_MAX_ARRAY_ELEMENTS = 24;
54051
- class EVMSignTypedData extends BaseMethod {
54408
+ class EVMSignTypedData$1 extends BaseMethod {
54052
54409
  getSupportedProtocols() {
54053
54410
  return ['V1', 'V2'];
54054
54411
  }
@@ -54203,7 +54560,7 @@ class EVMSignTypedData extends BaseMethod {
54203
54560
  let response;
54204
54561
  if (shouldUseLegacyV1EvmMessages(this.device)) {
54205
54562
  supportTrezor = true;
54206
- response = yield signTypedData$1({
54563
+ response = yield signTypedData$2({
54207
54564
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54208
54565
  addressN,
54209
54566
  data,
@@ -54212,7 +54569,7 @@ class EVMSignTypedData extends BaseMethod {
54212
54569
  });
54213
54570
  }
54214
54571
  else {
54215
- response = yield signTypedData({
54572
+ response = yield signTypedData$1({
54216
54573
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54217
54574
  addressN,
54218
54575
  data,
@@ -54232,7 +54589,7 @@ class EVMSignTypedData extends BaseMethod {
54232
54589
  if (!domainHash)
54233
54590
  throw hdShared.ERRORS.TypedError('Runtime', 'domainHash is required');
54234
54591
  if (shouldUseLegacyV1EvmMessages(this.device)) {
54235
- return signTypedHash$1({
54592
+ return signTypedHash$2({
54236
54593
  typedCall,
54237
54594
  addressN,
54238
54595
  domainHash,
@@ -54241,7 +54598,7 @@ class EVMSignTypedData extends BaseMethod {
54241
54598
  device: this.device,
54242
54599
  });
54243
54600
  }
54244
- return signTypedHash({
54601
+ return signTypedHash$1({
54245
54602
  typedCall,
54246
54603
  addressN,
54247
54604
  domainHash,
@@ -54462,7 +54819,7 @@ class EVMSignTypedData extends BaseMethod {
54462
54819
  }
54463
54820
  }
54464
54821
 
54465
- function verifyMessageLegacyV1 ({ typedCall, params, }) {
54822
+ function verifyMessageLegacyV1$1 ({ typedCall, params, }) {
54466
54823
  return __awaiter(this, void 0, void 0, function* () {
54467
54824
  const message = {
54468
54825
  signature: params.signature,
@@ -54482,7 +54839,7 @@ function verifyMessage ({ typedCall, params, }) {
54482
54839
  });
54483
54840
  }
54484
54841
 
54485
- class EVMSignMessage$1 extends BaseMethod {
54842
+ class EVMSignMessage$3 extends BaseMethod {
54486
54843
  getSupportedProtocols() {
54487
54844
  return ['V1', 'V2'];
54488
54845
  }
@@ -54506,7 +54863,7 @@ class EVMSignMessage$1 extends BaseMethod {
54506
54863
  run() {
54507
54864
  return __awaiter(this, void 0, void 0, function* () {
54508
54865
  if (shouldUseLegacyV1EvmMessages(this.device)) {
54509
- return verifyMessageLegacyV1({
54866
+ return verifyMessageLegacyV1$1({
54510
54867
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
54511
54868
  params: this.params,
54512
54869
  });
@@ -54670,7 +55027,7 @@ class StarcoinSignTransaction extends BaseMethod {
54670
55027
  }
54671
55028
  }
54672
55029
 
54673
- class EVMSignMessage extends BaseMethod {
55030
+ class EVMSignMessage$2 extends BaseMethod {
54674
55031
  getSupportedProtocols() {
54675
55032
  return ['V1', 'V2'];
54676
55033
  }
@@ -54697,7 +55054,7 @@ class EVMSignMessage extends BaseMethod {
54697
55054
  }
54698
55055
  }
54699
55056
 
54700
- const MAINNET = 0x68;
55057
+ const MAINNET$1 = 0x68;
54701
55058
  class NEMGetAddress extends BaseMethod {
54702
55059
  constructor() {
54703
55060
  super(...arguments);
@@ -54725,7 +55082,7 @@ class NEMGetAddress extends BaseMethod {
54725
55082
  const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
54726
55083
  this.params.push({
54727
55084
  address_n: addressN,
54728
- network: batch.network || MAINNET,
55085
+ network: batch.network || MAINNET$1,
54729
55086
  show_display: showOnOneKey,
54730
55087
  });
54731
55088
  });
@@ -60825,7 +61182,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
60825
61182
  checkBootloaderRelease: CheckBootloaderRelease,
60826
61183
  checkAllFirmwareRelease: CheckAllFirmwareRelease,
60827
61184
  checkFirmwareTypeAvailable: CheckFirmwareTypeAvailable,
60828
- deviceBackup: DeviceBackup,
61185
+ deviceBackup: DeviceBackup$1,
60829
61186
  deviceChangePin: DeviceChangePin,
60830
61187
  deviceFlags: DeviceFlags,
60831
61188
  deviceRebootToBootloader: DeviceRebootToBootloader,
@@ -60852,6 +61209,9 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
60852
61209
  promptWebDeviceAccess: PromptWebDeviceAccess,
60853
61210
  deviceReboot: DeviceReboot,
60854
61211
  deviceGetOnboardingStatus: DeviceGetOnboardingStatus,
61212
+ deviceReadFactoryInfo: DeviceFactoryInfoGet,
61213
+ deviceReadFactoryCertificate: DeviceFactoryCertificateRead,
61214
+ deviceSignFactoryChallenge: DeviceFactoryChallengeSign,
60855
61215
  deviceUploadWallpaper: DeviceUploadWallpaper,
60856
61216
  deviceUploadNft: DeviceUploadNft,
60857
61217
  uploadPortfolio: UploadPortfolio,
@@ -60868,18 +61228,18 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
60868
61228
  confluxSignMessage: ConfluxSignMessage,
60869
61229
  confluxSignMessageCIP23: ConfluxSignMessageCIP23,
60870
61230
  confluxSignTransaction: ConfluxSignTransaction,
60871
- evmGetAddress: EvmGetAddress,
60872
- evmGetPublicKey: EVMGetPublicKey,
60873
- evmSignMessage: EVMSignMessage$2,
61231
+ evmGetAddress: EvmGetAddress$1,
61232
+ evmGetPublicKey: EVMGetPublicKey$1,
61233
+ evmSignMessage: EVMSignMessage$4,
60874
61234
  evmSignMessageEIP712: EVMSignMessageEIP712,
60875
- evmSignTransaction: EVMSignTransaction,
60876
- evmSignTypedData: EVMSignTypedData,
60877
- evmVerifyMessage: EVMSignMessage$1,
61235
+ evmSignTransaction: EVMSignTransaction$1,
61236
+ evmSignTypedData: EVMSignTypedData$1,
61237
+ evmVerifyMessage: EVMSignMessage$3,
60878
61238
  starcoinGetAddress: StarcoinGetAddress,
60879
61239
  starcoinGetPublicKey: StarcoinGetPublicKey,
60880
61240
  starcoinSignMessage: StarcoinSignMessage,
60881
61241
  starcoinSignTransaction: StarcoinSignTransaction,
60882
- starcoinVerifyMessage: EVMSignMessage,
61242
+ starcoinVerifyMessage: EVMSignMessage$2,
60883
61243
  nemGetAddress: NEMGetAddress,
60884
61244
  nemSignTransaction: NEMSignTransaction,
60885
61245
  solGetAddress: SolGetAddress,
@@ -60950,7 +61310,25 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
60950
61310
  });
60951
61311
 
60952
61312
  const publicMethodRegistry = ApiMethods;
60953
- function findMethod(message) {
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;
60954
61332
  const { method } = message.payload;
60955
61333
  if (typeof method !== 'string') {
60956
61334
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Method is not set');
@@ -60959,6 +61337,13 @@ function findMethod(message) {
60959
61337
  if (MethodConstructor) {
60960
61338
  return new MethodConstructor(message);
60961
61339
  }
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
+ }
60962
61347
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Method ${method} is not set`);
60963
61348
  }
60964
61349
 
@@ -61361,7 +61746,10 @@ const callAPI = (context, message) => __awaiter(void 0, void 0, void 0, function
61361
61746
  }
61362
61747
  let method;
61363
61748
  try {
61364
- method = findMethod(message);
61749
+ method = findMethod(message, {
61750
+ extensions: context.methodExtensions,
61751
+ allowDestructiveOperations: context.allowDestructiveOperations,
61752
+ });
61365
61753
  method.connector = _connector;
61366
61754
  const shouldPostMessage = createUiProgressMessageFilter();
61367
61755
  method.postMessage = event => {
@@ -62268,18 +62656,22 @@ const createUiPromise = (promiseEvent, device) => {
62268
62656
  const removeUiPromise = (promise) => {
62269
62657
  _uiPromises = _uiPromises.filter(p => p !== promise);
62270
62658
  };
62271
- class Core extends events.exports {
62272
- constructor() {
62659
+ class Core extends events.exports.EventEmitter {
62660
+ constructor(options = {}) {
62273
62661
  super();
62274
62662
  this.requestQueue = new RequestQueue();
62275
62663
  this.methodSynchronize = getSynchronize();
62664
+ this.options = options;
62276
62665
  this.tracingContext = createSdkTracingContext();
62277
62666
  this.sdkInstanceId = this.tracingContext.sdkInstanceId;
62278
62667
  Log.debug(`[Core] Created SDK instance: ${this.sdkInstanceId}`);
62279
62668
  }
62280
62669
  getCoreContext() {
62670
+ var _a;
62281
62671
  return {
62282
62672
  sdkInstanceId: this.sdkInstanceId,
62673
+ methodExtensions: (_a = this.options.methodExtensions) !== null && _a !== void 0 ? _a : [],
62674
+ allowDestructiveOperations: this.options.allowDestructiveOperations === true,
62283
62675
  tracingContext: this.tracingContext,
62284
62676
  requestQueue: this.requestQueue,
62285
62677
  methodSynchronize: this.methodSynchronize,
@@ -62388,8 +62780,8 @@ class Core extends events.exports {
62388
62780
  });
62389
62781
  }
62390
62782
  }
62391
- const initCore = () => {
62392
- const core = new Core();
62783
+ const initCore = (options) => {
62784
+ const core = new Core(options);
62393
62785
  _core = core;
62394
62786
  return core;
62395
62787
  };
@@ -62406,7 +62798,7 @@ const initConnector = () => {
62406
62798
  const initTransport = (Transport, plugin) => {
62407
62799
  TransportManager.setTransport(Transport, plugin);
62408
62800
  };
62409
- const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0, function* () {
62801
+ const init = (settings, Transport, plugin, options) => __awaiter(void 0, void 0, void 0, function* () {
62410
62802
  try {
62411
62803
  try {
62412
62804
  yield DataManager.load(settings);
@@ -62419,7 +62811,7 @@ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0,
62419
62811
  if (DataManager.getSettings('env') !== 'react-native') {
62420
62812
  setLoggerPostMessage(postMessage);
62421
62813
  }
62422
- initCore();
62814
+ initCore(options);
62423
62815
  initConnector();
62424
62816
  return _core;
62425
62817
  }
@@ -62436,6 +62828,2189 @@ const switchTransport = ({ env, Transport, plugin, }) => {
62436
62828
  initConnector();
62437
62829
  };
62438
62830
 
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
+
62439
65014
  const HardwareSdk = ({ init, call, dispose, eventEmitter, uiResponse, cancel, updateSettings, switchTransport, }) => inject({
62440
65015
  init,
62441
65016
  call,
@@ -62486,6 +65061,7 @@ exports.DEVICE_SETTINGS_V2_ONLY_FIELDS = DEVICE_SETTINGS_V2_ONLY_FIELDS;
62486
65061
  exports.DataManager = DataManager;
62487
65062
  exports.DeviceModelToTypes = DeviceModelToTypes;
62488
65063
  exports.DeviceTypeToModels = DeviceTypeToModels;
65064
+ exports.FACTORY_API_METHOD_NAMES = FACTORY_API_METHOD_NAMES;
62489
65065
  exports.FIRMWARE = FIRMWARE;
62490
65066
  exports.FIRMWARE_EVENT = FIRMWARE_EVENT;
62491
65067
  exports.HardwareSDKLowLevel = HardwareSDKLowLevel;
@@ -62499,6 +65075,7 @@ exports.PRO2_WALLPAPER_HEIGHT = PRO2_WALLPAPER_HEIGHT;
62499
65075
  exports.PRO2_WALLPAPER_WIDTH = PRO2_WALLPAPER_WIDTH;
62500
65076
  exports.PROTOCOL_V2_NEVER_TIMEOUT_MS = PROTOCOL_V2_NEVER_TIMEOUT_MS;
62501
65077
  exports.RESPONSE_EVENT = RESPONSE_EVENT;
65078
+ exports.TEST_API_METHOD_NAMES = TEST_API_METHOD_NAMES;
62502
65079
  exports.UI_EVENT = UI_EVENT;
62503
65080
  exports.UI_REQUEST = UI_REQUEST;
62504
65081
  exports.UI_RESPONSE = UI_RESPONSE;
@@ -62510,18 +65087,21 @@ exports.completeRequestContext = completeRequestContext;
62510
65087
  exports.corsValidator = corsValidator;
62511
65088
  exports.createDeviceMessage = createDeviceMessage;
62512
65089
  exports.createErrorMessage = createErrorMessage;
65090
+ exports.createFactoryApi = createFactoryApi;
62513
65091
  exports.createFirmwareMessage = createFirmwareMessage;
62514
65092
  exports.createIFrameMessage = createIFrameMessage;
62515
65093
  exports.createLogMessage = createLogMessage;
62516
65094
  exports.createRequestContext = createRequestContext;
62517
65095
  exports.createResponseMessage = createResponseMessage;
62518
65096
  exports.createSdkTracingContext = createSdkTracingContext;
65097
+ exports.createTestApi = createTestApi;
62519
65098
  exports.createUiMessage = createUiMessage;
62520
65099
  exports.createUiResponse = createUiResponse;
62521
65100
  exports["default"] = HardwareSdk;
62522
65101
  exports.enableLog = enableLog;
62523
65102
  exports.encodePro2Wallpaper = encodePro2Wallpaper;
62524
65103
  exports.executeCallback = executeCallback;
65104
+ exports.factoryApiMethodExtension = factoryApiMethodExtension;
62525
65105
  exports.formatLogMethodLabel = formatLogMethodLabel;
62526
65106
  exports.formatRequestContext = formatRequestContext;
62527
65107
  exports.generateInstanceId = generateInstanceId;
@@ -62574,6 +65154,7 @@ exports.safeThrowError = safeThrowError;
62574
65154
  exports.setLoggerPostMessage = setLoggerPostMessage;
62575
65155
  exports.supportInputPinOnSoftware = supportInputPinOnSoftware;
62576
65156
  exports.switchTransport = switchTransport;
65157
+ exports.testApiMethodExtension = testApiMethodExtension;
62577
65158
  exports.updateRequestContext = updateRequestContext;
62578
65159
  exports.versionCompare = versionCompare;
62579
65160
  exports.versionSplit = versionSplit;