new ValidationPolicy()
ValidationPolicy is an abstract base class that implements a validation
policy for Data and Interest packets.
- Source:
Methods
(static) getKeyLocatorName(dataOrInterest, state) → {Name}
Extract the KeyLocator Name from a Data or signed Interest packet.
The SignatureInfo in the packet must contain a KeyLocator of type KEYNAME.
Otherwise, state.fail is invoked with INVALID_KEY_LOCATOR.
Parameters:
Name | Type | Description |
---|---|---|
dataOrInterest |
Data | Interest | The Data or Interest packet with the KeyLocator. |
state |
ValidationState | On error, this calls state.fail and returns an empty Name. |
- Source:
Returns:
The KeyLocator name, or an empty Name for failure.
- Type
- Name
(static) getKeyLocatorNameFromSignature_(signatureInfo, state) → {Name}
A helper method for getKeyLocatorName.
Parameters:
Name | Type | Description |
---|---|---|
signatureInfo |
Signature | |
state |
ValidationState |
- Source:
Returns:
- Type
- Name
checkCertificatePolicy(certificate, state, continueValidation)
Check the certificate against the policy.
This base class implementation just calls checkPolicy(certificate, ...). Your
derived class may override. Depending on implementation of the policy, this
check can be done synchronously or asynchronously. See the checkPolicy(Data)
documentation for the semantics.
Parameters:
Name | Type | Description |
---|---|---|
certificate |
CertificateV2 | The certificate to check. |
state |
ValidationState | The ValidationState of this validation. |
continueValidation |
function | The policy should call continueValidation() as described above. |
- Source:
checkPolicy(dataOrInterest, state, continueValidation)
Check the Data or Interest packet against the policy.
Your derived class must implement this.
Depending on the implementation of the policy, this check can be done
synchronously or asynchronously.
The semantics of checkPolicy are as follows:
If the packet violates the policy, then the policy should call
state.fail() with an appropriate error code and error description.
If the packet conforms to the policy and no further key retrievals are
necessary, then the policy should call continueValidation(null, state).
If the packet conforms to the policy and a key needs to be fetched, then
the policy should call
continueValidation({appropriate-key-request-instance}, state).
Parameters:
Name | Type | Description |
---|---|---|
dataOrInterest |
Data | Interest | The Data or Interest packet to check. |
state |
ValidationState | The ValidationState of this validation. |
continueValidation |
function | The policy should call continueValidation() as described above. |
- Source:
getInnerPolicy() → {ValidationPolicy}
Get the inner policy. If the inner policy was not set, the behavior is
undefined.
- Source:
Returns:
The inner policy.
- Type
- ValidationPolicy
hasInnerPolicy() → {boolean}
Check if the inner policy is set.
- Source:
Returns:
True if the inner policy is set.
- Type
- boolean
setInnerPolicy(innerPolicy)
Set the inner policy.
Multiple assignments of the inner policy will create a "chain" of linked
policies. The inner policy from the latest invocation of setInnerPolicy
will be at the bottom of the policy list.
For example, the sequence `this.setInnerPolicy(policy1)` and
`this.setInnerPolicy(policy2)`, will result in
`this.innerPolicy_ == policy1`,
this.innerPolicy_.innerPolicy_ == policy2', and
`this.innerPolicy_.innerPolicy_.innerPolicy_ == null`.
Parameters:
Name | Type | Description |
---|---|---|
innerPolicy |
ValidationPolicy |
- Source:
Throws:
Error if the innerPolicy is null.
setValidator(validator)
Set the validator to which this policy is associated. This replaces any
previous validator.
Parameters:
Name | Type | Description |
---|---|---|
validator |
Validator | The validator. |
- Source: