To verify a signature via web3, you can use the web3.eth.accounts.recover
method. Here's how I did it
const Web3 = require('web3');
const web3 = new Web3('https://mainnet.infura.io/v3/your-project-id'); // Replace with your own Infura project ID or URL
const signature = '...'; // Replace with the signature you want to verify
const message = '...'; // Replace with the original message that was signed
const address = '...'; // Replace with the expected signer address
const recoveredAddress = web3.eth.accounts.recover(message, signature);
if (recoveredAddress.toLowerCase() === address.toLowerCase()) {
console.log('Signature is valid!');
} else {
console.log('Signature is invalid.');
}
Hope that works for you