oxidite_security/
lib.rs

1//! # Oxidite Security
2//!
3//! Security utilities for the Oxidite framework including encryption,
4//! hashing, sanitization, and secure random generation.
5
6pub mod crypto;
7pub mod hash;
8pub mod random;
9pub mod sanitize;
10
11pub use crypto::{encrypt, decrypt, AesKey};
12pub use hash::{sha256, sha512, hmac_sha256};
13pub use random::{random_bytes, random_hex, secure_token};
14pub use sanitize::{sanitize_html, escape_html};
15
16use thiserror::Error;
17
18/// Security errors
19#[derive(Error, Debug)]
20pub enum SecurityError {
21    #[error("Encryption failed: {0}")]
22    EncryptionError(String),
23    
24    #[error("Decryption failed: {0}")]
25    DecryptionError(String),
26    
27    #[error("Invalid key length")]
28    InvalidKeyLength,
29    
30    #[error("Invalid data format")]
31    InvalidFormat,
32}
33
34pub type Result<T> = std::result::Result<T, SecurityError>;