mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
20 lines
521 B
Rust
20 lines
521 B
Rust
use thiserror::Error;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum AuthError {
|
|
#[error("password hash error: {0}")]
|
|
PasswordHash(String),
|
|
#[error("invalid api key encoding: {0}")]
|
|
ApiKeyEncoding(#[from] base64::DecodeError),
|
|
#[error("invalid api key pepper length")]
|
|
InvalidPepperLength,
|
|
}
|
|
|
|
pub type AuthResult<T> = Result<T, AuthError>;
|
|
|
|
impl From<argon2::password_hash::Error> for AuthError {
|
|
fn from(value: argon2::password_hash::Error) -> Self {
|
|
Self::PasswordHash(value.to_string())
|
|
}
|
|
}
|