challenge

Function challenge 

Source
pub fn challenge(token: &str) -> String
Expand description

Creates a PKCE code challenge from a code verifier.

Computes the SHA256 hash of the provided code verifier and encodes it using base64url encoding without padding. This implements the S256 code challenge method as specified in RFC 7636 section 4.2.

§Arguments

  • token - The code verifier string to hash

§Returns

The base64url-encoded SHA256 hash of the code verifier

§Example

use atproto_oauth::pkce;

let verifier = "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk";
let challenge = pkce::challenge(verifier);
assert!(!challenge.is_empty());
assert!(!challenge.contains('='));  // No padding in base64url