use thiserror::Error;
#[derive(Debug, Error, Clone, PartialEq)]
pub enum AuthError {
#[error("missing or invalid authentication token")]
InvalidToken,
#[error("failed to decode token header")]
DecodeHeader,
#[error("failed to find matching key in JWKS")]
NoMatchingKey,
#[error("unsupported key type for Supabase: {0}")]
UnsupportedKeyType(String),
#[error("unsupported curve for Supabase: {0}")]
UnsupportedCurve(String),
#[error("invalid key component: {0}")]
InvalidKeyComponent(String),
#[error("base64 decode error: {0}")]
Base64Decode(String),
#[error("invalid algorithm")]
InvalidAlgorithm,
#[error("token verification failed")]
Verification,
#[error("invalid claims")]
InvalidClaims,
#[error("internal JWKS error: {0}")]
JwksError(String),
#[error("malformed token format")]
MalformedToken,
#[error("network error: {0}")]
NetworkError(String),
}