I’m trying to use argon2 for hashing passwords.
I’ve added {:argon2_elixir, "~> 2.4"} to defp deps in apps/webshop/mix.exs, and then I did mix deps.get.
In user.ex I try to call a method from argon2 like so:
defp put_password_hash(
%Ecto.Changeset{valid?: true, changes: %{password: password}} =changeset
) do
change(changeset, hashed_password: Argon2.hash_pwd_salt(password))
end
But it says “Argon2.hash_pwd_salt/1 is undefined (module Argon2 is not available or is yet to be defined)”
If I run iex -S mix phx.server I can use it just fine.
What you’ve done sounds right. Have you restarted your iex session after doing mix deps.get ? If you do mix deps |grep argon2 do you see it on the list?
It also looks like you’re using an umbrella project, is the place you’re using the Argon2 module the same project as where it is defined as a dep?