mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-12-28 21:43:47 +03:00
fix: could not verify own events
This commit is contained in:
parent
c3966f501c
commit
24402312c5
1 changed files with 14 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
mod data;
|
mod data;
|
||||||
pub use data::Data;
|
pub use data::Data;
|
||||||
|
use ruma::serde::Base64;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
OwnedDeviceId, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId,
|
OwnedDeviceId, OwnedEventId, OwnedRoomId, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId,
|
||||||
};
|
};
|
||||||
|
@ -316,7 +317,19 @@ impl Service {
|
||||||
&self,
|
&self,
|
||||||
origin: &ServerName,
|
origin: &ServerName,
|
||||||
) -> Result<BTreeMap<OwnedServerSigningKeyId, VerifyKey>> {
|
) -> 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> {
|
pub fn database_version(&self) -> Result<u64> {
|
||||||
|
|
Loading…
Reference in a new issue