See DRIVERS-533 for details.
Automatic client side field level encryption should just work in Motor by passing AutoEncryptionOpts to MotorClient/AsyncIOMotorClient like this:
from motor.motor_asyncio import AsyncIOMotorClient # Configure auto_encryption_opts the same as a pymongo.MongoClient: from pymongo.encryption_options import AutoEncryptionOpts AWS_CREDS = { 'accessKeyId': '...', 'secretAccessKey': '...' } LOCAL_MASTER_KEY = b'\x00'*96 KMS_PROVIDERS = {'aws': AWS_CREDS, 'local': {'key': LOCAL_MASTER_KEY}} auto_encryption_opts = AutoEncryptionOpts(KMS_PROVIDERS, 'admin.datakeys') # Create an async client with automatic encryption: client = AsyncIOMotorClient(auto_encryption_opts=auto_encryption_opts)
The work in this ticket is to:
- document + test the above.
- Add an async version of PyMongo's ClientEncryption class used for explicit encryption.
- depends on
-
PYTHON-2012 FLE GA Spec changes
- Closed
- is duplicated by
-
MOTOR-430 Motor : FLE GA Spec changes
- Closed