kadence/spartacus~ SpartacusPlugin

Implements the spartacus decorations to the node object

Constructor

new SpartacusPlugin(node, privateKeyopt, optionsopt)

Creates the plugin instance given a node and optional identity

Parameters:
NameTypeAttributesDefaultDescription
nodeKademliaNode
privateKeybuffer<optional>

SECP256K1 private key

optionsobject<optional>
{}
Properties
NameTypeAttributesDefaultDescription
checkPublicKeyHashboolean<optional>
true

Methods

deserialize()

Parses and verifies the signature payload, then passes through to the JsonRpcDeserializer if successful

serialize()

Processes with JsonRpcSerializer then signs the result and appends an additional payload containing signature+identity information

setValidationPeriod(period)

Sets the validation period for nodes

Parameters:
NameTypeDescription
periodnumber

Milliseconds to honor a proven contact response

validate(node, request, response, next)

Checks if the sender is addressable at the claimed contact information and cross checks signatures between the original sender and the node addressed. This is intended to prevent reflection attacks and general DDoS via spam.

Parameters:
NameTypeDescription
nodeKademliaNode
requestAbstractNode~request
responseAbstractNode~response
nextAbstractNode~next