From d593007e8bde435c943f4e5fa627c844680c9db0 Mon Sep 17 00:00:00 2001 From: bailey Date: Wed, 1 Oct 2025 11:04:34 -0600 Subject: [PATCH] Remove support for explicitly providing cryptocallbacks --- src/bindings.ts | 5 ++++- src/index.ts | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bindings.ts b/src/bindings.ts index 3971d9c..54ade84 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -64,6 +64,9 @@ export interface IMongoCryptContext { get state(): number; } +/** + * All options that can be provided to a C++ MongoCrypt constructor. + */ export type MongoCryptConstructorOptions = { kmsProviders?: Uint8Array; schemaMap?: Uint8Array; @@ -132,7 +135,7 @@ export type ExplicitEncryptionContextOptions = NonNullable< Parameters[1] >; export type DataKeyContextOptions = NonNullable[1]>; -export type MongoCryptOptions = MongoCryptConstructorOptions; +export type MongoCryptOptions = Omit; export type MongoCryptErrorWrapper = MongoCryptOptions['errorWrapper']; // export const diff --git a/src/index.ts b/src/index.ts index 0cbba09..72447d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -96,10 +96,7 @@ export class MongoCrypt implements IMongoCrypt { constructor(options: MongoCryptOptions) { // Pass in JS cryptoCallbacks implementation by default. // If the Node.js openssl version is supported this will be ignored. - this.mc = new mc.MongoCrypt( - // @ts-expect-error: intentionally passing in an argument that will throw to preserve existing behavior - options == null || typeof options !== 'object' ? undefined : { cryptoCallbacks, ...options } - ); + this.mc = new mc.MongoCrypt({ cryptoCallbacks, ...options }); this.errorWrapper = options.errorWrapper;