pull/15/head
pubkey 7 years ago
parent 4038b1abaf
commit 5497c33e5c
  1. 6
      dist/es/public-key-by-private-key.js
  2. 9
      dist/lib/public-key-by-private-key.js
  3. 2
      package.json

@ -1,4 +1,5 @@
import EthUtil from 'ethereumjs-util';
import { addTrailing0x } from './util';
/**
* Generate publicKey from the privateKey.
@ -7,6 +8,7 @@ import EthUtil from 'ethereumjs-util';
* @returns {string}
*/
export default function publicKeyOfPrivateKey(privateKey) {
var publicKeyBuffer = EthUtil.privateToPublic(privateKey);
return publicKeyBuffer.toString('hex');
privateKey = addTrailing0x(privateKey);
var publicKeyBuffer = EthUtil.privateToPublic(privateKey);
return publicKeyBuffer.toString('hex');
}

@ -1,7 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports['default'] = publicKeyOfPrivateKey;
@ -9,6 +9,8 @@ var _ethereumjsUtil = require('ethereumjs-util');
var _ethereumjsUtil2 = _interopRequireDefault(_ethereumjsUtil);
var _util = require('./util');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
@ -18,6 +20,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd
* @returns {string}
*/
function publicKeyOfPrivateKey(privateKey) {
var publicKeyBuffer = _ethereumjsUtil2['default'].privateToPublic(privateKey);
return publicKeyBuffer.toString('hex');
privateKey = (0, _util.addTrailing0x)(privateKey);
var publicKeyBuffer = _ethereumjsUtil2['default'].privateToPublic(privateKey);
return publicKeyBuffer.toString('hex');
}

@ -1,6 +1,6 @@
{
"name": "eth-crypto",
"version": "1.0.0",
"version": "1.0.1",
"description": "Cryptographic functions for ethereum and how to use them with web3 and solidity",
"keywords": [
"ethereum",

Loading…
Cancel
Save