Namespace: pubkey

bitmessage/objects. pubkey

Methods

(static) decodeAsync(buf, optsopt) → {Promise.<DecodeResult>}

Decode pubkey object message.

Parameters:
Name Type Attributes Description
buf Buffer

Message

opts Object <optional>

Any of object.decode options and:

Properties
Name Type Description
needed Array.<Address> | Address | Object

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.

Source:
Returns:

A promise that contains decoded pubkey structure when fulfilled.

Type
Promise.<DecodeResult>

(static) decodePayloadAsync()

Decode pubkey object message payload. The same as decodeAsync.

Source:

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

Encode pubkey object message.

Parameters:
Name Type Description
opts Object

pubkey 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

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 pubkey object message payload. The same as encodeAsync.

Source:

Type Definitions

DecodeResult

Type:
  • Object
Properties:
Name Type 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

tag Buffer

Tag derived from the address object (present only if object version is 4)

behavior Object

Pubkey features that can be expected from the node

signPublicKey Buffer

Signing public key

encPublicKey Buffer

Encryption public key

nonceTrialsPerByte number

Difficulty parameter of the node (present only for pubkey version >= 3)

payloadLengthExtraBytes number

Difficulty parameter of the node (present only for pubkey version >= 3)

signature Buffer

Signature of the message (present only for pubkey version >= 3)

length number

Real data length

Source: