New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verification event improvements #129
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just two small nits:
Oh, also the constructor needs to be updated. As pointed out in the spec PR, it introduced a breaking change in not requiring the |
If you mean in Ruma, probably because the spec says so over here
Why the spec mentions this 🤷. There's some other inconsistency with the events, e.g. the start event has an enum as the content which depends on the verification method ( |
I meant in the spec.
Yeah, I've commented over at the spec PR about maybe not doing the same thing again. EDIT: Actually, in a way this ship has sailed because the MSC says "
This may be just us mirroring the spec, but if it's not and if both events seem equally likely to have method-specific data (or already do), making them uniform would be great! (if one of these does not hold, we may want to re-evaluate) |
Unless some other event type will be used to accept different verification methods I would say that the accept event will as well have method specific data. On the other hand one of the other known methods doesn't use the start event at all, over here. I guess to be on the safe side we should allow method specific data. |
…rt event publicly.
Not sure what the nightly is on about, seems unrelated to my changes. I updated the PR now, hopefully I didn't miss anything. I'll leave the |
@@ -40,7 +41,7 @@ pub struct MSasV1Content { | |||
|
|||
/// The key agreement protocols the sending device understands. | |||
/// | |||
/// Must include at least `curve25519`. | |||
/// Must include at least `Curve25519` or `Curve25519HkdfSha256`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're stricly speaking not compatible with either version of the spec like this, I really like this solution.
return Err(InvalidInput("`key_agreement_protocols` must contain at \ | ||
least `KeyAgreementProtocol::Curve25519` or \ | ||
`KeyAgreementProtocol::Curve25519HkdfSha256`".into())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am surprised rustfmt doesn't complain about this. Can you make it use block indentation since generally the standard formatting for Rust is never visual indentation?
So probably
return Err(InvalidInput("`key_agreement_protocols` must contain at \ | |
least `KeyAgreementProtocol::Curve25519` or \ | |
`KeyAgreementProtocol::Curve25519HkdfSha256`".into())); | |
return Err(InvalidInput( | |
"`key_agreement_protocols` must contain at least \ | |
`KeyAgreementProtocol::Curve25519` or \ | |
`KeyAgreementProtocol::Curve25519HkdfSha256`".into(), | |
)); |
(but maybe if you write that rustfmt changes something up again)
Same for the two error messages below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did complain and I ran cargo fmt
, or am I missing something about this? Github claims that the suggestion is outdated so it's probably fine now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, seems GitHub just showed me an outdated diff 🤦
Yes, just a new clippy lint that was introduced whose suggestion I'll apply separately from this PR :)
👍 |
Rebased and merged, thanks! |
The first commit introduces the new key agreement method, relevant MSC can be found here and the accompanied spec update is here.
The second commit just exposes the content fields of the start event publicly, as the event is otherwise useless to client libraries and clients.