rust_serv/auto_tls/
account.rs1use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
9pub struct AcmeAccount {
10 pub email: String,
12 pub private_key: String,
14 pub account_url: Option<String>,
16}
17
18impl AcmeAccount {
19 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}