Encryption
Encryption can be enabled via encryptionOptions. When enabled, values can be stored encrypted at rest.
How it works
- Encryption uses AES-256-GCM
- On
set(), the value is encrypted and stored withisEncrypted = true - On
get()/getList(), encrypted values are decrypted automatically (requiresencryptionKey)
Example
CrudConfigModule.register({
encryptionOptions: {
isEnabled: true,
encryptionKey: process.env.CONFIG_ENCRYPTION_KEY,
},
});await configService.set({
section: "database",
name: "DB_PASSWORD",
value: "my-secret-password",
});
const config = await configService.get({
section: "database",
name: "DB_PASSWORD",
});
console.log(config.value); // decrypted value
console.log(config.isEncrypted); // trueSee also:
Last updated on