# `Attesto.StatusList`
[🔗](https://github.com/XukuLLC/attesto/blob/v2.0.1/lib/attesto/status_list.ex#L1)

IETF Token Status List construction and verification.

Status values are packed into a compact bit array, compressed with zlib,
and carried in a signed `statuslist+jwt`. Fetching is deliberately supplied
by the host through resolver functions, so this module has no HTTP or Plug
dependency.

# `bits`

```elixir
@type bits() :: 1 | 2 | 4 | 8
```

# `verified`

```elixir
@type verified() :: %{
  bits: bits(),
  statuses_binary: binary(),
  sub: String.t(),
  claims: map()
}
```

# `build`

```elixir
@spec build(
  [non_neg_integer()],
  keyword()
) :: %{required(String.t()) =&gt; term()}
```

Build an unsigned `status_list` claim.

`:bits` defaults to `1`.

# `issue`

```elixir
@spec issue(module(), String.t(), [non_neg_integer()], keyword()) :: String.t()
```

Build and sign a Status List Token for `uri`.

Options are `:bits` (default `1`), `:exp`, `:ttl`, and `:now`.

# `pack`

```elixir
@spec pack([non_neg_integer()], bits()) :: binary()
```

Pack status values into bytes, placing the first entry in each byte's least
significant field.

# `reference`

```elixir
@spec reference(String.t(), non_neg_integer()) :: %{required(String.t()) =&gt; term()}
```

Build the `status` claim carried by a token that references a status list.

# `resolve`

```elixir
@spec resolve(
  map(),
  (String.t() -&gt; {:ok, String.t()} | {:error, term()}),
  term(),
  keyword()
) ::
  {:ok, non_neg_integer()} | {:error, term()}
```

Resolve a referenced token's status without performing HTTP.

`resolver` fetches the Status List Token for a URI and returns
`{:ok, token}`. The third argument may be trusted JWKS directly or a
function that resolves the trusted JWKS for that URI.

# `sign`

```elixir
@spec sign(module(), map(), keyword()) :: String.t()
```

Sign a caller-supplied Status List Token claim set with the required type.

# `status_at`

```elixir
@spec status_at(binary(), bits(), non_neg_integer()) :: non_neg_integer()
```

Read the status value at `idx` from a packed status array.

# `verify`

```elixir
@spec verify(String.t(), map() | [map()], keyword()) ::
  {:ok, verified()} | {:error, atom()}
```

Verify and decode a Status List Token.

`:accepted_algs` limits the trusted signing algorithms. By default all
asymmetric algorithms supported by Attesto are accepted.

---

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