Skip to content

feat(NODE-4136): adjust Node.js bindings for shared library spec#306

Merged
durran merged 2 commits into
mongodb:masterfrom
mongodb-js:node-4136-dev
Apr 21, 2022
Merged

feat(NODE-4136): adjust Node.js bindings for shared library spec#306
durran merged 2 commits into
mongodb:masterfrom
mongodb-js:node-4136-dev

Conversation

@addaleax
Copy link
Copy Markdown
Contributor

@addaleax addaleax commented Apr 19, 2022

Specifically, pass a default csfleSearchPaths list of ['$SYSTEM'],
and add support for csfleRequired.

As drive-by fixes, fix a typo that currently (unintentionally) leads to
_mongocryptdClient and _mongocryptdManager being initialized even
if bypassAutoEncryption was specified, and adjust the tests and the
.teardown() method for those cases.

Typings changes: mongodb/node-mongodb-native#3206

Specifically, pass a default `csfleSearchPaths` list of `['$SYSTEM']`,
and add support for `csfleRequired`.

As drive-by fixes, fix a typo that currently (unintentionally) leads to
`_mongocryptdClient` and `_mongocryptdManager` being initialized even
if `bypassAutoEncryption` was specified, and adjust the tests and the
`.teardown()` method for those cases.
// Only instantiate mongocryptd manager/client once we know for sure
// that we are not using the CSFLE shared library.
if (!this._bypassAutoEncryption && !this.csfleVersionInfo) {
if (!this._bypassEncryption && !this.csfleVersionInfo) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn’t realize in efad8b6 that this condition (before the addition of csfleVersionInfo) would never actually have been hit due to the typo.

Obviously it would be possible to go the other way here as well, i.e. drop the conditional entirely and always create _mongocryptdManager and _mongocryptdClient. Let me know if you have a specific preference 🙂

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to not have the cryptdManager exist when we are using the lib. Good catch!

Comment thread bindings/node/lib/autoEncrypter.js
// Only instantiate mongocryptd manager/client once we know for sure
// that we are not using the CSFLE shared library.
if (!this._bypassAutoEncryption && !this.csfleVersionInfo) {
if (!this._bypassEncryption && !this.csfleVersionInfo) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to not have the cryptdManager exist when we are using the lib. Good catch!

Copy link
Copy Markdown
Contributor

@durran durran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@durran durran merged commit d3f3884 into mongodb:master Apr 21, 2022
@addaleax addaleax deleted the node-4136-dev branch April 21, 2022 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants