web_authn_lite v0.4.0 WebAuthnLite.Operation.Register

Functions for Registering a new credential operation

https://www.w3.org/TR/webauthn/#registering-a-new-credential

Link to this section Summary

Functions

Verify attestation object and return public key

Verify clientDataJSON and return struct

Link to this section Functions

Link to this function validate_attestation_object(map)
validate_attestation_object(params :: map()) ::
  {:ok, storable_public_key :: WebAuthnLite.StorablePublicKey.t(),
   attestation_object :: WebAuthnLite.AttestationObject.t()}
  | {:error, term()}

Verify attestation object and return public key.

NOTE: This function doesn’t verify attestation statement yet.

{:ok, storable_public_key} =
  WebAuthnLite.Operation.Register.validate_attestation_object(%{
    attestation_object: encoded_attestation_object,
    client_data_json: encoded_client_data_json,
    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.Register.validate_client_data_json(%{
    client_data_json: encoded_client_data_json,
    origin: origin,
    challenge: challenge
  })