-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(NODE-4986)!: remove callbacks from ClientEncryption encrypt, decrypt, and createDataKey #3797
Conversation
3eaf05b
to
ca05650
Compare
af4d12f
to
e33cf69
Compare
…rypt, and createDataKey
e33cf69
to
1e7d89a
Compare
cb(err, null); | ||
return; | ||
} | ||
const updatedDataKey = await stateMachine.executeAsync<DataKey>(this, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to choose another name here because we were shadowing. Up for any suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just remove the first declaration and name this dataKey
? it's not proving much value imo and it actually makes this more confusing, because the data key is created by stateMachine.execute
.
const dataKeyBson = serialize({ provider, masterKey: options.masterKey });
cb(err, null); | ||
return; | ||
} | ||
const updatedDataKey = await stateMachine.executeAsync<DataKey>(this, context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just remove the first declaration and name this dataKey
? it's not proving much value imo and it actually makes this more confusing, because the data key is created by stateMachine.execute
.
const dataKeyBson = serialize({ provider, masterKey: options.masterKey });
|
||
beforeEach(function () { | ||
if (SKIP_AWS_TESTS) { | ||
this.currentTest?.skip(); | ||
return; | ||
} | ||
|
||
sandbox.restore(); | ||
sandbox = sinon.createSandbox(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to stub the whole object in one go?
sandbox.spy(cryptoCallbacks)
@@ -98,7 +98,7 @@ | |||
"js-yaml": "^4.1.0", | |||
"mocha": "^10.2.0", | |||
"mocha-sinon": "^2.1.2", | |||
"mongodb-client-encryption": "^6.0.0-alpha.1", | |||
"mongodb-client-encryption": "6.0.0-alpha.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we bump this to alpha 2 now that it's out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alpha.2 introduced the bug that's making the CI red, rolling back fixes it locally but all of EVG disagrees 😅 I'm not sure how the code is getting a hold of the alpha.2 version, I thought we only installed from devDeps now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context: https://jira.mongodb.org/browse/NODE-5516
Now that we track the package in our devDeps we can get rid of the peppering of manual installations. cc @baileympearson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failing tests are either unrelated or expected. LGTM
Description
What is changing?
Is there new documentation needed for these changes?
Release highlights
What is the motivation for this change?
We do not offer callbacks APIs anymore
Release Highlight
Callbacks removed from ClientEncryption's
encrypt
,decrypt
, andcreateDataKey
methodsDriver v5 dropped support for callbacks in asynchronous functions in favor of returning promises. We are now removing support for callbacks from the
ClientEncryption
class.createDataKey
return type fixThe Typescript for
createDataKey
incorrectly declared the result to be aDataKey
but the method actually returns the DataKey'sinsertedId
.Double check the following
npm run check:lint
scripttype(NODE-xxxx)[!]: description
feat(NODE-1234)!: rewriting everything in coffeescript