1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! # 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)
// Re-export main types for convenience
pub use ;
pub use ;