I am trying to authenticate phantom wallet by signing it with a message I used below code to sign the message and it returns me a signature how can I verify that signature in the backend.
const encodedMessage = new TextEncoder().encode("Message to sign");
const signedMessage = await window.solana.request({
method: "signMessage",
params: {
message: encodedMessage,
display: "utf8", //hex,utf8
},
});
Here signed Message responds with this answer with publickey and a signature
{
"publicKey": "Gy4xSKsLHXScRMVZgKt5f6BvDawp1JW8PrenA3GbakCK",
"signature": "5BoNFSoV9WEafBnXon2ujPzH5zgjwZkXHL9vkHuUHEnc1AqLSN38LEx5XtAz68JFEt9RhvuhmPL3GkMPdMcQPuzN"
}