66import * as net from 'net' ;
77
88import { deserialize , type Document , serialize } from '../bson' ;
9- import { type AWSCredentialProvider } from '../cmap/auth/aws_temporary_credentials' ;
109import { type CommandOptions , type ProxyOptions } from '../cmap/connection' ;
1110import { kDecorateResult } from '../constants' ;
1211import { getMongoDBClientEncryption } from '../deps' ;
@@ -18,7 +17,7 @@ import { autoSelectSocketOptions } from './client_encryption';
1817import * as cryptoCallbacks from './crypto_callbacks' ;
1918import { MongoCryptInvalidArgumentError } from './errors' ;
2019import { MongocryptdManager } from './mongocryptd_manager' ;
21- import { type KMSProviders , refreshKMSCredentials } from './providers' ;
20+ import { type CredentialProviders , type KMSProviders , refreshKMSCredentials } from './providers' ;
2221import { type CSFLEKMSTlsOptions , StateMachine } from './state_machine' ;
2322
2423/** @public */
@@ -31,6 +30,8 @@ export interface AutoEncryptionOptions {
3130 keyVaultNamespace ?: string ;
3231 /** Configuration options that are used by specific KMS providers during key generation, encryption, and decryption. */
3332 kmsProviders ?: KMSProviders ;
33+ /** Configuration options for custom credential providers. */
34+ credentialProviders ?: CredentialProviders ;
3435 /**
3536 * A map of namespaces to a local JSON schema for encryption
3637 *
@@ -105,8 +106,6 @@ export interface AutoEncryptionOptions {
105106 proxyOptions ?: ProxyOptions ;
106107 /** The TLS options to use connecting to the KMS provider */
107108 tlsOptions ?: CSFLEKMSTlsOptions ;
108- /** Optional custom credential provider to use for KMS requests. */
109- awsCredentialProvider ?: AWSCredentialProvider ;
110109}
111110
112111/**
@@ -156,7 +155,7 @@ export class AutoEncrypter {
156155 _kmsProviders : KMSProviders ;
157156 _bypassMongocryptdAndCryptShared : boolean ;
158157 _contextCounter : number ;
159- _awsCredentialProvider ?: AWSCredentialProvider ;
158+ _credentialProviders ?: CredentialProviders ;
160159
161160 _mongocryptdManager ?: MongocryptdManager ;
162161 _mongocryptdClient ?: MongoClient ;
@@ -241,7 +240,7 @@ export class AutoEncrypter {
241240 this . _proxyOptions = options . proxyOptions || { } ;
242241 this . _tlsOptions = options . tlsOptions || { } ;
243242 this . _kmsProviders = options . kmsProviders || { } ;
244- this . _awsCredentialProvider = options . awsCredentialProvider ;
243+ this . _credentialProviders = options . credentialProviders ;
245244
246245 const mongoCryptOptions : MongoCryptOptions = {
247246 cryptoCallbacks
@@ -443,7 +442,7 @@ export class AutoEncrypter {
443442 * the original ones.
444443 */
445444 async askForKMSCredentials ( ) : Promise < KMSProviders > {
446- return await refreshKMSCredentials ( this . _kmsProviders , this . _awsCredentialProvider ) ;
445+ return await refreshKMSCredentials ( this . _kmsProviders , this . _credentialProviders ) ;
447446 }
448447
449448 /**
0 commit comments