From 463ee082f5b4b9ef94bba4a1ff02ead32bc0bed7 Mon Sep 17 00:00:00 2001 From: Timshel Date: Wed, 20 Aug 2025 12:32:50 +0200 Subject: [PATCH] PkceCodeChallenge::new wrap an existing challenge --- src/types.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/types.rs b/src/types.rs index 039bfa5..290e4ee 100644 --- a/src/types.rs +++ b/src/types.rs @@ -431,6 +431,14 @@ pub struct PkceCodeChallenge { code_challenge_method: PkceCodeChallengeMethod, } impl PkceCodeChallenge { + /// Create a new PkceCodeChallenge to wrap the given String challenge and method + pub fn new(code_challenge: String, code_challenge_method: PkceCodeChallengeMethod) -> Self { + PkceCodeChallenge { + code_challenge, + code_challenge_method, + } + } + /// Generate a new random, base64-encoded SHA-256 PKCE code. pub fn new_random_sha256() -> (Self, PkceCodeVerifier) { Self::new_random_sha256_len(32)