@onekeyfe/hd-core 1.2.0-alpha.56 → 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.
- package/__tests__/protocol-v2.test.ts +125 -3
- package/__tests__/public-pro2-api-boundary.test.ts +98 -2
- package/__tests__/public-test-api-boundary.test.ts +167 -0
- package/dist/api/BixinBackupDevice.d.ts +7 -0
- package/dist/api/BixinBackupDevice.d.ts.map +1 -0
- package/dist/api/BixinLoadDevice.d.ts +7 -0
- package/dist/api/BixinLoadDevice.d.ts.map +1 -0
- package/dist/api/BixinMessageSE.d.ts +8 -0
- package/dist/api/BixinMessageSE.d.ts.map +1 -0
- package/dist/api/BixinVerifyDeviceRequest.d.ts +8 -0
- package/dist/api/BixinVerifyDeviceRequest.d.ts.map +1 -0
- package/dist/api/WebAuthnAddResidentCredential.d.ts +8 -0
- package/dist/api/WebAuthnAddResidentCredential.d.ts.map +1 -0
- package/dist/api/WebAuthnListResidentCredentials.d.ts +8 -0
- package/dist/api/WebAuthnListResidentCredentials.d.ts.map +1 -0
- package/dist/api/WebAuthnRemoveResidentCredential.d.ts +8 -0
- package/dist/api/WebAuthnRemoveResidentCredential.d.ts.map +1 -0
- package/dist/api/binance/BinanceGetAddress.d.ts +8 -0
- package/dist/api/binance/BinanceGetAddress.d.ts.map +1 -0
- package/dist/api/binance/BinanceGetPublicKey.d.ts +8 -0
- package/dist/api/binance/BinanceGetPublicKey.d.ts.map +1 -0
- package/dist/api/binance/BinanceSignTx.d.ts +7 -0
- package/dist/api/binance/BinanceSignTx.d.ts.map +1 -0
- package/dist/api/btc/BTCAuthorizeCoinJoin.d.ts +7 -0
- package/dist/api/btc/BTCAuthorizeCoinJoin.d.ts.map +1 -0
- package/dist/api/btc/BTCGetOwnershipId.d.ts +7 -0
- package/dist/api/btc/BTCGetOwnershipId.d.ts.map +1 -0
- package/dist/api/btc/BTCGetOwnershipProof.d.ts +7 -0
- package/dist/api/btc/BTCGetOwnershipProof.d.ts.map +1 -0
- package/dist/api/crypto/CryptoBatchGetPublickeys.d.ts +8 -0
- package/dist/api/crypto/CryptoBatchGetPublickeys.d.ts.map +1 -0
- package/dist/api/crypto/CryptoCipherKeyValue.d.ts +8 -0
- package/dist/api/crypto/CryptoCipherKeyValue.d.ts.map +1 -0
- package/dist/api/crypto/CryptoCosiCommit.d.ts +8 -0
- package/dist/api/crypto/CryptoCosiCommit.d.ts.map +1 -0
- package/dist/api/crypto/CryptoCosiSign.d.ts +8 -0
- package/dist/api/crypto/CryptoCosiSign.d.ts.map +1 -0
- package/dist/api/crypto/CryptoGetECDHSessionKey.d.ts +8 -0
- package/dist/api/crypto/CryptoGetECDHSessionKey.d.ts.map +1 -0
- package/dist/api/crypto/CryptoSignIdentity.d.ts +8 -0
- package/dist/api/crypto/CryptoSignIdentity.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkDecision.d.ts +7 -0
- package/dist/api/debug/DebugLinkDecision.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkEraseSdCard.d.ts +7 -0
- package/dist/api/debug/DebugLinkEraseSdCard.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkFlashErase.d.ts +7 -0
- package/dist/api/debug/DebugLinkFlashErase.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkGetState.d.ts +7 -0
- package/dist/api/debug/DebugLinkGetState.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkMemoryRead.d.ts +7 -0
- package/dist/api/debug/DebugLinkMemoryRead.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkMemoryWrite.d.ts +7 -0
- package/dist/api/debug/DebugLinkMemoryWrite.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkRecordScreen.d.ts +7 -0
- package/dist/api/debug/DebugLinkRecordScreen.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkReseedRandom.d.ts +7 -0
- package/dist/api/debug/DebugLinkReseedRandom.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkStop.d.ts +7 -0
- package/dist/api/debug/DebugLinkStop.d.ts.map +1 -0
- package/dist/api/debug/DebugLinkWatchLayout.d.ts +7 -0
- package/dist/api/debug/DebugLinkWatchLayout.d.ts.map +1 -0
- package/dist/api/device/DeviceVerify.d.ts.map +1 -1
- package/dist/api/emmc/EmmcDirList.d.ts +7 -0
- package/dist/api/emmc/EmmcDirList.d.ts.map +1 -0
- package/dist/api/emmc/EmmcDirMake.d.ts +7 -0
- package/dist/api/emmc/EmmcDirMake.d.ts.map +1 -0
- package/dist/api/emmc/EmmcDirRemove.d.ts +7 -0
- package/dist/api/emmc/EmmcDirRemove.d.ts.map +1 -0
- package/dist/api/emmc/EmmcFileDelete.d.ts +7 -0
- package/dist/api/emmc/EmmcFileDelete.d.ts.map +1 -0
- package/dist/api/emmc/EmmcFileRead.d.ts +7 -0
- package/dist/api/emmc/EmmcFileRead.d.ts.map +1 -0
- package/dist/api/emmc/EmmcFileWrite.d.ts +7 -0
- package/dist/api/emmc/EmmcFileWrite.d.ts.map +1 -0
- package/dist/api/emmc/EmmcFixPermission.d.ts +7 -0
- package/dist/api/emmc/EmmcFixPermission.d.ts.map +1 -0
- package/dist/api/emmc/EmmcPathInfo.d.ts +7 -0
- package/dist/api/emmc/EmmcPathInfo.d.ts.map +1 -0
- package/dist/api/eos/EosGetPublicKey.d.ts +8 -0
- package/dist/api/eos/EosGetPublicKey.d.ts.map +1 -0
- package/dist/api/eos/EosSignTx.d.ts +12 -0
- package/dist/api/eos/EosSignTx.d.ts.map +1 -0
- package/dist/api/evmTrezor/EVMGetAddress.d.ts +10 -0
- package/dist/api/evmTrezor/EVMGetAddress.d.ts.map +1 -0
- package/dist/api/evmTrezor/EVMGetPublicKey.d.ts +16 -0
- package/dist/api/evmTrezor/EVMGetPublicKey.d.ts.map +1 -0
- package/dist/api/evmTrezor/EVMSignMessage.d.ts +7 -0
- package/dist/api/evmTrezor/EVMSignMessage.d.ts.map +1 -0
- package/dist/api/evmTrezor/EVMSignTransaction.d.ts +15 -0
- package/dist/api/evmTrezor/EVMSignTransaction.d.ts.map +1 -0
- package/dist/api/evmTrezor/EVMSignTypedData.d.ts +43 -0
- package/dist/api/evmTrezor/EVMSignTypedData.d.ts.map +1 -0
- package/dist/api/evmTrezor/EVMVerifyMessage.d.ts +7 -0
- package/dist/api/evmTrezor/EVMVerifyMessage.d.ts.map +1 -0
- package/dist/api/evmTrezor/legacyV1/getAddress.d.ts +6 -0
- package/dist/api/evmTrezor/legacyV1/getAddress.d.ts.map +1 -0
- package/dist/api/evmTrezor/legacyV1/getPublicKey.d.ts +6 -0
- package/dist/api/evmTrezor/legacyV1/getPublicKey.d.ts.map +1 -0
- package/dist/api/evmTrezor/legacyV1/signMessage.d.ts +6 -0
- package/dist/api/evmTrezor/legacyV1/signMessage.d.ts.map +1 -0
- package/dist/api/evmTrezor/legacyV1/signTransaction.d.ts +9 -0
- package/dist/api/evmTrezor/legacyV1/signTransaction.d.ts.map +1 -0
- package/dist/api/evmTrezor/legacyV1/signTypedData.d.ts +10 -0
- package/dist/api/evmTrezor/legacyV1/signTypedData.d.ts.map +1 -0
- package/dist/api/evmTrezor/legacyV1/signTypedHash.d.ts +11 -0
- package/dist/api/evmTrezor/legacyV1/signTypedHash.d.ts.map +1 -0
- package/dist/api/evmTrezor/legacyV1/verifyMessage.d.ts +6 -0
- package/dist/api/evmTrezor/legacyV1/verifyMessage.d.ts.map +1 -0
- package/dist/api/extensionMethodNames.d.ts +3 -0
- package/dist/api/extensionMethodNames.d.ts.map +1 -0
- package/dist/api/factoryMethods.d.ts +3 -0
- package/dist/api/factoryMethods.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareErase.d.ts +12 -0
- package/dist/api/firmware/FirmwareErase.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareEraseEx.d.ts +12 -0
- package/dist/api/firmware/FirmwareEraseEx.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUpdateEmmcTest.d.ts +7 -0
- package/dist/api/firmware/FirmwareUpdateEmmcTest.d.ts.map +1 -0
- package/dist/api/firmware/FirmwareUploadTest.d.ts +7 -0
- package/dist/api/firmware/FirmwareUploadTest.d.ts.map +1 -0
- package/dist/api/firmware/Reboot.d.ts +7 -0
- package/dist/api/firmware/Reboot.d.ts.map +1 -0
- package/dist/api/firmware/SelfTest.d.ts +7 -0
- package/dist/api/firmware/SelfTest.d.ts.map +1 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/manager/DeviceCancelAuthorization.d.ts +7 -0
- package/dist/api/manager/DeviceCancelAuthorization.d.ts.map +1 -0
- package/dist/api/manager/DeviceChangeWipeCode.d.ts +7 -0
- package/dist/api/manager/DeviceChangeWipeCode.d.ts.map +1 -0
- package/dist/api/manager/DeviceDoPreauthorized.d.ts +7 -0
- package/dist/api/manager/DeviceDoPreauthorized.d.ts.map +1 -0
- package/dist/api/manager/DeviceEndSession.d.ts +7 -0
- package/dist/api/manager/DeviceEndSession.d.ts.map +1 -0
- package/dist/api/manager/DeviceGetEntropy.d.ts +7 -0
- package/dist/api/manager/DeviceGetEntropy.d.ts.map +1 -0
- package/dist/api/manager/DeviceGetFirmwareHash.d.ts +7 -0
- package/dist/api/manager/DeviceGetFirmwareHash.d.ts.map +1 -0
- package/dist/api/manager/DeviceInfoSettings.d.ts +7 -0
- package/dist/api/manager/DeviceInfoSettings.d.ts.map +1 -0
- package/dist/api/manager/DeviceLoad.d.ts +7 -0
- package/dist/api/manager/DeviceLoad.d.ts.map +1 -0
- package/dist/api/manager/DevicePing.d.ts +7 -0
- package/dist/api/manager/DevicePing.d.ts.map +1 -0
- package/dist/api/manager/DeviceReadSEPublicCert.d.ts +7 -0
- package/dist/api/manager/DeviceReadSEPublicCert.d.ts.map +1 -0
- package/dist/api/manager/DeviceSESignMessage.d.ts +7 -0
- package/dist/api/manager/DeviceSESignMessage.d.ts.map +1 -0
- package/dist/api/manager/DeviceSdProtect.d.ts +7 -0
- package/dist/api/manager/DeviceSdProtect.d.ts.map +1 -0
- package/dist/api/manager/DeviceSpiFlashRead.d.ts +7 -0
- package/dist/api/manager/DeviceSpiFlashRead.d.ts.map +1 -0
- package/dist/api/manager/DeviceSpiFlashWrite.d.ts +7 -0
- package/dist/api/manager/DeviceSpiFlashWrite.d.ts.map +1 -0
- package/dist/api/manager/DeviceUnlockPath.d.ts +7 -0
- package/dist/api/manager/DeviceUnlockPath.d.ts.map +1 -0
- package/dist/api/manager/DeviceWriteSEPrivateKey.d.ts +7 -0
- package/dist/api/manager/DeviceWriteSEPrivateKey.d.ts.map +1 -0
- package/dist/api/manager/DeviceWriteSEPublicCert.d.ts +7 -0
- package/dist/api/manager/DeviceWriteSEPublicCert.d.ts.map +1 -0
- package/dist/api/manager/GetDeviceInfoSettings.d.ts +7 -0
- package/dist/api/manager/GetDeviceInfoSettings.d.ts.map +1 -0
- package/dist/api/manager/GetPublicKeyMultiple.d.ts +7 -0
- package/dist/api/manager/GetPublicKeyMultiple.d.ts.map +1 -0
- package/dist/api/manager/ListResDir.d.ts +7 -0
- package/dist/api/manager/ListResDir.d.ts.map +1 -0
- package/dist/api/manager/NFTWriteData.d.ts +7 -0
- package/dist/api/manager/NFTWriteData.d.ts.map +1 -0
- package/dist/api/manager/NFTWriteInfo.d.ts +7 -0
- package/dist/api/manager/NFTWriteInfo.d.ts.map +1 -0
- package/dist/api/manager/ReadSEPublicKey.d.ts +7 -0
- package/dist/api/manager/ReadSEPublicKey.d.ts.map +1 -0
- package/dist/api/manager/ResourceUpdate.d.ts +6 -0
- package/dist/api/manager/ResourceUpdate.d.ts.map +1 -0
- package/dist/api/methodExtension.d.ts +13 -0
- package/dist/api/methodExtension.d.ts.map +1 -0
- package/dist/api/monero/MoneroGetAddress.d.ts +9 -0
- package/dist/api/monero/MoneroGetAddress.d.ts.map +1 -0
- package/dist/api/monero/MoneroGetWatchKey.d.ts +8 -0
- package/dist/api/monero/MoneroGetWatchKey.d.ts.map +1 -0
- package/dist/api/nem/NEMDecryptMessage.d.ts +8 -0
- package/dist/api/nem/NEMDecryptMessage.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryCertificateRead.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFactoryCertificateRead.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryCertificateWrite.d.ts +8 -0
- package/dist/api/protocol-v2/DeviceFactoryCertificateWrite.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryChallengeSign.d.ts +8 -0
- package/dist/api/protocol-v2/DeviceFactoryChallengeSign.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -1
- package/dist/api/protocol-v2/helpers.d.ts +15 -5
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +1 -1
- package/dist/api/testMethods.d.ts +82 -0
- package/dist/api/testMethods.d.ts.map +1 -0
- package/dist/api/tezos/TezosGetAddress.d.ts +9 -0
- package/dist/api/tezos/TezosGetAddress.d.ts.map +1 -0
- package/dist/api/tezos/TezosGetPublicKey.d.ts +8 -0
- package/dist/api/tezos/TezosGetPublicKey.d.ts.map +1 -0
- package/dist/api/tezos/TezosSignTx.d.ts +12 -0
- package/dist/api/tezos/TezosSignTx.d.ts.map +1 -0
- package/dist/api/utils.d.ts +6 -1
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/core/index.d.ts +10 -4
- package/dist/core/index.d.ts.map +1 -1
- package/dist/index.d.ts +722 -41
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2617 -51
- package/dist/inject.d.ts +6 -2
- package/dist/inject.d.ts.map +1 -1
- package/dist/types/api/binanceGetAddress.d.ts +11 -0
- package/dist/types/api/binanceGetAddress.d.ts.map +1 -0
- package/dist/types/api/binanceGetPublicKey.d.ts +11 -0
- package/dist/types/api/binanceGetPublicKey.d.ts.map +1 -0
- package/dist/types/api/binanceSignTx.d.ts +7 -0
- package/dist/types/api/binanceSignTx.d.ts.map +1 -0
- package/dist/types/api/bixinBackupDevice.d.ts +4 -0
- package/dist/types/api/bixinBackupDevice.d.ts.map +1 -0
- package/dist/types/api/bixinLoadDevice.d.ts +4 -0
- package/dist/types/api/bixinLoadDevice.d.ts.map +1 -0
- package/dist/types/api/bixinMessageSE.d.ts +4 -0
- package/dist/types/api/bixinMessageSE.d.ts.map +1 -0
- package/dist/types/api/bixinVerifyDeviceRequest.d.ts +4 -0
- package/dist/types/api/bixinVerifyDeviceRequest.d.ts.map +1 -0
- package/dist/types/api/btcAuthorizeCoinJoin.d.ts +13 -0
- package/dist/types/api/btcAuthorizeCoinJoin.d.ts.map +1 -0
- package/dist/types/api/btcGetOwnershipId.d.ts +10 -0
- package/dist/types/api/btcGetOwnershipId.d.ts.map +1 -0
- package/dist/types/api/btcGetOwnershipProof.d.ts +13 -0
- package/dist/types/api/btcGetOwnershipProof.d.ts.map +1 -0
- package/dist/types/api/cryptoBatchGetPublickeys.d.ts +12 -0
- package/dist/types/api/cryptoBatchGetPublickeys.d.ts.map +1 -0
- package/dist/types/api/cryptoCipherKeyValue.d.ts +13 -0
- package/dist/types/api/cryptoCipherKeyValue.d.ts.map +1 -0
- package/dist/types/api/cryptoCosiCommit.d.ts +8 -0
- package/dist/types/api/cryptoCosiCommit.d.ts.map +1 -0
- package/dist/types/api/cryptoCosiSign.d.ts +10 -0
- package/dist/types/api/cryptoCosiSign.d.ts.map +1 -0
- package/dist/types/api/cryptoGetECDHSessionKey.d.ts +4 -0
- package/dist/types/api/cryptoGetECDHSessionKey.d.ts.map +1 -0
- package/dist/types/api/cryptoSignIdentity.d.ts +4 -0
- package/dist/types/api/cryptoSignIdentity.d.ts.map +1 -0
- package/dist/types/api/debugLinkDecision.d.ts +4 -0
- package/dist/types/api/debugLinkDecision.d.ts.map +1 -0
- package/dist/types/api/debugLinkEraseSdCard.d.ts +4 -0
- package/dist/types/api/debugLinkEraseSdCard.d.ts.map +1 -0
- package/dist/types/api/debugLinkFlashErase.d.ts +4 -0
- package/dist/types/api/debugLinkFlashErase.d.ts.map +1 -0
- package/dist/types/api/debugLinkGetState.d.ts +4 -0
- package/dist/types/api/debugLinkGetState.d.ts.map +1 -0
- package/dist/types/api/debugLinkMemoryRead.d.ts +4 -0
- package/dist/types/api/debugLinkMemoryRead.d.ts.map +1 -0
- package/dist/types/api/debugLinkMemoryWrite.d.ts +4 -0
- package/dist/types/api/debugLinkMemoryWrite.d.ts.map +1 -0
- package/dist/types/api/debugLinkRecordScreen.d.ts +4 -0
- package/dist/types/api/debugLinkRecordScreen.d.ts.map +1 -0
- package/dist/types/api/debugLinkReseedRandom.d.ts +4 -0
- package/dist/types/api/debugLinkReseedRandom.d.ts.map +1 -0
- package/dist/types/api/debugLinkStop.d.ts +4 -0
- package/dist/types/api/debugLinkStop.d.ts.map +1 -0
- package/dist/types/api/debugLinkWatchLayout.d.ts +4 -0
- package/dist/types/api/debugLinkWatchLayout.d.ts.map +1 -0
- package/dist/types/api/deviceCancelAuthorization.d.ts +4 -0
- package/dist/types/api/deviceCancelAuthorization.d.ts.map +1 -0
- package/dist/types/api/deviceChangeWipeCode.d.ts +4 -0
- package/dist/types/api/deviceChangeWipeCode.d.ts.map +1 -0
- package/dist/types/api/deviceDoPreauthorized.d.ts +4 -0
- package/dist/types/api/deviceDoPreauthorized.d.ts.map +1 -0
- package/dist/types/api/deviceEndSession.d.ts +4 -0
- package/dist/types/api/deviceEndSession.d.ts.map +1 -0
- package/dist/types/api/deviceGetEntropy.d.ts +4 -0
- package/dist/types/api/deviceGetEntropy.d.ts.map +1 -0
- package/dist/types/api/deviceGetFirmwareHash.d.ts +4 -0
- package/dist/types/api/deviceGetFirmwareHash.d.ts.map +1 -0
- package/dist/types/api/deviceGetInfo.d.ts +4 -0
- package/dist/types/api/deviceGetInfo.d.ts.map +1 -0
- package/dist/types/api/deviceInfoSettings.d.ts +4 -0
- package/dist/types/api/deviceInfoSettings.d.ts.map +1 -0
- package/dist/types/api/deviceLoad.d.ts +16 -0
- package/dist/types/api/deviceLoad.d.ts.map +1 -0
- package/dist/types/api/devicePing.d.ts +4 -0
- package/dist/types/api/devicePing.d.ts.map +1 -0
- package/dist/types/api/deviceReadSEPublicCert.d.ts +4 -0
- package/dist/types/api/deviceReadSEPublicCert.d.ts.map +1 -0
- package/dist/types/api/deviceSESignMessage.d.ts +4 -0
- package/dist/types/api/deviceSESignMessage.d.ts.map +1 -0
- package/dist/types/api/deviceSdProtect.d.ts +4 -0
- package/dist/types/api/deviceSdProtect.d.ts.map +1 -0
- package/dist/types/api/deviceSpiFlashRead.d.ts +4 -0
- package/dist/types/api/deviceSpiFlashRead.d.ts.map +1 -0
- package/dist/types/api/deviceSpiFlashWrite.d.ts +4 -0
- package/dist/types/api/deviceSpiFlashWrite.d.ts.map +1 -0
- package/dist/types/api/deviceUnlockPath.d.ts +11 -0
- package/dist/types/api/deviceUnlockPath.d.ts.map +1 -0
- package/dist/types/api/deviceWriteSEPrivateKey.d.ts +4 -0
- package/dist/types/api/deviceWriteSEPrivateKey.d.ts.map +1 -0
- package/dist/types/api/deviceWriteSEPublicCert.d.ts +4 -0
- package/dist/types/api/deviceWriteSEPublicCert.d.ts.map +1 -0
- package/dist/types/api/emmcDirList.d.ts +4 -0
- package/dist/types/api/emmcDirList.d.ts.map +1 -0
- package/dist/types/api/emmcDirMake.d.ts +4 -0
- package/dist/types/api/emmcDirMake.d.ts.map +1 -0
- package/dist/types/api/emmcDirRemove.d.ts +4 -0
- package/dist/types/api/emmcDirRemove.d.ts.map +1 -0
- package/dist/types/api/emmcFileDelete.d.ts +4 -0
- package/dist/types/api/emmcFileDelete.d.ts.map +1 -0
- package/dist/types/api/emmcFileRead.d.ts +4 -0
- package/dist/types/api/emmcFileRead.d.ts.map +1 -0
- package/dist/types/api/emmcFileWrite.d.ts +4 -0
- package/dist/types/api/emmcFileWrite.d.ts.map +1 -0
- package/dist/types/api/emmcFixPermission.d.ts +4 -0
- package/dist/types/api/emmcFixPermission.d.ts.map +1 -0
- package/dist/types/api/emmcPathInfo.d.ts +4 -0
- package/dist/types/api/emmcPathInfo.d.ts.map +1 -0
- package/dist/types/api/eosGetPublicKey.d.ts +8 -0
- package/dist/types/api/eosGetPublicKey.d.ts.map +1 -0
- package/dist/types/api/eosSignTx.d.ts +7 -0
- package/dist/types/api/eosSignTx.d.ts.map +1 -0
- package/dist/types/api/evmGetAddressTrezor.d.ts +15 -0
- package/dist/types/api/evmGetAddressTrezor.d.ts.map +1 -0
- package/dist/types/api/evmGetPublicKeyTrezor.d.ts +20 -0
- package/dist/types/api/evmGetPublicKeyTrezor.d.ts.map +1 -0
- package/dist/types/api/evmSignMessageTrezor.d.ts +9 -0
- package/dist/types/api/evmSignMessageTrezor.d.ts.map +1 -0
- package/dist/types/api/evmSignTransactionTrezor.d.ts +40 -0
- package/dist/types/api/evmSignTransactionTrezor.d.ts.map +1 -0
- package/dist/types/api/evmSignTypedDataTrezor.d.ts +34 -0
- package/dist/types/api/evmSignTypedDataTrezor.d.ts.map +1 -0
- package/dist/types/api/evmVerifyMessageTrezor.d.ts +10 -0
- package/dist/types/api/evmVerifyMessageTrezor.d.ts.map +1 -0
- package/dist/types/api/firmwareErase.d.ts +4 -0
- package/dist/types/api/firmwareErase.d.ts.map +1 -0
- package/dist/types/api/firmwareEraseEx.d.ts +4 -0
- package/dist/types/api/firmwareEraseEx.d.ts.map +1 -0
- package/dist/types/api/firmwareUpdateEmmcTest.d.ts +4 -0
- package/dist/types/api/firmwareUpdateEmmcTest.d.ts.map +1 -0
- package/dist/types/api/firmwareUploadTest.d.ts +4 -0
- package/dist/types/api/firmwareUploadTest.d.ts.map +1 -0
- package/dist/types/api/getPublicKeyMultiple.d.ts +4 -0
- package/dist/types/api/getPublicKeyMultiple.d.ts.map +1 -0
- package/dist/types/api/index.d.ts +176 -3
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/listResDir.d.ts +4 -0
- package/dist/types/api/listResDir.d.ts.map +1 -0
- package/dist/types/api/moneroGetAddress.d.ts +14 -0
- package/dist/types/api/moneroGetAddress.d.ts.map +1 -0
- package/dist/types/api/moneroGetWatchKey.d.ts +14 -0
- package/dist/types/api/moneroGetWatchKey.d.ts.map +1 -0
- package/dist/types/api/nemDecryptMessage.d.ts +10 -0
- package/dist/types/api/nemDecryptMessage.d.ts.map +1 -0
- package/dist/types/api/nftWriteData.d.ts +4 -0
- package/dist/types/api/nftWriteData.d.ts.map +1 -0
- package/dist/types/api/nftWriteInfo.d.ts +4 -0
- package/dist/types/api/nftWriteInfo.d.ts.map +1 -0
- package/dist/types/api/protocolV2.d.ts +8 -2
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/api/readSEPublicKey.d.ts +4 -0
- package/dist/types/api/readSEPublicKey.d.ts.map +1 -0
- package/dist/types/api/reboot.d.ts +4 -0
- package/dist/types/api/reboot.d.ts.map +1 -0
- package/dist/types/api/resourceUpdate.d.ts +7 -0
- package/dist/types/api/resourceUpdate.d.ts.map +1 -0
- package/dist/types/api/selfTest.d.ts +4 -0
- package/dist/types/api/selfTest.d.ts.map +1 -0
- package/dist/types/api/tezosGetAddress.d.ts +14 -0
- package/dist/types/api/tezosGetAddress.d.ts.map +1 -0
- package/dist/types/api/tezosGetPublicKey.d.ts +14 -0
- package/dist/types/api/tezosGetPublicKey.d.ts.map +1 -0
- package/dist/types/api/tezosSignTx.d.ts +7 -0
- package/dist/types/api/tezosSignTx.d.ts.map +1 -0
- package/dist/types/api/webAuthnAddResidentCredential.d.ts +4 -0
- package/dist/types/api/webAuthnAddResidentCredential.d.ts.map +1 -0
- package/dist/types/api/webAuthnListResidentCredentials.d.ts +4 -0
- package/dist/types/api/webAuthnListResidentCredentials.d.ts.map +1 -0
- package/dist/types/api/webAuthnRemoveResidentCredential.d.ts +4 -0
- package/dist/types/api/webAuthnRemoveResidentCredential.d.ts.map +1 -0
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BixinBackupDevice.ts +15 -0
- package/src/api/BixinLoadDevice.ts +22 -0
- package/src/api/BixinMessageSE.ts +22 -0
- package/src/api/BixinVerifyDeviceRequest.ts +22 -0
- package/src/api/WebAuthnAddResidentCredential.ts +22 -0
- package/src/api/WebAuthnListResidentCredentials.ts +24 -0
- package/src/api/WebAuthnRemoveResidentCredential.ts +22 -0
- package/src/api/binance/BinanceGetAddress.ts +26 -0
- package/src/api/binance/BinanceGetPublicKey.ts +26 -0
- package/src/api/binance/BinanceSignTx.ts +35 -0
- package/src/api/btc/BTCAuthorizeCoinJoin.ts +37 -0
- package/src/api/btc/BTCGetOwnershipId.ts +34 -0
- package/src/api/btc/BTCGetOwnershipProof.ts +37 -0
- package/src/api/crypto/CryptoBatchGetPublickeys.ts +30 -0
- package/src/api/crypto/CryptoCipherKeyValue.ts +29 -0
- package/src/api/crypto/CryptoCosiCommit.ts +24 -0
- package/src/api/crypto/CryptoCosiSign.ts +26 -0
- package/src/api/crypto/CryptoGetECDHSessionKey.ts +24 -0
- package/src/api/crypto/CryptoSignIdentity.ts +25 -0
- package/src/api/debug/DebugLinkDecision.ts +25 -0
- package/src/api/debug/DebugLinkEraseSdCard.ts +23 -0
- package/src/api/debug/DebugLinkFlashErase.ts +23 -0
- package/src/api/debug/DebugLinkGetState.ts +21 -0
- package/src/api/debug/DebugLinkMemoryRead.ts +24 -0
- package/src/api/debug/DebugLinkMemoryWrite.ts +25 -0
- package/src/api/debug/DebugLinkRecordScreen.ts +23 -0
- package/src/api/debug/DebugLinkReseedRandom.ts +23 -0
- package/src/api/debug/DebugLinkStop.ts +25 -0
- package/src/api/debug/DebugLinkWatchLayout.ts +23 -0
- package/src/api/device/DeviceVerify.ts +2 -0
- package/src/api/emmc/EmmcDirList.ts +20 -0
- package/src/api/emmc/EmmcDirMake.ts +20 -0
- package/src/api/emmc/EmmcDirRemove.ts +20 -0
- package/src/api/emmc/EmmcFileDelete.ts +20 -0
- package/src/api/emmc/EmmcFileRead.ts +21 -0
- package/src/api/emmc/EmmcFileWrite.ts +23 -0
- package/src/api/emmc/EmmcFixPermission.ts +17 -0
- package/src/api/emmc/EmmcPathInfo.ts +20 -0
- package/src/api/eos/EosGetPublicKey.ts +26 -0
- package/src/api/eos/EosSignTx.ts +40 -0
- package/src/api/evmTrezor/EVMGetAddress.ts +75 -0
- package/src/api/evmTrezor/EVMGetPublicKey.ts +106 -0
- package/src/api/evmTrezor/EVMSignMessage.ts +40 -0
- package/src/api/evmTrezor/EVMSignTransaction.ts +83 -0
- package/src/api/evmTrezor/EVMSignTypedData.ts +366 -0
- package/src/api/evmTrezor/EVMVerifyMessage.ts +37 -0
- package/src/api/evmTrezor/legacyV1/getAddress.ts +16 -0
- package/src/api/evmTrezor/legacyV1/getPublicKey.ts +20 -0
- package/src/api/evmTrezor/legacyV1/signMessage.ts +22 -0
- package/src/api/evmTrezor/legacyV1/signTransaction.ts +24 -0
- package/src/api/evmTrezor/legacyV1/signTypedData.ts +36 -0
- package/src/api/evmTrezor/legacyV1/signTypedHash.ts +48 -0
- package/src/api/evmTrezor/legacyV1/verifyMessage.ts +19 -0
- package/src/api/extensionMethodNames.ts +88 -0
- package/src/api/factoryMethods.ts +2 -0
- package/src/api/firmware/FirmwareErase.ts +18 -0
- package/src/api/firmware/FirmwareEraseEx.ts +18 -0
- package/src/api/firmware/FirmwareUpdateEmmcTest.ts +18 -0
- package/src/api/firmware/FirmwareUploadTest.ts +17 -0
- package/src/api/firmware/Reboot.ts +17 -0
- package/src/api/firmware/SelfTest.ts +17 -0
- package/src/api/index.ts +3 -0
- package/src/api/manager/DeviceCancelAuthorization.ts +15 -0
- package/src/api/manager/DeviceChangeWipeCode.ts +19 -0
- package/src/api/manager/DeviceDoPreauthorized.ts +15 -0
- package/src/api/manager/DeviceEndSession.ts +19 -0
- package/src/api/manager/DeviceGetEntropy.ts +19 -0
- package/src/api/manager/DeviceGetFirmwareHash.ts +23 -0
- package/src/api/manager/DeviceInfoSettings.ts +23 -0
- package/src/api/manager/DeviceLoad.ts +27 -0
- package/src/api/manager/DevicePing.ts +19 -0
- package/src/api/manager/DeviceReadSEPublicCert.ts +18 -0
- package/src/api/manager/DeviceSESignMessage.ts +23 -0
- package/src/api/manager/DeviceSdProtect.ts +18 -0
- package/src/api/manager/DeviceSpiFlashRead.ts +22 -0
- package/src/api/manager/DeviceSpiFlashWrite.ts +22 -0
- package/src/api/manager/DeviceUnlockPath.ts +26 -0
- package/src/api/manager/DeviceWriteSEPrivateKey.ts +23 -0
- package/src/api/manager/DeviceWriteSEPublicCert.ts +23 -0
- package/src/api/manager/GetDeviceInfoSettings.ts +20 -0
- package/src/api/manager/GetPublicKeyMultiple.ts +24 -0
- package/src/api/manager/ListResDir.ts +19 -0
- package/src/api/manager/NFTWriteData.ts +21 -0
- package/src/api/manager/NFTWriteInfo.ts +23 -0
- package/src/api/manager/ReadSEPublicKey.ts +20 -0
- package/src/api/manager/ResourceUpdate.ts +22 -0
- package/src/api/methodExtension.ts +27 -0
- package/src/api/monero/MoneroGetAddress.ts +64 -0
- package/src/api/monero/MoneroGetWatchKey.ts +59 -0
- package/src/api/nem/NEMDecryptMessage.ts +29 -0
- package/src/api/protocol-v2/DeviceFactoryCertificateRead.ts +25 -0
- package/src/api/protocol-v2/DeviceFactoryCertificateWrite.ts +30 -0
- package/src/api/protocol-v2/DeviceFactoryChallengeSign.ts +28 -0
- package/src/api/protocol-v2/DeviceFactoryInfoGet.ts +3 -0
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +6 -7
- package/src/api/protocol-v2/helpers.ts +152 -5
- package/src/api/testMethods.ts +95 -0
- package/src/api/tezos/TezosGetAddress.ts +64 -0
- package/src/api/tezos/TezosGetPublicKey.ts +63 -0
- package/src/api/tezos/TezosSignTx.ts +44 -0
- package/src/api/utils.ts +46 -1
- package/src/core/index.ts +22 -7
- package/src/index.ts +5 -0
- package/src/inject.ts +209 -7
- package/src/types/api/binanceGetAddress.ts +17 -0
- package/src/types/api/binanceGetPublicKey.ts +17 -0
- package/src/types/api/binanceSignTx.ts +15 -0
- package/src/types/api/bixinBackupDevice.ts +8 -0
- package/src/types/api/bixinLoadDevice.ts +8 -0
- package/src/types/api/bixinMessageSE.ts +8 -0
- package/src/types/api/bixinVerifyDeviceRequest.ts +8 -0
- package/src/types/api/btcAuthorizeCoinJoin.ts +18 -0
- package/src/types/api/btcGetOwnershipId.ts +19 -0
- package/src/types/api/btcGetOwnershipProof.ts +22 -0
- package/src/types/api/cryptoBatchGetPublickeys.ts +18 -0
- package/src/types/api/cryptoCipherKeyValue.ts +18 -0
- package/src/types/api/cryptoCosiCommit.ts +13 -0
- package/src/types/api/cryptoCosiSign.ts +15 -0
- package/src/types/api/cryptoGetECDHSessionKey.ts +8 -0
- package/src/types/api/cryptoSignIdentity.ts +8 -0
- package/src/types/api/debugLinkDecision.ts +7 -0
- package/src/types/api/debugLinkEraseSdCard.ts +7 -0
- package/src/types/api/debugLinkFlashErase.ts +7 -0
- package/src/types/api/debugLinkGetState.ts +7 -0
- package/src/types/api/debugLinkMemoryRead.ts +7 -0
- package/src/types/api/debugLinkMemoryWrite.ts +7 -0
- package/src/types/api/debugLinkRecordScreen.ts +7 -0
- package/src/types/api/debugLinkReseedRandom.ts +7 -0
- package/src/types/api/debugLinkStop.ts +7 -0
- package/src/types/api/debugLinkWatchLayout.ts +7 -0
- package/src/types/api/deviceCancelAuthorization.ts +7 -0
- package/src/types/api/deviceChangeWipeCode.ts +7 -0
- package/src/types/api/deviceDoPreauthorized.ts +7 -0
- package/src/types/api/deviceEndSession.ts +7 -0
- package/src/types/api/deviceGetEntropy.ts +7 -0
- package/src/types/api/deviceGetFirmwareHash.ts +7 -0
- package/src/types/api/deviceGetInfo.ts +7 -0
- package/src/types/api/deviceInfoSettings.ts +7 -0
- package/src/types/api/deviceLoad.ts +19 -0
- package/src/types/api/devicePing.ts +7 -0
- package/src/types/api/deviceReadSEPublicCert.ts +7 -0
- package/src/types/api/deviceSESignMessage.ts +7 -0
- package/src/types/api/deviceSdProtect.ts +7 -0
- package/src/types/api/deviceSpiFlashRead.ts +7 -0
- package/src/types/api/deviceSpiFlashWrite.ts +7 -0
- package/src/types/api/deviceUnlockPath.ts +16 -0
- package/src/types/api/deviceWriteSEPrivateKey.ts +7 -0
- package/src/types/api/deviceWriteSEPublicCert.ts +7 -0
- package/src/types/api/emmcDirList.ts +7 -0
- package/src/types/api/emmcDirMake.ts +7 -0
- package/src/types/api/emmcDirRemove.ts +7 -0
- package/src/types/api/emmcFileDelete.ts +7 -0
- package/src/types/api/emmcFileRead.ts +7 -0
- package/src/types/api/emmcFileWrite.ts +7 -0
- package/src/types/api/emmcFixPermission.ts +7 -0
- package/src/types/api/emmcPathInfo.ts +7 -0
- package/src/types/api/eosGetPublicKey.ts +13 -0
- package/src/types/api/eosSignTx.ts +12 -0
- package/src/types/api/evmGetAddressTrezor.ts +24 -0
- package/src/types/api/evmGetPublicKeyTrezor.ts +31 -0
- package/src/types/api/evmSignMessageTrezor.ts +14 -0
- package/src/types/api/evmSignTransactionTrezor.ts +49 -0
- package/src/types/api/evmSignTypedDataTrezor.ts +42 -0
- package/src/types/api/evmVerifyMessageTrezor.ts +15 -0
- package/src/types/api/firmwareErase.ts +4 -0
- package/src/types/api/firmwareEraseEx.ts +7 -0
- package/src/types/api/firmwareUpdateEmmcTest.ts +7 -0
- package/src/types/api/firmwareUploadTest.ts +7 -0
- package/src/types/api/getPublicKeyMultiple.ts +11 -0
- package/src/types/api/index.ts +288 -2
- package/src/types/api/listResDir.ts +8 -0
- package/src/types/api/moneroGetAddress.ts +23 -0
- package/src/types/api/moneroGetWatchKey.ts +26 -0
- package/src/types/api/nemDecryptMessage.ts +15 -0
- package/src/types/api/nftWriteData.ts +8 -0
- package/src/types/api/nftWriteInfo.ts +8 -0
- package/src/types/api/protocolV2.ts +43 -2
- package/src/types/api/readSEPublicKey.ts +8 -0
- package/src/types/api/reboot.ts +4 -0
- package/src/types/api/resourceUpdate.ts +11 -0
- package/src/types/api/selfTest.ts +7 -0
- package/src/types/api/tezosGetAddress.ts +23 -0
- package/src/types/api/tezosGetPublicKey.ts +23 -0
- package/src/types/api/tezosSignTx.ts +12 -0
- package/src/types/api/webAuthnAddResidentCredential.ts +8 -0
- package/src/types/api/webAuthnListResidentCredentials.ts +8 -0
- 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
|
|
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$
|
|
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$
|
|
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,
|
|
@@ -50654,6 +50939,63 @@ 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;
|
|
50658
51000
|
const FILE_TRANSFER_RATE_WINDOW_MS = 1000;
|
|
50659
51001
|
function isProtocolV2ResponseTimeout(error) {
|
|
@@ -53302,7 +53644,7 @@ class ConfluxSignTransaction extends BaseMethod {
|
|
|
53302
53644
|
}
|
|
53303
53645
|
}
|
|
53304
53646
|
|
|
53305
|
-
function getAddressLegacyV1 ({ typedCall, param, }) {
|
|
53647
|
+
function getAddressLegacyV1$1 ({ typedCall, param, }) {
|
|
53306
53648
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53307
53649
|
const message = {
|
|
53308
53650
|
address_n: param.address_n,
|
|
@@ -53321,7 +53663,7 @@ function getAddress ({ typedCall, param, }) {
|
|
|
53321
53663
|
|
|
53322
53664
|
const shouldUseLegacyV1EvmMessages = (device) => !device.isProtocolV2() && TransportManager.getProtocolV1MessageSchema() === 'v1LegacySchema';
|
|
53323
53665
|
|
|
53324
|
-
class EvmGetAddress extends BaseMethod {
|
|
53666
|
+
class EvmGetAddress$1 extends BaseMethod {
|
|
53325
53667
|
constructor() {
|
|
53326
53668
|
super(...arguments);
|
|
53327
53669
|
this.hasBundle = false;
|
|
@@ -53356,7 +53698,7 @@ class EvmGetAddress extends BaseMethod {
|
|
|
53356
53698
|
getEvmAddress(param) {
|
|
53357
53699
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53358
53700
|
if (shouldUseLegacyV1EvmMessages(this.device)) {
|
|
53359
|
-
return getAddressLegacyV1({
|
|
53701
|
+
return getAddressLegacyV1$1({
|
|
53360
53702
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
53361
53703
|
param,
|
|
53362
53704
|
});
|
|
@@ -53398,7 +53740,7 @@ function getPublicKey ({ typedCall, param, }) {
|
|
|
53398
53740
|
});
|
|
53399
53741
|
}
|
|
53400
53742
|
|
|
53401
|
-
function getPublicKeyLegacyV1 ({ typedCall, param, }) {
|
|
53743
|
+
function getPublicKeyLegacyV1$1 ({ typedCall, param, }) {
|
|
53402
53744
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53403
53745
|
const message = {
|
|
53404
53746
|
address_n: param.address_n,
|
|
@@ -53409,7 +53751,7 @@ function getPublicKeyLegacyV1 ({ typedCall, param, }) {
|
|
|
53409
53751
|
});
|
|
53410
53752
|
}
|
|
53411
53753
|
|
|
53412
|
-
class EVMGetPublicKey extends BaseMethod {
|
|
53754
|
+
class EVMGetPublicKey$1 extends BaseMethod {
|
|
53413
53755
|
constructor() {
|
|
53414
53756
|
super(...arguments);
|
|
53415
53757
|
this.hasBundle = false;
|
|
@@ -53447,7 +53789,7 @@ class EVMGetPublicKey extends BaseMethod {
|
|
|
53447
53789
|
}
|
|
53448
53790
|
getEvmPublicKey(param) {
|
|
53449
53791
|
if (shouldUseLegacyV1EvmMessages(this.device)) {
|
|
53450
|
-
return getPublicKeyLegacyV1({
|
|
53792
|
+
return getPublicKeyLegacyV1$1({
|
|
53451
53793
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
53452
53794
|
param,
|
|
53453
53795
|
});
|
|
@@ -53499,7 +53841,7 @@ function signMessage ({ typedCall, params, }) {
|
|
|
53499
53841
|
});
|
|
53500
53842
|
}
|
|
53501
53843
|
|
|
53502
|
-
function signMessageLegacyV1 ({ typedCall, params, }) {
|
|
53844
|
+
function signMessageLegacyV1$1 ({ typedCall, params, }) {
|
|
53503
53845
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53504
53846
|
const message = {
|
|
53505
53847
|
address_n: params.address_n,
|
|
@@ -53511,7 +53853,7 @@ function signMessageLegacyV1 ({ typedCall, params, }) {
|
|
|
53511
53853
|
});
|
|
53512
53854
|
}
|
|
53513
53855
|
|
|
53514
|
-
class EVMSignMessage$
|
|
53856
|
+
class EVMSignMessage$4 extends BaseMethod {
|
|
53515
53857
|
getSupportedProtocols() {
|
|
53516
53858
|
return ['V1', 'V2'];
|
|
53517
53859
|
}
|
|
@@ -53536,7 +53878,7 @@ class EVMSignMessage$2 extends BaseMethod {
|
|
|
53536
53878
|
run() {
|
|
53537
53879
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53538
53880
|
if (shouldUseLegacyV1EvmMessages(this.device)) {
|
|
53539
|
-
return signMessageLegacyV1({
|
|
53881
|
+
return signMessageLegacyV1$1({
|
|
53540
53882
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
53541
53883
|
params: this.params,
|
|
53542
53884
|
});
|
|
@@ -53742,7 +54084,7 @@ const evmSignTxEip7702 = ({ typedCall, addressN, tx, supportTrezor, }) => __awai
|
|
|
53742
54084
|
supportTrezor,
|
|
53743
54085
|
});
|
|
53744
54086
|
});
|
|
53745
|
-
const signTransaction$
|
|
54087
|
+
const signTransaction$2 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53746
54088
|
if (isEIP7702) {
|
|
53747
54089
|
return evmSignTxEip7702({ typedCall, addressN, tx: tx });
|
|
53748
54090
|
}
|
|
@@ -53751,7 +54093,7 @@ const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) =
|
|
|
53751
54093
|
: evmSignTx({ typedCall, addressN, tx: tx });
|
|
53752
54094
|
});
|
|
53753
54095
|
|
|
53754
|
-
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* () {
|
|
53755
54097
|
if (isEIP7702) {
|
|
53756
54098
|
return evmSignTxEip7702({
|
|
53757
54099
|
typedCall,
|
|
@@ -53771,7 +54113,7 @@ const signTransaction = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) =>
|
|
|
53771
54113
|
return evmSignTx({ typedCall, addressN, tx: tx, supportTrezor: true });
|
|
53772
54114
|
});
|
|
53773
54115
|
|
|
53774
|
-
class EVMSignTransaction extends BaseMethod {
|
|
54116
|
+
class EVMSignTransaction$1 extends BaseMethod {
|
|
53775
54117
|
constructor() {
|
|
53776
54118
|
super(...arguments);
|
|
53777
54119
|
this.addressN = [];
|
|
@@ -53856,7 +54198,7 @@ class EVMSignTransaction extends BaseMethod {
|
|
|
53856
54198
|
if (formattedTx == null)
|
|
53857
54199
|
throw hdShared.ERRORS.TypedError('Runtime', 'formattedTx is not set');
|
|
53858
54200
|
if (shouldUseLegacyV1EvmMessages(this.device)) {
|
|
53859
|
-
return signTransaction({
|
|
54201
|
+
return signTransaction$1({
|
|
53860
54202
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
53861
54203
|
addressN,
|
|
53862
54204
|
tx: formattedTx,
|
|
@@ -53864,7 +54206,7 @@ class EVMSignTransaction extends BaseMethod {
|
|
|
53864
54206
|
isEIP7702,
|
|
53865
54207
|
});
|
|
53866
54208
|
}
|
|
53867
|
-
return signTransaction$
|
|
54209
|
+
return signTransaction$2({
|
|
53868
54210
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
53869
54211
|
addressN,
|
|
53870
54212
|
tx: formattedTx,
|
|
@@ -53875,7 +54217,7 @@ class EVMSignTransaction extends BaseMethod {
|
|
|
53875
54217
|
}
|
|
53876
54218
|
}
|
|
53877
54219
|
|
|
53878
|
-
const signTypedHash$
|
|
54220
|
+
const signTypedHash$2 = ({ typedCall, addressN, device, chainId, domainHash, messageHash, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53879
54221
|
var _a;
|
|
53880
54222
|
const deviceType = device.getCurrentDeviceType();
|
|
53881
54223
|
if (deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro) {
|
|
@@ -53894,7 +54236,7 @@ const signTypedHash$1 = ({ typedCall, addressN, device, chainId, domainHash, mes
|
|
|
53894
54236
|
return typedCall('EthereumSignTypedHash', 'EthereumTypedDataSignature', message);
|
|
53895
54237
|
});
|
|
53896
54238
|
|
|
53897
|
-
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* () {
|
|
53898
54240
|
var _a;
|
|
53899
54241
|
const deviceType = device.getCurrentDeviceType();
|
|
53900
54242
|
if (deviceType === hdShared.EDeviceType.Touch || deviceType === hdShared.EDeviceType.Pro) {
|
|
@@ -53912,7 +54254,7 @@ const signTypedHash = ({ typedCall, addressN, device, chainId, domainHash, messa
|
|
|
53912
54254
|
});
|
|
53913
54255
|
});
|
|
53914
54256
|
|
|
53915
|
-
const signTypedData$
|
|
54257
|
+
const signTypedData$2 = ({ typedCall, addressN, data, metamaskV4Compat, chainId, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53916
54258
|
const { primaryType } = data;
|
|
53917
54259
|
const message = {
|
|
53918
54260
|
address_n: addressN,
|
|
@@ -53929,7 +54271,7 @@ const signTypedData$1 = ({ typedCall, addressN, data, metamaskV4Compat, chainId,
|
|
|
53929
54271
|
return response;
|
|
53930
54272
|
});
|
|
53931
54273
|
|
|
53932
|
-
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* () {
|
|
53933
54275
|
const { primaryType } = data;
|
|
53934
54276
|
return typedCall('EthereumSignTypedDataOneKey', [
|
|
53935
54277
|
'EthereumTypedDataStructRequestOneKey',
|
|
@@ -54063,7 +54405,7 @@ const MINI_MAX_NAME_LENGTH = 63;
|
|
|
54063
54405
|
const MINI_MAX_DYNAMIC_VALUE_BYTES = 1536;
|
|
54064
54406
|
const MINI_MAX_ARRAY_TYPE_FIELDS = 24;
|
|
54065
54407
|
const MINI_MAX_ARRAY_ELEMENTS = 24;
|
|
54066
|
-
class EVMSignTypedData extends BaseMethod {
|
|
54408
|
+
class EVMSignTypedData$1 extends BaseMethod {
|
|
54067
54409
|
getSupportedProtocols() {
|
|
54068
54410
|
return ['V1', 'V2'];
|
|
54069
54411
|
}
|
|
@@ -54218,7 +54560,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
54218
54560
|
let response;
|
|
54219
54561
|
if (shouldUseLegacyV1EvmMessages(this.device)) {
|
|
54220
54562
|
supportTrezor = true;
|
|
54221
|
-
response = yield signTypedData$
|
|
54563
|
+
response = yield signTypedData$2({
|
|
54222
54564
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
54223
54565
|
addressN,
|
|
54224
54566
|
data,
|
|
@@ -54227,7 +54569,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
54227
54569
|
});
|
|
54228
54570
|
}
|
|
54229
54571
|
else {
|
|
54230
|
-
response = yield signTypedData({
|
|
54572
|
+
response = yield signTypedData$1({
|
|
54231
54573
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
54232
54574
|
addressN,
|
|
54233
54575
|
data,
|
|
@@ -54247,7 +54589,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
54247
54589
|
if (!domainHash)
|
|
54248
54590
|
throw hdShared.ERRORS.TypedError('Runtime', 'domainHash is required');
|
|
54249
54591
|
if (shouldUseLegacyV1EvmMessages(this.device)) {
|
|
54250
|
-
return signTypedHash$
|
|
54592
|
+
return signTypedHash$2({
|
|
54251
54593
|
typedCall,
|
|
54252
54594
|
addressN,
|
|
54253
54595
|
domainHash,
|
|
@@ -54256,7 +54598,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
54256
54598
|
device: this.device,
|
|
54257
54599
|
});
|
|
54258
54600
|
}
|
|
54259
|
-
return signTypedHash({
|
|
54601
|
+
return signTypedHash$1({
|
|
54260
54602
|
typedCall,
|
|
54261
54603
|
addressN,
|
|
54262
54604
|
domainHash,
|
|
@@ -54477,7 +54819,7 @@ class EVMSignTypedData extends BaseMethod {
|
|
|
54477
54819
|
}
|
|
54478
54820
|
}
|
|
54479
54821
|
|
|
54480
|
-
function verifyMessageLegacyV1 ({ typedCall, params, }) {
|
|
54822
|
+
function verifyMessageLegacyV1$1 ({ typedCall, params, }) {
|
|
54481
54823
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54482
54824
|
const message = {
|
|
54483
54825
|
signature: params.signature,
|
|
@@ -54497,7 +54839,7 @@ function verifyMessage ({ typedCall, params, }) {
|
|
|
54497
54839
|
});
|
|
54498
54840
|
}
|
|
54499
54841
|
|
|
54500
|
-
class EVMSignMessage$
|
|
54842
|
+
class EVMSignMessage$3 extends BaseMethod {
|
|
54501
54843
|
getSupportedProtocols() {
|
|
54502
54844
|
return ['V1', 'V2'];
|
|
54503
54845
|
}
|
|
@@ -54521,7 +54863,7 @@ class EVMSignMessage$1 extends BaseMethod {
|
|
|
54521
54863
|
run() {
|
|
54522
54864
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54523
54865
|
if (shouldUseLegacyV1EvmMessages(this.device)) {
|
|
54524
|
-
return verifyMessageLegacyV1({
|
|
54866
|
+
return verifyMessageLegacyV1$1({
|
|
54525
54867
|
typedCall: this.device.commands.typedCall.bind(this.device.commands),
|
|
54526
54868
|
params: this.params,
|
|
54527
54869
|
});
|
|
@@ -54685,7 +55027,7 @@ class StarcoinSignTransaction extends BaseMethod {
|
|
|
54685
55027
|
}
|
|
54686
55028
|
}
|
|
54687
55029
|
|
|
54688
|
-
class EVMSignMessage extends BaseMethod {
|
|
55030
|
+
class EVMSignMessage$2 extends BaseMethod {
|
|
54689
55031
|
getSupportedProtocols() {
|
|
54690
55032
|
return ['V1', 'V2'];
|
|
54691
55033
|
}
|
|
@@ -54712,7 +55054,7 @@ class EVMSignMessage extends BaseMethod {
|
|
|
54712
55054
|
}
|
|
54713
55055
|
}
|
|
54714
55056
|
|
|
54715
|
-
const MAINNET = 0x68;
|
|
55057
|
+
const MAINNET$1 = 0x68;
|
|
54716
55058
|
class NEMGetAddress extends BaseMethod {
|
|
54717
55059
|
constructor() {
|
|
54718
55060
|
super(...arguments);
|
|
@@ -54740,7 +55082,7 @@ class NEMGetAddress extends BaseMethod {
|
|
|
54740
55082
|
const showOnOneKey = (_a = batch.showOnOneKey) !== null && _a !== void 0 ? _a : true;
|
|
54741
55083
|
this.params.push({
|
|
54742
55084
|
address_n: addressN,
|
|
54743
|
-
network: batch.network || MAINNET,
|
|
55085
|
+
network: batch.network || MAINNET$1,
|
|
54744
55086
|
show_display: showOnOneKey,
|
|
54745
55087
|
});
|
|
54746
55088
|
});
|
|
@@ -60840,7 +61182,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
60840
61182
|
checkBootloaderRelease: CheckBootloaderRelease,
|
|
60841
61183
|
checkAllFirmwareRelease: CheckAllFirmwareRelease,
|
|
60842
61184
|
checkFirmwareTypeAvailable: CheckFirmwareTypeAvailable,
|
|
60843
|
-
deviceBackup: DeviceBackup,
|
|
61185
|
+
deviceBackup: DeviceBackup$1,
|
|
60844
61186
|
deviceChangePin: DeviceChangePin,
|
|
60845
61187
|
deviceFlags: DeviceFlags,
|
|
60846
61188
|
deviceRebootToBootloader: DeviceRebootToBootloader,
|
|
@@ -60867,6 +61209,9 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
60867
61209
|
promptWebDeviceAccess: PromptWebDeviceAccess,
|
|
60868
61210
|
deviceReboot: DeviceReboot,
|
|
60869
61211
|
deviceGetOnboardingStatus: DeviceGetOnboardingStatus,
|
|
61212
|
+
deviceReadFactoryInfo: DeviceFactoryInfoGet,
|
|
61213
|
+
deviceReadFactoryCertificate: DeviceFactoryCertificateRead,
|
|
61214
|
+
deviceSignFactoryChallenge: DeviceFactoryChallengeSign,
|
|
60870
61215
|
deviceUploadWallpaper: DeviceUploadWallpaper,
|
|
60871
61216
|
deviceUploadNft: DeviceUploadNft,
|
|
60872
61217
|
uploadPortfolio: UploadPortfolio,
|
|
@@ -60883,18 +61228,18 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
60883
61228
|
confluxSignMessage: ConfluxSignMessage,
|
|
60884
61229
|
confluxSignMessageCIP23: ConfluxSignMessageCIP23,
|
|
60885
61230
|
confluxSignTransaction: ConfluxSignTransaction,
|
|
60886
|
-
evmGetAddress: EvmGetAddress,
|
|
60887
|
-
evmGetPublicKey: EVMGetPublicKey,
|
|
60888
|
-
evmSignMessage: EVMSignMessage$
|
|
61231
|
+
evmGetAddress: EvmGetAddress$1,
|
|
61232
|
+
evmGetPublicKey: EVMGetPublicKey$1,
|
|
61233
|
+
evmSignMessage: EVMSignMessage$4,
|
|
60889
61234
|
evmSignMessageEIP712: EVMSignMessageEIP712,
|
|
60890
|
-
evmSignTransaction: EVMSignTransaction,
|
|
60891
|
-
evmSignTypedData: EVMSignTypedData,
|
|
60892
|
-
evmVerifyMessage: EVMSignMessage$
|
|
61235
|
+
evmSignTransaction: EVMSignTransaction$1,
|
|
61236
|
+
evmSignTypedData: EVMSignTypedData$1,
|
|
61237
|
+
evmVerifyMessage: EVMSignMessage$3,
|
|
60893
61238
|
starcoinGetAddress: StarcoinGetAddress,
|
|
60894
61239
|
starcoinGetPublicKey: StarcoinGetPublicKey,
|
|
60895
61240
|
starcoinSignMessage: StarcoinSignMessage,
|
|
60896
61241
|
starcoinSignTransaction: StarcoinSignTransaction,
|
|
60897
|
-
starcoinVerifyMessage: EVMSignMessage,
|
|
61242
|
+
starcoinVerifyMessage: EVMSignMessage$2,
|
|
60898
61243
|
nemGetAddress: NEMGetAddress,
|
|
60899
61244
|
nemSignTransaction: NEMSignTransaction,
|
|
60900
61245
|
solGetAddress: SolGetAddress,
|
|
@@ -60965,7 +61310,25 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
60965
61310
|
});
|
|
60966
61311
|
|
|
60967
61312
|
const publicMethodRegistry = ApiMethods;
|
|
60968
|
-
|
|
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;
|
|
60969
61332
|
const { method } = message.payload;
|
|
60970
61333
|
if (typeof method !== 'string') {
|
|
60971
61334
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'Method is not set');
|
|
@@ -60974,6 +61337,13 @@ function findMethod(message) {
|
|
|
60974
61337
|
if (MethodConstructor) {
|
|
60975
61338
|
return new MethodConstructor(message);
|
|
60976
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
|
+
}
|
|
60977
61347
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Method ${method} is not set`);
|
|
60978
61348
|
}
|
|
60979
61349
|
|
|
@@ -61376,7 +61746,10 @@ const callAPI = (context, message) => __awaiter(void 0, void 0, void 0, function
|
|
|
61376
61746
|
}
|
|
61377
61747
|
let method;
|
|
61378
61748
|
try {
|
|
61379
|
-
method = findMethod(message
|
|
61749
|
+
method = findMethod(message, {
|
|
61750
|
+
extensions: context.methodExtensions,
|
|
61751
|
+
allowDestructiveOperations: context.allowDestructiveOperations,
|
|
61752
|
+
});
|
|
61380
61753
|
method.connector = _connector;
|
|
61381
61754
|
const shouldPostMessage = createUiProgressMessageFilter();
|
|
61382
61755
|
method.postMessage = event => {
|
|
@@ -62283,18 +62656,22 @@ const createUiPromise = (promiseEvent, device) => {
|
|
|
62283
62656
|
const removeUiPromise = (promise) => {
|
|
62284
62657
|
_uiPromises = _uiPromises.filter(p => p !== promise);
|
|
62285
62658
|
};
|
|
62286
|
-
class Core extends events.exports {
|
|
62287
|
-
constructor() {
|
|
62659
|
+
class Core extends events.exports.EventEmitter {
|
|
62660
|
+
constructor(options = {}) {
|
|
62288
62661
|
super();
|
|
62289
62662
|
this.requestQueue = new RequestQueue();
|
|
62290
62663
|
this.methodSynchronize = getSynchronize();
|
|
62664
|
+
this.options = options;
|
|
62291
62665
|
this.tracingContext = createSdkTracingContext();
|
|
62292
62666
|
this.sdkInstanceId = this.tracingContext.sdkInstanceId;
|
|
62293
62667
|
Log.debug(`[Core] Created SDK instance: ${this.sdkInstanceId}`);
|
|
62294
62668
|
}
|
|
62295
62669
|
getCoreContext() {
|
|
62670
|
+
var _a;
|
|
62296
62671
|
return {
|
|
62297
62672
|
sdkInstanceId: this.sdkInstanceId,
|
|
62673
|
+
methodExtensions: (_a = this.options.methodExtensions) !== null && _a !== void 0 ? _a : [],
|
|
62674
|
+
allowDestructiveOperations: this.options.allowDestructiveOperations === true,
|
|
62298
62675
|
tracingContext: this.tracingContext,
|
|
62299
62676
|
requestQueue: this.requestQueue,
|
|
62300
62677
|
methodSynchronize: this.methodSynchronize,
|
|
@@ -62403,8 +62780,8 @@ class Core extends events.exports {
|
|
|
62403
62780
|
});
|
|
62404
62781
|
}
|
|
62405
62782
|
}
|
|
62406
|
-
const initCore = () => {
|
|
62407
|
-
const core = new Core();
|
|
62783
|
+
const initCore = (options) => {
|
|
62784
|
+
const core = new Core(options);
|
|
62408
62785
|
_core = core;
|
|
62409
62786
|
return core;
|
|
62410
62787
|
};
|
|
@@ -62421,7 +62798,7 @@ const initConnector = () => {
|
|
|
62421
62798
|
const initTransport = (Transport, plugin) => {
|
|
62422
62799
|
TransportManager.setTransport(Transport, plugin);
|
|
62423
62800
|
};
|
|
62424
|
-
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* () {
|
|
62425
62802
|
try {
|
|
62426
62803
|
try {
|
|
62427
62804
|
yield DataManager.load(settings);
|
|
@@ -62434,7 +62811,7 @@ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0,
|
|
|
62434
62811
|
if (DataManager.getSettings('env') !== 'react-native') {
|
|
62435
62812
|
setLoggerPostMessage(postMessage);
|
|
62436
62813
|
}
|
|
62437
|
-
initCore();
|
|
62814
|
+
initCore(options);
|
|
62438
62815
|
initConnector();
|
|
62439
62816
|
return _core;
|
|
62440
62817
|
}
|
|
@@ -62451,6 +62828,2189 @@ const switchTransport = ({ env, Transport, plugin, }) => {
|
|
|
62451
62828
|
initConnector();
|
|
62452
62829
|
};
|
|
62453
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
|
+
|
|
62454
65014
|
const HardwareSdk = ({ init, call, dispose, eventEmitter, uiResponse, cancel, updateSettings, switchTransport, }) => inject({
|
|
62455
65015
|
init,
|
|
62456
65016
|
call,
|
|
@@ -62501,6 +65061,7 @@ exports.DEVICE_SETTINGS_V2_ONLY_FIELDS = DEVICE_SETTINGS_V2_ONLY_FIELDS;
|
|
|
62501
65061
|
exports.DataManager = DataManager;
|
|
62502
65062
|
exports.DeviceModelToTypes = DeviceModelToTypes;
|
|
62503
65063
|
exports.DeviceTypeToModels = DeviceTypeToModels;
|
|
65064
|
+
exports.FACTORY_API_METHOD_NAMES = FACTORY_API_METHOD_NAMES;
|
|
62504
65065
|
exports.FIRMWARE = FIRMWARE;
|
|
62505
65066
|
exports.FIRMWARE_EVENT = FIRMWARE_EVENT;
|
|
62506
65067
|
exports.HardwareSDKLowLevel = HardwareSDKLowLevel;
|
|
@@ -62514,6 +65075,7 @@ exports.PRO2_WALLPAPER_HEIGHT = PRO2_WALLPAPER_HEIGHT;
|
|
|
62514
65075
|
exports.PRO2_WALLPAPER_WIDTH = PRO2_WALLPAPER_WIDTH;
|
|
62515
65076
|
exports.PROTOCOL_V2_NEVER_TIMEOUT_MS = PROTOCOL_V2_NEVER_TIMEOUT_MS;
|
|
62516
65077
|
exports.RESPONSE_EVENT = RESPONSE_EVENT;
|
|
65078
|
+
exports.TEST_API_METHOD_NAMES = TEST_API_METHOD_NAMES;
|
|
62517
65079
|
exports.UI_EVENT = UI_EVENT;
|
|
62518
65080
|
exports.UI_REQUEST = UI_REQUEST;
|
|
62519
65081
|
exports.UI_RESPONSE = UI_RESPONSE;
|
|
@@ -62525,18 +65087,21 @@ exports.completeRequestContext = completeRequestContext;
|
|
|
62525
65087
|
exports.corsValidator = corsValidator;
|
|
62526
65088
|
exports.createDeviceMessage = createDeviceMessage;
|
|
62527
65089
|
exports.createErrorMessage = createErrorMessage;
|
|
65090
|
+
exports.createFactoryApi = createFactoryApi;
|
|
62528
65091
|
exports.createFirmwareMessage = createFirmwareMessage;
|
|
62529
65092
|
exports.createIFrameMessage = createIFrameMessage;
|
|
62530
65093
|
exports.createLogMessage = createLogMessage;
|
|
62531
65094
|
exports.createRequestContext = createRequestContext;
|
|
62532
65095
|
exports.createResponseMessage = createResponseMessage;
|
|
62533
65096
|
exports.createSdkTracingContext = createSdkTracingContext;
|
|
65097
|
+
exports.createTestApi = createTestApi;
|
|
62534
65098
|
exports.createUiMessage = createUiMessage;
|
|
62535
65099
|
exports.createUiResponse = createUiResponse;
|
|
62536
65100
|
exports["default"] = HardwareSdk;
|
|
62537
65101
|
exports.enableLog = enableLog;
|
|
62538
65102
|
exports.encodePro2Wallpaper = encodePro2Wallpaper;
|
|
62539
65103
|
exports.executeCallback = executeCallback;
|
|
65104
|
+
exports.factoryApiMethodExtension = factoryApiMethodExtension;
|
|
62540
65105
|
exports.formatLogMethodLabel = formatLogMethodLabel;
|
|
62541
65106
|
exports.formatRequestContext = formatRequestContext;
|
|
62542
65107
|
exports.generateInstanceId = generateInstanceId;
|
|
@@ -62589,6 +65154,7 @@ exports.safeThrowError = safeThrowError;
|
|
|
62589
65154
|
exports.setLoggerPostMessage = setLoggerPostMessage;
|
|
62590
65155
|
exports.supportInputPinOnSoftware = supportInputPinOnSoftware;
|
|
62591
65156
|
exports.switchTransport = switchTransport;
|
|
65157
|
+
exports.testApiMethodExtension = testApiMethodExtension;
|
|
62592
65158
|
exports.updateRequestContext = updateRequestContext;
|
|
62593
65159
|
exports.versionCompare = versionCompare;
|
|
62594
65160
|
exports.versionSplit = versionSplit;
|