1#[derive(thiserror::Error, Debug)]
2pub enum OpenIdError {
3 #[error("Reqwest error: {0}")]
4 Reqwest(#[from] reqwest::Error),
5 #[error("Serde json error: {0}")]
6 SerdeJson(#[from] serde_json::Error),
7 #[error("validate id token: {0}")]
8 ValidateIdToken(Box<Self>),
9 #[error("decode jwt header: {0}")]
10 DecodeJWTHeader(#[source] jsonwebtoken::errors::Error),
11 #[error("kid is required for signature verification!")]
12 KidRequiredForSignatureVerification,
13 #[error("missing jwks in client configuration!")]
14 MissingJWKs,
15 #[error("unknown kid for signature verification: {0}")]
16 UnknownKid(String),
17 #[error("failed to decode jwk: {0}")]
18 DecodeJWK(#[source] jsonwebtoken::errors::Error),
19 #[error("failed to validate jwk: {0}")]
20 ValidateJWT(#[source] jsonwebtoken::errors::Error),
21 #[cfg(feature = "crypto-wrapper")]
22 #[error("State error: invalid IP")]
23 StateErrorInvalidIP,
24 #[cfg(feature = "crypto-wrapper")]
25 #[error("State error: expired")]
26 StateErrorExpired,
27 #[cfg(feature = "crypto-wrapper")]
28 #[error("Rkyv error: {0}")]
29 RkyvError(#[from] rkyv::rancor::Error),
30 #[cfg(feature = "crypto-wrapper")]
31 #[error("Base64 decoding error: {0}")]
32 Base64Decode(#[from] base64::DecodeError),
33 #[cfg(feature = "crypto-wrapper")]
34 #[error("Input string is smaller than nonce!")]
35 DecInputStringSmallerThanNonce,
36 #[cfg(feature = "crypto-wrapper")]
37 #[error("Failed to decrypt wrapped data!")]
38 DecryptWrappedData,
39 #[cfg(feature = "crypto-wrapper")]
40 #[error("try from slice error: {0}")]
41 TryFromSliceError(#[from] std::array::TryFromSliceError),
42}
43
44pub(crate) type Res<T = ()> = Result<T, OpenIdError>;