# `Countersign.Token`
[🔗](https://github.com/mkreyman/countersign/blob/v0.1.0/lib/countersign/token.ex#L1)

Signing-link tokens: 32 random bytes, URL-safe base64 without padding.

Only the SHA-256 hash of a token is stored (`signing_requests.token_hash`);
the token itself exists in the link and, encrypted, in
`last_token_ciphertext` for the reminder.

# `generate`

```elixir
@spec generate() :: {token :: String.t(), hash :: binary()}
```

A new token and its hash.

# `hash`

```elixir
@spec hash(String.t()) :: binary()
```

The SHA-256 hash of `token` (32 bytes).

# `valid_format?`

```elixir
@spec valid_format?(term()) :: boolean()
```

Whether `token` has the shape `generate/0` produces. A lookup checks this
first, so a malformed path segment never reaches the database.

---

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