From 2416094686e637b9204307361388a8cd28a0038d Mon Sep 17 00:00:00 2001 From: Kagami Hiiragi Date: Thu, 29 Jan 2015 01:21:48 +0300 Subject: [PATCH] Fix pubkey.decode API --- lib/objects.js | 8 ++++---- test.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/objects.js b/lib/objects.js index 7d984ac..5c315d5 100644 --- a/lib/objects.js +++ b/lib/objects.js @@ -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 = {}; diff --git a/test.js b/test.js index 19fa84c..98415d5 100644 --- a/test.js +++ b/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);