I've figured out the mechanism to use Metamask and ethers for the user to sign an arbitrary message, but it involved computing a hash of the message, arrayifying it, and then calling verify message.
Something like this:
function signMessage(msg : string) : string {
let msgHash= ethers.utils.solidityKeccak256(['string'],[msg]);
let sig = await this.mySigner.signMessage(ethers.utils.arrayify(hash));
return sig;
}
The problem I am trying to solve for is what the user sees when Metamask requests signature of the message, which looks like this:
The problem is that the end user is shown the hash, but no way of knowing what the actual message is they are being asked to sign. If I were the user, I'd like to be able to read the message I am being asked to sign within Metamask. Is there some way that, rather than signing a hash of the message, you can request signature of the clear text of the message? I've tried supplying a string to ethers signer.signMessage
function but it produces errors.