Skip to content

Commit

Permalink
PYTHON-4206 - QE Range Protocol V2 (#828)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStapp authored Jun 10, 2024
1 parent dfa0430 commit 008b889
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
5 changes: 4 additions & 1 deletion bindings/python/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Changelog
=========

Changes in Version 2.0.0
Changes in Version 1.10.0
------------------------

- Add Python async support.
- Drop support for Python 3.7 and PyPy 3.8. Python >=3.8 or PyPy >=3.9 is now required.
- Add support for range-based Queryable Encryption with the new "range"
algorithm on MongoDB 8.0+. This replaces the experimental "rangePreview" algorithm.


Changes in Version 1.9.2
------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def encrypt(
- `contention_factor` (int): The contention factor to use
when the algorithm is "Indexed".
- `range_opts` (bytes): Options for explicit encryption
with the "rangePreview" algorithm encoded as a BSON document.
with the "range" algorithm encoded as a BSON document.
- `is_expression` (boolean): True if this is an encryptExpression()
context. Defaults to False.
Expand Down
14 changes: 3 additions & 11 deletions bindings/python/pymongocrypt/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,7 @@ def _parse_version(version):
/// String constant for setopt_algorithm "Random" encryption
/// String constant for setopt_algorithm "Indexed" explicit encryption
/// String constant for setopt_algorithm "Unindexed" explicit encryption
/// String constant for setopt_algorithm "rangePreview" explicit encryption
/// NOTE: The RangePreview algorithm is experimental only. It is not intended
/// for public use.
/// String constant for setopt_algorithm "Range" explicit encryption
/**
* Identify the AWS KMS master key to use for creating a data key.
Expand Down Expand Up @@ -837,9 +835,7 @@ def _parse_version(version):
/**
* Explicit helper method to encrypt a Match Expression or Aggregate Expression.
* Contexts created for explicit encryption will not go through mongocryptd.
* Requires query_type to be "rangePreview".
* NOTE: The RangePreview algorithm is experimental only. It is not intended for
* public use.
* Requires query_type to be "range".
*
* This method expects the passed-in BSON to be of the form:
* { "v" : FLE2RangeFindDriverSpec }
Expand Down Expand Up @@ -1376,9 +1372,7 @@ def _parse_version(version):
bool mongocrypt_ctx_setopt_query_type(mongocrypt_ctx_t *ctx, const char *query_type, int len);
/**
* Set options for explicit encryption with the "rangePreview" algorithm.
* NOTE: The RangePreview algorithm is experimental only. It is not intended for
* public use.
* Set options for explicit encryption with the "range" algorithm.
*
* @p opts is a BSON document of the form:
* {
Expand All @@ -1398,8 +1392,6 @@ def _parse_version(version):
bool mongocrypt_ctx_setopt_algorithm_range(mongocrypt_ctx_t *ctx, mongocrypt_binary_t *opts);
/// String constants for setopt_query_type
// NOTE: The RangePreview algorithm is experimental only. It is not intended for
// public use.
"""
)

Expand Down
2 changes: 1 addition & 1 deletion bindings/python/pymongocrypt/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def __init__(
- `contention_factor` (int): The contention factor to use
when the algorithm is "Indexed".
- `range_opts` (bytes): Options for explicit encryption
with the "rangePreview" algorithm encoded as a BSON document.
with the "range" algorithm encoded as a BSON document.
- `is_expression` (boolean): True if this is an encryptExpression()
context. Defaults to False.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def encrypt(
- `contention_factor` (int): The contention factor to use
when the algorithm is "Indexed".
- `range_opts` (bytes): Options for explicit encryption
with the "rangePreview" algorithm encoded as a BSON document.
with the "range" algorithm encoded as a BSON document.
- `is_expression` (boolean): True if this is an encryptExpression()
context. Defaults to False.
Expand Down
8 changes: 4 additions & 4 deletions bindings/python/test/test_mongocrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,9 +985,9 @@ async def test_range_query_int32(self):
)
encrypted = await encrypter.encrypt(
value,
"rangePreview",
"range",
key_id=key_id,
query_type="rangePreview",
query_type="range",
contention_factor=4,
range_opts=range_opts,
is_expression=True,
Expand Down Expand Up @@ -1384,9 +1384,9 @@ def test_range_query_int32(self):
expected = json_data("fle2-find-range-explicit-v2/int32/encrypted-payload.json")
encrypted = encrypter.encrypt(
value,
"rangePreview",
"range",
key_id=key_id,
query_type="rangePreview",
query_type="range",
contention_factor=4,
range_opts=range_opts,
is_expression=True,
Expand Down

0 comments on commit 008b889

Please sign in to comment.