Comeonin v5.3.0 Comeonin behaviour View Source
Defines a behaviour for higher-level password hashing functions.
Link to this section Summary
Callbacks
Hashes a password and returns the password hash in a map.
Checks the password by comparing its hash with the password hash found in a user struct, or map.
Runs the password hash function, but always returns false.
Link to this section Types
opts()
View Source
opts() :: keyword()
opts() :: keyword()
password()
View Source
password() :: binary()
password() :: binary()
user_struct()
View Source
user_struct() :: map() | nil
user_struct() :: map() | nil
Link to this section Callbacks
add_hash(password, opts) View Source
Hashes a password and returns the password hash in a map.
check_pass(user_struct, password, opts)
View Source
check_pass(user_struct(), password(), opts()) ::
{:ok, map()} | {:error, String.t()}
check_pass(user_struct(), password(), opts()) :: {:ok, map()} | {:error, String.t()}
Checks the password by comparing its hash with the password hash found in a user struct, or map.
The first argument to check_pass
should be a user struct, a regular
map, or nil.
no_user_verify(opts)
View Source
no_user_verify(opts()) :: false
no_user_verify(opts()) :: false
Runs the password hash function, but always returns false.
This function is intended to make it more difficult for any potential attacker to find valid usernames by using timing attacks. This function is only useful if it is used as part of a policy of hiding usernames.