oauth2_types::pkce

Trait CodeChallengeMethodExt

source
pub trait CodeChallengeMethodExt {
    // Required method
    fn compute_challenge<'a>(
        &self,
        verifier: &'a str,
    ) -> Result<Cow<'a, str>, CodeChallengeError>;

    // Provided method
    fn verify(
        &self,
        challenge: &str,
        verifier: &str,
    ) -> Result<(), CodeChallengeError>
       where Self: Sized { ... }
}
Expand description

Helper trait to compute and verify code challenges.

Required Methods§

source

fn compute_challenge<'a>( &self, verifier: &'a str, ) -> Result<Cow<'a, str>, CodeChallengeError>

Compute the challenge for a given verifier

§Errors

Returns an error if the verifier did not adhere to the rules defined by the RFC in terms of length and allowed characters

Provided Methods§

source

fn verify( &self, challenge: &str, verifier: &str, ) -> Result<(), CodeChallengeError>
where Self: Sized,

Verify that a given verifier is valid for the given challenge

§Errors

Returns an error if the verifier did not match the challenge, or if the verifier did not adhere to the rules defined by the RFC in terms of length and allowed characters

Implementations on Foreign Types§

source§

impl CodeChallengeMethodExt for PkceCodeChallengeMethod

source§

fn compute_challenge<'a>( &self, verifier: &'a str, ) -> Result<Cow<'a, str>, CodeChallengeError>

Implementors§