Skip to content

Commit

Permalink
verification: Rustdoc comments for Verifier.
Browse files Browse the repository at this point in the history
This commit adds some missing Rustdoc comments for the various
per-platform `Verifier` structs and associated methods. Doing so will
avoid errors from missing comments once the types are part of the public
API.
  • Loading branch information
cpu committed Aug 31, 2023
1 parent b6d612b commit 1770e0c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/verification/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum VerifierStatus {
// official recommendation. See https://bugs.chromium.org/p/chromium/issues/detail?id=627154.
const AUTH_TYPE: &str = "RSA";

/// A TLS certificate verifier that utilizes the Android platform verifier.
#[derive(Default)]
pub struct Verifier {
/// Testing only: The root CA certificate to trust.
Expand All @@ -55,13 +56,16 @@ impl Drop for Verifier {
}

impl Verifier {
/// Creates a new instance of a TLS certificate verifier that utilizes the
/// Android certificate facilities
pub fn new() -> Self {
Self {
#[cfg(any(test, feature = "ffi-testing"))]
test_only_root_ca_override: None,
}
}

/// Creates a test-only TLS certificate verifier which trusts our fake root CA cert.
#[cfg(any(test, feature = "ffi-testing"))]
pub(crate) fn new_with_fake_root(root: &[u8]) -> Self {
Self {
Expand Down
1 change: 1 addition & 0 deletions src/verification/apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ fn system_time_to_cfdate(time: SystemTime) -> Result<CFDate, TlsError> {
.map(|epoch| CFDate::new(epoch.as_secs() as f64))
}

/// A TLS certificate verifier that utilizes the Apple platform certificate facilities.
#[derive(Default)]
pub struct Verifier {
/// Testing only: The root CA certificate to trust.
Expand Down
1 change: 1 addition & 0 deletions src/verification/others.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use rustls::{
CertificateError, Error as TlsError, RootCertStore,
};

/// A TLS certificate verifier that uses the system's root store and WebPKI.
#[derive(Default)]
pub struct Verifier {
// We use a `OnceCell` so we only need
Expand Down
1 change: 1 addition & 0 deletions src/verification/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ fn map_trust_error_status(unfiltered_status: DWORD) -> Result<(), TlsError> {
)))
}

/// A TLS certificate verifier that utilizes the Windows certificate facilities.
#[derive(Default)]
pub struct Verifier {
/// Testing only: The root CA certificate to trust.
Expand Down

0 comments on commit 1770e0c

Please sign in to comment.