generate

Function generate 

Source
pub fn generate() -> (String, String)
Expand description

Generates a PKCE code verifier and code challenge pair.

Creates a cryptographically random code verifier (100 characters) and computes its corresponding SHA256 code challenge. This follows the PKCE specification in RFC 7636 using the S256 code challenge method.

§Returns

A tuple containing:

  • String: The code verifier (random alphanumeric string)
  • String: The code challenge (base64url-encoded SHA256 hash of verifier)

§Example

use atproto_oauth::pkce;

let (verifier, challenge) = pkce::generate();
assert_eq!(verifier.len(), 100);
assert!(!challenge.is_empty());