mirror of
https://github.com/status-im/contract-notifier.git
synced 2025-02-24 17:08:25 +00:00
15 lines
455 B
JavaScript
15 lines
455 B
JavaScript
const web3EthAccounts = require("web3-eth-accounts");
|
|
const web3Utils = require("web3-utils");
|
|
|
|
const isSignatureValid = (address, message, signature) => {
|
|
const accounts = new web3EthAccounts();
|
|
address = web3Utils.toChecksumAddress(address);
|
|
let recoverAddress = accounts.recover(message, signature);
|
|
recoverAddress = web3Utils.toChecksumAddress(recoverAddress);
|
|
return address === recoverAddress;
|
|
};
|
|
|
|
module.exports = {
|
|
isSignatureValid
|
|
};
|