Erebus.Schema (Erebus v0.2.0-rc.2) View Source

This module provides macros for defining fields on your Ecto model.

Usage:

use Erebus.Schema
use Ecto.Schema

embedded_schema do
  hashed_encrypted_field(:first)
  data_encryption_key()
end

Link to this section Summary

Functions

Defines field dek of type map, which is required for storing encrypted information using Erebus.

Defines three fields

Link to this section Functions

Link to this macro

data_encryption_key()

View Source (macro)

Defines field dek of type map, which is required for storing encrypted information using Erebus.

Please note that if you're using it with a database underneath, this field needs to be of type jsonb underneath.

Link to this macro

hashed_encrypted_field(name)

View Source (macro)

Defines three fields:

  • name: virtual field of type string
  • name_encrypted: field of type binary storing encrypted data
  • name_hash: field of type string, storing sha512 version of given data, for quick searching

Please note that if you're using it with a database underneath, these fields need to be of type:

  • name_encrypted: bytea
  • name_hash: text