Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/client-side-encryption/auto_encrypter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface AutoEncryptionOptions {
/** If true, autoEncryption will not attempt to spawn a mongocryptd before connecting */
mongocryptdBypassSpawn?: boolean;
/** The path to the mongocryptd executable on the system */
mongocryptdSpawnPath?: string;
mongocryptdSpawnPath?: `${string}mongocryptd${'.exe' | ''}`;
/** Command line arguments to use when auto-spawning a mongocryptd */
mongocryptdSpawnArgs?: string[];
/**
Expand All @@ -95,7 +95,7 @@ export interface AutoEncryptionOptions {
*
* Requires the MongoDB Crypt shared library, available in MongoDB 6.0 or higher.
*/
cryptSharedLibPath?: string;
cryptSharedLibPath?: `${string}mongo_crypt_v${number}.${'so' | 'dll' | 'dylib'}`;
/**
* If specified, never use mongocryptd and instead fail when the MongoDB Crypt
* shared library could not be loaded.
Expand Down
50 changes: 50 additions & 0 deletions test/types/client-side-encryption.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expectAssignable, expectError, expectNotAssignable, expectType } from '

import type {
AWSEncryptionKeyOptions,
AutoEncryptionOptions,
AzureEncryptionKeyOptions,
ClientEncryption,
ClientEncryptionEncryptOptions,
Expand Down Expand Up @@ -107,3 +108,52 @@ expectAssignable<RequiredCreateEncryptedCollectionSettings>({

expectNotAssignable<ClientEncryptionDataKeyProvider>('arbitrary string');
}

{
expectAssignable<AutoEncryptionOptions>({
extraOptions: {
mongocryptdSpawnPath: 'mongocryptd'
}
});
expectAssignable<AutoEncryptionOptions>({
extraOptions: {
mongocryptdSpawnPath: 'mongocryptd.exe'
}
});
expectAssignable<AutoEncryptionOptions>({
extraOptions: {
mongocryptdSpawnPath: '/usr/bin/mongocryptd'
}
});
expectNotAssignable<AutoEncryptionOptions>({
extraOptions: {
mongocryptdSpawnPath: 'mongo_crypt_v1.so'
}
});

expectAssignable<AutoEncryptionOptions>({
extraOptions: {
cryptSharedLibPath: 'mongo_crypt_v1.so'
}
});
expectAssignable<AutoEncryptionOptions>({
extraOptions: {
cryptSharedLibPath: 'mongo_crypt_v1.dll'
}
});
expectAssignable<AutoEncryptionOptions>({
extraOptions: {
cryptSharedLibPath: 'mongo_crypt_v1.dylib'
}
});
expectAssignable<AutoEncryptionOptions>({
extraOptions: {
cryptSharedLibPath: '/usr/lib/mongo_crypt_v1.dylib'
}
});
expectNotAssignable<AutoEncryptionOptions>({
extraOptions: {
cryptSharedLibPath: 'libmongocrypt.so'
}
});
}