diff --git a/lib/expmt/stealthaddress.js b/lib/expmt/stealthaddress.js index 2c5cb8bcf..0d8212853 100644 --- a/lib/expmt/stealthaddress.js +++ b/lib/expmt/stealthaddress.js @@ -65,7 +65,7 @@ StealthAddress.prototype.getSharedKeypair = function(senderKeypair) { StealthAddress.prototype.getReceivePubkey = function(senderKeypair) { var sharedKeypair = this.getSharedKeypair(senderKeypair); - var pubkey = Pubkey(this.scanPubkey.point.add(sharedKeypair.pubkey.point).add(this.payloadPubkey.point)); + var pubkey = Pubkey(this.payloadPubkey.point.add(sharedKeypair.pubkey.point)); return pubkey; }; diff --git a/lib/expmt/stealthkey.js b/lib/expmt/stealthkey.js index 385983b33..2570c777b 100644 --- a/lib/expmt/stealthkey.js +++ b/lib/expmt/stealthkey.js @@ -46,14 +46,14 @@ Stealthkey.prototype.getSharedKeypair = function(senderPubkey) { Stealthkey.prototype.getReceivePubkey = function(senderPubkey) { var sharedKeypair = this.getSharedKeypair(senderPubkey); - var pubkey = Pubkey({point: this.scanKeypair.pubkey.point.add(sharedKeypair.pubkey.point).add(this.payloadKeypair.pubkey.point)}); + var pubkey = Pubkey({point: this.payloadKeypair.pubkey.point.add(sharedKeypair.pubkey.point)}); return pubkey; }; Stealthkey.prototype.getReceiveKeypair = function(senderPubkey) { var sharedKeypair = this.getSharedKeypair(senderPubkey); - var privkey = Privkey({bn: this.scanKeypair.privkey.bn.add(sharedKeypair.privkey.bn).add(this.payloadKeypair.privkey.bn).mod(Point.getN())}); + var privkey = Privkey({bn: this.payloadKeypair.privkey.bn.add(sharedKeypair.privkey.bn).mod(Point.getN())}); var key = Keypair({privkey: privkey}); key.privkey2pubkey(); diff --git a/test/stealthkey.js b/test/stealthkey.js index 69b8b2228..472cd751d 100644 --- a/test/stealthkey.js +++ b/test/stealthkey.js @@ -103,12 +103,12 @@ describe('Stealthkey', function() { describe('#isForMe', function() { it('should return true if it (the transaction or message) is for me', function() { - var pubkeyhash = new Buffer('0db7f06cffb913322e211e8b0688efe8ff52aa8d', 'hex'); + var pubkeyhash = new Buffer('3cb64fa6ee9b3e8754e3e2bd033bf61048604a99', 'hex'); stealthkey.isForMe(senderKeypair.pubkey, pubkeyhash).should.equal(true); }); it('should return false if it (the transaction or message) is not for me', function() { - var pubkeyhash = new Buffer('ffb7f06cffb913322e211e8b0688efe8ff52aa8d', 'hex'); + var pubkeyhash = new Buffer('00b64fa6ee9b3e8754e3e2bd033bf61048604a99', 'hex'); stealthkey.isForMe(senderKeypair.pubkey, pubkeyhash).should.equal(false); }); diff --git a/test/stealthmessage.js b/test/stealthmessage.js index 7951081f3..16b2139e1 100644 --- a/test/stealthmessage.js +++ b/test/stealthmessage.js @@ -12,7 +12,7 @@ describe('StealthMessage', function() { var payloadKeypair = KDF.buf2keypair(new Buffer('key1')); var scanKeypair = KDF.buf2keypair(new Buffer('key2')); var fromKeypair = KDF.buf2keypair(new Buffer('key3')); - var enchex = '3867dce7be22e8551512b25f329b51fd5fe8ecfe0381c7831a20c7c9ec88dcf092ea3683261798ccda991ed65a3a54a036d8125dec0381c7831a20c7c9ec88dcf092ea3683261798ccda991ed65a3a54a036d8125dec9f86d081884c7d659a2feaa0c55ad015aca97de5af3a34a0f47eee0a1f7774dcb759187555003282bd23b047bceb5b2f2c1ee35b8f0be1fda7a41424f6cc8030559c8c32ea8cc812860f4c8123f1417a'; + var enchex = 'f557994f16d0d628fa4fdb4ab3d7e0bc5f2754f20381c7831a20c7c9ec88dcf092ea3683261798ccda991ed65a3a54a036d8125dec0381c7831a20c7c9ec88dcf092ea3683261798ccda991ed65a3a54a036d8125dec9f86d081884c7d659a2feaa0c55ad01560ba2904d3bc8395b6c4a6f87648edb33db6a22170e5e26f340c7ba943169210234cd6a753ad13919b0ab7d678b47b5e7d63e452382de2c2590fb57ef048f7b3'; var encbuf = new Buffer(enchex, 'hex'); var ivbuf = Hash.sha256(new Buffer('test')).slice(0, 128 / 8); var sk = Stealthkey().set({payloadKeypair: payloadKeypair, scanKeypair: scanKeypair});