summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-03-28 11:34:37 +0100
committerErik Johnston <erik@matrix.org>2017-03-28 11:34:37 +0100
commit58a35366be4e9a56c6655972af5f26462a867f36 (patch)
tree129cfe6089966e82cad4ffe7cf74bbeea0ca4a94 /synapse
parentRaise a more helpful exception (diff)
downloadsynapse-58a35366be4e9a56c6655972af5f26462a867f36.tar.xz
The algorithm is part of the key id
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/end_to_end_keys.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/storage/end_to_end_keys.py b/synapse/storage/end_to_end_keys.py
index 85340746c7..b746f74269 100644
--- a/synapse/storage/end_to_end_keys.py
+++ b/synapse/storage/end_to_end_keys.py
@@ -144,14 +144,14 @@ class EndToEndKeyStore(SQLBaseStore):
         )
 
         existing_key_map = {
-            row["key_id"]: (row["algorithm"], row["key_json"]) for row in rows
+            (row["algorithm"], row["key_id"]): row["key_json"] for row in rows
         }
 
         new_keys = []  # Keys that we need to insert
         for algorithm, key_id, json_bytes in key_list:
-            if key_id in existing_key_map:
-                ex_algo, ex_bytes = existing_key_map[key_id]
-                if algorithm != ex_algo or json_bytes != ex_bytes:
+            if (algorithm, key_id) in existing_key_map:
+                ex_bytes = existing_key_map[key_id]
+                if json_bytes != ex_bytes:
                     raise SynapseError(
                         400, "One time key with key_id %r already exists" % (key_id,)
                     )