1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! The traits for abstract private keys and certs reading.

/// Read a single private key.
#[async_trait::async_trait]
pub trait ReadKey {
    /// An error that can occur while reading.
    type Error;

    /// Perform the reading.
    async fn read_key(&self) -> Result<rustls_pki_types::PrivateKeyDer<'static>, Self::Error>;
}

/// Read a list of certificates.
///
/// Inteaded for reading a single full certificate chain.
#[async_trait::async_trait]
pub trait ReadCerts {
    /// An error that can occur while reading.
    type Error;

    /// Perform the reading.
    async fn read_certs(
        &self,
    ) -> Result<Vec<rustls_pki_types::CertificateDer<'static>>, Self::Error>;
}