@@ -1082,12 +1082,12 @@ of the application "on the wire" and "at rest".
10821082To enable application-level encryption, set the environment variable
10831083``CIPHER_TOPIC `` to be the :ref: `topic <Topics >` of a cipher class.
10841084
1085- The library's :class: `~ eventsourcing.cipher.AESCipher ` class can
1086- be used to encrypt stored domain events.
1085+ The library's older :class: `eventsourcing.cipher.AESCipher ` class can
1086+ be used to encrypt stored domain events. This class uses ` Pycryptodome < https://pypi.org/project/pycryptodome/ >`_.
10871087When using the library's :class: `~eventsourcing.cipher.AESCipher `
10881088class, set environment variable ``CIPHER_KEY `` to be a valid encryption
10891089key. You can use the static method :func: `~eventsourcing.cipher.AESCipher.create_key `
1090- on the :class: `~ eventsourcing.cipher.AESCipher ` class to generate a valid encryption key.
1090+ on the :class: `eventsourcing.cipher.AESCipher ` class to generate a valid encryption key.
10911091
10921092.. code-block :: python
10931093
@@ -1103,6 +1103,31 @@ on the :class:`~eventsourcing.cipher.AESCipher` class to generate a valid encryp
11031103 os.environ[" CIPHER_KEY" ] = cipher_key
11041104
11051105
1106+ Alternatively, the library's new :class: `eventsourcing.cryptography.AESCipher ` class can
1107+ be used to encrypt stored domain events. This class uses the newer "standard" Python
1108+ `cryptography <https://pypi.org/project/cryptography/ >`_ package. When using this
1109+ :class: `~eventsourcing.cryptography.AESCipher ` class, set environment variable ``CIPHER_KEY ``
1110+ to be a valid encryption key. You can use the static method :func: `~eventsourcing.cryptography.AESCipher.create_key `
1111+ on the :class: `eventsourcing.cryptography.AESCipher ` class to generate a valid encryption key.
1112+
1113+ .. code-block :: python
1114+
1115+ from eventsourcing.cryptography import AESCipher
1116+
1117+ # Generate a cipher key (keep this safe).
1118+ cipher_key = AESCipher.create_key(num_bytes = 32 )
1119+
1120+ # Configure cipher topic.
1121+ os.environ[" CIPHER_TOPIC" ] = " eventsourcing.cryptography:AESCipher"
1122+
1123+ # Configure cipher key.
1124+ os.environ[" CIPHER_KEY" ] = cipher_key
1125+
1126+
1127+ The classes :class: `eventsourcing.cipher.AESCipher ` and :class: `eventsourcing.cryptography.AESCipher ` are tested
1128+ as being interoperable. You should be able to decrypt events with one that have been encrypted with the other, using
1129+ the same cipher key.
1130+
11061131.. _Snapshotting :
11071132
11081133Snapshotting
@@ -1254,6 +1279,13 @@ Code reference
12541279 :special-members:
12551280 :exclude-members: __weakref__, __dict__
12561281
1282+ .. automodule :: eventsourcing.cryptography
1283+ :show-inheritance:
1284+ :member-order: bysource
1285+ :members:
1286+ :special-members:
1287+ :exclude-members: __weakref__, __dict__
1288+
12571289.. automodule :: eventsourcing.cipher
12581290 :show-inheritance:
12591291 :member-order: bysource
0 commit comments