Skip to content

Commit

Permalink
adapt crypto callback tests for 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Aug 14, 2024
1 parent 4a975a7 commit e16b674
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/client-side-encryption/client_encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class ClientEncryption {

const mongoCryptOptions: MongoCryptOptions = {
...options,
cryptoCallbacks,
cryptoCallbacks: options.cryptoCallbacks ?? cryptoCallbacks,
kmsProviders: !Buffer.isBuffer(this._kmsProviders)
? (serialize(this._kmsProviders) as Buffer)
: this._kmsProviders
Expand Down Expand Up @@ -814,6 +814,9 @@ export interface ClientEncryptionOptions {
* TLS options for kms providers to use.
*/
tlsOptions?: CSFLEKMSTlsOptions;

/** @internal */
cryptoCallbacks?: typeof cryptoCallbacks
}

/**
Expand Down
14 changes: 9 additions & 5 deletions test/integration/node-specific/crypto_callbacks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe('cryptoCallbacks', function () {
beforeEach(function () {
if (SKIP_AWS_TESTS) {
this.currentTest?.skip();
return;
}

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

const encryption = new ClientEncryption(client, {
keyVaultNamespace: 'test.encryption',
kmsProviders
kmsProviders,
cryptoCallbacks
});

assertCertainHooksCalled();
Expand Down Expand Up @@ -125,7 +125,8 @@ describe('cryptoCallbacks', function () {

const encryption = new ClientEncryption(client, {
keyVaultNamespace: 'test.encryption',
kmsProviders
kmsProviders,
cryptoCallbacks
});

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

const encryption = new ClientEncryption(client, {
keyVaultNamespace: 'test.encryption',
kmsProviders
kmsProviders,
cryptoCallbacks

});

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

const encryption = new ClientEncryption(client, {
keyVaultNamespace: 'test.encryption',
kmsProviders
kmsProviders,
cryptoCallbacks
});

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

0 comments on commit e16b674

Please sign in to comment.