diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-10-16 00:09:48 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-10-16 00:09:48 +0100 |
commit | 66104da10c4191aa1e048f2379190574755109e6 (patch) | |
tree | 6b98f50ebaef2b75c78368174ddb939c3e95200e /synapse/federation | |
parent | persist hashes and origin signatures for PDUs (diff) | |
download | synapse-66104da10c4191aa1e048f2379190574755109e6.tar.xz |
Sign outgoing PDUs.
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/pdu_codec.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/federation/pdu_codec.py b/synapse/federation/pdu_codec.py index cef61108dd..bcac5f9ae8 100644 --- a/synapse/federation/pdu_codec.py +++ b/synapse/federation/pdu_codec.py @@ -14,6 +14,7 @@ # limitations under the License. from .units import Pdu +from synapse.crypto.event_signing import hash_event_pdu, sign_event_pdu import copy @@ -33,6 +34,7 @@ def encode_event_id(pdu_id, origin): class PduCodec(object): def __init__(self, hs): + self.signing_key = hs.config.signing_key[0] self.server_name = hs.hostname self.event_factory = hs.get_event_factory() self.clock = hs.get_clock() @@ -99,4 +101,6 @@ class PduCodec(object): if "ts" not in kwargs: kwargs["ts"] = int(self.clock.time_msec()) - return Pdu(**kwargs) + pdu = Pdu(**kwargs) + pdu = hash_event_pdu(pdu) + return sign_event_pdu(pdu, self.server_name, self.signing_key) |