diff --git a/.github/scripts/libmongocrypt.mjs b/.github/scripts/libmongocrypt.mjs index d61a7bd..b933ca6 100644 --- a/.github/scripts/libmongocrypt.mjs +++ b/.github/scripts/libmongocrypt.mjs @@ -8,7 +8,12 @@ import events from 'node:events'; import path from 'node:path'; import https from 'node:https'; import stream from 'node:stream/promises'; -import { buildLibmongocryptDownloadUrl, getLibmongocryptPrebuildName, resolveRoot, run } from './utils.mjs'; +import { + buildLibmongocryptDownloadUrl, + getLibmongocryptPrebuildName, + resolveRoot, + run +} from './utils.mjs'; async function parseArguments() { const pkg = JSON.parse(await fs.readFile(resolveRoot('package.json'), 'utf8')); @@ -72,19 +77,11 @@ export async function buildLibMongoCrypt(libmongocryptRoot, nodeDepsRoot, option const CMAKE_FLAGS = toCLIFlags({ /** - * We provide crypto hooks from Node.js binding to openssl (so disable system crypto) - * TODO: NODE-5455 + * We provide crypto hooks from Node.js binding to openssl (so disable **system** crypto) * - * One thing that is not obvious from the build instructions for libmongocrypt - * and the Node.js bindings is that the Node.js driver uses libmongocrypt in - * DISABLE_NATIVE_CRYPTO aka nocrypto mode, that is, instead of using native - * system libraries for crypto operations, it provides callbacks to libmongocrypt - * which, in the Node.js addon case, call JS functions that in turn call built-in - * Node.js crypto methods. - * - * That’s way more convoluted than it needs to be, considering that we always - * have a copy of OpenSSL available directly, but for now it seems to make sense - * to stick with what the Node.js addon does here. + * Node.js ships with openssl statically compiled into the runtime. + * We provide hooks to libmongocrypt that uses Node.js copy of openssl + * instead of the operating system's copy so we build without linking to the system crypto. */ DDISABLE_NATIVE_CRYPTO: '1', /** A consistent name for the output "library" directory */ @@ -185,9 +182,7 @@ async function buildBindings(args, pkg) { gypDefines = gypDefines.trim(); const prebuildOptions = - gypDefines.length > 0 - ? { env: { ...process.env, GYP_DEFINES: gypDefines } } - : undefined; + gypDefines.length > 0 ? { env: { ...process.env, GYP_DEFINES: gypDefines } } : undefined; await run('npm', ['run', 'prebuild'], prebuildOptions); // Compile Typescript diff --git a/addon/mongocrypt.cc b/addon/mongocrypt.cc index 1fcda3f..32f1a60 100644 --- a/addon/mongocrypt.cc +++ b/addon/mongocrypt.cc @@ -577,6 +577,11 @@ MongoCrypt::MongoCrypt(const CallbackInfo& info) : ObjectWrap(info) { mongocrypt_setopt_retry_kms(mongo_crypt(), true); + if (options.Get("enableMultipleCollinfo").ToBoolean()) { + /** TODO(NODE-6793): remove this option and have it always set in the next major */ + mongocrypt_setopt_enable_multiple_collinfo(mongo_crypt()); + } + // Initialize after all options are set. if (!mongocrypt_init(mongo_crypt())) { throw TypeError::New(Env(), errorStringFromStatus(mongo_crypt())); diff --git a/package.json b/package.json index 5dbaceb..12c925d 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ }, "license": "Apache-2.0", "gypfile": true, - "mongodb:libmongocrypt": "1.12.0", + "mongodb:libmongocrypt": "1.13.0", "dependencies": { "node-addon-api": "^4.3.0", "prebuild-install": "^7.1.3" @@ -96,4 +96,4 @@ "moduleResolution": "node" } } -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index 281570f..d75449a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -54,8 +54,8 @@ export interface MongoCryptContext { finishKMSRequests(): void; finalize(): Buffer; - readonly status: MongoCryptStatus; - readonly state: number; + get status(): MongoCryptStatus; + get state(): number; } type MongoCryptConstructorOptions = { @@ -67,6 +67,8 @@ type MongoCryptConstructorOptions = { cryptSharedLibSearchPaths?: string[]; cryptSharedLibPath?: string; bypassQueryAnalysis?: boolean; + /** TODO(NODE-6793): remove this option and have it always set in the next major */ + enableMultipleCollinfo?: boolean; }; export interface MongoCryptConstructor {