spiffe_rustls/
error.rs

1/// Result type used by this crate.
2pub type Result<T> = std::result::Result<T, Error>;
3
4/// Errors returned by `spiffe-rustls`.
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7    /// The `X509Source` currently has no SVID.
8    #[error("x509 source has no current SVID")]
9    NoSvid,
10
11    /// The `X509Source` currently has no bundle for the requested trust domain.
12    #[error("x509 source has no bundle for trust domain {0}")]
13    NoBundle(String),
14
15    /// Failed to create a `rustls::sign::CertifiedKey` from SVID material.
16    #[error("failed building rustls certified key: {0}")]
17    CertifiedKey(String),
18
19    /// Failed to parse a peer certificate.
20    #[error("failed parsing peer certificate: {0}")]
21    CertParse(String),
22
23    /// The peer certificate is missing a SPIFFE ID URI SAN.
24    #[error("peer is missing SPIFFE ID URI SAN")]
25    MissingSpiffeId,
26
27    /// The peer SPIFFE ID was rejected by the authorization hook.
28    #[error("peer SPIFFE ID is not authorized: {0}")]
29    UnauthorizedSpiffeId(String),
30
31    /// Failed to build a rustls verifier.
32    #[error("rustls verifier builder error: {0}")]
33    VerifierBuilder(String),
34
35    /// A rustls error occurred.
36    #[error("rustls error: {0}")]
37    Rustls(#[from] rustls::Error),
38
39    /// Internal error.
40    #[error("internal: {0}")]
41    Internal(String),
42}