fix: could not verify own events

This commit is contained in:
Timo Kösters 2023-07-15 23:43:25 +02:00
parent c3966f501c
commit 24402312c5
No known key found for this signature in database
GPG key ID: 0B25E636FBA7E4CB

View file

@ -1,5 +1,6 @@
mod data;
pub use data::Data;
use ruma::serde::Base64;
use ruma::{
OwnedDeviceId, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId,
};
@ -316,7 +317,19 @@ impl Service {
&self,
origin: &ServerName,
) -> Result<BTreeMap<OwnedServerSigningKeyId, VerifyKey>> {
self.db.signing_keys_for(origin)
let mut keys = self.db.signing_keys_for(origin)?;
if origin == self.server_name() {
keys.insert(
format!("ed25519:{}", services().globals.keypair().version())
.try_into()
.expect("found invalid server signing keys in DB"),
VerifyKey {
key: Base64::new(self.keypair.public_key().to_vec()),
},
);
}
Ok(keys)
}
pub fn database_version(&self) -> Result<u64> {