Strongbox.Schema (Strongbox v0.1.0-dev)

Copy Markdown View Source

Encrypted fields and blind indexes in a schema, always redacted.

defmodule MyApp.User do
  use Ecto.Schema
  use Strongbox.Schema, vault: MyApp.Vault

  schema "users" do
    field :name, :string
    encrypted_field :email, as: :string
    encrypted_field :born_on, as: :date
    blind_index :email_index, of: :email, normalize: [:trim, :downcase]
  end
end

encrypted_field/2 is field(name, Strongbox.Encrypted, opts) and blind_index/2 is field(name, Strongbox.Index, opts), each with the vault given to use and redact: true, so the values never show when the struct is inspected. Options are those of Strongbox.Encrypted and Strongbox.Index; a :vault among them takes the place of the one given to use.

Summary

Functions

A blind index of an encrypted field: see Strongbox.Index for its options. :of names the field it indexes.

An encrypted field: see Strongbox.Encrypted for its options.

Functions

blind_index(name, opts)

(macro)

A blind index of an encrypted field: see Strongbox.Index for its options. :of names the field it indexes.

encrypted_field(name, opts \\ [])

(macro)

An encrypted field: see Strongbox.Encrypted for its options.