Skip to main content

arminius_lib_user_keys/
lib.rs

1// SPDX-FileCopyrightText: 2025 BWI GmbH
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! This crate is the central point holding keys logic.
6
7pub mod identity_keys;
8pub mod one_time_keys;
9pub mod signatures;
10pub mod traits;
11
12use ruma::OwnedServerName;
13use serde::{Deserialize, Serialize};
14
15/// Error types for failing server key fetches
16#[derive(Debug, thiserror::Error, Serialize, Deserialize)]
17pub enum FederatedKeyFailureReason {
18	/// Server failed to respond before the timeout
19	#[error("Server failed to respond before the timeout")]
20	TimedOut,
21	/// Server unreachable
22	#[error("Server unreachable")]
23	Unreachable,
24}
25
26/// Contains a federated keys fetching failure.
27///
28/// NOTE: This is used by both the [identity_keys] and the [one_time_keys]
29/// modules, hence why we declare it here as a common place.
30#[derive(Debug, Deserialize, Serialize)]
31pub struct FederatedKeyFailure {
32	/// The server that could not be reached.
33	pub server_name: OwnedServerName,
34	/// An additional context as of why or how it could not be reached.
35	pub reason: FederatedKeyFailureReason,
36}