Ithibati.Identity.Challenges (Ithibati v0.6.2)

Copy Markdown View Source

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.

Summary

Functions

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

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

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

Functions

consume(challenge)

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(challenge)

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