> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/hosting/configuration/encryption-keys.md).

# Encryption keys in Duaer

Duaer encrypts credentials before saving them to the database. It creates a key on first launch; DUAER_ENCRYPTION_KEY overrides that.
## Auto-generated and custom keys

Duaer creates a random encryption key automatically on first launch and saves it in the settings file in the instance data directory. Duaer uses that key to encrypt credentials before they are saved to the database.

If the key is not yet in the settings file, set the environment variable DUAER_ENCRYPTION_KEY so Duaer uses your custom key instead of generating a new one. If the key is lost or changed, saved credentials cannot be decrypted. Workflows remain; connected accounts have to be saved again.

In [queue mode](/hosting/scaling/queue-mode.md), you must set the encryption key environment variable for every worker. Refer to [Set a custom encryption key](/hosting/configuration/configuration-examples/encryption-key.md).
## Questions

### Where does the encryption key come from?

On first launch Duaer creates one in the instance data directory. You can set DUAER_ENCRYPTION_KEY instead. If you lose or change it, stored credentials cannot be decrypted. Do not commit the key to Git.

### What does queue mode require for the key?

In Duaer, every worker must set the same DUAER_ENCRYPTION_KEY.

