View Source Cloak.Ecto.Integer (cloak_ecto v1.3.0)
An Ecto.Type to encrypt integer fields.
Migration
The database field must be of type :binary.
add :encrypted_field, :binaryUsage
Define an Encrypted.Integer module in your project:
defmodule MyApp.Encrypted.Integer do
use Cloak.Ecto.Integer, vault: MyApp.Vault
endThen, define the type of your desired fields:
schema "table_name" do
field :encrypted_field, MyApp.Encrypted.Integer
end