Encrypts values on save, and decrypts on fetch.
Strapi’s Encryptable Field Plugin is a plugin that allows users to encrypt and decrypt data in Strapi. It is important to note that this plugin should not be used to store user passwords, as hashing should be used for that purpose. The plugin supports the aes-256-cbc encryption method and is only compatible with Strapi version 4.
config/plugins.jsmodule.exports = ({ env }) => ({
// ...
settings: {
encryption: {
enabled: true,
encryptionKey: env('ENCRYPTION_KEY'),
},
},
});
ENCRYPTION_KEY to your server and .env file$ node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
Strapi’s Encryptable Field Plugin is a useful plugin for encrypting and decrypting data in Strapi. It provides features such as role-based decryption, basic and advanced settings for customization, and easy installation and configuration. It is important to follow best practices and consult the rules around PII data when using this plugin in production.