libmongocrypt-helper 1.8.0.0.1001 → 1.11.0.0.1001

Sign up to get free protection for your applications and to get access to all the features.
Files changed (385) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libmongocrypt/libmongocrypt/CHANGELOG.md +33 -0
  3. data/ext/libmongocrypt/libmongocrypt/CMakeLists.txt +12 -1
  4. data/ext/libmongocrypt/libmongocrypt/CODEOWNERS +1 -4
  5. data/ext/libmongocrypt/libmongocrypt/Earthfile +151 -3
  6. data/ext/libmongocrypt/libmongocrypt/README.md +36 -40
  7. data/ext/libmongocrypt/libmongocrypt/bindings/cs/CMakeLists.txt +1 -0
  8. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Driver.snk +0 -0
  9. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/AssemblyInfo.cs +2 -2
  10. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Binary.cs +16 -2
  11. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/CryptClientFactory.cs +8 -4
  12. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/Library.cs +10 -0
  13. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/LibraryLoader.cs +81 -44
  14. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt/MongoDB.Libmongocrypt.csproj +2 -1
  15. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test/MongoDB.Libmongocrypt.Test.csproj +2 -0
  16. data/ext/libmongocrypt/libmongocrypt/bindings/cs/MongoDB.Libmongocrypt.Test32/MongoDB.Libmongocrypt.Test32.csproj +2 -0
  17. data/ext/libmongocrypt/libmongocrypt/bindings/cs/README.md +3 -0
  18. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.cake +21 -26
  19. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.config +3 -0
  20. data/ext/libmongocrypt/libmongocrypt/bindings/cs/Scripts/build.sh +0 -0
  21. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/build.gradle.kts +28 -0
  22. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/java/com/mongodb/crypt/benchmark/BenchmarkRunner.java +217 -0
  23. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/benchmarks/src/main/resources/keyDocument.json +24 -0
  24. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/build.gradle.kts +21 -6
  25. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.jar +0 -0
  26. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradle/wrapper/gradle-wrapper.properties +1 -1
  27. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew +154 -108
  28. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/gradlew.bat +7 -18
  29. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/settings.gradle.kts +1 -0
  30. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPI.java +41 -6
  31. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CAPIHelper.java +5 -5
  32. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/CipherCallback.java +27 -1
  33. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java +34 -19
  34. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoExplicitEncryptOptions.java +6 -4
  35. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/jni-config.json +180 -0
  36. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/main/resources/META-INF/native-image/reflect-config.json +134 -0
  37. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/java/com/mongodb/crypt/capi/MongoCryptTest.java +44 -2
  38. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/encrypted-payload.json +1 -1
  39. data/ext/libmongocrypt/libmongocrypt/bindings/java/mongocrypt/src/test/resources/fle2-find-range-explicit-v2/int32/rangeopts.json +3 -0
  40. data/ext/libmongocrypt/libmongocrypt/bindings/node/README.md +4 -900
  41. data/ext/libmongocrypt/libmongocrypt/bindings/python/CHANGELOG.rst +60 -0
  42. data/ext/libmongocrypt/libmongocrypt/bindings/python/README.rst +41 -20
  43. data/ext/libmongocrypt/libmongocrypt/bindings/python/RELEASE.rst +6 -24
  44. data/ext/libmongocrypt/libmongocrypt/bindings/python/build-manylinux-wheel.sh +4 -13
  45. data/ext/libmongocrypt/libmongocrypt/bindings/python/hatch_build.py +36 -0
  46. data/ext/libmongocrypt/libmongocrypt/bindings/python/libmongocrypt-version.txt +1 -0
  47. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/__init__.py +2 -2
  48. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/auto_encrypter.py +61 -0
  49. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/credentials.py +156 -0
  50. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/explicit_encrypter.py +156 -0
  51. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/asynchronous/state_machine.py +149 -0
  52. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/auto_encrypter.py +2 -46
  53. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binary.py +14 -17
  54. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/binding.py +107 -61
  55. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/compat.py +6 -4
  56. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/credentials.py +2 -121
  57. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/crypto.py +31 -20
  58. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/errors.py +2 -2
  59. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/explicit_encrypter.py +2 -233
  60. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/mongocrypt.py +168 -238
  61. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/options.py +265 -0
  62. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/state_machine.py +2 -141
  63. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/auto_encrypter.py +61 -0
  64. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/credentials.py +156 -0
  65. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/explicit_encrypter.py +156 -0
  66. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/synchronous/state_machine.py +149 -0
  67. data/ext/libmongocrypt/libmongocrypt/bindings/python/pymongocrypt/version.py +2 -2
  68. data/ext/libmongocrypt/libmongocrypt/bindings/python/pyproject.toml +118 -0
  69. data/ext/libmongocrypt/libmongocrypt/bindings/python/release.sh +97 -61
  70. data/ext/libmongocrypt/libmongocrypt/bindings/python/{test-requirements.txt → requirements-test.txt} +4 -1
  71. data/ext/libmongocrypt/libmongocrypt/bindings/python/requirements.txt +4 -0
  72. data/ext/libmongocrypt/libmongocrypt/bindings/python/sbom.json +76 -0
  73. data/ext/libmongocrypt/libmongocrypt/bindings/python/strip_header.py +6 -7
  74. data/ext/libmongocrypt/libmongocrypt/bindings/python/synchro.py +64 -0
  75. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/__init__.py +1 -0
  76. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/collection-info.json +1 -1
  77. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/command.json +1 -1
  78. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/compact/success/encrypted-payload.json +21 -21
  79. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-command-reply.json +1 -1
  80. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/encrypted-field-config-map.json +1 -1
  81. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/encrypted-payload.json +1 -1
  82. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-range-explicit-v2/int32/rangeopts.json +3 -0
  83. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-rangePreview-explicit/int32/rangeopts.json +11 -0
  84. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/fle2-find-rangePreview-explicit/int32/value-to-encrypt.json +20 -0
  85. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-azure.json +1 -1
  86. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document-gcp.json +1 -1
  87. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-document.json +1 -1
  88. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/key-filter.json +1 -1
  89. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/list-collections-filter.json +1 -1
  90. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-command.json +1 -1
  91. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/mongocryptd-reply.json +1 -1
  92. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/data/schema-map.json +1 -1
  93. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/keyDocument.json +24 -0
  94. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/performance/perf_test.py +165 -0
  95. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_binding.py +8 -12
  96. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_crypto.py +9 -11
  97. data/ext/libmongocrypt/libmongocrypt/bindings/python/test/test_mongocrypt.py +988 -340
  98. data/ext/libmongocrypt/libmongocrypt/bindings/python/update-sbom.sh +14 -0
  99. data/ext/libmongocrypt/libmongocrypt/cmake/FetchMongoC.cmake +19 -1
  100. data/ext/libmongocrypt/libmongocrypt/cmake/ImportBSON.cmake +23 -0
  101. data/ext/libmongocrypt/libmongocrypt/cmake/IntelDFP.cmake +19 -227
  102. data/ext/libmongocrypt/libmongocrypt/cmake/Patch.cmake +54 -0
  103. data/ext/libmongocrypt/libmongocrypt/doc/img/cli-icon.png +0 -0
  104. data/ext/libmongocrypt/libmongocrypt/doc/img/reference-targets.png +0 -0
  105. data/ext/libmongocrypt/libmongocrypt/doc/releasing.md +153 -0
  106. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version.py +61 -28
  107. data/ext/libmongocrypt/libmongocrypt/etc/calc_release_version_selftest.sh +73 -0
  108. data/ext/libmongocrypt/libmongocrypt/etc/cyclonedx.sbom.json +108 -0
  109. data/ext/libmongocrypt/libmongocrypt/etc/format.sh +1 -1
  110. data/ext/libmongocrypt/libmongocrypt/etc/libbson-remove-GCC-diagnostic-pragma.patch +27 -0
  111. data/ext/libmongocrypt/libmongocrypt/etc/mongo-inteldfp-alpine-arm-fix.patch +17 -0
  112. data/ext/libmongocrypt/libmongocrypt/etc/packager.py +120 -91
  113. data/ext/libmongocrypt/libmongocrypt/etc/purls.txt +14 -0
  114. data/ext/libmongocrypt/libmongocrypt/etc/repo_config.yaml +56 -0
  115. data/ext/libmongocrypt/libmongocrypt/etc/silk-create-asset-group.sh +70 -0
  116. data/ext/libmongocrypt/libmongocrypt/etc/ssdlc_compliance_report.md +37 -0
  117. data/ext/libmongocrypt/libmongocrypt/etc/third_party_vulnerabilities.md +42 -0
  118. data/ext/libmongocrypt/libmongocrypt/integrating.md +18 -1
  119. data/ext/libmongocrypt/libmongocrypt/kms-message/CMakeLists.txt +11 -3
  120. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_gcp_request.c +1 -1
  121. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer.c +17 -0
  122. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_reader_writer_private.h +6 -0
  123. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_request.c +211 -1
  124. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_response.c +163 -0
  125. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_kmip_tag_type_private.h +2 -1
  126. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_request.h +17 -0
  127. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_message/kms_kmip_response.h +6 -0
  128. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_port.c +3 -2
  129. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request.c +4 -2
  130. data/ext/libmongocrypt/libmongocrypt/kms-message/src/kms_request_str.c +2 -2
  131. data/ext/libmongocrypt/libmongocrypt/kms-message/test/test_kmip_reader_writer.c +23 -2
  132. data/ext/libmongocrypt/libmongocrypt/src/crypto/libcrypto.c +13 -10
  133. data/ext/libmongocrypt/libmongocrypt/src/mc-dec128.h +1 -1
  134. data/ext/libmongocrypt/libmongocrypt/src/mc-efc-private.h +16 -2
  135. data/ext/libmongocrypt/libmongocrypt/src/mc-efc.c +94 -6
  136. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder-private.h +15 -5
  137. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-encryption-placeholder.c +114 -53
  138. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private-v2.h +1 -1
  139. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-private.h +1 -1
  140. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload-v2.c +2 -2
  141. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-equality-payload.c +2 -2
  142. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private-v2.h +21 -6
  143. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-private.h +5 -5
  144. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload-v2.c +38 -2
  145. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-find-range-payload.c +1 -1
  146. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private-v2.h +20 -7
  147. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-private.h +8 -8
  148. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-insert-update-payload-v2.c +89 -1
  149. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev-v2.c +3 -3
  150. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-payload-iev.c +1 -23
  151. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds-private.h +4 -3
  152. data/ext/libmongocrypt/libmongocrypt/src/mc-fle2-rfds.c +15 -12
  153. data/ext/libmongocrypt/libmongocrypt/src/mc-optional-private.h +11 -0
  154. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation-private.h +16 -6
  155. data/ext/libmongocrypt/libmongocrypt/src/mc-range-edge-generation.c +64 -22
  156. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding-private.h +23 -4
  157. data/ext/libmongocrypt/libmongocrypt/src/mc-range-encoding.c +359 -65
  158. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-generator.template.h +26 -14
  159. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover-private.h +17 -6
  160. data/ext/libmongocrypt/libmongocrypt/src/mc-range-mincover.c +31 -13
  161. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts-private.h +16 -3
  162. data/ext/libmongocrypt/libmongocrypt/src/mc-rangeopts.c +259 -63
  163. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens-private.h +40 -24
  164. data/ext/libmongocrypt/libmongocrypt/src/mc-tokens.c +57 -13
  165. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.h +17 -0
  166. data/ext/libmongocrypt/libmongocrypt/src/mlib/int128.test.cpp +5 -0
  167. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-binary-private.h +0 -5
  168. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-buffer.c +5 -7
  169. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-key.c +1 -0
  170. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth-private.h +16 -18
  171. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-cache-oauth.c +105 -76
  172. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-crypto.c +9 -3
  173. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-datakey.c +170 -89
  174. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-decrypt.c +5 -5
  175. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-encrypt.c +505 -124
  176. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx-private.h +31 -6
  177. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-ctx.c +81 -13
  178. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-dll-private.h +7 -0
  179. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek-private.h +5 -1
  180. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kek.c +161 -103
  181. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker-private.h +2 -7
  182. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key-broker.c +191 -69
  183. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-key.c +1 -1
  184. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx-private.h +50 -15
  185. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-kms-ctx.c +365 -69
  186. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking-private.h +2 -1
  187. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-marking.c +200 -107
  188. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts-private.h +50 -5
  189. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-opts.c +591 -15
  190. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-private.h +6 -13
  191. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt-util.c +3 -2
  192. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.c +47 -234
  193. data/ext/libmongocrypt/libmongocrypt/src/mongocrypt.h +75 -24
  194. data/ext/libmongocrypt/libmongocrypt/src/os_posix/os_dll.c +18 -2
  195. data/ext/libmongocrypt/libmongocrypt/src/os_win/os_dll.c +4 -0
  196. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/bypassQueryAnalysis/payload.json +53 -0
  197. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd-to-mongocryptd.json +23 -0
  198. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/jsonSchema/cmd.json +20 -0
  199. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd-to-mongocryptd.json +50 -0
  200. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/cmd.json +20 -0
  201. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/collinfo.json +44 -0
  202. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-field-map.json +24 -0
  203. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/encrypted-payload-pattern.json +53 -0
  204. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/simple/mongocryptd-reply.json +62 -0
  205. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd-to-mongocryptd.json +30 -0
  206. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/cmd.json +17 -0
  207. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/mongocryptd-reply.json +39 -0
  208. data/ext/libmongocrypt/libmongocrypt/test/data/bulkWrite/unencrypted/payload.json +21 -0
  209. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/missing-key-id/collinfo.json +20 -0
  210. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/collinfo.json +9 -0
  211. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/no-fields/encrypted-payload.json +4 -0
  212. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/cmd.json +1 -0
  213. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/collinfo.json +63 -0
  214. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-field-config-map.json +61 -0
  215. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload-range-v2.json +37 -0
  216. data/ext/libmongocrypt/libmongocrypt/test/data/cleanup/success/encrypted-payload.json +29 -0
  217. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/cmd.json +1 -0
  218. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/collinfo.json +64 -0
  219. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload-range-v2.json +105 -0
  220. data/ext/libmongocrypt/libmongocrypt/test/data/compact/anchor-pad/encrypted-payload.json +30 -0
  221. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/cmd.json +1 -0
  222. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/collinfo.json +49 -0
  223. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-field-config-map.json +47 -0
  224. data/ext/libmongocrypt/libmongocrypt/test/data/compact/no-range/encrypted-payload.json +23 -0
  225. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/collinfo.json +15 -0
  226. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-field-config-map.json +10 -0
  227. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload-range-v2.json +104 -0
  228. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/encrypted-payload.json +6 -0
  229. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/collinfo.json +4 -4
  230. data/ext/libmongocrypt/libmongocrypt/test/data/fle2-explain/with-csfle/encrypted-payload.json +3 -3
  231. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/decrypt-response.txt +16 -0
  232. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/encrypt-response.txt +16 -0
  233. data/ext/libmongocrypt/libmongocrypt/test/data/kms-azure/oauth-response.txt +19 -0
  234. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/cmd.json +9 -0
  235. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-field-map.json +19 -0
  236. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/encrypted-payload.json +62 -0
  237. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/find/mongocryptd-reply.json +69 -0
  238. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/cmd.json +11 -0
  239. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-field-map.json +19 -0
  240. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/encrypted-payload.json +40 -0
  241. data/ext/libmongocrypt/libmongocrypt/test/data/no-trimFactor/insert/mongocryptd-reply.json +47 -0
  242. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_decimal128.cstruct +1 -1
  243. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_double.cstruct +8637 -7958
  244. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int32.cstruct +5522 -1382
  245. data/ext/libmongocrypt/libmongocrypt/test/data/range-edge-generation/edges_int64.cstruct +5042 -1262
  246. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128.cstruct +1 -1
  247. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_decimal128_precision.cstruct +1 -1
  248. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double.cstruct +1 -1
  249. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_double_precision.cstruct +2 -2
  250. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int32.cstruct +1 -1
  251. data/ext/libmongocrypt/libmongocrypt/test/data/range-min-cover/mincover_int64.cstruct +1 -1
  252. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/cmd.json +8 -0
  253. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-field-map.json +19 -0
  254. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/encrypted-payload.json +53 -0
  255. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-find-int32/mongocryptd-reply.json +58 -0
  256. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/cmd.json +11 -0
  257. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-field-map.json +19 -0
  258. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/encrypted-payload.json +40 -0
  259. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/auto-insert-int32/mongocryptd-reply.json +45 -0
  260. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/expected.json +26 -0
  261. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32/to-encrypt.json +20 -0
  262. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/expected.json +26 -0
  263. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-find-int32-defaults/to-encrypt.json +20 -0
  264. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-double/expected.json +8 -0
  265. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32/expected.json +8 -0
  266. data/ext/libmongocrypt/libmongocrypt/test/data/range-sends-cryptoParams/explicit-insert-int32-defaults/expected.json +8 -0
  267. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/README.md +7 -4
  268. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/mc.json +9 -5
  269. data/ext/libmongocrypt/libmongocrypt/test/data/tokens/server.json +9 -5
  270. data/ext/libmongocrypt/libmongocrypt/test/example-state-machine.c +1 -0
  271. data/ext/libmongocrypt/libmongocrypt/test/test-gcp-auth.c +8 -8
  272. data/ext/libmongocrypt/libmongocrypt/test/test-mc-efc.c +6 -4
  273. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-find-range-payload-v2.c +43 -3
  274. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-payload-iup-v2.c +76 -0
  275. data/ext/libmongocrypt/libmongocrypt/test/test-mc-fle2-rfds.c +5 -5
  276. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-edge-generation.c +89 -14
  277. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-encoding.c +342 -76
  278. data/ext/libmongocrypt/libmongocrypt/test/test-mc-range-mincover.c +94 -12
  279. data/ext/libmongocrypt/libmongocrypt/test/test-mc-rangeopts.c +205 -7
  280. data/ext/libmongocrypt/libmongocrypt/test/test-mc-tokens.c +49 -23
  281. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.c +16 -19
  282. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-assert-match-bson.h +22 -1
  283. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cache-oauth.c +94 -11
  284. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-cleanup.c +374 -0
  285. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-compact.c +121 -42
  286. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-hooks.c +134 -4
  287. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.c +40 -0
  288. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-crypto-std-hooks.h +16 -0
  289. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-csfle-lib.c +11 -11
  290. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-decrypt.c +8 -5
  291. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-encrypt.c +922 -92
  292. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-rewrap-many-datakey.c +2 -2
  293. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-ctx-setopt.c +114 -12
  294. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-datakey.c +14 -9
  295. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-kms-ctx.c +424 -3
  296. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-log.c +1 -1
  297. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-marking.c +447 -28
  298. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-opts.c +42 -0
  299. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-traverse-util.c +30 -26
  300. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.c +7 -0
  301. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt-util.h +3 -0
  302. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.c +66 -14
  303. data/ext/libmongocrypt/libmongocrypt/test/test-mongocrypt.h +11 -0
  304. data/ext/libmongocrypt/libmongocrypt/test/test-named-kms-providers.c +2381 -0
  305. data/ext/libmongocrypt/libmongocrypt/test/util/HELP.autogen +3 -1
  306. data/ext/libmongocrypt/libmongocrypt/test/util/README.md +1 -0
  307. data/ext/libmongocrypt/libmongocrypt/test/util/csfle.c +4 -0
  308. data/ext/libmongocrypt/libmongocrypt/test/util/make_includes.py +1 -1
  309. data/ext/libmongocrypt/libmongocrypt/test/util/util.c +38 -3
  310. data/lib/libmongocrypt_helper/version.rb +2 -2
  311. metadata +112 -106
  312. checksums.yaml.gz.sig +0 -0
  313. data/ext/libmongocrypt/libmongocrypt/VERSION_CURRENT +0 -1
  314. data/ext/libmongocrypt/libmongocrypt/bindings/cs/cs.sln +0 -79
  315. data/ext/libmongocrypt/libmongocrypt/bindings/node/CHANGELOG.md +0 -105
  316. data/ext/libmongocrypt/libmongocrypt/bindings/node/LICENSE +0 -201
  317. data/ext/libmongocrypt/libmongocrypt/bindings/node/binding.gyp +0 -79
  318. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/README.hbs +0 -44
  319. data/ext/libmongocrypt/libmongocrypt/bindings/node/etc/build-static.sh +0 -36
  320. data/ext/libmongocrypt/libmongocrypt/bindings/node/index.d.ts +0 -641
  321. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/autoEncrypter.js +0 -420
  322. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/buffer_pool.js +0 -123
  323. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/clientEncryption.js +0 -821
  324. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/common.js +0 -98
  325. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/cryptoCallbacks.js +0 -87
  326. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/errors.js +0 -75
  327. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/index.js +0 -73
  328. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/mongocryptdManager.js +0 -66
  329. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/aws.js +0 -26
  330. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/azure.js +0 -178
  331. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/gcp.js +0 -24
  332. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/index.js +0 -54
  333. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/providers/utils.js +0 -39
  334. data/ext/libmongocrypt/libmongocrypt/bindings/node/lib/stateMachine.js +0 -492
  335. data/ext/libmongocrypt/libmongocrypt/bindings/node/package-lock.json +0 -15302
  336. data/ext/libmongocrypt/libmongocrypt/bindings/node/package.json +0 -100
  337. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.cc +0 -956
  338. data/ext/libmongocrypt/libmongocrypt/bindings/node/src/mongocrypt.h +0 -114
  339. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/autoEncrypter.test.js +0 -950
  340. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/buffer_pool.test.js +0 -91
  341. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/clientEncryption.test.js +0 -1093
  342. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/common.test.js +0 -94
  343. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/cryptoCallbacks.test.js +0 -240
  344. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/README.md +0 -5
  345. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/cmd.json +0 -6
  346. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/collection-info.json +0 -37
  347. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document-nested.json +0 -8
  348. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encrypted-document.json +0 -11
  349. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/encryptedFields.json +0 -30
  350. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key-document.json +0 -32
  351. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/key1-document.json +0 -30
  352. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/data/mongocryptd-reply.json +0 -18
  353. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/index.test.js +0 -45
  354. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/mongocryptdManager.test.js +0 -48
  355. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/providers/credentialsProvider.test.js +0 -551
  356. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/release.test.js +0 -66
  357. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/requirements.helper.js +0 -51
  358. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/stateMachine.test.js +0 -331
  359. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/chai-addons.js +0 -8
  360. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/tools/mongodb_reporter.js +0 -325
  361. data/ext/libmongocrypt/libmongocrypt/bindings/node/test/types/index.test-d.ts +0 -63
  362. data/ext/libmongocrypt/libmongocrypt/bindings/python/setup.py +0 -89
  363. data/ext/libmongocrypt/libmongocrypt/debian/build_snapshot.sh +0 -79
  364. data/ext/libmongocrypt/libmongocrypt/debian/changelog +0 -105
  365. data/ext/libmongocrypt/libmongocrypt/debian/compat +0 -1
  366. data/ext/libmongocrypt/libmongocrypt/debian/control +0 -41
  367. data/ext/libmongocrypt/libmongocrypt/debian/copyright +0 -129
  368. data/ext/libmongocrypt/libmongocrypt/debian/gbp.conf +0 -23
  369. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.dirs +0 -2
  370. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt-dev.install +0 -5
  371. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.dirs +0 -1
  372. data/ext/libmongocrypt/libmongocrypt/debian/libmongocrypt0.install +0 -1
  373. data/ext/libmongocrypt/libmongocrypt/debian/rules +0 -46
  374. data/ext/libmongocrypt/libmongocrypt/debian/source/format +0 -1
  375. data/ext/libmongocrypt/libmongocrypt/debian/source/lintian-overrides +0 -3
  376. data/ext/libmongocrypt/libmongocrypt/debian/source/options +0 -1
  377. data/ext/libmongocrypt/libmongocrypt/debian/watch +0 -3
  378. data/ext/libmongocrypt/libmongocrypt/test/data/compact/success/mongocryptd-reply.json +0 -72
  379. data.tar.gz.sig +0 -1
  380. metadata.gz.sig +0 -0
  381. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-decrypt-reply.txt → test/data/kms-aws/decrypt-response.txt} +0 -0
  382. /data/ext/libmongocrypt/libmongocrypt/{bindings/node/test/data/kms-encrypt-reply.txt → test/data/kms-aws/encrypt-response.txt} +0 -0
  383. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/decrypt-response.txt +0 -0
  384. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/encrypt-response.txt +0 -0
  385. /data/ext/libmongocrypt/libmongocrypt/test/data/{gcp-auth → kms-gcp}/oauth-response.txt +0 -0
