Fix pubkey.decode API
This commit is contained in:
parent
8e892581f5
commit
2416094686
|
@ -208,9 +208,9 @@ var pubkey = exports.pubkey = {
|
|||
/**
|
||||
* Options for decoding pubkey
|
||||
* @typedef {Object} PubkeyDecodeOpts
|
||||
* @property {?(Address[]|Address|Object)} neededPubkeys - Address
|
||||
* objects which represent pubkeys that we are interested in; this is
|
||||
* used only for pubkeys v4
|
||||
* @property {?(Address[]|Address|Object)} needed - Address objects
|
||||
* which represent pubkeys that we are interested in; this is used
|
||||
* only for pubkeys v4
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -266,7 +266,7 @@ var pubkey = exports.pubkey = {
|
|||
// `neededPubkeys` is either single address or addresses array or
|
||||
// Object key-by-tag. Time to match the tag is O(1), O(n), O(1)
|
||||
// respectfully.
|
||||
var neededPubkeys = opts.neededPubkeys || {};
|
||||
var neededPubkeys = opts.needed || {};
|
||||
if (Address.isAddress(neededPubkeys)) {
|
||||
addr = neededPubkeys;
|
||||
neededPubkeys = {};
|
||||
|
|
2
test.js
2
test.js
|
@ -612,7 +612,7 @@ describe("Object types", function() {
|
|||
return pubkey.encodeAsync({ttl: 789, from: from, to: from})
|
||||
.then(function(buf) {
|
||||
expect(message.decode(buf).command).to.equal("object");
|
||||
return pubkey.decodeAsync(buf, {neededPubkeys: from});
|
||||
return pubkey.decodeAsync(buf, {needed: from});
|
||||
}).then(function(res) {
|
||||
expect(res.ttl).to.be.at.most(789);
|
||||
expect(res.type).to.equal(object.PUBKEY);
|
||||
|
|
Loading…
Reference in New Issue
Block a user