Plug integration helpers for ExSwan.
Ceremony helpers keep challenges in server-side storage and put only opaque lookup
tokens in the Plug session. Applications retain identity and persistence policy
through the ExSwan.Plug.Store callbacks.
Installation
def deps do
[
{:exswan_plug, "~> 0.1.0"}
]
endWhen developing inside the exswan monorepo, depend on the path package and set
EXSWAN_MONOREPO=true so :exswan resolves from packages/exswan.
Summary
Types
A ceremony-store module and its adapter-specific context.
Functions
Begins an authentication ceremony.
Begins an authorized registration ceremony.
Consumes and verifies an authentication ceremony, then atomically persists its
counter and backup-state result through update_credential/3.
Consumes and verifies a registration ceremony, then invokes create_credential/3.
Validates relying-party configuration.
Returns the library version.
Types
Functions
@spec begin_authentication( Plug.Conn.t(), keyword() ) :: {:ok, Plug.Conn.t(), map()} | {:error, term()}
Begins an authentication ceremony.
Required options are :rp_id, :origin, and :ceremony_store. Pass stored
credentials with :allow_credentials when the account is known in advance.
@spec begin_registration( Plug.Conn.t(), keyword() ) :: {:ok, Plug.Conn.t(), map()} | {:error, term()}
Begins an authorized registration ceremony.
Required options are :user, :user_handle, :user_name, :rp_name, :rp_id,
:origin, and :ceremony_store. The returned options are browser-ready.
@spec finish_authentication( Plug.Conn.t(), keyword() ) :: {:ok, Plug.Conn.t(), ExSwan.AuthenticationResult.t(), term()} | {:error, term()}
Consumes and verifies an authentication ceremony, then atomically persists its
counter and backup-state result through update_credential/3.
@spec finish_registration( Plug.Conn.t(), keyword() ) :: {:ok, Plug.Conn.t(), ExSwan.RegistrationResult.t(), term()} | {:error, term()}
Consumes and verifies a registration ceremony, then invokes create_credential/3.
Ceremony state is consumed before verification, so failed and concurrent retries cannot reuse an attacker-controlled response.
Validates relying-party configuration.
Origins must be absolute HTTPS URLs without userinfo, query, or fragment. HTTP is accepted only for localhost development.
@spec version() :: String.t()
Returns the library version.