Initial update for the bitmessage-js package #1

Merged
PeterSurda merged 15 commits from lee.miller/bitmessage-js:mac into master 2024-03-08 01:55:30 +01:00
6 changed files with 27 additions and 26 deletions
Showing only changes of commit fdd941083d - Show all commits

View File

@ -11,7 +11,7 @@
* // Or create it from passphrase. * // Or create it from passphrase.
* var addr2 = Address.fromPassphrase("test"); * var addr2 = Address.fromPassphrase("test");
* console.log("Deterministic Bitmessage address:", addr2.encode()); * console.log("Deterministic Bitmessage address:", addr2.encode());
* @see {@link https://bitmessage.org/wiki/Address} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/address.html}
* @module bitmessage/address * @module bitmessage/address
*/ */
// TODO(Kagami): Document getters/setters. // TODO(Kagami): Document getters/setters.

View File

@ -1,8 +1,7 @@
/** /**
* Working with messages. * Working with messages.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Message_types} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#message-types}
* @see {@link https://bitmessage.org/wiki/Protocol_specification_v3#Message_types} * @see {@link https://wiki.bitmessage.org/w/index.php?title=Protocol_specification&oldid=23#Message_types}
* @see {@link https://bitmessage.org/Bitmessage%20Technical%20Paper.pdf}
* @module bitmessage/messages * @module bitmessage/messages
* @example * @example
* var structs = require("bitmessage").structs; * var structs = require("bitmessage").structs;
@ -30,6 +29,8 @@
* console.log(structs.message.decode(verackmsg).command); // verack * console.log(structs.message.decode(verackmsg).command); // verack
*/ */
// broken link: https://bitmessage.org/Bitmessage%20Technical%20Paper.pdf
"use strict"; "use strict";
var objectAssign = Object.assign || require("object-assign"); var objectAssign = Object.assign || require("object-assign");
@ -71,7 +72,7 @@ exports.getCommand = function(buf) {
/** /**
* `version` message. * `version` message.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#version} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#version}
* @namespace * @namespace
* @static * @static
*/ */
@ -277,7 +278,7 @@ function checkAddrOpts(opts) {
/** /**
* `addr` message. Provide information on known nodes of the network. * `addr` message. Provide information on known nodes of the network.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#addr} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#addr}
* @namespace * @namespace
* @static * @static
*/ */
@ -357,7 +358,7 @@ var addr = exports.addr = {
/** /**
* `inv` message. Allows a node to advertise its knowledge of one or * `inv` message. Allows a node to advertise its knowledge of one or
* more objects. * more objects.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#inv} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#inv}
* @namespace * @namespace
* @static * @static
*/ */
@ -431,7 +432,7 @@ var inv = exports.inv = {
* `getdata` message. `getdata` is used in response to an * `getdata` message. `getdata` is used in response to an
* [inv]{@link module:bitmessage/messages.inv} message to retrieve the * [inv]{@link module:bitmessage/messages.inv} message to retrieve the
* content of a specific object after filtering known elements. * content of a specific object after filtering known elements.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#getdata} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#getdata}
* @namespace * @namespace
*/ */
exports.getdata = objectAssign({}, inv, { exports.getdata = objectAssign({}, inv, {

View File

@ -2,7 +2,7 @@
* Working with objects. * Working with objects.
* NOTE: Most operations with objects are asynchronous and return * NOTE: Most operations with objects are asynchronous and return
* promises. * promises.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Object_types} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#object-types}
* @module bitmessage/objects * @module bitmessage/objects
*/ */
@ -85,7 +85,7 @@ function prependNonce(obj, opts) {
* `getpubkey` object. When a node has the hash of a public key (from an * `getpubkey` object. When a node has the hash of a public key (from an
* address) but not the public key itself, it must send out a request * address) but not the public key itself, it must send out a request
* for the public key. * for the public key.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#getpubkey} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#getpubkey}
* @namespace * @namespace
* @static * @static
*/ */
@ -246,7 +246,7 @@ function findAddrByTag(addrs, tag) {
/** /**
* `pubkey` object. * `pubkey` object.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#pubkey} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#pubkey}
* @namespace * @namespace
* @static * @static
*/ */
@ -562,7 +562,7 @@ function decodeMessage(message, encoding) {
/** /**
* `msg` object. * `msg` object.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#msg} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#msg}
* @namespace * @namespace
* @static * @static
*/ */
@ -871,7 +871,7 @@ function tryDecryptBroadcastV4(subscriptions, buf) {
/** /**
* `broadcast` object. * `broadcast` object.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#broadcast} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#broadcast}
* @namespace * @namespace
* @static * @static
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* Implements proof of work. * Implements proof of work.
* @see {@link https://bitmessage.org/wiki/Proof_of_work} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/pow.html}
* @module bitmessage/pow * @module bitmessage/pow
*/ */

View File

@ -1,7 +1,7 @@
/** /**
* Implements common structures. * Implements common structures.
* @see {@link * @see {@link
* https://bitmessage.org/wiki/Protocol_specification#Common_structures} * https://pybitmessage.rtfd.io/en/v0.6/protocol.html#common-structures}
* @module bitmessage/structs * @module bitmessage/structs
* @example * @example
* var structs = require("bitmessage").structs; * var structs = require("bitmessage").structs;
@ -93,7 +93,7 @@ function findMagic(buf) {
/** /**
* Message structure. * Message structure.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Message_structure} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#id1}
* @namespace * @namespace
* @static * @static
*/ */
@ -274,7 +274,7 @@ var message = exports.message = {
* An `object` is a message which is shared throughout a stream. It is * An `object` is a message which is shared throughout a stream. It is
* the only message which propagates; all others are only between two * the only message which propagates; all others are only between two
* nodes. * nodes.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#object} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#object}
* @namespace * @namespace
* @static * @static
*/ */
@ -499,7 +499,7 @@ var object = exports.object = {
/** /**
* Variable length integer. * Variable length integer.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Variable_length_integer} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#variable-length-integer}
* @namespace * @namespace
* @static * @static
*/ */
@ -602,7 +602,7 @@ var var_int = exports.var_int = {
/** /**
* Variable length string. * Variable length string.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Variable_length_string} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#variable-length-string}
* @namespace * @namespace
*/ */
exports.var_str = { exports.var_str = {
@ -646,7 +646,7 @@ exports.var_str = {
/** /**
* Variable length list of integers. * Variable length list of integers.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Variable_length_list_of_integers} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#variable-length-list-of-integers}
* @namespace * @namespace
*/ */
exports.var_int_list = { exports.var_int_list = {
@ -712,7 +712,7 @@ function inet_ntop(buf) {
/** /**
* Network address. * Network address.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Network_address} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#network-address}
* @namespace * @namespace
*/ */
exports.net_addr = { exports.net_addr = {
@ -814,7 +814,7 @@ exports.net_addr = {
/** /**
* Inventory vector. * Inventory vector.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Inventory_Vectors} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#inventory-vectors}
* @namespace * @namespace
*/ */
exports.inv_vect = { exports.inv_vect = {
@ -833,7 +833,7 @@ exports.inv_vect = {
/** /**
* Encrypted payload. * Encrypted payload.
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Encrypted_payload} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#encrypted-payload}
* @namespace encrypted * @namespace encrypted
* @static * @static
*/ */
@ -940,7 +940,7 @@ var Bitfield = function(size) {
/** /**
* Service features bitfield (MSB 0). * Service features bitfield (MSB 0).
* @see {@link https://bitmessage.org/wiki/Protocol_specification#version} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#version}
* @param {Buffer=} buf - A 8-byte bitfield buffer (will be created if * @param {Buffer=} buf - A 8-byte bitfield buffer (will be created if
* not provided or will be copied if `opts.copy` is `true`) * not provided or will be copied if `opts.copy` is `true`)
* @param {Object=} opts - Options * @param {Object=} opts - Options
@ -1006,7 +1006,7 @@ var ServicesBitfield = exports.ServicesBitfield = objectAssign(Bitfield(64), {
/** /**
* Pubkey features bitfield (MSB 0). * Pubkey features bitfield (MSB 0).
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Pubkey_bitfield_features} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/protocol.html#pubkey-bitfield-features}
* @param {Buffer=} buf - A 4-byte bitfield buffer (will be created if * @param {Buffer=} buf - A 4-byte bitfield buffer (will be created if
* not provided or will be copied if `opts.copy` is `true`) * not provided or will be copied if `opts.copy` is `true`)
* @param {Object=} opts - Options * @param {Object=} opts - Options

View File

@ -1,6 +1,6 @@
/** /**
* Working with Bitmessage user agents. * Working with Bitmessage user agents.
* @see {@link https://bitmessage.org/wiki/User_Agent} * @see {@link https://pybitmessage.rtfd.io/en/v0.6/useragent.html}
* @module bitmessage/user-agent * @module bitmessage/user-agent
*/ */