256-bit key as a 64-character hex string. New values are sealed
under a subkey derived from it with HKDF-SHA-256; the key itself is
used only to read legacy (pre-v2) ciphertexts.
OptionalalgorithmAlgorithm identifier. Currently only "xchacha20-poly1305" is supported.
Reserved for future algorithm additions.
OptionalfieldsPer-entity field mapping. Keys are entity names, values are arrays of
property names that should be encrypted. Used by EncryptionSubscriber
to know which fields to process automatically.
OptionalcontextColumn context bound into every ciphertext as associated data, by
convention "Entity.property". A value sealed for one context fails
to decrypt under another, so ciphertexts cannot be swapped between
columns. @EncryptedColumn sets it to ClassName.property unless
given here; EncryptionSubscriber always uses EntityName.field.
A bare EncryptionTransformer without a context binds the empty
context, which every other context-less transformer shares.
OptionalallowReturn a stored value as-is when it is not a ciphertext at all,
instead of throwing a FieldDecryptionError. Meant only for the
window in which existing plaintext rows are being migrated. A value
in the v2: format that fails authentication is always rejected.
OptionalacceptAccept legacy ciphertexts written before the v2: format (sealed
with the configured key and no associated data). Legacy values are not
bound to their column, so anyone able to write the database could
move one into another encrypted column. Set this only while
re-writing old rows, then remove it.
Configuration for column-level encryption.
Example