futureauth 0.5.0

OTP authentication SDK — local session management with FutureAuth OTP delivery
Documentation
use thiserror::Error;

#[derive(Debug, Error)]
pub enum FutureAuthError {
    #[error("database error: {0}")]
    Database(#[from] sqlx::Error),

    #[error("http error: {0}")]
    Http(#[from] reqwest::Error),

    #[error("invalid OTP code")]
    InvalidOtp,

    #[error("OTP expired")]
    OtpExpired,

    #[error("OTP max attempts exceeded")]
    OtpMaxAttempts,

    #[error("OTP delivery failed: {0}")]
    OtpDeliveryFailed(String),

    #[error("invalid magic link")]
    InvalidMagicLink,

    #[error("magic link expired")]
    MagicLinkExpired,

    #[error("magic link delivery failed: {0}")]
    MagicLinkDeliveryFailed(String),

    #[error("session not found or expired")]
    SessionNotFound,

    #[error("user not found")]
    UserNotFound,

    #[error("invalid configuration: {0}")]
    Config(String),
}

pub type Result<T> = std::result::Result<T, FutureAuthError>;