Class: InterestValidationState

InterestValidationState(interest, successCallback, failureCallback)

new InterestValidationState(interest, successCallback, failureCallback)

The InterestValidationState class extends ValidationState to hold the validation state for an Interest packet. Create an InterestValidationState for the Interest packet. The caller must ensure that the state instance is valid until the validation finishes (i.e., until validateCertificateChain() and validateOriginalPacket() have been called).
Parameters:
Name Type Description
interest Interest The Interest packet being validated, which is copied.
successCallback function This calls successCallback(interest) to report a successful Interest validation.
failureCallback function This calls failureCallback(interest, error) to report a failed Interest validation, where error is a ValidationError.
Source:

Methods

addSuccessCallback(successCallback)

Parameters:
Name Type Description
successCallback function This calls successCallback(interest).
Source:

bypassValidation_()

Override to call the success callback using the Interest packet given to the constructor.
Source:

fail(error)

Call the failure callback.
Parameters:
Name Type Description
error ValidationError
Source:

getOriginalInterest() → {Interest}

Get the original Interest packet being validated which was given to the constructor.
Source:
Returns:
The original Interest packet.
Type
Interest

verifyOriginalPacketPromise_(trustedCertificate) → {Promise|SyncPromise}

Override to verify the Interest packet given to the constructor.
Parameters:
Name Type Description
trustedCertificate CertificateV2 The certificate that signs the original packet.
Source:
Returns:
A promise that resolves when the success or failure callback has been called.
Type
Promise | SyncPromise