events: Add support for MSC3783 in the key verification events

This commit is contained in:
Damir Jelić 2022-11-09 16:45:24 +01:00 committed by GitHub
parent 05356d7d4e
commit 6d133971b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View File

@ -42,6 +42,7 @@ unstable-msc3551 = ["unstable-msc1767"]
unstable-msc3552 = ["unstable-msc3551"]
unstable-msc3553 = ["unstable-msc3552"]
unstable-msc3554 = ["unstable-msc1767"]
unstable-msc3783 = []
unstable-pdu = []
unstable-sanitize = ["dep:html5ever", "dep:phf"]
unstable-unspecified = []

View File

@ -58,6 +58,11 @@ pub enum MessageAuthenticationCode {
/// The HKDF-HMAC-SHA256 MAC.
HkdfHmacSha256,
/// The second version of the HKDF-HMAC-SHA256 MAC.
#[cfg(feature = "unstable-msc3783")]
#[ruma_enum(rename = "org.matrix.msc3783.hkdf-hmac-sha256")]
HkdfHmacSha256V2,
/// The HMAC-SHA256 MAC.
HmacSha256,
@ -158,4 +163,15 @@ mod tests {
assert_eq!(serialized, "\"hmac-sha256\"");
assert_eq!(deserialized, MessageAuthenticationCode::HmacSha256);
}
#[test]
#[cfg(feature = "unstable-msc3783")]
fn serialize_mac_method_msc3783() {
let serialized =
serde_json::to_string(&MessageAuthenticationCode::HkdfHmacSha256V2).unwrap();
let deserialized: MessageAuthenticationCode = serde_json::from_str(&serialized).unwrap();
assert_eq!(serialized, "\"org.matrix.msc3783.hkdf-hmac-sha256\"");
assert_eq!(deserialized, MessageAuthenticationCode::HkdfHmacSha256V2);
}
}

View File

@ -150,6 +150,7 @@ unstable-msc3554 = ["ruma-common/unstable-msc3554"]
unstable-msc3575 = ["ruma-client-api?/unstable-msc3575"]
unstable-msc3618 = ["ruma-federation-api?/unstable-msc3618"]
unstable-msc3723 = ["ruma-federation-api?/unstable-msc3723"]
unstable-msc3783 = ["ruma-common/unstable-msc3783"]
unstable-pdu = ["ruma-common/unstable-pdu"]
unstable-sanitize = ["ruma-common/unstable-sanitize"]
unstable-unspecified = [
@ -185,6 +186,7 @@ __ci = [
"unstable-msc3575",
"unstable-msc3618",
"unstable-msc3723",
"unstable-msc3783",
]
[dependencies]