blockchainethereumsmart-contractssoliditytutorialdappweb3ethtruffleweb3jstransactionsigntransactionsignaturesign-datasignpublickeyprivatekeyethereum-identityencryptioncipher
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
612 B
19 lines
612 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.publicKeyByPrivateKey = publicKeyByPrivateKey;
|
|
var _ethereumjsUtil = require("ethereumjs-util");
|
|
var _util = require("./util");
|
|
/**
|
|
* Generate publicKey from the privateKey.
|
|
* This creates the uncompressed publicKey,
|
|
* where 04 has stripped from left
|
|
* @returns {string}
|
|
*/
|
|
function publicKeyByPrivateKey(privateKey) {
|
|
privateKey = (0, _util.addLeading0x)(privateKey);
|
|
var publicKeyBuffer = (0, _ethereumjsUtil.privateToPublic)((0, _ethereumjsUtil.toBuffer)(privateKey));
|
|
return publicKeyBuffer.toString('hex');
|
|
} |