new PubkeyBitfield(bufopt, optsopt)
Pubkey features bitfield (MSB 0).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
buf |
Buffer |
<optional> |
A 4-byte bitfield buffer (will be created if
not provided or will be copied if |
opts |
Object |
<optional> |
Options |
- Source:
- See:
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
Members
(static, constant) DOES_ACK :number
Bit index. If set, the receiving node does send acknowledgements (rather than dropping them).
Type:
- number
- Source:
(static, constant) INCLUDE_DESTINATION :number
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.
Type:
- number
- Source:
buffer :Buffer
The contents of the bitfield.
Type:
- Buffer
- Source:
Methods
get(index) → {boolean}
Returns a boolean indicating whether the bit is set.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Bit index (MSB 0) |
- Source:
Returns:
- Type
- boolean
set(index) → {Object}
Set the given bit(s) to 1
.
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Array.<number> | Bit(s) index (MSB 0) |
- Source:
Returns:
Returns self so methods can be chained.
- Type
- Object