danielberkompas / cloak

Elixir encryption library designed for Ecto
MIT License
582 stars 55 forks source link

Add support for encrypted Ecto String and Integer Array types. #52

Closed boydm closed 6 years ago

boydm commented 6 years ago

Had a need to encrypt an array of strings (a supported Ecto type) in the db. Example use case is a list of permissions in a record. This used to work in Cloak version 0.3 by using the EncryptedMapField because it was simply running the data through Json without actually casting into Ecto. Newer versions cloak do more type checking, so the Ecto type {:array, :string} fails now.

This PR creates two new encrypted field types corresponding to the Ecto types of {:array, :string} and {:array, :integer}. They are simple variations of the existing Map type. Docs and tests for both have been added/updated.

boydm commented 6 years ago

Ugh. It wants formatting. I'll go install 1.6-rc...