new DataValidationState(data, successCallback, failureCallback)
The DataValidationState class extends ValidationState to hold the validation
state for a Data packet.
Create a DataValidationState for the Data 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 |
---|---|---|
data |
Data | The Date packet being validated, which is copied. |
successCallback |
function | This calls successCallback(data) to report a successful Data validation. |
failureCallback |
function | This calls failureCallback(data, error) to report a failed Data validation, where error is a ValidationError. |
Methods
bypassValidation_()
Override to call the success callback using the Data packet given to the
constructor.
fail(error)
Call the failure callback.
Parameters:
Name | Type | Description |
---|---|---|
error |
ValidationError |
getOriginalData() → {Data}
Get the original Data packet being validated which was given to the
constructor.
Returns:
The original Data packet.
- Type
- Data
verifyOriginalPacketPromise_(trustedCertificate) → {Promise|SyncPromise}
Override to verify the Data packet given to the constructor.
Parameters:
Name | Type | Description |
---|---|---|
trustedCertificate |
CertificateV2 | The certificate that signs the original packet. |
Returns:
A promise that resolves when the success or
failure callback has been called.
- Type
- Promise | SyncPromise