Added docs for CertificateStore

This commit is contained in:
Nathan Fisher 2023-05-26 19:04:31 -04:00
parent 799ff9ef17
commit 887ab8e085

View file

@ -1,9 +1,14 @@
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
/// An item which stores known certificates /// An item which stores known certificates. For convenience, this trait is implemented for
/// `std::collections::HashMap<String, String>` and `std::collections::BTreeMap<String, String>`
pub trait CertificateStore: Send + Sync { pub trait CertificateStore: Send + Sync {
/// Retrieves a certificate fingerprint using the hostname as it's key if
/// it has previously been saved
fn get_certificate(&self, host: &str) -> Option<String>; fn get_certificate(&self, host: &str) -> Option<String>;
/// Inserts a certificate fingerprint with the hostname as the key
fn insert_certificate(&mut self, host: &str, fingerprint: &str) -> Option<String>; fn insert_certificate(&mut self, host: &str, fingerprint: &str) -> Option<String>;
/// Returns true if a fingerprint has been stored for this host
fn contains_certificate(&self, host: &str) -> bool; fn contains_certificate(&self, host: &str) -> bool;
} }