events: Rename & hide verification enum Custom variants
This commit is contained in:
parent
349a57ffc7
commit
f4021d0ab0
@ -8,6 +8,8 @@ Breaking changes:
|
||||
* Remove `room::power_level::NotificationPowerLevels`, now found in `ruma_common::power_levels`
|
||||
(or `ruma::power_levels`)
|
||||
* Remove `Custom` variant from event enums. If you were using this, please get in touch.
|
||||
* Remove `Custom` variant from `key::verification::accept::AcceptMethod` and
|
||||
`key::verification::start::StartMethod`.
|
||||
|
||||
# 0.22.2
|
||||
|
||||
|
@ -67,8 +67,7 @@ impl AcceptEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// An enum representing the different method specific
|
||||
/// *m.key.verification.accept* content.
|
||||
/// An enum representing the different method specific *m.key.verification.accept* content.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[serde(untagged)]
|
||||
@ -77,12 +76,14 @@ pub enum AcceptMethod {
|
||||
SasV1(SasV1Content),
|
||||
|
||||
/// Any unknown accept method.
|
||||
Custom(CustomContent),
|
||||
#[doc(hidden)]
|
||||
_Custom(_CustomContent),
|
||||
}
|
||||
|
||||
/// Method specific content of a unknown key verification method.
|
||||
#[doc(hidden)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct CustomContent {
|
||||
pub struct _CustomContent {
|
||||
/// The name of the method.
|
||||
pub method: String,
|
||||
|
||||
@ -177,8 +178,8 @@ mod tests {
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use super::AcceptEventContent;
|
||||
use super::{
|
||||
AcceptMethod, AcceptToDeviceEventContent, CustomContent, HashAlgorithm,
|
||||
KeyAgreementProtocol, MessageAuthenticationCode, SasV1Content, ShortAuthenticationString,
|
||||
AcceptMethod, AcceptToDeviceEventContent, HashAlgorithm, KeyAgreementProtocol,
|
||||
MessageAuthenticationCode, SasV1Content, ShortAuthenticationString, _CustomContent,
|
||||
};
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use crate::key::verification::Relation;
|
||||
@ -232,7 +233,7 @@ mod tests {
|
||||
|
||||
let key_verification_accept_content = AcceptToDeviceEventContent {
|
||||
transaction_id: "456".into(),
|
||||
method: AcceptMethod::Custom(CustomContent {
|
||||
method: AcceptMethod::_Custom(_CustomContent {
|
||||
method: "m.sas.custom".to_owned(),
|
||||
data: vec![("test".to_owned(), JsonValue::from("field"))]
|
||||
.into_iter()
|
||||
@ -377,7 +378,7 @@ mod tests {
|
||||
sender,
|
||||
content: AcceptToDeviceEventContent {
|
||||
transaction_id,
|
||||
method: AcceptMethod::Custom(CustomContent {
|
||||
method: AcceptMethod::_Custom(_CustomContent {
|
||||
method,
|
||||
data,
|
||||
})
|
||||
|
@ -76,8 +76,7 @@ impl StartEventContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// An enum representing the different method specific
|
||||
/// *m.key.verification.start* content.
|
||||
/// An enum representing the different method specific *m.key.verification.start* content.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
#[serde(untagged)]
|
||||
@ -87,19 +86,21 @@ pub enum StartMethod {
|
||||
|
||||
/// The *m.reciprocate.v1* verification method.
|
||||
///
|
||||
/// The spec entry for this method can be found [here][1]
|
||||
/// The spec entry for this method can be found [here][1].
|
||||
///
|
||||
/// [1]: https://spec.matrix.org/unstable/client-server-api/#mkeyverificationstartmreciprocatev1
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
ReciprocateV1(ReciprocateV1Content),
|
||||
|
||||
/// Any unknown start method.
|
||||
Custom(CustomContent),
|
||||
#[doc(hidden)]
|
||||
_Custom(_CustomContent),
|
||||
}
|
||||
|
||||
/// Method specific content of a unknown key verification method.
|
||||
#[doc(hidden)]
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct CustomContent {
|
||||
pub struct _CustomContent {
|
||||
/// The name of the method.
|
||||
pub method: String,
|
||||
|
||||
@ -257,9 +258,9 @@ mod tests {
|
||||
};
|
||||
|
||||
use super::{
|
||||
CustomContent, HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode,
|
||||
SasV1Content, SasV1ContentInit, ShortAuthenticationString, StartMethod,
|
||||
StartToDeviceEventContent,
|
||||
HashAlgorithm, KeyAgreementProtocol, MessageAuthenticationCode, SasV1Content,
|
||||
SasV1ContentInit, ShortAuthenticationString, StartMethod, StartToDeviceEventContent,
|
||||
_CustomContent,
|
||||
};
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
use super::{ReciprocateV1Content, StartEventContent};
|
||||
@ -376,7 +377,7 @@ mod tests {
|
||||
let key_verification_start_content = StartToDeviceEventContent {
|
||||
from_device: "123".into(),
|
||||
transaction_id: "456".into(),
|
||||
method: StartMethod::Custom(CustomContent {
|
||||
method: StartMethod::_Custom(_CustomContent {
|
||||
method: "m.sas.custom".to_owned(),
|
||||
data: vec![("test".to_owned(), JsonValue::from("field"))]
|
||||
.into_iter()
|
||||
@ -565,7 +566,7 @@ mod tests {
|
||||
content: StartToDeviceEventContent {
|
||||
from_device,
|
||||
transaction_id,
|
||||
method: StartMethod::Custom(CustomContent { method, data })
|
||||
method: StartMethod::_Custom(_CustomContent { method, data })
|
||||
}
|
||||
} if from_device == "123"
|
||||
&& sender == user_id!("@example:localhost")
|
||||
|
Loading…
x
Reference in New Issue
Block a user