mod database; mod error; use chrono::{DateTime, Utc}; use id::{AppID, UserID}; pub use crate::error::Error; #[derive(Debug)] pub struct AuthorizationCode { // Info code: String, app: AppID, user: UserID, // Timings created_at: DateTime, expires_at: DateTime, used_at: Option>, } impl AuthorizationCode { pub fn has_been_used(&self) -> bool { self.used_at.is_some() } pub fn has_expired(&self) -> bool { self.expires_at < Utc::now() } }