I need to verify the signer of a signature in my node server.

const fortmaticApiKey = 'pk_live_...';

const checkPersonalSignature = async (data, signature, signer) => {
  try {
    const { get } = configure();
    const fm = new Fortmatic(fortmaticApiKey);
    const web3 = new Web3(fm.getProvider());
    const calculatedSigner = web3.eth.personal.ecRecover(data, signature);
    return calculatedSigner === signer;
  } catch (error) {
    return false;

Here I'm trying to use Fortmatic as my provider. This code always gives back false because Fortmatic tries to access window which isn't defined on a Node server.

If I try to call eth.personal.ecRecover without providing a provider, Web3 complains that it needs a provider for that method. How can I recover signatures on the server?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.