mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 17:44:01 +01:00
Don't assume event has hashes key already
This commit is contained in:
parent
9024a19658
commit
82a6b83524
1 changed files with 2 additions and 0 deletions
|
@ -113,4 +113,6 @@ def add_hashes_and_signatures(event, signature_name, signing_key,
|
||||||
event_json.pop("hashes", None)
|
event_json.pop("hashes", None)
|
||||||
event_json_bytes = encode_canonical_json(event_json)
|
event_json_bytes = encode_canonical_json(event_json)
|
||||||
hashed = hash_algorithm(event_json_bytes)
|
hashed = hash_algorithm(event_json_bytes)
|
||||||
|
if not hasattr(event, "hashes"):
|
||||||
|
event.hashes = {}
|
||||||
event.hashes[hashed.name] = encode_base64(hashed.digest())
|
event.hashes[hashed.name] = encode_base64(hashed.digest())
|
||||||
|
|
Loading…
Reference in a new issue