AuthShield v0.0.1 AuthShield.Credentials.PIN View Source

A personal identification number (PIN), or sometimes redundantly a PIN number, is a numeric or alpha-numeric password used in the process of authenticating a user accessing a system.

It is usually used in ATM oe POS transactions to authenticate identities and secure access control.

This module implements an interface to deal with database transactions as inserts, updates, deletes, etc.

Link to this section Summary

Types

Transactional responses of failed

Transactional responses of success

Functions

Checks if the given PIN code matches with the credential pin_hash

Gets a AuthShield.Credentials.Schemas.PIN register by its filters.

Gets a AuthShield.Credentials.Schemas.PIN register by its filters.

Returns a list of AuthShield.Credentials.Schemas.PIN by its filters

Link to this section Types

Link to this type

failed_response()

View Source
failed_response() :: {:error, Ecto.Changeset.t()}

Transactional responses of failed

Link to this type

success_response()

View Source
success_response() :: {:ok, AuthShield.Credentials.Schemas.PIN.t()}

Transactional responses of success

Link to this section Functions

Link to this function

check_pin?(pin, code)

View Source
check_pin?(
  pin :: AuthShield.Credentials.Schemas.PIN.t(),
  pin_code :: String.t()
) :: boolean()

Checks if the given PIN code matches with the credential pin_hash

It calls the Argon2 to verify and returns true if the PIN matches and false if the PIN doesn't match.

Exemples:

  AuthShield.Credentials.PIN.check_pin?(pin, "332456")

Deletes a AuthShield.Credentials.Schemas.PIN register.

Exemples:

  AuthShield.Credentials.PIN.delete(pin)

Deletes a AuthShield.Credentials.Schemas.PIN register.

Similar to delete/1 but returns the struct or raises if the changeset is invalid.

Gets a AuthShield.Credentials.Schemas.PIN register by its filters.

Exemples:

  AuthShield.Credentials.PIN.get_by(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")

Gets a AuthShield.Credentials.Schemas.PIN register by its filters.

Similar to get_by/1 but returns the struct or raises if the changeset is invalid.

Creates a new AuthShield.Credentials.Schemas.PIN register.

Exemples:

  AuthShield.Credentials.PIN.insert(%{
    user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e",
    pin: "332456"
  })

Creates a new AuthShield.Credentials.Schemas.PIN register.

Similar to insert/1 but returns the struct or raises if the changeset is invalid.

Returns a list of AuthShield.Credentials.Schemas.PIN by its filters

Exemples:

  # Getting the all list
  AuthShield.Credentials.PIN.list()

  # Filtering the list by field
  AuthShield.Credentials.PIN.list(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")