Merge pull request #1103 from dskloet/patch-1

Fix JS doc for publickey.js
This commit is contained in:
Esteban Ordano 2015-02-23 11:14:54 -03:00
commit 33e3dcf01b
1 changed files with 9 additions and 7 deletions

View File

@ -117,7 +117,7 @@ PublicKey._isBuffer = function(param) {
/**
* Internal function to detect if a param is a JSON string or plain object
*
* @param {*} param - value to test
* @param {*} json - value to test
* @returns {boolean}
* @private
*/
@ -146,7 +146,7 @@ PublicKey._transformPrivateKey = function(privkey) {
* Internal function to transform DER into a public key point
*
* @param {Buffer} buf - An hex encoded buffer
* @param {bool} [strict] - if set to false, will loosen some conditions
* @param {bool=} strict - if set to false, will loosen some conditions
* @returns {Object} An object with keys: point and compressed
* @private
*/
@ -220,7 +220,7 @@ PublicKey.fromJSON = function(json) {
/**
* Internal function to transform a JSON into a public key point
*
* @param {Buffer} buf - a JSON string or plain object
* @param {String|Object} json - a JSON string or plain object
* @returns {Object} An object with keys: point and compressed
* @private
*/
@ -254,7 +254,7 @@ PublicKey.fromPrivateKey = function(privkey) {
/**
* Instantiate a PublicKey from a Buffer
* @param {Buffer} buf - A DER hex buffer
* @param {bool} [strict] - if set to false, will loosen some conditions
* @param {bool=} strict - if set to false, will loosen some conditions
* @returns {PublicKey} A new valid instance of PublicKey
*/
PublicKey.fromDER = PublicKey.fromBuffer = function(buf, strict) {
@ -285,7 +285,7 @@ PublicKey.fromPoint = function(point, compressed) {
* Instantiate a PublicKey from a DER hex encoded string
*
* @param {String} str - A DER hex string
* @param {String} [encoding] - The type of string encoding
* @param {String=} encoding - The type of string encoding
* @returns {PublicKey} A new valid instance of PublicKey
*/
PublicKey.fromString = function(str, encoding) {
@ -314,7 +314,6 @@ PublicKey.fromX = function(odd, x) {
* Check if there would be any errors when initializing a PublicKey
*
* @param {String} data - The encoded data in various formats
* @param {String} [compressed] - If the public key is compressed
* @returns {null|Error} An error if exists
*/
PublicKey.getValidationError = function(data) {
@ -332,7 +331,6 @@ PublicKey.getValidationError = function(data) {
* Check if the parameters are valid
*
* @param {String} data - The encoded data in various formats
* @param {String} [compressed] - If the public key is compressed
* @returns {Boolean} If the public key would be valid
*/
PublicKey.isValid = function(data) {
@ -350,6 +348,9 @@ PublicKey.prototype.toObject = function toObject() {
};
};
/**
* @returns {String} A JSON string of the PublicKey
*/
PublicKey.prototype.toJSON = function toJSON() {
return JSON.stringify(this.toObject());
};
@ -397,6 +398,7 @@ PublicKey.prototype._getID = function _getID() {
/**
* Will return an address for the public key
*
* @param {String|Network=} network - Which network should the address be for
* @returns {Address} An address generated from the public key
*/
PublicKey.prototype.toAddress = function(network) {