UNPKG

leap-node

Version:

[![codecov](https://codecov.io/gh/leapdao/leap-node/branch/master/graph/badge.svg)](https://codecov.io/gh/leapdao/leap-node) [![Docker Repository on Quay](https://quay.io/repository/leapdao/leap-node/status "Docker Repository on Quay")](https://quay.io/re

10 lines (8 loc) 304 B
const utils = require('ethereumjs-util'); module.exports = function getAddress(pubkey) { const bytes = pubkey.startsWith('0x') ? Buffer.from(pubkey.replace('0x', ''), 'hex') : Buffer.from(pubkey, 'base64'); const hash = utils.sha256(bytes).slice(0, 20); return hash.toString('base64'); };