Skip to content

Conversation

@kaylendog
Copy link
Contributor

@kaylendog kaylendog commented Nov 20, 2025

Partially fixes element-hq/element-web#30740. This currently does not work over a session reload, which I intend to introduce in a different PR.

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

@kaylendog kaylendog marked this pull request as ready for review November 26, 2025 13:20
@kaylendog kaylendog requested review from a team as code owners November 26, 2025 13:20
@kaylendog kaylendog requested review from richvdh and removed request for andybalaam November 26, 2025 14:08
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.

A few comments, generally looks good

- Remove `onReceiveToDeviceEvent` from `CryptoBackend`.
- Copy old room key bundle importing logic to
  `preprocessToDeviceEvents`.
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.

a few more comments. Main thing is the inviter param to maybeAcceptKeyBundle.

@kaylendog kaylendog requested a review from richvdh December 8, 2025 12:04
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. Feel free to merge, after addressing the comments

* the inviter's ID.
*
* @param roomId - The room we were invited to, for which we did not receive a key bundle before accepting the invite.
* @param inviterId - The user who invited us to the room and is expected to have sent the room key bundle.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @param inviterId - The user who invited us to the room and is expected to have sent the room key bundle.
* @param inviterId - The user who invited us to the room and is expected to send the room key bundle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f9ea673


/** mapping of room ID -> inviter ID for rooms pending MSC4268 key bundles */
private roomsPendingKeyBundles: Set<string> = new Set();
private readonly roomsPendingKeyBundles: Record<string, string> = {};
Copy link
Member

Choose a reason for hiding this comment

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

generally we try to use Map rather than Record, to avoid any danger of prototype pollution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f9ea673

}
},
(err) => {
this.logger.error(err);
Copy link
Member

Choose a reason for hiding this comment

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

suggest giving a bit more context here, so that the logs are more useful: error attempting to download key bundle for room ${roomId} or so

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f9ea673

@kaylendog kaylendog added this pull request to the merge queue Dec 8, 2025
@kaylendog kaylendog removed this pull request from the merge queue due to a manual request Dec 8, 2025
@kaylendog kaylendog enabled auto-merge December 8, 2025 17:46
@kaylendog kaylendog added this pull request to the merge queue Dec 8, 2025
Merged via the queue into matrix-org:develop with commit fdfddde Dec 8, 2025
28 checks passed
@kaylendog kaylendog deleted the kaylendog/msc4268/pending-bundles branch December 8, 2025 18:11
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.

History sharing doesn't work if the key bundle message arrives after the join

3 participants