Fix pubkey.decode API

This commit is contained in:
Kagami Hiiragi 2015-01-29 01:21:48 +03:00
parent 8e892581f5
commit 2416094686
2 changed files with 5 additions and 5 deletions

View File

@ -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 = {};

View File

@ -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);