debug(e2ee): update both shared+per-participant keys on rotation
This commit is contained in:
9
voice.py
9
voice.py
@@ -116,15 +116,18 @@ class VoiceSession:
|
||||
self._caller_all_keys[index] = key
|
||||
logger.info("E2EE key received from %s:%s (index=%d, %d bytes)",
|
||||
sender, device_id, index, len(key))
|
||||
# Live-update shared key when caller rotates (e.g. on bot join) — use
|
||||
# set_shared_key so the shared-key decryption path stays in sync.
|
||||
# Live-update both shared key and per-participant key on rotation.
|
||||
if self.lk_room and hasattr(self.lk_room, 'e2ee_manager'):
|
||||
try:
|
||||
kp = self.lk_room.e2ee_manager.key_provider
|
||||
kp.set_shared_key(key, index)
|
||||
logger.info("Live-updated shared key[%d] (%d bytes)", index, len(key))
|
||||
# Also update per-participant key (belt+suspenders for rotations)
|
||||
caller_id = self._caller_identity or f"{sender}:{device_id}"
|
||||
kp.set_key(caller_id, key, index)
|
||||
logger.info("Live-updated per-participant key[%d] for %s", index, caller_id)
|
||||
except Exception as e:
|
||||
logger.warning("Failed to live-update shared key: %s", e)
|
||||
logger.warning("Failed to live-update caller key: %s", e)
|
||||
|
||||
async def _fetch_encryption_key_http(self) -> bytes | None:
|
||||
"""Fetch encryption key from room timeline (NOT state) via Matrix HTTP API.
|
||||
|
||||
Reference in New Issue
Block a user