summary refs log tree commit diff
path: root/synapse/crypto/event_signing.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-03 11:32:12 +0000
committerErik Johnston <erik@matrix.org>2014-11-03 11:32:12 +0000
commit82a6b83524ed2f7cb12bd2fc43a2651558c392dd (patch)
tree99f88ab3ad30bc4819bd57d233dd043c90e172de /synapse/crypto/event_signing.py
parentRemove dead code. (diff)
downloadsynapse-82a6b83524ed2f7cb12bd2fc43a2651558c392dd.tar.xz
Don't assume event has hashes key already
Diffstat (limited to '')
-rw-r--r--synapse/crypto/event_signing.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/crypto/event_signing.py b/synapse/crypto/event_signing.py
index cb2db01c04..0e8bc7eb6c 100644
--- a/synapse/crypto/event_signing.py
+++ b/synapse/crypto/event_signing.py
@@ -113,4 +113,6 @@ def add_hashes_and_signatures(event, signature_name, signing_key,
     event_json.pop("hashes", None)
     event_json_bytes = encode_canonical_json(event_json)
     hashed = hash_algorithm(event_json_bytes)
+    if not hasattr(event, "hashes"):
+        event.hashes = {}
     event.hashes[hashed.name] = encode_base64(hashed.digest())