From 44b5a8725ed9a2dd8f318e18318e1d1a5fd31242 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 3 Oct 2016 03:27:49 -0700 Subject: [PATCH] walletkey: minor. --- lib/wallet/walletkey.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/wallet/walletkey.js b/lib/wallet/walletkey.js index 03b71d3f..07e881ae 100644 --- a/lib/wallet/walletkey.js +++ b/lib/wallet/walletkey.js @@ -248,22 +248,8 @@ WalletKey.fromRing = function fromRing(account, ring) { }; /** - * Test whether an object is a WalletKey. - * @param {Object} obj - * @returns {Boolean} - */ - -WalletKey.isWalletKey = function isWalletKey(obj) { - return obj - && obj.path !== undefined - && Buffer.isBuffer(obj.publicKey) - && typeof obj.toSecret === 'function'; -}; - -/** - * Test whether an object is a WalletKey. - * @param {Object} obj - * @returns {Boolean} + * Convert wallet key to a path. + * @returns {Path} */ WalletKey.prototype.toPath = function toPath() { @@ -293,6 +279,19 @@ WalletKey.prototype.toPath = function toPath() { return path; }; +/** + * Test whether an object is a WalletKey. + * @param {Object} obj + * @returns {Boolean} + */ + +WalletKey.isWalletKey = function isWalletKey(obj) { + return obj + && Buffer.isBuffer(obj.publicKey) + && typeof obj.index === 'number' + && typeof obj.toPath === 'function'; +}; + /* * Expose */