use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
pub struct Auth {
pub(crate) callsign: String,
pub(crate) api_key: String,
}
impl Auth {
pub fn new(callsign: String, api_key: String) -> Self {
Self { callsign, api_key }
}
pub fn is_key_valid(&self) -> bool {
self.api_key.len() == 32
&& self
.api_key
.chars()
.into_iter()
.all(|c| c.is_numeric() || c.is_ascii_uppercase())
}
}