address/net documentation

This commit is contained in:
Kagami Hiiragi 2015-02-10 17:59:49 +03:00
parent 5ada61cbe1
commit 73a0dc4e56
6 changed files with 37 additions and 13 deletions

View File

@ -30,7 +30,7 @@ var popkey = require("./_util").popkey;
/**
* Create a new Bitmessage address object.
* @param {?Object} opts - Optional address options
* @param {?Object} opts - Address options
* @param {number} opts.version - Version number (4 by default)
* @param {number} opts.stream - Stream number (1 by default)
* @param {Object} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield} (`DOES_ACK` by default)
@ -248,12 +248,12 @@ Address.prototype.encode = function() {
/**
* Create a new Bitmessage address with random encryption and signing
* private keys.
* @param {?Object} opts - Optional address options
* @param {?Object} opts - Address options
* @param {number} opts.ripeLength - Required length of the short RIPEMD
* hash (19 by default)
* @param {number} opts.version - Version number
* @param {number} opts.stream - Stream number
* @param {Object} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield}
* @param {number} opts.version - Version number (4 by default)
* @param {number} opts.stream - Stream number (1 by default)
* @param {Object} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield} (`DOES_ACK` by default)
* @return {Address} New address object.
*/
Address.fromRandom = function(opts) {
@ -289,9 +289,9 @@ Address.fromRandom = function(opts) {
* @param {string} opts.passphrase - Passphrase to generate address from
* @param {?number} opts.ripeLength - Required length of the short
* RIPEMD hash (19 by default)
* @param {?number} opts.version - Version number
* @param {?number} opts.stream - Stream number
* @param {?Object} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield}
* @param {?number} opts.version - Version number (4 by default)
* @param {?number} opts.stream - Stream number (1 by default)
* @param {?Object} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield} (`DOES_ACK` by default)
* @return {Address} New address object.
*/
Address.fromPassphrase = function(opts) {

View File

@ -54,7 +54,7 @@ exports.ripemd160 = platform.ripemd160;
exports.randomBytes = platform.randomBytes;
/**
* Generate new random private key.
* Generate a new random private key.
* @return {Buffer} New private key.
*/
exports.getPrivate = function() {
@ -86,8 +86,8 @@ exports.sign = function(privateKey, msg) {
* @param {Buffer} publicKey - A 65-byte public key
* @param {Buffer} msg - The message being verified
* @param {Buffer} sig - The signature in DER format
* @return {Promise.<undefined>} A promise that resolves on correct
* signature and rejects on bad key or signature.
* @return {Promise.<null>} A promise that resolves on correct signature
* and rejects on bad key or signature.
*/
exports.verify = function(publicKey, msg, sig) {
var hash = sha1(msg);

View File

@ -18,7 +18,6 @@ var structs = require("../structs");
/**
* Base transport class. Allows to use single class for both client and
* server modes (as separate instances).
* @param {?Object} opts - Transport options
* @constructor
* @static
*/

View File

@ -24,6 +24,19 @@ var unmap = BaseTransport._unmap;
/**
* TCP transport class. Implements
* [base transport interface]{@link module:bitmessage/net/base.BaseTransport}.
* @param {?Object} opts - Transport options
* @param {Array} opts.seeds - Bootstrap nodes (none by default)
* @param {Array} opts.dnsSeeds - Bootstrap DNS nodes (none by default)
* @param {Object} opts.services -
* [Service features]{@link module:bitmessage/structs.ServicesBitfield}
* provided by this node (`NODE_NETWORK` by default)
* @param {(Array|string|Buffer)} opts.userAgent -
* [User agent]{@link module:bitmessage/user-agent} of this node
* (bitmessage's by default)
* @param {number[]} opts.streamNumbers - Streams accepted by this node
* (1 by default)
* @param {number} opts.port - Incoming port of this node (8444 by
* default)
* @constructor
* @static
*/

View File

@ -25,6 +25,18 @@ var unmap = BaseTransport._unmap;
/**
* WebSocket transport class. Implements
* [base transport interface]{@link module:bitmessage/net/base.BaseTransport}.
* @param {?Object} opts - Transport options
* @param {Array} opts.seeds - Bootstrap nodes (none by default)
* @param {Object} opts.services -
* [Service features]{@link module:bitmessage/structs.ServicesBitfield}
* provided by this node (`NODE_NETWORK` by default)
* @param {(Array|string|Buffer)} opts.userAgent -
* [User agent]{@link module:bitmessage/user-agent} of this node
* (bitmessage's by default)
* @param {number[]} opts.streamNumbers - Streams accepted by this node
* (1 by default)
* @param {number} opts.port - Incoming port of this node (8444 by
* default)
* @constructor
* @static
*/

View File

@ -57,7 +57,7 @@
"bn.js": "^1.0.0",
"bs58": "^2.0.0",
"buffer-equal": "~0.0.1",
"eccrypto": "^0.9.5",
"eccrypto": "^0.9.6",
"es6-promise": "^2.0.1",
"hash.js": "^1.0.2",
"inherits": "^2.0.1",