eth-crypto
Version:
Cryptographic functions for ethereum and how to use them with web3 and solidity
14 lines (13 loc) • 430 B
JavaScript
import { recoverPublicKey } from './recover-public-key';
import { toAddress as addressByPublicKey } from './public-key';
/**
* returns the address with which the messageHash was signed
* @param {string} sigString
* @param {string} hash
* @return {string} address
*/
export function recover(sigString, hash) {
var pubkey = recoverPublicKey(sigString, hash);
var address = addressByPublicKey(pubkey);
return address;
}