use async_trait::async_trait;
use std::time::SystemTime;
pub(super) const EPOCH_CURSOR: SystemTime = SystemTime::UNIX_EPOCH;
#[derive(Clone)]
pub struct KeyRecord {
pub id: i64,
pub version: u8,
pub key_bytes: Vec<u8>,
pub nonce: Option<Vec<u8>>,
pub encryption_key_version: u8,
pub activated_at: SystemTime,
}
#[async_trait]
pub trait SecretBackend: Send + Sync + 'static {
type Error: std::error::Error + Send + Sync + 'static;
async fn load_all(&self, group_id: &str) -> Result<Vec<KeyRecord>, Self::Error>;
async fn poll_new(
&self,
group_id: &str,
since_time: SystemTime,
since_id: i64,
) -> Result<Vec<KeyRecord>, Self::Error>;
}