@@ -1,902 +1,6 @@
1
- MongoDB Client Encryption
2
- =========================
1
+ ### The Node.js Bindings Have Moved!
3
2
 
4
- The Node.js wrapper for [`libmongocrypt`](../../README.md)
5
-
6
- ### Installation
7
-
8
- You can install `mongodb-client-encryption` with the following:
9
-
10
- ```bash
11
- npm install mongodb-client-encryption
12
- ```
13
-
14
- ### Development
15
- #### Setup
16
-
17
- Run the following command to build libmongocrypt and setup the node bindings for development:
18
-
19
- ```shell
20
- bash ./etc/build-static.sh
21
- ```
22
-
23
-
24
- #### Testing
25
-
26
- Some tests require a standalone server to be running with authentication enabled. Set up a single
27
- server running with the following conditions:
28
-
29
- | param | value |
30
- |-----------|-----------|
31
- | host | localhost |
32
- | port | 27017 |
33
-
34
- This is the standard setup for a standalone server with no authentication.
35
-
36
- Run the test suite using:
37
-
38
- ```bash
39
- npm test
40
- ```
41
-
42
- # Documentation
43
-
44
- ## Classes
45
-
46
- <dl>
47
- <dt><a href="#AutoEncrypter">AutoEncrypter</a></dt>
48
- <dd><p>An internal class to be used by the driver for auto encryption
49
- <strong>NOTE</strong>: Not meant to be instantiated directly, this is for internal use only.</p>
50
- </dd>
51
- <dt><a href="#ClientEncryption">ClientEncryption</a></dt>
52
- <dd><p>The public interface for explicit in-use encryption</p>
53
- </dd>
54
- <dt><a href="#MongoCryptError">MongoCryptError</a></dt>
55
- <dd><p>An error indicating that something went wrong specifically with MongoDB Client Encryption</p>
56
- </dd>
57
- <dt><a href="#MongoCryptCreateDataKeyError">MongoCryptCreateDataKeyError</a></dt>
58
- <dd><p>An error indicating that <code>ClientEncryption.createEncryptedCollection()</code> failed to create data keys</p>
59
- </dd>
60
- <dt><a href="#MongoCryptCreateEncryptedCollectionError">MongoCryptCreateEncryptedCollectionError</a></dt>
61
- <dd><p>An error indicating that <code>ClientEncryption.createEncryptedCollection()</code> failed to create a collection</p>
62
- </dd>
63
- <dt><a href="#MongoCryptAzureKMSRequestError">MongoCryptAzureKMSRequestError</a></dt>
64
- <dd><p>An error indicating that mongodb-client-encryption failed to auto-refresh Azure KMS credentials.</p>
65
- </dd>
66
- </dl>
67
-
68
- ## Typedefs
69
-
70
- <dl>
71
- <dt><a href="#BSONValue">BSONValue</a> : <code>*</code></dt>
72
- <dd><p>any serializable BSON value</p>
73
- </dd>
74
- <dt><a href="#Long">Long</a> : <code>BSON.Long</code></dt>
75
- <dd><p>A 64 bit integer, represented by the js-bson Long type.</p>
76
- </dd>
77
- <dt><a href="#KMSProviders">KMSProviders</a> : <code>object</code></dt>
78
- <dd><p>Configuration options that are used by specific KMS providers during key generation, encryption, and decryption.</p>
79
- </dd>
80
- <dt><a href="#DataKey">DataKey</a> : <code>object</code></dt>
81
- <dd><p>A data key as stored in the database.</p>
82
- </dd>
83
- <dt><a href="#KmsProvider">KmsProvider</a> : <code>string</code></dt>
84
- <dd><p>A string containing the name of a kms provider. Valid options are &#39;aws&#39;, &#39;azure&#39;, &#39;gcp&#39;, &#39;kmip&#39;, or &#39;local&#39;</p>
85
- </dd>
86
- <dt><a href="#ClientSession">ClientSession</a> : <code>object</code></dt>
87
- <dd><p>The ClientSession class from the MongoDB Node driver (see <a href="https://mongodb.github.io/node-mongodb-native/4.8/classes/ClientSession.html">https://mongodb.github.io/node-mongodb-native/4.8/classes/ClientSession.html</a>)</p>
88
- </dd>
89
- <dt><a href="#DeleteResult">DeleteResult</a> : <code>object</code></dt>
90
- <dd><p>The result of a delete operation from the MongoDB Node driver (see <a href="https://mongodb.github.io/node-mongodb-native/4.8/interfaces/DeleteResult.html">https://mongodb.github.io/node-mongodb-native/4.8/interfaces/DeleteResult.html</a>)</p>
91
- </dd>
92
- <dt><a href="#BulkWriteResult">BulkWriteResult</a> : <code>object</code></dt>
93
- <dd><p>The BulkWriteResult class from the MongoDB Node driver (<a href="https://mongodb.github.io/node-mongodb-native/4.8/classes/BulkWriteResult.html">https://mongodb.github.io/node-mongodb-native/4.8/classes/BulkWriteResult.html</a>)</p>
94
- </dd>
95
- <dt><a href="#FindCursor">FindCursor</a> : <code>object</code></dt>
96
- <dd><p>The FindCursor class from the MongoDB Node driver (see <a href="https://mongodb.github.io/node-mongodb-native/4.8/classes/FindCursor.html">https://mongodb.github.io/node-mongodb-native/4.8/classes/FindCursor.html</a>)</p>
97
- </dd>
98
- <dt><a href="#ClientEncryptionDataKeyId">ClientEncryptionDataKeyId</a> : <code>Binary</code></dt>
99
- <dd><p>The id of an existing dataKey. Is a bson Binary value.
100
- Can be used for <a href="ClientEncryption.encrypt">ClientEncryption.encrypt</a>, and can be used to directly
101
- query for the data key itself against the key vault namespace.</p>
102
- </dd>
103
- <dt><a href="#ClientEncryptionCreateDataKeyCallback">ClientEncryptionCreateDataKeyCallback</a> : <code>function</code></dt>
104
- <dd></dd>
105
- <dt><a href="#AWSEncryptionKeyOptions">AWSEncryptionKeyOptions</a> : <code>object</code></dt>
106
- <dd><p>Configuration options for making an AWS encryption key</p>
107
- </dd>
108
- <dt><a href="#GCPEncryptionKeyOptions">GCPEncryptionKeyOptions</a> : <code>object</code></dt>
109
- <dd><p>Configuration options for making a GCP encryption key</p>
110
- </dd>
111
- <dt><a href="#AzureEncryptionKeyOptions">AzureEncryptionKeyOptions</a> : <code>object</code></dt>
112
- <dd><p>Configuration options for making an Azure encryption key</p>
113
- </dd>
114
- <dt><a href="#RewrapManyDataKeyResult">RewrapManyDataKeyResult</a> : <code>object</code></dt>
115
- <dd></dd>
116
- <dt><a href="#ClientEncryptionEncryptCallback">ClientEncryptionEncryptCallback</a> : <code>function</code></dt>
117
- <dd></dd>
118
- <dt><a href="#RangeOptions">RangeOptions</a> : <code>object</code></dt>
119
- <dd><p>min, max, sparsity, and range must match the values set in the encryptedFields of the destination collection.
120
- For double and decimal128, min/max/precision must all be set, or all be unset.</p>
121
- </dd>
122
- <dt><a href="#EncryptOptions">EncryptOptions</a> : <code>object</code></dt>
123
- <dd><p>Options to provide when encrypting data.</p>
124
- </dd>
125
- </dl>
126
-
127
- <a name="AutoEncrypter"></a>
128
-
129
- ## AutoEncrypter
130
- An internal class to be used by the driver for auto encryption
131
- **NOTE**: Not meant to be instantiated directly, this is for internal use only.
132
-
133
-
134
- * [AutoEncrypter](#AutoEncrypter)
135
-
136
- * [new AutoEncrypter(client, [options])](#new_AutoEncrypter_new)
137
-
138
- * _instance_
139
- * [.cryptSharedLibVersionInfo](#AutoEncrypter+cryptSharedLibVersionInfo)
140
-
141
- * [.askForKMSCredentials()](#AutoEncrypter+askForKMSCredentials)
142
-
143
- * _inner_
144
- * [~logLevel](#AutoEncrypter..logLevel)
145
-
146
- * [~AutoEncryptionOptions](#AutoEncrypter..AutoEncryptionOptions)
147
-
148
- * [~AutoEncryptionExtraOptions](#AutoEncrypter..AutoEncryptionExtraOptions)
149
-
150
- * [~logger](#AutoEncrypter..logger)
151
-
152
-
153
- <a name="new_AutoEncrypter_new"></a>
154
-
155
- ### new AutoEncrypter(client, [options])
156
-
157
- | Param | Type | Description |
158
- | --- | --- | --- |
159
- | client | <code>MongoClient</code> | The client autoEncryption is enabled on |
160
- | [options] | [<code>AutoEncryptionOptions</code>](#AutoEncrypter..AutoEncryptionOptions) | Optional settings |
161
-
162
- Create an AutoEncrypter
163
-
164
- **Note**: Do not instantiate this class directly. Rather, supply the relevant options to a MongoClient
165
-
166
- **Note**: Supplying `options.schemaMap` provides more security than relying on JSON Schemas obtained from the server.
167
- It protects against a malicious server advertising a false JSON Schema, which could trick the client into sending unencrypted data that should be encrypted.
168
- Schemas supplied in the schemaMap only apply to configuring automatic encryption for Client-Side Field Level Encryption.
169
- Other validation rules in the JSON schema will not be enforced by the driver and will result in an error.
170
-
171
- **Example**
172
- ```js
173
- // Enabling autoEncryption via a MongoClient
174
- const { MongoClient } = require('mongodb');
175
- const client = new MongoClient(URL, {
176
- autoEncryption: {
177
- kmsProviders: {
178
- aws: {
179
- accessKeyId: AWS_ACCESS_KEY,
180
- secretAccessKey: AWS_SECRET_KEY
181
- }
182
- }
183
- }
184
- });
185
-
186
- await client.connect();
187
- // From here on, the client will be encrypting / decrypting automatically
188
- ```
189
- <a name="AutoEncrypter+cryptSharedLibVersionInfo"></a>
190
-
191
- ### *autoEncrypter*.cryptSharedLibVersionInfo
192
- Return the current libmongocrypt's CSFLE shared library version
193
- as `{ version: bigint, versionStr: string }`, or `null` if no CSFLE
194
- shared library was loaded.
195
-
196
- <a name="AutoEncrypter+askForKMSCredentials"></a>
197
-
198
- ### *autoEncrypter*.askForKMSCredentials()
199
- Ask the user for KMS credentials.
200
-
201
- This returns anything that looks like the kmsProviders original input
202
- option. It can be empty, and any provider specified here will override
203
- the original ones.
204
-
205
- <a name="AutoEncrypter..logLevel"></a>
206
-
207
- ### *AutoEncrypter*~logLevel
208
- The level of severity of the log message
209
-
210
- | Value | Level |
211
- |-------|-------|
212
- | 0 | Fatal Error |
213
- | 1 | Error |
214
- | 2 | Warning |
215
- | 3 | Info |
216
- | 4 | Trace |
217
-
218
- <a name="AutoEncrypter..AutoEncryptionOptions"></a>
219
-
220
- ### *AutoEncrypter*~AutoEncryptionOptions
221
- **Properties**
222
-
223
- | Name | Type | Description |
224
- | --- | --- | --- |
225
- | [keyVaultClient] | <code>MongoClient</code> | A `MongoClient` used to fetch keys from a key vault |
226
- | [keyVaultNamespace] | <code>string</code> | The namespace where keys are stored in the key vault |
227
- | [kmsProviders] | [<code>KMSProviders</code>](#KMSProviders) | Configuration options that are used by specific KMS providers during key generation, encryption, and decryption. |
228
- | [schemaMap] | <code>object</code> | A map of namespaces to a local JSON schema for encryption |
229
- | [bypassAutoEncryption] | <code>boolean</code> | Allows the user to bypass auto encryption, maintaining implicit decryption |
230
- | [options.logger] | [<code>logger</code>](#AutoEncrypter..logger) | An optional hook to catch logging messages from the underlying encryption engine |
231
- | [extraOptions] | [<code>AutoEncryptionExtraOptions</code>](#AutoEncrypter..AutoEncryptionExtraOptions) | Extra options related to the mongocryptd process |
232
-
233
- Configuration options for a automatic client encryption.
234
-
235
- <a name="AutoEncrypter..AutoEncryptionExtraOptions"></a>
236
-
237
- ### *AutoEncrypter*~AutoEncryptionExtraOptions
238
- **Properties**
239
-
240
- | Name | Type | Default | Description |
241
- | --- | --- | --- | --- |
242
- | [mongocryptdURI] | <code>string</code> | | A local process the driver communicates with to determine how to encrypt values in a command. Defaults to "mongodb://%2Fvar%2Fmongocryptd.sock" if domain sockets are available or "mongodb://localhost:27020" otherwise |
243
- | [mongocryptdBypassSpawn] | <code>boolean</code> | <code>false</code> | If true, autoEncryption will not attempt to spawn a mongocryptd before connecting |
244
- | [mongocryptdSpawnPath] | <code>string</code> | | The path to the mongocryptd executable on the system |
245
- | [mongocryptdSpawnArgs] | <code>Array.&lt;string&gt;</code> | | Command line arguments to use when auto-spawning a mongocryptd |
246
-
247
- Extra options related to the mongocryptd process
248
-
249
- <a name="AutoEncrypter..logger"></a>
250
-
251
- ### *AutoEncrypter*~logger
252
-
253
- | Param | Type | Description |
254
- | --- | --- | --- |
255
- | level | [<code>logLevel</code>](#AutoEncrypter..logLevel) | The level of logging. |
256
- | message | <code>string</code> | The message to log |
257
-
258
- A callback that is invoked with logging information from
259
- the underlying C++ Bindings.
260
-
261
- <a name="ClientEncryption"></a>
262
-
263
- ## ClientEncryption
264
- The public interface for explicit in-use encryption
265
-
266
-
267
- * [ClientEncryption](#ClientEncryption)
268
-
269
- * [new ClientEncryption(client, options)](#new_ClientEncryption_new)
270
-
271
- * _instance_
272
- * [.createDataKey(provider, [options], [callback])](#ClientEncryption+createDataKey)
273
-
274
- * [.rewrapManyDataKey(filter, [options])](#ClientEncryption+rewrapManyDataKey)
275
-
276
- * [.deleteKey(_id)](#ClientEncryption+deleteKey)
277
-
278
- * [.getKeys()](#ClientEncryption+getKeys)
279
-
280
- * [.getKey(_id)](#ClientEncryption+getKey)
281
-
282
- * [.getKeyByAltName(keyAltName)](#ClientEncryption+getKeyByAltName)
283
-
284
- * [.addKeyAltName(_id, keyAltName)](#ClientEncryption+addKeyAltName)
285
-
286
- * [.removeKeyAltName(_id, keyAltName)](#ClientEncryption+removeKeyAltName)
287
-
288
- * [.createEncryptedCollection(db, name, options)](#ClientEncryption+createEncryptedCollection)
289
-
290
- * [.encrypt(value, options, [callback])](#ClientEncryption+encrypt)
291
-
292
- * [.encryptExpression(expression, options)](#ClientEncryption+encryptExpression)
293
-
294
- * [.decrypt(value, callback)](#ClientEncryption+decrypt)
295
-
296
- * [.askForKMSCredentials()](#ClientEncryption+askForKMSCredentials)
297
-
298
- * _inner_
299
- * [~decryptCallback](#ClientEncryption..decryptCallback)
300
-
301
-
302
- <a name="new_ClientEncryption_new"></a>
303
-
304
- ### new ClientEncryption(client, options)
305
-
306
- | Param | Type | Description |
307
- | --- | --- | --- |
308
- | client | <code>MongoClient</code> | The client used for encryption |
309
- | options | <code>object</code> | Additional settings |
310
- | options.keyVaultNamespace | <code>string</code> | The namespace of the key vault, used to store encryption keys |
311
- | options.tlsOptions | <code>object</code> | An object that maps KMS provider names to TLS options. |
312
- | [options.keyVaultClient] | <code>MongoClient</code> | A `MongoClient` used to fetch keys from a key vault. Defaults to `client` |
313
- | [options.kmsProviders] | [<code>KMSProviders</code>](#KMSProviders) | options for specific KMS providers to use |
314
-
315
- Create a new encryption instance
316
-
317
- **Example**
318
- ```js
319
- new ClientEncryption(mongoClient, {
320
- keyVaultNamespace: 'client.encryption',
321
- kmsProviders: {
322
- local: {
323
- key: masterKey // The master key used for encryption/decryption. A 96-byte long Buffer
324
- }
325
- }
326
- });
327
- ```
328
- **Example**
329
- ```js
330
- new ClientEncryption(mongoClient, {
331
- keyVaultNamespace: 'client.encryption',
332
- kmsProviders: {
333
- aws: {
334
- accessKeyId: AWS_ACCESS_KEY,
335
- secretAccessKey: AWS_SECRET_KEY
336
- }
337
- }
338
- });
339
- ```
340
- <a name="ClientEncryption+createDataKey"></a>
341
-
342
- ### *clientEncryption*.createDataKey(provider, [options], [callback])
343
-
344
- | Param | Type | Description |
345
- | --- | --- | --- |
346
- | provider | <code>string</code> | The KMS provider used for this data key. Must be `'aws'`, `'azure'`, `'gcp'`, or `'local'` |
347
- | [options] | <code>object</code> | Options for creating the data key |
348
- | [options.masterKey] | [<code>AWSEncryptionKeyOptions</code>](#AWSEncryptionKeyOptions) \| [<code>AzureEncryptionKeyOptions</code>](#AzureEncryptionKeyOptions) \| [<code>GCPEncryptionKeyOptions</code>](#GCPEncryptionKeyOptions) | Idenfities a new KMS-specific key used to encrypt the new data key |
349
- | [options.keyAltNames] | <code>Array.&lt;string&gt;</code> | An optional list of string alternate names used to reference a key. If a key is created with alternate names, then encryption may refer to the key by the unique alternate name instead of by _id. |
350
- | [callback] | [<code>ClientEncryptionCreateDataKeyCallback</code>](#ClientEncryptionCreateDataKeyCallback) | Optional callback to invoke when key is created |
351
-
352
- Creates a data key used for explicit encryption and inserts it into the key vault namespace
353
-
354
- **Returns**: <code>Promise</code> \| <code>void</code> - If no callback is provided, returns a Promise that either resolves with [the id of the created data key](ClientEncryption~dataKeyId), or rejects with an error. If a callback is provided, returns nothing.
355
- **Example**
356
- ```js
357
- // Using callbacks to create a local key
358
- clientEncryption.createDataKey('local', (err, dataKey) => {
359
- if (err) {
360
- // This means creating the key failed.
361
- } else {
362
- // key creation succeeded
363
- }
364
- });
365
- ```
366
- **Example**
367
- ```js
368
- // Using async/await to create a local key
369
- const dataKeyId = await clientEncryption.createDataKey('local');
370
- ```
371
- **Example**
372
- ```js
373
- // Using async/await to create an aws key
374
- const dataKeyId = await clientEncryption.createDataKey('aws', {
375
- masterKey: {
376
- region: 'us-east-1',
377
- key: 'xxxxxxxxxxxxxx' // CMK ARN here
378
- }
379
- });
380
- ```
381
- **Example**
382
- ```js
383
- // Using async/await to create an aws key with a keyAltName
384
- const dataKeyId = await clientEncryption.createDataKey('aws', {
385
- masterKey: {
386
- region: 'us-east-1',
387
- key: 'xxxxxxxxxxxxxx' // CMK ARN here
388
- },
389
- keyAltNames: [ 'mySpecialKey' ]
390
- });
391
- ```
392
- <a name="ClientEncryption+rewrapManyDataKey"></a>
393
-
394
- ### *clientEncryption*.rewrapManyDataKey(filter, [options])
395
-
396
- | Param | Type | Description |
397
- | --- | --- | --- |
398
- | filter | <code>object</code> | A valid MongoDB filter. Any documents matching this filter will be re-wrapped. |
399
- | [options] | <code>object</code> | |
400
- | options.provider | [<code>KmsProvider</code>](#KmsProvider) | The KMS provider to use when re-wrapping the data keys. |
401
- | [options.masterKey] | [<code>AWSEncryptionKeyOptions</code>](#AWSEncryptionKeyOptions) \| [<code>AzureEncryptionKeyOptions</code>](#AzureEncryptionKeyOptions) \| [<code>GCPEncryptionKeyOptions</code>](#GCPEncryptionKeyOptions) | |
402
-
403
- Searches the keyvault for any data keys matching the provided filter. If there are matches, rewrapManyDataKey then attempts to re-wrap the data keys using the provided options.
404
-
405
- If no matches are found, then no bulk write is performed.
406
-
407
- **Example**
408
- ```js
409
- // rewrapping all data data keys (using a filter that matches all documents)
410
- const filter = {};
411
-
412
- const result = await clientEncryption.rewrapManyDataKey(filter);
413
- if (result.bulkWriteResult != null) {
414
- // keys were re-wrapped, results will be available in the bulkWrite object.
415
- }
416
- ```
417
- **Example**
418
- ```js
419
- // attempting to rewrap all data keys with no matches
420
- const filter = { _id: new Binary() } // assume _id matches no documents in the database
421
- const result = await clientEncryption.rewrapManyDataKey(filter);
422
-
423
- if (result.bulkWriteResult == null) {
424
- // no keys matched, `bulkWriteResult` does not exist on the result object
425
- }
426
- ```
427
- <a name="ClientEncryption+deleteKey"></a>
428
-
429
- ### *clientEncryption*.deleteKey(_id)
430
-
431
- | Param | Type | Description |
432
- | --- | --- | --- |
433
- | _id | [<code>ClientEncryptionDataKeyId</code>](#ClientEncryptionDataKeyId) | the id of the document to delete. |
434
-
435
- Deletes the key with the provided id from the keyvault, if it exists.
436
-
437
- **Returns**: [<code>Promise.&lt;DeleteResult&gt;</code>](#DeleteResult) - Returns a promise that either resolves to a [DeleteResult](#DeleteResult) or rejects with an error.
438
- **Example**
439
- ```js
440
- // delete a key by _id
441
- const id = new Binary(); // id is a bson binary subtype 4 object
442
- const { deletedCount } = await clientEncryption.deleteKey(id);
443
-
444
- if (deletedCount != null && deletedCount > 0) {
445
- // successful deletion
446
- }
447
- ```
448
- <a name="ClientEncryption+getKeys"></a>
449
-
450
- ### *clientEncryption*.getKeys()
451
- Finds all the keys currently stored in the keyvault.
452
-
453
- This method will not throw.
454
-
455
- **Returns**: [<code>FindCursor</code>](#FindCursor) - a FindCursor over all keys in the keyvault.
456
- **Example**
457
- ```js
458
- // fetching all keys
459
- const keys = await clientEncryption.getKeys().toArray();
460
- ```
461
- <a name="ClientEncryption+getKey"></a>
462
-
463
- ### *clientEncryption*.getKey(_id)
464
-
465
- | Param | Type | Description |
466
- | --- | --- | --- |
467
- | _id | [<code>ClientEncryptionDataKeyId</code>](#ClientEncryptionDataKeyId) | the id of the document to delete. |
468
-
469
- Finds a key in the keyvault with the specified _id.
470
-
471
- **Returns**: [<code>Promise.&lt;DataKey&gt;</code>](#DataKey) - Returns a promise that either resolves to a [DataKey](#DataKey) if a document matches the key or null if no documents
472
- match the id. The promise rejects with an error if an error is thrown.
473
- **Example**
474
- ```js
475
- // getting a key by id
476
- const id = new Binary(); // id is a bson binary subtype 4 object
477
- const key = await clientEncryption.getKey(id);
478
- if (!key) {
479
- // key is null if there was no matching key
480
- }
481
- ```
482
- <a name="ClientEncryption+getKeyByAltName"></a>
483
-
484
- ### *clientEncryption*.getKeyByAltName(keyAltName)
485
-
486
- | Param | Type | Description |
487
- | --- | --- | --- |
488
- | keyAltName | <code>string</code> | a keyAltName to search for a key |
489
-
490
- Finds a key in the keyvault which has the specified keyAltName.
491
-
492
- **Returns**: <code>Promise.&lt;(DataKey\|null)&gt;</code> - Returns a promise that either resolves to a [DataKey](#DataKey) if a document matches the key or null if no documents
493
- match the keyAltName. The promise rejects with an error if an error is thrown.
494
- **Example**
495
- ```js
496
- // get a key by alt name
497
- const keyAltName = 'keyAltName';
498
- const key = await clientEncryption.getKeyByAltName(keyAltName);
499
- if (!key) {
500
- // key is null if there is no matching key
501
- }
502
- ```
503
- <a name="ClientEncryption+addKeyAltName"></a>
504
-
505
- ### *clientEncryption*.addKeyAltName(_id, keyAltName)
506
-
507
- | Param | Type | Description |
508
- | --- | --- | --- |
509
- | _id | [<code>ClientEncryptionDataKeyId</code>](#ClientEncryptionDataKeyId) | The id of the document to update. |
510
- | keyAltName | <code>string</code> | a keyAltName to search for a key |
511
-
512
- Adds a keyAltName to a key identified by the provided _id.
513
-
514
- This method resolves to/returns the *old* key value (prior to adding the new altKeyName).
515
-
516
- **Returns**: [<code>Promise.&lt;DataKey&gt;</code>](#DataKey) - Returns a promise that either resolves to a [DataKey](#DataKey) if a document matches the key or null if no documents
517
- match the id. The promise rejects with an error if an error is thrown.
518
- **Example**
519
- ```js
520
- // adding an keyAltName to a data key
521
- const id = new Binary(); // id is a bson binary subtype 4 object
522
- const keyAltName = 'keyAltName';
523
- const oldKey = await clientEncryption.addKeyAltName(id, keyAltName);
524
- if (!oldKey) {
525
- // null is returned if there is no matching document with an id matching the supplied id
526
- }
527
- ```
528
- <a name="ClientEncryption+removeKeyAltName"></a>
529
-
530
- ### *clientEncryption*.removeKeyAltName(_id, keyAltName)
531
-
532
- | Param | Type | Description |
533
- | --- | --- | --- |
534
- | _id | [<code>ClientEncryptionDataKeyId</code>](#ClientEncryptionDataKeyId) | The id of the document to update. |
535
- | keyAltName | <code>string</code> | a keyAltName to search for a key |
536
-
537
- Adds a keyAltName to a key identified by the provided _id.
538
-
539
- This method resolves to/returns the *old* key value (prior to removing the new altKeyName).
540
-
541
- If the removed keyAltName is the last keyAltName for that key, the `altKeyNames` property is unset from the document.
542
-
543
- **Returns**: <code>Promise.&lt;(DataKey\|null)&gt;</code> - Returns a promise that either resolves to a [DataKey](#DataKey) if a document matches the key or null if no documents
544
- match the id. The promise rejects with an error if an error is thrown.
545
- **Example**
546
- ```js
547
- // removing a key alt name from a data key
548
- const id = new Binary(); // id is a bson binary subtype 4 object
549
- const keyAltName = 'keyAltName';
550
- const oldKey = await clientEncryption.removeKeyAltName(id, keyAltName);
551
-
552
- if (!oldKey) {
553
- // null is returned if there is no matching document with an id matching the supplied id
554
- }
555
- ```
556
- <a name="ClientEncryption+createEncryptedCollection"></a>
557
-
558
- ### *clientEncryption*.createEncryptedCollection(db, name, options)
559
- **Throws**:
560
-
561
- - [<code>MongoCryptCreateDataKeyError</code>](#MongoCryptCreateDataKeyError) - If part way through the process a createDataKey invocation fails, an error will be rejected that has the partial `encryptedFields` that were created.
562
- - [<code>MongoCryptCreateEncryptedCollectionError</code>](#MongoCryptCreateEncryptedCollectionError) - If creating the collection fails, an error will be rejected that has the entire `encryptedFields` that were created.
563
-
564
- **Experimental**: Public Technical Preview
565
-
566
- A convenience method for creating an encrypted collection.
567
- This method will create data keys for any encryptedFields that do not have a `keyId` defined
568
- and then create a new collection with the full set of encryptedFields.
569
-
570
- | Param | Type | Description |
571
- | --- | --- | --- |
572
- | db | <code>Db</code> | A Node.js driver Db object with which to create the collection |
573
- | name | <code>string</code> | The name of the collection to be created |
574
- | options | <code>object</code> | Options for createDataKey and for createCollection |
575
- | options.provider | <code>string</code> | KMS provider name |
576
- | [options.masterKey] | [<code>AWSEncryptionKeyOptions</code>](#AWSEncryptionKeyOptions) \| [<code>AzureEncryptionKeyOptions</code>](#AzureEncryptionKeyOptions) \| [<code>GCPEncryptionKeyOptions</code>](#GCPEncryptionKeyOptions) | masterKey to pass to createDataKey |
577
- | options.createCollectionOptions | <code>CreateCollectionOptions</code> | options to pass to createCollection, must include `encryptedFields` |
578
-
579
- **Returns**: <code>Promise.&lt;{collection: Collection.&lt;TSchema&gt;, encryptedFields: Document}&gt;</code> - - created collection and generated encryptedFields
580
- <a name="ClientEncryption+encrypt"></a>
581
-
582
- ### *clientEncryption*.encrypt(value, options, [callback])
583
-
584
- | Param | Type | Description |
585
- | --- | --- | --- |
586
- | value | <code>\*</code> | The value that you wish to serialize. Must be of a type that can be serialized into BSON |
587
- | options | [<code>EncryptOptions</code>](#EncryptOptions) | |
588
- | [callback] | [<code>ClientEncryptionEncryptCallback</code>](#ClientEncryptionEncryptCallback) | Optional callback to invoke when value is encrypted |
589
-
590
- Explicitly encrypt a provided value. Note that either `options.keyId` or `options.keyAltName` must
591
- be specified. Specifying both `options.keyId` and `options.keyAltName` is considered an error.
592
-
593
- **Returns**: <code>Promise</code> \| <code>void</code> - If no callback is provided, returns a Promise that either resolves with the encrypted value, or rejects with an error. If a callback is provided, returns nothing.
594
- **Example**
595
- ```js
596
- // Encryption with callback API
597
- function encryptMyData(value, callback) {
598
- clientEncryption.createDataKey('local', (err, keyId) => {
599
- if (err) {
600
- return callback(err);
601
- }
602
- clientEncryption.encrypt(value, { keyId, algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' }, callback);
603
- });
604
- }
605
- ```
606
- **Example**
607
- ```js
608
- // Encryption with async/await api
609
- async function encryptMyData(value) {
610
- const keyId = await clientEncryption.createDataKey('local');
611
- return clientEncryption.encrypt(value, { keyId, algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' });
612
- }
613
- ```
614
- **Example**
615
- ```js
616
- // Encryption using a keyAltName
617
- async function encryptMyData(value) {
618
- await clientEncryption.createDataKey('local', { keyAltNames: 'mySpecialKey' });
619
- return clientEncryption.encrypt(value, { keyAltName: 'mySpecialKey', algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic' });
620
- }
621
- ```
622
- <a name="ClientEncryption+encryptExpression"></a>
623
-
624
- ### *clientEncryption*.encryptExpression(expression, options)
625
- **Experimental**: The Range algorithm is experimental only. It is not intended for production use. It is subject to breaking changes.
626
-
627
- | Param | Type | Description |
628
- | --- | --- | --- |
629
- | expression | <code>object</code> | a BSON document of one of the following forms: 1. A Match Expression of this form: `{$and: [{<field>: {$gt: <value1>}}, {<field>: {$lt: <value2> }}]}` 2. An Aggregate Expression of this form: `{$and: [{$gt: [<fieldpath>, <value1>]}, {$lt: [<fieldpath>, <value2>]}]}` `$gt` may also be `$gte`. `$lt` may also be `$lte`. |
630
- | options | [<code>EncryptOptions</code>](#EncryptOptions) | |
631
-
632
- Encrypts a Match Expression or Aggregate Expression to query a range index.
633
-
634
- Only supported when queryType is "rangePreview" and algorithm is "RangePreview".
635
-
636
- **Returns**: <code>Promise.&lt;object&gt;</code> - Returns a Promise that either resolves with the encrypted value or rejects with an error.
637
- <a name="ClientEncryption+decrypt"></a>
638
-
639
- ### *clientEncryption*.decrypt(value, callback)
640
-
641
- | Param | Type | Description |
642
- | --- | --- | --- |
643
- | value | <code>Buffer</code> \| <code>Binary</code> | An encrypted value |
644
- | callback | [<code>decryptCallback</code>](#ClientEncryption..decryptCallback) | Optional callback to invoke when value is decrypted |
645
-
646
- Explicitly decrypt a provided encrypted value
647
-
648
- **Returns**: <code>Promise</code> \| <code>void</code> - If no callback is provided, returns a Promise that either resolves with the decrypted value, or rejects with an error. If a callback is provided, returns nothing.
649
- **Example**
650
- ```js
651
- // Decrypting value with callback API
652
- function decryptMyValue(value, callback) {
653
- clientEncryption.decrypt(value, callback);
654
- }
655
- ```
656
- **Example**
657
- ```js
658
- // Decrypting value with async/await API
659
- async function decryptMyValue(value) {
660
- return clientEncryption.decrypt(value);
661
- }
662
- ```
663
- <a name="ClientEncryption+askForKMSCredentials"></a>
664
-
665
- ### *clientEncryption*.askForKMSCredentials()
666
- Ask the user for KMS credentials.
667
-
668
- This returns anything that looks like the kmsProviders original input
669
- option. It can be empty, and any provider specified here will override
670
- the original ones.
671
-
672
- <a name="ClientEncryption..decryptCallback"></a>
673
-
674
- ### *ClientEncryption*~decryptCallback
675
-
676
- | Param | Type | Description |
677
- | --- | --- | --- |
678
- | [err] | <code>Error</code> | If present, indicates an error that occurred in the process of decryption |
679
- | [result] | <code>object</code> | If present, is the decrypted result |
680
-
681
- <a name="MongoCryptError"></a>
682
-
683
- ## MongoCryptError
684
- An error indicating that something went wrong specifically with MongoDB Client Encryption
685
-
686
- <a name="MongoCryptCreateDataKeyError"></a>
687
-
688
- ## MongoCryptCreateDataKeyError
689
- **Experimental**: Public Technical Preview
690
- An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create data keys
691
-
692
- <a name="MongoCryptCreateEncryptedCollectionError"></a>
693
-
694
- ## MongoCryptCreateEncryptedCollectionError
695
- **Experimental**: Public Technical Preview
696
- An error indicating that `ClientEncryption.createEncryptedCollection()` failed to create a collection
697
-
698
- <a name="MongoCryptAzureKMSRequestError"></a>
699
-
700
- ## MongoCryptAzureKMSRequestError
701
- An error indicating that mongodb-client-encryption failed to auto-refresh Azure KMS credentials.
702
-
703
- <a name="new_MongoCryptAzureKMSRequestError_new"></a>
704
-
705
- ### new MongoCryptAzureKMSRequestError(message, body)
706
-
707
- | Param | Type |
708
- | --- | --- |
709
- | message | <code>string</code> |
710
- | body | <code>object</code> \| <code>undefined</code> |
711
-
712
- <a name="BSONValue"></a>
713
-
714
- ## BSONValue
715
- any serializable BSON value
716
-
717
- <a name="Long"></a>
718
-
719
- ## Long
720
- A 64 bit integer, represented by the js-bson Long type.
721
-
722
- <a name="KMSProviders"></a>
723
-
724
- ## KMSProviders
725
- **Properties**
726
-
727
- | Name | Type | Description |
728
- | --- | --- | --- |
729
- | [aws] | <code>object</code> | Configuration options for using 'aws' as your KMS provider |
730
- | [aws.accessKeyId] | <code>string</code> | The access key used for the AWS KMS provider |
731
- | [aws.secretAccessKey] | <code>string</code> | The secret access key used for the AWS KMS provider |
732
- | [local] | <code>object</code> | Configuration options for using 'local' as your KMS provider |
733
- | [local.key] | <code>Buffer</code> | The master key used to encrypt/decrypt data keys. A 96-byte long Buffer. |
734
- | [azure] | <code>object</code> | Configuration options for using 'azure' as your KMS provider |
735
- | [azure.tenantId] | <code>string</code> | The tenant ID identifies the organization for the account |
736
- | [azure.clientId] | <code>string</code> | The client ID to authenticate a registered application |
737
- | [azure.clientSecret] | <code>string</code> | The client secret to authenticate a registered application |
738
- | [azure.identityPlatformEndpoint] | <code>string</code> | If present, a host with optional port. E.g. "example.com" or "example.com:443". This is optional, and only needed if customer is using a non-commercial Azure instance (e.g. a government or China account, which use different URLs). Defaults to "login.microsoftonline.com" |
739
- | [gcp] | <code>object</code> | Configuration options for using 'gcp' as your KMS provider |
740
- | [gcp.email] | <code>string</code> | The service account email to authenticate |
741
- | [gcp.privateKey] | <code>string</code> \| <code>Binary</code> | A PKCS#8 encrypted key. This can either be a base64 string or a binary representation |
742
- | [gcp.endpoint] | <code>string</code> | If present, a host with optional port. E.g. "example.com" or "example.com:443". Defaults to "oauth2.googleapis.com" |
743
-
744
- Configuration options that are used by specific KMS providers during key generation, encryption, and decryption.
745
-
746
- <a name="DataKey"></a>
747
-
748
- ## DataKey
749
- **Properties**
750
-
751
- | Name | Type | Description |
752
- | --- | --- | --- |
753
- | _id | <code>UUID</code> | A unique identifier for the key. |
754
- | version | <code>number</code> | A numeric identifier for the schema version of this document. Implicitly 0 if unset. |
755
- | [keyAltNames] | <code>Array.&lt;string&gt;</code> | Alternate names to search for keys by. Used for a per-document key scenario in support of GDPR scenarios. |
756
- | keyMaterial | <code>Binary</code> | Encrypted data key material, BinData type General. |
757
- | creationDate | <code>Date</code> | The datetime the wrapped data key material was imported into the Key Database. |
758
- | updateDate | <code>Date</code> | The datetime the wrapped data key material was last modified. On initial import, this value will be set to creationDate. |
759
- | status | <code>number</code> | 0 = enabled, 1 = disabled |
760
- | masterKey | <code>object</code> | the encrypted master key |
761
-
762
- A data key as stored in the database.
763
-
764
- <a name="KmsProvider"></a>
765
-
766
- ## KmsProvider
767
- A string containing the name of a kms provider. Valid options are 'aws', 'azure', 'gcp', 'kmip', or 'local'
768
-
769
- <a name="ClientSession"></a>
770
-
771
- ## ClientSession
772
- The ClientSession class from the MongoDB Node driver (see https://mongodb.github.io/node-mongodb-native/4.8/classes/ClientSession.html)
773
-
774
- <a name="DeleteResult"></a>
775
-
776
- ## DeleteResult
777
- **Properties**
778
-
779
- | Name | Type | Description |
780
- | --- | --- | --- |
781
- | acknowledged | <code>boolean</code> | Indicates whether this write result was acknowledged. If not, then all other members of this result will be undefined. |
782
- | deletedCount | <code>number</code> | The number of documents that were deleted |
783
-
784
- The result of a delete operation from the MongoDB Node driver (see https://mongodb.github.io/node-mongodb-native/4.8/interfaces/DeleteResult.html)
785
-
786
- <a name="BulkWriteResult"></a>
787
-
788
- ## BulkWriteResult
789
- The BulkWriteResult class from the MongoDB Node driver (https://mongodb.github.io/node-mongodb-native/4.8/classes/BulkWriteResult.html)
790
-
791
- <a name="FindCursor"></a>
792
-
793
- ## FindCursor
794
- The FindCursor class from the MongoDB Node driver (see https://mongodb.github.io/node-mongodb-native/4.8/classes/FindCursor.html)
795
-
796
- <a name="ClientEncryptionDataKeyId"></a>
797
-
798
- ## ClientEncryptionDataKeyId
799
- The id of an existing dataKey. Is a bson Binary value.
800
- Can be used for [ClientEncryption.encrypt](ClientEncryption.encrypt), and can be used to directly
801
- query for the data key itself against the key vault namespace.
802
-
803
- <a name="ClientEncryptionCreateDataKeyCallback"></a>
804
-
805
- ## ClientEncryptionCreateDataKeyCallback
806
-
807
- | Param | Type | Description |
808
- | --- | --- | --- |
809
- | [error] | <code>Error</code> | If present, indicates an error that occurred in the creation of the data key |
810
- | [dataKeyId] | <code>ClientEncryption~dataKeyId</code> | If present, returns the id of the created data key |
811
-
812
- <a name="AWSEncryptionKeyOptions"></a>
813
-
814
- ## AWSEncryptionKeyOptions
815
- **Properties**
816
-
817
- | Name | Type | Description |
818
- | --- | --- | --- |
819
- | region | <code>string</code> | The AWS region of the KMS |
820
- | key | <code>string</code> | The Amazon Resource Name (ARN) to the AWS customer master key (CMK) |
821
- | [endpoint] | <code>string</code> | An alternate host to send KMS requests to. May include port number |
822
-
823
- Configuration options for making an AWS encryption key
824
-
825
- <a name="GCPEncryptionKeyOptions"></a>
826
-
827
- ## GCPEncryptionKeyOptions
828
- **Properties**
829
-
830
- | Name | Type | Description |
831
- | --- | --- | --- |
832
- | projectId | <code>string</code> | GCP project id |
833
- | location | <code>string</code> | Location name (e.g. "global") |
834
- | keyRing | <code>string</code> | Key ring name |
835
- | keyName | <code>string</code> | Key name |
836
- | [keyVersion] | <code>string</code> | Key version |
837
- | [endpoint] | <code>string</code> | KMS URL, defaults to `https://www.googleapis.com/auth/cloudkms` |
838
-
839
- Configuration options for making a GCP encryption key
840
-
841
- <a name="AzureEncryptionKeyOptions"></a>
842
-
843
- ## AzureEncryptionKeyOptions
844
- **Properties**
845
-
846
- | Name | Type | Description |
847
- | --- | --- | --- |
848
- | keyName | <code>string</code> | Key name |
849
- | keyVaultEndpoint | <code>string</code> | Key vault URL, typically `<name>.vault.azure.net` |
850
- | [keyVersion] | <code>string</code> | Key version |
851
-
852
- Configuration options for making an Azure encryption key
853
-
854
- <a name="RewrapManyDataKeyResult"></a>
855
-
856
- ## RewrapManyDataKeyResult
857
- **Properties**
858
-
859
- | Name | Type | Description |
860
- | --- | --- | --- |
861
- | [bulkWriteResult] | [<code>BulkWriteResult</code>](#BulkWriteResult) | An optional BulkWriteResult, if any keys were matched and attempted to be re-wrapped. |
862
-
863
- <a name="ClientEncryptionEncryptCallback"></a>
864
-
865
- ## ClientEncryptionEncryptCallback
866
-
867
- | Param | Type | Description |
868
- | --- | --- | --- |
869
- | [err] | <code>Error</code> | If present, indicates an error that occurred in the process of encryption |
870
- | [result] | <code>Buffer</code> | If present, is the encrypted result |
871
-
872
- <a name="RangeOptions"></a>
873
-
874
- ## RangeOptions
875
- **Properties**
876
-
877
- | Name | Type | Description |
878
- | --- | --- | --- |
879
- | min | [<code>BSONValue</code>](#BSONValue) | is required if precision is set. |
880
- | max | [<code>BSONValue</code>](#BSONValue) | is required if precision is set. |
881
- | sparsity | <code>BSON.Long</code> | |
882
- | precision | <code>number</code> \| <code>undefined</code> | (may only be set for double or decimal128). |
883
-
884
- min, max, sparsity, and range must match the values set in the encryptedFields of the destination collection.
885
- For double and decimal128, min/max/precision must all be set, or all be unset.
886
-
887
- <a name="EncryptOptions"></a>
888
-
889
- ## EncryptOptions
890
- **Properties**
891
-
892
- | Name | Type | Description |
893
- | --- | --- | --- |
894
- | [keyId] | [<code>ClientEncryptionDataKeyId</code>](#ClientEncryptionDataKeyId) | The id of the Binary dataKey to use for encryption. |
895
- | [keyAltName] | <code>string</code> | A unique string name corresponding to an already existing dataKey. |
896
- | [algorithm] | <code>string</code> | The algorithm to use for encryption. Must be either `'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'`, `'AEAD_AES_256_CBC_HMAC_SHA_512-Random'`, `'Indexed'` or `'Unindexed'` |
897
- | [contentionFactor] | <code>bigint</code> \| <code>number</code> | (experimental) - the contention factor. |
898
- | queryType | <code>&#x27;equality&#x27;</code> \| <code>&#x27;rangePreview&#x27;</code> | (experimental) - the query type supported. |
899
- | [rangeOptions] | [<code>RangeOptions</code>](#RangeOptions) | (experimental) The index options for a Queryable Encryption field supporting "rangePreview" queries. |
900
-
901
- Options to provide when encrypting data.
3
+ #### https://github.com/mongodb-js/mongodb-client-encryption
902
4
 
5
+ They can still be found at the same npm package:
6
+ - https://www.npmjs.com/package/mongodb-client-encryption