# `PhoenixCap.Token`
[🔗](https://github.com/elchemista/phoenix_cap/blob/v0.1.0/lib/phoenix_cap/token.ex#L1)

Behaviour for configured verification token modules.

The configured token module follows the same API shape as `Phoenix.Token`:

    config :phoenix_cap,
      token_module: Phoenix.Token

Custom token modules should implement `sign/3` and `verify/4` with the same
argument order.

# `reason`

```elixir
@type reason() :: term()
```

Failure reported by the configured signing module.

# `sign`

```elixir
@callback sign(term(), binary(), term()) :: binary()
```

Signs the verification payload using the endpoint context and configured salt.

# `verify`

```elixir
@callback verify(term(), binary(), binary(), keyword()) ::
  {:ok, term()} | {:error, reason()}
```

Authenticates the token and returns its payload. Honor the supplied `:max_age` in seconds.

---

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