web_authn_lite v0.1.2 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, authenticator_data :: WebAuthnLite.AuthenticatorData.t()}
  | {:error, term()}

Verify AuthenticatorResponse and return struct.

{:ok, authenticator_data} =
  WebAuthnLite.Operation.Authenticate.validate_authenticator_assertion(%{
    signature: encoded_signature,
    authenticator_data: encoded_authenticator_data,
    client_data_json: encoded_client_data_json,
    public_key: public_key,
    rp_id: rp_id,
    up_required: true,
    uv_required: false,
    sign_count: sign_count
  })
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
  })