documentation/dsls/DSL:-AshCloak.md

<!--
This file was generated by Spark. Do not edit it by hand.
-->
# DSL: AshCloak

An extension for encrypting attributes of a resource.

See the getting started guide for more information.


## cloak
Encrypt attributes of a resource






### Options

| Name | Type | Default | Docs |
|------|------|---------|------|
| [`vault`](#cloak-vault){: #cloak-vault .spark-required} | `module` |  | The vault to use to encrypt & decrypt the value |
| [`attributes`](#cloak-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){: #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){: #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}` |







<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>