Javascript Validation
(JS / Node)
Validate signature belongs to the signing address
To validate the signature belongs to the signing address, we can use the method recover from web3.eth.account.recover:
function checkSignatureMatch(signingAddress, transaction, signature) {
var expectedSigningAddress = web3.eth.accounts.recover(transaction, signature);
var isEqual = expectedSigningAddress === signingAddress;
return isEqual;
}
Updated almost 5 years ago