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

Make callback interactions with ClientSessionDelegate async #4549

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

zzorba
Copy link
Contributor

@zzorba zzorba commented Jan 17, 2025

See issue: #4516

The client we are using the matrix-rust-sdk (react-native) does not offer synchronous access to the system keychain. In order to make this easier, this change adjusts ClientSessionDelegate to be a CallbackInterface with async methods for storing and retrieving. Retrieving is the only on that strictly speaking needs to be async, but it felt like symmetry was warranted here in case the save operation were to fail at the system level.

Public API changes documented in changelogs (optional)
Signed-off-by: Daniel Salinas

@zzorba
Copy link
Contributor Author

zzorba commented Jan 17, 2025

I do not understand the compilation error, it seems to only be flagged in tests, and I can't figure out how to run the failing step locally, making debugging very challenging.

@zzorba zzorba marked this pull request as ready for review January 17, 2025 16:01
@zzorba zzorba requested a review from a team as a code owner January 17, 2025 16:01
@zzorba zzorba requested review from andybalaam and removed request for a team January 17, 2025 16:01
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.40%. Comparing base (2bd8c56) to head (b11f0b7).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/oidc/cross_process.rs 33.33% 2 Missing ⚠️
crates/matrix-sdk/src/oidc/mod.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4549   +/-   ##
=======================================
  Coverage   85.40%   85.40%           
=======================================
  Files         285      285           
  Lines       32213    32216    +3     
=======================================
+ Hits        27511    27514    +3     
  Misses       4702     4702           

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

@jmartinesp
Copy link
Contributor

Maybe it's because the complement-crypto tests use a quite outdated version of UniFFI (0.25.0, if I'm not mistaken). I can confirm just building the usual bindings works fine, but if I run the build_rust_sdk.sh script locally to build the go bindings I get the same error as the CI.

I'm not sure if it's possible to upgrade the go bindings version in the complement-crypto codebase though 🫤 .

@@ -153,9 +154,13 @@ pub trait ClientDelegate: Sync + Send {
}

#[matrix_sdk_ffi_macros::export(callback_interface)]
#[async_trait::async_trait]
Copy link
Member

Choose a reason for hiding this comment

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

Do we still need async_trait with our minimum required version of Rust? I'm not sure.

}
}

struct FfiSaveSessionCallback {
Copy link
Member

Choose a reason for hiding this comment

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

Please, don't use an Ffi prefix for type names. If it collides with the SDK names, you can rename the SDK names while importing names, by adding an Sdk prefix, as we do in other modules of this crate. Thus:

use matrix_sdk::authentication::SaveSessionCallback as SdkSaveSessionCallback;

@Hywan
Copy link
Member

Hywan commented Jan 20, 2025

Forgot to say: Thanks for your contribution!

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.

3 participants