diff --git a/lib/expmt/stealthkey.js b/lib/expmt/stealthkey.js index 2382cd00a..224203f43 100644 --- a/lib/expmt/stealthkey.js +++ b/lib/expmt/stealthkey.js @@ -44,15 +44,6 @@ Stealthkey.prototype.getSharedKeypairAsReceiver = function(senderPubkey) { 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) { var sharedKeypair = this.getSharedKeypairAsReceiver(senderPubkey); var pubkey = Pubkey({point: this.payloadKeypair.pubkey.point.add(sharedKeypair.pubkey.point)}); @@ -60,13 +51,6 @@ Stealthkey.prototype.getReceivePubkeyAsReceiver = function(senderPubkey) { 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) { var sharedKeypair = this.getSharedKeypairAsReceiver(senderPubkey); var privkey = Privkey({bn: this.payloadKeypair.privkey.bn.add(sharedKeypair.privkey.bn).mod(Point.getN())}); diff --git a/test/stealthkey.js b/test/stealthkey.js index 09638eda9..222a02741 100644 --- a/test/stealthkey.js +++ b/test/stealthkey.js @@ -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() { 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() { it('should return a key', function() {