1#[derive(Debug, thiserror::Error)]
2pub enum AuthError {
3 #[error("database error: {0}")]
4 Database(#[from] sqlx::Error),
5
6 #[error("invalid email format")]
7 InvalidEmail,
8
9 #[error("not found")]
10 NotFound,
11
12 #[error("conflict: {0}")]
13 Conflict(String),
14
15 #[error("invalid password hash: {0}")]
16 InvalidPasswordHash(String),
17
18 #[error("email error: {0}")]
19 Email(String),
20
21 #[error("jwt error: {0}")]
22 Jwt(String),
23
24 #[error("OAuth state invalid or expired")]
25 OAuthStateMismatch,
26
27 #[error("OAuth token exchange failed: {0}")]
28 OAuthTokenExchange(String),
29
30 #[error("OAuth user info fetch failed: {0}")]
31 OAuthUserInfoFetch(String),
32
33 #[error("OAuth HTTP error: {0}")]
34 OAuthHttp(String),
35
36 #[error("MFA not configured -- provide mfa_key to AllowThemBuilder")]
37 MfaNotConfigured,
38
39 #[error("MFA already enabled for this user")]
40 MfaAlreadyEnabled,
41
42 #[error("MFA not enabled for this user")]
43 MfaNotEnabled,
44
45 #[error("invalid TOTP code")]
46 InvalidTotpCode,
47
48 #[error("MFA encryption error: {0}")]
49 MfaEncryption(String),
50}