mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-12 02:50:02 -04:00
Sign outgoing PDUs.
This commit is contained in:
parent
1c445f88f6
commit
66104da10c
9 changed files with 62 additions and 24 deletions
|
@ -15,6 +15,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
from synapse.federation.units import Pdu
|
||||
from synapse.api.events.utils import prune_pdu
|
||||
from syutil.jsonutil import encode_canonical_json
|
||||
from syutil.base64util import encode_base64, decode_base64
|
||||
|
@ -25,8 +26,7 @@ import hashlib
|
|||
|
||||
def hash_event_pdu(pdu, hash_algortithm=hashlib.sha256):
|
||||
hashed = _compute_hash(pdu, hash_algortithm)
|
||||
hashes[hashed.name] = encode_base64(hashed.digest())
|
||||
pdu.hashes = hashes
|
||||
pdu.hashes[hashed.name] = encode_base64(hashed.digest())
|
||||
return pdu
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue