Skip to content
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

feat(ffi): add support for starting and responding to user verification requests #4618

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

stefanceriu
Copy link
Member

This patch expands on the existing device verification flows to add support for verifying users as well.

It does so by:

  • moving incoming request detection to the Client level so that it works for both to-device events as well as timeline ones. The client then forwards the data through the generic process_incoming_verification_request method
  • exposing a new request_user_verification method next to the (renamed) request_device_verification one on the SessionVerificationController
  • consolidating subscription logic within set_ongoing_verification_request
  • overall the mecanisms are very similar which should make it easy to adopt in the final clients

@stefanceriu stefanceriu requested a review from poljar February 4, 2025 13:20
@stefanceriu stefanceriu requested a review from a team as a code owner February 4, 2025 13:20
Copy link

codecov bot commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.73%. Comparing base (d5d9898) to head (6ce266a).
Report is 46 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4618   +/-   ##
=======================================
  Coverage   85.73%   85.73%           
=======================================
  Files         291      291           
  Lines       33323    33325    +2     
=======================================
+ Hits        28570    28572    +2     
  Misses       4753     4753           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I left a couple of nits and it's quite sad that we can't, instead of adding event handlers here, have a higher level stream in the SDK which gives you the Verification object once one gets created.

Maybe one of these days when the OlmMachine doesn't get permanently killed and resurrected. 🥲

@@ -252,13 +252,13 @@ impl Room {
}

pub async fn member(&self, user_id: String) -> Result<RoomMember, ClientError> {
let user_id = UserId::parse(&*user_id).context("Invalid user id.")?;
let user_id = UserId::parse(&*user_id)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a point in removing these? Perhaps it would make sense to have a helper that always applies this context to the UserId parsing step instead of just removing this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked at where UserId::parse was used and noticed there's significantly more without a context than with. Figured I might as well make it consistent.

I'm not sure it's worth wrapping it, I don't think I've ever seen one of these in practice and even if it were to happen the underlying ruma error is clear enough.

@stefanceriu stefanceriu force-pushed the stefan/userVerification branch from fd39193 to 6ce266a Compare February 6, 2025 11:46
@stefanceriu stefanceriu enabled auto-merge (rebase) February 6, 2025 11:46
@stefanceriu stefanceriu merged commit ce44c6e into main Feb 6, 2025
41 checks passed
@stefanceriu stefanceriu deleted the stefan/userVerification branch February 6, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants