diff --git a/src/client-side-encryption/providers/index.ts b/src/client-side-encryption/providers/index.ts index 54f4366f6f..f254cf69f9 100644 --- a/src/client-side-encryption/providers/index.ts +++ b/src/client-side-encryption/providers/index.ts @@ -1,3 +1,4 @@ +import type { Binary } from '../../bson'; import { loadAWSCredentials } from './aws'; import { loadAzureCredentials } from './azure'; import { loadGCPCredentials } from './gcp'; @@ -39,7 +40,7 @@ export interface LocalKMSProviderConfiguration { * The master key used to encrypt/decrypt data keys. * A 96-byte long Buffer or base64 encoded string. */ - key: Buffer | string; + key: Binary | Uint8Array | string; } /** @public */ diff --git a/test/types/client-side-encryption.test-d.ts b/test/types/client-side-encryption.test-d.ts index 53e4060aa2..87c9d46a34 100644 --- a/test/types/client-side-encryption.test-d.ts +++ b/test/types/client-side-encryption.test-d.ts @@ -9,7 +9,7 @@ import type { KMSProviders, RangeOptions } from '../..'; -import type { ClientEncryptionDataKeyProvider } from '../mongodb'; +import { Binary, type ClientEncryptionDataKeyProvider } from '../mongodb'; type RequiredCreateEncryptedCollectionSettings = Parameters< ClientEncryption['createEncryptedCollection'] @@ -51,6 +51,10 @@ expectAssignable({ { // KMSProviders + // local + expectAssignable({ key: '' }); + expectAssignable({ key: Buffer.alloc(0) }); + expectAssignable({ key: Binary.createFromBase64('') }); // aws expectAssignable({ accessKeyId: '', secretAccessKey: '' }); expectAssignable({