Module code

Source
Expand description

Coupled PKCE code verifier and challenge pairs.

The Code type provides ergonomic and simple methods to generate verifier-challenge pairs.

Code is slightly more than simply using Verifier and Challenge together, as it imposes the following invariant: the verifier and challenge are always generated together and the challenge corresponds to the verifier, meaning verifier.verify(&challenge) is always true.

Therefore it is not possible to access the verifier or challenge separately, and one should use into_pair to get both parts, consuming the Code value.

§Examples

use pkce_std::code::Code;

let code = Code::generate_default();

let (verifier, challenge) = code.into_pair();

// this is always true here!
assert!(verifier.verify(&challenge));

Structs§

Code
Represents coupled Verifier and Challenge pairs.

Type Aliases§

OwnedPair
Represents owned Pair values.
OwnedParts
Represents owned Parts values.
Pair
Represents (verifier, challenge) pairs.
Parts
Represents (verifier, secret, method) parts.
StaticCodestatic
An alias for Code<'static>.