From 04505ada7ad2cb444506767a706cc24ff152cb55 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 6 Jun 2024 10:23:35 +0200 Subject: [PATCH] acme-api: implement revoke certificate helper Signed-off-by: Dietmar Maurer --- proxmox-acme-api/src/certificate_helpers.rs | 10 ++++++++++ proxmox-acme-api/src/lib.rs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/proxmox-acme-api/src/certificate_helpers.rs b/proxmox-acme-api/src/certificate_helpers.rs index c83f2d57..8f8b28f9 100644 --- a/proxmox-acme-api/src/certificate_helpers.rs +++ b/proxmox-acme-api/src/certificate_helpers.rs @@ -9,6 +9,16 @@ use proxmox_sys::{task_log, task_warn}; use crate::types::{AcmeConfig, AcmeDomain}; +pub async fn revoke_certificate(acme_config: AcmeConfig, certificate: &[u8]) -> Result<(), Error> { + let mut acme = super::account_config::load_account_config(&acme_config.account) + .await? + .client(); + + acme.revoke_certificate(certificate, None).await?; + + Ok(()) +} + pub struct OrderedCertificate { pub certificate: Vec, pub private_key_pem: Vec, diff --git a/proxmox-acme-api/src/lib.rs b/proxmox-acme-api/src/lib.rs index 3230f8cf..9990717c 100644 --- a/proxmox-acme-api/src/lib.rs +++ b/proxmox-acme-api/src/lib.rs @@ -43,4 +43,4 @@ pub(crate) mod acme_plugin; #[cfg(feature = "impl")] mod certificate_helpers; #[cfg(feature = "impl")] -pub use certificate_helpers::order_certificate; +pub use certificate_helpers::{order_certificate, revoke_certificate};