walletconnect-monorepo: Can't get valid signatures for signMessage for web3-provider
I can’t get a verifiable signature when I use web3 provider like ethers, direct usage of connector works fine.
This works (with direct connector usage): https://codesandbox.io/s/unruffled-benz-9ubn6?file=/src/App.vue
This doesn’t work: https://codesandbox.io/s/gallant-banach-z7svg?file=/src/App.vue the same code works for direct MetaMask usage as a browser extension.
I was also testing with wrappers like:
const rawMessageLength = new Blob([rawMessage]).size
let message = ethers.utils.toUtf8Bytes("\x19Ethereum Signed Message:\n" + rawMessageLength + rawMessage)
message = ethers.utils.keccak256(message)
They don’t help as well.
This topic was also discussed here: https://stackoverflow.com/questions/63793873/sign-and-verifiy-message-on-ethereum-using-wallet-connect-not-working/63817084#63817084
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 19 (8 by maintainers)
The method below you can try, and you can see the full raw message (not hex) on the client side
reference from zkSync
Here’s my workaround that works for window.ethereum and wallet connect, with ethers:
now its just using
_legacySignMessagesee https://github.com/ethers-io/ethers.js/commit/8947fd405e3aea07f6db958d89a3ad39abe3a25aThis is true now for any provider, not just Metamask, so this should affect walletconnect as well
I spent a fair amount of time trying to understand what’s going on with signatures and wallet, and the response is that it’s just a jungle.
What I found:
Check this: https://github.com/mooni/mooni/blob/master/app/src/lib/eth.ts#L130 I don’t support contract wallets
@miohtama currently I use the following hack:
Do you wish me to make a PR with a fix for that?