events: Drop M
prefix from enum variants
This commit is contained in:
parent
28de60a90a
commit
f179a5c771
@ -2,7 +2,9 @@
|
||||
|
||||
Breaking changes:
|
||||
|
||||
* Fix the name of the qr code scan verification method (`MQrScanShowV1` => `MQrCodeScanV1`)
|
||||
* Rename `key::verification::AcceptMethod::{MSasV1 => SasV1}`
|
||||
* As above, drop `M` prefix from `key::verification::VerificationMethod` variants
|
||||
* Additionally, fix the name of the QR code one (`QrScanShowV1` to `QrCodeScanV1`)
|
||||
|
||||
# 0.22.2
|
||||
|
||||
|
@ -129,22 +129,22 @@ impl TryFrom<RelatesToJsonRepr> for Relation {
|
||||
pub enum VerificationMethod {
|
||||
/// The *m.sas.v1* verification method.
|
||||
#[ruma_enum(rename = "m.sas.v1")]
|
||||
MSasV1,
|
||||
SasV1,
|
||||
|
||||
/// The *m.qr_code.scan.v1* verification method.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[ruma_enum(rename = "m.qr_code.scan.v1")]
|
||||
MQrCodeScanV1,
|
||||
QrCodeScanV1,
|
||||
|
||||
/// The *m.qr_code.show.v1* verification method.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[ruma_enum(rename = "m.qr_code.show.v1")]
|
||||
MQrCodeShowV1,
|
||||
QrCodeShowV1,
|
||||
|
||||
/// The *m.reciprocate.v1* verification method.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[ruma_enum(rename = "m.reciprocate.v1")]
|
||||
MReciprocateV1,
|
||||
ReciprocateV1,
|
||||
|
||||
#[doc(hidden)]
|
||||
_Custom(String),
|
||||
|
@ -74,7 +74,7 @@ impl AcceptEventContent {
|
||||
#[serde(untagged)]
|
||||
pub enum AcceptMethod {
|
||||
/// The *m.sas.v1* verification method.
|
||||
MSasV1(SasV1Content),
|
||||
SasV1(SasV1Content),
|
||||
|
||||
/// Any unknown accept method.
|
||||
Custom(CustomContent),
|
||||
@ -186,7 +186,7 @@ mod tests {
|
||||
fn serialization() {
|
||||
let key_verification_accept_content = AcceptToDeviceEventContent {
|
||||
transaction_id: "456".into(),
|
||||
method: AcceptMethod::MSasV1(SasV1Content {
|
||||
method: AcceptMethod::SasV1(SasV1Content {
|
||||
hash: HashAlgorithm::Sha256,
|
||||
key_agreement_protocol: KeyAgreementProtocol::Curve25519,
|
||||
message_authentication_code: MessageAuthenticationCode::HkdfHmacSha256,
|
||||
@ -251,7 +251,7 @@ mod tests {
|
||||
|
||||
let key_verification_accept_content = AcceptEventContent {
|
||||
relation: Relation { event_id: event_id.clone() },
|
||||
method: AcceptMethod::MSasV1(SasV1Content {
|
||||
method: AcceptMethod::SasV1(SasV1Content {
|
||||
hash: HashAlgorithm::Sha256,
|
||||
key_agreement_protocol: KeyAgreementProtocol::Curve25519,
|
||||
message_authentication_code: MessageAuthenticationCode::HkdfHmacSha256,
|
||||
@ -296,7 +296,7 @@ mod tests {
|
||||
.unwrap(),
|
||||
AcceptToDeviceEventContent {
|
||||
transaction_id,
|
||||
method: AcceptMethod::MSasV1(SasV1Content {
|
||||
method: AcceptMethod::SasV1(SasV1Content {
|
||||
commitment,
|
||||
hash,
|
||||
key_agreement_protocol,
|
||||
@ -336,7 +336,7 @@ mod tests {
|
||||
sender,
|
||||
content: AcceptToDeviceEventContent {
|
||||
transaction_id,
|
||||
method: AcceptMethod::MSasV1(SasV1Content {
|
||||
method: AcceptMethod::SasV1(SasV1Content {
|
||||
commitment,
|
||||
hash,
|
||||
key_agreement_protocol,
|
||||
@ -415,7 +415,7 @@ mod tests {
|
||||
relation: Relation {
|
||||
event_id
|
||||
},
|
||||
method: AcceptMethod::MSasV1(SasV1Content {
|
||||
method: AcceptMethod::SasV1(SasV1Content {
|
||||
commitment,
|
||||
hash,
|
||||
key_agreement_protocol,
|
||||
|
@ -95,7 +95,7 @@ mod tests {
|
||||
let content = ReadyEventContent {
|
||||
from_device: device.clone(),
|
||||
relation: Relation { event_id },
|
||||
methods: vec![VerificationMethod::MSasV1],
|
||||
methods: vec![VerificationMethod::SasV1],
|
||||
};
|
||||
|
||||
assert_eq!(to_json_value(&content).unwrap(), json_data);
|
||||
@ -109,7 +109,7 @@ mod tests {
|
||||
let content = ReadyToDeviceEventContent {
|
||||
from_device: device,
|
||||
transaction_id: "456".to_owned(),
|
||||
methods: vec![VerificationMethod::MSasV1],
|
||||
methods: vec![VerificationMethod::SasV1],
|
||||
};
|
||||
|
||||
assert_eq!(to_json_value(&content).unwrap(), json_data);
|
||||
@ -141,7 +141,7 @@ mod tests {
|
||||
},
|
||||
methods,
|
||||
} if from_device == device
|
||||
&& methods == vec![VerificationMethod::MSasV1]
|
||||
&& methods == vec![VerificationMethod::SasV1]
|
||||
&& event_id == id
|
||||
);
|
||||
|
||||
@ -161,7 +161,7 @@ mod tests {
|
||||
transaction_id,
|
||||
methods,
|
||||
} if from_device == device
|
||||
&& methods == vec![VerificationMethod::MSasV1]
|
||||
&& methods == vec![VerificationMethod::SasV1]
|
||||
&& transaction_id == "456"
|
||||
);
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ fn verification_request_deserialization() {
|
||||
} if body == "@example:localhost is requesting to verify your key, ..."
|
||||
&& to == user_id
|
||||
&& from_device == device_id
|
||||
&& methods.contains(&VerificationMethod::MSasV1)
|
||||
&& methods.contains(&VerificationMethod::SasV1)
|
||||
);
|
||||
}
|
||||
|
||||
@ -339,7 +339,7 @@ fn verification_request_serialization() {
|
||||
let body = "@example:localhost is requesting to verify your key, ...".to_owned();
|
||||
|
||||
let methods = vec![
|
||||
VerificationMethod::MSasV1,
|
||||
VerificationMethod::SasV1,
|
||||
VerificationMethod::_Custom("m.qr_code.show.v1".to_owned()),
|
||||
VerificationMethod::_Custom("m.reciprocate.v1".to_owned()),
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user