catzconnect 1.0.0

Secure, minimal SDK for sending encrypted communication requests to the CatzConnect API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use once_cell::sync::Lazy;
use regex::Regex;

use crate::error::CatzError;

static EMAIL_RE: Lazy<Regex> =
    Lazy::new(|| Regex::new(r"^[^\s@]+@[^\s@]+\.[^\s@]+$").expect("invalid email regex"));

pub fn validate_email(email: &str) -> Result<(), CatzError> {
    if EMAIL_RE.is_match(email) {
        Ok(())
    } else {
        Err(CatzError::Validation(format!("Invalid email: {email}")))
    }
}