graciousagency/doctrine-encryption-bundle — reverse-engineered prompt
Reverse engineered prompt
Build me a small Symfony Doctrine bundle in PHP that makes it easy to store sensitive entity fields safely in the database.
I want it to add custom Doctrine column types called encrypted, encryptedArrayCollection, and hashed. The encrypted type should use libsodium, automatically create a nonce for each value, and store the nonce together with the encrypted value so it can be decrypted later. The array collection version should handle encrypted collections in the same spirit. The hashed type should store a one way hashed value.
Please make it configurable with environment variables, especially ENABLE_ENCRYPTION and ENCRYPTION_KEY, where the key is a 64 character hex string. Include the bundle class, the Doctrine type classes, composer setup, and clear README instructions showing how to install it, register the Doctrine types in doctrine.yaml, generate an encryption key, and use the types in entity annotations.
Keep it simple and compatible with Symfony and Doctrine projects. Look up current docs online if needed.
Want more depth? Deep Reverse