Skip to content

Commit 240a748

Browse files
authored
PYTHON-3893 Add BSON Binary Data subtype Sensitive (#1335)
1 parent dc59eb8 commit 240a748

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

bson/binary.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ class UuidRepresentation:
183183
.. versionadded:: 4.0
184184
"""
185185

186+
SENSITIVE_SUBTYPE = 8
187+
"""BSON binary subtype for sensitive data.
188+
189+
.. versionadded:: 4.5
190+
"""
191+
192+
186193
USER_DEFINED_SUBTYPE = 128
187194
"""BSON binary subtype for any user defined structure.
188195
"""

doc/api/bson/binary.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
.. autodata:: CSHARP_LEGACY
1616
.. autodata:: MD5_SUBTYPE
1717
.. autodata:: COLUMN_SUBTYPE
18+
.. autodata:: SENSITIVE_SUBTYPE
1819
.. autodata:: USER_DEFINED_SUBTYPE
1920

2021
.. autoclass:: UuidRepresentation

test/bson_corpus/binary.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"canonical_bson": "1D000000057800100000000773FFD26444B34C6990E8E7D1DFC035D400",
5656
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"07\"}}}"
5757
},
58+
{
59+
"description": "subtype 0x08",
60+
"canonical_bson": "1D000000057800100000000873FFD26444B34C6990E8E7D1DFC035D400",
61+
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"08\"}}}"
62+
},
5863
{
5964
"description": "subtype 0x80",
6065
"canonical_bson": "0F0000000578000200000080FFFF00",

0 commit comments

Comments
 (0)