From f7a13107efb8a3370e48b9d28ae2e9c635ea40ce Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Sun, 3 Mar 2024 17:37:10 +0100 Subject: [PATCH] Add SessionId new_unchecked --- src/certs/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/certs/mod.rs b/src/certs/mod.rs index 4727713..c08797b 100644 --- a/src/certs/mod.rs +++ b/src/certs/mod.rs @@ -51,6 +51,14 @@ impl SessionId { session_id.validate()?; Ok(session_id) } + + /// Creates a new [SessionId] without validating it. This is useful when you are certain that + /// the [SessionId] is valid and you want to avoid the overhead of validation, or if you are + /// creating an extension for polyproto where the [SessionId] is allowed to be longer than 32 + /// characters. + pub fn new_unchecked(id: Ia5String) -> Self { + Self { session_id: id } + } } #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]