cloak v0.6.2 Cloak.EncryptedIntegerListField View Source

An Ecto.Type to encrypt a list of integers.

Configuration

You can customize the json library used for for converting the lists. Default: Poison

config :cloak, json_library: Jason

Usage

You should create the field with type :binary. On encryption, the list will first be converted to JSON using the configured :json_library, and then encrypted. On decryption, the :json_library will be used to convert it back to a list of integers.

You can use this field type in your schema definition like this:

schema "table" do
  field :field_name, Cloak.EncryptedIntegerArrayField
end

Use it where you would have normally done this:

schema "table" do
  field :field_name, {:array, :integer}
end