mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-12-04 14:21:50 +00:00
refactor: Clean up acquire_keys_as_notary
This commit is contained in:
1 parent
5e971aef3c
commit
a31cbce31e
3 files changed
+135
-173
No files matched your search
@@ -2,7 +2,8 @@ use conduwuit::{
|
||||
Err, Result, matrix::event::gen_event_id_canonical_json, trace, utils::to_canonical_object,
|
||||
};
|
||||
use ruma::{
|
||||
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, ServerName, SigningKeyAlgorithm,
|
||||
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, ServerName, ServerSigningKeyId,
|
||||
SigningKeyAlgorithm,
|
||||
api::federation::discovery::ServerSigningKeys,
|
||||
room_version_rules::RoomVersionRules,
|
||||
serde::{Base64, Raw, base64::Standard},
|
||||
@@ -35,6 +36,17 @@ impl TryFrom<&Raw<ServerSigningKeys>> for IncomingServerKeys {
|
||||
}
|
||||
}
|
||||
|
||||
impl IncomingServerKeys {
|
||||
/// Returns an iterator of every key ID in this key response.
|
||||
pub fn all_key_ids(&self) -> impl Iterator<Item = &ServerSigningKeyId> {
|
||||
self.parsed
|
||||
.verify_keys
|
||||
.keys()
|
||||
.chain(self.parsed.old_verify_keys.keys())
|
||||
.map(|key| &**key)
|
||||
}
|
||||
}
|
||||
|
||||
impl super::Service {
|
||||
/// Validates the incoming event only using locally known verification keys.
|
||||
/// Inserts the calculated event ID into the event_id field upon success.
|
||||
|
||||
Reference in new issue
Block a user