Comparing version 1.6.2 to 1.6.3
@@ -77,5 +77,9 @@ 'use strict'; | ||
/** ECIES */ | ||
/** | ||
ECIES | ||
@arg {string|Object} pubkey wif, PublicKey object | ||
@return {Buffer} 64 byte shared secret | ||
*/ | ||
function getSharedSecret(public_key) { | ||
public_key = toPublic(public_key); | ||
public_key = PublicKey(public_key); | ||
var KB = public_key.toUncompressed().toBuffer(); | ||
@@ -92,5 +96,8 @@ var KBP = Point.fromAffine(secp256k1, BigInteger.fromBuffer(KB.slice(1, 33)), // x | ||
// /** ECIES (does not always match the Point.fromAffine version above) */ | ||
// getSharedSecret(public_key){ | ||
// public_key = toPublic(public_key) | ||
// /** ECIES TODO unit test | ||
// @arg {string|Object} pubkey wif, PublicKey object | ||
// @return {Buffer} 64 byte shared secret | ||
// */ | ||
// function getSharedSecret(public_key) { | ||
// public_key = PublicKey(public_key).toUncompressed() | ||
// var P = public_key.Q.multiply( d ); | ||
@@ -109,3 +116,3 @@ // var S = P.affineX.toBuffer({size: 32}); | ||
function getChildKey(name) { | ||
console.error('WARNING: getChildKey untested against eosd'); | ||
// console.error('WARNING: getChildKey untested against eosd'); // no eosd impl yet | ||
var index = createHash('sha256').update(toBuffer()).update(name).digest(); | ||
@@ -205,6 +212,2 @@ return PrivateKey(index); | ||
return PrivateKey.fromBuffer(keyUtils.random32ByteBuffer({ cpuEntropyBits: cpuEntropyBits })); | ||
}; | ||
var toPublic = function toPublic(data) { | ||
return data == null ? data : data.Q ? data : PublicKey.fromStringOrThrow(data); | ||
}; |
@@ -31,3 +31,3 @@ 'use strict'; | ||
if ((typeof Q === 'undefined' ? 'undefined' : _typeof(Q)) !== 'object' || !Q.compressed) { | ||
if ((typeof Q === 'undefined' ? 'undefined' : _typeof(Q)) !== 'object' || typeof Q.compressed !== 'boolean') { | ||
throw new TypeError('Invalid public key'); | ||
@@ -67,3 +67,6 @@ } | ||
/** @deprecated */ | ||
function child(offset) { | ||
console.error('Deprecated warning: PublicKey.child'); | ||
assert(Buffer.isBuffer(offset), "Buffer required: offset"); | ||
@@ -70,0 +73,0 @@ assert.equal(offset.length, 32, "offset length"); |
{ | ||
"name": "eosjs-ecc", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "Elliptic curve cryptography functions", | ||
@@ -5,0 +5,0 @@ "keywords": "ECC, Private Key, Public Key, Signature, AES, Encryption, Decryption", |
Sorry, the diff of this file is too big to display
1359455
39
33496