Expand description
§Proven - Safe, Formally Verified Library
Rust bindings for the proven library, providing formally verified implementations for safe math, cryptography, parsing, and validation. Calls Idris 2 verified code via Zig ABI.
§Features
- Safe Math: Overflow detection, safe division, bounded integers
- Safe Strings: UTF-8 validation, injection-safe escaping
- Safe JSON: Exception-free parsing with type-safe access
- Safe URLs: RFC 3986 compliant parsing
- Safe Email: RFC 5321/5322 validation
- Safe Paths: Traversal prevention, glob matching
- Safe Crypto: Secure hashing, HMAC, random generation (stubs)
- Safe Passwords: Policy validation, strength analysis
- Safe DateTime: ISO 8601 parsing, timezone handling
- Safe Network: IPv4/IPv6 parsing, CIDR, ports
- Safe UUID: RFC 4122 UUID generation and validation
- Safe Currency: Type-safe monetary values with ISO 4217 codes
- Safe Phone: E.164 phone number parsing and formatting
- Safe Hex: Hexadecimal encoding and decoding
- Safe Header: HTTP header validation, CRLF injection prevention (v0.8.0)
- Safe Cookie: HTTP cookie validation, injection prevention (v0.8.0)
- Safe ContentType: MIME type validation, sniffing prevention (v0.8.0)
- Safe Float: NaN/Infinity prevention, safe division for f32/f64 (v0.9.0)
- Safe Tensor: Bounds-checked vector/matrix ops, shape validation (v0.9.0)
- Safe ML: Numerically stable softmax, loss functions, activations (v0.9.0)
§Example
use proven::{SafeMath, SafeString, Result};
// Safe addition with overflow detection
let result = SafeMath::add(i64::MAX, 1);
assert!(result.is_err());
// Safe HTML escaping
let escaped = SafeString::escape_html("<script>alert('xss')</script>");
assert!(!escaped.contains('<'));Re-exports§
pub use crate::core::Bounded;pub use crate::core::Error;pub use crate::core::NonEmpty;pub use crate::core::Result;pub use safe_content_type::ContentType;pub use safe_content_type::MediaCategory;pub use safe_content_type::SafeContentType;pub use safe_cookie::Cookie;pub use safe_cookie::CookieAttributes;pub use safe_cookie::CookiePrefix;pub use safe_cookie::SafeCookie;pub use safe_cookie::SameSite;pub use safe_crypto::SafeCrypto;pub use safe_currency::CurrencyCode;pub use safe_currency::Money;pub use safe_currency::SafeCurrency;pub use safe_datetime::SafeDateTime;pub use safe_email::SafeEmail;pub use safe_header::Header;pub use safe_header::SafeHeader;pub use safe_hex::SafeHex;pub use safe_json::SafeJson;pub use safe_math::SafeMath;pub use safe_network::SafeNetwork;pub use safe_password::SafePassword;pub use safe_path::SafePath;pub use safe_phone::PhoneNumber;pub use safe_phone::SafePhone;pub use safe_string::SafeString;pub use safe_url::SafeUrl;pub use safe_uuid::SafeUuid;pub use safe_uuid::Uuid;pub use safe_float::SafeFloat;pub use safe_ml::SafeML;pub use safe_tensor::SafeTensor;
Modules§
- core
- Core types for the proven library.
- safe_
content_ type - Safe Content-Type operations that prevent MIME sniffing attacks.
- safe_
cookie - Safe HTTP Cookie operations that prevent injection attacks.
- safe_
crypto - Safe cryptographic operations with formally verified specifications.
- safe_
currency - Safe currency operations with type-safe monetary values.
- safe_
datetime - Safe datetime parsing and validation.
- safe_
email - Safe email validation.
- safe_
float - Safe floating-point operations with NaN/Infinity prevention.
- safe_
header - Safe HTTP Header operations that prevent CRLF injection attacks.
- safe_
hex - Safe hexadecimal encoding and decoding.
- safe_
json - Safe JSON parsing and access.
- safe_
math - Safe mathematical operations with overflow detection.
- safe_ml
- Safe machine learning operations with mathematical guarantees.
- safe_
network - Safe network address operations.
- safe_
password - Safe password handling and validation.
- safe_
path - Safe path operations with traversal prevention.
- safe_
phone - Safe phone number validation following E.164.
- safe_
string - Safe string operations with injection prevention.
- safe_
tensor - Safe tensor and matrix operations with bounds checking.
- safe_
url - Safe URL parsing and manipulation.
- safe_
uuid - Safe UUID generation and validation following RFC 4122.