Skip to main content

acme/api/
revocation.rs

1use serde::{Deserialize, Serialize};
2
3/// Certificate revocation request.
4///
5/// See [RFC 8555 §7.6].
6///
7/// [RFC 8555 §7.6]: https://datatracker.ietf.org/doc/html/rfc8555#section-7.6
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9pub struct Revocation {
10    /// The certificate to be revoked, in the base64url-encoded version of the DER format.
11    ///
12    /// Note: not PEM, since headers are omitted.
13    pub certificate: String,
14
15    /// One of the revocation reasonCodes defined in [RFC 5280 §5.3.1].
16    ///
17    /// [RFC 5280 §5.3.1]: https://datatracker.ietf.org/doc/html/rfc5280#section-5.3.1
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub reason: Option<usize>,
20}
21
22impl Revocation {
23    pub fn new(certificate: String, reason: Option<usize>) -> Self {
24        Self {
25            certificate,
26            reason,
27        }
28    }
29}