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

Element-R: wire up device lists #3272

Merged
merged 24 commits into from
Apr 21, 2023

Conversation

florianduros
Copy link
Contributor

@florianduros florianduros commented Apr 12, 2023

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Related to element-hq/element-web#24833

The MatrixClient.downloadKeys and MatrixClient.getStoredDevicesForUser methods are not available for the new crypto. Following the idea in element-hq/element-web#24833 to add a new method getUserDeviceInfo to the crypto API.

Instead of changing the existing downloadKeys and getStoredDevicesForUser for both crypto and changing their behaviors, a new method getUserDeviceInfo is also added to the crypto-api.

This method has the following behavior:

  1. Check if the users are currently tracked
  2. If they are not tracked and downloadUncached is at true (in order to get the devices of theses untracked users)
    • old crypto downloadKeys is called (which is calling /keys/query later)
    • new crypto make a request to /keys/query
  3. Do a device conversion (DeviceInfo, QueryDevice, RustSdkCryptoJs.Device ) to a unique new Device class
  4. Return the content in maps

Here's what your changelog entry will look like:

✨ Features

@florianduros florianduros force-pushed the florianduros/feat/wire-up-device-list branch from 47f45dc to 1c8a1cc Compare April 13, 2023 15:03
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

Thanks florian! Looks great but a few suggestions...

src/crypto-api.ts Show resolved Hide resolved
src/models/device.ts Outdated Show resolved Hide resolved
src/models/device.ts Show resolved Hide resolved
src/models/device.ts Show resolved Hide resolved
src/crypto/device-converter.ts Outdated Show resolved Hide resolved
src/crypto/index.ts Outdated Show resolved Hide resolved
src/rust-crypto/rust-crypto.ts Outdated Show resolved Hide resolved
src/rust-crypto/rust-crypto.ts Outdated Show resolved Hide resolved
src/rust-crypto/rust-crypto.ts Outdated Show resolved Hide resolved
src/rust-crypto/device-converter.ts Outdated Show resolved Hide resolved
@florianduros florianduros force-pushed the florianduros/feat/wire-up-device-list branch from 529b9d4 to 2b57d0e Compare April 21, 2023 12:46
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm otherwise

src/crypto-api.ts Outdated Show resolved Hide resolved
src/models/device.ts Outdated Show resolved Hide resolved
src/crypto/device-converter.ts Outdated Show resolved Hide resolved
@florianduros florianduros enabled auto-merge April 21, 2023 13:56
@florianduros florianduros added this pull request to the merge queue Apr 21, 2023
Merged via the queue into develop with commit fbb1c4b Apr 21, 2023
@florianduros florianduros deleted the florianduros/feat/wire-up-device-list branch April 21, 2023 14:16
richvdh added a commit to matrix-org/matrix-react-sdk that referenced this pull request May 8, 2023
matrix-org/matrix-js-sdk#3272 added a new
`CryptoApi.getUserDeviceInfo` method, which also works with rust crypto. Update
DeviceListener to use it, thus making many of the cypress tests work on Element
Web R.
richvdh added a commit to matrix-org/matrix-react-sdk that referenced this pull request May 8, 2023
matrix-org/matrix-js-sdk#3272 added a new
`CryptoApi.getUserDeviceInfo` method, which also works with rust crypto. Update
DeviceListener to use it, thus making many of the cypress tests work on Element
Web R.
github-merge-queue bot pushed a commit to matrix-org/matrix-react-sdk that referenced this pull request May 9, 2023
* DeviceListener: use new `getUserDeviceInfo` method

matrix-org/matrix-js-sdk#3272 added a new
`CryptoApi.getUserDeviceInfo` method, which also works with rust crypto. Update
DeviceListener to use it, thus making many of the cypress tests work on Element
Web R.

* add missing await

... mostly to silence the quality gate
su-ex added a commit to SchildiChat/matrix-js-sdk that referenced this pull request Jul 31, 2023
* Deprecate MatrixClient::resolveRoomAlias ([\matrix-org#3316](matrix-org#3316)).
* add client method to remove pusher ([\matrix-org#3324](matrix-org#3324)). Contributed by @kerryarchibald.
* Implement MSC 3981 ([\matrix-org#3248](matrix-org#3248)). Fixes element-hq/element-web#25021. Contributed by @justjanne.
* Added `Room.getLastLiveEvent` and `Room.getLastThread`. Deprecated `Room.lastThread` in favour of `Room.getLastThread`. ([\matrix-org#3321](matrix-org#3321)).
* Element-R: wire up device lists ([\matrix-org#3272](matrix-org#3272)). Contributed by @florianduros.
* Node 20 support ([\matrix-org#3302](matrix-org#3302)).
* Fix racing between one-time-keys processing and sync ([\matrix-org#3327](matrix-org#3327)). Fixes element-hq/element-web#25214. Contributed by @florianduros.
* Fix lack of media when a user reconnects ([\matrix-org#3318](matrix-org#3318)).
* Fix TimelineWindow getEvents exploding if no neigbouring timeline ([\matrix-org#3285](matrix-org#3285)). Fixes element-hq/element-web#25104.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants