ExSwan.Plug.CeremonyStore behaviour (exswan_plug v0.1.0)

Copy Markdown View Source

Storage contract for expiring, single-use WebAuthn ceremony state.

consume/2 must atomically remove and return a live entry. Concurrent consumers must never both receive the same ceremony.

Summary

Types

Serializable server-only ceremony state.

Adapter-specific process, connection, or namespace.

Opaque, caller-visible lookup token.

Callbacks

Atomically removes and returns a live ceremony.

Stores ceremony state until the monotonic deadline in milliseconds.

Types

ceremony()

@type ceremony() :: term()

Serializable server-only ceremony state.

context()

@type context() :: term()

Adapter-specific process, connection, or namespace.

error()

@type error() :: :not_found | :expired | term()

token()

@type token() :: String.t()

Opaque, caller-visible lookup token.

Callbacks

consume(context, token, integer)

@callback consume(context(), token(), integer()) :: {:ok, ceremony()} | {:error, error()}

Atomically removes and returns a live ceremony.

put(context, token, ceremony, integer)

@callback put(context(), token(), ceremony(), integer()) :: :ok | {:error, term()}

Stores ceremony state until the monotonic deadline in milliseconds.