diff --git a/matrix/encryption.py b/matrix/encryption.py index ea731d0..d5f6e08 100644 --- a/matrix/encryption.py +++ b/matrix/encryption.py @@ -409,9 +409,10 @@ class Olm(): } } - to_device_dict["messages"][user] = { - key.device_id: olm_dict - } + if user not in to_device_dict["messages"]: + to_device_dict["messages"][user] = {} + + to_device_dict["messages"][user][key.device_id] = olm_dict return to_device_dict