Sigra.Passkeys.Authentication (Sigra v1.20.0)

Copy Markdown View Source

WebAuthn authentication ceremony helpers.

Summary

Types

assertion()

@type assertion() :: %{
  :credential_id => binary(),
  :authenticator_data => binary(),
  :signature => binary(),
  :client_data_json => binary(),
  :challenge => Wax.Challenge.t(),
  optional(:user_handle) => binary() | String.t() | nil
}

Functions

handle_sign_count(stored, presented, policy, metadata \\ %{})

@spec handle_sign_count(
  non_neg_integer(),
  non_neg_integer(),
  Sigra.Passkeys.SignCountPolicy.policy(),
  map()
) :: :ok | {:regression, Sigra.Passkeys.SignCountPolicy.policy(), map()}

new_challenge(config, opts \\ [])

@spec new_challenge(
  Sigra.Config.t(),
  keyword()
) :: Wax.Challenge.t()

verify(config, user, assertion, opts \\ [])

@spec verify(Sigra.Config.t(), map(), assertion(), keyword()) ::
  {:ok, struct(), Wax.AuthenticatorData.t()}
  | {:error, :credential_not_owned}
  | {:error, term()}