On a web page I have some 3 fields, name, age and height, which a user authenticated via MetaMask sends to backend along with his wallet address. In JSON.
In order to ensure that data that's sent hasn't been tampered and his wallet address indeed belongs to him, I'll have to ask a user to sign data, right? I'm aware of how to do it:
let mySigData = await this.mySigner.signMessage(ethers.utils.arrayify("some data"));
I'll also include a timestamp in data to prevent re-usage of a signature.
However, what is it what I actually will have to send from a client to then send to backend? What will all the data (data + payload) look like?
And how will I then deconstract it on a server properly?
Option #1
{
name: "name1",
age: 367,
height: 188,
sig: "fdsafdsafdsafds$$2fds####",
timestamp: 1236366
}
Option #2
{
sig: "#6$$,,##$$-safd8543gfds", //name, age and height have somehow been embeded here
timestamp: 1236366
}
I'm aware how to verify a signature itself in ether.js
but I mean the whole data itself.
On a server I'll then call .... what?
const verify = ethers.utils.verifyMessage("???", params["sig"])