use async_trait::async_trait;
use instant_acme::RevocationRequest;
use crate::types::acme::{AcmeCert, Error, Record};
#[async_trait]
pub trait TokenManager: Sync + Send {
async fn set(&self, id: &str, token: &str) -> Result<(), anyhow::Error>;
async fn unset(&self, id: &str) -> Result<(), anyhow::Error>;
async fn verify(&self, id: &str, token: &str) -> Result<(), anyhow::Error>;
}
#[async_trait]
pub trait DnsManager: Sync + Send {
async fn create(
&self,
zone: &str,
name: &str,
record: Record,
ttl: u32,
) -> Result<(), anyhow::Error>;
async fn delete(&self, zone: &str, name: &str) -> Result<(), anyhow::Error>;
}
#[async_trait]
pub trait AcmeCertificateClient: Sync + Send {
async fn issue(
&self,
names: Vec<String>,
private_key: Option<Vec<u8>>,
) -> Result<AcmeCert, Error>;
async fn revoke<'a>(&self, request: &RevocationRequest<'a>) -> Result<(), Error>;
}