Hi Zeppelins
I am trying to verify signatures with a wallet created with ethers with its method
ethers.Wallet.createRandom()
.
Then I create the hash of the message:
let sha256 = ethers.utils.hashMessage("message 1", "message 2")
And finally I sign it with:
const hash = await wallet.signMessage(sha256);
When checking the message I check that the method used is
function prefixed(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
Thus:
bytes32 message = prefixed(keccak256(abi.encodePacked(idGame, this)));
I think this prefix is to check if it has been signed with a certain metamask?
Should I remove the check like this?
bytes32 message = keccak256(abi.encodePacked(idGame, this));
Or is it much better to add it in the message creation like this?
let sha256 = ethers.utils.hashMessage("\x19Ethereum Signed Message:\n32", "message 1", "message 2")