# `AttestoClient.PKCE`
[🔗](https://github.com/XukuLLC/attesto_client/blob/v2.26.0/lib/attesto_client/pkce.ex#L1)

Generate RFC 7636 PKCE verifier/challenge pairs for OAuth clients.

This is the client-side mirror of `Attesto.PKCE.verify/3`: the client creates
a fresh `code_verifier`, sends the corresponding S256 `code_challenge` in the
authorization request, then presents the verifier at the token endpoint.

Only S256 is produced. `plain` is deliberately not supported.

# `code_challenge`

```elixir
@spec code_challenge(String.t()) :: {:ok, String.t()} | {:error, :invalid_verifier}
```

Compute the S256 `code_challenge` for `code_verifier`.

Returns `{:ok, challenge}` for a well-formed verifier, or
`{:error, :invalid_verifier}`. Delegates to `Attesto.PKCE.challenge/1`, the
same primitive the server side verifies against.

# `code_verifier`

```elixir
@spec code_verifier() :: String.t()
```

Generate a fresh RFC 7636 `code_verifier`.

The verifier is 43 base64url characters from 32 bytes of CSPRNG output. That
sits at the RFC 7636 lower bound and uses a subset of the allowed unreserved
alphabet (`A-Z`, `a-z`, `0-9`, `-`, `_`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
