# `PhoenixReplay.Export.Runtime`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/export/runtime.ex#L1)

Starts what exports need with the first export, under this supervisor:
`PhoenixReplay.Web.Export.Endpoint` and a connection to Playwright, so
an application that never exports runs neither.

The endpoint listens on 127.0.0.1 and a free port, with a secret made
when it starts and given to it as an argument rather than kept in the
application environment. Tokens for the stage are signed with that
secret, so they die with the endpoint; `stage_url/3` makes one for a
recording, and `verify/2` reads it.

# `t`

```elixir
@type t() :: %{url: String.t(), connection: GenServer.name()}
```

Where the browser loads the stage from, and the Playwright connection.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `ensure`

```elixir
@spec ensure(PhoenixReplay.Config.export()) :: {:ok, t()} | {:error, term()}
```

Starts the endpoint and Playwright unless they run, and tells where they are.

# `stage_url`

```elixir
@spec stage_url(t(), PhoenixReplay.Recording.id(), PhoenixReplay.Export.Options.t()) ::
  String.t()
```

The address of the stage for a recording, with a token that opens it,
and whether the export draws the pointer.

# `start_endpoint`

```elixir
@spec start_endpoint() :: Supervisor.on_start()
```

Starts the endpoint with its configuration as arguments: a loopback
address, a free port, and secrets made for this start. Children start
one at a time, so only the start that starts it makes the secret.

# `start_link`

```elixir
@spec start_link(keyword()) :: Supervisor.on_start()
```

Starts the supervisor the endpoint and Playwright are started under on demand.

# `verify`

```elixir
@spec verify(module(), String.t()) ::
  {:ok, PhoenixReplay.Recording.id()} | {:error, atom()}
```

Reads a stage token with the endpoint that serves the stage.

---

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