Publish docs

This commit is contained in:
Kagami Hiiragi 2015-02-12 13:44:15 +03:00
parent 7d4d2b8bd0
commit 034f611a98
49 changed files with 14263 additions and 2373 deletions

View File

@ -28,9 +28,22 @@
<article> <article>
<pre class="prettyprint source linenums"><code>/** <pre class="prettyprint source linenums"><code>/**
* Working with Bitmessage addresses. * Working with Bitmessage addresses.
* **NOTE**: `Address` is exported as a module.
* @example
* var Address = require("bitmessage").Address;
* // Or: var Address = require("bitmessage/address");
*
* // Generate a new random Bitmessage identity.
* var addr1 = Address.fromRandom();
* console.log("New random Bitmessage address:", addr1.encode());
*
* // Or create it from passphrase.
* var addr2 = Address.fromPassphrase("test");
* console.log("Deterministic Bitmessage address:", addr2.encode());
* @see {@link https://bitmessage.org/wiki/Address} * @see {@link https://bitmessage.org/wiki/Address}
* @module bitmessage/address * @module bitmessage/address
*/ */
// TODO(Kagami): Document getters/setters.
"use strict"; "use strict";
@ -45,7 +58,16 @@ var popkey = require("./_util").popkey;
/** /**
* Create a new Bitmessage address object. * Create a new Bitmessage address object.
* @param {?Object} opts - 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)
* @param {Buffer} opts.signPrivateKey - Signing private key
* @param {Buffer} opts.signPublicKey - Signing public key
* @param {Buffer} opts.encPrivateKey - Encryption private key
* @param {Buffer} opts.encPublicKey - Encryption public key
* @param {Buffer} opts.ripe - Keys RIPEMD hash
* @constructor * @constructor
* @static * @static
*/ */
@ -75,7 +97,7 @@ Address.prototype.clone = function() {
}; };
/** /**
* Test if given object is an Address instance. * Test if the given object is an Address instance.
* NOTE: Implementation is just simple `instanceof` but it improves * NOTE: Implementation is just simple `instanceof` but it improves
* readability and consistent with `isArray`, `isBuffer`, etc. * readability and consistent with `isArray`, `isBuffer`, etc.
* @param {Object} obj - Given object * @param {Object} obj - Given object
@ -126,8 +148,8 @@ function getaddrchecksum(data) {
} }
/** /**
* Get the ripe hash of the address without prefix zeroes. * Get the RIPEMD hash of the address keys without prefix nulls.
* @return {Buffer} A short ripe hash. * @return {Buffer} A short RIPEMD hash.
*/ */
Address.prototype.getShortRipe = function() { Address.prototype.getShortRipe = function() {
var ripe = this.ripe; var ripe = this.ripe;
@ -253,10 +275,15 @@ Address.prototype.encode = function() {
}; };
/** /**
* Create new Bitmessage address from random encryption and signing * Create a new Bitmessage address with random encryption and signing
* private keys. * private keys.
* @param {?Object} opts - Address options * @param {Object=} opts - Address options
* @return {Address} Generated address object. * @param {number} opts.ripeLength - Required length of the short RIPEMD
* hash (19 by default)
* @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) { Address.fromRandom = function(opts) {
opts = objectAssign({}, opts); opts = objectAssign({}, opts);
@ -286,9 +313,15 @@ Address.fromRandom = function(opts) {
}; };
/** /**
* Create new Bitmessage address from passphrase. * Create a new Bitmessage address from passphrase.
* @param {?Object} opts - Address options * @param {(string|Object)} opts - Passphrase or address options
* @return {Address} Generated address object. * @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 (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) { Address.fromPassphrase = function(opts) {
if (typeof opts === "string") { if (typeof opts === "string") {
@ -423,13 +456,13 @@ module.exports = Address;
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -38,7 +38,7 @@ var eccrypto = require("eccrypto");
var assert = require("./_util").assert; var assert = require("./_util").assert;
var platform = require("./platform"); var platform = require("./platform");
var promise = platform.promise; var PPromise = platform.Promise;
/** /**
* Calculate SHA-1 hash. * Calculate SHA-1 hash.
@ -82,7 +82,7 @@ exports.ripemd160 = platform.ripemd160;
exports.randomBytes = platform.randomBytes; exports.randomBytes = platform.randomBytes;
/** /**
* Generate new random private key. * Generate a new random private key.
* @return {Buffer} New private key. * @return {Buffer} New private key.
*/ */
exports.getPrivate = function() { exports.getPrivate = function() {
@ -114,8 +114,8 @@ exports.sign = function(privateKey, msg) {
* @param {Buffer} publicKey - A 65-byte public key * @param {Buffer} publicKey - A 65-byte public key
* @param {Buffer} msg - The message being verified * @param {Buffer} msg - The message being verified
* @param {Buffer} sig - The signature in DER format * @param {Buffer} sig - The signature in DER format
* @return {Promise.&lt;undefined>} A promise that resolves on correct * @return {Promise.&lt;null>} A promise that resolves on correct signature
* signature and rejects on bad key or signature. * and rejects on bad key or signature.
*/ */
exports.verify = function(publicKey, msg, sig) { exports.verify = function(publicKey, msg, sig) {
var hash = sha1(msg); var hash = sha1(msg);
@ -174,15 +174,14 @@ var encrypted = exports.encrypted = {
* Encrypt message for given recepient's public key. * Encrypt message for given recepient's public key.
* @param {Buffer} publicKeyTo - Recipient's public key (65 bytes) * @param {Buffer} publicKeyTo - Recipient's public key (65 bytes)
* @param {Buffer} msg - The message being encrypted * @param {Buffer} msg - The message being encrypted
* @param {?{?iv: Buffer, ?ephemPrivateKey: Buffer}} opts - You may also * @param {Object=} opts - You may also specify initialization vector
* specify initialization vector (16 bytes) and ephemeral private key * and ephemeral private key to get deterministic results
* (32 bytes) to get deterministic results. * @param {Buffer} opts.iv - Initialization vector (16 bytes)
* @return {Promise.&lt;Buffer>} - A promise that resolves with the buffer * @param {Buffer} opts.ephemPrivateKey - Ephemeral private key (32
* in `encrypted` format successful encryption and rejects on failure. * bytes)
* @return {Promise.&lt;Buffer>} A promise that resolves with the buffer in
* `encrypted` format successful encryption and rejects on failure.
*/ */
// TODO(Kagami): Properly document `opts`. Documenting multiple
// function arguments with options object at the end for now gives
// strange results (probably a bug in jsdoc).
exports.encrypt = function(publicKeyTo, msg, opts) { exports.encrypt = function(publicKeyTo, msg, opts) {
return eccrypto.encrypt(publicKeyTo, msg, opts).then(function(encObj) { return eccrypto.encrypt(publicKeyTo, msg, opts).then(function(encObj) {
return encrypted.encode(encObj); return encrypted.encode(encObj);
@ -194,11 +193,11 @@ exports.encrypt = function(publicKeyTo, msg, opts) {
* @param {Buffer} privateKey - A 32-byte private key of recepient of * @param {Buffer} privateKey - A 32-byte private key of recepient of
* the mesage * the mesage
* @param {Buffer} buf - Encrypted data * @param {Buffer} buf - Encrypted data
* @return {Promise.&lt;Buffer>} - A promise that resolves with the * @return {Promise.&lt;Buffer>} A promise that resolves with the plaintext
* plaintext on successful decryption and rejects on failure. * on successful decryption and rejects on failure.
*/ */
exports.decrypt = function(privateKey, buf) { exports.decrypt = function(privateKey, buf) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var encObj = encrypted.decode(buf); var encObj = encrypted.decode(buf);
resolve(eccrypto.decrypt(privateKey, encObj)); resolve(eccrypto.decrypt(privateKey, encObj));
}); });
@ -213,13 +212,13 @@ exports.decrypt = function(privateKey, buf) {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -52,19 +52,16 @@
<li><a href="https://bitmessage.org/wiki/Protocol_specification">Protocol specification</a></li> <li><a href="https://bitmessage.org/wiki/Protocol_specification">Protocol specification</a></li>
<li><a href="https://bitmessage.org/bitmessage.pdf">Whitepaper</a></li> <li><a href="https://bitmessage.org/bitmessage.pdf">Whitepaper</a></li>
</ul> </ul>
<h2>Feature matrix (both Browser and Node)</h2><ul> <h2>Feature matrix</h2><ul>
<li>[x] Crypto<ul> <li>[x] Crypto<ul>
<li>[x] SHA-1</li> <li>[x] SHA-1</li>
<li>[x] SHA-256</li> <li>[x] SHA-256</li>
<li>[x] SHA-512</li> <li>[x] SHA-512</li>
<li>[x] RIPEMD-160</li> <li>[x] RIPEMD-160</li>
<li>[x] PRNG</li> <li>[x] PRNG</li>
<li>[x] ECC keys manipulation</li> <li>[x] ECC keys handling</li>
<li>[x] ECDSA</li> <li>[x] ECDSA</li>
<li>[x] ECDH</li>
<li>[x] ECIES</li> <li>[x] ECIES</li>
<li>[x] AES-256-CBC</li>
<li>[x] HMAC-SHA-256</li>
</ul> </ul>
</li> </li>
<li>[x] Common structures<ul> <li>[x] Common structures<ul>
@ -82,7 +79,6 @@
</li> </li>
<li>[x] Message types<ul> <li>[x] Message types<ul>
<li>[x] version</li> <li>[x] version</li>
<li>[x] verack</li>
<li>[x] addr</li> <li>[x] addr</li>
<li>[x] inv</li> <li>[x] inv</li>
<li>[x] getdata</li> <li>[x] getdata</li>
@ -103,18 +99,19 @@
<li>[x] UserAgent</li> <li>[x] UserAgent</li>
</ul> </ul>
</li> </li>
<li>[ ] Parse PyBitmessage configs<ul> <li>[ ] Network transports<ul>
<li>[x] TCP (Node.js only)</li>
<li>[x] WebSocket</li>
<li>[ ] WebRTC</li>
</ul>
</li>
<li>[ ] PyBitmessage configs parsing<ul>
<li>[ ] keys.dat</li> <li>[ ] keys.dat</li>
<li>[ ] knownnodes.dat</li> <li>[ ] knownnodes.dat</li>
<li>[ ] messages.dat</li> <li>[ ] messages.dat</li>
</ul> </ul>
</li> </li>
</ul> </ul>
<h2>Network feature matrix (Node.js only)</h2><ul>
<li>[ ] Bootstrap</li>
<li>[ ] Connect to the network</li>
<li>[ ] Accept connections</li>
</ul>
<h2>Usage</h2><h3>Address</h3><pre class="prettyprint source lang-js"><code>var Address = require(&quot;bitmessage&quot;).Address; <h2>Usage</h2><h3>Address</h3><pre class="prettyprint source lang-js"><code>var Address = require(&quot;bitmessage&quot;).Address;
// Generate a new random Bitmessage identity. // Generate a new random Bitmessage identity.
@ -123,8 +120,73 @@ console.log(&quot;New random Bitmessage address:&quot;, addr1.encode());
// Or create it from passphrase. // Or create it from passphrase.
var addr2 = Address.fromPassphrase(&quot;test&quot;); var addr2 = Address.fromPassphrase(&quot;test&quot;);
console.log(&quot;Deterministic Bitmessage address:&quot;, addr2.encode());</code></pre><h2>License</h2><p>bitmessage - JavaScript Bitmessage library</p> console.log(&quot;Deterministic Bitmessage address:&quot;, addr2.encode());</code></pre><h3>Structures</h3><pre class="prettyprint source lang-js"><code>var structs = require(&quot;bitmessage&quot;).structs;
<p>Written in 2014 by Kagami Hiiragi <a href="&#109;&#x61;&#x69;&#108;&#116;&#x6f;&#x3a;&#107;&#x61;&#x67;&#x61;&#109;&#x69;&#64;&#x67;&#x65;&#110;&#115;&#104;&#105;&#x6b;&#x65;&#110;&#46;&#111;&#x72;&#x67;">&#107;&#x61;&#x67;&#x61;&#109;&#x69;&#64;&#x67;&#x65;&#110;&#115;&#104;&#105;&#x6b;&#x65;&#110;&#46;&#111;&#x72;&#x67;</a></p>
var encoded = Buffer.concat([
structs.var_int.encode(4),
Buffer(&quot;test&quot;),
structs.var_str.encode(&quot;test2&quot;),
structs.var_int_list.encode([1, 2, 3]),
]);
var decoded1 = structs.var_str.decode(encoded);
console.log(decoded1.str); // test
var decoded2 = structs.var_str.decode(decoded1.rest);
console.log(decoded2.str); // test2
var decoded3 = structs.var_int.decode(decoded2.rest);
console.log(decoded3.value); // 3
var decoded4 = structs.var_int_list.decode(decoded2.rest);
console.log(decoded4.list); // [1, 2, 3]</code></pre><h3>Messages</h3><pre class="prettyprint source lang-js"><code>var structs = require(&quot;bitmessage&quot;).structs;
var messages = require(&quot;bitmessage&quot;).messages;
// Simple encoding and decoding:
var vermsg = messages.version.encode({
nonce: Buffer(8), // Hack detection connection to self
remoteHost: &quot;1.1.1.1&quot;,
remotePort: 8444,
});
console.log(messages.version.decode(vermsg).remoteHost); // 1.1.1.1
// Low-level encoding and decoding:
var addrPayload = messages.addr.encodePayload([
{host: &quot;2.2.2.2&quot;, port: 28444},
]);
var addrmsg = structs.message.encode(&quot;addr&quot;, addrPayload);
var decoded = structs.message.decode(addrmsg);
console.log(decoded.command); // addr
var payload = decoded.payload;
var decodedPayload = messages.addr.decodePayload(payload);
console.log(decodedPayload.addrs[0].host); // 2.2.2.2
// Encode with empty payload:
var verackmsg = structs.message.encode(&quot;verack&quot;);
console.log(structs.message.decode(verackmsg).command); // verack</code></pre><h3>Network</h3><pre class="prettyprint source lang-js"><code>var messages = require(&quot;bitmessage&quot;).messages;
var TcpTransport = require(&quot;bitmessage/net/tcp&quot;);
var tcp = new TcpTransport({
dnsSeeds: [[&quot;bootstrap8444.bitmessage.org&quot;, 8444]],
});
tcp.bootstrap().then(function(nodes) {
var remoteHost = nodes[0][0];
var remotePort = nodes[0][1];
console.log(&quot;Connecting to&quot;, nodes[0]);
tcp.connect(remotePort, remoteHost);
});
tcp.on(&quot;established&quot;, function() {
console.log(&quot;Connection established&quot;);
tcp.on(&quot;message&quot;, function(command, payload) {
console.log(&quot;Got new&quot;, command, &quot;message&quot;);
var decoded;
if (command === &quot;addr&quot;) {
decoded = messages.addr.decodePayload(payload);
console.log(&quot;Got&quot;, decoded.addrs.length, &quot;node addresses&quot;);
}
});
});</code></pre><h2>License</h2><p>bitmessage - JavaScript Bitmessage library</p>
<p>Written in 2014-2015 by Kagami Hiiragi <a href="&#109;&#97;&#105;&#x6c;&#116;&#x6f;&#58;&#107;&#x61;&#x67;&#97;&#x6d;&#105;&#x40;&#103;&#x65;&#110;&#x73;&#x68;&#105;&#107;&#101;&#x6e;&#46;&#x6f;&#x72;&#x67;">&#107;&#x61;&#x67;&#97;&#x6d;&#105;&#x40;&#103;&#x65;&#110;&#x73;&#x68;&#105;&#107;&#101;&#x6e;&#46;&#x6f;&#x72;&#x67;</a></p>
<p>To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.</p> <p>To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.</p>
<p>You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.</p></article> <p>You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.</p></article>
</section> </section>
@ -137,13 +199,13 @@ console.log(&quot;Deterministic Bitmessage address:&quot;, addr2.encode());</cod
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -65,13 +65,13 @@ exports.UserAgent = require("./user-agent");
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -32,14 +32,41 @@
* @see {@link https://bitmessage.org/wiki/Protocol_specification_v3#Message_types} * @see {@link https://bitmessage.org/wiki/Protocol_specification_v3#Message_types}
* @see {@link https://bitmessage.org/Bitmessage%20Technical%20Paper.pdf} * @see {@link https://bitmessage.org/Bitmessage%20Technical%20Paper.pdf}
* @module bitmessage/messages * @module bitmessage/messages
* @example
* var structs = require("bitmessage").structs;
* var messages = require("bitmessage").messages;
*
* // Simple encoding and decoding:
* var vermsg = messages.version.encode({
* nonce: Buffer(8), // Hack detection connection to self
* remoteHost: "1.1.1.1",
* remotePort: 8444,
* });
* console.log(messages.version.decode(vermsg).remoteHost); // 1.1.1.1
*
* // Low-level encoding and decoding:
* var addrPayload = messages.addr.encodePayload([
* {host: "2.2.2.2", port: 28444},
* ]);
* var addrmsg = structs.message.encode("addr", addrPayload);
* var decoded = structs.message.decode(addrmsg);
* console.log(decoded.command); // addr
* var payload = decoded.payload;
* var decodedPayload = messages.addr.decodePayload(payload);
* console.log(decodedPayload.addrs[0].host); // 2.2.2.2
*
* // Encode with empty payload:
* var verackmsg = structs.message.encode("verack");
* console.log(structs.message.decode(verackmsg).command); // verack
*/ */
// TODO(Kagami): Document object-like params.
"use strict"; "use strict";
var objectAssign = Object.assign || require("object-assign"); var objectAssign = Object.assign || require("object-assign");
var bufferEqual = require("buffer-equal");
var assert = require("./_util").assert; var assert = require("./_util").assert;
var structs = require("./structs"); var structs = require("./structs");
var bmcrypto = require("./crypto");
var UserAgent = require("./user-agent"); var UserAgent = require("./user-agent");
var util = require("./_util"); var util = require("./_util");
@ -51,8 +78,7 @@ var ServicesBitfield = structs.ServicesBitfield;
* Note that this function doesn't do any validation because it is * Note that this function doesn't do any validation because it is
* already provided by * already provided by
* [message.decode]{@link module:bitmessage/structs.message.decode} * [message.decode]{@link module:bitmessage/structs.message.decode}
* routine. Normally you call this for each incoming message and then * routine.
* call decode function of the appropriate message handler.
* @param {Buffer} buf - Buffer that starts with encoded message * @param {Buffer} buf - Buffer that starts with encoded message
* @return {?string} Message's command if any. * @return {?string} Message's command if any.
*/ */
@ -71,24 +97,45 @@ exports.getCommand = function(buf) {
return command.slice(0, firstNonNull).toString("ascii"); return command.slice(0, firstNonNull).toString("ascii");
}; };
// Random nonce used to detect connections to self.
var randomNonce = bmcrypto.randomBytes(8);
/** /**
* `version` message. * `version` message.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#version} * @see {@link https://bitmessage.org/wiki/Protocol_specification#version}
* @namespace * @namespace
* @static * @static
*/ */
// TODO(Kagami): User agent and stream numbers size limits per
// &lt;https://github.com/Bitmessage/PyBitmessage/issues/767>.
var version = exports.version = { var version = exports.version = {
/** /**
* Random nonce used to detect connections to self. * @typedef {Object} DecodeResult
* @const {Buffer} * @property {Object} services -
* [Service]{@link module:bitmessage/structs.ServicesBitfield}
* features to be enabled for this connection
* @property {Date} time - Node time
* @property {string} remoteHost - IPv4/IPv6 address of the node
* receiving this message
* @property {number} remotePort - Port of the node receiving this
* message
* @property {number} port - Incoming port of the node sending this
* message
* @property {Buffer} nonce - Random nonce used to detect connection
* to self
* @property {(Array|string|Buffer)} userAgent -
* [User agent]{@link module:bitmessage/user-agent} of the node
* @property {number[]} streamNumbers - Streams accepted by the node
* @property {number} length - Real data length
* @memberof module:bitmessage/messages.version
*/ */
NONCE: new Buffer("20bde0a3355dad78", "hex"),
/** /**
* Decode `version` message. * Decode `version` message.
* NOTE: `nonce` is copied. * NOTE: `nonce` is copied.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @return {Object} Decoded `version` structure. * @return {DecodeResult}
* [Decoded `version` structure.]{@link module:bitmessage/messages.version.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
@ -98,9 +145,7 @@ var version = exports.version = {
/** /**
* Decode `version` message payload. * Decode `version` message payload.
* NOTE: `nonce` is copied. * The same as [decode]{@link module:bitmessage/messages.version.decode}.
* @param {Buffer} buf - Message payload
* @return {Object} Decoded `version` structure.
*/ */
decodePayload: function(buf) { decodePayload: function(buf) {
// 4 + 8 + 8 + 26 + 26 + 8 + (1+) + (1+) // 4 + 8 + 8 + 26 + 26 + 8 + (1+) + (1+)
@ -113,6 +158,7 @@ var version = exports.version = {
var addrFrom = structs.net_addr.decode(buf.slice(46, 72), short); var addrFrom = structs.net_addr.decode(buf.slice(46, 72), short);
var nonce = new Buffer(8); var nonce = new Buffer(8);
buf.copy(nonce, 0, 72, 80); buf.copy(nonce, 0, 72, 80);
assert(!bufferEqual(nonce, randomNonce), "Connection to self");
var decodedUa = UserAgent.decode(buf.slice(80)); var decodedUa = UserAgent.decode(buf.slice(80));
var decodedStreamNumbers = structs.var_int_list.decode(decodedUa.rest); var decodedStreamNumbers = structs.var_int_list.decode(decodedUa.rest);
return { return {
@ -136,6 +182,24 @@ var version = exports.version = {
/** /**
* Encode `version` message. * Encode `version` message.
* @param {Object} opts - Version options * @param {Object} opts - Version options
* @param {Object=} opts.services -
* [Service]{@link module:bitmessage/structs.ServicesBitfield}
* features to be enabled for this connection (`NODE_NETWORK` by
* default)
* @param {Date=} opts.time - Node time (current time by default)
* @param {string} opts.remoteHost - IPv4/IPv6 address of the node
* receiving this message
* @param {number} opts.remotePort - Port of the node receiving this
* message
* @param {number=} opts.port - Incoming port of the node (8444 by
* default)
* @param {Buffer=} opts.nonce - Random nonce used to detect connection
* to self (unique per node.js process by default)
* @param {(Array|string|Buffer)=} opts.userAgent -
* [User agent]{@link module:bitmessage/user-agent} of the node
* (bitmessage's by default)
* @param {Array&lt;number>=} opts.streamNumbers - Streams accepted by the
* node (1 by default)
* @return {Buffer} Encoded message. * @return {Buffer} Encoded message.
*/ */
encode: function(opts) { encode: function(opts) {
@ -145,16 +209,16 @@ var version = exports.version = {
/** /**
* Encode `version` message payload. * Encode `version` message payload.
* @param {Object} opts - Version options * The same as [encode]{@link module:bitmessage/messages.version.encode}.
* @return {Buffer} Encoded payload.
*/ */
encodePayload: function(opts) { encodePayload: function(opts) {
// Deal with default options. // Deal with default options.
var services = opts.services || var services = opts.services ||
ServicesBitfield().set(ServicesBitfield.NODE_NETWORK); ServicesBitfield().set(ServicesBitfield.NODE_NETWORK);
var time = opts.time || new Date(); var time = opts.time || new Date();
var nonce = opts.nonce || version.NONCE; var nonce = opts.nonce || randomNonce;
assert(nonce.length === 8, "Bad nonce"); assert(nonce.length === 8, "Bad nonce");
var port = opts.port || 8444;
var userAgent = opts.userAgent || UserAgent.SELF; var userAgent = opts.userAgent || UserAgent.SELF;
var streamNumbers = opts.streamNumbers || [1]; var streamNumbers = opts.streamNumbers || [1];
// Start encoding. // Start encoding.
@ -169,7 +233,7 @@ var version = exports.version = {
var addrFrom = structs.net_addr.encode({ var addrFrom = structs.net_addr.encode({
services: services, services: services,
host: "127.0.0.1", host: "127.0.0.1",
port: opts.port, port: port,
short: true, short: true,
}); });
return Buffer.concat([ return Buffer.concat([
@ -192,10 +256,19 @@ var version = exports.version = {
* @static * @static
*/ */
var addr = exports.addr = { var addr = exports.addr = {
/**
* @typedef {Object} DecodeResult
* @property {Object[]} addrs - List of
* [decoded `net_addr` structures]{@link module:bitmessage/structs.net_addr.DecodeResult}
* @property {number} length - Real data length
* @memberof module:bitmessage/messages.addr
*/
/** /**
* Decode `addr` message. * Decode `addr` message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @return {Object} Decoded `addr` structure. * @return {DecodeResult}
* [Decoded `addr` structure.]{@link module:bitmessage/messages.addr.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
@ -205,8 +278,7 @@ var addr = exports.addr = {
/** /**
* Decode `addr` message payload. * Decode `addr` message payload.
* @param {Buffer} buf - Message payload * The same as [decode]{@link module:bitmessage/messages.addr.decode}.
* @return {Object} Decoded `addr` structure.
*/ */
decodePayload: function(buf) { decodePayload: function(buf) {
var decoded = structs.var_int.decode(buf); var decoded = structs.var_int.decode(buf);
@ -228,7 +300,8 @@ var addr = exports.addr = {
/** /**
* Encode `addr` message. * Encode `addr` message.
* @param {Object[]} addrs - Network addresses * @param {Object[]} addrs - List of
* [net_addr encode options]{@link module:bitmessage/structs.net_addr.encode}
* @return {Buffer} Encoded message. * @return {Buffer} Encoded message.
*/ */
encode: function(addrs) { encode: function(addrs) {
@ -238,13 +311,13 @@ var addr = exports.addr = {
/** /**
* Encode `addr` message payload. * Encode `addr` message payload.
* @param {Object[]} addrs - Network addresses * The same as [encode]{@link module:bitmessage/messages.addr.encode}.
* @return {Buffer} Encoded payload.
*/ */
encodePayload: function(addrs) { encodePayload: function(addrs) {
assert(addrs.length &lt;= 1000, "Too many address entires"); assert(addrs.length &lt;= 1000, "Too many address entires");
var addrsBuf = Buffer.concat(addrs.map(structs.net_addr.encode)); var addrBufs = addrs.map(structs.net_addr.encode);
return Buffer.concat([structs.var_int.encode(addrs.length), addrsBuf]); var bufs = [structs.var_int.encode(addrs.length)].concat(addrBufs);
return Buffer.concat(bufs);
}, },
}; };
@ -256,10 +329,19 @@ var addr = exports.addr = {
* @static * @static
*/ */
var inv = exports.inv = { var inv = exports.inv = {
/**
* @typedef {Object} DecodeResult
* @property {Buffer[]} inventory - List of
* [inventory vectors]{@link module:bitmessage/structs.inv_vect}
* @property {number} length - Real data length
* @memberof module:bitmessage/messages.inv
*/
/** /**
* Decode `inv` message. * Decode `inv` message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @return {Object} Decoded `inv` structure. * @return {DecodeResult}
* [Decoded `inv` structure.]{@link module:bitmessage/messages.inv.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
@ -269,8 +351,7 @@ var inv = exports.inv = {
/** /**
* Decode `inv` message payload. * Decode `inv` message payload.
* @param {Buffer} buf - Message payload * The same as [decode]{@link module:bitmessage/messages.inv.decode}.
* @return {Object} Decoded `inv` structure.
*/ */
decodePayload: function(buf) { decodePayload: function(buf) {
var decoded = structs.var_int.decode(buf); var decoded = structs.var_int.decode(buf);
@ -292,7 +373,8 @@ var inv = exports.inv = {
/** /**
* Encode `inv` message. * Encode `inv` message.
* @param {Buffer[]} inventory - Inventory vector list * @param {Buffer[]} inventory -
* [Inventory vector]{@link module:bitmessage/structs.inv_vect} list
* @return {Buffer} Encoded message. * @return {Buffer} Encoded message.
*/ */
encode: function(inventory) { encode: function(inventory) {
@ -302,13 +384,13 @@ var inv = exports.inv = {
/** /**
* Encode `inv` message payload. * Encode `inv` message payload.
* @param {Buffer[]} inventory - Inventory vector list * The same as [encode]{@link module:bitmessage/messages.inv.encode}.
* @return {Buffer} Encoded payload.
*/ */
encodePayload: function(inventory) { encodePayload: function(inventory) {
assert(inventory.length &lt;= 50000, "Too many inventory entires"); assert(inventory.length &lt;= 50000, "Too many inventory entires");
var invBuf = Buffer.concat(inventory); // TODO(Kagami): Validate vectors length.
return Buffer.concat([structs.var_int.encode(inventory.length), invBuf]); var bufs = [structs.var_int.encode(inventory.length)].concat(inventory);
return Buffer.concat(bufs);
}, },
}; };
@ -320,10 +402,19 @@ var inv = exports.inv = {
* @namespace * @namespace
*/ */
exports.getdata = objectAssign({}, inv, { exports.getdata = objectAssign({}, inv, {
/**
* @typedef {Object} DecodeResult
* @property {Buffer[]} inventory - List of
* [inventory vectors]{@link module:bitmessage/structs.inv_vect}
* @property {number} length - Real data length
* @memberof module:bitmessage/messages.getdata
*/
/** /**
* Decode `getdata` message. * Decode `getdata` message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @return {Object} Decoded `getdata` structure. * @return {DecodeResult}
* [Decoded `getdata` structure.]{@link module:bitmessage/messages.getdata.DecodeResult}
* @memberof module:bitmessage/messages.getdata * @memberof module:bitmessage/messages.getdata
*/ */
decode: function(buf) { decode: function(buf) {
@ -331,9 +422,18 @@ exports.getdata = objectAssign({}, inv, {
assert(decoded.command === "getdata", "Bad command"); assert(decoded.command === "getdata", "Bad command");
return inv.decodePayload(decoded.payload); return inv.decodePayload(decoded.payload);
}, },
/**
* Decode `getdata` message payload.
* The same as [decode]{@link module:bitmessage/messages.getdata.decode}.
* @function decodePayload
* @memberof module:bitmessage/messages.getdata
*/
/** /**
* Encode `getdata` message. * Encode `getdata` message.
* @param {Buffer[]} inventory - Inventory vector list * @param {Buffer[]} inventory -
* [Inventory vector]{@link module:bitmessage/structs.inv_vect} list
* @return {Buffer} Encoded message. * @return {Buffer} Encoded message.
* @memberof module:bitmessage/messages.getdata * @memberof module:bitmessage/messages.getdata
*/ */
@ -341,17 +441,10 @@ exports.getdata = objectAssign({}, inv, {
var payload = inv.encodePayload(inventory); var payload = inv.encodePayload(inventory);
return message.encode("getdata", payload); return message.encode("getdata", payload);
}, },
/**
* Decode `getdata` message payload.
* @param {Buffer} buf - Message payload
* @return {Object} Decoded `inv` structure.
* @function decodePayload
* @memberof module:bitmessage/messages.getdata
*/
/** /**
* Encode `getdata` message payload. * Encode `getdata` message payload.
* @param {Buffer[]} inventory - Inventory vector list * The same as [encode]{@link module:bitmessage/messages.getdata.encode}.
* @return {Buffer} Encoded payload.
* @function encodePayload * @function encodePayload
* @memberof module:bitmessage/messages.getdata * @memberof module:bitmessage/messages.getdata
*/ */
@ -383,10 +476,24 @@ var error = exports.error = {
*/ */
FATAL: 2, FATAL: 2,
/**
* @typedef {Object} DecodeResult
* @property {number} fatal - Type of the error
* @property {number} banTime - The other node informs that it will
* not accept further connections for this number of seconds
* @property {?Buffer} vector -
* [Inventory vector]{@link module:bitmessage/structs.inv_vect}
* related to the error
* @property {string} errorText - A human-readable error description
* @property {number} length - Real data length
* @memberof module:bitmessage/messages.error
*/
/** /**
* Decode `error` message. * Decode `error` message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @return {Object} Decoded `error` structure. * @return {DecodeResult}
* [Decoded `error` structure.]{@link module:bitmessage/messages.error.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
@ -396,25 +503,37 @@ var error = exports.error = {
/** /**
* Decode `error` message payload. * Decode `error` message payload.
* @param {Buffer} buf - Message payload * The same as [decode]{@link module:bitmessage/messages.error.decode}.
* @return {Object} Decoded `error` structure.
*/ */
decodePayload: function(buf) { decodePayload: function(buf) {
assert(buf.length >= 4, "Buffer is too small"); assert(buf.length >= 4, "Buffer is too small");
var decodedFatal = structs.var_int.decode(buf); var decodedFatal = structs.var_int.decode(buf);
var decodedBanTime = structs.var_int.decode(decodedFatal.rest); var decodedBanTime = structs.var_int.decode(decodedFatal.rest);
var decodedVector = structs.var_str.decode(decodedBanTime.rest);
var decodedErrorText = structs.var_str.decode(decodedVector.rest); var decodedVectorLength = structs.var_int.decode(decodedBanTime.rest);
// NOTE(Kagami): Inventory vector should be only 32-byte in size but
// currently we don't ensure it.
var vectorLength = decodedVectorLength.value;
var rest = decodedVectorLength.rest;
assert(rest.length >= vectorLength, "Buffer is too small");
var vector = null;
if (vectorLength) {
vector = new Buffer(vectorLength);
rest.copy(vector);
rest = rest.slice(vectorLength);
}
var decodedErrorText = structs.var_str.decode(rest);
var length = ( var length = (
decodedFatal.length + decodedFatal.length +
decodedBanTime.length + decodedBanTime.length +
decodedVector.length + decodedVectorLength.length + vectorLength +
decodedErrorText.length decodedErrorText.length
); );
return { return {
fatal: decodedFatal.value, fatal: decodedFatal.value,
banTime: decodedBanTime.value, banTime: decodedBanTime.value,
vector: decodedVector.str, vector: vector,
errorText: decodedErrorText.str, errorText: decodedErrorText.str,
// Real data length. // Real data length.
length: length, length: length,
@ -424,6 +543,16 @@ var error = exports.error = {
/** /**
* Encode `error` message. * Encode `error` message.
* @param {Object} opts - Error options * @param {Object} opts - Error options
* @param {number=} opts.fatal - Type of the error
* ([warning]{@link module:bitmessage/messages.error.WARNING} by
* default)
* @param {number=} opts.banTime - Inform the other node, that you
* will not accept further connections for this number of seconds (0
* by default)
* @param {Buffer=} opts.vector - A 32-byte
* [inventory vector]{@link module:bitmessage/structs.inv_vect}
* related to the error (empty by default)
* @param {string} opts.errorText - A human-readable error description
* @return {Buffer} Encoded message. * @return {Buffer} Encoded message.
*/ */
encode: function(opts) { encode: function(opts) {
@ -433,19 +562,19 @@ var error = exports.error = {
/** /**
* Encode `error` message payload. * Encode `error` message payload.
* @param {Object} opts - Error options * The same as [encode]{@link module:bitmessage/messages.error.encode}.
* @return {Buffer} Encoded payload.
*/ */
encodePayload: function(opts) { encodePayload: function(opts) {
var fatal = opts.fatal || error.WARNING; var fatal = opts.fatal || error.WARNING;
var banTime = opts.banTime || 0; var banTime = opts.banTime || 0;
var vector = opts.vector || ""; // TODO(Kagami): Validate vector length.
var errorText = opts.errorText || ""; var vector = opts.vector || new Buffer(0);
return Buffer.concat([ return Buffer.concat([
structs.var_int.encode(fatal), structs.var_int.encode(fatal),
structs.var_int.encode(banTime), structs.var_int.encode(banTime),
structs.var_str.encode(vector), structs.var_int.encode(vector.length),
structs.var_str.encode(errorText), vector,
structs.var_str.encode(opts.errorText),
]); ]);
}, },
}; };
@ -459,13 +588,13 @@ var error = exports.error = {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -654,13 +654,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -44,7 +44,7 @@
<h4 class="name" id="Address"><span class="type-signature"></span>new Address<span class="signature">(opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"></span></h4> <h4 class="name" id="Address"><span class="type-signature"></span>new Address<span class="signature">(opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
@ -104,9 +104,9 @@
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -115,7 +115,217 @@
<td class="description last"><p>Address options</p></td> <td class="description last"><p>Address options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Version number (4 by default)</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Stream number (1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>behavior</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.PubkeyBitfield.html">Pubkey features</a> (<code>DOES_ACK</code> by default)</p></td>
</tr>
<tr>
<td class="name"><code>signPrivateKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Signing private key</p></td>
</tr>
<tr>
<td class="name"><code>signPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Signing public key</p></td>
</tr>
<tr>
<td class="name"><code>encPrivateKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Encryption private key</p></td>
</tr>
<tr>
<td class="name"><code>encPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Encryption public key</p></td>
</tr>
<tr>
<td class="name"><code>ripe</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Keys RIPEMD hash</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -156,7 +366,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line24">line 24</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line46">line 46</a>
</li></ul></dd> </li></ul></dd>
@ -305,7 +515,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line65">line 65</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line87">line 87</a>
</li></ul></dd> </li></ul></dd>
@ -358,14 +568,14 @@
<h4 class="name" id=".fromPassphrase"><span class="type-signature">(static) </span>fromPassphrase<span class="signature">(opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Address}</span></h4> <h4 class="name" id=".fromPassphrase"><span class="type-signature">(static) </span>fromPassphrase<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Address}</span></h4>
<div class="description"> <div class="description">
<p>Create new Bitmessage address from passphrase.</p> <p>Create a new Bitmessage address from passphrase.</p>
</div> </div>
@ -389,6 +599,51 @@
<th>Type</th> <th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Passphrase or address options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th> <th>Attributes</th>
@ -403,7 +658,138 @@
<tr> <tr>
<td class="name"><code>opts</code></td> <td class="name"><code>passphrase</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Passphrase to generate address from</p></td>
</tr>
<tr>
<td class="name"><code>ripeLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Required length of the short
RIPEMD hash (19 by default)</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Version number (4 by default)</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Stream number (1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>behavior</code></td>
<td class="type"> <td class="type">
@ -418,9 +804,9 @@
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -429,7 +815,14 @@
<td class="description last"><p>Address options</p></td> <td class="description last"><p><a href="module-bitmessage_structs.PubkeyBitfield.html">Pubkey features</a> (<code>DOES_ACK</code> by default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -470,7 +863,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line265">line 265</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line298">line 298</a>
</li></ul></dd> </li></ul></dd>
@ -497,7 +890,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Generated address object.</p> <p>New address object.</p>
</div> </div>
@ -523,14 +916,14 @@
<h4 class="name" id=".fromRandom"><span class="type-signature">(static) </span>fromRandom<span class="signature">(opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Address}</span></h4> <h4 class="name" id=".fromRandom"><span class="type-signature">(static) </span>fromRandom<span class="signature">(opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Address}</span></h4>
<div class="description"> <div class="description">
<p>Create new Bitmessage address from random encryption and signing <p>Create a new Bitmessage address with random encryption and signing
private keys.</p> private keys.</p>
</div> </div>
@ -584,9 +977,9 @@ private keys.</p>
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -595,7 +988,126 @@ private keys.</p>
<td class="description last"><p>Address options</p></td> <td class="description last"><p>Address options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ripeLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Required length of the short RIPEMD
hash (19 by default)</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Version number (4 by default)</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Stream number (1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>behavior</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.PubkeyBitfield.html">Pubkey features</a> (<code>DOES_ACK</code> by default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -636,7 +1148,7 @@ private keys.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line233">line 233</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line260">line 260</a>
</li></ul></dd> </li></ul></dd>
@ -663,7 +1175,7 @@ private keys.</p>
<div class="param-desc"> <div class="param-desc">
<p>Generated address object.</p> <p>New address object.</p>
</div> </div>
@ -696,7 +1208,7 @@ private keys.</p>
<div class="description"> <div class="description">
<p>Test if given object is an Address instance.<br>NOTE: Implementation is just simple <code>instanceof</code> but it improves <p>Test if the given object is an Address instance.<br>NOTE: Implementation is just simple <code>instanceof</code> but it improves
readability and consistent with <code>isArray</code>, <code>isBuffer</code>, etc.</p> readability and consistent with <code>isArray</code>, <code>isBuffer</code>, etc.</p>
</div> </div>
@ -790,7 +1302,7 @@ readability and consistent with <code>isArray</code>, <code>isBuffer</code>, etc
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line56">line 56</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line78">line 78</a>
</li></ul></dd> </li></ul></dd>
@ -890,7 +1402,7 @@ readability and consistent with <code>isArray</code>, <code>isBuffer</code>, etc
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line45">line 45</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line67">line 67</a>
</li></ul></dd> </li></ul></dd>
@ -994,7 +1506,7 @@ readability and consistent with <code>isArray</code>, <code>isBuffer</code>, etc
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line217">line 217</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line239">line 239</a>
</li></ul></dd> </li></ul></dd>
@ -1099,7 +1611,7 @@ readability and consistent with <code>isArray</code>, <code>isBuffer</code>, etc
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line142">line 142</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line164">line 164</a>
</li></ul></dd> </li></ul></dd>
@ -1205,7 +1717,7 @@ encrypt/decrypt
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line156">line 156</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line178">line 178</a>
</li></ul></dd> </li></ul></dd>
@ -1310,7 +1822,7 @@ encrypt/decrypt
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line123">line 123</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line145">line 145</a>
</li></ul></dd> </li></ul></dd>
@ -1416,7 +1928,7 @@ encrypt/decrypt
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line133">line 133</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line155">line 155</a>
</li></ul></dd> </li></ul></dd>
@ -1476,7 +1988,7 @@ encrypt/decrypt
<div class="description"> <div class="description">
<p>Get the ripe hash of the address without prefix zeroes.</p> <p>Get the RIPEMD hash of the address keys without prefix nulls.</p>
</div> </div>
@ -1520,7 +2032,7 @@ encrypt/decrypt
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line104">line 104</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line126">line 126</a>
</li></ul></dd> </li></ul></dd>
@ -1547,7 +2059,7 @@ encrypt/decrypt
<div class="param-desc"> <div class="param-desc">
<p>A short ripe hash.</p> <p>A short RIPEMD hash.</p>
</div> </div>
@ -1624,7 +2136,7 @@ encrypt/decrypt
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="address.js.html">address.js</a>, <a href="address.js.html#line164">line 164</a> <a href="address.js.html">address.js</a>, <a href="address.js.html#line186">line 186</a>
</li></ul></dd> </li></ul></dd>
@ -1688,13 +2200,13 @@ encrypt/decrypt
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -38,7 +38,7 @@
<div class="container-overview"> <div class="container-overview">
<div class="description"><p>Working with Bitmessage addresses.</p></div> <div class="description"><p>Working with Bitmessage addresses.<br><strong>NOTE</strong>: <code>Address</code> is exported as a module.</p></div>
@ -119,6 +119,20 @@
<h5>Example</h5>
<pre class="prettyprint"><code>var Address = require("bitmessage").Address;
// Or: var Address = require("bitmessage/address");
// Generate a new random Bitmessage identity.
var addr1 = Address.fromRandom();
console.log("New random Bitmessage address:", addr1.encode());
// Or create it from passphrase.
var addr2 = Address.fromPassphrase("test");
console.log("Deterministic Bitmessage address:", addr2.encode());</code></pre>
@ -158,13 +172,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -262,7 +262,7 @@ the mesage</p></td>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="crypto.js.html">crypto.js</a>, <a href="crypto.js.html#line172">line 172</a> <a href="crypto.js.html">crypto.js</a>, <a href="crypto.js.html#line171">line 171</a>
</li></ul></dd> </li></ul></dd>
@ -289,10 +289,8 @@ the mesage</p></td>
<div class="param-desc"> <div class="param-desc">
<ul> <p>A promise that resolves with the plaintext
<li>A promise that resolves with the on successful decryption and rejects on failure.</p>
plaintext on successful decryption and rejects on failure.</li>
</ul>
</div> </div>
@ -318,7 +316,7 @@ plaintext on successful decryption and rejects on failure.</li>
<h4 class="name" id=".encrypt"><span class="type-signature">(static) </span>encrypt<span class="signature">(publicKeyTo, msg, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encrypt"><span class="type-signature">(static) </span>encrypt<span class="signature">(publicKeyTo, msg, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4>
@ -440,9 +438,9 @@ plaintext on successful decryption and rejects on failure.</li>
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -451,9 +449,81 @@ plaintext on successful decryption and rejects on failure.</li>
<td class="description last"><p>You may also <td class="description last"><p>You may also specify initialization vector
specify initialization vector (16 bytes) and ephemeral private key and ephemeral private key to get deterministic results</p>
(32 bytes) to get deterministic results.</p></td> <h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>iv</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Initialization vector (16 bytes)</p></td>
</tr>
<tr>
<td class="name"><code>ephemPrivateKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Ephemeral private key (32
bytes)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -494,7 +564,7 @@ specify initialization vector (16 bytes) and ephemeral private key
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="crypto.js.html">crypto.js</a>, <a href="crypto.js.html#line158">line 158</a> <a href="crypto.js.html">crypto.js</a>, <a href="crypto.js.html#line157">line 157</a>
</li></ul></dd> </li></ul></dd>
@ -521,10 +591,8 @@ specify initialization vector (16 bytes) and ephemeral private key
<div class="param-desc"> <div class="param-desc">
<ul> <p>A promise that resolves with the buffer in
<li>A promise that resolves with the buffer <code>encrypted</code> format successful encryption and rejects on failure.</p>
in <code>encrypted</code> format successful encryption and rejects on failure.</li>
</ul>
</div> </div>
@ -557,7 +625,7 @@ in <code>encrypted</code> format successful encryption and rejects on failure.</
<div class="description"> <div class="description">
<p>Generate new random private key.</p> <p>Generate a new random private key.</p>
</div> </div>
@ -1749,7 +1817,7 @@ format when fulfilled.</p>
<h4 class="name" id=".verify"><span class="type-signature">(static) </span>verify<span class="signature">(publicKey, msg, sig)</span><span class="type-signature"> &rarr; {Promise.&lt;undefined>}</span></h4> <h4 class="name" id=".verify"><span class="type-signature">(static) </span>verify<span class="signature">(publicKey, msg, sig)</span><span class="type-signature"> &rarr; {Promise.&lt;null>}</span></h4>
@ -1922,8 +1990,8 @@ format when fulfilled.</p>
<div class="param-desc"> <div class="param-desc">
<p>A promise that resolves on correct <p>A promise that resolves on correct signature
signature and rejects on bad key or signature.</p> and rejects on bad key or signature.</p>
</div> </div>
@ -1934,7 +2002,7 @@ signature and rejects on bad key or signature.</p>
</dt> </dt>
<dd> <dd>
<span class="param-type">Promise.&lt;undefined></span> <span class="param-type">Promise.&lt;null></span>
</dd> </dd>
@ -1960,13 +2028,13 @@ signature and rejects on bad key or signature.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line166">line 166</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line230">line 230</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -219,7 +219,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line172">line 172</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line245">line 245</a>
</li></ul></dd> </li></ul></dd>
@ -246,7 +246,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>addr</code> structure.</p> <p><a href="module-bitmessage_messages.addr.html#.DecodeResult">Decoded <code>addr</code> structure.</a></p>
</div> </div>
@ -257,7 +257,7 @@
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -272,14 +272,15 @@
<h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Decode <code>addr</code> message payload.</p> <p>Decode <code>addr</code> message payload.
The same as <a href="module-bitmessage_messages.addr.html#.decode">decode</a>.</p>
</div> </div>
@ -290,55 +291,6 @@
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
</tbody>
</table>
@ -372,7 +324,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line183">line 183</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line255">line 255</a>
</li></ul></dd> </li></ul></dd>
@ -395,28 +347,6 @@
<h5>Returns:</h5>
<div class="param-desc">
<p>Decoded <code>addr</code> structure.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
@ -484,7 +414,8 @@
<td class="description last"><p>Network addresses</p></td> <td class="description last"><p>List of
<a href="module-bitmessage_structs.net_addr.html#.encode">net_addr encode options</a></p></td>
</tr> </tr>
@ -525,7 +456,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line206">line 206</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line279">line 279</a>
</li></ul></dd> </li></ul></dd>
@ -578,14 +509,15 @@
<h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">(addrs)</span><span class="type-signature"> &rarr; {Buffer}</span></h4> <h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>addr</code> message payload.</p> <p>Encode <code>addr</code> message payload.
The same as <a href="module-bitmessage_messages.addr.html#.encode">encode</a>.</p>
</div> </div>
@ -596,10 +528,99 @@
<h5>Parameters:</h5>
<table class="params">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line288">line 288</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead> <thead>
<tr> <tr>
@ -637,7 +658,31 @@
<td class="description last"><p>Network addresses</p></td> <td class="description last"><p>List of
<a href="module-bitmessage_structs.net_addr.html#.DecodeResult">decoded <code>net_addr</code> structures</a></p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Real data length</p></td>
</tr> </tr>
@ -647,8 +692,6 @@
<dl class="details"> <dl class="details">
@ -678,7 +721,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line216">line 216</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line231">line 231</a>
</li></ul></dd> </li></ul></dd>
@ -698,40 +741,6 @@
<h5>Returns:</h5>
<div class="param-desc">
<p>Encoded payload.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
</dd>
</dl>
</article> </article>
</section> </section>
@ -742,13 +751,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line338">line 338</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line431">line 431</a>
</li></ul></dd> </li></ul></dd>
@ -168,7 +168,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line349">line 349</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line442">line 442</a>
</li></ul></dd> </li></ul></dd>
@ -241,7 +241,7 @@ maybe ban you for some time.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line356">line 356</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line449">line 449</a>
</li></ul></dd> </li></ul></dd>
@ -313,7 +313,7 @@ maybe ban you for some time.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line343">line 343</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line436">line 436</a>
</li></ul></dd> </li></ul></dd>
@ -340,7 +340,7 @@ maybe ban you for some time.</p>
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -440,7 +440,7 @@ maybe ban you for some time.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line363">line 363</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line470">line 470</a>
</li></ul></dd> </li></ul></dd>
@ -467,7 +467,7 @@ maybe ban you for some time.</p>
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>error</code> structure.</p> <p><a href="module-bitmessage_messages.error.html#.DecodeResult">Decoded <code>error</code> structure.</a></p>
</div> </div>
@ -478,7 +478,7 @@ maybe ban you for some time.</p>
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -493,14 +493,15 @@ maybe ban you for some time.</p>
<h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Decode <code>error</code> message payload.</p> <p>Decode <code>error</code> message payload.
The same as <a href="module-bitmessage_messages.error.html#.decode">decode</a>.</p>
</div> </div>
@ -511,55 +512,6 @@ maybe ban you for some time.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
</tbody>
</table>
@ -593,7 +545,7 @@ maybe ban you for some time.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line374">line 374</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line480">line 480</a>
</li></ul></dd> </li></ul></dd>
@ -616,28 +568,6 @@ maybe ban you for some time.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>Decoded <code>error</code> structure.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
@ -705,7 +635,171 @@ maybe ban you for some time.</p>
<td class="description last"><p>Error options</p></td> <td class="description last"><p>Error options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fatal</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Type of the error
(<a href="module-bitmessage_messages.error.html#.WARNING">warning</a> by
default)</p></td>
</tr>
<tr>
<td class="name"><code>banTime</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Inform the other node, that you
will not accept further connections for this number of seconds (0
by default)</p></td>
</tr>
<tr>
<td class="name"><code>vector</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>A 32-byte
<a href="module-bitmessage_structs.inv_vect.html">inventory vector</a>
related to the error (empty by default)</p></td>
</tr>
<tr>
<td class="name"><code>errorText</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>A human-readable error description</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -746,7 +840,7 @@ maybe ban you for some time.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line401">line 401</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line530">line 530</a>
</li></ul></dd> </li></ul></dd>
@ -799,14 +893,15 @@ maybe ban you for some time.</p>
<h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Buffer}</span></h4> <h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>error</code> message payload.</p> <p>Encode <code>error</code> message payload.
The same as <a href="module-bitmessage_messages.error.html#.encode">encode</a>.</p>
</div> </div>
@ -817,55 +912,6 @@ maybe ban you for some time.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Error options</p></td>
</tr>
</tbody>
</table>
@ -899,7 +945,7 @@ maybe ban you for some time.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line411">line 411</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line539">line 539</a>
</li></ul></dd> </li></ul></dd>
@ -922,27 +968,257 @@ maybe ban you for some time.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>Encoded payload.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd> <h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>fatal</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Type of the error</p></td>
</tr>
<tr>
<td class="name"><code>banTime</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The other node informs that it will
not accept further connections for this number of seconds</p></td>
</tr>
<tr>
<td class="name"><code>vector</code></td>
<td class="type">
<span class="param-type">Buffer</span> <span class="param-type">Buffer</span>
</dd>
</dl>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.inv_vect.html">Inventory vector</a>
related to the error</p></td>
</tr>
<tr>
<td class="name"><code>errorText</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>A human-readable error description</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Real data length</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line451">line 451</a>
</li></ul></dd>
</dl>
@ -963,13 +1239,13 @@ maybe ban you for some time.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -78,7 +78,7 @@ content of a specific object after filtering known elements.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line294">line 294</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line376">line 376</a>
</li></ul></dd> </li></ul></dd>
@ -121,7 +121,7 @@ content of a specific object after filtering known elements.</p></div>
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -221,7 +221,7 @@ content of a specific object after filtering known elements.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line301">line 301</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line392">line 392</a>
</li></ul></dd> </li></ul></dd>
@ -248,7 +248,7 @@ content of a specific object after filtering known elements.</p></div>
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>getdata</code> structure.</p> <p><a href="module-bitmessage_messages.getdata.html#.DecodeResult">Decoded <code>getdata</code> structure.</a></p>
</div> </div>
@ -259,7 +259,7 @@ content of a specific object after filtering known elements.</p></div>
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -274,14 +274,15 @@ content of a specific object after filtering known elements.</p></div>
<h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Decode <code>getdata</code> message payload.</p> <p>Decode <code>getdata</code> message payload.
The same as <a href="module-bitmessage_messages.getdata.html#.decode">decode</a>.</p>
</div> </div>
@ -292,55 +293,6 @@ content of a specific object after filtering known elements.</p></div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
</tbody>
</table>
@ -374,7 +326,7 @@ content of a specific object after filtering known elements.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line316">line 316</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line398">line 398</a>
</li></ul></dd> </li></ul></dd>
@ -397,28 +349,6 @@ content of a specific object after filtering known elements.</p></div>
<h5>Returns:</h5>
<div class="param-desc">
<p>Decoded <code>inv</code> structure.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
@ -486,7 +416,7 @@ content of a specific object after filtering known elements.</p></div>
<td class="description last"><p>Inventory vector list</p></td> <td class="description last"><p><a href="module-bitmessage_structs.inv_vect.html">Inventory vector</a> list</p></td>
</tr> </tr>
@ -527,7 +457,7 @@ content of a specific object after filtering known elements.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line312">line 312</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line412">line 412</a>
</li></ul></dd> </li></ul></dd>
@ -580,14 +510,15 @@ content of a specific object after filtering known elements.</p></div>
<h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">(inventory)</span><span class="type-signature"> &rarr; {Buffer}</span></h4> <h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>getdata</code> message payload.</p> <p>Encode <code>getdata</code> message payload.
The same as <a href="module-bitmessage_messages.getdata.html#.encode">encode</a>.</p>
</div> </div>
@ -598,10 +529,99 @@ content of a specific object after filtering known elements.</p></div>
<h5>Parameters:</h5>
<table class="params">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line417">line 417</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead> <thead>
<tr> <tr>
@ -639,7 +659,31 @@ content of a specific object after filtering known elements.</p></div>
<td class="description last"><p>Inventory vector list</p></td> <td class="description last"><p>List of
<a href="module-bitmessage_structs.inv_vect.html">inventory vectors</a></p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Real data length</p></td>
</tr> </tr>
@ -649,8 +693,6 @@ content of a specific object after filtering known elements.</p></div>
<dl class="details"> <dl class="details">
@ -680,7 +722,7 @@ content of a specific object after filtering known elements.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line323">line 323</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line377">line 377</a>
</li></ul></dd> </li></ul></dd>
@ -700,40 +742,6 @@ content of a specific object after filtering known elements.</p></div>
<h5>Returns:</h5>
<div class="param-desc">
<p>Encoded payload.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
</dd>
</dl>
</article> </article>
</section> </section>
@ -744,13 +752,13 @@ content of a specific object after filtering known elements.</p></div>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -123,6 +123,35 @@
<h5>Example</h5>
<pre class="prettyprint"><code>var structs = require("bitmessage").structs;
var messages = require("bitmessage").messages;
// Simple encoding and decoding:
var vermsg = messages.version.encode({
nonce: Buffer(8), // Hack detection connection to self
remoteHost: "1.1.1.1",
remotePort: 8444,
});
console.log(messages.version.decode(vermsg).remoteHost); // 1.1.1.1
// Low-level encoding and decoding:
var addrPayload = messages.addr.encodePayload([
{host: "2.2.2.2", port: 28444},
]);
var addrmsg = structs.message.encode("addr", addrPayload);
var decoded = structs.message.decode(addrmsg);
console.log(decoded.command); // addr
var payload = decoded.payload;
var decodedPayload = messages.addr.decodePayload(payload);
console.log(decodedPayload.addrs[0].host); // 2.2.2.2
// Encode with empty payload:
var verackmsg = structs.message.encode("verack");
console.log(structs.message.decode(verackmsg).command); // verack</code></pre>
@ -178,8 +207,7 @@
Note that this function doesn't do any validation because it is Note that this function doesn't do any validation because it is
already provided by already provided by
<a href="module-bitmessage_structs.message.html#.decode">message.decode</a> <a href="module-bitmessage_structs.message.html#.decode">message.decode</a>
routine. Normally you call this for each incoming message and then routine.</p>
call decode function of the appropriate message handler.</p>
</div> </div>
@ -272,7 +300,7 @@ call decode function of the appropriate message handler.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line31">line 31</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line57">line 57</a>
</li></ul></dd> </li></ul></dd>
@ -336,13 +364,13 @@ call decode function of the appropriate message handler.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -77,7 +77,7 @@ more objects.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line230">line 230</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line303">line 303</a>
</li></ul></dd> </li></ul></dd>
@ -120,7 +120,7 @@ more objects.</p></div>
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -220,7 +220,7 @@ more objects.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line236">line 236</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line318">line 318</a>
</li></ul></dd> </li></ul></dd>
@ -247,7 +247,7 @@ more objects.</p></div>
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>inv</code> structure.</p> <p><a href="module-bitmessage_messages.inv.html#.DecodeResult">Decoded <code>inv</code> structure.</a></p>
</div> </div>
@ -258,7 +258,7 @@ more objects.</p></div>
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -273,14 +273,15 @@ more objects.</p></div>
<h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Decode <code>inv</code> message payload.</p> <p>Decode <code>inv</code> message payload.
The same as <a href="module-bitmessage_messages.inv.html#.decode">decode</a>.</p>
</div> </div>
@ -291,55 +292,6 @@ more objects.</p></div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
</tbody>
</table>
@ -373,7 +325,7 @@ more objects.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line247">line 247</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line328">line 328</a>
</li></ul></dd> </li></ul></dd>
@ -396,28 +348,6 @@ more objects.</p></div>
<h5>Returns:</h5>
<div class="param-desc">
<p>Decoded <code>inv</code> structure.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
@ -485,7 +415,7 @@ more objects.</p></div>
<td class="description last"><p>Inventory vector list</p></td> <td class="description last"><p><a href="module-bitmessage_structs.inv_vect.html">Inventory vector</a> list</p></td>
</tr> </tr>
@ -526,7 +456,7 @@ more objects.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line270">line 270</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line352">line 352</a>
</li></ul></dd> </li></ul></dd>
@ -579,14 +509,15 @@ more objects.</p></div>
<h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">(inventory)</span><span class="type-signature"> &rarr; {Buffer}</span></h4> <h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>inv</code> message payload.</p> <p>Encode <code>inv</code> message payload.
The same as <a href="module-bitmessage_messages.inv.html#.encode">encode</a>.</p>
</div> </div>
@ -597,10 +528,99 @@ more objects.</p></div>
<h5>Parameters:</h5>
<table class="params">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line361">line 361</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead> <thead>
<tr> <tr>
@ -638,7 +658,31 @@ more objects.</p></div>
<td class="description last"><p>Inventory vector list</p></td> <td class="description last"><p>List of
<a href="module-bitmessage_structs.inv_vect.html">inventory vectors</a></p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Real data length</p></td>
</tr> </tr>
@ -648,8 +692,6 @@ more objects.</p></div>
<dl class="details"> <dl class="details">
@ -679,7 +721,7 @@ more objects.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line280">line 280</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line304">line 304</a>
</li></ul></dd> </li></ul></dd>
@ -699,40 +741,6 @@ more objects.</p></div>
<h5>Returns:</h5>
<div class="param-desc">
<p>Encoded payload.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
</dd>
</dl>
</article> </article>
</section> </section>
@ -743,13 +751,13 @@ more objects.</p></div>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line52">line 52</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line83">line 83</a>
</li></ul></dd> </li></ul></dd>
@ -110,82 +110,6 @@
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".NONCE"><span class="type-signature">(static, constant) </span>NONCE<span class="type-signature"> :Buffer</span></h4>
<div class="description">
<p>Random nonce used to detect connections to self.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Buffer</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line57">line 57</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3> <h3 class="subsection-title">Methods</h3>
@ -195,15 +119,14 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
<div class="description"> <div class="description">
<p>Decode <code>version</code> message. <p>Decode <code>version</code> message.<br>NOTE: <code>nonce</code> is copied.</p>
NOTE: <code>nonce</code> is copied.</p>
</div> </div>
@ -296,7 +219,7 @@ NOTE: <code>nonce</code> is copied.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line65">line 65</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line112">line 112</a>
</li></ul></dd> </li></ul></dd>
@ -323,7 +246,7 @@ NOTE: <code>nonce</code> is copied.</p>
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>version</code> structure.</p> <p><a href="module-bitmessage_messages.version.html#.DecodeResult">Decoded <code>version</code> structure.</a></p>
</div> </div>
@ -334,7 +257,7 @@ NOTE: <code>nonce</code> is copied.</p>
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -349,7 +272,7 @@ NOTE: <code>nonce</code> is copied.</p>
<h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
@ -357,7 +280,7 @@ NOTE: <code>nonce</code> is copied.</p>
<div class="description"> <div class="description">
<p>Decode <code>version</code> message payload. <p>Decode <code>version</code> message payload.
NOTE: <code>nonce</code> is copied.</p> The same as <a href="module-bitmessage_messages.version.html#.decode">decode</a>.</p>
</div> </div>
@ -368,55 +291,6 @@ NOTE: <code>nonce</code> is copied.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
</tbody>
</table>
@ -450,7 +324,7 @@ NOTE: <code>nonce</code> is copied.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line77">line 77</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line122">line 122</a>
</li></ul></dd> </li></ul></dd>
@ -473,28 +347,6 @@ NOTE: <code>nonce</code> is copied.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>Decoded <code>version</code> structure.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
@ -562,7 +414,309 @@ NOTE: <code>nonce</code> is copied.</p>
<td class="description last"><p>Version options</p></td> <td class="description last"><p>Version options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>services</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.ServicesBitfield.html">Service</a>
features to be enabled for this connection (<code>NODE_NETWORK</code> by
default)</p></td>
</tr>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Date</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Node time (current time by default)</p></td>
</tr>
<tr>
<td class="name"><code>remoteHost</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>IPv4/IPv6 address of the node
receiving this message</p></td>
</tr>
<tr>
<td class="name"><code>remotePort</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Port of the node receiving this
message</p></td>
</tr>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Incoming port of the node (8444 by
default)</p></td>
</tr>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Random nonce used to detect connection
to self (unique per node.js process by default)</p></td>
</tr>
<tr>
<td class="name"><code>userAgent</code></td>
<td class="type">
<span class="param-type">Array</span>
|
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p><a href="module-bitmessage_user-agent.html">User agent</a> of the node
(bitmessage's by default)</p></td>
</tr>
<tr>
<td class="name"><code>streamNumbers</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Streams accepted by the
node (1 by default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -603,7 +757,7 @@ NOTE: <code>nonce</code> is copied.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line113">line 113</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line177">line 177</a>
</li></ul></dd> </li></ul></dd>
@ -656,14 +810,15 @@ NOTE: <code>nonce</code> is copied.</p>
<h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Buffer}</span></h4> <h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>version</code> message payload.</p> <p>Encode <code>version</code> message payload.
The same as <a href="module-bitmessage_messages.version.html#.encode">encode</a>.</p>
</div> </div>
@ -674,55 +829,6 @@ NOTE: <code>nonce</code> is copied.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Version options</p></td>
</tr>
</tbody>
</table>
@ -756,7 +862,7 @@ NOTE: <code>nonce</code> is copied.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line123">line 123</a> <a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line186">line 186</a>
</li></ul></dd> </li></ul></dd>
@ -779,27 +885,324 @@ NOTE: <code>nonce</code> is copied.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>Encoded payload.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd> <h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>services</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.ServicesBitfield.html">Service</a>
features to be enabled for this connection</p></td>
</tr>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Date</span>
</td>
<td class="description last"><p>Node time</p></td>
</tr>
<tr>
<td class="name"><code>remoteHost</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>IPv4/IPv6 address of the node
receiving this message</p></td>
</tr>
<tr>
<td class="name"><code>remotePort</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Port of the node receiving this
message</p></td>
</tr>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Incoming port of the node sending this
message</p></td>
</tr>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Buffer</span> <span class="param-type">Buffer</span>
</dd>
</dl>
</td>
<td class="description last"><p>Random nonce used to detect connection
to self</p></td>
</tr>
<tr>
<td class="name"><code>userAgent</code></td>
<td class="type">
<span class="param-type">Array</span>
|
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p><a href="module-bitmessage_user-agent.html">User agent</a> of the node</p></td>
</tr>
<tr>
<td class="name"><code>streamNumbers</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
</td>
<td class="description last"><p>Streams accepted by the node</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Real data length</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="messages.js.html">messages.js</a>, <a href="messages.js.html#line84">line 84</a>
</li></ul></dd>
</dl>
@ -820,13 +1223,13 @@ NOTE: <code>nonce</code> is copied.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -0,0 +1,881 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: BaseTransport</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: BaseTransport</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-bitmessage_net_base.html">bitmessage/net/base</a>.</span>
BaseTransport
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="BaseTransport"><span class="type-signature"></span>new BaseTransport<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Base transport class. Allows to use single class for both client and
server modes (as separate instances).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line24">line 24</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="bootstrap"><span class="type-signature">(abstract) </span>bootstrap<span class="signature">()</span><span class="type-signature"> &rarr; {Promise.&lt;Array>}</span></h4>
<div class="description">
<p>Do the transport-specific bootstrap process and return promise that
contains discovered nodes when fulfilled (both modes).<br>NOTE: Do not use nodes received by this method in <code>addr</code> messages!
This is meaningless.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line38">line 38</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Array></span>
</dd>
</dl>
<h4 class="name" id="broadcast"><span class="type-signature">(abstract) </span>broadcast<span class="signature">(msg, payload<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Send <a href="module-bitmessage_structs.message.html">message</a> to all
connected clients (server mode only).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Buffer</span>
|
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Encoded message or command string</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Message payload (used if the first
argument is a string)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line82">line 82</a>
</li></ul></dd>
</dl>
<h4 class="name" id="close"><span class="type-signature">(abstract) </span>close<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Close connection(s) and/or stop listening (both modes).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line90">line 90</a>
</li></ul></dd>
</dl>
<h4 class="name" id="connect"><span class="type-signature">(abstract) </span>connect<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Connect to the transport-specific address. Enters client mode. Should
emit <code>open</code> event after successful connect and <code>established</code> event
after <code>verack</code> messages exchange.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line48">line 48</a>
</li></ul></dd>
</dl>
<h4 class="name" id="listen"><span class="type-signature">(abstract) </span>listen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Listen for the transport-specific incoming connections. Enters server
mode. Should emit <code>connection</code> event with a transport instance for
each new connection.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line58">line 58</a>
</li></ul></dd>
</dl>
<h4 class="name" id="send"><span class="type-signature">(abstract) </span>send<span class="signature">(msg, payload<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Send <a href="module-bitmessage_structs.message.html">message</a> over the
wire (client mode only).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Buffer</span>
|
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Encoded message or command string</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Message payload (used if the first
argument is a string)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line70">line 70</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@ -0,0 +1,173 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: bitmessage/net/base</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: bitmessage/net/base</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description"><p>Networking base module. Defines base transport interface, useful for
implementing new transports. End-users should import some transport
instead in order to connect/accept connections to/from other nodes.<br><strong>NOTE</strong>: <code>BaseTransport</code> is exported as a module.</p></div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_base.js.html">net/base.js</a>, <a href="net_base.js.html#line1">line 1</a>
</li></ul></dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>var BaseTransport = require("bitmessage/net/base");</code></pre>
</div>
<h3 class="subsection-title">Classes</h3>
<dl>
<dt><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></dt>
<dd></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@ -0,0 +1,573 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: TcpTransport</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: TcpTransport</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a>.</span>
TcpTransport
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="TcpTransport"><span class="type-signature"></span>new TcpTransport<span class="signature">(opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>TCP transport class. Implements
<a href="module-bitmessage_net_base.BaseTransport.html">base transport interface</a>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Transport options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>seeds</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>Bootstrap nodes (none by default)</p></td>
</tr>
<tr>
<td class="name"><code>dnsSeeds</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>Bootstrap DNS nodes (none by default)</p></td>
</tr>
<tr>
<td class="name"><code>services</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.ServicesBitfield.html">Service features</a>
provided by this node (<code>NODE_NETWORK</code> by default)</p></td>
</tr>
<tr>
<td class="name"><code>userAgent</code></td>
<td class="type">
<span class="param-type">Array</span>
|
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p><a href="module-bitmessage_user-agent.html">User agent</a> of this node
(bitmessage's by default)</p></td>
</tr>
<tr>
<td class="name"><code>streamNumbers</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
</td>
<td class="description last"><p>Streams accepted by this node
(1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Incoming port of this node (8444 by
default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_tcp.js.html">net/tcp.js</a>, <a href="net_tcp.js.html#line69">line 69</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="connect"><span class="type-signature"></span>connect<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Connect to a TCP node. Connection arguments are the same as for
<a href="http://nodejs.org/api/net.html#net_net_connect_port_host_connectlistener">net.connect</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_tcp.js.html">net/tcp.js</a>, <a href="net_tcp.js.html#line240">line 240</a>
</li></ul></dd>
</dl>
<h4 class="name" id="listen"><span class="type-signature"></span>listen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Listen for incoming TCP connections. Listen arguments are the same as
for
<a href="http://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback">server.listen</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_tcp.js.html">net/tcp.js</a>, <a href="net_tcp.js.html#line251">line 251</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@ -0,0 +1,197 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: bitmessage/net/tcp</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: bitmessage/net/tcp</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description"><p>TCP transport compatible with PyBitmessage. Available only for Node
platform.<br><strong>NOTE</strong>: <code>TcpTransport</code> is exported as a module.</p></div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_tcp.js.html">net/tcp.js</a>, <a href="net_tcp.js.html#line1">line 1</a>
</li></ul></dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>var messages = require("bitmessage").messages;
var TcpTransport = require("bitmessage/net/tcp");
var tcp = new TcpTransport({
dnsSeeds: [["bootstrap8444.bitmessage.org", 8444]],
});
tcp.bootstrap().then(function(nodes) {
var remoteHost = nodes[0][0];
var remotePort = nodes[0][1];
console.log("Connecting to", nodes[0]);
tcp.connect(remotePort, remoteHost);
});
tcp.on("established", function() {
console.log("Connection established");
tcp.on("message", function(command, payload) {
console.log("Got new", command, "message");
var decoded;
if (command === "addr") {
decoded = messages.addr.decodePayload(payload);
console.log("Got", decoded.addrs.length, "node addresses");
}
});
});</code></pre>
</div>
<h3 class="subsection-title">Classes</h3>
<dl>
<dt><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></dt>
<dd></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@ -0,0 +1,551 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: WsTransport</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: WsTransport</h1>
<section>
<header>
<h2>
<span class="ancestors"><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a>.</span>
WsTransport
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="WsTransport"><span class="type-signature"></span>new WsTransport<span class="signature">(opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>WebSocket transport class. Implements
<a href="module-bitmessage_net_base.BaseTransport.html">base transport interface</a>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Transport options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>seeds</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"><p>Bootstrap nodes (none by default)</p></td>
</tr>
<tr>
<td class="name"><code>services</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.ServicesBitfield.html">Service features</a>
provided by this node (<code>NODE_NETWORK</code> by default)</p></td>
</tr>
<tr>
<td class="name"><code>userAgent</code></td>
<td class="type">
<span class="param-type">Array</span>
|
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p><a href="module-bitmessage_user-agent.html">User agent</a> of this node
(bitmessage's by default)</p></td>
</tr>
<tr>
<td class="name"><code>streamNumbers</code></td>
<td class="type">
<span class="param-type">Array.&lt;number></span>
</td>
<td class="description last"><p>Streams accepted by this node
(1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Incoming port of this node (8444 by
default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_ws.js.html">net/ws.js</a>, <a href="net_ws.js.html#line43">line 43</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="connect"><span class="type-signature"></span>connect<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Connect to a WebSocket node. Connection arguments are the same as for
<a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSocket">WebSocket</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_ws.js.html">net/ws.js</a>, <a href="net_ws.js.html#line165">line 165</a>
</li></ul></dd>
</dl>
<h4 class="name" id="listen"><span class="type-signature"></span>listen<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Listen for incoming WebSocket connections. Listen arguments are the
same as for
<a href="https://github.com/websockets/ws#server-example">WebSocketServer</a>.
Available only for Node platform.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_ws.js.html">net/ws.js</a>, <a href="net_ws.js.html#line179">line 179</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@ -0,0 +1,173 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: bitmessage/net/ws</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: bitmessage/net/ws</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="description"><p>WebSocket transport. Needed because browsers can't handle TCP sockets
so we use separate WebSocket server to proxy messages into TCP data
packets. Available for both Node.js and Browser platforms.<br><strong>NOTE</strong>: <code>WsTransport</code> is exported as a module.</p></div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="net_ws.js.html">net/ws.js</a>, <a href="net_ws.js.html#line1">line 1</a>
</li></ul></dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>var WsTransport = require("bitmessage/net/ws");</code></pre>
</div>
<h3 class="subsection-title">Classes</h3>
<dl>
<dt><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></dt>
<dd></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line784">line 784</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line875">line 875</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4> <h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts)</span><span class="type-signature"> &rarr; {Promise.&lt;DecodeResult>}</span></h4>
@ -201,120 +201,8 @@
<td class="description last"><p>Decoding options</p></td> <td class="description last"><p>Any of <a href="module-bitmessage_structs.object.html#.decode">object.decode</a> options and:</p>
</tr> <h6>Properties</h6>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line792">line 792</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains decoded
<code>broadcast</code> object structure when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
<h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">(buf, opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<div class="description">
<p>Decode <code>broadcast</code> object message payload.</p>
</div>
<h5>Parameters:</h5>
<table class="params"> <table class="params">
@ -339,34 +227,17 @@
<tr> <tr>
<td class="name"><code>buf</code></td> <td class="name"><code>subscriptions</code></td>
<td class="type"> <td class="type">
<span class="param-type">Buffer</span> <span class="param-type">Array.&lt;Address></span>
|
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Address</span>
|
<span class="param-type">Object</span> <span class="param-type">Object</span>
@ -378,7 +249,18 @@
<td class="description last"><p>Decoding options</p></td> <td class="description last"><p>Address
objects which represent broadcast subscriptions. It is either
addresses array or single address or Object
addr-by-tag/addr-by-ripe. Time to match the key is O(n), O(1), O(1)
respectfully.</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -419,7 +301,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line807">line 807</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line923">line 923</a>
</li></ul></dd> </li></ul></dd>
@ -446,8 +328,8 @@
<div class="param-desc"> <div class="param-desc">
<p>A promise that contains decoded <code>pubkey</code> <p>A promise that contains
object structure when fulfilled.</p> <a href="module-bitmessage_objects.broadcast.html#.DecodeResult">decoded <code>broadcast</code> structure</a> when fulfilled.</p>
</div> </div>
@ -458,7 +340,7 @@ object structure when fulfilled.</p>
</dt> </dt>
<dd> <dd>
<span class="param-type">Promise.&lt;Object></span> <span class="param-type">Promise.&lt;DecodeResult></span>
</dd> </dd>
@ -472,6 +354,89 @@ object structure when fulfilled.</p>
<h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Decode <code>broadcast</code> object message payload.
The same as <a href="module-bitmessage_objects.broadcast.html#.decodeAsync">decodeAsync</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line936">line 936</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".encodeAsync"><span class="type-signature">(static) </span>encodeAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encodeAsync"><span class="type-signature">(static) </span>encodeAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4>
@ -532,7 +497,235 @@ object structure when fulfilled.</p>
<td class="description last"><p><code>broadcast</code> object options</p></td> <td class="description last"><p><code>broadcast</code> object options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>from</code></td>
<td class="type">
<span class="param-type">Address</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Originator of the message</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message</p></td>
</tr>
<tr>
<td class="name"><code>subject</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Subject for <a href="module-bitmessage_objects.msg.html#.SIMPLE">SIMPLE</a> encoding</p></td>
</tr>
<tr>
<td class="name"><code>encoding</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Encoding of the message
(<a href="module-bitmessage_objects.msg.html#.TRIVIAL">TRIVIAL</a> by default)</p></td>
</tr>
<tr>
<td class="name"><code>skipPow</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Do not compute POW (false by
default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -573,7 +766,7 @@ object structure when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line935">line 935</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line1073">line 1073</a>
</li></ul></dd> </li></ul></dd>
@ -627,14 +820,15 @@ when fulfilled.</p>
<h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>broadcast</code> object message payload.</p> <p>Encode <code>broadcast</code> object message payload.
The same as <a href="module-bitmessage_objects.broadcast.html#.encodeAsync">encodeAsync</a>.</p>
</div> </div>
@ -645,55 +839,6 @@ when fulfilled.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><code>broadcast</code> object options</p></td>
</tr>
</tbody>
</table>
@ -727,7 +872,7 @@ when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line947">line 947</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line1084">line 1084</a>
</li></ul></dd> </li></ul></dd>
@ -750,26 +895,670 @@ when fulfilled.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains encoded message
payload when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Buffer></span>
</dd>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>A 8-byte object nonce</p></td>
</tr>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object type</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object version</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object stream</p></td>
</tr>
<tr>
<td class="name"><code>headerLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Length of the object header</p></td>
</tr>
<tr>
<td class="name"><code>tag</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Tag derived from the address object used
to send this <code>broadcast</code> (present only for object version &gt;= 5)</p></td>
</tr>
<tr>
<td class="name"><code>senderVersion</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's address version</p></td>
</tr>
<tr>
<td class="name"><code>senderStream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's stream</p></td>
</tr>
<tr>
<td class="name"><code>behavior</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's <a href="module-bitmessage_structs.PubkeyBitfield.html">pubkey features</a> that can be expected from
the node</p></td>
</tr>
<tr>
<td class="name"><code>signPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's signing public key</p></td>
</tr>
<tr>
<td class="name"><code>encPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's encryption public key</p></td>
</tr>
<tr>
<td class="name"><code>nonceTrialsPerByte</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Difficulty parameter of the
sender (present only if sender's address version &gt;= 3)</p></td>
</tr>
<tr>
<td class="name"><code>payloadLengthExtraBytes</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Difficulty parameter
of the sender (present only if sender's address version &gt;= 3)</p></td>
</tr>
<tr>
<td class="name"><code>encoding</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message encoding</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message string for
<a href="module-bitmessage_objects.msg.html#.TRIVIAL">TRIVIAL</a> and
<a href="module-bitmessage_objects.msg.html#.SIMPLE">SIMPLE</a> encodings or
unparsed buffer data for other encodings</p></td>
</tr>
<tr>
<td class="name"><code>subject</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Subject string for <a href="module-bitmessage_objects.msg.html#.SIMPLE">SIMPLE</a> encoding</p></td>
</tr>
<tr>
<td class="name"><code>signature</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Signature of the message</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Real data length</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line876">line 876</a>
</li></ul></dd>
</dl> </dl>
@ -781,7 +1570,6 @@ payload when fulfilled.</p>
</article> </article>
</section> </section>
@ -792,13 +1580,13 @@ payload when fulfilled.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -78,7 +78,7 @@ for the public key.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line103">line 103</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line92">line 92</a>
</li></ul></dd> </li></ul></dd>
@ -121,7 +121,7 @@ for the public key.</p></div>
<h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4> <h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;DecodeResult>}</span></h4>
@ -212,9 +212,9 @@ for the public key.</p></div>
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -223,7 +223,7 @@ for the public key.</p></div>
<td class="description last"><p>Decoding options</p></td> <td class="description last"><p>Any of <a href="module-bitmessage_structs.object.html#.decode">object.decode</a> options</p></td>
</tr> </tr>
@ -264,7 +264,7 @@ for the public key.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line111">line 111</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line118">line 118</a>
</li></ul></dd> </li></ul></dd>
@ -291,8 +291,8 @@ for the public key.</p></div>
<div class="param-desc"> <div class="param-desc">
<p>A promise that contains decoded <p>A promise that contains
<code>getpubkey</code> object structure when fulfilled.</p> <a href="module-bitmessage_objects.getpubkey.html#.DecodeResult">decoded <code>getpubkey</code> structure</a> when fulfilled.</p>
</div> </div>
@ -303,7 +303,7 @@ for the public key.</p></div>
</dt> </dt>
<dd> <dd>
<span class="param-type">Promise.&lt;Object></span> <span class="param-type">Promise.&lt;DecodeResult></span>
</dd> </dd>
@ -318,14 +318,15 @@ for the public key.</p></div>
<h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">(buf, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4> <h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Decode <code>getpubkey</code> object message payload.</p> <p>Decode <code>getpubkey</code> object message payload.
The same as <a href="module-bitmessage_objects.getpubkey.html#.decodeAsync">decodeAsync</a>.</p>
</div> </div>
@ -336,98 +337,6 @@ for the public key.</p></div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"><p>Decoding options</p></td>
</tr>
</tbody>
</table>
@ -461,7 +370,7 @@ for the public key.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line126">line 126</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line131">line 131</a>
</li></ul></dd> </li></ul></dd>
@ -484,29 +393,6 @@ for the public key.</p></div>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains decoded
<code>getpubkey</code> object structure when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
@ -574,7 +460,131 @@ for the public key.</p></div>
<td class="description last"><p><code>getpubkey</code> object options</p></td> <td class="description last"><p><code>getpubkey</code> object options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>to</code></td>
<td class="type">
<span class="param-type">Address</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Receiver of the message</p></td>
</tr>
<tr>
<td class="name"><code>skipPow</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Do not compute POW (false by
default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -615,7 +625,7 @@ for the public key.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line152">line 152</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line161">line 161</a>
</li></ul></dd> </li></ul></dd>
@ -669,14 +679,16 @@ when fulfilled.</p>
<h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>getpubkey</code> object message payload.</p> <p>Encode <code>getpubkey</code> object message payload.
The same as
<a href="module-bitmessage_objects.getpubkey.html#.encodeAsync">encodeAsync</a>.</p>
</div> </div>
@ -687,55 +699,6 @@ when fulfilled.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><code>getpubkey</code> object options</p></td>
</tr>
</tbody>
</table>
@ -769,7 +732,7 @@ when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line164">line 164</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line172">line 172</a>
</li></ul></dd> </li></ul></dd>
@ -792,26 +755,314 @@ when fulfilled.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains encoded message
payload when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Buffer></span>
</dd>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>A 8-byte object nonce</p></td>
</tr>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object type</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object version</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object stream</p></td>
</tr>
<tr>
<td class="name"><code>headerLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Length of the object header</p></td>
</tr>
<tr>
<td class="name"><code>ripe</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The RIPEMD hash of the requested public
keys for address version &lt;= 3</p></td>
</tr>
<tr>
<td class="name"><code>tag</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>...or tag derived from the address object
for address version &gt;= 4</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Real data length</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line93">line 93</a>
</li></ul></dd>
</dl> </dl>
@ -823,7 +1074,6 @@ payload when fulfilled.</p>
</article> </article>
</section> </section>
@ -834,13 +1084,13 @@ payload when fulfilled.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -38,8 +38,8 @@
<div class="container-overview"> <div class="container-overview">
<div class="description"><p>Working with objects.<br>NOTE: Most operations with objects in this module are asynchronous <div class="description"><p>Working with objects.<br>NOTE: Most operations with objects are asynchronous and return
and return promises.</p></div> promises.</p></div>
@ -161,7 +161,7 @@ and return promises.</p></div>
<h4 class="name" id=".getPayloadType"><span class="type-signature">(static) </span>getPayloadType<span class="signature">(buf)</span><span class="type-signature"> &rarr; (nullable) {number}</span></h4> <h4 class="name" id=".getPayloadType"><span class="type-signature">(static) </span>getPayloadType<span class="signature">()</span><span class="type-signature"></span></h4>
@ -169,12 +169,7 @@ and return promises.</p></div>
<div class="description"> <div class="description">
<p>Try to get type of the given object message payload. <p>Try to get type of the given object message payload.
Note that this function doesn't do any validation because it is The same as <a href="module-bitmessage_objects.html#.getType">getType</a>.</p>
already provided by
<a href="module-bitmessage_structs.object.html#.decodePayload">object.decodePayload</a>
routine. Normally you call this for each incoming object message
payload and then call decode function of the appropriate object
handler.</p>
</div> </div>
@ -185,55 +180,6 @@ handler.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Buffer that starts with object message payload</p></td>
</tr>
</tbody>
</table>
@ -267,7 +213,7 @@ handler.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line60">line 60</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line49">line 49</a>
</li></ul></dd> </li></ul></dd>
@ -290,28 +236,6 @@ handler.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>Object's type if any.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">number</span>
</dd>
</dl>
@ -425,7 +349,7 @@ then call decode function of the appropriate object handler.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line40">line 40</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line36">line 36</a>
</li></ul></dd> </li></ul></dd>
@ -489,13 +413,13 @@ then call decode function of the appropriate object handler.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line523">line 523</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line567">line 567</a>
</li></ul></dd> </li></ul></dd>
@ -169,7 +169,7 @@ simply be sharing its public key with you.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line529">line 529</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line573">line 573</a>
</li></ul></dd> </li></ul></dd>
@ -241,7 +241,7 @@ simply be sharing its public key with you.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line540">line 540</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line584">line 584</a>
</li></ul></dd> </li></ul></dd>
@ -314,7 +314,7 @@ of data, like URIs or magnet links.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line535">line 535</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line579">line 579</a>
</li></ul></dd> </li></ul></dd>
@ -341,7 +341,7 @@ of data, like URIs or magnet links.</p>
<h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4> <h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts)</span><span class="type-signature"> &rarr; {Promise.&lt;DecodeResult>}</span></h4>
@ -423,120 +423,8 @@ of data, like URIs or magnet links.</p>
<td class="description last"><p>Decoding options</p></td> <td class="description last"><p>Any of <a href="module-bitmessage_structs.object.html#.decode">object.decode</a> options and:</p>
</tr> <h6>Properties</h6>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line549">line 549</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains decoded <code>msg</code>
object structure when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
<h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">(buf, opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<div class="description">
<p>Decode <code>msg</code> object message payload.</p>
</div>
<h5>Parameters:</h5>
<table class="params"> <table class="params">
@ -561,13 +449,16 @@ object structure when fulfilled.</p>
<tr> <tr>
<td class="name"><code>buf</code></td> <td class="name"><code>identities</code></td>
<td class="type"> <td class="type">
<span class="param-type">Buffer</span> <span class="param-type">Array.&lt;Address></span>
|
<span class="param-type">Address</span>
@ -577,30 +468,15 @@ object structure when fulfilled.</p>
<td class="description last"><p>Message payload</p></td> <td class="description last"><p>Address objects used
to decrypt the message</p></td>
</tr> </tr>
</tbody>
<tr> </table>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td> </td>
<td class="description last"><p>Decoding options</p></td>
</tr> </tr>
@ -641,7 +517,7 @@ object structure when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line564">line 564</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line630">line 630</a>
</li></ul></dd> </li></ul></dd>
@ -668,8 +544,9 @@ object structure when fulfilled.</p>
<div class="param-desc"> <div class="param-desc">
<p>A promise that contains decoded <code>msg</code> <p>A promise that contains [decoded
object structure when fulfilled.</p> <code>msg</code> structure]<a href="module-bitmessage_objects.msg.html#.DecodeResult">module:bitmessage/objects.msg.DecodeResult</a>
when fulfilled.</p>
</div> </div>
@ -680,7 +557,7 @@ object structure when fulfilled.</p>
</dt> </dt>
<dd> <dd>
<span class="param-type">Promise.&lt;Object></span> <span class="param-type">Promise.&lt;DecodeResult></span>
</dd> </dd>
@ -694,6 +571,89 @@ object structure when fulfilled.</p>
<h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Decode <code>msg</code> object message payload.
The same as <a href="module-bitmessage_objects.msg.html#.decodeAsync">decodeAsync</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line643">line 643</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".encodeAsync"><span class="type-signature">(static) </span>encodeAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encodeAsync"><span class="type-signature">(static) </span>encodeAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4>
@ -754,7 +714,300 @@ object structure when fulfilled.</p>
<td class="description last"><p><code>msg</code> object options</p></td> <td class="description last"><p><code>msg</code> object options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>from</code></td>
<td class="type">
<span class="param-type">Address</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Originator of the message</p></td>
</tr>
<tr>
<td class="name"><code>to</code></td>
<td class="type">
<span class="param-type">Address</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Receiver of the message</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message</p></td>
</tr>
<tr>
<td class="name"><code>subject</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Subject for <a href="module-bitmessage_objects.msg.html#.SIMPLE">SIMPLE</a> encoding</p></td>
</tr>
<tr>
<td class="name"><code>encoding</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Encoding of the message
(<a href="module-bitmessage_objects.msg.html#.TRIVIAL">TRIVIAL</a> by default)</p></td>
</tr>
<tr>
<td class="name"><code>friend</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Whether the receiver is friend and
should have minimal POW difficulty (false by default)</p></td>
</tr>
<tr>
<td class="name"><code>skipPow</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Do not compute POW (false by
default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -795,7 +1048,7 @@ object structure when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line663">line 663</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line754">line 754</a>
</li></ul></dd> </li></ul></dd>
@ -849,14 +1102,15 @@ when fulfilled.</p>
<h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>msg</code> object message payload.</p> <p>Encode <code>msg</code> object message payload.
The same as <a href="module-bitmessage_objects.msg.html#.encodeAsync">encodeAsync</a>.</p>
</div> </div>
@ -867,55 +1121,6 @@ when fulfilled.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><code>msg</code> object options</p></td>
</tr>
</tbody>
</table>
@ -949,7 +1154,7 @@ when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line675">line 675</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line765">line 765</a>
</li></ul></dd> </li></ul></dd>
@ -972,26 +1177,698 @@ when fulfilled.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains encoded message
payload when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Buffer></span>
</dd>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>A 8-byte object nonce</p></td>
</tr>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object type</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object version</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object stream</p></td>
</tr>
<tr>
<td class="name"><code>headerLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Length of the object header</p></td>
</tr>
<tr>
<td class="name"><code>senderVersion</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's address version</p></td>
</tr>
<tr>
<td class="name"><code>senderStream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's stream</p></td>
</tr>
<tr>
<td class="name"><code>behavior</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's <a href="module-bitmessage_structs.PubkeyBitfield.html">pubkey features</a> that can be expected from
the node</p></td>
</tr>
<tr>
<td class="name"><code>signPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's signing public key</p></td>
</tr>
<tr>
<td class="name"><code>encPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Sender's encryption public key</p></td>
</tr>
<tr>
<td class="name"><code>nonceTrialsPerByte</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Difficulty parameter of the
sender (present only if sender's address version &gt;= 3)</p></td>
</tr>
<tr>
<td class="name"><code>payloadLengthExtraBytes</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Difficulty parameter
of the sender (present only if sender's address version &gt;= 3)</p></td>
</tr>
<tr>
<td class="name"><code>ripe</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>The RIPEMD hash of the receiver's keys</p></td>
</tr>
<tr>
<td class="name"><code>encoding</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message encoding</p></td>
</tr>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message string for
<a href="module-bitmessage_objects.msg.html#.TRIVIAL">TRIVIAL</a> and
<a href="module-bitmessage_objects.msg.html#.SIMPLE">SIMPLE</a> encodings or
unparsed buffer data for other encodings</p></td>
</tr>
<tr>
<td class="name"><code>subject</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Subject string for <a href="module-bitmessage_objects.msg.html#.SIMPLE">SIMPLE</a> encoding</p></td>
</tr>
<tr>
<td class="name"><code>ack</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message acknowledgement</p></td>
</tr>
<tr>
<td class="name"><code>signature</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Signature of the message</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Real data length</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line586">line 586</a>
</li></ul></dd>
</dl> </dl>
@ -1003,7 +1880,6 @@ payload when fulfilled.</p>
</article> </article>
</section> </section>
@ -1014,13 +1890,13 @@ payload when fulfilled.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line244">line 244</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line252">line 252</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4> <h4 class="name" id=".decodeAsync"><span class="type-signature">(static) </span>decodeAsync<span class="signature">(buf, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;DecodeResult>}</span></h4>
@ -210,9 +210,9 @@
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -221,120 +221,8 @@
<td class="description last"><p>Decoding options</p></td> <td class="description last"><p>Any of <a href="module-bitmessage_structs.object.html#.decode">object.decode</a> options and:</p>
</tr> <h6>Properties</h6>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line252">line 252</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains decoded <code>pubkey</code>
object structure when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Object></span>
</dd>
</dl>
<h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">(buf, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Promise.&lt;Object>}</span></h4>
<div class="description">
<p>Decode <code>pubkey</code> object message payload.</p>
</div>
<h5>Parameters:</h5>
<table class="params"> <table class="params">
@ -347,8 +235,6 @@ object structure when fulfilled.</p>
<th>Type</th> <th>Type</th>
<th>Attributes</th>
@ -361,42 +247,17 @@ object structure when fulfilled.</p>
<tr> <tr>
<td class="name"><code>buf</code></td> <td class="name"><code>needed</code></td>
<td class="type"> <td class="type">
<span class="param-type">Buffer</span> <span class="param-type">Array.&lt;Address></span>
|
</td>
<td class="attributes">
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Address</span>
|
<span class="param-type">Object</span> <span class="param-type">Object</span>
@ -405,20 +266,21 @@ object structure when fulfilled.</p>
</td> </td>
<td class="attributes">
&lt;nullable><br> <td class="description last"><p>Address objects
which represent pubkeys that we are interested in (used only for
pubkeys v4). It is either addresses array or single address or
Object addr-by-tag. Time to match the key is O(n), O(1), O(1)
respectfully.</p></td>
</tr>
</tbody>
</table>
</td> </td>
<td class="description last"><p>Decoding options</p></td>
</tr> </tr>
@ -459,7 +321,7 @@ object structure when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line267">line 267</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line293">line 293</a>
</li></ul></dd> </li></ul></dd>
@ -486,8 +348,9 @@ object structure when fulfilled.</p>
<div class="param-desc"> <div class="param-desc">
<p>A promise that contains decoded <code>pubkey</code> <p>A promise that contains
object structure when fulfilled.</p> <a href="module-bitmessage_objects.pubkey.html#.DecodeResult">decoded <code>pubkey</code> structure</a>
when fulfilled.</p>
</div> </div>
@ -498,7 +361,7 @@ object structure when fulfilled.</p>
</dt> </dt>
<dd> <dd>
<span class="param-type">Promise.&lt;Object></span> <span class="param-type">Promise.&lt;DecodeResult></span>
</dd> </dd>
@ -512,6 +375,89 @@ object structure when fulfilled.</p>
<h4 class="name" id=".decodePayloadAsync"><span class="type-signature">(static) </span>decodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Decode <code>pubkey</code> object message payload.
The same as <a href="module-bitmessage_objects.pubkey.html#.decodeAsync">decodeAsync</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line306">line 306</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".encodeAsync"><span class="type-signature">(static) </span>encodeAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encodeAsync"><span class="type-signature">(static) </span>encodeAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4>
@ -572,7 +518,162 @@ object structure when fulfilled.</p>
<td class="description last"><p><code>pubkey</code> object options</p></td> <td class="description last"><p><code>pubkey</code> object options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>from</code></td>
<td class="type">
<span class="param-type">Address</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Originator of the message</p></td>
</tr>
<tr>
<td class="name"><code>to</code></td>
<td class="type">
<span class="param-type">Address</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Receiver of the message</p></td>
</tr>
<tr>
<td class="name"><code>skipPow</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Do not compute POW (false by
default)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -613,7 +714,7 @@ object structure when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line347">line 347</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line391">line 391</a>
</li></ul></dd> </li></ul></dd>
@ -667,14 +768,15 @@ when fulfilled.</p>
<h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Promise.&lt;Buffer>}</span></h4> <h4 class="name" id=".encodePayloadAsync"><span class="type-signature">(static) </span>encodePayloadAsync<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>pubkey</code> object message payload.</p> <p>Encode <code>pubkey</code> object message payload.
The same as <a href="module-bitmessage_objects.pubkey.html#.encodeAsync">encodeAsync</a>.</p>
</div> </div>
@ -685,55 +787,6 @@ when fulfilled.</p>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><code>pubkey</code> object options</p></td>
</tr>
</tbody>
</table>
@ -767,7 +820,7 @@ when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line359">line 359</a> <a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line402">line 402</a>
</li></ul></dd> </li></ul></dd>
@ -790,26 +843,432 @@ when fulfilled.</p>
<h5>Returns:</h5>
<div class="param-desc">
<p>A promise that contains encoded message
payload when fulfilled.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;Buffer></span>
</dd>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>A 8-byte object nonce</p></td>
</tr>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object type</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object version</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object stream</p></td>
</tr>
<tr>
<td class="name"><code>headerLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Length of the object header</p></td>
</tr>
<tr>
<td class="name"><code>tag</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Tag derived from the address object
(present only if object version is 4)</p></td>
</tr>
<tr>
<td class="name"><code>behavior</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.PubkeyBitfield.html">Pubkey features</a> that can be expected from
the node</p></td>
</tr>
<tr>
<td class="name"><code>signPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Signing public key</p></td>
</tr>
<tr>
<td class="name"><code>encPublicKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Encryption public key</p></td>
</tr>
<tr>
<td class="name"><code>nonceTrialsPerByte</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Difficulty parameter of the
node (present only for <code>pubkey</code> version &gt;= 3)</p></td>
</tr>
<tr>
<td class="name"><code>payloadLengthExtraBytes</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Difficulty parameter
of the node (present only for <code>pubkey</code> version &gt;= 3)</p></td>
</tr>
<tr>
<td class="name"><code>signature</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Signature of the message (present
only for <code>pubkey</code> version &gt;= 3)</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Real data length</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="objects.js.html">objects.js</a>, <a href="objects.js.html#line253">line 253</a>
</li></ul></dd>
</dl> </dl>
@ -821,7 +1280,6 @@ payload when fulfilled.</p>
</article> </article>
</section> </section>
@ -832,13 +1290,13 @@ payload when fulfilled.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -203,7 +203,130 @@
<td class="description last"><p>Proof of work options</p></td> <td class="description last"><p>Proof of work options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>target</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Proof of work target or pass
<a href="module-bitmessage_pow.html#.getTarget">getTarget</a> options to <code>opts</code>
to compute it</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload (with nonce)</p></td>
</tr>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>...or already derived nonce</p></td>
</tr>
<tr>
<td class="name"><code>initialHash</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>...and initial hash</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -244,7 +367,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="pow.js.html">pow.js</a>, <a href="pow.js.html#line38">line 38</a> <a href="pow.js.html">pow.js</a>, <a href="pow.js.html#line55">line 55</a>
</li></ul></dd> </li></ul></dd>
@ -401,8 +524,6 @@
&lt;nullable><br>
</td> </td>
@ -435,8 +556,6 @@ get the initial hash from</p></td>
&lt;nullable><br>
</td> </td>
@ -444,7 +563,8 @@ get the initial hash from</p></td>
<td class="description last"><p>Or already computed initial hash</p></td> <td class="description last"><p>...or already computed initial
hash</p></td>
</tr> </tr>
@ -479,6 +599,40 @@ get the initial hash from</p></td>
</tr> </tr>
<tr>
<td class="name"><code>poolSize</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>POW calculation pool size (by
default equals to number of cores)</p></td>
</tr>
</tbody> </tbody>
</table> </table>
@ -523,7 +677,7 @@ get the initial hash from</p></td>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="pow.js.html">pow.js</a>, <a href="pow.js.html#line85">line 85</a> <a href="pow.js.html">pow.js</a>, <a href="pow.js.html#line105">line 105</a>
</li></ul></dd> </li></ul></dd>
@ -636,7 +790,201 @@ the given target when fulfilled.</p>
<td class="description last"><p>Target options</p></td> <td class="description last"><p>Target options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live of the message in seconds</p></td>
</tr>
<tr>
<td class="name"><code>payloadLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Length of the message payload
(with nonce)</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>...or payload itself</p></td>
</tr>
<tr>
<td class="name"><code>nonceTrialsPerByte</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>This number is the average
number of nonce trials a node will have to perform to meet the Proof
of Work requirement. 1000 is the network minimum so any lower values
will be automatically raised to 1000.</p></td>
</tr>
<tr>
<td class="name"><code>payloadLengthExtraBytes</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>This number is added
to the data length to make sending small messages more difficult.
1000 is the network minimum so any lower values will be automatically
raised to 1000.</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -677,7 +1025,7 @@ the given target when fulfilled.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="pow.js.html">pow.js</a>, <a href="pow.js.html#line23">line 23</a> <a href="pow.js.html">pow.js</a>, <a href="pow.js.html#line34">line 34</a>
</li></ul></dd> </li></ul></dd>
@ -741,13 +1089,13 @@ the given target when fulfilled.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>JSDoc: Namespace: PubkeyBitfield</title> <title>JSDoc: Class: PubkeyBitfield</title>
<script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script> <script src="scripts/prettify/lang-css.js"> </script>
@ -17,7 +17,7 @@
<div id="main"> <div id="main">
<h1 class="page-title">Namespace: PubkeyBitfield</h1> <h1 class="page-title">Class: PubkeyBitfield</h1>
@ -41,7 +41,121 @@
<div class="container-overview"> <div class="container-overview">
<div class="description"><p>Pubkey bitfield features.</p></div>
<h4 class="name" id="PubkeyBitfield"><span class="type-signature"></span>new PubkeyBitfield<span class="signature">(buf<span class="signature-attributes">opt</span>, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Pubkey features bitfield (MSB 0).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>A 4-byte bitfield buffer (will be created if
not provided or will be copied if <code>opts.copy</code> is <code>true</code>)</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Options</p></td>
</tr>
</tbody>
</table>
@ -76,7 +190,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line688">line 688</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1013">line 1013</a>
</li></ul></dd> </li></ul></dd>
@ -97,6 +211,30 @@
<h5>Example</h5>
<pre class="prettyprint"><code>var PubkeyBitfield = require("bitmessage").structs.PubkeyBitfield;
var behavior = PubkeyBitfield().set([
PubkeyBitfield.INCLUDE_DESTINATION,
PubkeyBitfield.DOES_ACK,
]).set(1);
console.log(behavior.get(PubkeyBitfield.DOES_ACK)); // true
console.log(behavior.get(15)); // false</code></pre>
</div> </div>
@ -120,7 +258,8 @@
<div class="description"> <div class="description">
<p>If true, the receiving node does send acknowledgements (rather than <p>Bit index.
If set, the receiving node does send acknowledgements (rather than
dropping them).</p> dropping them).</p>
</div> </div>
@ -169,7 +308,7 @@ dropping them).</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line703">line 703</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1054">line 1054</a>
</li></ul></dd> </li></ul></dd>
@ -193,9 +332,10 @@ dropping them).</p>
<div class="description"> <div class="description">
<p>Receiving node expects that the RIPE hash encoded in their address <p>Bit index.
preceedes the encrypted message data of msg messages bound for If set, the receiving node expects that the RIPEMD hash encoded in
them.</p> their address preceedes the encrypted message data of msg messages
bound for them.</p>
</div> </div>
@ -243,7 +383,206 @@ them.</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line696">line 696</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1046">line 1046</a>
</li></ul></dd>
</dl>
<h4 class="name" id="buffer"><span class="type-signature"></span>buffer<span class="type-signature"> :Buffer</span></h4>
<div class="description">
<p>The contents of the bitfield.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Buffer</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1030">line 1030</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(index)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Returns a boolean indicating whether the bit is set.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Bit index (MSB 0)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1014">line 1014</a>
</li></ul></dd> </li></ul></dd>
@ -266,6 +605,188 @@ them.</p>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(index)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
<p>Set the given bit(s) to <code>1</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">Array.&lt;number></span>
</td>
<td class="description last"><p>Bit(s) index (MSB 0)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line1022">line 1022</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns self so methods can be chained.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</article> </article>
@ -277,13 +798,13 @@ them.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>JSDoc: Namespace: ServicesBitfield</title> <title>JSDoc: Class: ServicesBitfield</title>
<script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script> <script src="scripts/prettify/lang-css.js"> </script>
@ -17,7 +17,7 @@
<div id="main"> <div id="main">
<h1 class="page-title">Namespace: ServicesBitfield</h1> <h1 class="page-title">Class: ServicesBitfield</h1>
@ -41,7 +41,121 @@
<div class="container-overview"> <div class="container-overview">
<div class="description"><p>Services bitfield features.</p></div>
<h4 class="name" id="ServicesBitfield"><span class="type-signature"></span>new ServicesBitfield<span class="signature">(buf<span class="signature-attributes">opt</span>, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Service features bitfield (MSB 0).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>A 8-byte bitfield buffer (will be created if
not provided or will be copied if <code>opts.copy</code> is <code>true</code>)</p></td>
</tr>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Options</p></td>
</tr>
</tbody>
</table>
@ -76,7 +190,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line673">line 673</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line964">line 964</a>
</li></ul></dd> </li></ul></dd>
@ -97,6 +211,27 @@
<h5>Example</h5>
<pre class="prettyprint"><code>var ServicesBitfield = require("bitmessage").structs.ServicesBitfield;
var services = ServicesBitfield().set(ServicesBitfield.NODE_NETWORK);
console.log(services.get(ServicesBitfield.NODE_NETWORK)); // true
console.log(services.get(15)); // false</code></pre>
</div> </div>
@ -120,7 +255,7 @@
<div class="description"> <div class="description">
<p>This is a normal network node.</p> <p>Bit index indicating normal network node.</p>
</div> </div>
@ -168,7 +303,206 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line679">line 679</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line994">line 994</a>
</li></ul></dd>
</dl>
<h4 class="name" id="buffer"><span class="type-signature"></span>buffer<span class="type-signature"> :Buffer</span></h4>
<div class="description">
<p>The contents of the bitfield.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Buffer</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line981">line 981</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(index)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
<div class="description">
<p>Returns a boolean indicating whether the bit is set.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Bit index (MSB 0)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line965">line 965</a>
</li></ul></dd> </li></ul></dd>
@ -191,6 +525,188 @@
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(index)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
<p>Set the given bit(s) to <code>1</code>.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
|
<span class="param-type">Array.&lt;number></span>
</td>
<td class="description last"><p>Bit(s) index (MSB 0)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line973">line 973</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns self so methods can be chained.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</article> </article>
@ -202,13 +718,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line582">line 582</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line850">line 850</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -219,7 +219,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line588">line 588</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line865">line 865</a>
</li></ul></dd> </li></ul></dd>
@ -246,7 +246,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Decoded encrypted structure.</p> <p><a href="module-bitmessage_structs.encrypted.html#.DecodeResult">Decoded <code>encrypted</code> structure.</a></p>
</div> </div>
@ -257,7 +257,7 @@
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -331,7 +331,127 @@
<td class="description last"><p>Encode options</p></td> <td class="description last"><p>Encoding options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>iv</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Initialization vector (16 bytes)</p></td>
</tr>
<tr>
<td class="name"><code>ephemPrivateKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Ephemeral private key (32
bytes)</p></td>
</tr>
<tr>
<td class="name"><code>ciphertext</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The result of encryption (variable
size)</p></td>
</tr>
<tr>
<td class="name"><code>mac</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message authentication code (32 bytes)</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -372,7 +492,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line596">line 596</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line874">line 874</a>
</li></ul></dd> </li></ul></dd>
@ -399,7 +519,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Encoded encrypted payload.</p> <p>Encoded <code>encrypted</code> payload.</p>
</div> </div>
@ -424,6 +544,200 @@
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>iv</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Initialization vector (16 bytes)</p></td>
</tr>
<tr>
<td class="name"><code>ephemPrivateKey</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Ephemeral private key (32 bytes)</p></td>
</tr>
<tr>
<td class="name"><code>ciphertext</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The result of encryption (variable
size)</p></td>
</tr>
<tr>
<td class="name"><code>mac</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message authentication code (32 bytes)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line856">line 856</a>
</li></ul></dd>
</dl>
</article> </article>
@ -436,13 +750,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -119,6 +119,27 @@
<h5>Example</h5>
<pre class="prettyprint"><code>var structs = require("bitmessage").structs;
var encoded = Buffer.concat([
structs.var_int.encode(4),
Buffer("test"),
structs.var_str.encode("test2"),
structs.var_int_list.encode([1, 2, 3]),
]);
var decoded1 = structs.var_str.decode(encoded);
console.log(decoded1.str); // test
var decoded2 = structs.var_str.decode(decoded1.rest);
console.log(decoded2.str); // test2
var decoded3 = structs.var_int.decode(decoded2.rest);
console.log(decoded3.value); // 3
var decoded4 = structs.var_int_list.decode(decoded2.rest);
console.log(decoded4.list); // [1, 2, 3]</code></pre>
@ -129,6 +150,16 @@
<h3 class="subsection-title">Classes</h3>
<dl>
<dt><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></dt>
<dd></dd>
<dt><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></dt>
<dd></dd>
</dl>
@ -151,12 +182,6 @@
<dt><a href="module-bitmessage_structs.object.html">object</a></dt> <dt><a href="module-bitmessage_structs.object.html">object</a></dt>
<dd></dd> <dd></dd>
<dt><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></dt>
<dd></dd>
<dt><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></dt>
<dd></dd>
<dt><a href="module-bitmessage_structs.var_int.html">var_int</a></dt> <dt><a href="module-bitmessage_structs.var_int.html">var_int</a></dt>
<dd></dd> <dd></dd>
@ -185,13 +210,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line571">line 571</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line836">line 836</a>
</li></ul></dd> </li></ul></dd>
@ -219,7 +219,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line577">line 577</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line845">line 845</a>
</li></ul></dd> </li></ul></dd>
@ -246,7 +246,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Encoded <code>inv_vect</code>.</p> <p>A 32-byte encoded <code>inv_vect</code>.</p>
</div> </div>
@ -283,13 +283,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line37">line 37</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line97">line 97</a>
</li></ul></dd> </li></ul></dd>
@ -168,7 +168,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line42">line 42</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line102">line 102</a>
</li></ul></dd> </li></ul></dd>
@ -195,14 +195,14 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
<div class="description"> <div class="description">
<p>Decode message structure.<br>NOTE: <code>payload</code> is copied, <code>rest</code> references input buffer.</p> <p>Decode message.<br>NOTE: <code>payload</code> is copied, <code>rest</code> references input buffer.</p>
</div> </div>
@ -295,7 +295,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line51">line 51</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line218">line 218</a>
</li></ul></dd> </li></ul></dd>
@ -322,7 +322,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Decoded message structure.</p> <p><a href="module-bitmessage_structs.message.html#.DecodeResult">Decoded message structure.</a></p>
</div> </div>
@ -333,7 +333,7 @@
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -355,7 +355,7 @@
<div class="description"> <div class="description">
<p>Encode message structure.</p> <p>Encode message.</p>
</div> </div>
@ -471,7 +471,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line86">line 86</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line254">line 254</a>
</li></ul></dd> </li></ul></dd>
@ -524,6 +524,614 @@
<h4 class="name" id=".tryDecode"><span class="type-signature">(static) </span>tryDecode<span class="signature">(buf)</span><span class="type-signature"> &rarr; (nullable) {TryDecodeResult}</span></h4>
<div class="description">
<p>Decode message in &quot;stream&quot; mode.<br>NOTE: message payload and <code>rest</code> are copied (so the runtime can GC
processed buffer data).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>buf</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Data buffer</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line124">line 124</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p><a href="module-bitmessage_structs.message.html#.TryDecodeResult">Decoded result.</a></p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">TryDecodeResult</span>
</dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>command</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Message command</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Full message length</p></td>
</tr>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The rest of the input buffer</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line202">line 202</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".TryDecodeResult">TryDecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Decoded message</p>
<h6>Properties</h6>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>command</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>Message command</p></td>
</tr>
<tr>
<td class="name"><code>payload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Message payload</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Full message length</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="name"><code>error</code></td>
<td class="type">
<span class="param-type">Error</span>
</td>
<td class="description last"><p>...or decoding error</p></td>
</tr>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The rest of the input buffer after
processing message</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line104">line 104</a>
</li></ul></dd>
</dl>
</article> </article>
@ -535,13 +1143,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line498">line 498</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line739">line 739</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -210,9 +210,9 @@
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -264,7 +264,7 @@ decode <code>net_addr</code> from
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line507">line 507</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line763">line 763</a>
</li></ul></dd> </li></ul></dd>
@ -291,7 +291,7 @@ decode <code>net_addr</code> from
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>net_addr</code> structure.</p> <p><a href="module-bitmessage_structs.net_addr.html#.DecodeResult">Decoded <code>net_addr</code> structure.</a></p>
</div> </div>
@ -302,7 +302,7 @@ decode <code>net_addr</code> from
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -376,9 +376,234 @@ decode <code>net_addr</code> from
<td class="description last"><p>Encode options; use <code>short</code> option to encode <td class="description last"><p>Encoding options</p>
<code>net_addr</code> for <h6>Properties</h6>
<a href="module-bitmessage_messages.version.html">version message</a></p></td>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>short</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Encode <code>net_addr</code> for
<a href="module-bitmessage_messages.version.html">version message</a>
(false by default)</p></td>
</tr>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Date</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Time the node was last active, not
included in short mode (current time by default)</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Stream number of the node, not
included in short mode (1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>services</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.ServicesBitfield.html">Services</a>
provided by the node (<code>NODE_NETWORK</code> by default)</p></td>
</tr>
<tr>
<td class="name"><code>host</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>IPv4/IPv6 address of the node</p></td>
</tr>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Incoming port of the node</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -419,7 +644,7 @@ decode <code>net_addr</code> from
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line538">line 538</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line804">line 804</a>
</li></ul></dd> </li></ul></dd>
@ -471,6 +696,225 @@ decode <code>net_addr</code> from
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>time</code></td>
<td class="type">
<span class="param-type">Date</span>
</td>
<td class="description last"><p>Time the node was last active, not included
in short mode</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Stream number of the node, not included
in short mode</p></td>
</tr>
<tr>
<td class="name"><code>services</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p><a href="module-bitmessage_structs.ServicesBitfield.html">Services</a>
provided by the node</p></td>
</tr>
<tr>
<td class="name"><code>host</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>IPv4/IPv6 address of the node</p></td>
</tr>
<tr>
<td class="name"><code>port</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Incoming port of the node</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line740">line 740</a>
</li></ul></dd>
</dl>
</article> </article>
@ -483,13 +927,13 @@ decode <code>net_addr</code> from
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -78,7 +78,7 @@ nodes.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line108">line 108</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line278">line 278</a>
</li></ul></dd> </li></ul></dd>
@ -112,6 +112,298 @@ nodes.</p></div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id=".BROADCAST"><span class="type-signature">(static, constant) </span>BROADCAST<span class="type-signature"> :number</span></h4>
<div class="description">
<p><a href="module-bitmessage_objects.broadcast.html">broadcast</a> object type.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line298">line 298</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".GETPUBKEY"><span class="type-signature">(static, constant) </span>GETPUBKEY<span class="type-signature"> :number</span></h4>
<div class="description">
<p><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a> object type.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line283">line 283</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".MSG"><span class="type-signature">(static, constant) </span>MSG<span class="type-signature"> :number</span></h4>
<div class="description">
<p><a href="module-bitmessage_objects.msg.html">msg</a> object type.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line293">line 293</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".PUBKEY"><span class="type-signature">(static, constant) </span>PUBKEY<span class="type-signature"> :number</span></h4>
<div class="description">
<p><a href="module-bitmessage_objects.pubkey.html">pubkey</a> object type.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line288">line 288</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3> <h3 class="subsection-title">Methods</h3>
@ -121,7 +413,7 @@ nodes.</p></div>
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf, opts<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -212,9 +504,9 @@ nodes.</p></div>
<td class="attributes"> <td class="attributes">
&lt;optional><br>
&lt;nullable><br>
@ -223,119 +515,8 @@ nodes.</p></div>
<td class="description last"><p>Decoding options</p></td> <td class="description last"><p>Decoding options</p>
</tr> <h6>Properties</h6>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line122">line 122</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Decoded <code>object</code> structure.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
<h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">(buf, opts<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Object}</span></h4>
<div class="description">
<p>Decode <code>object</code> message payload.<br>NOTE: <code>nonce</code> and <code>objectPayload</code> are copied.</p>
</div>
<h5>Parameters:</h5>
<table class="params"> <table class="params">
@ -348,8 +529,6 @@ nodes.</p></div>
<th>Type</th> <th>Type</th>
<th>Attributes</th>
@ -362,64 +541,53 @@ nodes.</p></div>
<tr> <tr>
<td class="name"><code>buf</code></td> <td class="name"><code>allowExpired</code></td>
<td class="type"> <td class="type">
<span class="param-type">Buffer</span> <span class="param-type">boolean</span>
</td> </td>
<td class="attributes">
<td class="description last"><p>Allow expired objects</p></td>
</td>
<td class="description last"><p>Message payload</p></td>
</tr> </tr>
<tr> <tr>
<td class="name"><code>opts</code></td> <td class="name"><code>skipPow</code></td>
<td class="type"> <td class="type">
<span class="param-type">Object</span> <span class="param-type">boolean</span>
</td> </td>
<td class="attributes">
&lt;nullable><br> <td class="description last"><p>Do not validate object POW</p></td>
</tr>
</tbody>
</table>
</td> </td>
<td class="description last"><p>Decoding options</p></td>
</tr> </tr>
@ -460,7 +628,7 @@ nodes.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line135">line 135</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line322">line 322</a>
</li></ul></dd> </li></ul></dd>
@ -487,7 +655,7 @@ nodes.</p></div>
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>object</code> structure.</p> <p><a href="module-bitmessage_structs.object.html#.DecodeResult">Decoded <code>object</code> structure.</a></p>
</div> </div>
@ -498,7 +666,7 @@ nodes.</p></div>
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -512,6 +680,89 @@ nodes.</p></div>
<h4 class="name" id=".decodePayload"><span class="type-signature">(static) </span>decodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Decode <code>object</code> message payload.
The same as <a href="module-bitmessage_structs.object.html#.decode">decode</a>.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line332">line 332</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".encode"><span class="type-signature">(static) </span>encode<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Buffer}</span></h4> <h4 class="name" id=".encode"><span class="type-signature">(static) </span>encode<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
@ -572,7 +823,223 @@ nodes.</p></div>
<td class="description last"><p>Object options</p></td> <td class="description last"><p>Object options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>A 8-byte object nonce</p></td>
</tr>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object type</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object version</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Object stream (1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>objectPayload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object payload</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -613,7 +1080,7 @@ nodes.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line183">line 183</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line386">line 386</a>
</li></ul></dd> </li></ul></dd>
@ -666,14 +1133,15 @@ nodes.</p></div>
<h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">(opts)</span><span class="type-signature"> &rarr; {Buffer}</span></h4> <h4 class="name" id=".encodePayload"><span class="type-signature">(static) </span>encodePayload<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description"> <div class="description">
<p>Encode <code>object</code> message payload.</p> <p>Encode <code>object</code> message payload.
The same as <a href="module-bitmessage_structs.object.html#.encode">encode</a>.</p>
</div> </div>
@ -684,55 +1152,6 @@ nodes.</p></div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>opts</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"><p>Object options</p></td>
</tr>
</tbody>
</table>
@ -766,7 +1185,7 @@ nodes.</p></div>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line193">line 193</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line395">line 395</a>
</li></ul></dd> </li></ul></dd>
@ -789,28 +1208,6 @@ nodes.</p></div>
<h5>Returns:</h5>
<div class="param-desc">
<p>Encoded payload.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
</dd>
</dl>
@ -879,7 +1276,192 @@ useful if you are going to calculate it later).</p>
<td class="description last"><p>Object options</p></td> <td class="description last"><p>Object options</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object type</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object version</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last"><p>Object stream (1 by default)</p></td>
</tr>
<tr>
<td class="name"><code>objectPayload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Object payload</p></td>
</tr>
</tbody>
</table>
</td>
</tr> </tr>
@ -920,7 +1502,7 @@ useful if you are going to calculate it later).</p>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line217">line 217</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line424">line 424</a>
</li></ul></dd> </li></ul></dd>
@ -972,6 +1554,268 @@ useful if you are going to calculate it later).</p>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>nonce</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>A 8-byte object nonce</p></td>
</tr>
<tr>
<td class="name"><code>ttl</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Time to live in seconds</p></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object type</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object version</p></td>
</tr>
<tr>
<td class="name"><code>stream</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Object stream</p></td>
</tr>
<tr>
<td class="name"><code>headerLength</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Length of the object header</p></td>
</tr>
<tr>
<td class="name"><code>objectPayload</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Object payload</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line300">line 300</a>
</li></ul></dd>
</dl>
</article> </article>
@ -984,13 +1828,13 @@ useful if you are going to calculate it later).</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line242">line 242</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line449">line 449</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -219,7 +219,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line250">line 250</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line465">line 465</a>
</li></ul></dd> </li></ul></dd>
@ -246,7 +246,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>var_int</code> structure.</p> <p><a href="module-bitmessage_structs.var_int.html#.DecodeResult">Decoded <code>var_int</code> structure.</a></p>
</div> </div>
@ -257,7 +257,7 @@
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -375,7 +375,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line295">line 295</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line510">line 510</a>
</li></ul></dd> </li></ul></dd>
@ -427,6 +427,176 @@
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Stored value</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p><code>var_int</code> full length</p></td>
</tr>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The rest of the input buffer</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line450">line 450</a>
</li></ul></dd>
</dl>
</article> </article>
@ -439,13 +609,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line371">line 371</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line594">line 594</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -220,7 +220,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line380">line 380</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line611">line 611</a>
</li></ul></dd> </li></ul></dd>
@ -247,7 +247,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>var_int_list</code> structure.</p> <p><a href="module-bitmessage_structs.var_int_list.html#.DecodeResult">Decoded <code>var_int_list</code> structure.</a></p>
</div> </div>
@ -258,7 +258,7 @@
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -373,7 +373,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line400">line 400</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line631">line 631</a>
</li></ul></dd> </li></ul></dd>
@ -425,6 +425,176 @@
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>list</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>Stored numbers</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p><code>var_int_list</code> full length</p></td>
</tr>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The rest of the input buffer</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line595">line 595</a>
</li></ul></dd>
</dl>
</article> </article>
@ -437,13 +607,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -76,7 +76,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line335">line 335</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line550">line 550</a>
</li></ul></dd> </li></ul></dd>
@ -119,7 +119,7 @@
<h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {Object}</span></h4> <h4 class="name" id=".decode"><span class="type-signature">(static) </span>decode<span class="signature">(buf)</span><span class="type-signature"> &rarr; {DecodeResult}</span></h4>
@ -219,7 +219,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line343">line 343</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line566">line 566</a>
</li></ul></dd> </li></ul></dd>
@ -246,7 +246,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Decoded <code>var_str</code> structure.</p> <p><a href="module-bitmessage_structs.var_str.html#.DecodeResult">Decoded <code>var_str</code> structure.</a></p>
</div> </div>
@ -257,7 +257,7 @@
</dt> </dt>
<dd> <dd>
<span class="param-type">Object</span> <span class="param-type">DecodeResult</span>
</dd> </dd>
@ -372,7 +372,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line359">line 359</a> <a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line582">line 582</a>
</li></ul></dd> </li></ul></dd>
@ -424,6 +424,176 @@
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DecodeResult">DecodeResult</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>str</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The string itself</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p><code>var_str</code> full length</p></td>
</tr>
<tr>
<td class="name"><code>rest</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>The rest of the input buffer</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="structs.js.html">structs.js</a>, <a href="structs.js.html#line551">line 551</a>
</li></ul></dd>
</dl>
</article> </article>
@ -436,13 +606,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -360,6 +360,9 @@ comes first.</p>
| |
<span class="param-type">string</span> <span class="param-type">string</span>
|
<span class="param-type">Buffer</span>
@ -369,8 +372,8 @@ comes first.</p>
<td class="description last"><p>List of software to <td class="description last"><p>List of
encode or just raw user agent string</p></td> software to encode or just raw user agent string/Buffer</p></td>
</tr> </tr>
@ -471,7 +474,7 @@ encode or just raw user agent string</p></td>
<div class="description"> <div class="description">
<p>Encode bitmessage's user agent.</p> <p>Encode bitmessage's library user agent.</p>
</div> </div>
@ -515,7 +518,7 @@ encode or just raw user agent string</p></td>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="user-agent.js.html">user-agent.js</a>, <a href="user-agent.js.html#line96">line 96</a> <a href="user-agent.js.html">user-agent.js</a>, <a href="user-agent.js.html#line98">line 98</a>
</li></ul></dd> </li></ul></dd>
@ -575,8 +578,8 @@ encode or just raw user agent string</p></td>
<div class="description"> <div class="description">
<p>Encode user agent with bitmessage's user agent underneath. Most <p>Encode user agent with bitmessage's library user agent underneath.
underlying software comes first.</p> Most underlying software comes first.</p>
</div> </div>
@ -679,7 +682,7 @@ software to encode</p></td>
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="user-agent.js.html">user-agent.js</a>, <a href="user-agent.js.html#line107">line 107</a> <a href="user-agent.js.html">user-agent.js</a>, <a href="user-agent.js.html#line109">line 109</a>
</li></ul></dd> </li></ul></dd>
@ -898,13 +901,13 @@ format because it's not that important.</p>
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -151,7 +151,8 @@
<div class="description"> <div class="description">
<p>Decode WIF encoded private key.</p> <p>Decode WIF-encoded private key (corresponded to a uncompressed public
key).</p>
</div> </div>
@ -244,7 +245,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="wif.js.html">wif.js</a>, <a href="wif.js.html#line24">line 24</a> <a href="wif.js.html">wif.js</a>, <a href="wif.js.html#line25">line 25</a>
</li></ul></dd> </li></ul></dd>
@ -304,7 +305,8 @@
<div class="description"> <div class="description">
<p>Convert private key to a WIF.</p> <p>Convert private key to a WIF (corresponded to a uncompressed public
key).</p>
</div> </div>
@ -397,7 +399,7 @@
<dt class="tag-source">Source:</dt> <dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li> <dd class="tag-source"><ul class="dummy"><li>
<a href="wif.js.html">wif.js</a>, <a href="wif.js.html#line38">line 38</a> <a href="wif.js.html">wif.js</a>, <a href="wif.js.html#line40">line 40</a>
</li></ul></dd> </li></ul></dd>
@ -424,7 +426,7 @@
<div class="param-desc"> <div class="param-desc">
<p>Encoded private key.</p> <p>WIF-encoded private key.</p>
</div> </div>
@ -461,13 +463,13 @@
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:22 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

164
docs/net_base.js.html Normal file
View File

@ -0,0 +1,164 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: net/base.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: net/base.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* Networking base module. Defines base transport interface, useful for
* implementing new transports. End-users should import some transport
* instead in order to connect/accept connections to/from other nodes.
* **NOTE**: `BaseTransport` is exported as a module.
* @example var BaseTransport = require("bitmessage/net/base");
* @module bitmessage/net/base
*/
// TODO(Kagami): Write some sort of tutorial.
"use strict";
var inherits = require("inherits");
var EventEmitter = require("events").EventEmitter;
var PPromise = require("../platform").Promise;
var structs = require("../structs");
/**
* Base transport class. Allows to use single class for both client and
* server modes (as separate instances).
* @constructor
* @static
*/
function BaseTransport() {
BaseTransport.super_.call(this);
}
inherits(BaseTransport, EventEmitter);
/**
* Do the transport-specific bootstrap process and return promise that
* contains discovered nodes when fulfilled (both modes).
* NOTE: Do not use nodes received by this method in `addr` messages!
* This is meaningless.
* @return {Promise.&lt;Array>}
* @abstract
*/
BaseTransport.prototype.bootstrap = function() {
return PPromise.reject(new Error("Not implemented"));
};
/**
* Connect to the transport-specific address. Enters client mode. Should
* emit `open` event after successful connect and `established` event
* after `verack` messages exchange.
* @abstract
*/
BaseTransport.prototype.connect = function() {
throw new Error("Not implemented");
};
/**
* Listen for the transport-specific incoming connections. Enters server
* mode. Should emit `connection` event with a transport instance for
* each new connection.
* @abstract
*/
BaseTransport.prototype.listen = function() {
throw new Error("Not implemented");
};
/**
* Send [message]{@link module:bitmessage/structs.message} over the
* wire (client mode only).
* @param {(Buffer|string)} msg - Encoded message or command string
* @param {Buffer=} payload - Message payload (used if the first
* argument is a string)
* @abstract
*/
BaseTransport.prototype.send = function() {
throw new Error("Not implemented");
};
/**
* Send [message]{@link module:bitmessage/structs.message} to all
* connected clients (server mode only).
* @param {(Buffer|string)} msg - Encoded message or command string
* @param {Buffer=} payload - Message payload (used if the first
* argument is a string)
* @abstract
*/
BaseTransport.prototype.broadcast = function() {
throw new Error("Not implemented");
};
/**
* Close connection(s) and/or stop listening (both modes).
* @abstract
*/
BaseTransport.prototype.close = function() {
throw new Error("Not implemented");
};
// Static private helpers.
BaseTransport._getmsg = function(args) {
if (typeof args[0] === "string") {
return structs.message.encode(args[0], args[1]);
} else {
return args[0];
}
};
// Unmap IPv4-mapped IPv6 address.
BaseTransport._unmap = function(addr) {
if (addr.slice(0, 7) === "::ffff:") {
return addr.slice(7);
} else {
return addr;
}
};
module.exports = BaseTransport;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

377
docs/net_tcp.js.html Normal file
View File

@ -0,0 +1,377 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: net/tcp.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: net/tcp.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* TCP transport compatible with PyBitmessage. Available only for Node
* platform.
* **NOTE**: `TcpTransport` is exported as a module.
* @module bitmessage/net/tcp
* @example
* var messages = require("bitmessage").messages;
* var TcpTransport = require("bitmessage/net/tcp");
*
* var tcp = new TcpTransport({
* dnsSeeds: [["bootstrap8444.bitmessage.org", 8444]],
* });
*
* tcp.bootstrap().then(function(nodes) {
* var remoteHost = nodes[0][0];
* var remotePort = nodes[0][1];
* console.log("Connecting to", nodes[0]);
* tcp.connect(remotePort, remoteHost);
* });
*
* tcp.on("established", function() {
* console.log("Connection established");
*
* tcp.on("message", function(command, payload) {
* console.log("Got new", command, "message");
* var decoded;
* if (command === "addr") {
* decoded = messages.addr.decodePayload(payload);
* console.log("Got", decoded.addrs.length, "node addresses");
* }
* });
* });
*/
"use strict";
var objectAssign = Object.assign || require("object-assign");
var inherits = require("inherits");
var net = require("net");
var dns = require("dns");
var assert = require("../_util").assert;
var PPromise = require("../platform").Promise;
var structs = require("../structs");
var messages = require("../messages");
var BaseTransport = require("./base");
var getmsg = BaseTransport._getmsg;
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
*/
function TcpTransport(opts) {
TcpTransport.super_.call(this);
objectAssign(this, opts);
this.seeds = this.seeds || [];
this.dnsSeeds = this.dnsSeeds || [];
this._clients = {};
}
inherits(TcpTransport, BaseTransport);
function getfrom(client) {
return unmap(client.remoteAddress) + ":" + client.remotePort;
}
TcpTransport.prototype._sendVersion = function() {
return this.send(messages.version.encode({
services: this.services,
userAgent: this.userAgent,
streamNumbers: this.streamNumbers,
port: this.port,
remoteHost: this._client.remoteAddress,
remotePort: this._client.remotePort,
}));
};
TcpTransport.prototype._setupClient = function(client, accepted) {
var self = this;
self._client = client;
var cache = Buffer(0);
var decoded;
var verackSent = false;
var verackReceived = false;
var established = false;
// Set default transport timeout per spec.
// TODO(Kagami): We may also want to close connection if it wasn't
// established within minute.
client.setTimeout(20000);
client.on("connect", function() {
// NOTE(Kagami): This handler shouldn't be called at all for
// accepted sockets but let's be sure.
if (!accepted) {
self.emit("open");
self._sendVersion();
}
});
client.on("data", function(data) {
// TODO(Kagami): We may want to preallocate 1.6M buffer for each
// client instead (max size of the message) to not constantly
// allocate new buffers. Though this may lead to another issues: too
// many memory per client.
cache = Buffer.concat([cache, data]);
while (true) {
decoded = structs.message.tryDecode(cache);
if (!decoded) {
break;
}
cache = decoded.rest;
if (decoded.message) {
self.emit(
"message",
decoded.message.command,
decoded.message.payload,
decoded.message);
} else if (decoded.error) {
// TODO(Kagami): Wrap it in custom error class?
// TODO(Kagami): Send `error` message and ban node for some time
// if there were too many errors?
self.emit("warning", new Error(
"Message decoding error from " + getfrom(client) + ": " +
decoded.error
));
}
}
});
// High-level message processing.
self.on("message", function(command) {
if (!established) {
// TODO: Process version data.
// TODO: Disconnect if proto version &lt; 3.
if (command === "version") {
if (verackSent) {
return;
}
self.send("verack");
verackSent = true;
if (accepted) {
self._sendVersion();
} else if (verackReceived) {
self.emit("established");
}
} else if (command === "verack") {
verackReceived = true;
if (verackSent) {
self.emit("established");
}
}
}
});
self.on("established", function() {
established = true;
// Raise timeout up to 10 minutes per spec.
// TODO(Kagami): Send pong messages every 5 minutes as PyBitmessage.
client.setTimeout(600000);
});
client.on("timeout", function() {
client.end();
});
client.on("error", function(err) {
self.emit("error", err);
});
client.on("close", function() {
self.emit("close");
delete self._client;
});
};
function resolveDnsSeed(seed) {
var host = seed[0];
var port = seed[1];
var nodes = [];
// NOTE(Kagami):
// 1) Node's `getaddrinfo` (`dns.lookup`) returns only one address so
// we can't use it.
// 2) Node's `dig host any` (`dns.resolve`) doesn't return type of the
// record! So we resolve twice for A and AAAA.
// 3) We ignore any errors here, promise's result is always a list.
return new PPromise(function(resolve) {
dns.resolve4(host, function(err, nodes4) {
if (!err) {
nodes4.forEach(function(n) {
nodes.push([n, port]);
});
}
dns.resolve6(host, function(err, nodes6) {
if (!err) {
nodes6.forEach(function(n) {
nodes.push([n, port]);
});
}
resolve(nodes);
});
});
});
}
TcpTransport.prototype.bootstrap = function() {
var promises = this.dnsSeeds.map(resolveDnsSeed);
var hardcodedNodes = this.seeds;
// FIXME(Kagami): Filter incorrect/private IP range nodes?
// See also: &lt;https://github.com/Bitmessage/PyBitmessage/issues/768>.
return PPromise.all(promises).then(function(dnsNodes) {
// Flatten array of arrays.
dnsNodes = Array.prototype.concat.apply([], dnsNodes);
// Add hardcoded nodes to the end of list because DNS nodes should
// be more up-to-date.
return dnsNodes.concat(hardcodedNodes);
});
};
/**
* Connect to a TCP node. Connection arguments are the same as for
* [net.connect](http://nodejs.org/api/net.html#net_net_connect_port_host_connectlistener).
*/
TcpTransport.prototype.connect = function() {
assert(!this._client, "Already connected");
assert(!this._server, "Already listening");
this._setupClient(net.connect.apply(null, arguments));
};
/**
* Listen for incoming TCP connections. Listen arguments are the same as
* for
* [server.listen](http://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback).
*/
TcpTransport.prototype.listen = function() {
assert(!this._client, "Already connected");
assert(!this._server, "Already listening");
var self = this;
var server = self._server = net.createServer();
server.listen.apply(server, arguments);
// TODO(Kagami): We may want to specify some limits for number of
// connected users.
server.on("connection", function(client) {
var addr = client.remoteAddress;
var port = client.remotePort;
if (self._clients[addr]) {
// NOTE(Kagami): Doesn't allow more than one connection per IP.
// This may obstruct people behind NAT but we copy PyBitmessage's
// behavior here.
client.end();
return self.emit("warning", new Error(
unmap(addr) + " was tried to create second connection"
));
}
self._clients[addr] = client;
client.on("close", function() {
delete self._clients[addr];
});
var transport = new self.constructor(self);
var accepted = true;
transport._setupClient(client, accepted);
self.emit("connection", transport, unmap(addr), port);
// Emit "open" manually because "connect" for this socket won't be
// fired.
transport.emit("open");
});
server.on("error", function(err) {
self.emit("error", err);
});
server.on("close", function() {
self.emit("close");
delete self._server;
});
};
TcpTransport.prototype.send = function() {
if (this._client) {
this._client.write(getmsg(arguments));
} else {
throw new Error("Not connected");
}
};
TcpTransport.prototype.broadcast = function() {
var data = getmsg(arguments);
if (this._server) {
Object.keys(this._clients).forEach(function(ip) {
this._clients[ip].write(data);
}, this);
} else {
throw new Error("Not listening");
}
};
TcpTransport.prototype.close = function() {
if (this._client) {
this._client.end();
} else if (this._server) {
Object.keys(this._clients).forEach(function(ip) {
this._clients[ip].end();
}, this);
this._server.close();
}
};
module.exports = TcpTransport;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

307
docs/net_ws.js.html Normal file
View File

@ -0,0 +1,307 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: net/ws.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: net/ws.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* WebSocket transport. Needed because browsers can't handle TCP sockets
* so we use separate WebSocket server to proxy messages into TCP data
* packets. Available for both Node.js and Browser platforms.
* **NOTE**: `WsTransport` is exported as a module.
* @example var WsTransport = require("bitmessage/net/ws");
* @module bitmessage/net/ws
*/
"use strict";
var objectAssign = Object.assign || require("object-assign");
var inherits = require("inherits");
var WebSocket = require("ws"); // jshint ignore:line
var assert = require("../_util").assert;
var PPromise = require("../platform").Promise;
var structs = require("../structs");
var messages = require("../messages");
var BaseTransport = require("./base");
var WebSocketServer = WebSocket.Server;
var getmsg = BaseTransport._getmsg;
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
*/
function WsTransport(opts) {
WsTransport.super_.call(this);
objectAssign(this, opts);
this.seeds = this.seeds || [];
}
inherits(WsTransport, BaseTransport);
function getfrom(client) {
return unmap(client._socket.remoteAddress) + ":" + client._socket.remotePort;
}
WsTransport.prototype._sendVersion = function() {
return this.send(messages.version.encode({
services: this.services,
userAgent: this.userAgent,
streamNumbers: this.streamNumbers,
port: this.port,
remoteHost: this._client._socket.remoteAddress,
remotePort: this._client._socket.remotePort,
}));
};
WsTransport.prototype._handleTimeout = function() {
var client = this._client;
// TODO(Kagami): We may also want to close connection if it wasn't
// established within minute.
client._socket.setTimeout(20000);
client._socket.on("timeout", function() {
client.close();
});
this.on("established", function() {
// Raise timeout up to 10 minutes per spec.
// TODO(Kagami): Send ping frame every 5 minutes as PyBitmessage.
client._socket.setTimeout(600000);
});
};
WsTransport.prototype._setupClient = function(client, accepted) {
var self = this;
self._client = client;
var verackSent = false;
var verackReceived = false;
var established = false;
client.on("open", function() {
// NOTE(Kagami): This handler shouldn't be called at all for
// accepted sockets but let's be sure.
if (!accepted) {
// NOTE(Kagami): We may set timeout only after connection was
// opened because socket may not yet be available when
// `_setupClient` is called.
self._handleTimeout();
self.emit("open");
self._sendVersion();
}
});
client.on("message", function(data, flags) {
var decoded;
if (!flags.binary) {
// TODO(Kagami): Send `error` message and ban node for some time
// if there were too many errors?
return self.emit("warning", new Error(
"Peer " + getfrom(client) + " sent non-binary data"
));
}
try {
decoded = structs.message.decode(data);
} catch (err) {
return self.emit("warning", new Error(
"Message decoding error from " + getfrom(client) + ": " + err
));
}
self.emit("message", decoded.command, decoded.payload, decoded);
});
// High-level message processing.
self.on("message", function(command) {
if (!established) {
// TODO: Process version data.
// TODO: Disconnect if proto version &lt; 3.
if (command === "version") {
if (verackSent) {
return;
}
self.send("verack");
verackSent = true;
if (accepted) {
self._sendVersion();
} else if (verackReceived) {
established = true;
self.emit("established");
}
} else if (command === "verack") {
verackReceived = true;
if (verackSent) {
established = true;
self.emit("established");
}
}
}
});
client.on("error", function(err) {
self.emit("error", err);
});
client.on("close", function() {
self.emit("close");
delete self._client;
});
};
WsTransport.prototype.bootstrap = function() {
return PPromise.resolve([].concat(this.seeds));
};
/**
* Connect to a WebSocket node. Connection arguments are the same as for
* [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).
*/
WsTransport.prototype.connect = function(address, protocols, options) {
assert(!this._client, "Already connected");
assert(!this._server, "Already listening");
// `new` doesn't work with `apply`, so passing all possible arguments
// manually.
this._setupClient(new WebSocket(address, protocols, options));
};
/**
* Listen for incoming WebSocket connections. Listen arguments are the
* same as for
* [WebSocketServer](https://github.com/websockets/ws#server-example).
* Available only for Node platform.
*/
WsTransport.prototype.listen = function(options, callback) {
assert(!this._client, "Already connected");
assert(!this._server, "Already listening");
var self = this;
var server = self._server = new WebSocketServer(options, callback);
// TODO(Kagami): We may want to specify some limits for number of
// connected users.
server.on("connection", function(client) {
var addr = client._socket.remoteAddress;
var port = client._remotePort;
var i;
// NOTE(Kagami): O(n) search because `clients` array is already
// provided by `ws` library. We may want to optmize it though and
// also disable `clientTracking` option.
for (i = 0; i &lt; server.clients.length; i++) {
if (server.clients[i] !== client &amp;&amp;
server.clients[i]._socket.remoteAddress === addr) {
// NOTE(Kagami): Doesn't allow more than one connection per IP.
// This may obstruct people behind NAT but we copy
// PyBitmessage's behavior here.
client.close();
return self.emit("warning", new Error(
unmap(addr) + " was tried to create second connection"
));
}
}
var transport = new self.constructor(self);
var accepted = true;
transport._setupClient(client, accepted);
transport._handleTimeout();
self.emit("connection", transport, unmap(addr), port);
// Emit "open" manually because it won't be fired for already opened
// socket.
transport.emit("open");
});
server.on("error", function(err) {
self.emit("error", err);
});
};
WsTransport.prototype.send = function() {
if (this._client) {
// TODO(Kagami): `mask: true` doesn't work with Chromium 40. File a
// bug to ws bugtracker.
this._client.send(getmsg(arguments), {binary: true});
} else {
throw new Error("Not connected");
}
};
WsTransport.prototype.broadcast = function() {
var data = getmsg(arguments);
if (this._server) {
this._server.clients.forEach(function(client) {
client.send(data, {binary: true});
});
} else {
throw new Error("Not listening");
}
};
WsTransport.prototype.close = function() {
if (this._client) {
this._client.close();
} else if (this._server) {
// `ws` server terminates immediately without any events.
this._server.close();
this.emit("close");
delete this._server;
}
};
module.exports = WsTransport;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>

View File

@ -28,22 +28,18 @@
<article> <article>
<pre class="prettyprint source linenums"><code>/** <pre class="prettyprint source linenums"><code>/**
* Working with objects. * Working with objects.
* NOTE: Most operations with objects in this module are asynchronous * NOTE: Most operations with objects are asynchronous and return
* and return promises. * promises.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Object_types} * @see {@link https://bitmessage.org/wiki/Protocol_specification#Object_types}
* @module bitmessage/objects * @module bitmessage/objects
*/ */
// TODO(Kagami): Document object-like params.
// FIXME(Kagami): Think through the API, we may want to get decoded
// structure even if it contains unsupported version. Also error
// handling may need some refactoring.
"use strict"; "use strict";
var objectAssign = Object.assign || require("object-assign"); var objectAssign = Object.assign || require("object-assign");
var bufferEqual = require("buffer-equal"); var bufferEqual = require("buffer-equal");
var assert = require("./_util").assert; var assert = require("./_util").assert;
var promise = require("./platform").promise; var PPromise = require("./platform").Promise;
var bmcrypto = require("./crypto"); var bmcrypto = require("./crypto");
var Address = require("./address"); var Address = require("./address");
var structs = require("./structs"); var structs = require("./structs");
@ -76,14 +72,7 @@ exports.getType = function(buf) {
/** /**
* Try to get type of the given object message payload. * Try to get type of the given object message payload.
* Note that this function doesn't do any validation because it is * The same as [getType]{@link module:bitmessage/objects.getType}.
* already provided by
* [object.decodePayload]{@link module:bitmessage/structs.object.decodePayload}
* routine. Normally you call this for each incoming object message
* payload and then call decode function of the appropriate object
* handler.
* @param {Buffer} buf - Buffer that starts with object message payload
* @return {?number} Object's type if any.
*/ */
exports.getPayloadType = function(buf) { exports.getPayloadType = function(buf) {
// Object header: 8 + 8 + 4 // Object header: 8 + 8 + 4
@ -95,7 +84,7 @@ exports.getPayloadType = function(buf) {
// Prepend nonce to a given object without nonce. // Prepend nonce to a given object without nonce.
function prependNonce(obj, opts) { function prependNonce(obj, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
assert(obj.length &lt;= 262136, "object message payload is too big"); assert(obj.length &lt;= 262136, "object message payload is too big");
opts = objectAssign({}, opts); opts = objectAssign({}, opts);
var nonce, target, powp; var nonce, target, powp;
@ -129,15 +118,33 @@ function prependNonce(obj, opts) {
* @static * @static
*/ */
var getpubkey = exports.getpubkey = { var getpubkey = exports.getpubkey = {
/**
* @typedef {Object} DecodeResult
* @property {Buffer} nonce - A 8-byte object nonce
* @property {number} ttl - Time to live in seconds
* @property {number} type - Object type
* @property {number} version - Object version
* @property {number} stream - Object stream
* @property {number} headerLength - Length of the object header
* @property {Buffer} ripe - The RIPEMD hash of the requested public
* keys for address version &lt;= 3
* @property {Buffer} tag - ...or tag derived from the address object
* for address version >= 4
* @property {number} length - Real data length
* @memberof module:bitmessage/objects.getpubkey
*/
/** /**
* Decode `getpubkey` object message. * Decode `getpubkey` object message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @param {?Object} opts - Decoding options * @param {Object=} opts - Any of [object.decode]{@link
* @return {Promise.&lt;Object>} A promise that contains decoded * module:bitmessage/structs.object.decode} options
* `getpubkey` object structure when fulfilled. * @return {Promise.&lt;DecodeResult>} A promise that contains
* [decoded `getpubkey` structure]{@link
* module:bitmessage/objects.getpubkey.DecodeResult} when fulfilled.
*/ */
decodeAsync: function(buf, opts) { decodeAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
assert(decoded.command === "object", "Bad command"); assert(decoded.command === "object", "Bad command");
resolve(getpubkey.decodePayloadAsync(decoded.payload, opts)); resolve(getpubkey.decodePayloadAsync(decoded.payload, opts));
@ -146,13 +153,11 @@ var getpubkey = exports.getpubkey = {
/** /**
* Decode `getpubkey` object message payload. * Decode `getpubkey` object message payload.
* @param {Buffer} buf - Message payload * The same as [decodeAsync]{@link
* @param {?Object} opts - Decoding options * module:bitmessage/objects.getpubkey.decodeAsync}.
* @return {Promise.&lt;Object>} A promise that contains decoded
* `getpubkey` object structure when fulfilled.
*/ */
decodePayloadAsync: function(buf, opts) { decodePayloadAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var decoded = object.decodePayload(buf, opts); var decoded = object.decodePayload(buf, opts);
assert(decoded.type === object.GETPUBKEY, "Wrong object type"); assert(decoded.type === object.GETPUBKEY, "Wrong object type");
assert(decoded.version >= 2, "getpubkey version is too low"); assert(decoded.version >= 2, "getpubkey version is too low");
@ -174,6 +179,10 @@ var getpubkey = exports.getpubkey = {
/** /**
* Encode `getpubkey` object message. * Encode `getpubkey` object message.
* @param {Object} opts - `getpubkey` object options * @param {Object} opts - `getpubkey` object options
* @param {number} opts.ttl - Time to live in seconds
* @param {Address} opts.to - Receiver of the message
* @param {boolean=} opts.skipPow - Do not compute POW (false by
* default)
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * @return {Promise.&lt;Buffer>} A promise that contains encoded message
* when fulfilled. * when fulfilled.
*/ */
@ -185,12 +194,11 @@ var getpubkey = exports.getpubkey = {
/** /**
* Encode `getpubkey` object message payload. * Encode `getpubkey` object message payload.
* @param {Object} opts - `getpubkey` object options * The same as
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * [encodeAsync]{@link module:bitmessage/objects.getpubkey.encodeAsync}.
* payload when fulfilled.
*/ */
encodePayloadAsync: function(opts) { encodePayloadAsync: function(opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
opts = objectAssign({}, opts); opts = objectAssign({}, opts);
opts.type = object.GETPUBKEY; opts.type = object.GETPUBKEY;
// Bitmessage address of recepeint of `getpubkey` message. // Bitmessage address of recepeint of `getpubkey` message.
@ -270,15 +278,48 @@ function findAddrByTag(addrs, tag) {
* @static * @static
*/ */
var pubkey = exports.pubkey = { var pubkey = exports.pubkey = {
/**
* @typedef {Object} DecodeResult
* @property {Buffer} nonce - A 8-byte object nonce
* @property {number} ttl - Time to live in seconds
* @property {number} type - Object type
* @property {number} version - Object version
* @property {number} stream - Object stream
* @property {number} headerLength - Length of the object header
* @property {Buffer} tag - Tag derived from the address object
* (present only if object version is 4)
* @property {Object} behavior - [Pubkey features]{@link
* module:bitmessage/structs.PubkeyBitfield} that can be expected from
* the node
* @property {Buffer} signPublicKey - Signing public key
* @property {Buffer} encPublicKey - Encryption public key
* @property {number} nonceTrialsPerByte - Difficulty parameter of the
* node (present only for `pubkey` version >= 3)
* @property {number} payloadLengthExtraBytes - Difficulty parameter
* of the node (present only for `pubkey` version >= 3)
* @property {Buffer} signature - Signature of the message (present
* only for `pubkey` version >= 3)
* @property {number} length - Real data length
* @memberof module:bitmessage/objects.pubkey
*/
/** /**
* Decode `pubkey` object message. * Decode `pubkey` object message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @param {?Object} opts - Decoding options * @param {Object=} opts - Any of [object.decode]{@link
* @return {Promise.&lt;Object>} A promise that contains decoded `pubkey` * module:bitmessage/structs.object.decode} options and:
* object structure when fulfilled. * @param {(Address[]|Address|Object)} opts.needed - Address objects
* which represent pubkeys that we are interested in (used only for
* pubkeys v4). It is either addresses array or single address or
* Object addr-by-tag. Time to match the key is O(n), O(1), O(1)
* respectfully.
* @return {Promise.&lt;DecodeResult>} A promise that contains
* [decoded `pubkey` structure]{@link
* module:bitmessage/objects.pubkey.DecodeResult}
* when fulfilled.
*/ */
decodeAsync: function(buf, opts) { decodeAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
assert(decoded.command === "object", "Bad command"); assert(decoded.command === "object", "Bad command");
resolve(pubkey.decodePayloadAsync(decoded.payload, opts)); resolve(pubkey.decodePayloadAsync(decoded.payload, opts));
@ -287,13 +328,11 @@ var pubkey = exports.pubkey = {
/** /**
* Decode `pubkey` object message payload. * Decode `pubkey` object message payload.
* @param {Buffer} buf - Message payload * The same as [decodeAsync]{@link
* @param {?Object} opts - Decoding options * module:bitmessage/objects.pubkey.decodeAsync}.
* @return {Promise.&lt;Object>} A promise that contains decoded `pubkey`
* object structure when fulfilled.
*/ */
decodePayloadAsync: function(buf, opts) { decodePayloadAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
opts = opts || {}; opts = opts || {};
var decoded = object.decodePayload(buf, opts); var decoded = object.decodePayload(buf, opts);
assert(decoded.type === object.PUBKEY, "Wrong object type"); assert(decoded.type === object.PUBKEY, "Wrong object type");
@ -369,6 +408,11 @@ var pubkey = exports.pubkey = {
/** /**
* Encode `pubkey` object message. * Encode `pubkey` object message.
* @param {Object} opts - `pubkey` object options * @param {Object} opts - `pubkey` object options
* @param {number} opts.ttl - Time to live in seconds
* @param {Address} opts.from - Originator of the message
* @param {Address} opts.to - Receiver of the message
* @param {boolean=} opts.skipPow - Do not compute POW (false by
* default)
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * @return {Promise.&lt;Buffer>} A promise that contains encoded message
* when fulfilled. * when fulfilled.
*/ */
@ -380,12 +424,11 @@ var pubkey = exports.pubkey = {
/** /**
* Encode `pubkey` object message payload. * Encode `pubkey` object message payload.
* @param {Object} opts - `pubkey` object options * The same as [encodeAsync]{@link
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * module:bitmessage/objects.pubkey.encodeAsync}.
* payload when fulfilled.
*/ */
encodePayloadAsync: function(opts) { encodePayloadAsync: function(opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
opts = objectAssign({}, opts); opts = objectAssign({}, opts);
opts.type = object.PUBKEY; opts.type = object.PUBKEY;
// Originator of `pubkey` message. // Originator of `pubkey` message.
@ -465,8 +508,9 @@ var pubkey = exports.pubkey = {
function tryDecryptMsg(identities, buf) { function tryDecryptMsg(identities, buf) {
function inner(i) { function inner(i) {
if (i > last) { if (i > last) {
var err = new Error("Failed to decrypt msg with given identities"); return PPromise.reject(
return promise.reject(err); new Error("Failed to decrypt msg with given identities")
);
} }
return bmcrypto return bmcrypto
.decrypt(identities[i].encPrivateKey, buf) .decrypt(identities[i].encPrivateKey, buf)
@ -567,15 +611,52 @@ var msg = exports.msg = {
*/ */
SIMPLE: 2, SIMPLE: 2,
/**
* @typedef {Object} DecodeResult
* @property {Buffer} nonce - A 8-byte object nonce
* @property {number} ttl - Time to live in seconds
* @property {number} type - Object type
* @property {number} version - Object version
* @property {number} stream - Object stream
* @property {number} headerLength - Length of the object header
* @property {number} senderVersion - Sender's address version
* @property {number} senderStream - Sender's stream
* @property {Object} behavior - Sender's [pubkey features]{@link
* module:bitmessage/structs.PubkeyBitfield} that can be expected from
* the node
* @property {Buffer} signPublicKey - Sender's signing public key
* @property {Buffer} encPublicKey - Sender's encryption public key
* @property {number} nonceTrialsPerByte - Difficulty parameter of the
* sender (present only if sender's address version >= 3)
* @property {number} payloadLengthExtraBytes - Difficulty parameter
* of the sender (present only if sender's address version >= 3)
* @property {Buffer} ripe - The RIPEMD hash of the receiver's keys
* @property {number} encoding - Message encoding
* @property {(string|Buffer)} message - Message string for
* [TRIVIAL]{@link module:bitmessage/objects.msg.TRIVIAL} and
* [SIMPLE]{@link module:bitmessage/objects.msg.SIMPLE} encodings or
* unparsed buffer data for other encodings
* @property {string=} subject - Subject string for [SIMPLE]{@link
* module:bitmessage/objects.msg.SIMPLE} encoding
* @property {Buffer} ack - Message acknowledgement
* @property {Buffer} signature - Signature of the message
* @property {number} length - Real data length
* @memberof module:bitmessage/objects.msg
*/
/** /**
* Decode `msg` object message. * Decode `msg` object message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @param {Object} opts - Decoding options * @param {Object} opts - Any of [object.decode]{@link
* @return {Promise.&lt;Object>} A promise that contains decoded `msg` * module:bitmessage/structs.object.decode} options and:
* object structure when fulfilled. * @param {(Address[]|Address)} opts.identities - Address objects used
* to decrypt the message
* @return {Promise.&lt;DecodeResult>} A promise that contains [decoded
* `msg` structure]{@link module:bitmessage/objects.msg.DecodeResult}
* when fulfilled.
*/ */
decodeAsync: function(buf, opts) { decodeAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
assert(decoded.command === "object", "Bad command"); assert(decoded.command === "object", "Bad command");
resolve(msg.decodePayloadAsync(decoded.payload, opts)); resolve(msg.decodePayloadAsync(decoded.payload, opts));
@ -584,13 +665,11 @@ var msg = exports.msg = {
/** /**
* Decode `msg` object message payload. * Decode `msg` object message payload.
* @param {Buffer} buf - Message payload * The same as [decodeAsync]{@link
* @param {Object} opts - Decoding options * module:bitmessage/objects.msg.decodeAsync}.
* @return {Promise.&lt;Object>} A promise that contains decoded `msg`
* object structure when fulfilled.
*/ */
decodePayloadAsync: function(buf, opts) { decodePayloadAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var decoded = object.decodePayload(buf, opts); var decoded = object.decodePayload(buf, opts);
assert(decoded.type === object.MSG, "Bad object type"); assert(decoded.type === object.MSG, "Bad object type");
assert(decoded.version === 1, "Bad msg version"); assert(decoded.version === 1, "Bad msg version");
@ -617,7 +696,7 @@ var msg = exports.msg = {
var rest = decrypted.slice(decoded.length); var rest = decrypted.slice(decoded.length);
// Pow extra. // Pow extra.
if (decoded.senderVersion >= 3) { if (senderVersion >= 3) {
var decodedTrials = var_int.decode(rest); var decodedTrials = var_int.decode(rest);
decoded.nonceTrialsPerByte = decodedTrials.value; decoded.nonceTrialsPerByte = decodedTrials.value;
decoded.length += decodedTrials.length; decoded.length += decodedTrials.length;
@ -685,6 +764,18 @@ var msg = exports.msg = {
/** /**
* Encode `msg` object message. * Encode `msg` object message.
* @param {Object} opts - `msg` object options * @param {Object} opts - `msg` object options
* @param {number} opts.ttl - Time to live in seconds
* @param {Address} opts.from - Originator of the message
* @param {Address} opts.to - Receiver of the message
* @param {(string|Buffer)} opts.message - Message
* @param {(string|Buffer)=} opts.subject - Subject for [SIMPLE]{@link
* module:bitmessage/objects.msg.SIMPLE} encoding
* @param {number=} opts.encoding - Encoding of the message
* ([TRIVIAL]{@link module:bitmessage/objects.msg.TRIVIAL} by default)
* @param {boolean=} opts.friend - Whether the receiver is friend and
* should have minimal POW difficulty (false by default)
* @param {boolean=} opts.skipPow - Do not compute POW (false by
* default)
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * @return {Promise.&lt;Buffer>} A promise that contains encoded message
* when fulfilled. * when fulfilled.
*/ */
@ -696,12 +787,11 @@ var msg = exports.msg = {
/** /**
* Encode `msg` object message payload. * Encode `msg` object message payload.
* @param {Object} opts - `msg` object options * The same as [encodeAsync]{@link
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * module:bitmessage/objects.msg.encodeAsync}.
* payload when fulfilled.
*/ */
encodePayloadAsync: function(opts) { encodePayloadAsync: function(opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
// Deal with options. // Deal with options.
opts = objectAssign({}, opts); opts = objectAssign({}, opts);
opts.type = object.MSG; opts.type = object.MSG;
@ -776,8 +866,9 @@ var DEFAULT_ENCODING = msg.TRIVIAL;
function tryDecryptBroadcastV4(subscriptions, buf) { function tryDecryptBroadcastV4(subscriptions, buf) {
function inner(i) { function inner(i) {
if (i > last) { if (i > last) {
var err = new Error("Failed to decrypt broadcast with given identities"); return PPromise.reject(
return promise.reject(err); new Error("Failed to decrypt broadcast with given identities")
);
} }
return bmcrypto return bmcrypto
.decrypt(subscriptions[i].getBroadcastPrivateKey(), buf) .decrypt(subscriptions[i].getBroadcastPrivateKey(), buf)
@ -810,15 +901,55 @@ function tryDecryptBroadcastV4(subscriptions, buf) {
* @static * @static
*/ */
var broadcast = exports.broadcast = { var broadcast = exports.broadcast = {
/**
* @typedef {Object} DecodeResult
* @property {Buffer} nonce - A 8-byte object nonce
* @property {number} ttl - Time to live in seconds
* @property {number} type - Object type
* @property {number} version - Object version
* @property {number} stream - Object stream
* @property {number} headerLength - Length of the object header
* @property {Buffer} tag - Tag derived from the address object used
* to send this `broadcast` (present only for object version >= 5)
* @property {number} senderVersion - Sender's address version
* @property {number} senderStream - Sender's stream
* @property {Object} behavior - Sender's [pubkey features]{@link
* module:bitmessage/structs.PubkeyBitfield} that can be expected from
* the node
* @property {Buffer} signPublicKey - Sender's signing public key
* @property {Buffer} encPublicKey - Sender's encryption public key
* @property {number} nonceTrialsPerByte - Difficulty parameter of the
* sender (present only if sender's address version >= 3)
* @property {number} payloadLengthExtraBytes - Difficulty parameter
* of the sender (present only if sender's address version >= 3)
* @property {number} encoding - Message encoding
* @property {(string|Buffer)} message - Message string for
* [TRIVIAL]{@link module:bitmessage/objects.msg.TRIVIAL} and
* [SIMPLE]{@link module:bitmessage/objects.msg.SIMPLE} encodings or
* unparsed buffer data for other encodings
* @property {string=} subject - Subject string for [SIMPLE]{@link
* module:bitmessage/objects.msg.SIMPLE} encoding
* @property {Buffer} signature - Signature of the message
* @property {number} length - Real data length
* @memberof module:bitmessage/objects.broadcast
*/
/** /**
* Decode `broadcast` object message. * Decode `broadcast` object message.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @param {Object} opts - Decoding options * @param {Object} opts - Any of [object.decode]{@link
* @return {Promise.&lt;Object>} A promise that contains decoded * module:bitmessage/structs.object.decode} options and:
* `broadcast` object structure when fulfilled. * @param {(Address[]|Address|Object)} opts.subscriptions - Address
* objects which represent broadcast subscriptions. It is either
* addresses array or single address or Object
* addr-by-tag/addr-by-ripe. Time to match the key is O(n), O(1), O(1)
* respectfully.
* @return {Promise.&lt;DecodeResult>} A promise that contains
* [decoded `broadcast` structure]{@link
* module:bitmessage/objects.broadcast.DecodeResult} when fulfilled.
*/ */
decodeAsync: function(buf, opts) { decodeAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
assert(decoded.command === "object", "Bad command"); assert(decoded.command === "object", "Bad command");
resolve(broadcast.decodePayloadAsync(decoded.payload, opts)); resolve(broadcast.decodePayloadAsync(decoded.payload, opts));
@ -827,13 +958,11 @@ var broadcast = exports.broadcast = {
/** /**
* Decode `broadcast` object message payload. * Decode `broadcast` object message payload.
* @param {Buffer} buf - Message payload * The same as [decodeAsync]{@link
* @param {Object} opts - Decoding options * module:bitmessage/objects.broadcast.decodeAsync}.
* @return {Promise.&lt;Object>} A promise that contains decoded `pubkey`
* object structure when fulfilled.
*/ */
decodePayloadAsync: function(buf, opts) { decodePayloadAsync: function(buf, opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
var decoded = object.decodePayload(buf, opts); var decoded = object.decodePayload(buf, opts);
assert(decoded.type === object.BROADCAST, "Bad object type"); assert(decoded.type === object.BROADCAST, "Bad object type");
var version = decoded.version; var version = decoded.version;
@ -957,6 +1086,15 @@ var broadcast = exports.broadcast = {
/** /**
* Encode `broadcast` object message. * Encode `broadcast` object message.
* @param {Object} opts - `broadcast` object options * @param {Object} opts - `broadcast` object options
* @param {number} opts.ttl - Time to live in seconds
* @param {Address} opts.from - Originator of the message
* @param {(string|Buffer)} opts.message - Message
* @param {(string|Buffer)=} opts.subject - Subject for [SIMPLE]{@link
* module:bitmessage/objects.msg.SIMPLE} encoding
* @param {number=} opts.encoding - Encoding of the message
* ([TRIVIAL]{@link module:bitmessage/objects.msg.TRIVIAL} by default)
* @param {boolean=} opts.skipPow - Do not compute POW (false by
* default)
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * @return {Promise.&lt;Buffer>} A promise that contains encoded message
* when fulfilled. * when fulfilled.
*/ */
@ -968,12 +1106,11 @@ var broadcast = exports.broadcast = {
/** /**
* Encode `broadcast` object message payload. * Encode `broadcast` object message payload.
* @param {Object} opts - `broadcast` object options * The same as [encodeAsync]{@link
* @return {Promise.&lt;Buffer>} A promise that contains encoded message * module:bitmessage/objects.broadcast.encodeAsync}.
* payload when fulfilled.
*/ */
encodePayloadAsync: function(opts) { encodePayloadAsync: function(opts) {
return new promise(function(resolve) { return new PPromise(function(resolve) {
// Deal with options. // Deal with options.
opts = objectAssign({}, opts); opts = objectAssign({}, opts);
opts.type = object.BROADCAST; opts.type = object.BROADCAST;
@ -1033,13 +1170,13 @@ var broadcast = exports.broadcast = {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -31,7 +31,6 @@
* @see {@link https://bitmessage.org/wiki/Proof_of_work} * @see {@link https://bitmessage.org/wiki/Proof_of_work}
* @module bitmessage/pow * @module bitmessage/pow
*/ */
// TODO(Kagami): Find a way how to document object params properly.
"use strict"; "use strict";
@ -43,6 +42,18 @@ var util = require("./_util");
/** /**
* Calculate target. * Calculate target.
* @param {Object} opts - Target options * @param {Object} opts - Target options
* @param {number} opts.ttl - Time to live of the message in seconds
* @param {number} opts.payloadLength - Length of the message payload
* (with nonce)
* @param {Buffer} opts.payload - ...or payload itself
* @param {number=} opts.nonceTrialsPerByte - This number is the average
* number of nonce trials a node will have to perform to meet the Proof
* of Work requirement. 1000 is the network minimum so any lower values
* will be automatically raised to 1000.
* @param {number=} opts.payloadLengthExtraBytes - This number is added
* to the data length to make sending small messages more difficult.
* 1000 is the network minimum so any lower values will be automatically
* raised to 1000.
* @return {number} Target. * @return {number} Target.
* @function * @function
* @static * @static
@ -61,6 +72,12 @@ var getTarget = exports.getTarget = function(opts) {
/** /**
* Check a POW. * Check a POW.
* @param {Object} opts - Proof of work options * @param {Object} opts - Proof of work options
* @param {number} opts.target - Proof of work target or pass
* [getTarget]{@link module:bitmessage/pow.getTarget} options to `opts`
* to compute it
* @param {Buffer} opts.payload - Message payload (with nonce)
* @param {(number|Buffer)} opts.nonce - ...or already derived nonce
* @param {Buffer} opts.initialHash - ...and initial hash
* @return {boolean} Is the proof of work sufficient. * @return {boolean} Is the proof of work sufficient.
*/ */
exports.check = function(opts) { exports.check = function(opts) {
@ -103,10 +120,13 @@ exports.check = function(opts) {
/** /**
* Do a POW. * Do a POW.
* @param {Object} opts - Proof of work options * @param {Object} opts - Proof of work options
* @param {?Buffer} opts.data - Object message payload without nonce to * @param {Buffer} opts.data - Object message payload without nonce to
* get the initial hash from * get the initial hash from
* @param {?Buffer} opts.initialHash - Or already computed initial hash * @param {Buffer} opts.initialHash - ...or already computed initial
* hash
* @param {number} opts.target - POW target * @param {number} opts.target - POW target
* @param {number=} opts.poolSize - POW calculation pool size (by
* default equals to number of cores)
* @return {Promise.&lt;number>} A promise that contains computed nonce for * @return {Promise.&lt;number>} A promise that contains computed nonce for
* the given target when fulfilled. * the given target when fulfilled.
*/ */
@ -130,13 +150,13 @@ exports.doAsync = function(opts) {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -28,10 +28,28 @@
<article> <article>
<pre class="prettyprint source linenums"><code>/** <pre class="prettyprint source linenums"><code>/**
* Implements common structures. * Implements common structures.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Common_structures} * @see {@link
* https://bitmessage.org/wiki/Protocol_specification#Common_structures}
* @module bitmessage/structs * @module bitmessage/structs
* @example
* var structs = require("bitmessage").structs;
*
* var encoded = Buffer.concat([
* structs.var_int.encode(4),
* Buffer("test"),
* structs.var_str.encode("test2"),
* structs.var_int_list.encode([1, 2, 3]),
* ]);
*
* var decoded1 = structs.var_str.decode(encoded);
* console.log(decoded1.str); // test
* var decoded2 = structs.var_str.decode(decoded1.rest);
* console.log(decoded2.str); // test2
* var decoded3 = structs.var_int.decode(decoded2.rest);
* console.log(decoded3.value); // 3
* var decoded4 = structs.var_int_list.decode(decoded2.rest);
* console.log(decoded4.list); // [1, 2, 3]
*/ */
// TODO(Kagami): Document object-like params.
"use strict"; "use strict";
@ -56,6 +74,48 @@ function getmsgchecksum(data) {
return bmcrypto.sha512(data).slice(0, 4); return bmcrypto.sha512(data).slice(0, 4);
} }
// \ :3 /
function findMagic(buf) {
var i;
var len = buf.length;
var firstb = false;
var secondb = false;
var thirdb = false;
for (i = 0; i &lt; len; ++i) {
switch (buf[i]) {
case 0xE9:
firstb = true;
break;
case 0xBE:
if (firstb) { secondb = true; }
break;
case 0xB4:
if (firstb &amp;&amp; secondb) { thirdb = true; }
break;
case 0xD9:
if (firstb &amp;&amp; secondb &amp;&amp; thirdb) { return i - 3; }
break;
default:
firstb = false;
secondb = false;
thirdb = false;
}
}
// If we reached the end of the buffer but part of the magic matches
// we'll still return index of the magic's start position.
if (firstb) {
if (secondb) {
--i;
}
if (thirdb) {
--i;
}
return i - 1; // Compensate for last i's increment
} else {
return -1;
}
}
/** /**
* Message structure. * Message structure.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Message_structure} * @see {@link https://bitmessage.org/wiki/Protocol_specification#Message_structure}
@ -70,11 +130,118 @@ var message = exports.message = {
MAGIC: 0xE9BEB4D9, MAGIC: 0xE9BEB4D9,
/** /**
* Decode message structure. * @typedef {Object} TryDecodeResult
* @property {Object} message - Decoded message
* @property {string} message.command - Message command
* @property {Buffer} message.payload - Message payload
* @property {number} message.length - Full message length
* @property {Error} error - ...or decoding error
* @property {Buffer} rest - The rest of the input buffer after
* processing message
* @memberof module:bitmessage/structs.message
*/
/**
* Decode message in "stream" mode.
* NOTE: message payload and `rest` are copied (so the runtime can GC
* processed buffer data).
* @param {Buffer} buf - Data buffer
* @return {?TryDecodeResult}
* [Decoded result.]{@link module:bitmessage/structs.message.TryDecodeResult}
*/
tryDecode: function(buf) {
if (buf.length &lt; 24) {
// Message is not yet fully received, just skip to next process
// cycle.
return;
}
var res = {};
// Magic.
var mindex = findMagic(buf);
if (mindex !== 0) {
if (mindex === -1) {
res.error = new Error("Magic not found, skipping buffer data");
res.rest = new Buffer(0);
} else {
res.error = new Error(
"Magic in the middle of buffer, skipping some data at start"
);
res.rest = new Buffer(buf.length - mindex);
buf.copy(res.rest, 0, mindex);
}
return res;
}
// Payload length.
var payloadLength = buf.readUInt32BE(16, true);
var msgLength = 24 + payloadLength;
// See: &lt;https://github.com/Bitmessage/PyBitmessage/issues/767>.
if (payloadLength > 1600003) {
res.error = new Error("Message is too large, skipping it");
if (buf.length > msgLength) {
res.rest = new Buffer(buf.length - msgLength);
buf.copy(res.rest, 0, msgLength);
} else {
res.rest = new Buffer(0);
}
return res;
}
if (buf.length &lt; msgLength) {
// Message is not yet fully received, just skip to next process
// cycle.
return;
}
// Now we can set `rest` value.
res.rest = new Buffer(buf.length - msgLength);
buf.copy(res.rest, 0, msgLength);
// Command.
var command = buf.slice(4, 16);
var firstNonNull = 0;
var i;
for (i = 11; i >=0; i--) {
if (command[i] > 127) {
res.error = new Error(
"Non-ASCII characters in command, skipping message"
);
return res;
}
if (!firstNonNull &amp;&amp; command[i] !== 0) {
firstNonNull = i + 1;
}
}
command = command.slice(0, firstNonNull).toString("ascii");
// Payload.
var payload = new Buffer(payloadLength);
buf.copy(payload, 0, 24, msgLength);
var checksum = buf.slice(20, 24);
if (!bufferEqual(checksum, getmsgchecksum(payload))) {
res.error = new Error("Bad checksum, skipping message");
return res;
}
res.message = {command: command, payload: payload, length: msgLength};
return res;
},
/**
* @typedef {Object} DecodeResult
* @property {string} command - Message command
* @property {Buffer} payload - Message payload
* @property {number} length - Full message length
* @property {Buffer} rest - The rest of the input buffer
* @memberof module:bitmessage/structs.message
*/
/**
* Decode message.
* NOTE: `payload` is copied, `rest` references input buffer. * NOTE: `payload` is copied, `rest` references input buffer.
* @param {Buffer} buf - Buffer that starts with encoded message * @param {Buffer} buf - Buffer that starts with encoded message
* @return {{command: string, payload: Buffer, length: number, rest: Buffer}} * @return {DecodeResult}
* Decoded message structure. * [Decoded message structure.]{@link module:bitmessage/structs.message.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
assert(buf.length >= 24, "Buffer is too small"); assert(buf.length >= 24, "Buffer is too small");
@ -93,6 +260,7 @@ var message = exports.message = {
// than default "utf-8" encoding. // than default "utf-8" encoding.
command = command.slice(0, firstNonNull).toString("ascii"); command = command.slice(0, firstNonNull).toString("ascii");
var payloadLength = buf.readUInt32BE(16, true); var payloadLength = buf.readUInt32BE(16, true);
assert(payloadLength &lt;= 1600003, "Message payload is too big");
var length = 24 + payloadLength; var length = 24 + payloadLength;
assert(buf.length >= length, "Truncated payload"); assert(buf.length >= length, "Truncated payload");
var checksum = buf.slice(20, 24); var checksum = buf.slice(20, 24);
@ -106,7 +274,7 @@ var message = exports.message = {
}, },
/** /**
* Encode message structure. * Encode message.
* @param {string} command - Message command * @param {string} command - Message command
* @param {Bufer} payload - Message payload * @param {Bufer} payload - Message payload
* @return {Buffer} Encoded message structure. * @return {Buffer} Encoded message structure.
@ -114,6 +282,8 @@ var message = exports.message = {
encode: function(command, payload) { encode: function(command, payload) {
assert(command.length &lt;= 12, "Command is too long"); assert(command.length &lt;= 12, "Command is too long");
assert(isAscii(command), "Non-ASCII characters in command"); assert(isAscii(command), "Non-ASCII characters in command");
payload = payload || new Buffer(0);
assert(payload.length &lt;= 1600003, "Message payload is too big");
var buf = new Buffer(24 + payload.length); var buf = new Buffer(24 + payload.length);
buf.fill(0); buf.fill(0);
buf.writeUInt32BE(message.MAGIC, 0, true); buf.writeUInt32BE(message.MAGIC, 0, true);
@ -134,18 +304,48 @@ var message = exports.message = {
* @static * @static
*/ */
var object = exports.object = { var object = exports.object = {
// Known types. /**
* [getpubkey]{@link module:bitmessage/objects.getpubkey} object type.
* @constant {number}
*/
GETPUBKEY: 0, GETPUBKEY: 0,
/**
* [pubkey]{@link module:bitmessage/objects.pubkey} object type.
* @constant {number}
*/
PUBKEY: 1, PUBKEY: 1,
/**
* [msg]{@link module:bitmessage/objects.msg} object type.
* @constant {number}
*/
MSG: 2, MSG: 2,
/**
* [broadcast]{@link module:bitmessage/objects.broadcast} object type.
* @constant {number}
*/
BROADCAST: 3, BROADCAST: 3,
/**
* @typedef {Object} DecodeResult
* @property {Buffer} nonce - A 8-byte object nonce
* @property {number} ttl - Time to live in seconds
* @property {number} type - Object type
* @property {number} version - Object version
* @property {number} stream - Object stream
* @property {number} headerLength - Length of the object header
* @property {Buffer} objectPayload - Object payload
* @memberof module:bitmessage/structs.object
*/
/** /**
* Decode `object` message. * Decode `object` message.
* NOTE: `nonce` and `objectPayload` are copied. * NOTE: `nonce` and `objectPayload` are copied.
* @param {Buffer} buf - Message * @param {Buffer} buf - Message
* @param {?Object} opts - Decoding options * @param {Object=} opts - Decoding options
* @return {Object} Decoded `object` structure. * @param {boolean} opts.allowExpired - Allow expired objects
* @param {boolean} opts.skipPow - Do not validate object POW
* @return {DecodeResult}
* [Decoded `object` structure.]{@link module:bitmessage/structs.object.DecodeResult}
*/ */
decode: function(buf, opts) { decode: function(buf, opts) {
var decoded = message.decode(buf); var decoded = message.decode(buf);
@ -155,10 +355,7 @@ var object = exports.object = {
/** /**
* Decode `object` message payload. * Decode `object` message payload.
* NOTE: `nonce` and `objectPayload` are copied. * The same as [decode]{@link module:bitmessage/structs.object.decode}.
* @param {Buffer} buf - Message payload
* @param {?Object} opts - Decoding options
* @return {Object} Decoded `object` structure.
*/ */
decodePayload: function(buf, opts) { decodePayload: function(buf, opts) {
opts = opts || {}; opts = opts || {};
@ -206,6 +403,12 @@ var object = exports.object = {
/** /**
* Encode `object` message. * Encode `object` message.
* @param {Object} opts - Object options * @param {Object} opts - Object options
* @param {Object} opts.nonce - A 8-byte object nonce
* @param {number} opts.ttl - Time to live in seconds
* @param {number} opts.type - Object type
* @param {number} opts.version - Object version
* @param {number=} opts.stream - Object stream (1 by default)
* @param {Buffer} opts.objectPayload - Object payload
* @return {Buffer} Encoded message. * @return {Buffer} Encoded message.
*/ */
encode: function(opts) { encode: function(opts) {
@ -215,8 +418,7 @@ var object = exports.object = {
/** /**
* Encode `object` message payload. * Encode `object` message payload.
* @param {Object} opts - Object options * The same as [encode]{@link module:bitmessage/structs.object.encode}.
* @return {Buffer} Encoded payload.
*/ */
encodePayload: function(opts) { encodePayload: function(opts) {
// NOTE(Kagami): We do not try to calculate nonce here if it is not // NOTE(Kagami): We do not try to calculate nonce here if it is not
@ -240,6 +442,11 @@ var object = exports.object = {
* Encode `object` message payload without leading nonce field (may be * Encode `object` message payload without leading nonce field (may be
* useful if you are going to calculate it later). * useful if you are going to calculate it later).
* @param {Object} opts - Object options * @param {Object} opts - Object options
* @param {number} opts.ttl - Time to live in seconds
* @param {number} opts.type - Object type
* @param {number} opts.version - Object version
* @param {number=} opts.stream - Object stream (1 by default)
* @param {Buffer} opts.objectPayload - Object payload
* @return {Buffer} Encoded payload. * @return {Buffer} Encoded payload.
*/ */
encodePayloadWithoutNonce: function(opts) { encodePayloadWithoutNonce: function(opts) {
@ -268,12 +475,20 @@ var object = exports.object = {
* @static * @static
*/ */
var var_int = exports.var_int = { var var_int = exports.var_int = {
/**
* @typedef {Object} DecodeResult
* @property {number} value - Stored value
* @property {number} length - `var_int` full length
* @property {Buffer} rest - The rest of the input buffer
* @memberof module:bitmessage/structs.var_int
*/
/** /**
* Decode `var_int`. * Decode `var_int`.
* NOTE: `rest` references input buffer. * NOTE: `rest` references input buffer.
* @param {Buffer} buf - A buffer that starts with encoded `var_int` * @param {Buffer} buf - A buffer that starts with encoded `var_int`
* @return {{value: number, length: number, rest: Buffer}} * @return {DecodeResult}
* Decoded `var_int` structure. * [Decoded `var_int` structure.]{@link module:bitmessage/structs.var_int.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
var value, length; var value, length;
@ -361,12 +576,20 @@ var var_int = exports.var_int = {
* @namespace * @namespace
*/ */
exports.var_str = { exports.var_str = {
/**
* @typedef {Object} DecodeResult
* @property {number} str - The string itself
* @property {number} length - `var_str` full length
* @property {Buffer} rest - The rest of the input buffer
* @memberof module:bitmessage/structs.var_str
*/
/** /**
* Decode `var_str`. * Decode `var_str`.
* NOTE: `rest` references input buffer. * NOTE: `rest` references input buffer.
* @param {Buffer} buf - A buffer that starts with encoded `var_str` * @param {Buffer} buf - A buffer that starts with encoded `var_str`
* @return {{str: string, length: number, rest: Buffer}} * @return {DecodeResult}
* Decoded `var_str` structure. * [Decoded `var_str` structure.]{@link module:bitmessage/structs.var_str.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
var decoded = var_int.decode(buf); var decoded = var_int.decode(buf);
@ -397,13 +620,21 @@ exports.var_str = {
* @namespace * @namespace
*/ */
exports.var_int_list = { exports.var_int_list = {
/**
* @typedef {Object} DecodeResult
* @property {number} list - Stored numbers
* @property {number} length - `var_int_list` full length
* @property {Buffer} rest - The rest of the input buffer
* @memberof module:bitmessage/structs.var_int_list
*/
/** /**
* Decode `var_int_list`. * Decode `var_int_list`.
* NOTE: `rest` references input buffer. * NOTE: `rest` references input buffer.
* @param {Buffer} buf - A buffer that starts with encoded * @param {Buffer} buf - A buffer that starts with encoded
* `var_int_list` * `var_int_list`
* @return {{list: number[], length: number, rest: Buffer}} * @return {DecodeResult}
* Decoded `var_int_list` structure. * [Decoded `var_int_list` structure.]{@link module:bitmessage/structs.var_int_list.DecodeResult}
*/ */
decode: function(buf) { decode: function(buf) {
var decoded = var_int.decode(buf); var decoded = var_int.decode(buf);
@ -426,8 +657,9 @@ exports.var_int_list = {
* @return {Buffer} Encoded `var_int_list`. * @return {Buffer} Encoded `var_int_list`.
*/ */
encode: function(list) { encode: function(list) {
var listBuf = Buffer.concat(list.map(var_int.encode)); var var_ints = list.map(var_int.encode);
return Buffer.concat([var_int.encode(list.length), listBuf]); var bufs = [var_int.encode(list.length)].concat(var_ints);
return Buffer.concat(bufs);
}, },
}; };
@ -454,10 +686,17 @@ function inet_ntop(buf) {
function inet_pton(str) { function inet_pton(str) {
var buf = new Buffer(16); var buf = new Buffer(16);
buf.fill(0); buf.fill(0);
// IPv4-mapped IPv6.
if (str.slice(0, 7) === "::ffff:") {
str = str.slice(7);
}
// IPv4. // IPv4.
if (str.indexOf(":") === -1) { if (str.indexOf(":") === -1) {
IPv4_MAPPING.copy(buf); IPv4_MAPPING.copy(buf);
var octets = str.split(/\./g).map(function(s) {return parseInt(s, 10);}); var octets = str.split(/\./g).map(function(o) {
assert(/^\d+$/.test(o), "Bad octet");
return parseInt(o, 10);
});
// Support short form from inet_aton(3) man page. // Support short form from inet_aton(3) man page.
if (octets.length === 1) { if (octets.length === 1) {
buf.writeUInt32BE(octets[0], 12); buf.writeUInt32BE(octets[0], 12);
@ -512,6 +751,8 @@ function inet_pton(str) {
assert(groups.length === 8, "Bad IPv6 address"); assert(groups.length === 8, "Bad IPv6 address");
} }
for (i = 0; i &lt; Math.min(groups.length, 8); i++) { for (i = 0; i &lt; Math.min(groups.length, 8); i++) {
// Check against parseInt("127.0.0.1", 16) -> 295
assert(/^[0-9a-f]+$/.test(groups[i]), "Bad group");
buf.writeUInt16BE(parseInt(groups[i], 16), i * 2); buf.writeUInt16BE(parseInt(groups[i], 16), i * 2);
} }
} }
@ -524,13 +765,28 @@ function inet_pton(str) {
* @namespace * @namespace
*/ */
exports.net_addr = { exports.net_addr = {
/**
* @typedef {Object} DecodeResult
* @property {Date} time - Time the node was last active, not included
* in short mode
* @property {number} stream - Stream number of the node, not included
* in short mode
* @property {Object} services -
* [Services]{@link module:bitmessage/structs.ServicesBitfield}
* provided by the node
* @property {string} host - IPv4/IPv6 address of the node
* @property {number} port - Incoming port of the node
* @memberof module:bitmessage/structs.net_addr
*/
/** /**
* Decode `net_addr`. * Decode `net_addr`.
* @param {Buffer} buf - A buffer that contains encoded `net_addr` * @param {Buffer} buf - A buffer that contains encoded `net_addr`
* @param {?Object} opts - Decoding options; use `short` option to * @param {Object=} opts - Decoding options; use `short` option to
* decode `net_addr` from * decode `net_addr` from
* [version message]{@link module:bitmessage/messages.version} * [version message]{@link module:bitmessage/messages.version}
* @return {Object} Decoded `net_addr` structure. * @return {DecodeResult}
* [Decoded `net_addr` structure.]{@link module:bitmessage/structs.net_addr.DecodeResult}
*/ */
decode: function(buf, opts) { decode: function(buf, opts) {
var short = !!(opts || {}).short; var short = !!(opts || {}).short;
@ -558,9 +814,19 @@ exports.net_addr = {
/** /**
* Encode `net_addr`. * Encode `net_addr`.
* @param {Object} opts - Encode options; use `short` option to encode * @param {Object} opts - Encoding options
* `net_addr` for * @param {boolean=} opts.short - Encode `net_addr` for
* [version message]{@link module:bitmessage/messages.version} * [version message]{@link module:bitmessage/messages.version}
* (false by default)
* @param {Date=} opts.time - Time the node was last active, not
* included in short mode (current time by default)
* @param {number=} opts.stream - Stream number of the node, not
* included in short mode (1 by default)
* @param {Object=} opts.services -
* [Services]{@link module:bitmessage/structs.ServicesBitfield}
* provided by the node (`NODE_NETWORK` by default)
* @param {string} opts.host - IPv4/IPv6 address of the node
* @param {number} opts.port - Incoming port of the node
* @return {Buffer} Encoded `net_addr`. * @return {Buffer} Encoded `net_addr`.
*/ */
encode: function(opts) { encode: function(opts) {
@ -595,12 +861,14 @@ exports.net_addr = {
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Inventory_Vectors} * @see {@link https://bitmessage.org/wiki/Protocol_specification#Inventory_Vectors}
* @namespace * @namespace
*/ */
// Only encode operation is defined because decode is impossible.
exports.inv_vect = { exports.inv_vect = {
// NOTE(Kagami): Only encode operation is defined because decoding of
// the encoded vector is impossible.
/** /**
* Encode inventory vector. * Encode inventory vector.
* @param {Buffer} buf - Payload to calculate the inventory vector for * @param {Buffer} buf - Payload to calculate the inventory vector for
* @return {Buffer} Encoded `inv_vect`. * @return {Buffer} A 32-byte encoded `inv_vect`.
*/ */
encode: function(buf) { encode: function(buf) {
return bmcrypto.sha512(bmcrypto.sha512(buf)).slice(0, 32); return bmcrypto.sha512(bmcrypto.sha512(buf)).slice(0, 32);
@ -613,18 +881,34 @@ exports.inv_vect = {
* @namespace encrypted * @namespace encrypted
* @static * @static
*/ */
/**
* @typedef {Object} DecodeResult
* @property {Buffer} iv - Initialization vector (16 bytes)
* @property {Buffer} ephemPrivateKey - Ephemeral private key (32 bytes)
* @property {Buffer} ciphertext - The result of encryption (variable
* size)
* @property {Buffer} mac - Message authentication code (32 bytes)
* @memberof module:bitmessage/structs.encrypted
*/
/** /**
* Decode encrypted payload. * Decode encrypted payload.
* NOTE: all structure members are copied. * NOTE: all structure members are copied.
* @param {Buffer} buf - A buffer that contains encrypted payload * @param {Buffer} buf - A buffer that contains encrypted payload
* @return {Object} Decoded encrypted structure. * @return {DecodeResult}
* [Decoded `encrypted` structure.]{@link module:bitmessage/structs.encrypted.DecodeResult}
* @function decode * @function decode
* @memberof module:bitmessage/structs.encrypted * @memberof module:bitmessage/structs.encrypted
*/ */
/** /**
* Encode `encrypted`. * Encode `encrypted`.
* @param {Object} opts - Encode options * @param {Object} opts - Encoding options
* @return {Buffer} Encoded encrypted payload. * @param {Buffer} opts.iv - Initialization vector (16 bytes)
* @param {Buffer} opts.ephemPrivateKey - Ephemeral private key (32
* bytes)
* @param {Buffer} opts.ciphertext - The result of encryption (variable
* size)
* @param {Buffer} opts.mac - Message authentication code (32 bytes)
* @return {Buffer} Encoded `encrypted` payload.
* @function encode * @function encode
* @memberof module:bitmessage/structs.encrypted * @memberof module:bitmessage/structs.encrypted
*/ */
@ -689,18 +973,49 @@ var Bitfield = function(size) {
}; };
/** /**
* Services bitfield features. * Service features bitfield (MSB 0).
* @see {@link https://bitmessage.org/wiki/Protocol_specification#version} * @see {@link https://bitmessage.org/wiki/Protocol_specification#version}
* @namespace * @param {Buffer=} buf - A 8-byte bitfield buffer (will be created if
* not provided or will be copied if `opts.copy` is `true`)
* @param {Object=} opts - Options
* @constructor
* @static * @static
* @example
* var ServicesBitfield = require("bitmessage").structs.ServicesBitfield;
* var services = ServicesBitfield().set(ServicesBitfield.NODE_NETWORK);
* console.log(services.get(ServicesBitfield.NODE_NETWORK)); // true
* console.log(services.get(15)); // false
*/ */
// TODO(Kagami): Document methods.
// NOTE(Kagami): Since pubkey bitfield uses MSB 0, we use it here too. // NOTE(Kagami): Since pubkey bitfield uses MSB 0, we use it here too.
// See &lt;https://github.com/Bitmessage/PyBitmessage/issues/769> for // See &lt;https://github.com/Bitmessage/PyBitmessage/issues/769> for
// details. // details.
var ServicesBitfield = exports.ServicesBitfield = objectAssign(Bitfield(64), { var ServicesBitfield = exports.ServicesBitfield = objectAssign(Bitfield(64), {
/** /**
* This is a normal network node. * Returns a boolean indicating whether the bit is set.
* @param {number} index - Bit index (MSB 0)
* @function get
* @instance
* @return {boolean}
* @memberof module:bitmessage/structs.ServicesBitfield
*/
/**
* Set the given bit(s) to `1`.
* @param {(number|number[])} index - Bit(s) index (MSB 0)
* @function set
* @instance
* @return {Object} Returns self so methods can be chained.
* @memberof module:bitmessage/structs.ServicesBitfield
*/
/**
* The contents of the bitfield.
* @type {Buffer}
* @var buffer
* @instance
* @memberof module:bitmessage/structs.ServicesBitfield
*/
/**
* Bit index indicating normal network node.
* @memberof module:bitmessage/structs.ServicesBitfield * @memberof module:bitmessage/structs.ServicesBitfield
* @constant {number} * @constant {number}
*/ */
@ -708,22 +1023,58 @@ var ServicesBitfield = exports.ServicesBitfield = objectAssign(Bitfield(64), {
}); });
/** /**
* Pubkey bitfield features. * Pubkey features bitfield (MSB 0).
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Pubkey_bitfield_features} * @see {@link https://bitmessage.org/wiki/Protocol_specification#Pubkey_bitfield_features}
* @namespace * @param {Buffer=} buf - A 4-byte bitfield buffer (will be created if
* not provided or will be copied if `opts.copy` is `true`)
* @param {Object=} opts - Options
* @constructor
* @example
* var PubkeyBitfield = require("bitmessage").structs.PubkeyBitfield;
* var behavior = PubkeyBitfield().set([
* PubkeyBitfield.INCLUDE_DESTINATION,
* PubkeyBitfield.DOES_ACK,
* ]).set(1);
* console.log(behavior.get(PubkeyBitfield.DOES_ACK)); // true
* console.log(behavior.get(15)); // false
*/ */
// TODO(Kagami): Document methods.
exports.PubkeyBitfield = objectAssign(Bitfield(32), { exports.PubkeyBitfield = objectAssign(Bitfield(32), {
/** /**
* Receiving node expects that the RIPE hash encoded in their address * Returns a boolean indicating whether the bit is set.
* preceedes the encrypted message data of msg messages bound for * @param {number} index - Bit index (MSB 0)
* them. * @function get
* @instance
* @return {boolean}
* @memberof module:bitmessage/structs.PubkeyBitfield
*/
/**
* Set the given bit(s) to `1`.
* @param {(number|number[])} index - Bit(s) index (MSB 0)
* @function set
* @instance
* @return {Object} Returns self so methods can be chained.
* @memberof module:bitmessage/structs.PubkeyBitfield
*/
/**
* The contents of the bitfield.
* @type {Buffer}
* @var buffer
* @instance
* @memberof module:bitmessage/structs.PubkeyBitfield
*/
/**
* Bit index.
* If set, the receiving node expects that the RIPEMD hash encoded in
* their address preceedes the encrypted message data of msg messages
* bound for them.
* @memberof module:bitmessage/structs.PubkeyBitfield * @memberof module:bitmessage/structs.PubkeyBitfield
* @constant {number} * @constant {number}
*/ */
INCLUDE_DESTINATION: 30, INCLUDE_DESTINATION: 30,
/** /**
* If true, the receiving node does send acknowledgements (rather than * Bit index.
* If set, the receiving node does send acknowledgements (rather than
* dropping them). * dropping them).
* @memberof module:bitmessage/structs.PubkeyBitfield * @memberof module:bitmessage/structs.PubkeyBitfield
* @constant {number} * @constant {number}
@ -740,13 +1091,13 @@ exports.PubkeyBitfield = objectAssign(Bitfield(32), {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -334,13 +334,15 @@ h6
.params th, .props th { border-right: 1px solid #aaa; } .params th, .props th { border-right: 1px solid #aaa; }
.params thead .last, .props thead .last { border-right: 1px solid #ddd; } .params thead .last, .props thead .last { border-right: 1px solid #ddd; }
.params td.description > p:first-child .params td.description > p:first-child,
.props td.description > p:first-child
{ {
margin-top: 0; margin-top: 0;
padding-top: 0; padding-top: 0;
} }
.params td.description > p:last-child .params td.description > p:last-child,
.props td.description > p:last-child
{ {
margin-bottom: 0; margin-bottom: 0;
padding-bottom: 0; padding-bottom: 0;

View File

@ -90,8 +90,8 @@ exports.parse = function(str) {
/** /**
* Encode user agent into `var_str` Buffer. Most underlying software * Encode user agent into `var_str` Buffer. Most underlying software
* comes first. * comes first.
* @param {(Object[]|string[]|string)} software - List of software to * @param {(Object[]|string[]|string|Buffer)} software - List of
* encode or just raw user agent string * software to encode or just raw user agent string/Buffer
* @return {Buffer} Encoded user agent. * @return {Buffer} Encoded user agent.
* @function * @function
* @static * @static
@ -111,6 +111,8 @@ var encode = exports.encode = function(software) {
return str; return str;
}).join("/"); }).join("/");
ua = "/" + ua + "/"; ua = "/" + ua + "/";
} else if (Buffer.isBuffer(software)) {
return software;
} else { } else {
ua = software; ua = software;
} }
@ -118,7 +120,7 @@ var encode = exports.encode = function(software) {
}; };
/** /**
* Encode bitmessage's user agent. * Encode bitmessage's library user agent.
* @return {Buffer} Encoded user agent. * @return {Buffer} Encoded user agent.
*/ */
exports.encodeSelf = function() { exports.encodeSelf = function() {
@ -126,8 +128,8 @@ exports.encodeSelf = function() {
}; };
/** /**
* Encode user agent with bitmessage's user agent underneath. Most * Encode user agent with bitmessage's library user agent underneath.
* underlying software comes first. * Most underlying software comes first.
* @param {(Object[]|string[]|Object|string)} software - List of * @param {(Object[]|string[]|Object|string)} software - List of
* software to encode * software to encode
* @return {Buffer} Encoded user agent. * @return {Buffer} Encoded user agent.
@ -146,13 +148,13 @@ exports.encodeSelfWith = function(software) {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>

View File

@ -45,7 +45,8 @@ function getwifchecksum(data) {
} }
/** /**
* Decode WIF encoded private key. * Decode WIF-encoded private key (corresponded to a uncompressed public
* key).
* @param {string} wif - Encoded key * @param {string} wif - Encoded key
* @return {Buffer} Private key. * @return {Buffer} Private key.
*/ */
@ -59,9 +60,10 @@ exports.decode = function(wif) {
}; };
/** /**
* Convert private key to a WIF. * Convert private key to a WIF (corresponded to a uncompressed public
* key).
* @param {Buffer} privateKey - A private key to encode * @param {Buffer} privateKey - A private key to encode
* @return {string} Encoded private key. * @return {string} WIF-encoded private key.
*/ */
exports.encode = function(privateKey) { exports.encode = function(privateKey) {
var data = Buffer.concat([new Buffer([0x80]), privateKey]); var data = Buffer.concat([new Buffer([0x80]), privateKey]);
@ -79,13 +81,13 @@ exports.encode = function(privateKey) {
</div> </div>
<nav> <nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_net_base.html">bitmessage/net/base</a></li><li><a href="module-bitmessage_net_tcp.html">bitmessage/net/tcp</a></li><li><a href="module-bitmessage_net_ws.html">bitmessage/net/ws</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_user-agent.html">bitmessage/user-agent</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li><li><a href="module-bitmessage_net_base.BaseTransport.html">BaseTransport</a></li><li><a href="module-bitmessage_net_tcp.TcpTransport.html">TcpTransport</a></li><li><a href="module-bitmessage_net_ws.WsTransport.html">WsTransport</a></li><li><a href="module-bitmessage_structs.PubkeyBitfield.html">PubkeyBitfield</a></li><li><a href="module-bitmessage_structs.ServicesBitfield.html">ServicesBitfield</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_messages.addr.html">addr</a></li><li><a href="module-bitmessage_messages.error.html">error</a></li><li><a href="module-bitmessage_messages.getdata.html">getdata</a></li><li><a href="module-bitmessage_messages.inv.html">inv</a></li><li><a href="module-bitmessage_messages.version.html">version</a></li><li><a href="module-bitmessage_objects.broadcast.html">broadcast</a></li><li><a href="module-bitmessage_objects.getpubkey.html">getpubkey</a></li><li><a href="module-bitmessage_objects.msg.html">msg</a></li><li><a href="module-bitmessage_objects.pubkey.html">pubkey</a></li><li><a href="module-bitmessage_structs.encrypted.html">encrypted</a></li><li><a href="module-bitmessage_structs.inv_vect.html">inv_vect</a></li><li><a href="module-bitmessage_structs.message.html">message</a></li><li><a href="module-bitmessage_structs.net_addr.html">net_addr</a></li><li><a href="module-bitmessage_structs.object.html">object</a></li><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
</nav> </nav>
<br class="clear"> <br class="clear">
<footer> <footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-beta1</a> on Sat Jan 31 2015 14:53:21 GMT+0300 (MSK) Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Feb 12 2015 13:43:38 GMT+0300 (MSK)
</footer> </footer>
<script> prettyPrint(); </script> <script> prettyPrint(); </script>