|
|
@ -50,7 +50,7 @@ Stealth.prototype.fromRandom = function() { |
|
|
|
|
|
|
|
Stealth.prototype.getSharedKeyAsReceiver = function(senderPubkey) { |
|
|
|
var sharedSecretPoint = senderPubkey.point.mul(this.scanKey.privkey.bn); |
|
|
|
var sharedSecretPubkey = Pubkey(sharedSecretPoint); |
|
|
|
var sharedSecretPubkey = Pubkey({point: sharedSecretPoint}); |
|
|
|
var buf = sharedSecretPubkey.toDER(true); |
|
|
|
var sharedKey = KDF.sha256hmac2key(buf); |
|
|
|
|
|
|
@ -59,7 +59,7 @@ Stealth.prototype.getSharedKeyAsReceiver = function(senderPubkey) { |
|
|
|
|
|
|
|
Stealth.prototype.getSharedKeyAsSender = function(senderKey) { |
|
|
|
var sharedSecretPoint = this.scanKey.pubkey.point.mul(senderKey.privkey.bn); |
|
|
|
var sharedSecretPubkey = Pubkey(sharedSecretPoint); |
|
|
|
var sharedSecretPubkey = Pubkey({point: sharedSecretPoint}); |
|
|
|
var buf = sharedSecretPubkey.toDER(true); |
|
|
|
var sharedKey = KDF.sha256hmac2key(buf); |
|
|
|
|
|
|
@ -68,14 +68,14 @@ Stealth.prototype.getSharedKeyAsSender = function(senderKey) { |
|
|
|
|
|
|
|
Stealth.prototype.getReceivePubkeyAsReceiver = function(senderPubkey) { |
|
|
|
var sharedKey = this.getSharedKeyAsReceiver(senderPubkey); |
|
|
|
var pubkey = Pubkey(this.payloadKey.pubkey.point.add(sharedKey.pubkey.point)); |
|
|
|
var pubkey = Pubkey({point: this.payloadKey.pubkey.point.add(sharedKey.pubkey.point)}); |
|
|
|
|
|
|
|
return pubkey; |
|
|
|
}; |
|
|
|
|
|
|
|
Stealth.prototype.getReceivePubkeyAsSender = function(senderKey) { |
|
|
|
var sharedKey = this.getSharedKeyAsSender(senderKey); |
|
|
|
var pubkey = Pubkey(this.payloadKey.pubkey.point.add(sharedKey.pubkey.point)); |
|
|
|
var pubkey = Pubkey({point: this.payloadKey.pubkey.point.add(sharedKey.pubkey.point)}); |
|
|
|
|
|
|
|
return pubkey; |
|
|
|
}; |
|
|
|