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

Copy Markdown View Source

Persistence contract used by WebAuthn ceremony finish functions.

Implementations own application identity and transaction policy. In particular, update_credential/3 must persist the signature counter and backup state atomically.

Summary

Types

Application-defined callback context.

Stable failures understood by ExSwan.Plug.

Application-defined user or registration subject.

Callbacks

Persists a newly verified credential, returning :duplicate on conflict.

Fetches a stored credential by its unpadded base64url identifier.

Atomically persists authentication counter and backup-state changes.

Types

context()

@type context() :: term()

Application-defined callback context.

error()

@type error() :: :not_found | :duplicate | :stale_credential | term()

Stable failures understood by ExSwan.Plug.

user()

@type user() :: term()

Application-defined user or registration subject.

Callbacks

create_credential(user, t, context)

@callback create_credential(user(), ExSwan.RegistrationResult.t(), context()) ::
  {:ok, term()} | {:error, error()}

Persists a newly verified credential, returning :duplicate on conflict.

get_credential(credential_id, context)

@callback get_credential(ExSwan.Credential.credential_id(), context()) ::
  {:ok, ExSwan.Credential.t()} | {:error, error()}

Fetches a stored credential by its unpadded base64url identifier.

update_credential(t, t, context)

@callback update_credential(
  ExSwan.Credential.t(),
  ExSwan.AuthenticationResult.t(),
  context()
) ::
  {:ok, term()} | {:error, error()}

Atomically persists authentication counter and backup-state changes.