E2E Test: E2E test for end to end encryption.#656
Open
cloudwebrtc wants to merge 5 commits into
Open
Conversation
Contributor
Author
|
@copilot resolve the merge conflicts in this pull request |
…r-end-to-end-encryption # Conflicts: # livekit-rtc/rust-sdks Co-authored-by: cloudwebrtc <17733746+cloudwebrtc@users.noreply.github.com>
Resolved by merging Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add end-to-end tests for E2EE (shared-key and per-participant key modes), and fix several SDK bugs uncovered along the way that prevented the workflows from working at all.
Depends on
E2eeManager::set_enablednot persisting theenabledflag, which causedset_enabled(true)afterset_enabled(false)to be silently dropped. The shared-key test's re-enable step depends on this fix landing and the bundled FFI dylib being rebuilt.New tests
tests/test_e2ee_shared_key.py— publisher + 2 receivers share a key; verifies connect → publish →OKstate → GCM enforced → ratchet →KEY_RATCHETED→ disable →DECRYPTION_FAILED→ re-enable →OK.tests/test_e2ee_per_participant.py— same flow but with three per-identity keys (indexes 0/1/2); adds asetKeyIndexswitch step at the end. Ported from the Darte2ee_per_participant.darttest, with one deviation: step 6 ratchetskey_index=0instead of2, because the Python/Rust frame cryptor defaults to index 0 — ratcheting an unused key would never affect transmitted frames.Both tests skip when
LIVEKIT_URL/LIVEKIT_API_KEY/LIVEKIT_API_SECRETaren't set.Bug fixes
Room.connectcrashed whenshared_key=None(livekit/rtc/room.py)The proto field is optional ("Only specify if you want to use a shared_key"), but
connectassigned it unconditionally →TypeError: expected bytes, NoneType found. Per-participant mode couldn't connect at all. Now only assigned when notNone.E2EEManager.frame_cryptors()sent an empty oneof (livekit/rtc/e2ee.py)Only
room_handlewas set, so FFI returnedInvalidRequest("message is empty"). Addedreq.e2ee.manager_get_frame_cryptors.SetInParent().FrameCryptordroppedtrack_sid(livekit/rtc/e2ee.py)FrameCryptorSet{Enabled,KeyIndex}Requestrequiretrack_sidin the proto, but the Python wrapper neither stored nor sent it →EncodeError: missing required fields: track_sid. Addedtrack_sidto the constructor, populated it frommanager_get_frame_cryptors, and threaded it through bothset_enabledandset_key_index.Test plan
pytest tests/test_e2ee_shared_key.py tests/test_e2ee_per_participant.py -vpasses against a running LiveKit server (both pass locally in ~10s)tests/test_e2ee.pyunit tests still passexamples/e2ee.pyto confirm shared-key path is unaffected