Skip to content

Commit 5682d18

Browse files
committed
Move client-side QE config from faq to howto
1 parent 05032fc commit 5682d18

File tree

2 files changed

+78
-73
lines changed

2 files changed

+78
-73
lines changed

docs/source/faq.rst

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -52,72 +52,3 @@ logging::
5252
If running ``manage.py dumpdata`` results in ``CommandError: Unable to
5353
serialize database: 'EmbeddedModelManager' object has no attribute using'``,
5454
see :ref:`configuring-database-routers-setting`.
55-
56-
.. _queryable-encryption:
57-
58-
Queryable Encryption
59-
====================
60-
61-
What about client-side configuration?
62-
-------------------------------------
63-
64-
In the :doc:`Queryable Encryption how-to guide <howto/queryable-encryption>`,
65-
server-side Queryable Encryption configuration is covered.
66-
67-
Client side Queryable Encryption configuration requires that the entire
68-
encrypted fields map be known at the time of client connection.
69-
70-
Encrypted fields map
71-
~~~~~~~~~~~~~~~~~~~~
72-
73-
In addition to the
74-
:ref:`settings described in the how-to guide <server-side-queryable-encryption-settings>`,
75-
you will need to provide a ``encrypted_fields_map`` to the
76-
``AutoEncryptionOpts``.
77-
78-
Fortunately, this is easy to do with Django MongoDB Backend. You can use
79-
the ``createencryptedfieldsmap`` management command to generate the schema map
80-
for your encrypted fields, and then use the results in your settings.
81-
82-
To generate the encrypted fields map, run the following command in your Django
83-
project::
84-
85-
python manage.py createencryptedfieldsmap
86-
87-
.. note:: The ``createencryptedfieldsmap`` command is only available if you
88-
have the ``django_mongodb_backend`` app included in the
89-
:setting:`INSTALLED_APPS` setting.
90-
91-
Settings
92-
~~~~~~~~
93-
94-
Now include the generated schema map in your Django settings::
95-
96-
97-
DATABASES["encrypted"] = {
98-
99-
"OPTIONS": {
100-
"auto_encryption_opts": AutoEncryptionOpts(
101-
102-
encrypted_fields_map = {
103-
"encryption__patientrecord": {
104-
"fields": [
105-
{
106-
"bsonType": "string",
107-
"path": "ssn",
108-
"queries": {"queryType": "equality"},
109-
"keyId": Binary(b"\x14F\x89\xde\x8d\x04K7\xa9\x9a\xaf_\xca\x8a\xfb&", 4),
110-
},
111-
}
112-
},
113-
# Add other models with encrypted fields here
114-
},
115-
),
116-
117-
},
118-
119-
}
120-
121-
You are now ready to use client-side
122-
:doc:`Queryable Encryption </topics/queryable-encryption>`
123-
in your Django project.

docs/source/howto/queryable-encryption.rst

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22
Configuring Queryable Encryption
33
================================
44

5+
.. _server-side-queryable-encryption:
6+
57
Configuring Queryable Encryption in Django is similar to
68
:doc:`manual:core/queryable-encryption/quick-start` but with some additional
79
steps required for Django.
810

9-
.. admonition:: Server-side Queryable Encryption
11+
Server-side Queryable Encryption
12+
--------------------------------
13+
14+
Server-side Queryable Encryption allows you to begin developing applications
15+
without needing to define the encrypted fields map at the time of connection
16+
to the database.
17+
18+
.. admonition:: What about client-side Queryable Encryption?
1019

11-
This section describes how to configure server side Queryable
12-
Encryption in Django. For configuration of client side Queryable Encryption,
13-
please refer to this :ref:`FAQ question <queryable-encryption>`.
20+
For configuration of client-side Queryable Encryption,
21+
please refer to this :ref:`see below <client-side-queryable-encryption>`.
1422

1523
Prerequisites
1624
-------------
@@ -80,3 +88,69 @@ database router. Here's how to set it up in your Django settings.
8088

8189
You are now ready to use server side :doc:`Queryable Encryption
8290
</topics/queryable-encryption>` in your Django project.
91+
92+
.. _client-side-queryable-encryption:
93+
94+
Client-side Queryable Encryption
95+
--------------------------------
96+
97+
In the :ref:`section above <server-side-queryable-encryption-settings>`,
98+
server-side Queryable Encryption configuration is covered.
99+
100+
Client side Queryable Encryption configuration requires that the entire
101+
encrypted fields map be known at the time of client connection.
102+
103+
Encrypted fields map
104+
~~~~~~~~~~~~~~~~~~~~
105+
106+
In addition to the
107+
:ref:`settings described in the how-to guide <server-side-queryable-encryption-settings>`,
108+
you will need to provide a ``encrypted_fields_map`` to the
109+
``AutoEncryptionOpts``.
110+
111+
Fortunately, this is easy to do with Django MongoDB Backend. You can use
112+
the ``createencryptedfieldsmap`` management command to generate the schema map
113+
for your encrypted fields, and then use the results in your settings.
114+
115+
To generate the encrypted fields map, run the following command in your Django
116+
project::
117+
118+
python manage.py createencryptedfieldsmap
119+
120+
.. note:: The ``createencryptedfieldsmap`` command is only available if you
121+
have the ``django_mongodb_backend`` app included in the
122+
:setting:`INSTALLED_APPS` setting.
123+
124+
Settings
125+
~~~~~~~~
126+
127+
Now include the generated schema map in your Django settings::
128+
129+
130+
DATABASES["encrypted"] = {
131+
132+
"OPTIONS": {
133+
"auto_encryption_opts": AutoEncryptionOpts(
134+
135+
encrypted_fields_map = {
136+
"encryption__patientrecord": {
137+
"fields": [
138+
{
139+
"bsonType": "string",
140+
"path": "ssn",
141+
"queries": {"queryType": "equality"},
142+
"keyId": Binary(b"\x14F\x89\xde\x8d\x04K7\xa9\x9a\xaf_\xca\x8a\xfb&", 4),
143+
},
144+
}
145+
},
146+
# Add other models with encrypted fields here
147+
},
148+
),
149+
150+
},
151+
152+
}
153+
154+
You are now ready to use client-side
155+
:doc:`Queryable Encryption </topics/queryable-encryption>`
156+
in your Django project.

0 commit comments

Comments
 (0)