Karta.Accounts.Password (Karta v1.0.0)

Password hashes for local login: Argon2id, 16 MiB, 3 passes, 1 lane (the parameters of API keys; above OWASP's 12 MiB / 3 passes). A check for a user without a password, or with no user at all, still computes a hash with the same parameters, so that its answer takes as long as a real one and does not tell which accounts exist.

Summary

Functions

A random password for a new local account: 24 characters of base32 (120 bits).

The hash of a password, to store.

True when password matches hash; nil (no password) never matches, at the same cost.

Functions

generate()

@spec generate() :: String.t()

A random password for a new local account: 24 characters of base32 (120 bits).

hash(password)

@spec hash(String.t()) :: String.t()

The hash of a password, to store.

verify(hash, password)

@spec verify(String.t() | nil, String.t()) :: boolean()

True when password matches hash; nil (no password) never matches, at the same cost.