File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 11import path from 'path' ;
22import { promises as fs , constants as fsConstants } from 'fs' ;
33import type { MongoshBus } from '@mongosh/types' ;
4+ import type { AutoEncryptionOptions } from 'mongodb' ;
45
5- export const SHARED_LIBRARY_SUFFIX =
6+ type SharedObjectSuffix = 'so' | 'dylib' | 'dll' ;
7+ export const SHARED_LIBRARY_SUFFIX : SharedObjectSuffix =
68 process . platform === 'win32'
79 ? 'dll'
810 : process . platform === 'darwin'
911 ? 'dylib'
1012 : 'so' ;
13+ export type CryptSharedLibPath = NonNullable <
14+ NonNullable < AutoEncryptionOptions [ 'extraOptions' ] > [ 'cryptSharedLibPath' ]
15+ > ;
1116
1217export interface CryptLibraryPathResult {
13- cryptSharedLibPath ?: string ;
18+ cryptSharedLibPath ?: CryptSharedLibPath ;
1419 expectedVersion ?: { version : bigint ; versionStr : string } ;
1520}
1621
@@ -54,7 +59,10 @@ export async function getCryptLibraryPaths(
5459 ) ,
5560 // Location of the shared library in the zip and tgz packages
5661 path . resolve ( bindir , `mongosh_crypt_v1.${ SHARED_LIBRARY_SUFFIX } ` ) ,
57- ] ) {
62+ // NB: The types here intentionally mismatch, as we rename the
63+ // library file to avoid conflicts with system installations of
64+ // the crypt_shared library.
65+ ] as CryptSharedLibPath [ ] ) {
5866 try {
5967 const permissionsMismatch = await ensureMatchingPermissions (
6068 libraryCandidate ,
You can’t perform that action at this time.
0 commit comments