Ethereum Public Address Recovery

a message that the address has signed on

the signature after signing the message

Code examples

Programming language for the example below

import { recoverAddress, getBytes, hashMessage } from "ethers";

  const recoverPublicKey = (message, signature) => {
    const digest = getBytes(hashMessage(message));
    return recoverAddress(digest, signature);
  }