mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-02-17 13:14:19 -05:00
client: Decrypt to-device events from the client sync stream.
This commit is contained in:
parent
e2497bca38
commit
d38825704d
@ -26,12 +26,14 @@ from nio import (
|
|||||||
ClientConfig,
|
ClientConfig,
|
||||||
EncryptionError,
|
EncryptionError,
|
||||||
Event,
|
Event,
|
||||||
|
ToDeviceEvent,
|
||||||
KeysQueryResponse,
|
KeysQueryResponse,
|
||||||
KeyVerificationEvent,
|
KeyVerificationEvent,
|
||||||
KeyVerificationKey,
|
KeyVerificationKey,
|
||||||
KeyVerificationMac,
|
KeyVerificationMac,
|
||||||
KeyVerificationStart,
|
KeyVerificationStart,
|
||||||
LocalProtocolError,
|
LocalProtocolError,
|
||||||
|
OlmEvent,
|
||||||
MegolmEvent,
|
MegolmEvent,
|
||||||
RoomContextError,
|
RoomContextError,
|
||||||
RoomEncryptedMedia,
|
RoomEncryptedMedia,
|
||||||
@ -812,6 +814,17 @@ class PanClient(AsyncClient):
|
|||||||
Returns the json response with decrypted events.
|
Returns the json response with decrypted events.
|
||||||
"""
|
"""
|
||||||
logger.info("Decrypting sync")
|
logger.info("Decrypting sync")
|
||||||
|
|
||||||
|
for event in body["to_device"]["events"]:
|
||||||
|
if event["type"] != "m.room.encrypted":
|
||||||
|
continue
|
||||||
|
event = ToDeviceEvent.parse_encrypted_event(event)
|
||||||
|
|
||||||
|
if not isinstance(event, OlmEvent):
|
||||||
|
continue
|
||||||
|
|
||||||
|
self.olm.handle_to_device_event(event)
|
||||||
|
|
||||||
for room_id, room_dict in body["rooms"]["join"].items():
|
for room_id, room_dict in body["rooms"]["join"].items():
|
||||||
try:
|
try:
|
||||||
if not self.rooms[room_id].encrypted:
|
if not self.rooms[room_id].encrypted:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user