# `Countersign.Web.Admit`
[🔗](https://github.com/mkreyman/countersign/blob/v0.1.0/lib/countersign/web/admit.ex#L1)

The gate of the signer's pages past the code: the signing page and its
document, which sign, and the signed copy.

A page is admitted only when the session entry under the config's
`:session_key` (put there by the code check of `Countersign.Web.LinkController` on a
correct code) names the request the path's token opens, its
`"verified_at"` is less than `Countersign.Requests.verification_seconds/0`
old, the scope is switched on (`c:Countersign.Host.enabled?/1`), and the
request is live, or, for `:copy`, signed and inside its copy window
(`Countersign.Request.copyable?/2`). Anything else goes back to the
landing page, which asks for a new code or shows the dead link, so the gate
never says which check failed.

`Countersign.Router.countersign_routes/2` mounts it: `on_mount/4` in front
of `Countersign.Web.SigningLive`, `call/2` in front of the document and
copy downloads. Both assign `:countersign_config` (the `Countersign.Config`),
`:signing_request` and `:signing_token`.

# `mode`

```elixir
@type mode() :: :sign | :copy
```

# `admit`

```elixir
@spec admit(Countersign.Config.t(), mode(), String.t(), term()) ::
  {:ok, Countersign.Request.t()} | :error
```

`{:ok, request}` when `entry` (the session's value under the config's
`:session_key`) admits `token`'s request for `mode`, else `:error`. The
config's host clock decides the age of the verification.

# `landing_path`

```elixir
@spec landing_path(Countersign.Config.t(), String.t()) :: String.t()
```

The landing page of `token`.

---

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