From ddc211e4a8822256dae05724e89fa6b3e3f7bc84 Mon Sep 17 00:00:00 2001 From: Dave Chen Date: Mon, 9 Oct 2023 17:41:06 +0800 Subject: [PATCH] make `from_jwt` public There is a case to use `from_jwt` with a `DecodingKey` directly Signed-off-by: Dave Chen --- src/ear.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ear.rs b/src/ear.rs index 7ec0fca..8c2b9a5 100644 --- a/src/ear.rs +++ b/src/ear.rs @@ -87,7 +87,11 @@ impl Ear { Self::from_jwt(token, jwt_alg, &dk) } - fn from_jwt(token: &str, alg: jwt::Algorithm, key: &jwt::DecodingKey) -> Result { + pub fn from_jwt( + token: &str, + alg: jwt::Algorithm, + key: &jwt::DecodingKey, + ) -> Result { let mut validation = jwt::Validation::new(alg); // the default validation sets "exp" as a mandatory claim, which an E is not required to // have.