Security Filters

Security Filters

Use security filters to encrypt and decrypt strings.

decrypt_aes: String secret String salt (optional)
Returns the unencrypted value of the input using a shared secret and optional salt. If no salt is provided, a default salt value is used.
encrypt_aes: String secret String salt (optional)
Returns an encrypted value of the input using a shared secret and optional salt. If no salt is provided, a default salt value is used.

Note: Particularly for code that may be re-used across multiple sites, it is recommended to store your secrets in a site setting where it can quickly and easily be updated.

Examples

{% var some_secret_string = entity.secret.value | encrypt_aes: site.shared_secret.value %}
{% var shouldEqualOriginalValue = some_secret_string | decrypt_aes: site.shared_secret.value %}
{% capture salt %}{{ entity.guid }}{{ entity.name.value }}{% endcapture %}
{% set salt = salt | url_encode %}
{% assign some_secret_string = entity.secret.value | encrypt_aes: site.shared_secret.value, salt %}
{% assign some_decoded_string = request.query_params.encrypted_data | decrypt_aes: site.shared_secret.value, salt %}