# `Ithibati.Identity.Challenges`
[🔗](https://github.com/oliverandrich/ithibati/blob/v0.6.2/lib/ithibati/identity/challenges.ex#L1)

Tracks outstanding challenges in the configured database across application instances.

The transport retains the challenge and its approved subject and policy. This module stores
only a digest and expiry. Consume the record before verification, outside any transaction
that could roll back after a handler fails. Database errors propagate; they never authorize
verification. Applications may schedule `delete_expired/0` to remove abandoned challenges.

# `consume`

Atomically consumes an unexpired challenge, returning `:ok` or `{:error, :no_challenge}`.

Raises `ArgumentError` inside a transaction: a later rollback must not restore consumption.

# `delete_expired`

Deletes abandoned, expired challenge records and returns the number removed.

# `store`

Records a newly issued challenge until its timeout expires. Returns `:ok`.

---

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