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

Docs and example for using e2e #437

Closed
ghost opened this issue May 16, 2017 · 6 comments
Closed

Docs and example for using e2e #437

ghost opened this issue May 16, 2017 · 6 comments

Comments

@ghost
Copy link

ghost commented May 16, 2017

Being new to matrix-js-sdk, I am attempting to build a bot which supports e2e. Please excuse me if I'm asking obvious questions.

I see that there are multiple well-explained examples for creating clients. However, I do have some issues understanding how to apply e2e in the code.

The client works well when it comes to sending messages (having added the session store/WebStorageSessionStore and device ID to the client config), but receiving messages from other users in the room ends with a Unable to decrypt: The sender's device has not sent us the keys for this message.. I also see that the following is created in session.e2e.rooms<room>:

{"algorithm":"m.megolm.v1.aes-sha2"}

Also, the device list for each participating user seems to come down fine.

What in the implementation guide is automatically done in the SDK, and what is required by the developer?

If anyone has a code example, that would be great for the docs I think.

@ara4n
Copy link
Member

ara4n commented May 16, 2017

As a quick answer, i think that https://matrix.org/docs/projects/other/matrix-recorder.html is using js-sdk with e2e, so you can probably take inspiration from that (or failing that Riot). Most of the e2e implementation guide is already covered by the js-sdk, so relatively little should be needed in addition.

N.B. that there is a risk of hitting https://github.com/vector-im/riot-web/issues/3231 unless you persist deviceId in your app between sessions.

@ghost
Copy link
Author

ghost commented May 16, 2017

That worked perfectly, and it's a great example btw!

Based on your last comment - it occurred to me that I obviously should not make up my own device ID either, so that is something take a note of.

Hopefully this can be helpful to the next one wondering about the same thing.

Thanks a lot!

@theilgaard
Copy link

I got stuck in the exact same place as you.

Also, the config object is missing a documentation/declaration when using MatrixClient.setRoomEncryption(roomId, config). I sifted through the code to find that it had to look like {"algorithm":"m.megolm.v1.aes-sha2"}

@nahakiole
Copy link

I'm in the same place stuck, there are no examples how to verify and upload keys from new clients. Also the whole encryption itself could be explained a bit more clear maybe graphically in the matrix docs. But with the sdk it's very unclear what we as developers have to implement to get the same interface as in elementor using emojis and qr codes to sign new keys / upload / download existing keys.

I've tried to start a graphical overview of the encryption, but I'm stuck. If someone of the matrix team would have time to chat and fill my knowledge gaps I could publish the finished version to help other developers.

image

@nahakiole
Copy link

I've found this repository here and will try to implement it this way: https://github.com/hmendes00/matrix-js-sdk-e2ee-helpers
Maybe the examples from there could be integrated into the official docs?

@richvdh
Copy link
Member

richvdh commented Nov 18, 2024

#4503 improved the documentation.

It's true that we could do with an example, but that is covered by #4535.

@richvdh richvdh closed this as completed Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants