light-openid 2.0.2

Lightweight OpenID primitives & client
Documentation
use reqwest::StatusCode;

#[derive(thiserror::Error, Debug)]
pub enum OpenIdError {
    #[error("Reqwest error: {0}")]
    Reqwest(#[from] reqwest::Error),
    #[error("http request failed with status: {0}")]
    HTTPRequestFailedWithInvalidStatus(StatusCode),
    #[error("Serde json error: {0}")]
    SerdeJson(#[from] serde_json::Error),
    #[error("validate id token: {0}")]
    ValidateIdToken(Box<Self>),
    #[error("decode jwt header: {0}")]
    DecodeJWTHeader(#[source] jsonwebtoken::errors::Error),
    #[error("kid is required for signature verification!")]
    KidRequiredForSignatureVerification,
    #[error("missing jwks in client configuration!")]
    MissingJWKs,
    #[error("unknown kid for signature verification: {0}")]
    UnknownKid(String),
    #[error("failed to decode jwk: {0}")]
    DecodeJWK(#[source] jsonwebtoken::errors::Error),
    #[error("failed to validate jwk: {0}")]
    ValidateJWT(#[source] jsonwebtoken::errors::Error),
    #[cfg(feature = "crypto-wrapper")]
    #[error("State error: invalid IP")]
    StateErrorInvalidIP,
    #[cfg(feature = "crypto-wrapper")]
    #[error("State error: expired")]
    StateErrorExpired,
    #[cfg(feature = "crypto-wrapper")]
    #[error("Rkyv error: {0}")]
    RkyvError(#[from] rkyv::rancor::Error),
    #[cfg(feature = "crypto-wrapper")]
    #[error("Base64 decoding error: {0}")]
    Base64Decode(#[from] base64::DecodeError),
    #[cfg(feature = "crypto-wrapper")]
    #[error("Input string is smaller than nonce!")]
    DecInputStringSmallerThanNonce,
    #[cfg(feature = "crypto-wrapper")]
    #[error("Failed to decrypt wrapped data!")]
    DecryptWrappedData,
    #[cfg(feature = "crypto-wrapper")]
    #[error("try from slice error: {0}")]
    TryFromSliceError(#[from] std::array::TryFromSliceError),
}

pub(crate) type Res<T = ()> = Result<T, OpenIdError>;