6
6
import * as net from 'net' ;
7
7
8
8
import { deserialize , type Document , serialize } from '../bson' ;
9
- import { type AWSCredentialProvider } from '../cmap/auth/aws_temporary_credentials' ;
10
9
import { type CommandOptions , type ProxyOptions } from '../cmap/connection' ;
11
10
import { kDecorateResult } from '../constants' ;
12
11
import { getMongoDBClientEncryption } from '../deps' ;
@@ -18,7 +17,7 @@ import { autoSelectSocketOptions } from './client_encryption';
18
17
import * as cryptoCallbacks from './crypto_callbacks' ;
19
18
import { MongoCryptInvalidArgumentError } from './errors' ;
20
19
import { MongocryptdManager } from './mongocryptd_manager' ;
21
- import { type KMSProviders , refreshKMSCredentials } from './providers' ;
20
+ import { type CredentialProviders , type KMSProviders , refreshKMSCredentials } from './providers' ;
22
21
import { type CSFLEKMSTlsOptions , StateMachine } from './state_machine' ;
23
22
24
23
/** @public */
@@ -31,6 +30,8 @@ export interface AutoEncryptionOptions {
31
30
keyVaultNamespace ?: string ;
32
31
/** Configuration options that are used by specific KMS providers during key generation, encryption, and decryption. */
33
32
kmsProviders ?: KMSProviders ;
33
+ /** Configuration options for custom credential providers. */
34
+ credentialProviders ?: CredentialProviders ;
34
35
/**
35
36
* A map of namespaces to a local JSON schema for encryption
36
37
*
@@ -105,8 +106,6 @@ export interface AutoEncryptionOptions {
105
106
proxyOptions ?: ProxyOptions ;
106
107
/** The TLS options to use connecting to the KMS provider */
107
108
tlsOptions ?: CSFLEKMSTlsOptions ;
108
- /** Optional custom credential provider to use for KMS requests. */
109
- awsCredentialProvider ?: AWSCredentialProvider ;
110
109
}
111
110
112
111
/**
@@ -156,7 +155,7 @@ export class AutoEncrypter {
156
155
_kmsProviders : KMSProviders ;
157
156
_bypassMongocryptdAndCryptShared : boolean ;
158
157
_contextCounter : number ;
159
- _awsCredentialProvider ?: AWSCredentialProvider ;
158
+ _credentialProviders ?: CredentialProviders ;
160
159
161
160
_mongocryptdManager ?: MongocryptdManager ;
162
161
_mongocryptdClient ?: MongoClient ;
@@ -241,7 +240,7 @@ export class AutoEncrypter {
241
240
this . _proxyOptions = options . proxyOptions || { } ;
242
241
this . _tlsOptions = options . tlsOptions || { } ;
243
242
this . _kmsProviders = options . kmsProviders || { } ;
244
- this . _awsCredentialProvider = options . awsCredentialProvider ;
243
+ this . _credentialProviders = options . credentialProviders ;
245
244
246
245
const mongoCryptOptions : MongoCryptOptions = {
247
246
cryptoCallbacks
@@ -443,7 +442,7 @@ export class AutoEncrypter {
443
442
* the original ones.
444
443
*/
445
444
async askForKMSCredentials ( ) : Promise < KMSProviders > {
446
- return await refreshKMSCredentials ( this . _kmsProviders , this . _awsCredentialProvider ) ;
445
+ return await refreshKMSCredentials ( this . _kmsProviders , this . _credentialProviders ) ;
447
446
}
448
447
449
448
/**
0 commit comments