initial work replacing symmetric shared secret with ECIES

This commit is contained in:
Ryan X. Charles 2014-06-08 12:59:48 -07:00
commit 31d601b2a6
4 changed files with 55 additions and 23 deletions

View file

@ -20,13 +20,25 @@ function PrivateKey(opts) {
PrivateKey.prototype.getId = function() {
if (!this.id) {
var path = Structure.IdFullBranch;
var idhk = this.bip.derive(path);
this.id= idhk.eckey.public.toString('hex');
this.cacheId();
}
return this.id;
};
PrivateKey.prototype.getIdPriv = function() {
if (!this.idpriv) {
this.cacheId();
}
return this.idpriv;
};
PrivateKey.prototype.cacheId = function() {
var path = Structure.IdFullBranch;
var idhk = this.bip.derive(path);
this.id = idhk.eckey.public.toString('hex');
this.idpriv = idhk.eckey.private.toString('hex');
};
PrivateKey.prototype.deriveBIP45Branch = function() {
if (!this.bip45Branch) {
this.bip45Branch = this.bip.derive(Structure.BIP45_PUBLIC_PREFIX);