start work on signing

This commit is contained in:
timokoesters 2020-04-06 14:53:34 +02:00
parent 80ddf80f17
commit 9b79798e56
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4
1 changed files with 7 additions and 3 deletions

View File

@ -457,6 +457,9 @@ impl Data {
))
.expect("ruma's reference hashes are correct");
let mut pdu_json = serde_json::to_value(pdu).unwrap();
ruma_signatures::hash_and_sign_event(self.hostname(), self.keypair(), &mut pdu_json);
self.pdu_leaves_replace(&room_id, &pdu.event_id);
// The new value will need a new index. We store the last used index in 'n'
@ -478,9 +481,10 @@ impl Data {
pdu_id.push(0xff); // Add delimiter so we don't find rooms starting with the same id
pdu_id.extend_from_slice(&index.to_be_bytes());
let pdu_json = serde_json::to_string(&pdu).unwrap();
self.db.pduid_pdu.insert(&pdu_id, &*pdu_json).unwrap();
self.db
.pduid_pdu
.insert(&pdu_id, &*serde_json::to_string(&pdu_json).unwrap())
.unwrap();
self.db
.eventid_pduid