Skip to main content

assay_auth/
error.rs

1//! Error types for the auth crate.
2//!
3//! Backends and modules return [`Error`] uniformly so callers (engine
4//! HTTP handlers in phase 8) can map a single enum to status codes.
5
6#[derive(thiserror::Error, Debug)]
7pub enum Error {
8    #[error("invalid credentials")]
9    InvalidCredentials,
10    #[error("session not found or expired")]
11    SessionNotFound,
12    #[error("csrf token mismatch")]
13    CsrfMismatch,
14    #[error("jwt verification failed: {0}")]
15    Jwt(String),
16    #[error("zanzibar depth limit exceeded")]
17    ZanzibarDepth,
18    #[error("zanzibar cycle detected")]
19    ZanzibarCycle,
20    #[error("oidc error: {0}")]
21    Oidc(String),
22    #[error("passkey error: {0}")]
23    Passkey(String),
24    #[error("backend: {0}")]
25    Backend(#[from] anyhow::Error),
26}
27
28pub type Result<T> = std::result::Result<T, Error>;