File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/client-side-encryption Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,12 @@ import { autoSelectSocketOptions } from './client_encryption';
1717import * as cryptoCallbacks from './crypto_callbacks' ;
1818import { MongoCryptInvalidArgumentError } from './errors' ;
1919import { MongocryptdManager } from './mongocryptd_manager' ;
20- import { type CredentialProviders , type KMSProviders , refreshKMSCredentials } from './providers' ;
20+ import {
21+ type CredentialProviders ,
22+ isEmptyCredentials ,
23+ type KMSProviders ,
24+ refreshKMSCredentials
25+ } from './providers' ;
2126import { type CSFLEKMSTlsOptions , StateMachine } from './state_machine' ;
2227
2328/** @public */
@@ -242,6 +247,15 @@ export class AutoEncrypter {
242247 this . _kmsProviders = options . kmsProviders || { } ;
243248 this . _credentialProviders = options . credentialProviders ;
244249
250+ if (
251+ options . credentialProviders ?. aws &&
252+ ! isEmptyCredentials ( 'aws' , options . kmsProviders || { } )
253+ ) {
254+ throw new MongoCryptInvalidArgumentError (
255+ 'Cannot provide both a custom credential provider and credentials. Please specify one or the other.'
256+ ) ;
257+ }
258+
245259 const mongoCryptOptions : MongoCryptOptions = {
246260 cryptoCallbacks
247261 } ;
You can’t perform that action at this time.
0 commit comments