mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-20 14:28:07 -04:00
Fix bugs in generating event signatures and hashing
This commit is contained in:
parent
bab2846513
commit
68698e0ac8
6 changed files with 58 additions and 96 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue