web_authn_lite v0.4.0 WebAuthnLite.Operation.Authenticate

Functions for Verifying an authentication assertion operation

https://www.w3.org/TR/webauthn/#verifying-assertion

Link to this section Summary

Functions

Verify AuthenticatorResponse and return struct

Verify clientDataJSON and return struct

Link to this section Functions

Link to this function validate_authenticator_assertion(map)
validate_authenticator_assertion(params :: map()) ::
  {:ok, updated_storable_public_key :: WebAuthnLite.StorablePublicKey.t(),
   authenticator_data :: WebAuthnLite.AuthenticatorData.t()}
  | {:error, term()}

Verify AuthenticatorResponse and return struct.

{:ok, authenticator_data} =
  WebAuthnLite.Operation.Authenticate.validate_authenticator_assertion(%{
    credential_id: credential_id,
    signature: encoded_signature,
    authenticator_data: encoded_authenticator_data,
    client_data_json: encoded_client_data_json,
    public_keys: [storable_public_key],
    rp_id: rp_id,
    up_required: true,
    uv_required: false
  })
Link to this function validate_client_data_json(map)
validate_client_data_json(params :: map()) ::
  {:ok, client_data_json :: WebAuthnLite.ClientDataJSON.t()} | {:error, term()}

Verify clientDataJSON and return struct.

{:ok, client_data_json} =
  WebAuthnLite.Operation.Authenticate.validate_client_data_json(%{
    client_data_json: encoded_client_data_json,
    origin: origin,
    challenge: challenge
  })