ProtoRune. Atproto. OAuth. PKCE
(proto_rune v0.3.0)
Copy Markdown
Proof Key for Code Exchange (PKCE) helpers for the AT Protocol OAuth flow.
Implements the S256 code challenge method from RFC 7636 using only
:crypto. The code verifier is a high-entropy random string sent to the
token endpoint, while the code challenge is its SHA-256 hash sent during
the authorization request.
Summary
Functions
Computes the S256 code challenge for a code verifier.
Generates a {code_verifier, code_challenge} pair.
Generates a random code verifier.
Functions
Computes the S256 code challenge for a code verifier.
Examples
iex> PKCE.challenge("dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
Generates a {code_verifier, code_challenge} pair.
@spec generate_verifier() :: String.t()
Generates a random code verifier.
Returns a base64url-encoded string (without padding) derived from 32 cryptographically secure random bytes.