How to use the eth-sig-util.recoverPersonalSignature function in eth-sig-util

To help you get started, we’ve selected a few eth-sig-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spacesuit-extension / SpaceSuit / integration-test / tests.js View on Github external
return function validate(signature) {
    let recovered = sigUtil.recoverPersonalSignature({
      data: message,
      sig: signature
    })
    return norm(account) === norm(recovered)
  }
}
github MetaMask / eth-hd-keyring / test / index.js View on Github external
.then((sig) => {
        assert.notEqual(sig, message, 'something changed')

        const restored = sigUtil.recoverPersonalSignature({
          data: message,
          sig,
        })

        assert.equal(restored, sigUtil.normalize(address), 'recovered address')
        done()
      })
      .catch((reason) => {
github ninjadotorg / handshake-app / src / guru / services / metamask / connect.js View on Github external
const recovertSign = (params) => {
  const { signedToken, signText } = params;
  return sigUtil.recoverPersonalSignature({
    data: signText,
    sig: signedToken
  });
};
github ProofOfToss / proof-of-toss / src / util / auth.js View on Github external
function (err, result) {
        if (err) {
          return errorCallback(err);
        }

        if (result.error) {
          return errorCallback(result.error);
        }

        const msgParams = {data: msg, sig: result.result};
        const recovered = sigUtil.recoverPersonalSignature(msgParams);

        if (recovered === currentAddress) {
          saveTokenToLocalStorage(currentAddress, result.result);

          return successCallback();
        } else {
          return errorCallback();
        }
      }
    );
github DigixGlobal / truffle-lightwallet-provider / node_modules / web3-provider-engine / subproviders / hooked-wallet.js View on Github external
HookedWalletSubprovider.prototype.recoverPersonalSignature = function(msgParams, cb) {
  let senderHex
  try {
    senderHex = sigUtil.recoverPersonalSignature(msgParams)
  } catch (err) {
    return cb(err)
  }
  cb(null, senderHex)
}
github AudiusProject / audius-protocol / libs / src / services / web3Manager / index.js View on Github external
async verifySignature (data, signature) {
    return sigUtil.recoverPersonalSignature({ data: data, sig: signature })
  }
github unlock-protocol / unlock / unlock-app / src / components / interface / VerificationStatus.tsx View on Github external
})

  let matchingKey: OwnedKey | undefined

  if (queryResults.data) {
    matchingKey = queryResults.data.keyHolders[0].keys.find((key: OwnedKey) => {
      return key.lock.address === lockAddress
    })
  }

  const secondsElapsedFromSignature = Math.floor(
    (Date.now() - timestamp) / 1000
  )

  const identityIsValid =
    sigUtil.recoverPersonalSignature({
      data: hexData,
      sig,
    }) === accountAddress.toLowerCase()

  return (
    <div>
      {matchingKey &amp;&amp; <h1>{matchingKey.lock.name}</h1>}
      

      
</div>