Browse Source

Stealth.prototype.set

patch-2
Ryan X. Charles 11 years ago
parent
commit
6b4bc4c49c
  1. 13
      lib/expmt/stealth.js
  2. 8
      test/test.stealth.js

13
lib/expmt/stealth.js

@ -6,12 +6,17 @@ var Hash = require('../hash');
var KDF = require('../kdf');
var base58check = require('../base58check');
var Stealth = function Stealth(payloadKey, scanKey) {
var Stealth = function Stealth(obj) {
if (!(this instanceof Stealth))
return new Stealth(payloadKey, scanKey);
return new Stealth(obj);
if (obj)
this.set(obj);
};
this.payloadKey = payloadKey;
this.scanKey = scanKey;
Stealth.prototype.set = function(obj) {
this.payloadKey = obj.payloadKey || this.payloadKey;
this.scanKey = obj.scanKey || this.scanKey;
return this;
};
Stealth.prototype.fromAddressBuffer = function(buf) {

8
test/test.stealth.js

@ -36,6 +36,14 @@ describe('Stealth', function() {
should.exist(stealth);
});
describe('#set', function() {
it('should set payload key', function() {
should.exist(Stealth().set({payloadKey: stealth.payloadKey}).payloadKey);
});
});
describe('#fromAddressBuffer', function() {
it('should give a stealth address with the right pubkeys', function() {

Loading…
Cancel
Save