matrix-org / matrix-org/matrix-rust-sdk
Migrate the session to use MAS if the homeserver has been migrated.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
Following the migration of matrix.org to use MAS it has become apparent that the SDK also needs to do some work to migrate the Session too. A visible result of this is that in Element X, only new logins against matrix.org show the Manage Account/Manage Devices buttons in settings. Following this through in the code:
When creating a Session the existing auth_api is used to set some oidc_data that is stored:
Then when restoring that Session the presence of some oidc_data determines which auth_api is used in the new Client instance.
This means that when checking for the account_url, the wrong auth type is present and so no requests can be made to fetch it:
Furthermore, the API is used in a few places to determine whether requests are sent to the homeserver or the authentication server. For example, the logout function will still send the request to the homeserver when it should be sending this to the authentication server:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bindings/matrix-sdk-ffi/src/client.rs at the Session creation and restoration paths around lines 1620-1659 and 1680-1706, then inspect the account_url check around lines 617-619. Trace how the restored auth_api is selected and compare it with crates/matrix-sdk/src/client/mod.rs around lines 1334-1340. Done means migrated sessions use the appropriate authentication server for account URL lookup and logout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100