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` +