Stealthkey AsSender functions obsolete
use StealthAddress instead
This commit is contained in:
parent
779e48d562
commit
558a7672ef
@ -44,15 +44,6 @@ Stealthkey.prototype.getSharedKeypairAsReceiver = function(senderPubkey) {
|
|||||||
return sharedKeypair;
|
return sharedKeypair;
|
||||||
};
|
};
|
||||||
|
|
||||||
Stealthkey.prototype.getSharedKeypairAsSender = function(senderKeypair) {
|
|
||||||
var sharedSecretPoint = this.scanKeypair.pubkey.point.mul(senderKeypair.privkey.bn);
|
|
||||||
var sharedSecretPubkey = Pubkey({point: sharedSecretPoint});
|
|
||||||
var buf = sharedSecretPubkey.toDER(true);
|
|
||||||
var sharedKeypair = KDF.sha256hmac2keypair(buf);
|
|
||||||
|
|
||||||
return sharedKeypair;
|
|
||||||
};
|
|
||||||
|
|
||||||
Stealthkey.prototype.getReceivePubkeyAsReceiver = function(senderPubkey) {
|
Stealthkey.prototype.getReceivePubkeyAsReceiver = function(senderPubkey) {
|
||||||
var sharedKeypair = this.getSharedKeypairAsReceiver(senderPubkey);
|
var sharedKeypair = this.getSharedKeypairAsReceiver(senderPubkey);
|
||||||
var pubkey = Pubkey({point: this.payloadKeypair.pubkey.point.add(sharedKeypair.pubkey.point)});
|
var pubkey = Pubkey({point: this.payloadKeypair.pubkey.point.add(sharedKeypair.pubkey.point)});
|
||||||
@ -60,13 +51,6 @@ Stealthkey.prototype.getReceivePubkeyAsReceiver = function(senderPubkey) {
|
|||||||
return pubkey;
|
return pubkey;
|
||||||
};
|
};
|
||||||
|
|
||||||
Stealthkey.prototype.getReceivePubkeyAsSender = function(senderKeypair) {
|
|
||||||
var sharedKeypair = this.getSharedKeypairAsSender(senderKeypair);
|
|
||||||
var pubkey = Pubkey({point: this.payloadKeypair.pubkey.point.add(sharedKeypair.pubkey.point)});
|
|
||||||
|
|
||||||
return pubkey;
|
|
||||||
};
|
|
||||||
|
|
||||||
Stealthkey.prototype.getReceiveKeypair = function(senderPubkey) {
|
Stealthkey.prototype.getReceiveKeypair = function(senderPubkey) {
|
||||||
var sharedKeypair = this.getSharedKeypairAsReceiver(senderPubkey);
|
var sharedKeypair = this.getSharedKeypairAsReceiver(senderPubkey);
|
||||||
var privkey = Privkey({bn: this.payloadKeypair.privkey.bn.add(sharedKeypair.privkey.bn).mod(Point.getN())});
|
var privkey = Privkey({bn: this.payloadKeypair.privkey.bn.add(sharedKeypair.privkey.bn).mod(Point.getN())});
|
||||||
|
|||||||
@ -71,32 +71,6 @@ describe('Stealthkey', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#getSharedKeypairAsSender', function() {
|
|
||||||
|
|
||||||
it('should return a key', function() {
|
|
||||||
var stealthkey2 = new Stealthkey();
|
|
||||||
stealthkey2.payloadKeypair = new Keypair();
|
|
||||||
stealthkey2.payloadKeypair.pubkey = stealthkey.payloadKeypair.pubkey;
|
|
||||||
stealthkey2.scanKeypair = new Keypair();
|
|
||||||
stealthkey2.scanKeypair.pubkey = stealthkey.scanKeypair.pubkey;
|
|
||||||
var key = stealthkey2.getSharedKeypairAsSender(senderKeypair);
|
|
||||||
(key instanceof Keypair).should.equal(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return the same key as getSharedKeypairAsReceiver', function() {
|
|
||||||
var stealthkey2 = new Stealthkey();
|
|
||||||
stealthkey2.payloadKeypair = new Keypair();
|
|
||||||
stealthkey2.payloadKeypair.pubkey = stealthkey.payloadKeypair.pubkey;
|
|
||||||
stealthkey2.scanKeypair = new Keypair();
|
|
||||||
stealthkey2.scanKeypair.pubkey = stealthkey.scanKeypair.pubkey;
|
|
||||||
var key = stealthkey2.getSharedKeypairAsSender(senderKeypair);
|
|
||||||
|
|
||||||
var key2 = stealthkey.getSharedKeypairAsReceiver(senderKeypair.pubkey);
|
|
||||||
key.toString().should.equal(key2.toString());
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('#getReceivePubkeyAsReceiver', function() {
|
describe('#getReceivePubkeyAsReceiver', function() {
|
||||||
|
|
||||||
it('should return a pubkey', function() {
|
it('should return a pubkey', function() {
|
||||||
@ -106,21 +80,6 @@ describe('Stealthkey', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#getReceivePubkeyAsSender', function() {
|
|
||||||
|
|
||||||
it('should return a pubkey', function() {
|
|
||||||
var pubkey = stealthkey.getReceivePubkeyAsSender(senderKeypair);
|
|
||||||
(pubkey instanceof Pubkey).should.equal(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return the same pubkey as getReceivePubkeyAsReceiver', function() {
|
|
||||||
var pubkey = stealthkey.getReceivePubkeyAsSender(senderKeypair);
|
|
||||||
var pubkey2 = stealthkey.getReceivePubkeyAsReceiver(senderKeypair.pubkey);
|
|
||||||
pubkey2.toString().should.equal(pubkey.toString());
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('#getReceiveKeypair', function() {
|
describe('#getReceiveKeypair', function() {
|
||||||
|
|
||||||
it('should return a key', function() {
|
it('should return a key', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user