From baa87104569b45dc07a9a7a16d3c7592ab8f4d6b Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Sun, 7 Jun 2020 13:52:27 -0500 Subject: [PATCH] Re-export key identifiers at crate root --- ruma-identifiers/CHANGELOG.md | 2 +- ruma-identifiers/src/lib.rs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ruma-identifiers/CHANGELOG.md b/ruma-identifiers/CHANGELOG.md index 275e87f2..159c9453 100644 --- a/ruma-identifiers/CHANGELOG.md +++ b/ruma-identifiers/CHANGELOG.md @@ -11,7 +11,7 @@ Breaking changes: Improvements: -* Add `DeviceKeyId`, `KeyAlgorithm`, and `ServerKeyId` +* Add `DeviceKeyId`, `DeviceKeyAlgorithm`, `ServerKeyId`, and `ServerKeyAlgorithm` # 0.16.2 diff --git a/ruma-identifiers/src/lib.rs b/ruma-identifiers/src/lib.rs index 17d33b1e..930b2df4 100644 --- a/ruma-identifiers/src/lib.rs +++ b/ruma-identifiers/src/lib.rs @@ -36,6 +36,21 @@ pub mod room_version_id; pub mod server_key_id; pub mod user_id; +/// Allowed algorithms for homeserver signing keys. +pub type DeviceKeyAlgorithm = key_algorithms::DeviceKeyAlgorithm; + +/// An owned device key identifier containing a key algorithm and device ID. +/// +/// Can be created via `TryFrom` and `TryFrom<&str>`; implements `Serialize` +/// and `Deserialize` if the `serde` feature is enabled. +pub type DeviceKeyId = device_key_id::DeviceKeyId>; + +/// A reference to a device key identifier containing a key algorithm and device ID. +/// +/// Can be created via `TryFrom<&str>`; implements `Serialize` and `Deserialize` +/// if the `serde` feature is enabled. +pub type DeviceKeyIdRef<'a> = device_key_id::DeviceKeyId<&'a str>; + /// An owned device ID. /// /// While this is currently just a `String`, that will likely change in the future. @@ -103,6 +118,22 @@ pub type RoomVersionId = room_version_id::RoomVersionId>; /// `Serialize` if the `serde` feature is enabled. pub type RoomVersionIdRef<'a> = room_version_id::RoomVersionId<&'a str>; +/// Allowed algorithms for homeserver signing keys. +pub type ServerKeyAlgorithm = key_algorithms::ServerKeyAlgorithm; + +/// An owned homeserver signing key identifier containing a key algorithm and version. +/// +/// Can be created via `TryFrom` and `TryFrom<&str>`; implements `Serialize` +/// and `Deserialize` if the `serde` feature is enabled. +pub type ServerKeyId = server_key_id::ServerKeyId>; + +/// An reference to a homeserver signing key identifier containing a key +/// algorithm and version. +/// +/// Can be created via `TryFrom<&str>`; implements `Serialize` +/// and `Deserialize` if the `serde` feature is enabled. +pub type ServerKeyIdRef<'a> = server_key_id::ServerKeyId<&'a str>; + /// An owned user ID. /// /// Can be created via `new` (if the `rand` feature is enabled) and `TryFrom` +