mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-10 11:51:57 +02:00
Sign events we create.
This commit is contained in:
parent
0a8b026ccf
commit
7249785bcb
1 changed files with 9 additions and 0 deletions
|
@ -18,6 +18,8 @@ from synapse.api.errors import LimitExceededError
|
||||||
|
|
||||||
from synapse.util.async import run_on_reactor
|
from synapse.util.async import run_on_reactor
|
||||||
|
|
||||||
|
from synapse.crypto.event_signing import add_hashes_and_signatures
|
||||||
|
|
||||||
class BaseHandler(object):
|
class BaseHandler(object):
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
@ -32,6 +34,9 @@ class BaseHandler(object):
|
||||||
self.clock = hs.get_clock()
|
self.clock = hs.get_clock()
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
|
|
||||||
|
self.signing_key = hs.config.signing_key[0]
|
||||||
|
self.server_name = hs.hostname
|
||||||
|
|
||||||
def ratelimit(self, user_id):
|
def ratelimit(self, user_id):
|
||||||
time_now = self.clock.time()
|
time_now = self.clock.time()
|
||||||
allowed, time_allowed = self.ratelimiter.send_message(
|
allowed, time_allowed = self.ratelimiter.send_message(
|
||||||
|
@ -53,6 +58,10 @@ class BaseHandler(object):
|
||||||
|
|
||||||
yield self.state_handler.annotate_state_groups(event)
|
yield self.state_handler.annotate_state_groups(event)
|
||||||
|
|
||||||
|
yield add_hashes_and_signatures(
|
||||||
|
event, self.server_name, self.signing_key
|
||||||
|
)
|
||||||
|
|
||||||
if not suppress_auth:
|
if not suppress_auth:
|
||||||
yield self.auth.check(event, snapshot, raises=True)
|
yield self.auth.check(event, snapshot, raises=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue