File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
src/client-side-encryption Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ export interface AutoEncryptionOptions {
105105 proxyOptions ?: ProxyOptions ;
106106 /** The TLS options to use connecting to the KMS provider */
107107 tlsOptions ?: CSFLEKMSTlsOptions ;
108+ /** Optional custom credential provider to use for KMS requests. */
109+ awsCredentialProvider ?: AWSCredentialProvider ;
108110}
109111
110112/**
@@ -239,6 +241,7 @@ export class AutoEncrypter {
239241 this . _proxyOptions = options . proxyOptions || { } ;
240242 this . _tlsOptions = options . tlsOptions || { } ;
241243 this . _kmsProviders = options . kmsProviders || { } ;
244+ this . _awsCredentialProvider = options . awsCredentialProvider ;
242245
243246 const mongoCryptOptions : MongoCryptOptions = {
244247 cryptoCallbacks
@@ -329,11 +332,6 @@ export class AutoEncrypter {
329332 * This function is a no-op when bypassSpawn is set or the crypt shared library is used.
330333 */
331334 async init ( ) : Promise < MongoClient | void > {
332- // This is handled during init() as the auto encrypter is instantiated during the client's
333- // parseOptions() call, so the client doesn't have its options set at that point.
334- this . _awsCredentialProvider =
335- this . _client . options . credentials ?. mechanismProperties . AWS_CREDENTIAL_PROVIDER ;
336-
337335 if ( this . _bypassMongocryptdAndCryptShared || this . cryptSharedLibVersionInfo ) {
338336 return ;
339337 }
You can’t perform that action at this time.
0 commit comments