Skip to content

fix(rtc-node): send the required key and track SID in E2EE requests - #768

Open
ninglinLiu wants to merge 1 commit into
livekit:mainfrom
ninglinLiu:fix/e2ee-required-fields
Open

ninglinLiu wants to merge 1 commit into
livekit:mainfrom
ninglinLiu:fix/e2ee-required-fields

Conversation

@ninglinLiu

Copy link
Copy Markdown

Fixes the first two defects in #741.

Three E2EE wrappers build FFI requests that leave out a required proto2 field, so encoding the request throws (cannot encode field ... required field not set) and the call can never reach the native side:

  • KeyProvider.setKey(participantIdentity, keyIndex) has no way to pass the key, and SetKeyRequest.key is required. It now takes the key, matching the Python SDK's set_key(participant_identity, key, key_index): setKey(participantIdentity, key, keyIndex). The old signature could not work, so no working caller is affected.
  • FrameCryptor.setEnabled() and FrameCryptor.setKeyIndex() don't send track_sid, which FrameCryptorSetEnabledRequest and FrameCryptorSetKeyIndexRequest both require. FrameCryptor now stores the track SID (as the Python FrameCryptor does), and E2EEManager.frameCryptors() passes in the trackSid the FFI already returns.

The third point in #741 turned out to be on the reporter's side (see their follow-up comment), so it is not part of this PR.

Tests

src/e2ee.test.ts spies on FfiClient.request, encodes each captured request with FfiRequest.toBinary(), and checks that frameCryptors() keeps the track SID. All three tests fail on main and pass with this change. A patch changeset is included.

@changeset-bot

changeset-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 593b012

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@livekit/rtc-node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant