Skip to content

Commit 036d901

Browse files
feat(NODE-6297)!: Remove support for explicitly providing CryptoCallbacks (#103)
1 parent 7f0be63 commit 036d901

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/bindings.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export interface IMongoCryptContext {
6464
get state(): number;
6565
}
6666

67+
/**
68+
* All options that can be provided to a C++ MongoCrypt constructor.
69+
*/
6770
export type MongoCryptConstructorOptions = {
6871
kmsProviders?: Uint8Array;
6972
schemaMap?: Uint8Array;
@@ -132,7 +135,7 @@ export type ExplicitEncryptionContextOptions = NonNullable<
132135
Parameters<IMongoCrypt['makeExplicitEncryptionContext']>[1]
133136
>;
134137
export type DataKeyContextOptions = NonNullable<Parameters<IMongoCrypt['makeDataKeyContext']>[1]>;
135-
export type MongoCryptOptions = MongoCryptConstructorOptions;
138+
export type MongoCryptOptions = Omit<MongoCryptConstructorOptions, 'cryptoCallbacks'>;
136139
export type MongoCryptErrorWrapper = MongoCryptOptions['errorWrapper'];
137140

138141
// export const

src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ export class MongoCrypt implements IMongoCrypt {
9696
constructor(options: MongoCryptOptions) {
9797
// Pass in JS cryptoCallbacks implementation by default.
9898
// If the Node.js openssl version is supported this will be ignored.
99-
this.mc = new mc.MongoCrypt(
100-
// @ts-expect-error: intentionally passing in an argument that will throw to preserve existing behavior
101-
options == null || typeof options !== 'object' ? undefined : { cryptoCallbacks, ...options }
102-
);
99+
this.mc = new mc.MongoCrypt({ cryptoCallbacks, ...options });
103100

104101
this.errorWrapper = options.errorWrapper;
105102

0 commit comments

Comments
 (0)