fraiseql_wire/auth/
mod.rs1pub mod scram;
8
9pub use scram::{ScramClient, ScramError};
10
11use std::fmt;
12
13#[derive(Debug, Clone)]
15#[non_exhaustive]
16pub enum AuthError {
17 Scram(ScramError),
19 MechanismNotSupported(String),
21 InvalidServerMessage(String),
23 Utf8Error(String),
25}
26
27impl fmt::Display for AuthError {
28 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29 match self {
30 AuthError::Scram(e) => write!(f, "SCRAM authentication error: {}", e),
31 AuthError::MechanismNotSupported(mech) => {
32 write!(f, "server does not support mechanism: {}", mech)
33 }
34 AuthError::InvalidServerMessage(msg) => {
35 write!(f, "invalid server message format: {}", msg)
36 }
37 AuthError::Utf8Error(msg) => write!(f, "UTF-8 encoding error: {}", msg),
38 }
39 }
40}
41
42impl std::error::Error for AuthError {}
43
44impl From<ScramError> for AuthError {
45 fn from(e: ScramError) -> Self {
46 AuthError::Scram(e)
47 }
48}