Skip to main content

rust_serv/auto_tls/
account.rs

1//! ACME account management
2//!
3//! This module handles ACME account creation and management.
4
5use serde::{Deserialize, Serialize};
6
7/// ACME account information
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
9pub struct AcmeAccount {
10    /// Account email
11    pub email: String,
12    /// Account private key (PEM format)
13    pub private_key: String,
14    /// Account URL (from ACME server)
15    pub account_url: Option<String>,
16}
17
18impl AcmeAccount {
19    /// Create a new ACME account
20    pub fn new(email: String, private_key: String) -> Self {
21        Self {
22            email,
23            private_key,
24            account_url: None,
25        }
26    }
27}
28
29#[cfg(test)]
30mod tests {
31    use super::*;
32
33    #[test]
34    fn test_acme_account_creation() {
35        let account = AcmeAccount::new(
36            "test@example.com".to_string(),
37            "private_key_pem".to_string(),
38        );
39        assert_eq!(account.email, "test@example.com");
40        assert!(account.account_url.is_none());
41    }
42}