offline-license-validator 0.1.1

Offline license validation library using Ed25519 signatures
Documentation
//! # Offline License Validator
//!
//! A simple, secure offline license validation library using Ed25519 signatures.
//!
//! ## Features
//!
//! - **Ed25519 Cryptography**: Industry-standard signature verification
//! - **HWID Binding**: Licenses are bound to specific hardware
//! - **Expiration Checking**: Automatic expiration validation
//! - **Persistent Storage**: Saves validated licenses to `~/.offline-license/`
//! - **Easy Integration**: Simple API - just provide public key
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use offline_license_validator::{LicenseValidator, storage};
//!
//! // Initialize validator with your public key
//! let validator = LicenseValidator::new(
//!     "913d5e19269699e51bcdb5c5a7106c278ef0e0fe92d31b76b6daf5bb00594fcf"
//! ).expect("Invalid public key");
//!
//! // Validate license
//! match validator.validate("license_string_here", "hardware_id_here") {
//!     Ok(info) => {
//!         println!("✓ Valid license!");
//!         println!("Type: {}", info.license_type);
//!         println!("Expires: {}", info.expires_at);
//!
//!         // Save to disk for offline use
//!         storage::save_license(&info, "license_string_here").ok();
//!     }
//!     Err(e) => eprintln!("✗ Invalid license: {}", e),
//! }
//! ```
//!
//! ## Storage
//!
//! Validated licenses are automatically saved to:
//! - **Unix/macOS**: `~/.offline-license/license.json`
//! - **Windows**: `%USERPROFILE%\.offline-license\license.json`
//!
//! ## Security
//!
//! - Public key is hardcoded in your application
//! - Ed25519 signatures prevent tampering
//! - HWID binding prevents license sharing
//! - No network required for validation
//!
//! ## Integration with Tauri
//!
//! ```rust,ignore
//! #[tauri::command]
//! fn verify_license(license: String, hwid: String) -> Result<String, String> {
//!     let validator = LicenseValidator::new(PUBLIC_KEY)
//!         .map_err(|e| e.to_string())?;
//!
//!     let info = validator.validate(&license, &hwid)
//!         .map_err(|e| e.to_string())?;
//!
//!     storage::save_license(&info, &license).ok();
//!
//!     Ok(format!("Valid until: {}", info.expires_at))
//! }
//! ```
//!
//! ## Credits
//!
//! Developed by [Krakiun](https://krakiun.com) - Expert Software Development & Security Solutions
//!
//! **Need custom licensing solutions?** Visit [krakiun.com](https://krakiun.com)

pub mod storage;
pub mod types;
pub mod validator;

// Re-export main types for convenience
pub use types::{LicensePayload, ValidLicenseInfo};
pub use validator::{LicenseError, LicenseValidator};

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_library_basic_usage() {
        // This test verifies that the public API works
        let result = LicenseValidator::new("invalid");
        assert!(result.is_err());
    }
}