Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -132,7 +135,7 @@ export type ExplicitEncryptionContextOptions = NonNullable<
Parameters<IMongoCrypt['makeExplicitEncryptionContext']>[1]
>;
export type DataKeyContextOptions = NonNullable<Parameters<IMongoCrypt['makeDataKeyContext']>[1]>;
export type MongoCryptOptions = MongoCryptConstructorOptions;
export type MongoCryptOptions = Omit<MongoCryptConstructorOptions, 'cryptoCallbacks'>;
export type MongoCryptErrorWrapper = MongoCryptOptions['errorWrapper'];

// export const
5 changes: 1 addition & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down