diff --git a/.gitignore b/.gitignore index b86cc9e..ec71389 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -* +/* !/docs/ diff --git a/docs/module-bitmessage_messages.addr.html b/docs/module-bitmessage_messages.addr.html new file mode 100644 index 0000000..9889a8c --- /dev/null +++ b/docs/module-bitmessage_messages.addr.html @@ -0,0 +1,757 @@ + + + + + JSDoc: Namespace: addr + + + + + + + + + + +
+ +

Namespace: addr

+ + + + + + +
+ +
+ +

+ bitmessage/messages. + + addr +

+ + +
+ +
+
+ + +

addr message. Provide information on known nodes of the network.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf) → {Object}

+ + + + + +
+

Decode addr message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded addr structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) decodePayload(buf) → {Object}

+ + + + + +
+

Decode addr message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message payload

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded addr structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(addrs) → {Buffer}

+ + + + + +
+

Encode addr message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
addrs + + +Array.<Object> + + + +

Network addresses

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded message.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodePayload(addrs) → {Buffer}

+ + + + + +
+

Encode addr message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
addrs + + +Array.<Object> + + + +

Network addresses

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_messages.error.html b/docs/module-bitmessage_messages.error.html new file mode 100644 index 0000000..624d833 --- /dev/null +++ b/docs/module-bitmessage_messages.error.html @@ -0,0 +1,978 @@ + + + + + JSDoc: Namespace: error + + + + + + + + + + +
+ +

Namespace: error

+ + + + + + +
+ +
+ +

+ bitmessage/messages. + + error +

+ + +
+ +
+
+ + +

error message.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) ERROR :number

+ + + + +
+

It's an error, something was going wrong (e.g. an object got lost).

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) FATAL :number

+ + + + +
+

It's a fatal error. The node will drop the line for that error and +maybe ban you for some time.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) WARNING :number

+ + + + +
+

Just a warning.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf) → {Object}

+ + + + + +
+

Decode error message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded error structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) decodePayload(buf) → {Object}

+ + + + + +
+

Decode error message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message payload

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded error structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(opts) → {Buffer}

+ + + + + +
+

Encode error message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Error options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded message.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodePayload(opts) → {Buffer}

+ + + + + +
+

Encode error message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Error options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_messages.getdata.html b/docs/module-bitmessage_messages.getdata.html new file mode 100644 index 0000000..d907331 --- /dev/null +++ b/docs/module-bitmessage_messages.getdata.html @@ -0,0 +1,759 @@ + + + + + JSDoc: Namespace: getdata + + + + + + + + + + +
+ +

Namespace: getdata

+ + + + + + +
+ +
+ +

+ bitmessage/messages. + + getdata +

+ + +
+ +
+
+ + +

getdata message. getdata is used in response to an +inv message to retrieve the +content of a specific object after filtering known elements.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf) → {Object}

+ + + + + +
+

Decode getdata message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded getdata structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) decodePayload(buf) → {Object}

+ + + + + +
+

Decode getdata message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message payload

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded inv structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(inventory) → {Buffer}

+ + + + + +
+

Encode getdata message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
inventory + + +Array.<Buffer> + + + +

Inventory vector list

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded message.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodePayload(inventory) → {Buffer}

+ + + + + +
+

Encode getdata message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
inventory + + +Array.<Buffer> + + + +

Inventory vector list

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_messages.inv.html b/docs/module-bitmessage_messages.inv.html new file mode 100644 index 0000000..d47255f --- /dev/null +++ b/docs/module-bitmessage_messages.inv.html @@ -0,0 +1,758 @@ + + + + + JSDoc: Namespace: inv + + + + + + + + + + +
+ +

Namespace: inv

+ + + + + + +
+ +
+ +

+ bitmessage/messages. + + inv +

+ + +
+ +
+
+ + +

inv message. Allows a node to advertise its knowledge of one or +more objects.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf) → {Object}

+ + + + + +
+

Decode inv message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded inv structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) decodePayload(buf) → {Object}

+ + + + + +
+

Decode inv message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message payload

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded inv structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(inventory) → {Buffer}

+ + + + + +
+

Encode inv message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
inventory + + +Array.<Buffer> + + + +

Inventory vector list

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded message.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodePayload(inventory) → {Buffer}

+ + + + + +
+

Encode inv message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
inventory + + +Array.<Buffer> + + + +

Inventory vector list

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_messages.version.html b/docs/module-bitmessage_messages.version.html new file mode 100644 index 0000000..087aadd --- /dev/null +++ b/docs/module-bitmessage_messages.version.html @@ -0,0 +1,835 @@ + + + + + JSDoc: Namespace: version + + + + + + + + + + +
+ +

Namespace: version

+ + + + + + +
+ +
+ +

+ bitmessage/messages. + + version +

+ + +
+ +
+
+ + +

version message.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) NONCE :Buffer

+ + + + +
+

Random nonce used to detect connections to self.

+
+ + + +
Type:
+
    +
  • + +Buffer + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf) → {Object}

+ + + + + +
+

Decode version message. +NOTE: nonce is copied.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded version structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) decodePayload(buf) → {Object}

+ + + + + +
+

Decode version message payload. +NOTE: nonce is copied.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message payload

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded version structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(opts) → {Buffer}

+ + + + + +
+

Encode version message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Version options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded message.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodePayload(opts) → {Buffer}

+ + + + + +
+

Encode version message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Version options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_objects.broadcast.html b/docs/module-bitmessage_objects.broadcast.html new file mode 100644 index 0000000..dc60ff0 --- /dev/null +++ b/docs/module-bitmessage_objects.broadcast.html @@ -0,0 +1,807 @@ + + + + + JSDoc: Namespace: broadcast + + + + + + + + + + +
+ +

Namespace: broadcast

+ + + + + + +
+ +
+ +

+ bitmessage/objects. + + broadcast +

+ + +
+ +
+
+ + +

broadcast object.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decodeAsync(buf, opts) → {Promise.<Object>}

+ + + + + +
+

Decode broadcast object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message

opts + + +Object + + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded +broadcast object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) decodePayloadAsync(buf, opts) → {Promise.<Object>}

+ + + + + +
+

Decode broadcast object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message payload

opts + + +Object + + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded pubkey +object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) encodeAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode broadcast object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

broadcast object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + +

(static) encodePayloadAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode broadcast object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

broadcast object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +payload when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_objects.getpubkey.html b/docs/module-bitmessage_objects.getpubkey.html new file mode 100644 index 0000000..23cb631 --- /dev/null +++ b/docs/module-bitmessage_objects.getpubkey.html @@ -0,0 +1,849 @@ + + + + + JSDoc: Namespace: getpubkey + + + + + + + + + + +
+ +

Namespace: getpubkey

+ + + + + + +
+ +
+ +

+ bitmessage/objects. + + getpubkey +

+ + +
+ +
+
+ + +

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 +for the public key.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decodeAsync(buf, optsnullable) → {Promise.<Object>}

+ + + + + +
+

Decode getpubkey object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buf + + +Buffer + + + + + + + + + +

Message

opts + + +Object + + + + + + + + <nullable>
+ + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded +getpubkey object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) decodePayloadAsync(buf, optsnullable) → {Promise.<Object>}

+ + + + + +
+

Decode getpubkey object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buf + + +Buffer + + + + + + + + + +

Message payload

opts + + +Object + + + + + + + + <nullable>
+ + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded +getpubkey object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) encodeAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode getpubkey object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

getpubkey object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + +

(static) encodePayloadAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode getpubkey object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

getpubkey object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +payload when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_objects.msg.html b/docs/module-bitmessage_objects.msg.html new file mode 100644 index 0000000..a9ee231 --- /dev/null +++ b/docs/module-bitmessage_objects.msg.html @@ -0,0 +1,1029 @@ + + + + + JSDoc: Namespace: msg + + + + + + + + + + +
+ +

Namespace: msg

+ + + + + + +
+ +
+ +

+ bitmessage/objects. + + msg +

+ + +
+ +
+
+ + +

msg object.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) IGNORE :number

+ + + + +
+

Any data with this number may be ignored. The sending node might +simply be sharing its public key with you.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) SIMPLE :number

+ + + + +
+

UTF-8. Uses 'Subject' and 'Body' sections. No MIME is used.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) TRIVIAL :number

+ + + + +
+

UTF-8. No 'Subject' or 'Body' sections. Useful for simple strings +of data, like URIs or magnet links.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) decodeAsync(buf, opts) → {Promise.<Object>}

+ + + + + +
+

Decode msg object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message

opts + + +Object + + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded msg +object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) decodePayloadAsync(buf, opts) → {Promise.<Object>}

+ + + + + +
+

Decode msg object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Message payload

opts + + +Object + + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded msg +object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) encodeAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode msg object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

msg object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + +

(static) encodePayloadAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode msg object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

msg object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +payload when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_objects.pubkey.html b/docs/module-bitmessage_objects.pubkey.html new file mode 100644 index 0000000..eee5a62 --- /dev/null +++ b/docs/module-bitmessage_objects.pubkey.html @@ -0,0 +1,847 @@ + + + + + JSDoc: Namespace: pubkey + + + + + + + + + + +
+ +

Namespace: pubkey

+ + + + + + +
+ +
+ +

+ bitmessage/objects. + + pubkey +

+ + +
+ +
+
+ + +

pubkey object.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decodeAsync(buf, optsnullable) → {Promise.<Object>}

+ + + + + +
+

Decode pubkey object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buf + + +Buffer + + + + + + + + + +

Message

opts + + +Object + + + + + + + + <nullable>
+ + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded pubkey +object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) decodePayloadAsync(buf, optsnullable) → {Promise.<Object>}

+ + + + + +
+

Decode pubkey object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buf + + +Buffer + + + + + + + + + +

Message payload

opts + + +Object + + + + + + + + <nullable>
+ + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains decoded pubkey +object structure when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Object> + + +
+
+ + + + + + + + + + +

(static) encodeAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode pubkey object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

pubkey object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + +

(static) encodePayloadAsync(opts) → {Promise.<Buffer>}

+ + + + + +
+

Encode pubkey object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

pubkey object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

A promise that contains encoded message +payload when fulfilled.

+
+ + + +
+
+ Type +
+
+ +Promise.<Buffer> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_structs.PubkeyBitfield.html b/docs/module-bitmessage_structs.PubkeyBitfield.html new file mode 100644 index 0000000..34135ce --- /dev/null +++ b/docs/module-bitmessage_structs.PubkeyBitfield.html @@ -0,0 +1,292 @@ + + + + + JSDoc: Namespace: PubkeyBitfield + + + + + + + + + + +
+ +

Namespace: PubkeyBitfield

+ + + + + + +
+ +
+ +

+ bitmessage/structs. + + PubkeyBitfield +

+ + +
+ +
+
+ + +

Pubkey bitfield features.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) DOES_ACK :number

+ + + + +
+

If true, the receiving node does send acknowledgements (rather than +dropping them).

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static, constant) INCLUDE_DESTINATION :number

+ + + + +
+

Receiving node expects that the RIPE hash encoded in their address +preceedes the encrypted message data of msg messages bound for +them.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_structs.ServicesBitfield.html b/docs/module-bitmessage_structs.ServicesBitfield.html new file mode 100644 index 0000000..827de69 --- /dev/null +++ b/docs/module-bitmessage_structs.ServicesBitfield.html @@ -0,0 +1,217 @@ + + + + + JSDoc: Namespace: ServicesBitfield + + + + + + + + + + +
+ +

Namespace: ServicesBitfield

+ + + + + + +
+ +
+ +

+ bitmessage/structs. + + ServicesBitfield +

+ + +
+ +
+
+ + +

Services bitfield features.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) NODE_NETWORK :number

+ + + + +
+

This is a normal network node.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_structs.encrypted.html b/docs/module-bitmessage_structs.encrypted.html new file mode 100644 index 0000000..8986818 --- /dev/null +++ b/docs/module-bitmessage_structs.encrypted.html @@ -0,0 +1,451 @@ + + + + + JSDoc: Namespace: encrypted + + + + + + + + + + +
+ +

Namespace: encrypted

+ + + + + + +
+ +
+ +

+ bitmessage/structs. + + encrypted +

+ + +
+ +
+
+ + +

Encrypted payload.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf) → {Object}

+ + + + + +
+

Decode encrypted payload.
NOTE: all structure members are copied.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

A buffer that contains encrypted payload

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded encrypted structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(opts) → {Buffer}

+ + + + + +
+

Encode encrypted.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Encode options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded encrypted payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_structs.inv_vect.html b/docs/module-bitmessage_structs.inv_vect.html new file mode 100644 index 0000000..4dc549d --- /dev/null +++ b/docs/module-bitmessage_structs.inv_vect.html @@ -0,0 +1,298 @@ + + + + + JSDoc: Namespace: inv_vect + + + + + + + + + + +
+ +

Namespace: inv_vect

+ + + + + + +
+ +
+ +

+ bitmessage/structs. + + inv_vect +

+ + +
+ +
+
+ + +

Inventory vector.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) encode(buf) → {Buffer}

+ + + + + +
+

Encode inventory vector.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Payload to calculate the inventory vector for

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded inv_vect.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_structs.message.html b/docs/module-bitmessage_structs.message.html new file mode 100644 index 0000000..254350d --- /dev/null +++ b/docs/module-bitmessage_structs.message.html @@ -0,0 +1,550 @@ + + + + + JSDoc: Namespace: message + + + + + + + + + + +
+ +

Namespace: message

+ + + + + + +
+ +
+ +

+ bitmessage/structs. + + message +

+ + +
+ +
+
+ + +

Message structure.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) MAGIC :number

+ + + + +
+

Bitmessage magic value.

+
+ + + +
Type:
+
    +
  • + +number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf) → {Object}

+ + + + + +
+

Decode message structure.
NOTE: payload is copied, rest references input buffer.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buf + + +Buffer + + + +

Buffer that starts with encoded message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded message structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(command, payload) → {Buffer}

+ + + + + +
+

Encode message structure.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
command + + +string + + + +

Message command

payload + + +Bufer + + + +

Message payload

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded message structure.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_structs.net_addr.html b/docs/module-bitmessage_structs.net_addr.html new file mode 100644 index 0000000..e251573 --- /dev/null +++ b/docs/module-bitmessage_structs.net_addr.html @@ -0,0 +1,498 @@ + + + + + JSDoc: Namespace: net_addr + + + + + + + + + + +
+ +

Namespace: net_addr

+ + + + + + +
+ +
+ +

+ bitmessage/structs. + + net_addr +

+ + +
+ +
+
+ + +

Network address.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf, optsnullable) → {Object}

+ + + + + +
+

Decode net_addr.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buf + + +Buffer + + + + + + + + + +

A buffer that contains encoded net_addr

opts + + +Object + + + + + + + + <nullable>
+ + + +

Decoding options; use short option to +decode net_addr from +version message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded net_addr structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(opts) → {Buffer}

+ + + + + +
+

Encode net_addr.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Encode options; use short option to encode +net_addr for +version message

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded net_addr.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_structs.object.html b/docs/module-bitmessage_structs.object.html new file mode 100644 index 0000000..3f12417 --- /dev/null +++ b/docs/module-bitmessage_structs.object.html @@ -0,0 +1,999 @@ + + + + + JSDoc: Namespace: object + + + + + + + + + + +
+ +

Namespace: object

+ + + + + + +
+ +
+ +

+ bitmessage/structs. + + object +

+ + +
+ +
+
+ + +

An object is a message which is shared throughout a stream. It is +the only message which propagates; all others are only between two +nodes.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) decode(buf, optsnullable) → {Object}

+ + + + + +
+

Decode object message.
NOTE: nonce and objectPayload are copied.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buf + + +Buffer + + + + + + + + + +

Message

opts + + +Object + + + + + + + + <nullable>
+ + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded object structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) decodePayload(buf, optsnullable) → {Object}

+ + + + + +
+

Decode object message payload.
NOTE: nonce and objectPayload are copied.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
buf + + +Buffer + + + + + + + + + +

Message payload

opts + + +Object + + + + + + + + <nullable>
+ + + +

Decoding options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoded object structure.

+
+ + + +
+
+ Type +
+
+ +Object + + +
+
+ + + + + + + + + + +

(static) encode(opts) → {Buffer}

+ + + + + +
+

Encode object message.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded message.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodePayload(opts) → {Buffer}

+ + + + + +
+

Encode object message payload.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodePayloadWithoutNonce(opts) → {Buffer}

+ + + + + +
+

Encode object message payload without leading nonce field (may be +useful if you are going to calculate it later).

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object + + + +

Object options

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded payload.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/module-bitmessage_user-agent.html b/docs/module-bitmessage_user-agent.html new file mode 100644 index 0000000..918c053 --- /dev/null +++ b/docs/module-bitmessage_user-agent.html @@ -0,0 +1,913 @@ + + + + + JSDoc: Module: bitmessage/user-agent + + + + + + + + + + +
+ +

Module: bitmessage/user-agent

+ + + + + + +
+ +
+ + + + + +
+ +
+
+ + +

Working with Bitmessage user agents.

+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + +
See:
+
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static, constant) SELF :Array.<Object>

+ + + + +
+

User agent of the bitmessage library itself.

+
+ + + +
Type:
+
    +
  • + +Array.<Object> + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) decode()

+ + + + + +
+

Decode user agent's var_str. Just an alias for +var_str.decode.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) encode(software) → {Buffer}

+ + + + + +
+

Encode user agent into var_str Buffer. Most underlying software +comes first.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
software + + +Array.<Object> +| + +Array.<string> +| + +string + + + +

List of software to +encode or just raw user agent string

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded user agent.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodeSelf() → {Buffer}

+ + + + + +
+

Encode bitmessage's user agent.

+
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded user agent.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) encodeSelfWith(software) → {Buffer}

+ + + + + +
+

Encode user agent with bitmessage's user agent underneath. Most +underlying software comes first.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
software + + +Array.<Object> +| + +Array.<string> +| + +Object +| + +string + + + +

List of +software to encode

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Encoded user agent.

+
+ + + +
+
+ Type +
+
+ +Buffer + + +
+
+ + + + + + + + + + +

(static) parse(str) → {Array.<Object>}

+ + + + + +
+

Parse raw user agent into software stack list. Most underlying +software comes first.
NOTE: Decoding is rather loose, it won't fail on bad user agent +format because it's not that important.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
str + + +string + + + +

Raw user agent string

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Parsed user agent.

+
+ + + +
+
+ Type +
+
+ +Array.<Object> + + +
+
+ + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/user-agent.js.html b/docs/user-agent.js.html new file mode 100644 index 0000000..738e026 --- /dev/null +++ b/docs/user-agent.js.html @@ -0,0 +1,161 @@ + + + + + JSDoc: Source: user-agent.js + + + + + + + + + + +
+ +

Source: user-agent.js

+ + + + + + +
+
+
/**
+ * Working with Bitmessage user agents.
+ * @see {@link https://bitmessage.org/wiki/User_Agent}
+ * @module bitmessage/user-agent
+ */
+
+"use strict";
+
+var var_str = require("./structs").var_str;
+var BM_NAME = require("../package.json").name;
+var BM_VERSION = require("../package.json").version;
+
+/**
+ * User agent of the bitmessage library itself.
+ * @constant {Object[]}
+ * @static
+ */
+var SELF = exports.SELF = [{name: BM_NAME, version: BM_VERSION}];
+
+/**
+ * Decode user agent's `var_str`. Just an alias for
+ * [var_str.decode]{@link module:bitmessage/structs.var_str.decode}.
+ * @function
+ */
+exports.decode = var_str.decode;
+
+/**
+ * Parse raw user agent into software stack list. Most underlying
+ * software comes first.  
+ * NOTE: Decoding is rather loose, it won't fail on bad user agent
+ * format because it's not that important.
+ * @param {string} str - Raw user agent string
+ * @return {Object[]} Parsed user agent.
+ */
+exports.parse = function(str) {
+  var software = [];
+  if (str.length > 2 && str[0] === "/" && str[str.length - 1] === "/") {
+    software = str.slice(1, -1).split("/");
+    software = software.map(function(str) {
+      // That's more readable than /([^:]*)(?::([^(]*)(?:\(([^)]*))?)?/
+      var soft = {name: str};
+      var semicolon = soft.name.indexOf(":");
+      if (semicolon !== -1) {
+        soft.version = soft.name.slice(semicolon + 1);
+        soft.name = soft.name.slice(0, semicolon);
+        var obracket = soft.version.indexOf("(");
+        if (obracket !== -1) {
+          soft.comments = soft.version.slice(obracket + 1);
+          soft.version = soft.version.slice(0, obracket);
+          var cbracket = soft.comments.indexOf(")");
+          if (cbracket !== -1) {
+            soft.comments = soft.comments.slice(0, cbracket);
+          }
+        }
+      }
+      return soft;
+    });
+  }
+  return software;
+};
+
+/**
+ * Encode user agent into `var_str` Buffer. Most underlying software
+ * comes first.
+ * @param {(Object[]|string[]|string)} software - List of software to
+ * encode or just raw user agent string
+ * @return {Buffer} Encoded user agent.
+ * @function
+ * @static
+ */
+var encode = exports.encode = function(software) {
+  var ua;
+  if (Array.isArray(software)) {
+    ua = software.map(function(soft) {
+      if (typeof soft === "string") {
+        return soft;
+      }
+      var version = soft.version || "0.0.0";
+      var str = soft.name + ":" + version;
+      if (soft.comments) {
+        str += "(" + soft.comments + ")";
+      }
+      return str;
+    }).join("/");
+    ua = "/" + ua + "/";
+  } else {
+    ua = software;
+  }
+  return var_str.encode(ua);
+};
+
+/**
+ * Encode bitmessage's user agent.
+ * @return {Buffer} Encoded user agent.
+ */
+exports.encodeSelf = function() {
+  return encode(SELF);
+};
+
+/**
+ * Encode user agent with bitmessage's user agent underneath. Most
+ * underlying software comes first.
+ * @param {(Object[]|string[]|Object|string)} software - List of
+ * software to encode
+ * @return {Buffer} Encoded user agent.
+ */
+exports.encodeSelfWith = function(software) {
+  software = SELF.concat(software);
+  return encode(software);
+};
+
+
+
+ + + + +
+ + + +
+ + + + + + +