View Source Plausible.Auth (Plausible v0.0.1)
Functions for user authentication context.
Summary
Types
@type rate_limit_type() :: :email_change_user | :login_user | :login_ip
Functions
@spec check_password(Plausible.Auth.User.t(), String.t()) :: :ok | {:error, :wrong_password}
@spec create_api_key(Plausible.Auth.User.t(), String.t(), String.t()) :: {:ok, Plausible.Auth.ApiKey.t()} | {:error, Ecto.Changeset.t() | :upgrade_required}
@spec delete_api_key(Plausible.Auth.User.t(), integer()) :: :ok | {:error, :not_found}
@spec find_api_key(String.t()) :: {:ok, Plausible.Auth.ApiKey.t()} | {:error, :invalid_api_key}
@spec find_user_by(Keyword.t()) :: Plausible.Auth.User.t() | nil
@spec get_user_by(Keyword.t()) :: {:ok, Plausible.Auth.User.t()} | {:error, :user_not_found}
@spec rate_limit(rate_limit_type(), Plausible.Auth.User.t() | Plug.Conn.t()) :: :ok | {:error, {:rate_limit, rate_limit_type()}}
@spec rate_limits() :: map()