danielberkompas/cloak_ecto

Cloak.Ecto.Type does not conform to the Ecto.Type behavior

WilHall opened this issue · 3 comments

The Cloak.Ecto.Type module does not conform to the Ecto.Type behavior. For example, equal/3 is not implemented.

Because of this, following the cloak_ecto usage instructions results in a custom Ecto type which does not conform to the Ecto.Type behavior. This can result in UndefinedFunctionError instances when Ecto tries to use the custom type in a way that is not implemented:

** (UndefinedFunctionError) function Application.Encrypted.Binary.equal?/2 is undefined or private

I believe either Cloak.Ecto.Type should be updated to use Ecto.Type such that the default implementations can be used as fallbacks, or the usage instructions should be updated to let consumers of use Cloak.Ecto.Binary know that they either need to use Ecto.Type or define the missing methods.

This pull request is related to the issue: #11

Unsure of what the best solution is. But as it is now things will not work as documented with Ecto 3.5.

This should be fixed in 2238af0

Great! 👏