Skip to content

Commit 0376041

Browse files
committed
Deprecate e2ee options
1 parent edc9ecc commit 0376041

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

livekit-rtc/livekit/rtc/room.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import logging
2020
from dataclasses import dataclass, field
2121
from typing import Callable, Dict, Literal, Optional, cast, Mapping
22+
import warnings
2223

2324
from .event_emitter import EventEmitter
2425
from ._ffi_client import FfiClient, FfiHandle
@@ -98,6 +99,8 @@ class RoomOptions:
9899
"""Automatically subscribe to tracks when participants join."""
99100
dynacast: bool = False
100101
e2ee: E2EEOptions | None = None
102+
"""Deprecated, use `encryption` field instead"""
103+
encryption: E2EEOptions | None = None
101104
"""Options for end-to-end encryption."""
102105
rtc_config: RtcConfiguration | None = None
103106
"""WebRTC-related configuration."""
@@ -422,6 +425,12 @@ def on_participant_connected(participant):
422425
req.connect.options.dynacast = options.dynacast
423426

424427
if options.e2ee:
428+
warnings.warn(
429+
"options.e2ee is deprecated, use options.encryption instead",
430+
DeprecationWarning,
431+
stacklevel=2,
432+
)
433+
425434
req.connect.options.e2ee.encryption_type = options.e2ee.encryption_type
426435
req.connect.options.e2ee.key_provider_options.shared_key = (
427436
options.e2ee.key_provider_options.shared_key # type: ignore
@@ -436,6 +445,21 @@ def on_participant_connected(participant):
436445
options.e2ee.key_provider_options.ratchet_window_size
437446
)
438447

448+
if options.encryption:
449+
req.connect.options.encryption.encryption_type = options.encryption.encryption_type
450+
req.connect.options.encryption.key_provider_options.shared_key = (
451+
options.encryption.key_provider_options.shared_key # type: ignore
452+
)
453+
req.connect.options.encryption.key_provider_options.ratchet_salt = (
454+
options.encryption.key_provider_options.ratchet_salt
455+
)
456+
req.connect.options.encryption.key_provider_options.failure_tolerance = (
457+
options.encryption.key_provider_options.failure_tolerance
458+
)
459+
req.connect.options.encryption.key_provider_options.ratchet_window_size = (
460+
options.encryption.key_provider_options.ratchet_window_size
461+
)
462+
439463
if options.rtc_config:
440464
req.connect.options.rtc_config.ice_transport_type = (
441465
options.rtc_config.ice_transport_type

0 commit comments

Comments
 (0)