Encryption
Plugin Data
You can enable encryption of the data stored by the plugin inside the user content file.
site/config/config.php
<?php
return [
'bnomei.klub.crypto.encrypt' => true,
'bnomei.klub.crypto.password' => fn() => env('CRYPTO_PASSWORD'),
// other options
];
Like with other secrets, I would strongly recommend loading them from a .env
file.
⚠️ If you enable encryption and lose your password, you cannot recover the data.
User Content File
You can also fully encrypt the data stored by Kirby in its user content file by creating a custom UserModel and matching the targeted role (member
by default). This might be useful if you intend to store sensitive personal data like names, emails, addresses, social media account names and similar data.
site/plugins/klub-encryption/index.php
<?php
class MemberModel extends \Kirby\Cms\User
{
// encrypt user content files
use \Bnomei\Klub\HasEncryptedContent;
}
Kirby::plugin('bnomei/klub-encryption', [
'userModels' => [
'member' => MemberModel::class,
],
]);