flamingo-verifier-client 0.11.2

Attestation-verifying client for the Flamingo verifier
Documentation
//! The crate's error type.

use pontifex::{ChannelError, attestation};

/// Failures while configuring or calling the host.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// A configuration field was not usable.
    #[error("invalid {attribute}: {reason}")]
    InvalidConfig {
        /// Which field.
        attribute: String,
        /// Why it was rejected.
        reason: String,
    },

    /// The configuration JSON could not be parsed.
    #[error("failed to parse config: {0}")]
    MalformedConfig(String),

    /// An attestation document did not verify.
    #[error(transparent)]
    Attestation(#[from] attestation::Error),

    /// The assignment document or public key was not valid base64.
    #[error("assignment document or public key was not valid base64")]
    MalformedAssignment,

    /// The assignment is stale: re-assign, re-seal, and retry once.
    #[error("the request was not sealed to the enclave's current key; re-assign and retry once")]
    ReassignRequired,

    /// Channel attestation, key binding, sealing or opening failed.
    #[error("sealed channel failure: {0:?}")]
    Channel(#[source] ChannelError),

    /// The request violated a WIP-201 bound or its AAT did not verify.
    #[error("match request was malformed")]
    MalformedRequest,
    /// The attested release does not define the request's pipeline or `match_strictness`, or the
    /// request's `pipeline_inputs` do not fit the pipeline.
    #[error("the enclave's release does not support the request's pipeline or strictness")]
    ReleaseUnavailable,
    /// The request's pipeline lists more response slots than the configured maximum, so its
    /// response timing could reveal too much (WIP-201 ยง4.6 step 3).
    #[error("the pipeline lists more response slots than the configured maximum")]
    TooManyResponseSlots,
    /// The assignment's attestation does not carry the `release_hash` of its release manifest.
    #[error("the attestation does not attest the assignment's release manifest")]
    ReleaseNotAttested,
    /// The sealed plaintext was not a match result.
    #[error("sealed response was not a match result")]
    MalformedResult,

    /// The attested signing public key was not a valid `BabyJubJub` point.
    #[error("attested signing public key was invalid")]
    InvalidSigningKey,

    /// The statement did not verify under the attested signing key.
    #[error("match statement did not verify under the attested signing key")]
    StatementInvalid,

    /// The WebSocket handshake or an I/O operation on it failed.
    #[error("WebSocket transport failed: {0}")]
    WebSocket(#[source] tokio_tungstenite::tungstenite::Error),

    /// An operation did not finish within its configured deadline.
    #[error("the host did not respond within the configured deadline")]
    Timeout,

    /// The host closed the WebSocket before the exchange completed.
    #[error("the host closed the connection before the exchange completed")]
    ConnectionClosed,

    /// A frame was not the message the protocol expects at that point.
    #[error("the host sent an unexpected or malformed message")]
    MalformedMessage,

    /// The host returned an error envelope over the WebSocket.
    #[error("host returned error ({code})")]
    ApiFrame {
        /// Machine-readable code from the envelope.
        code: String,
        /// Whether the host says the request may be retried.
        allow_retry: bool,
    },
}