spiffe/svid/
mod.rs

1//! X.509-SVID and JWT-SVID types.
2
3use std::error::Error;
4
5pub mod jwt;
6pub mod x509;
7
8/// Represents a SPIFFE Verifiable Identity Document (SVID).
9pub trait Svid {}
10
11/// Represents a source of SPIFFE SVIDs.
12pub trait SvidSource {
13    /// The type of the SVIDs provided by the source.
14    type Item: Svid;
15
16    /// Returns an owned SVID.
17    /// If it cannot be found an SVID in the source, it returns `Ok(None)`.
18    /// If there's is an error in source fetching the SVID, it returns an `Err<Box<dyn Error + Send + Sync + 'static>>`.
19    fn get_svid(&self) -> Result<Option<Self::Item>, Box<dyn Error + Send + Sync + 'static>>;
20}
21
22/// Represents a source of SPIFFE SVIDs.
23pub trait SvidRefSource {
24    /// The type of the SVIDs provided by the source.
25    type Item: Svid;
26
27    /// Returns an SVID reference.
28    /// If it cannot be found an SVID in the source, it returns `Ok(None)`.
29    /// If there's is an error in source fetching the SVID, it returns an `Err<Box<dyn Error + Send + Sync + 'static>>`.
30    fn get_svid_ref(&self) -> Result<Option<&Self::Item>, Box<dyn Error + Send + Sync + 'static>>;
31}