pub struct CodeVerifier(/* private fields */);Expand description
A code_verifier: the value a client keeps and never sends until it redeems
the authorization code.
§Redaction
Renders as CodeVerifier(…) under Debug. It is a secret
with the same lifetime and reach as the token it becomes, so it must not
escape through a panic message or an assertion failure. Display
is the deliberate exception, because a client has to put this in a
code_verifier form field to redeem the code at all.
Implementations§
Source§impl CodeVerifier
impl CodeVerifier
Sourcepub fn new(value: impl Into<String>) -> Result<Self, PkceError>
pub fn new(value: impl Into<String>) -> Result<Self, PkceError>
Parse a verifier against RFC 7636 §4.1’s grammar.
§Errors
PkceError::VerifierLength if it is shorter than 43 or longer than
128 characters; PkceError::VerifierCharset if it contains anything
outside unreserved.
Sourcepub fn challenge(&self, method: ChallengeMethod) -> CodeChallenge
pub fn challenge(&self, method: ChallengeMethod) -> CodeChallenge
The challenge this verifier produces under method.
RFC 7636 §4.3. Plain returns the verifier unchanged; S256 returns
BASE64URL-ENCODE(SHA256(ASCII(code_verifier))), unpadded, which is
43 characters and always inside the code_challenge grammar.
Trait Implementations§
Source§impl Clone for CodeVerifier
impl Clone for CodeVerifier
Source§impl Debug for CodeVerifier
impl Debug for CodeVerifier
Source§impl Display for CodeVerifier
Implements fmt::Display for a CodeVerifier.
impl Display for CodeVerifier
Implements fmt::Display for a CodeVerifier.
This is the one path that prints the secret in full, and it exists so a
client can build a code_verifier field. Prefer
as_str at any call site that is not literally
serialising one into a token request.