@videosdk.live/js-sdk
Version:
<h1 align="center"> <img src="https://cdn.videosdk.live/docs/images/javascript/api_ref/js_api_ref.png"/><br/> </h1>
56 lines (51 loc) • 1.39 kB
TypeScript
/**
* Configuration options for the ExternalE2EEKeyProvider.
*/
export interface E2EEKeyProviderOptions {
/**
* The window size used for key ratcheting.
*
* @default 0
*/
ratchetWindowSize?: number;
/**
* The number of tolerated decryption failures before taking action.
*
* @default -1
*/
failureTolerance?: number;
/**
* Determines whether frames should be discarded when the cryptor is not ready.
*
* @default false
*/
discardFrameWhenCryptorNotReady?: boolean;
}
/**
* Provides end-to-end encryption (E2EE) key management using a shared passphrase
* across all participants.
*/
export class ExternalE2EEKeyProvider {
/**
* Creates a new instance of `ExternalE2EEKeyProvider`.
*
* @param options - Optional configuration settings for the key provider.
*/
constructor(options?: E2EEKeyProviderOptions);
/**
* Sets the shared encryption key used for end-to-end encryption.
*
* @param key - The shared encryption key. Can be a string or an ArrayBuffer.
* @returns A promise that resolves once the key has been successfully set.
*
* @example
* ```ts
* const keyProvider = new ExternalE2EEKeyProvider({
* discardFrameWhenCryptorNotReady: true,
* });
*
* await keyProvider.setSharedKey("<SECRET_KEY>");
* ```
*/
setSharedKey(key: string | ArrayBuffer): Promise<void>;
}