initial work replacing symmetric shared secret with ECIES
This commit is contained in:
parent
a535d93b6f
commit
31d601b2a6
4 changed files with 55 additions and 23 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue