Using ethers and metamask to sign plaintext message? #3381
Unanswered
grapevinegizmos
asked this question in
Q&A
Replies: 1 comment
-
Have you tried this way: const provider= new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const message= "Hello Ethers!"
const signature = await signer.signMessage(message); // this will trigger metamask for signature request
const verify = ethers.utils.verifyMessage(message, signature) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been able to use metamask and ethers to request that a user sign a hash of a message, but what I'd like to do is display the plaintext of a message and ask an account holder to sign the plaintext. I've been unable to figure out how to do that using Signer.signMessage(),
although it seems like it should be possible per the documentation. I get an arrayify error message if I supply a plaintext string, rather than arrayify(keccakhash(string)) to the method.
For a more complete description of the problem, see the stackoverflow question here: https://ethereum.stackexchange.com/questions/136351/is-it-possible-to-use-metamask-to-sign-a-plaintext-message
Is it possible? If not, it is planned to be possible?
Beta Was this translation helpful? Give feedback.
All reactions