Stealth.prototype.set
This commit is contained in:
parent
0ca390d45b
commit
6b4bc4c49c
|
@ -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) {
|
||||
|
|
|
@ -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…
Reference in New Issue