use ruma_macros::IdZst;
#[repr(transparent)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, IdZst)]
#[ruma_id(validate = ruma_identifiers_validation::client_secret::validate)]
pub struct ClientSecret(str);
impl ClientSecret {
#[cfg(feature = "rand")]
#[allow(clippy::new_ret_no_self)]
pub fn new() -> OwnedClientSecret {
let id = uuid::Uuid::new_v4();
ClientSecret::from_borrowed(&id.simple().to_string()).to_owned()
}
}
#[cfg(test)]
mod tests {
use std::convert::TryFrom;
use super::ClientSecret;
#[test]
fn valid_secret() {
assert!(<&ClientSecret>::try_from("this_=_a_valid_secret_1337").is_ok())
}
}