@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
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { UI_REQUEST } from '../../constants/ui-request';
|
|
2
|
+
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
3
|
+
import { BaseMethod } from '../BaseMethod';
|
|
4
|
+
import { validateParams } from '../helpers/paramsValidator';
|
|
5
|
+
|
|
6
|
+
import type { TezosGetPublicKey as HardwareTezosGetPublicKey } from '@onekeyfe/hd-transport';
|
|
7
|
+
|
|
8
|
+
export default class TezosGetPublicKey extends BaseMethod<HardwareTezosGetPublicKey[]> {
|
|
9
|
+
hasBundle = false;
|
|
10
|
+
|
|
11
|
+
init() {
|
|
12
|
+
this.checkDeviceId = true;
|
|
13
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
14
|
+
|
|
15
|
+
this.hasBundle = !!this.payload?.bundle;
|
|
16
|
+
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };
|
|
17
|
+
|
|
18
|
+
// check payload
|
|
19
|
+
validateParams(payload, [{ name: 'bundle', type: 'array' }]);
|
|
20
|
+
|
|
21
|
+
// init params
|
|
22
|
+
this.params = [];
|
|
23
|
+
payload.bundle.forEach((batch: any) => {
|
|
24
|
+
const addressN = validatePath(batch.path, 3);
|
|
25
|
+
|
|
26
|
+
validateParams(batch, [
|
|
27
|
+
{ name: 'path', required: true },
|
|
28
|
+
{ name: 'showOnOneKey', type: 'boolean' },
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
const showOnOneKey = batch.showOnOneKey ?? true;
|
|
32
|
+
|
|
33
|
+
this.params.push({
|
|
34
|
+
address_n: addressN,
|
|
35
|
+
show_display: showOnOneKey,
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async run() {
|
|
41
|
+
const responses: any[] = [];
|
|
42
|
+
|
|
43
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
44
|
+
const param = this.params[i];
|
|
45
|
+
|
|
46
|
+
const res = await this.device.commands.typedCall('TezosGetPublicKey', 'TezosPublicKey', {
|
|
47
|
+
...param,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const { public_key } = res.message;
|
|
51
|
+
|
|
52
|
+
const result = {
|
|
53
|
+
path: serializedPath(param.address_n),
|
|
54
|
+
public_key,
|
|
55
|
+
};
|
|
56
|
+
responses.push(result);
|
|
57
|
+
|
|
58
|
+
this.postPreviousAddressMessage(result);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return Promise.resolve(this.hasBundle ? responses : responses[0]);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { UI_REQUEST } from '../../constants/ui-request';
|
|
2
|
+
import { validatePath } from '../helpers/pathUtils';
|
|
3
|
+
import { BaseMethod } from '../BaseMethod';
|
|
4
|
+
|
|
5
|
+
import type { TezosSignTx as HardwareTezosSignTx } from '@onekeyfe/hd-transport';
|
|
6
|
+
|
|
7
|
+
export default class TezosSignTx extends BaseMethod<HardwareTezosSignTx> {
|
|
8
|
+
init() {
|
|
9
|
+
this.checkDeviceId = true;
|
|
10
|
+
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
11
|
+
|
|
12
|
+
const { path } = this.payload;
|
|
13
|
+
|
|
14
|
+
const addressN = validatePath(path, 3);
|
|
15
|
+
|
|
16
|
+
// init params
|
|
17
|
+
this.params = {
|
|
18
|
+
address_n: addressN,
|
|
19
|
+
branch: new Uint8Array(4),
|
|
20
|
+
reveal: this.payload.reveal,
|
|
21
|
+
transaction: this.payload.transaction,
|
|
22
|
+
origination: this.payload.origination,
|
|
23
|
+
delegation: this.payload.delegation,
|
|
24
|
+
proposal: this.payload.proposal,
|
|
25
|
+
ballot: this.payload.ballot,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
getVersionRange() {
|
|
30
|
+
return {
|
|
31
|
+
model_mini: {
|
|
32
|
+
min: '2.5.0',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async run() {
|
|
38
|
+
const res = await this.device.commands.typedCall('TezosSignTx', 'TezosSignedTx', {
|
|
39
|
+
...this.params,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return Promise.resolve(res.message);
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/api/utils.ts
CHANGED
|
@@ -3,13 +3,47 @@ import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
|
3
3
|
import * as ApiMethods from './index';
|
|
4
4
|
|
|
5
5
|
import type { BaseMethod } from './BaseMethod';
|
|
6
|
+
import type { CoreMethodExtension } from './methodExtension';
|
|
6
7
|
import type { IFrameCallMessage } from '../events';
|
|
7
8
|
|
|
8
9
|
type MethodConstructor = new (message: IFrameCallMessage & { id?: number }) => BaseMethod<any>;
|
|
9
10
|
|
|
10
11
|
const publicMethodRegistry = ApiMethods as unknown as Record<string, MethodConstructor>;
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
+
export type FindMethodOptions = {
|
|
14
|
+
extensions?: readonly CoreMethodExtension[];
|
|
15
|
+
allowDestructiveOperations?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const findExtensionMethod = (
|
|
19
|
+
method: string,
|
|
20
|
+
extensions: readonly CoreMethodExtension[]
|
|
21
|
+
): { constructor: MethodConstructor; destructive: boolean } | undefined => {
|
|
22
|
+
let match: { constructor: MethodConstructor; destructive: boolean } | undefined;
|
|
23
|
+
|
|
24
|
+
for (const extension of extensions) {
|
|
25
|
+
const constructor = extension.methods[method];
|
|
26
|
+
if (constructor) {
|
|
27
|
+
if (match) {
|
|
28
|
+
throw ERRORS.TypedError(
|
|
29
|
+
HardwareErrorCode.CallMethodInvalidParameter,
|
|
30
|
+
`Method ${method} is registered by multiple extensions`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
match = {
|
|
34
|
+
constructor,
|
|
35
|
+
destructive: extension.destructiveMethods?.includes(method) === true,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return match;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function findMethod(
|
|
44
|
+
message: IFrameCallMessage & { id?: number },
|
|
45
|
+
options: FindMethodOptions = {}
|
|
46
|
+
): BaseMethod<any> {
|
|
13
47
|
const { method } = message.payload;
|
|
14
48
|
if (typeof method !== 'string') {
|
|
15
49
|
throw ERRORS.TypedError(HardwareErrorCode.CallMethodInvalidParameter, 'Method is not set');
|
|
@@ -20,6 +54,17 @@ export function findMethod(message: IFrameCallMessage & { id?: number }): BaseMe
|
|
|
20
54
|
return new MethodConstructor(message);
|
|
21
55
|
}
|
|
22
56
|
|
|
57
|
+
const extensionMethod = findExtensionMethod(method, options.extensions ?? []);
|
|
58
|
+
if (extensionMethod) {
|
|
59
|
+
if (extensionMethod.destructive && options.allowDestructiveOperations !== true) {
|
|
60
|
+
throw ERRORS.TypedError(
|
|
61
|
+
HardwareErrorCode.CallMethodInvalidParameter,
|
|
62
|
+
`Destructive method ${method} requires allowDestructiveOperations`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return new extensionMethod.constructor(message);
|
|
66
|
+
}
|
|
67
|
+
|
|
23
68
|
throw ERRORS.TypedError(
|
|
24
69
|
HardwareErrorCode.CallMethodInvalidParameter,
|
|
25
70
|
`Method ${method} is not set`
|
package/src/core/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
|
-
import EventEmitter from 'events';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
3
|
import { DeviceSessionPinType, TRANSPORT_EVENT } from '@onekeyfe/hd-transport';
|
|
4
4
|
import {
|
|
5
5
|
ERRORS,
|
|
@@ -75,6 +75,7 @@ import type {
|
|
|
75
75
|
TransportDeviceDisconnectEvent,
|
|
76
76
|
} from '@onekeyfe/hd-transport';
|
|
77
77
|
import type { BaseMethod } from '../api/BaseMethod';
|
|
78
|
+
import type { CoreMethodExtension } from '../api/methodExtension';
|
|
78
79
|
|
|
79
80
|
const Log = getLogger(LoggerNames.Core);
|
|
80
81
|
const PRE_INITIALIZE_TTL_MS = 60 * 1000;
|
|
@@ -86,6 +87,11 @@ const preWarmDoneAt = new Map<string, number>();
|
|
|
86
87
|
|
|
87
88
|
export type CoreContext = ReturnType<Core['getCoreContext']>;
|
|
88
89
|
|
|
90
|
+
export type CoreOptions = {
|
|
91
|
+
methodExtensions?: readonly CoreMethodExtension[];
|
|
92
|
+
allowDestructiveOperations?: boolean;
|
|
93
|
+
};
|
|
94
|
+
|
|
89
95
|
function hasDeriveCardano(method: BaseMethod): boolean {
|
|
90
96
|
if (
|
|
91
97
|
method.name.startsWith('allNetworkGetAddress') &&
|
|
@@ -156,7 +162,10 @@ export const callAPI = async (context: CoreContext, message: CoreMessage) => {
|
|
|
156
162
|
// find api method
|
|
157
163
|
let method!: BaseMethod;
|
|
158
164
|
try {
|
|
159
|
-
method = findMethod(message as IFrameCallMessage
|
|
165
|
+
method = findMethod(message as IFrameCallMessage, {
|
|
166
|
+
extensions: context.methodExtensions,
|
|
167
|
+
allowDestructiveOperations: context.allowDestructiveOperations,
|
|
168
|
+
});
|
|
160
169
|
method.connector = _connector;
|
|
161
170
|
const shouldPostMessage = createUiProgressMessageFilter();
|
|
162
171
|
method.postMessage = event => {
|
|
@@ -1477,8 +1486,11 @@ export default class Core extends EventEmitter {
|
|
|
1477
1486
|
|
|
1478
1487
|
private methodSynchronize = getSynchronize();
|
|
1479
1488
|
|
|
1480
|
-
|
|
1489
|
+
private readonly options: CoreOptions;
|
|
1490
|
+
|
|
1491
|
+
constructor(options: CoreOptions = {}) {
|
|
1481
1492
|
super();
|
|
1493
|
+
this.options = options;
|
|
1482
1494
|
this.tracingContext = createSdkTracingContext();
|
|
1483
1495
|
this.sdkInstanceId = this.tracingContext.sdkInstanceId;
|
|
1484
1496
|
Log.debug(`[Core] Created SDK instance: ${this.sdkInstanceId}`);
|
|
@@ -1487,6 +1499,8 @@ export default class Core extends EventEmitter {
|
|
|
1487
1499
|
private getCoreContext() {
|
|
1488
1500
|
return {
|
|
1489
1501
|
sdkInstanceId: this.sdkInstanceId,
|
|
1502
|
+
methodExtensions: this.options.methodExtensions ?? [],
|
|
1503
|
+
allowDestructiveOperations: this.options.allowDestructiveOperations === true,
|
|
1490
1504
|
tracingContext: this.tracingContext,
|
|
1491
1505
|
requestQueue: this.requestQueue,
|
|
1492
1506
|
methodSynchronize: this.methodSynchronize,
|
|
@@ -1617,8 +1631,8 @@ export default class Core extends EventEmitter {
|
|
|
1617
1631
|
}
|
|
1618
1632
|
}
|
|
1619
1633
|
|
|
1620
|
-
export const initCore = () => {
|
|
1621
|
-
const core = new Core();
|
|
1634
|
+
export const initCore = (options?: CoreOptions) => {
|
|
1635
|
+
const core = new Core(options);
|
|
1622
1636
|
_core = core;
|
|
1623
1637
|
return core;
|
|
1624
1638
|
};
|
|
@@ -1644,7 +1658,8 @@ const initTransport = (Transport: any, plugin?: LowlevelTransportSharedPlugin) =
|
|
|
1644
1658
|
export const init = async (
|
|
1645
1659
|
settings: ConnectSettings,
|
|
1646
1660
|
Transport: any,
|
|
1647
|
-
plugin?: LowlevelTransportSharedPlugin
|
|
1661
|
+
plugin?: LowlevelTransportSharedPlugin,
|
|
1662
|
+
options?: CoreOptions
|
|
1648
1663
|
) => {
|
|
1649
1664
|
try {
|
|
1650
1665
|
try {
|
|
@@ -1657,7 +1672,7 @@ export const init = async (
|
|
|
1657
1672
|
if (DataManager.getSettings('env') !== 'react-native') {
|
|
1658
1673
|
setLoggerPostMessage(postMessage);
|
|
1659
1674
|
}
|
|
1660
|
-
initCore();
|
|
1675
|
+
initCore(options);
|
|
1661
1676
|
initConnector();
|
|
1662
1677
|
|
|
1663
1678
|
return _core;
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,11 @@ export type { LowLevelCoreApi, LowLevelInjectApi } from './lowLevelInject';
|
|
|
10
10
|
export type { TopLevelInjectApi } from './topLevelInject';
|
|
11
11
|
|
|
12
12
|
export { default as Core, init as initCore, switchTransport } from './core';
|
|
13
|
+
export type { CoreOptions } from './core';
|
|
14
|
+
export { factoryApiMethodExtension, testApiMethodExtension } from './api/methodExtension';
|
|
15
|
+
export type { CoreMethodConstructor, CoreMethodExtension } from './api/methodExtension';
|
|
16
|
+
export { FACTORY_API_METHOD_NAMES, TEST_API_METHOD_NAMES } from './api/extensionMethodNames';
|
|
17
|
+
export { createFactoryApi, createTestApi } from './inject';
|
|
13
18
|
|
|
14
19
|
export * from './constants';
|
|
15
20
|
export * from './utils';
|
package/src/inject.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { FACTORY_API_METHOD_NAMES, TEST_API_METHOD_NAMES } from './api/extensionMethodNames';
|
|
2
|
+
|
|
1
3
|
import type { HardwareConnectProtocol } from '@onekeyfe/hd-shared';
|
|
2
4
|
import type { Unsuccessful } from './types';
|
|
3
5
|
import type { EventEmitter } from 'events';
|
|
4
6
|
import type { CallMethod } from './events';
|
|
5
|
-
import type { CoreApi } from './types/api';
|
|
7
|
+
import type { CoreApi, FactoryApi, TestApi, TestApiMethods } from './types/api';
|
|
6
8
|
import type { AllNetworkAddress } from './types/api/allNetworkGetAddress';
|
|
7
9
|
|
|
8
10
|
type CallbackFunction = (data?: any, error?: Unsuccessful) => void;
|
|
@@ -131,10 +133,7 @@ export const inject = ({
|
|
|
131
133
|
return api;
|
|
132
134
|
};
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
call: CoreApi['call']
|
|
136
|
-
): Omit<
|
|
137
|
-
CoreApi,
|
|
136
|
+
type ApiControlMethodName =
|
|
138
137
|
| 'on'
|
|
139
138
|
| 'off'
|
|
140
139
|
| 'emit'
|
|
@@ -146,8 +145,11 @@ export const createCoreApi = (
|
|
|
146
145
|
| 'uiResponse'
|
|
147
146
|
| 'cancel'
|
|
148
147
|
| 'updateSettings'
|
|
149
|
-
| 'switchTransport'
|
|
150
|
-
|
|
148
|
+
| 'switchTransport';
|
|
149
|
+
|
|
150
|
+
type InjectedApi<TApi> = Omit<TApi, ApiControlMethodName>;
|
|
151
|
+
|
|
152
|
+
const createAllCoreApi = (call: CoreApi['call']): InjectedApi<TestApi> => ({
|
|
151
153
|
getLogs: () => call({ method: 'getLogs' }),
|
|
152
154
|
clearSessionCache: params => call({ ...params, method: 'clearSessionCache' }),
|
|
153
155
|
/**
|
|
@@ -215,6 +217,16 @@ export const createCoreApi = (
|
|
|
215
217
|
deviceReboot: (connectId, params) => call({ ...params, connectId, method: 'deviceReboot' }),
|
|
216
218
|
deviceGetOnboardingStatus: (connectId, params) =>
|
|
217
219
|
call({ ...params, connectId, method: 'deviceGetOnboardingStatus' }),
|
|
220
|
+
deviceProvisionFactoryInfo: (connectId, params) =>
|
|
221
|
+
call({ ...params, connectId, method: 'deviceProvisionFactoryInfo' }),
|
|
222
|
+
deviceReadFactoryInfo: (connectId, params) =>
|
|
223
|
+
call({ ...params, connectId, method: 'deviceReadFactoryInfo' }),
|
|
224
|
+
deviceWriteFactoryCertificate: (connectId, params) =>
|
|
225
|
+
call({ ...params, connectId, method: 'deviceWriteFactoryCertificate' }),
|
|
226
|
+
deviceReadFactoryCertificate: (connectId, params) =>
|
|
227
|
+
call({ ...params, connectId, method: 'deviceReadFactoryCertificate' }),
|
|
228
|
+
deviceSignFactoryChallenge: (connectId, params) =>
|
|
229
|
+
call({ ...params, connectId, method: 'deviceSignFactoryChallenge' }),
|
|
218
230
|
deviceUploadWallpaper: (connectId, params) =>
|
|
219
231
|
call({ ...params, connectId, method: 'deviceUploadWallpaper' }),
|
|
220
232
|
deviceUploadNft: (connectId, params) => call({ ...params, connectId, method: 'deviceUploadNft' }),
|
|
@@ -285,6 +297,19 @@ export const createCoreApi = (
|
|
|
285
297
|
evmVerifyMessage: (connectId, deviceId, params) =>
|
|
286
298
|
call({ ...params, connectId, deviceId, method: 'evmVerifyMessage' }),
|
|
287
299
|
|
|
300
|
+
evmGetAddressTrezor: (connectId, deviceId, params) =>
|
|
301
|
+
call({ ...params, connectId, deviceId, method: 'evmGetAddressTrezor' }),
|
|
302
|
+
evmGetPublicKeyTrezor: (connectId, deviceId, params) =>
|
|
303
|
+
call({ ...params, connectId, deviceId, method: 'evmGetPublicKeyTrezor' }),
|
|
304
|
+
evmSignMessageTrezor: (connectId, deviceId, params) =>
|
|
305
|
+
call({ ...params, connectId, deviceId, method: 'evmSignMessageTrezor' }),
|
|
306
|
+
evmSignTransactionTrezor: (connectId, deviceId, params) =>
|
|
307
|
+
call({ ...params, connectId, deviceId, method: 'evmSignTransactionTrezor' }),
|
|
308
|
+
evmSignTypedDataTrezor: (connectId, deviceId, params) =>
|
|
309
|
+
call({ ...params, connectId, deviceId, method: 'evmSignTypedDataTrezor' }),
|
|
310
|
+
evmVerifyMessageTrezor: (connectId, deviceId, params) =>
|
|
311
|
+
call({ ...params, connectId, deviceId, method: 'evmVerifyMessageTrezor' }),
|
|
312
|
+
|
|
288
313
|
btcGetAddress: (connectId, deviceId, params) =>
|
|
289
314
|
call({ ...params, connectId, deviceId, method: 'btcGetAddress' }),
|
|
290
315
|
btcGetPublicKey: (connectId, deviceId, params) =>
|
|
@@ -297,6 +322,25 @@ export const createCoreApi = (
|
|
|
297
322
|
call({ ...params, connectId, deviceId, method: 'btcSignTransaction' }),
|
|
298
323
|
btcVerifyMessage: (connectId, deviceId, params) =>
|
|
299
324
|
call({ ...params, connectId, deviceId, method: 'btcVerifyMessage' }),
|
|
325
|
+
btcGetOwnershipId: (connectId, deviceId, params) =>
|
|
326
|
+
call({ ...params, connectId, deviceId, method: 'btcGetOwnershipId' }),
|
|
327
|
+
btcGetOwnershipProof: (connectId, deviceId, params) =>
|
|
328
|
+
call({ ...params, connectId, deviceId, method: 'btcGetOwnershipProof' }),
|
|
329
|
+
btcAuthorizeCoinJoin: (connectId, deviceId, params) =>
|
|
330
|
+
call({ ...params, connectId, deviceId, method: 'btcAuthorizeCoinJoin' }),
|
|
331
|
+
|
|
332
|
+
cryptoBatchGetPublickeys: (connectId, deviceId, params) =>
|
|
333
|
+
call({ ...params, connectId, deviceId, method: 'cryptoBatchGetPublickeys' }),
|
|
334
|
+
cryptoCipherKeyValue: (connectId, deviceId, params) =>
|
|
335
|
+
call({ ...params, connectId, deviceId, method: 'cryptoCipherKeyValue' }),
|
|
336
|
+
cryptoCosiCommit: (connectId, deviceId, params) =>
|
|
337
|
+
call({ ...params, connectId, deviceId, method: 'cryptoCosiCommit' }),
|
|
338
|
+
cryptoCosiSign: (connectId, deviceId, params) =>
|
|
339
|
+
call({ ...params, connectId, deviceId, method: 'cryptoCosiSign' }),
|
|
340
|
+
cryptoGetECDHSessionKey: (connectId, deviceId, params) =>
|
|
341
|
+
call({ ...params, connectId, deviceId, method: 'cryptoGetECDHSessionKey' }),
|
|
342
|
+
cryptoSignIdentity: (connectId, deviceId, params) =>
|
|
343
|
+
call({ ...params, connectId, deviceId, method: 'cryptoSignIdentity' }),
|
|
300
344
|
|
|
301
345
|
starcoinGetAddress: (connectId, deviceId, params) =>
|
|
302
346
|
call({ ...params, connectId, deviceId, method: 'starcoinGetAddress' }),
|
|
@@ -313,6 +357,8 @@ export const createCoreApi = (
|
|
|
313
357
|
call({ ...params, connectId, deviceId, method: 'nemGetAddress' }),
|
|
314
358
|
nemSignTransaction: (connectId, deviceId, params) =>
|
|
315
359
|
call({ ...params, connectId, deviceId, method: 'nemSignTransaction' }),
|
|
360
|
+
nemDecryptMessage: (connectId, deviceId, params) =>
|
|
361
|
+
call({ ...params, connectId, deviceId, method: 'nemDecryptMessage' }),
|
|
316
362
|
|
|
317
363
|
solGetAddress: (connectId, deviceId, params) =>
|
|
318
364
|
call({ ...params, connectId, deviceId, method: 'solGetAddress' }),
|
|
@@ -478,8 +524,164 @@ export const createCoreApi = (
|
|
|
478
524
|
benfenSignMessage: (connectId, deviceId, params) =>
|
|
479
525
|
call({ ...params, connectId, deviceId, method: 'benfenSignMessage' }),
|
|
480
526
|
|
|
527
|
+
/**
|
|
528
|
+
* Test-only APIs.
|
|
529
|
+
*/
|
|
530
|
+
tezosGetAddress: (connectId, deviceId, params) =>
|
|
531
|
+
call({ ...params, connectId, deviceId, method: 'tezosGetAddress' }),
|
|
532
|
+
tezosGetPublicKey: (connectId, deviceId, params) =>
|
|
533
|
+
call({ ...params, connectId, deviceId, method: 'tezosGetPublicKey' }),
|
|
534
|
+
tezosSignTx: (connectId, deviceId, params) =>
|
|
535
|
+
call({ ...params, connectId, deviceId, method: 'tezosSignTx' }),
|
|
536
|
+
|
|
537
|
+
binanceGetAddress: (connectId, deviceId, params) =>
|
|
538
|
+
call({ ...params, connectId, deviceId, method: 'binanceGetAddress' }),
|
|
539
|
+
binanceGetPublicKey: (connectId, deviceId, params) =>
|
|
540
|
+
call({ ...params, connectId, deviceId, method: 'binanceGetPublicKey' }),
|
|
541
|
+
binanceSignTx: (connectId, deviceId, params) =>
|
|
542
|
+
call({ ...params, connectId, deviceId, method: 'binanceSignTx' }),
|
|
543
|
+
|
|
544
|
+
moneroGetWatchKey: (connectId, deviceId, params) =>
|
|
545
|
+
call({ ...params, connectId, deviceId, method: 'moneroGetWatchKey' }),
|
|
546
|
+
moneroGetAddress: (connectId, deviceId, params) =>
|
|
547
|
+
call({ ...params, connectId, deviceId, method: 'moneroGetAddress' }),
|
|
548
|
+
|
|
549
|
+
eosGetPublicKey: (connectId, deviceId, params) =>
|
|
550
|
+
call({ ...params, connectId, deviceId, method: 'eosGetPublicKey' }),
|
|
551
|
+
eosSignTx: (connectId, deviceId, params) =>
|
|
552
|
+
call({ ...params, connectId, deviceId, method: 'eosSignTx' }),
|
|
553
|
+
|
|
554
|
+
webAuthnAddResidentCredential: (connectId, deviceId, params) =>
|
|
555
|
+
call({ ...params, connectId, deviceId, method: 'webAuthnAddResidentCredential' }),
|
|
556
|
+
webAuthnListResidentCredentials: (connectId, deviceId, params) =>
|
|
557
|
+
call({ ...params, connectId, deviceId, method: 'webAuthnListResidentCredentials' }),
|
|
558
|
+
webAuthnRemoveResidentCredential: (connectId, deviceId, params) =>
|
|
559
|
+
call({ ...params, connectId, deviceId, method: 'webAuthnRemoveResidentCredential' }),
|
|
560
|
+
|
|
561
|
+
getPublicKeyMultiple: (connectId, deviceId, params) =>
|
|
562
|
+
call({ ...params, connectId, deviceId, method: 'getPublicKeyMultiple' }),
|
|
563
|
+
listResDir: (connectId, deviceId, params) =>
|
|
564
|
+
call({ ...params, connectId, deviceId, method: 'listResDir' }),
|
|
565
|
+
nftWriteData: (connectId, deviceId, params) =>
|
|
566
|
+
call({ ...params, connectId, deviceId, method: 'nftWriteData' }),
|
|
567
|
+
nftWriteInfo: (connectId, deviceId, params) =>
|
|
568
|
+
call({ ...params, connectId, deviceId, method: 'nftWriteInfo' }),
|
|
569
|
+
readSEPublicKey: (connectId, deviceId, params) =>
|
|
570
|
+
call({ ...params, connectId, deviceId, method: 'readSEPublicKey' }),
|
|
571
|
+
resourceUpdate: (connectId, deviceId, params) =>
|
|
572
|
+
call({ ...params, connectId, deviceId, method: 'resourceUpdate' }),
|
|
573
|
+
|
|
574
|
+
bixinBackupDevice: (connectId, deviceId, params) =>
|
|
575
|
+
call({ ...params, connectId, deviceId, method: 'bixinBackupDevice' }),
|
|
576
|
+
bixinLoadDevice: (connectId, deviceId, params) =>
|
|
577
|
+
call({ ...params, connectId, deviceId, method: 'bixinLoadDevice' }),
|
|
578
|
+
bixinMessageSE: (connectId, deviceId, params) =>
|
|
579
|
+
call({ ...params, connectId, deviceId, method: 'bixinMessageSE' }),
|
|
580
|
+
bixinVerifyDeviceRequest: (connectId, deviceId, params) =>
|
|
581
|
+
call({ ...params, connectId, deviceId, method: 'bixinVerifyDeviceRequest' }),
|
|
582
|
+
|
|
583
|
+
deviceSpiFlashWrite: (connectId, params) =>
|
|
584
|
+
call({ ...params, connectId, method: 'deviceSpiFlashWrite' }),
|
|
585
|
+
deviceSpiFlashRead: (connectId, params) =>
|
|
586
|
+
call({ ...params, connectId, method: 'deviceSpiFlashRead' }),
|
|
587
|
+
deviceInfoSettings: (connectId, params) =>
|
|
588
|
+
call({ ...params, connectId, method: 'deviceInfoSettings' }),
|
|
589
|
+
deviceGetInfo: (connectId, params) => call({ ...params, connectId, method: 'deviceGetInfo' }),
|
|
590
|
+
deviceReadSEPublicCert: (connectId, params) =>
|
|
591
|
+
call({ ...params, connectId, method: 'deviceReadSEPublicCert' }),
|
|
592
|
+
deviceWriteSEPrivateKey: (connectId, params) =>
|
|
593
|
+
call({ ...params, connectId, method: 'deviceWriteSEPrivateKey' }),
|
|
594
|
+
deviceWriteSEPublicCert: (connectId, params) =>
|
|
595
|
+
call({ ...params, connectId, method: 'deviceWriteSEPublicCert' }),
|
|
596
|
+
deviceSESignMessage: (connectId, params) =>
|
|
597
|
+
call({ ...params, connectId, method: 'deviceSESignMessage' }),
|
|
598
|
+
deviceGetFirmwareHash: (connectId, params) =>
|
|
599
|
+
call({ ...params, connectId, method: 'deviceGetFirmwareHash' }),
|
|
600
|
+
deviceUnlockPath: (connectId, params) =>
|
|
601
|
+
call({ ...params, connectId, method: 'deviceUnlockPath' }),
|
|
602
|
+
devicePing: (connectId, params) => call({ ...params, connectId, method: 'devicePing' }),
|
|
603
|
+
deviceGetEntropy: (connectId, params) =>
|
|
604
|
+
call({ ...params, connectId, method: 'deviceGetEntropy' }),
|
|
605
|
+
deviceSdProtect: (connectId, params) => call({ ...params, connectId, method: 'deviceSdProtect' }),
|
|
606
|
+
deviceChangeWipeCode: (connectId, params) =>
|
|
607
|
+
call({ ...params, connectId, method: 'deviceChangeWipeCode' }),
|
|
608
|
+
deviceEndSession: (connectId, params) =>
|
|
609
|
+
call({ ...params, connectId, method: 'deviceEndSession' }),
|
|
610
|
+
deviceLoad: (connectId, params) => call({ ...params, connectId, method: 'deviceLoad' }),
|
|
611
|
+
deviceDoPreauthorized: (connectId, params) =>
|
|
612
|
+
call({ ...params, connectId, method: 'deviceDoPreauthorized' }),
|
|
613
|
+
deviceCancelAuthorization: (connectId, params) =>
|
|
614
|
+
call({ ...params, connectId, method: 'deviceCancelAuthorization' }),
|
|
615
|
+
|
|
616
|
+
emmcDirList: (connectId, params) => call({ ...params, connectId, method: 'emmcDirList' }),
|
|
617
|
+
emmcDirMake: (connectId, params) => call({ ...params, connectId, method: 'emmcDirMake' }),
|
|
618
|
+
emmcDirRemove: (connectId, params) => call({ ...params, connectId, method: 'emmcDirRemove' }),
|
|
619
|
+
emmcFileDelete: (connectId, params) => call({ ...params, connectId, method: 'emmcFileDelete' }),
|
|
620
|
+
emmcFileRead: (connectId, params) => call({ ...params, connectId, method: 'emmcFileRead' }),
|
|
621
|
+
emmcFileWrite: (connectId, params) => call({ ...params, connectId, method: 'emmcFileWrite' }),
|
|
622
|
+
emmcFixPermission: (connectId, params) =>
|
|
623
|
+
call({ ...params, connectId, method: 'emmcFixPermission' }),
|
|
624
|
+
emmcPathInfo: (connectId, params) => call({ ...params, connectId, method: 'emmcPathInfo' }),
|
|
625
|
+
|
|
626
|
+
debugLinkDecision: (connectId, params) =>
|
|
627
|
+
call({ ...params, connectId, method: 'debugLinkDecision' }),
|
|
628
|
+
debugLinkEraseSdCard: (connectId, params) =>
|
|
629
|
+
call({ ...params, connectId, method: 'debugLinkEraseSdCard' }),
|
|
630
|
+
debugLinkFlashErase: (connectId, params) =>
|
|
631
|
+
call({ ...params, connectId, method: 'debugLinkFlashErase' }),
|
|
632
|
+
debugLinkGetState: (connectId, params) =>
|
|
633
|
+
call({ ...params, connectId, method: 'debugLinkGetState' }),
|
|
634
|
+
debugLinkMemoryRead: (connectId, params) =>
|
|
635
|
+
call({ ...params, connectId, method: 'debugLinkMemoryRead' }),
|
|
636
|
+
debugLinkMemoryWrite: (connectId, params) =>
|
|
637
|
+
call({ ...params, connectId, method: 'debugLinkMemoryWrite' }),
|
|
638
|
+
debugLinkRecordScreen: (connectId, params) =>
|
|
639
|
+
call({ ...params, connectId, method: 'debugLinkRecordScreen' }),
|
|
640
|
+
debugLinkReseedRandom: (connectId, params) =>
|
|
641
|
+
call({ ...params, connectId, method: 'debugLinkReseedRandom' }),
|
|
642
|
+
debugLinkStop: (connectId, params) => call({ ...params, connectId, method: 'debugLinkStop' }),
|
|
643
|
+
debugLinkWatchLayout: (connectId, params) =>
|
|
644
|
+
call({ ...params, connectId, method: 'debugLinkWatchLayout' }),
|
|
645
|
+
|
|
646
|
+
firmwareEraseEx: (connectId, params) => call({ ...params, connectId, method: 'firmwareEraseEx' }),
|
|
647
|
+
firmwareErase: (connectId, params) => call({ ...params, connectId, method: 'firmwareErase' }),
|
|
648
|
+
firmwareUpdateEmmcTest: (connectId, params) =>
|
|
649
|
+
call({ ...params, connectId, method: 'firmwareUpdateEmmcTest' }),
|
|
650
|
+
firmwareUploadTest: (connectId, params) =>
|
|
651
|
+
call({ ...params, connectId, method: 'firmwareUploadTest' }),
|
|
652
|
+
reboot: (connectId, params) => call({ ...params, connectId, method: 'reboot' }),
|
|
653
|
+
selfTest: (connectId, params) => call({ ...params, connectId, method: 'selfTest' }),
|
|
654
|
+
|
|
481
655
|
neoGetAddress: (connectId, deviceId, params) =>
|
|
482
656
|
call({ ...params, connectId, deviceId, method: 'neoGetAddress' }),
|
|
483
657
|
neoSignTransaction: (connectId, deviceId, params) =>
|
|
484
658
|
call({ ...params, connectId, deviceId, method: 'neoSignTransaction' }),
|
|
485
659
|
});
|
|
660
|
+
|
|
661
|
+
const pickApiMethods = <TApi extends object>(
|
|
662
|
+
api: InjectedApi<TestApi>,
|
|
663
|
+
methodNames: readonly string[]
|
|
664
|
+
): TApi => {
|
|
665
|
+
const selected: Record<string, unknown> = {};
|
|
666
|
+
methodNames.forEach(methodName => {
|
|
667
|
+
selected[methodName] = api[methodName as keyof typeof api];
|
|
668
|
+
});
|
|
669
|
+
return selected as TApi;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
export const createCoreApi = (call: CoreApi['call']): InjectedApi<CoreApi> => {
|
|
673
|
+
const api = createAllCoreApi(call);
|
|
674
|
+
const extensionMethodNames = new Set<string>([
|
|
675
|
+
...TEST_API_METHOD_NAMES,
|
|
676
|
+
...FACTORY_API_METHOD_NAMES,
|
|
677
|
+
]);
|
|
678
|
+
return Object.fromEntries(
|
|
679
|
+
Object.entries(api).filter(([methodName]) => !extensionMethodNames.has(methodName))
|
|
680
|
+
) as InjectedApi<CoreApi>;
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
export const createTestApi = (call: CoreApi['call']): TestApiMethods =>
|
|
684
|
+
pickApiMethods<TestApiMethods>(createAllCoreApi(call), TEST_API_METHOD_NAMES);
|
|
685
|
+
|
|
686
|
+
export const createFactoryApi = (call: CoreApi['call']): FactoryApi =>
|
|
687
|
+
pickApiMethods<FactoryApi>(createAllCoreApi(call), FACTORY_API_METHOD_NAMES);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BinanceAddress as HardwareBinanceAddress } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type TezosAddress = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareBinanceAddress;
|
|
7
|
+
|
|
8
|
+
export type BinanceAddressParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
showOnOneKey?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function binanceGetAddress(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & BinanceAddressParams
|
|
17
|
+
): Response<TezosAddress>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BinancePublicKey as HardwareBinancePublicKey } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type TezosPublicKey = {
|
|
5
|
+
path: string;
|
|
6
|
+
} & HardwareBinancePublicKey;
|
|
7
|
+
|
|
8
|
+
export type BinanceGetPublicKeyParams = {
|
|
9
|
+
path: string | number[];
|
|
10
|
+
showOnOneKey?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare function binanceGetPublicKey(
|
|
14
|
+
connectId: string,
|
|
15
|
+
deviceId: string,
|
|
16
|
+
params: CommonParams & BinanceGetPublicKeyParams
|
|
17
|
+
): Response<TezosPublicKey>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BinanceSignedTx,
|
|
3
|
+
BinanceSignTx as HardwareBinanceSignTx,
|
|
4
|
+
} from '@onekeyfe/hd-transport';
|
|
5
|
+
import type { CommonParams, Response } from '../params';
|
|
6
|
+
|
|
7
|
+
export type BinanceSignTxParams = {
|
|
8
|
+
path: string | number[];
|
|
9
|
+
} & Omit<HardwareBinanceSignTx, 'address_n'>;
|
|
10
|
+
|
|
11
|
+
export declare function binanceSignTx(
|
|
12
|
+
connectId: string,
|
|
13
|
+
deviceId: string,
|
|
14
|
+
params: CommonParams & BinanceSignTxParams
|
|
15
|
+
): Response<BinanceSignedTx>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BixinLoadDevice, Success } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export declare function bixinLoadDevice(
|
|
5
|
+
connectId: string,
|
|
6
|
+
deviceId: string,
|
|
7
|
+
params: CommonParams & BixinLoadDevice
|
|
8
|
+
): Response<Success>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BixinMessageSE, BixinOutMessageSE } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export declare function bixinMessageSE(
|
|
5
|
+
connectId: string,
|
|
6
|
+
deviceId: string,
|
|
7
|
+
params: CommonParams & BixinMessageSE
|
|
8
|
+
): Response<BixinOutMessageSE>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BixinVerifyDeviceAck, BixinVerifyDeviceRequest } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export declare function bixinVerifyDeviceRequest(
|
|
5
|
+
connectId: string,
|
|
6
|
+
deviceId: string,
|
|
7
|
+
params: CommonParams & BixinVerifyDeviceRequest
|
|
8
|
+
): Response<BixinVerifyDeviceAck>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InputScriptType, OwnershipProof } from '@onekeyfe/hd-transport';
|
|
2
|
+
import type { CommonParams, Response } from '../params';
|
|
3
|
+
|
|
4
|
+
export type BTCAuthorizeCoinJoin = {
|
|
5
|
+
path: string | number[];
|
|
6
|
+
coin?: string;
|
|
7
|
+
scriptType?: InputScriptType;
|
|
8
|
+
coordinator: string;
|
|
9
|
+
max_total_fee: number;
|
|
10
|
+
fee_per_anonymity?: number;
|
|
11
|
+
amount_unit?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export declare function btcAuthorizeCoinJoin(
|
|
15
|
+
connectId: string,
|
|
16
|
+
deviceId: string,
|
|
17
|
+
params: CommonParams & BTCAuthorizeCoinJoin
|
|
18
|
+
): Response<OwnershipProof>;
|