summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-03 17:51:42 +0000
committerErik Johnston <erik@matrix.org>2014-11-03 17:51:42 +0000
commit68698e0ac8c39083f6ab7d377a48b5bead3d3598 (patch)
treed2b722e1743d024cf8dcece32f0b8c07fb1bcf0e /synapse/federation
parentMerge branch 'event_signing' of github.com:matrix-org/synapse into federation... (diff)
downloadsynapse-68698e0ac8c39083f6ab7d377a48b5bead3d3598.tar.xz
Fix bugs in generating event signatures and hashing
Diffstat (limited to 'synapse/federation')
-rw-r--r--synapse/federation/pdu_codec.py13
-rw-r--r--synapse/federation/units.py11
2 files changed, 3 insertions, 21 deletions
diff --git a/synapse/federation/pdu_codec.py b/synapse/federation/pdu_codec.py
index 5ec97a698e..52c84efb5b 100644
--- a/synapse/federation/pdu_codec.py
+++ b/synapse/federation/pdu_codec.py
@@ -14,10 +14,6 @@
 # limitations under the License.
 
 from .units import Pdu
-from synapse.crypto.event_signing import (
-    add_event_pdu_content_hash, sign_event_pdu
-)
-from synapse.types import EventID
 
 import copy
 
@@ -49,17 +45,10 @@ class PduCodec(object):
     def pdu_from_event(self, event):
         d = event.get_full_dict()
 
-        if hasattr(event, "state_key"):
-            d["is_state"] = True
-
         kwargs = copy.deepcopy(event.unrecognized_keys)
         kwargs.update({
             k: v for k, v in d.items()
         })
 
-        if "origin_server_ts" not in kwargs:
-            kwargs["origin_server_ts"] = int(self.clock.time_msec())
-
         pdu = Pdu(**kwargs)
-        pdu = add_event_pdu_content_hash(pdu)
-        return sign_event_pdu(pdu, self.server_name, self.signing_key)
+        return pdu
diff --git a/synapse/federation/units.py b/synapse/federation/units.py
index c94dcf64cf..c2d8dca8f3 100644
--- a/synapse/federation/units.py
+++ b/synapse/federation/units.py
@@ -65,8 +65,7 @@ class Pdu(JsonEncodedObject):
         "content",
         "outlier",
         "hashes",
-        "signatures",
-        "is_state",  # Below this are keys valid only for State Pdus.
+        "signatures",  # Below this are keys valid only for State Pdus.
         "state_key",
         "prev_state",
         "required_power_level",
@@ -91,16 +90,10 @@ class Pdu(JsonEncodedObject):
     # TODO: We need to make this properly load content rather than
     # just leaving it as a dict. (OR DO WE?!)
 
-    def __init__(self, destinations=[], is_state=False, prev_events=[],
+    def __init__(self, destinations=[], prev_events=[],
                  outlier=False, hashes={}, signatures={}, **kwargs):
-        if is_state:
-            for required_key in ["state_key"]:
-                if required_key not in kwargs:
-                    raise RuntimeError("Key %s is required" % required_key)
-
         super(Pdu, self).__init__(
             destinations=destinations,
-            is_state=bool(is_state),
             prev_events=prev_events,
             outlier=outlier,
             hashes=hashes,