From 298c7d049ac5b16a24694490d03d4a075bc9e147 Mon Sep 17 00:00:00 2001 From: metalurgical <97008724+metalurgical@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:52:45 +0200 Subject: [PATCH] fix: remove prefix form public key if present --- .../web3_android_mpc_provider/EthereumTssAccount.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web3-android-mpc-provider/src/main/java/com/web3auth/web3_android_mpc_provider/EthereumTssAccount.java b/web3-android-mpc-provider/src/main/java/com/web3auth/web3_android_mpc_provider/EthereumTssAccount.java index 0d64645..96a5844 100644 --- a/web3-android-mpc-provider/src/main/java/com/web3auth/web3_android_mpc_provider/EthereumTssAccount.java +++ b/web3-android-mpc-provider/src/main/java/com/web3auth/web3_android_mpc_provider/EthereumTssAccount.java @@ -43,7 +43,14 @@ public class EthereumTssAccount { public EthereumTssAccount(EthTssAccountParams params) { ethAccountParams = params; - evmAddress = Keys.toChecksumAddress(Keys.getAddress(params.publicKey)); + String prefix = "04"; + String key; + if (params.publicKey.startsWith(prefix)) { + key = params.publicKey.substring(prefix.length()); + } else { + key = params.publicKey; + } + evmAddress = Keys.toChecksumAddress(Keys.getAddress(key)); } public String signMessage(String message) throws TSSClientError, CustomSigningError {