summary refs log tree commit diff
path: root/synapse/storage/signatures.py
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2014-11-13 11:58:54 +0200
committerMatthew Hodgson <matthew@matrix.org>2014-11-13 11:58:54 +0200
commit28408a9f64dc889078711b0e2bae5cff4c90c91e (patch)
tree35ea17e51de82925f171bb15d4b9876d67b3bf9c /synapse/storage/signatures.py
parentvarious fixes based on truphone feedback (diff)
parentDetect OpenWebRTC and add workarounds, but comment out the turn server remova... (diff)
downloadsynapse-28408a9f64dc889078711b0e2bae5cff4c90c91e.tar.xz
Merge branch 'develop' of git+ssh://github.com/matrix-org/synapse into develop
Diffstat (limited to 'synapse/storage/signatures.py')
-rw-r--r--synapse/storage/signatures.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/synapse/storage/signatures.py b/synapse/storage/signatures.py
index 84a49088a2..d90e08fff1 100644
--- a/synapse/storage/signatures.py
+++ b/synapse/storage/signatures.py
@@ -103,24 +103,30 @@ class SignatureStore(SQLBaseStore):
             or_ignore=True,
         )
 
-
-    def _get_event_origin_signatures_txn(self, txn, event_id):
+    def _get_event_signatures_txn(self, txn, event_id):
         """Get all the signatures for a given PDU.
         Args:
             txn (cursor):
             event_id (str): Id for the Event.
         Returns:
-            A dict of key_id -> signature_bytes.
+            A dict of sig name -> dict(key_id -> signature_bytes)
         """
         query = (
-            "SELECT key_id, signature"
-            " FROM event_origin_signatures"
+            "SELECT signature_name, key_id, signature"
+            " FROM event_signatures"
             " WHERE event_id = ? "
         )
         txn.execute(query, (event_id, ))
-        return dict(txn.fetchall())
+        rows = txn.fetchall()
+
+        res = {}
+
+        for name, key, sig in rows:
+            res.setdefault(name, {})[key] = sig
+
+        return res
 
-    def _store_event_origin_signature_txn(self, txn, event_id, origin, key_id,
+    def _store_event_signature_txn(self, txn, event_id, signature_name, key_id,
                                           signature_bytes):
         """Store a signature from the origin server for a PDU.
         Args:
@@ -132,10 +138,10 @@ class SignatureStore(SQLBaseStore):
         """
         self._simple_insert_txn(
             txn,
-            "event_origin_signatures",
+            "event_signatures",
             {
                 "event_id": event_id,
-                "origin": origin,
+                "signature_name": signature_name,
                 "key_id": key_id,
                 "signature": buffer(signature_bytes),
             },