use crate::constants::DEFAULT_SVID;
use crate::{X509BundleSet, X509Svid};
use std::sync::Arc;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct X509Context {
svids: Vec<Arc<X509Svid>>,
bundle_set: Arc<X509BundleSet>,
}
impl X509Context {
#[must_use]
pub fn new(
svids: impl IntoIterator<Item = Arc<X509Svid>>,
bundle_set: impl Into<Arc<X509BundleSet>>,
) -> Self {
Self {
svids: svids.into_iter().collect(),
bundle_set: bundle_set.into(),
}
}
pub fn default_svid(&self) -> Option<&Arc<X509Svid>> {
self.svids.get(DEFAULT_SVID)
}
pub const fn svids(&self) -> &[Arc<X509Svid>] {
self.svids.as_slice()
}
pub const fn bundle_set(&self) -> &Arc<X509BundleSet> {
&self.bundle_set
}
}