fix(e2ee): use correct Element Call E2EE parameters

Inline E2EE options had 3 wrong values vs Element Call JS SDK:
- failure_tolerance=-1 (infinite, hid all DEC_FAILED) → 10
- key_ring_size=16 (too small, keys overflow) → 256
- ratchet_window_size=16 (wrong) → 10

Now uses _build_e2ee_options() which was already correct but never called.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-02-22 20:00:55 +02:00
parent c2338fca46
commit e3be4512d9

View File

@@ -261,7 +261,10 @@ def _build_e2ee_options() -> rtc.E2EEOptions:
key_ring_size=256, key_ring_size=256,
key_derivation_function=KDF_HKDF, # Rust FFI applies HKDF; we pass raw base keys key_derivation_function=KDF_HKDF, # Rust FFI applies HKDF; we pass raw base keys
) )
return rtc.E2EEOptions(key_provider_options=key_opts) return rtc.E2EEOptions(
encryption_type=rtc.EncryptionType.GCM,
key_provider_options=key_opts,
)
class VoiceSession: class VoiceSession:
@@ -421,18 +424,9 @@ class VoiceSession:
# E2EE: re-enabled after diagnostic confirmed EC encrypts audio. # E2EE: re-enabled after diagnostic confirmed EC encrypts audio.
# Root cause found: set_key() only applies HKDF if the frame cryptor for that # Root cause found: set_key() only applies HKDF if the frame cryptor for that
# participant already exists. Must call set_key() in on_track_subscribed, not at connect time. # participant already exists. Must call set_key() in on_track_subscribed, not at connect time.
key_opts = rtc.KeyProviderOptions( # Parameters MUST match Element Call JS SDK: ratchetWindowSize=10, keyringSize=256,
shared_key=b"", # per-participant mode # failureTolerance=10, ratchetSalt="LKFrameEncryptionKey".
ratchet_window_size=16, e2ee_opts = _build_e2ee_options()
ratchet_salt=b"LKFrameEncryptionKey",
failure_tolerance=-1,
key_ring_size=16,
key_derivation_function=KDF_HKDF, # Rust applies HKDF matching EC JS SDK
)
e2ee_opts = rtc.E2EEOptions(
encryption_type=rtc.EncryptionType.GCM,
key_provider_options=key_opts,
)
room_opts = rtc.RoomOptions(e2ee=e2ee_opts) room_opts = rtc.RoomOptions(e2ee=e2ee_opts)
self.lk_room = rtc.Room() self.lk_room = rtc.Room()