Skip to content

Commit 7b08a4a

Browse files
committed
feat(NODE-3777): pass tls options through to csfle
1 parent 07f3d02 commit 7b08a4a

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

src/deps.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,28 @@ export const AutoEncryptionLoggerLevel = Object.freeze({
174174
export type AutoEncryptionLoggerLevel =
175175
typeof AutoEncryptionLoggerLevel[keyof typeof AutoEncryptionLoggerLevel];
176176

177+
/** @public */
178+
export interface AutoEncryptionTlsOptions {
179+
/**
180+
* Specifies the location of a local .pem file that contains
181+
* either the client's TLS/SSL certificate and key or only the
182+
* client's TLS/SSL key when tlsCertificateFile is used to
183+
* provide the certificate.
184+
*/
185+
tlsCertificateKeyFile?: string;
186+
/**
187+
* Specifies the password to de-crypt the tlsCertificateKeyFile.
188+
*/
189+
tlsCertificateKeyFilePassword?: string;
190+
/**
191+
* Specifies the location of a local .pem file that contains the
192+
* root certificate chain from the Certificate Authority.
193+
* This file is used to validate the certificate presented by the
194+
* KMS provider.
195+
*/
196+
tlsCAFile?: string;
197+
}
198+
177199
/** @public */
178200
export interface AutoEncryptionOptions {
179201
/** @internal */
@@ -275,6 +297,14 @@ export interface AutoEncryptionOptions {
275297
mongocryptdSpawnArgs?: string[];
276298
};
277299
proxyOptions?: ProxyOptions;
300+
/** The TLS options to use connecting to the KMS provider */
301+
tlsOptions?: {
302+
aws?: AutoEncryptionTlsOptions;
303+
local?: AutoEncryptionTlsOptions;
304+
azure?: AutoEncryptionTlsOptions;
305+
gcp?: AutoEncryptionTlsOptions;
306+
kmip?: AutoEncryptionTlsOptions;
307+
}
278308
}
279309

280310
/** @public */

test/integration/client-side-encryption/client_side_encryption.corpus.spec.test.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,16 @@ describe('Client Side Encryption Corpus', function () {
202202
// .. code:: javascript
203203
// Mng0NCt4ZHVUYUJCa1kxNkVyNUR1QURhZ2h2UzR2d2RrZzh0cFBwM3R6NmdWMDFBMUN3YkQ5aXRRMkhGRGdQV09wOGVNYUMxT2k3NjZKelhaQmRCZGJkTXVyZG9uSjFk
204204
// Configure both objects with ``keyVaultNamespace`` set to ``keyvault.datakeys``.
205+
const tlsOptions = {
206+
kmip: {
207+
tlsCAFile: '/Users/modetojoy/work/mongodb-labs/drivers-evergreen-tools/.evergreen/x509gen/ca.pem',
208+
tlsCertificateKeyFile: '/Users/modetojoy/work/mongodb-labs/drivers-evergreen-tools/.evergreen/x509gen/client.pem'
209+
}
210+
};
205211
const autoEncryption = {
206212
keyVaultNamespace,
207-
kmsProviders
213+
kmsProviders,
214+
tlsOptions
208215
};
209216
if (useClientSideSchema) {
210217
autoEncryption.schemaMap = {
@@ -217,7 +224,8 @@ describe('Client Side Encryption Corpus', function () {
217224
clientEncryption = new mongodbClientEncryption.ClientEncryption(client, {
218225
bson: BSON,
219226
keyVaultNamespace,
220-
kmsProviders
227+
kmsProviders,
228+
tlsOptions
221229
});
222230
});
223231
});

0 commit comments

Comments
 (0)