summary refs log tree commit diff
path: root/synapse/storage/signatures.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-04 11:27:59 +0000
committerErik Johnston <erik@matrix.org>2014-12-04 11:27:59 +0000
commit5d7c9ab7898f2721aa3f60ab76c53dc44322be77 (patch)
tree7a6209af97b35e8d62db575327217c23592e68af /synapse/storage/signatures.py
parentWIP for new way of managing events. (diff)
downloadsynapse-5d7c9ab7898f2721aa3f60ab76c53dc44322be77.tar.xz
Begin converting things to use the new Event structure
Diffstat (limited to 'synapse/storage/signatures.py')
-rw-r--r--synapse/storage/signatures.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/storage/signatures.py b/synapse/storage/signatures.py
index eea4f21065..e2f11c7ffc 100644
--- a/synapse/storage/signatures.py
+++ b/synapse/storage/signatures.py
@@ -15,6 +15,8 @@
 
 from _base import SQLBaseStore
 
+from syutil.base64util import encode_base64
+
 
 class SignatureStore(SQLBaseStore):
     """Persistence for event signatures and hashes"""
@@ -67,6 +69,20 @@ class SignatureStore(SQLBaseStore):
             f
         )
 
+    def add_event_hashes(self, event_ids):
+        hashes = yield self.store.get_event_reference_hashes(
+            event_ids
+        )
+        hashes = [
+            {
+                k: encode_base64(v) for k, v in h.items()
+                if k == "sha256"
+            }
+            for h in hashes
+        ]
+
+        defer.returnValue(zip(event_ids, hashes))
+
     def _get_event_reference_hashes_txn(self, txn, event_id):
         """Get all the hashes for a given PDU.
         Args: