# `PhoenixWebTransport.Cert`
[🔗](https://github.com/knevan/phoenix-wtransport/blob/main/lib/phoenix_wtransport/cert.ex#L1)

Development certificate for the WebTransport listener.

Chrome only accepts a self-signed certificate through the
`serverCertificateHashes` option, and that option requires an ECDSA P-256
key and a validity window of at most 14 days. A `mix phx.gen.cert` RSA
certificate is rejected, so this module generates its own 13-day ECDSA P-256
cert directly in pure Erlang (`:public_key`) with zero external CLI
dependencies, and exposes the SHA-256 of the DER encoding for the page to pin.

Production deployments terminate QUIC with a publicly trusted certificate
and never use this module.

# `ensure!`

```elixir
@spec ensure!(Path.t()) :: {Path.t(), Path.t()}
```

Ensures a fresh cert/key pair exists in `dir` and returns their paths.

# `generate_keypair`

```elixir
@spec generate_keypair(keyword()) :: {binary(), tuple()}
```

Generates an in-memory 13-day ECDSA P-256 self-signed DER certificate and
`ECPrivateKey` record suitable for localhost / loopback WebTransport dev servers.

# `hash_hex`

```elixir
@spec hash_hex(Path.t()) :: String.t()
```

Lowercase hex SHA-256 of the certificate's DER bytes.

---

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