use std::fmt::Debug;
use std::time::Duration;
#[cfg(any(test, feature = "test_utils"))]
use p2panda_encryption::key_bundle::Lifetime;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Config {
pub pre_key_lifetime: Duration,
pub pre_key_rotate_after: Duration,
}
impl Default for Config {
fn default() -> Self {
Self {
pre_key_lifetime: Duration::from_secs(60 * 60 * 24 * 90), pre_key_rotate_after: Duration::from_secs(60 * 60 * 24 * 60), }
}
}
#[cfg(any(test, feature = "test_utils"))]
impl Config {
#[allow(unused)]
pub(crate) fn lifetime(&self) -> Lifetime {
Lifetime::new(self.pre_key_lifetime.as_secs())
}
}