Namespace: msg

bitmessage/objects. msg

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.<DecodeResult>}

Decode msg object message.

Parameters:
Name Type Description
buf Buffer

Message

opts Object

Any of object.decode options and:

Properties
Name Type Description
identities Array.<Address> | Address

Address objects used to decrypt the message

Source:
Returns:

A promise that contains [decoded msg structure]module:bitmessage/objects.msg.DecodeResult when fulfilled.

Type
Promise.<DecodeResult>

(static) decodePayloadAsync()

Decode msg object message payload. The same as decodeAsync.

Source:

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

Encode msg object message.

Parameters:
Name Type Description
opts Object

msg object options

Properties
Name Type Attributes Description
ttl number

Time to live in seconds

from Address

Originator of the message

to Address

Receiver of the message

message string | Buffer

Message

subject string | Buffer <optional>

Subject for SIMPLE encoding

encoding number <optional>

Encoding of the message (TRIVIAL by default)

friend boolean <optional>

Whether the receiver is friend and should have minimal POW difficulty (false by default)

skipPow boolean <optional>

Do not compute POW (false by default)

Source:
Returns:

A promise that contains encoded message when fulfilled.

Type
Promise.<Buffer>

(static) encodePayloadAsync()

Encode msg object message payload. The same as encodeAsync.

Source:

Type Definitions

DecodeResult

Type:
  • Object
Properties:
Name Type Attributes Description
nonce Buffer

A 8-byte object nonce

ttl number

Time to live in seconds

type number

Object type

version number

Object version

stream number

Object stream

headerLength number

Length of the object header

senderVersion number

Sender's address version

senderStream number

Sender's stream

behavior Object

Sender's pubkey features that can be expected from the node

signPublicKey Buffer

Sender's signing public key

encPublicKey Buffer

Sender's encryption public key

nonceTrialsPerByte number

Difficulty parameter of the sender (present only if sender's address version >= 3)

payloadLengthExtraBytes number

Difficulty parameter of the sender (present only if sender's address version >= 3)

ripe Buffer

The RIPEMD hash of the receiver's keys

encoding number

Message encoding

message string | Buffer

Message string for TRIVIAL and SIMPLE encodings or unparsed buffer data for other encodings

subject string <optional>

Subject string for SIMPLE encoding

ack Buffer

Message acknowledgement

signature Buffer

Signature of the message

length number

Real data length

Source: