new ValidationPolicyConfig()
ValidationPolicyConfig implements a validator which can be set up via a
configuration file. For command Interest validation, this policy must be
combined with ValidationPolicyCommandInterest in order to guard against
replay attacks.
Methods
(static) getRefreshPeriod_(configSection) → {number}
Get the "refresh" value. If the value is 9, return a period of one hour.
Parameters:
Name | Type | Description |
---|---|---|
configSection |
BoostInfoTree | The section containing the definition of the trust anchor, e.g. one of "validator.trust-anchor". |
Returns:
The refresh period in milliseconds. However if there is no
"refresh" value, return a large number (effectively no refresh).
- Type
- number
checkPolicy(dataOrInterest, state, continueValidation)
Parameters:
Name | Type | Description |
---|---|---|
dataOrInterest |
Data | Interest | |
state |
ValidationState | |
continueValidation |
function |
load(filePath, input, configSection, inputName)
There are three forms of load:
load(filePath) - Load the configuration from the given config file.
load(input, inputName) - Load the configuration from the given input string.
load(configSection, inputName) - Load the configuration from the given
configSection.
Each of these forms of load replaces any existing configuration.
Parameters:
Name | Type | Description |
---|---|---|
filePath |
String | The The path of the config file. |
input |
String | The contents of the configuration rules, with lines separated by "\n" or "\r\n". |
configSection |
BoostInfoTree | The configuration section loaded from the config file. It should have one "validator" section. |
inputName |
String | Used for log messages, etc. |
processConfigTrustAnchor_(configSection, inputName)
Process the trust-anchor configuration section and call
validator_.loadAnchor as needed.
Parameters:
Name | Type | Description |
---|---|---|
configSection |
BoostInfoTree | The section containing the definition of the trust anchor, e.g. one of "validator.trust-anchor". |
inputName |
String | Used for log messages, etc. |