An extension for encrypting attributes of a resource.
See the getting started guide for more information.
Encrypt attributes of a resource
Name | Type | Default | Docs |
---|---|---|---|
vault {: #cloak-vault .spark-required} |
module |
The vault to use to encrypt & decrypt the value | |
attributes {: #cloak-attributes } |
atom | list(atom) |
[] |
The attribute or attributes to encrypt. The attribute will be renamed to encrypted_{attribute} , and a calculation with the same name will be added. |
decrypt_by_default {: #cloak-decrypt_by_default } |
atom | list(atom) |
[] |
A list of attributes that should be decrypted (their calculation should be loaded) by default. |
on_decrypt {: #cloak-on_decrypt } |
(any, any, any, any -> any) | mfa |
A function to call when decrypting any value. Takes the resource, field, records, and calculation context. Must return :ok or {:error, error} |