walletkey: minor.

This commit is contained in:
Christopher Jeffrey 2016-10-03 03:27:49 -07:00
parent 2097450b42
commit 44b5a8725e
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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
*/