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