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
Functions
Checks if the given PIN code matches with the credential pin_hash
Deletes a AuthShield.Credentials.Schemas.PIN
register.
Deletes a AuthShield.Credentials.Schemas.PIN
register.
Gets a AuthShield.Credentials.Schemas.PIN
register by its filters.
Gets a AuthShield.Credentials.Schemas.PIN
register by its filters.
Creates a new AuthShield.Credentials.Schemas.PIN
register.
Creates a new AuthShield.Credentials.Schemas.PIN
register.
Returns a list of AuthShield.Credentials.Schemas.PIN
by its filters
Link to this section Types
Transactional responses of failed
success_response()
View Sourcesuccess_response() :: {:ok, AuthShield.Credentials.Schemas.PIN.t()}
Transactional responses of success
Link to this section Functions
check_pin?(pin, code)
View Sourcecheck_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")
delete(pin)
View Sourcedelete(pin :: AuthShield.Credentials.Schemas.PIN.t()) :: success_response() | failed_response()
Deletes a AuthShield.Credentials.Schemas.PIN
register.
Exemples:
AuthShield.Credentials.PIN.delete(pin)
delete!(pin)
View Sourcedelete!(pin :: AuthShield.Credentials.Schemas.PIN.t()) :: AuthShield.Credentials.Schemas.PIN.t() | no_return()
Deletes a AuthShield.Credentials.Schemas.PIN
register.
Similar to delete/1
but returns the struct or raises if the changeset is invalid.
get_by(filters)
View Sourceget_by(filters :: keyword()) :: AuthShield.Credentials.Schemas.PIN.t() | nil
Gets a AuthShield.Credentials.Schemas.PIN
register by its filters.
Exemples:
AuthShield.Credentials.PIN.get_by(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")
get_by!(filters)
View Sourceget_by!(filters :: keyword()) :: AuthShield.Credentials.Schemas.PIN.t() | no_return()
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.
insert(params)
View Sourceinsert(params :: map()) :: success_response() | failed_response()
Creates a new AuthShield.Credentials.Schemas.PIN
register.
Exemples:
AuthShield.Credentials.PIN.insert(%{
user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e",
pin: "332456"
})
insert!(params)
View Sourceinsert!(params :: map()) :: AuthShield.Credentials.Schemas.PIN.t() | no_return()
Creates a new AuthShield.Credentials.Schemas.PIN
register.
Similar to insert/1
but returns the struct or raises if the changeset is invalid.
list(filters \\ [])
View Sourcelist(filters :: keyword()) :: [AuthShield.Credentials.Schemas.PIN.t()]
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")