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