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 support for native E2E #186

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

Add support for native E2E #186

wants to merge 12 commits into from

Conversation

Half-Shot
Copy link
Contributor

@Half-Shot Half-Shot commented Jan 14, 2022

Fixes #185

This PR adds support for the new native E2E built into the bot-sdk, which removes the need for pan. I've tested this works locally, but it's not extensively battle tested. I've also:

  • Kept the pan config, but added a check to avoid trying to use pan and this feature concurrrently.
  • Changed the README to recommend admins use this feature, as it's easier to setup.

This could potentially be enabled by default, but I didn't want to change things for existing users.

I cribbed from https://github.com/turt2live/matrix-bot-sdk/blob/master/examples/encryption_bot.ts when writing this code.

@Half-Shot
Copy link
Contributor Author

The test failures are due to matrix-bot-sdk now depending on Node 14+ or greater, I am not sure how comfortable you folks are with increasing the minimum node version, but 12 is due to be EOL by April this year anyway..

@Yoric
Copy link
Contributor

Yoric commented Jan 18, 2022

I've been asking around and nobody seems to mind too much if we switch to Node 14+.

client = new MatrixClient(config.homeserverUrl, config.accessToken, storage, cryptoStorage);
if (config.encryption.enabled) {
const joinedRooms = await client.getJoinedRooms();
await client.crypto.prepare(joinedRooms);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be done only at startup?

We'll probably want to apply this treatment also to the various instances of MatrixClient we use in tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this only needs to be done at startup, afterwards the client should manage the joined room list internally.

Gnuxie added a commit that referenced this pull request Jan 18, 2022
Needed to merge #186 & node 12 is approaching EOL.
@Yoric
Copy link
Contributor

Yoric commented Jan 19, 2022

Let's wait until we have #192 for testing.

Gnuxie added a commit that referenced this pull request Jan 19, 2022
Needed to merge #186 & node 12 is approaching EOL.
@Yoric
Copy link
Contributor

Yoric commented Feb 1, 2022

@Half-Shot Could you rebase and retry? We have fixed numerous issues on CI, I hope things will be run smoother now.

@Half-Shot
Copy link
Contributor Author

@Yoric I had a go but I think it's very busted for me. I had to modify the test setup code a bit because we need to extract an access token out of /register for the E2EE stuff to work.

@Yoric
Copy link
Contributor

Yoric commented Apr 7, 2022

@Half-Shot Is there anything we can do to help?

@Yoric Yoric marked this pull request as draft April 7, 2022 07:16
@peterscheu-aceart
Copy link

Whats the state on this?
Is it just the tests failing?

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.

Support E2E natively within Mjolnir
3 participants