Constructor
new SpartacusPlugin(node, privateKeyopt, optionsopt)
Creates the plugin instance given a node and optional identity
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
node | KademliaNode | |||||||||||||
privateKey | buffer | <optional> | SECP256K1 private key | |||||||||||
options | object | <optional> | {} | Properties
|
- Source
Methods
deserialize()
Parses and verifies the signature payload, then passes through to the JsonRpcDeserializer if successful
- Implements
- Source
serialize()
Processes with JsonRpcSerializer then signs the result and appends an additional payload containing signature+identity information
- Implements
- Source
setValidationPeriod(period)
Sets the validation period for nodes
Parameters:
Name | Type | Description |
---|---|---|
period | number | Milliseconds to honor a proven contact response |
- Source
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:
Name | Type | Description |
---|---|---|
node | KademliaNode | |
request | AbstractNode~request | |
response | AbstractNode~response | |
next | AbstractNode~next |
- Source