EncryptionManager class abstract

Attaches AES-GCM end-to-end encryption to RTP senders and receivers.

One manager holds every key for a call and wraps senders and receivers with the native encoded transform.

Usage

final e2ee = EncryptionManager.create(userId: myUserId);
await e2ee.setSharedKey(0, keyBytes); // 16 bytes for AES-128

// Publishing.
await e2ee.encrypt(sender, codec: 'vp8', trackType: E2eeTrackType.video);

// Subscribing. Match the receiver by `track.id`, never by identity.
await e2ee.decrypt(receiver, userId: remoteUserId,
    trackType: E2eeTrackType.video);

Constructors

EncryptionManager.create({required String userId, EncryptionAlgorithm algorithm = EncryptionAlgorithm.aes128Gcm})
Creates a manager that encrypts outgoing frames as userId.
factory

Properties

algorithm EncryptionAlgorithm
The key size this manager was created with.
no setter
events Stream<E2eeEvent>
Diagnostic e2ee.* events for this manager.
no setter
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether dispose has run. A disposed manager rejects every call.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
userId String
The local user id passed to EncryptionManager.create.
no setter

Methods

decrypt(RTCRtpReceiver receiver, {required String userId, E2eeTrackType? trackType}) Future<void>
Decrypts everything receiver delivers from now on.
dispose() Future<void>
Releases the native manager and closes events.
enablePerformanceReporting(bool enabled) Future<void>
Starts or stops periodic e2ee.perf_report events on events.
encrypt(RTCRtpSender sender, {String? codec, E2eeTrackType? trackType}) Future<void>
Encrypts everything sender publishes from now on.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAllKeys(String userId) Future<void>
Drops every key registered for userId.
removeKey(String userId, int keyIndex) Future<void>
Drops the key registered for userId at keyIndex.
removeSharedKey(int keyIndex) Future<void>
Drops the shared key at keyIndex.
requestKeyState() Future<void>
Requests one e2ee.key_state event on events.
setKey(String userId, int keyIndex, Uint8List rawKey) Future<void>
Registers rawKey at keyIndex for a single user.
setSharedKey(int keyIndex, Uint8List rawKey) Future<void>
Registers rawKey at keyIndex for every participant.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

isSupported bool
Whether the running platform can attach encoded transforms.
no setter