/** * Context encapsulating the cryptography bits required for E2EE. * This uses the WebRTC Insertable Streams API which is explained in * https://github.com/alvestrand/webrtc-media-streams/blob/master/explainer.md * that provides access to the encoded frames and allows them to be transformed. * * The encoded frame format is explained below in the _encodeFunction method. * High level design goals were: * - do not require changes to existing SFUs and retain (VP8) metadata. * - allow the SFU to rewrite SSRCs, timestamp, pictureId. * - allow for the key to be rotated frequently. */ export default class E2EEcontext { /** * Build a new E2EE context instance, which will be used in a given conference. * @param {boolean} [options.sharedKey] - whether there is a uniques key shared amoung all participants. */ constructor({ sharedKey }?: boolean); _worker: Worker; /** * Cleans up all state associated with the given participant. This is needed when a * participant leaves the current conference. * * @param {string} participantId - The participant that just left. */ cleanup(participantId: string): void; /** * Cleans up all state associated with all participants in the conference. This is needed when disabling e2ee. * */ cleanupAll(): void; /** * Handles the given {@code RTCRtpReceiver} by creating a {@code TransformStream} which will inject * a frame decoder. * * @param {RTCRtpReceiver} receiver - The receiver which will get the decoding function injected. * @param {string} kind - The kind of track this receiver belongs to. * @param {string} participantId - The participant id that this receiver belongs to. */ handleReceiver(receiver: RTCRtpReceiver, kind: string, participantId: string): void; /** * Handles the given {@code RTCRtpSender} by creating a {@code TransformStream} which will inject * a frame encoder. * * @param {RTCRtpSender} sender - The sender which will get the encoding function injected. * @param {string} kind - The kind of track this sender belongs to. * @param {string} participantId - The participant id that this sender belongs to. */ handleSender(sender: RTCRtpSender, kind: string, participantId: string): void; /** * Set the E2EE key for the specified participant. * * @param {string} participantId - the ID of the participant who's key we are setting. * @param {Uint8Array | boolean} key - they key for the given participant. * @param {Number} keyIndex - the key index. */ setKey(participantId: string, key: Uint8Array | boolean, keyIndex: number): void; }