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

Add message id for to-device events #1652

Merged
merged 1 commit into from
Dec 8, 2022
Merged

Add message id for to-device events #1652

merged 1 commit into from
Dec 8, 2022

Conversation

Anderas
Copy link
Contributor

@Anderas Anderas commented Dec 7, 2022

Add automatically generated org.matrix.msgid to each to-device message (i.e. per user / device) as described in element-hq/element-meta#558

For context see Android and web implementation.

When sending to-device messages (e.g. room keys) the logs will look like this:

[MXMegolmEncryption] shareKey: Actually share with 2 users and 2 devices
[MXToDevicePayload] Created to-device payload with txnId m2054895014.1, message ids: [@charlie:x.y.z/IYYFXFKAIG 5A07D00E-CB64-4133-A1BB-F9CE1AFD38AA, @bob:x.y.z/CSCLHKJCVN 11C0E404-B0CC-433C-86EA-C883727C4CA7]
[MXHTTPClient] #105 - PUT _matrix/client/r0/sendToDevice/m.room.encrypted/m2054895014.1
[MXHTTPClient] #105 - PUT _matrix/client/r0/sendToDevice/m.room.encrypted/m2054895014.1 completed in 24ms
[MXMegolmEncryption] shareKey: request succeeded

When recieveing to-device messages the logs will look like this:

[MXSession] Received sync response in 50ms
[MXSession] handleSyncResponse: Received 0 joined rooms, 0 invited rooms, 0 left rooms, 1 toDevice events.
[MXSession] handleToDeviceEvents: Processing new to-device event msgid: 47B65E01-AEA2-4761-9E9F-B994A6E7B6D1
[MXSession] handleToDeviceEvents: Received new to-device event `m.room_key` from `@bob:x.y.z` msgid: 47B65E01-AEA2-4761-9E9F-B994A6E7B6D1
[MXMegolmDecryption] onRoomKeyEvent: Adding key for megolm session <id> from m.room_key event

Note that these logs will only work with legacy Crypto, whereas the work-in-progress Crypto V2 needs to make these changes in rust-sdk.

Copy link
Member

@BillCarsonFr BillCarsonFr left a comment

Choose a reason for hiding this comment

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

LGTM

@Anderas Anderas merged commit 47292c5 into develop Dec 8, 2022
@Anderas Anderas deleted the andy/todevice-id branch December 8, 2022 10:54
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