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