Exosphere.ATProto.OAuth.DPoP.NonceStore (Exosphere v0.5.0)

Copy Markdown View Source

Per-authorization-server DPoP nonce cache.

Authorization servers issue a nonce (in the DPoP-Nonce response header) that clients must echo in subsequent proof JWTs for that server. The nonce is shared state across requests, so it lives in a public ETS table owned by this small GenServer, keyed by server origin (scheme://host[:port]).

Started by Exosphere.Application (which the Hex dependency starts automatically). Reads never fail when the table is missing; writes to a missing table return {:error, :not_started}.

Summary

Functions

Returns a specification to start this module under a supervisor.

Forget the nonce for a server origin (e.g. after it is rejected).

Fetch the current nonce for a server origin, if any.

Remember the nonce issued by a server origin.

Types

server()

@type server() :: GenServer.server()

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(origin)

@spec clear(String.t()) :: :ok | {:error, :not_started}

Forget the nonce for a server origin (e.g. after it is rejected).

get(origin)

@spec get(String.t()) :: String.t() | nil

Fetch the current nonce for a server origin, if any.

put(origin, nonce)

@spec put(String.t(), String.t()) :: :ok | {:error, :not_started}

Remember the nonce issued by a server origin.