fix(e2ee): add set_shared_key fallback for incoming audio decryption
Rust FFI may not use per-participant key for remote participant decryption in all code paths. Set the caller key as both per-participant AND shared key so either path works for incoming frame decryption. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
6
voice.py
6
voice.py
@@ -269,6 +269,8 @@ class VoiceSession:
|
|||||||
|
|
||||||
# Set caller's key(s) — decrypts incoming audio
|
# Set caller's key(s) — decrypts incoming audio
|
||||||
# Use all collected keys with their correct indices (Element Call may rotate)
|
# Use all collected keys with their correct indices (Element Call may rotate)
|
||||||
|
# Also set as shared key fallback: Rust FFI may not use per-participant
|
||||||
|
# key for remote participants in all code paths.
|
||||||
if self._caller_key:
|
if self._caller_key:
|
||||||
caller_id = remote_identity or self._caller_identity
|
caller_id = remote_identity or self._caller_identity
|
||||||
if caller_id:
|
if caller_id:
|
||||||
@@ -276,6 +278,10 @@ class VoiceSession:
|
|||||||
for idx, key in keys_to_set.items():
|
for idx, key in keys_to_set.items():
|
||||||
kp.set_key(caller_id, key, idx)
|
kp.set_key(caller_id, key, idx)
|
||||||
logger.info("Set caller key[%d] for %s (%d bytes)", idx, caller_id, len(key))
|
logger.info("Set caller key[%d] for %s (%d bytes)", idx, caller_id, len(key))
|
||||||
|
# Shared key fallback: use highest-index caller key
|
||||||
|
max_idx = max(keys_to_set.keys())
|
||||||
|
kp.set_shared_key(keys_to_set[max_idx], max_idx)
|
||||||
|
logger.info("Set shared key fallback[%d] (%d bytes)", max_idx, len(keys_to_set[max_idx]))
|
||||||
else:
|
else:
|
||||||
logger.warning("Have caller key but no caller identity")
|
logger.warning("Have caller key but no caller identity")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user