Skip to main content

tuwunel_admin/debug/
verify_pdu.rs

1use ruma::{OwnedEventId, signatures::Verified};
2use tuwunel_core::Result;
3
4use crate::admin_command;
5
6#[admin_command]
7pub(super) async fn verify_pdu(&self, event_id: OwnedEventId) -> Result {
8	let mut event = self
9		.services
10		.timeline
11		.get_pdu_json(&event_id)
12		.await?;
13
14	event.remove("event_id");
15	let msg = match self
16		.services
17		.server_keys
18		.verify_event(&event, None)
19		.await?
20	{
21		| Verified::Signatures => "signatures OK, but content hash failed (redaction).",
22		| Verified::All => "signatures and hashes OK.",
23	};
24
25	self.write_str(msg).await
26}