Module exposing: generate_pkce_params, PkceParams, generate_code_verifier, compute_code_challenge, base64_url_no_pad
// Source: https://github.com/rust-mcp-stack/rust-mcp-sdk | License: MIT | Copyright 2025 Rust MCP Stack (rust-mcp-sdk)
// Provided via justclaw.it.com; keep this notice with the code.
use base64::Engine;
use sha2::{Digest, Sha256};
/// The result of [`generate_pkce_params`].
///
/// `code_challenge` is the SHA-256 hash of `code_verifier`, base64url-encoded
/// without padding. Send `code_challenge` with the authorization request and
/// `code_verifier` with the token exchange.
#[derive(Debug, Clone)]
pub struct PkceParams {
pub code_verifier: String,
pub code_challenge: String,
}
/// Generate PKCE parameters for the authorization code flow with PKCE (RFC 7636).
///
/// Returns a [`PkceParams`] containing a cryptographically random `code_verifier`
/// (43 characters) and its SHA-
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key