-
On the front end I am using react, Wallet Connect 2 and ethers.js 6.7.1 Currently am creating a signature on the front end using ethers.js 6.7.1. I am then retrieving the wallet address from the signature to verify it is the same address I signed with. I wish to move the verifying bit of the signature code to the Java Backend so was thinking of using the web3j library for that. This question is about how do I verify the signature using web3j? I am showing the JavaScript code used to create the signature so that the verify signature java code can be compatible. My TypeScript code which creates the signature and verifies it is as follows:
My code successfully creates the signature using ethers.js. Although the code is client side I also verify the signature to check the ethers code is working:
What I want to do is verify the signature on the Java Side instead of on the TypeScript side. As you can see I can verify the signature and get the wallet address with a single line:
My question is how do I do the same thing using web3j ? Thank you for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I am not sure if I need to go low level and be adding stuff like this to the signedMessage before trying to process it:
|
Beta Was this translation helpful? Give feedback.
-
Hey @javaspeak , Have you tried these functions to recover or verify - |
Beta Was this translation helpful? Give feedback.
Hey @javaspeak , Have you tried these functions to recover or verify -
signedMessageToKey
,recoverFromSignature
,getRecId
, etc from Sign Class - https://github.com/web3j/web3j/blob/master/crypto/src/main/java/org/web3j/crypto/Sign.java