ruma_common/identifiers/
one_time_key_name.rs

1use ruma_macros::IdZst;
2
3use super::{IdParseError, KeyName};
4
5/// The name of a [one-time or fallback key].
6///
7/// One-time and fallback key names in Matrix are completely opaque character sequences. This
8/// type is provided simply for its semantic value.
9///
10/// [one-time or fallback key]: https://spec.matrix.org/latest/client-server-api/#one-time-and-fallback-keys
11#[repr(transparent)]
12#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, IdZst)]
13pub struct OneTimeKeyName(str);
14
15impl KeyName for OneTimeKeyName {
16    fn validate(_s: &str) -> Result<(), IdParseError> {
17        Ok(())
18    }
19}
20
21impl KeyName for OwnedOneTimeKeyName {
22    fn validate(_s: &str) -> Result<(), IdParseError> {
23        Ok(())
24    }
25}