Skip to content

Commit e16b674

Browse files
adapt crypto callback tests for 6.1
1 parent 4a975a7 commit e16b674

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/client-side-encryption/client_encryption.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class ClientEncryption {
123123

124124
const mongoCryptOptions: MongoCryptOptions = {
125125
...options,
126-
cryptoCallbacks,
126+
cryptoCallbacks: options.cryptoCallbacks ?? cryptoCallbacks,
127127
kmsProviders: !Buffer.isBuffer(this._kmsProviders)
128128
? (serialize(this._kmsProviders) as Buffer)
129129
: this._kmsProviders
@@ -814,6 +814,9 @@ export interface ClientEncryptionOptions {
814814
* TLS options for kms providers to use.
815815
*/
816816
tlsOptions?: CSFLEKMSTlsOptions;
817+
818+
/** @internal */
819+
cryptoCallbacks?: typeof cryptoCallbacks
817820
}
818821

819822
/**

test/integration/node-specific/crypto_callbacks.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ describe('cryptoCallbacks', function () {
3838
beforeEach(function () {
3939
if (SKIP_AWS_TESTS) {
4040
this.currentTest?.skip();
41-
return;
4241
}
4342

4443
sandbox = sinon.createSandbox();
@@ -91,7 +90,8 @@ describe('cryptoCallbacks', function () {
9190

9291
const encryption = new ClientEncryption(client, {
9392
keyVaultNamespace: 'test.encryption',
94-
kmsProviders
93+
kmsProviders,
94+
cryptoCallbacks
9595
});
9696

9797
assertCertainHooksCalled();
@@ -125,7 +125,8 @@ describe('cryptoCallbacks', function () {
125125

126126
const encryption = new ClientEncryption(client, {
127127
keyVaultNamespace: 'test.encryption',
128-
kmsProviders
128+
kmsProviders,
129+
cryptoCallbacks
129130
});
130131

131132
const result = await (async () => {
@@ -155,7 +156,9 @@ describe('cryptoCallbacks', function () {
155156

156157
const encryption = new ClientEncryption(client, {
157158
keyVaultNamespace: 'test.encryption',
158-
kmsProviders
159+
kmsProviders,
160+
cryptoCallbacks
161+
159162
});
160163

161164
const result = await encryption.createDataKey('aws', dataKeyOptions).catch(error => error);
@@ -169,7 +172,8 @@ describe('cryptoCallbacks', function () {
169172

170173
const encryption = new ClientEncryption(client, {
171174
keyVaultNamespace: 'test.encryption',
172-
kmsProviders
175+
kmsProviders,
176+
cryptoCallbacks
173177
});
174178

175179
const result = await encryption.createDataKey('aws', dataKeyOptions).catch(error => error);

0 commit comments

Comments
 (0)