From 4d1411432f8fa3479346453a27e6ee74a32c009b Mon Sep 17 00:00:00 2001 From: nworbnhoj Date: Mon, 26 Jun 2023 11:11:45 +1000 Subject: [PATCH] mirror RustlsOwnedTrustAnchor::from_subject_spki_name_constraints() --- libs/tls/src/lib.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libs/tls/src/lib.rs b/libs/tls/src/lib.rs index 58bf90b66..fdbc45197 100644 --- a/libs/tls/src/lib.rs +++ b/libs/tls/src/lib.rs @@ -21,13 +21,24 @@ const CURRENT_VERSION_KEY: &str = "__version"; #[derive(Archive, Serialize, Deserialize, Debug)] pub struct RustlsOwnedTrustAnchor { - subject: Vec, - spki: Vec, - name_constraints: Option>, + pub subject: Vec, + pub spki: Vec, + pub name_constraints: Option>, } impl RustlsOwnedTrustAnchor { +pub fn from_subject_spki_name_constraints( + subject: impl Into>, + spki: impl Into>, + name_constraints: Option>>, +) -> Self { + Self { + subject: subject.into(), + spki: spki.into(), + name_constraints: name_constraints.map(|x| x.into()) + } +}