I would like to verify that a message is sent by a certain address, and to get the signer address I use the following function:
function VerifyMessage(bytes32 _hashedMessage, uint8 _v, bytes32 _r, bytes32 _s) public pure returns (address) {
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 prefixedHashMessage = keccak256(abi.encodePacked(prefix, _hashedMessage));
address signer = ecrecover(prefixedHashMessage, _v, _r, _s);
return signer;
}
But in order to prevent the replication of the signature I would like to use nonce. How can I integrate the nonce into my logic? I have also frontend and backend in my application if any management might be required from those sides.