Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ jobs:
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
run: |
source .test-venv/bin/activate
pytest tests/
pytest tests/ livekit-rtc/tests/

- name: Run tests (Windows)
if: runner.os == 'Windows'
env:
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
run: .test-venv\Scripts\python.exe -m pytest tests/
run: .test-venv\Scripts\python.exe -m pytest tests/ livekit-rtc/tests/
shell: pwsh

298 changes: 148 additions & 150 deletions livekit-rtc/livekit/rtc/_proto/room_pb2.py

Large diffs are not rendered by default.

42 changes: 3 additions & 39 deletions livekit-rtc/livekit/rtc/_proto/room_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion livekit-rtc/livekit/rtc/e2ee.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,28 @@ def ratchet_key(self, participant_identity: str, key_index: int) -> bytes:


class FrameCryptor:
def __init__(self, room_handle: int, participant_identity: str, key_index: int, enabled: bool):
def __init__(
self,
room_handle: int,
participant_identity: str,
track_sid: str,
key_index: int,
enabled: bool,
):
self._room_handle = room_handle
self._enabled = enabled
self._participant_identity = participant_identity
self._track_sid = track_sid
self._key_index = key_index

@property
def participant_identity(self) -> str:
return self._participant_identity

@property
def track_sid(self) -> str:
return self._track_sid

@property
def key_index(self) -> int:
return self._key_index
Expand All @@ -218,6 +230,7 @@ def set_enabled(self, enabled: bool) -> None:
req = proto_ffi.FfiRequest()
req.e2ee.room_handle = self._room_handle
req.e2ee.cryptor_set_enabled.participant_identity = self._participant_identity
req.e2ee.cryptor_set_enabled.track_sid = self._track_sid
req.e2ee.cryptor_set_enabled.enabled = enabled
FfiClient.instance.request(req)

Expand All @@ -236,6 +249,7 @@ def set_key_index(self, key_index: int) -> None:
req = proto_ffi.FfiRequest()
req.e2ee.room_handle = self._room_handle
req.e2ee.cryptor_set_key_index.participant_identity = self._participant_identity
req.e2ee.cryptor_set_key_index.track_sid = self._track_sid
req.e2ee.cryptor_set_key_index.key_index = key_index
FfiClient.instance.request(req)

Expand Down Expand Up @@ -289,6 +303,7 @@ def frame_cryptors(self) -> List[FrameCryptor]:
"""
req = proto_ffi.FfiRequest()
req.e2ee.room_handle = self._room_handle
req.e2ee.manager_get_frame_cryptors.SetInParent()

resp = FfiClient.instance.request(req)
frame_cryptors = []
Expand All @@ -297,6 +312,7 @@ def frame_cryptors(self) -> List[FrameCryptor]:
FrameCryptor(
self._room_handle,
frame_cryptor.participant_identity,
frame_cryptor.track_sid,
frame_cryptor.key_index,
frame_cryptor.enabled,
)
Expand Down
14 changes: 8 additions & 6 deletions livekit-rtc/livekit/rtc/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,10 @@ def on_participant_connected(participant):
)

req.connect.options.e2ee.encryption_type = options.e2ee.encryption_type
req.connect.options.e2ee.key_provider_options.shared_key = (
options.e2ee.key_provider_options.shared_key # type: ignore
)
if options.e2ee.key_provider_options.shared_key is not None:
req.connect.options.e2ee.key_provider_options.shared_key = (
options.e2ee.key_provider_options.shared_key
)
req.connect.options.e2ee.key_provider_options.ratchet_salt = (
options.e2ee.key_provider_options.ratchet_salt
)
Expand All @@ -487,9 +488,10 @@ def on_participant_connected(participant):

if options.encryption:
req.connect.options.encryption.encryption_type = options.encryption.encryption_type
req.connect.options.encryption.key_provider_options.shared_key = (
options.encryption.key_provider_options.shared_key # type: ignore
)
if options.encryption.key_provider_options.shared_key is not None:
req.connect.options.encryption.key_provider_options.shared_key = (
options.encryption.key_provider_options.shared_key
)
req.connect.options.encryption.key_provider_options.ratchet_salt = (
options.encryption.key_provider_options.ratchet_salt
)
Expand Down
Loading