-
-
Notifications
You must be signed in to change notification settings - Fork 594
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
Feat: Add NodeJS E2EE TS example. #3346
Conversation
This reverts commit 6b7c47e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, at first glance this feels extremely complex for an example. In general, I'd expect a code example to be a single file of actual logic, probably limited to a few functions. The non-crypto node example is probably a bit too large, IMO. It's great to have a complete example but I'm struggling to see where the relevant code for starting an e2e Matrix client actually is in here.
I could also use some help understanding how this works. It's not specifying a store, so presumably is using the MemoryStore by default, which may be fine since it logs in each time it starts, but in an example it's even more important than normal to be very clear about what's happening.
The references to maybe clearing devices in the case of encryption problems don't really help me to understand when I actually would or wouldn't do this in real code.
Co-authored-by: David Baker <dbkr@users.noreply.github.com>
I don't feel this example is too complicated, a little complex maybe but this allows me to segregate parts of the code that people want to look at without having to sift through the rest that they are not interested in like in Here we have
I have updated the README to hopefully increase the clarity on how it is setup and what it is doing. |
Thanks a lot @saul-jb, this was exactly what I was looking for ❤️ All the other (few) examples concerning e2ee on node are outdated, difficult to find, and not working. Imho this example/little app should be merged in master ASAP. FYI Tested, working, with:
|
@saul-jb could you provide more details here ? Adding this section
to the createClient of the startWithToken function doesn't work smoothly, it gives back and error such as
Also: if we want to have the crypto Store persisted, do we still need to login via username and password (getTokenLogin) ? |
Yeah, Matrix is pretty cool overall but it is a nightmare to figure out how to use this library due to lack of working examples and documentation. I think a few up to date examples would go a long way to increasing adoption.
Yeah, that seems to have problems and the only way I have found to persist storage is using
No, since we can persist an access token and device we can skip straight to the token login - the example has be updated to do this too. |
Well done, it works perfectly with
Yeah, I agree, it was a nightmare, until I managed to find this issue. |
This came up as a longstanding PR in our meeting, and others on the team were in agreement with me that it's a bit complex for an example, although I also agree that we have a severe lack of examples and people are clearly finding this useful. I don't think we'd want this to live in the main js-sdk repo still, but as a compromise, how about putting it in its own repo, if you'd be happy to maintain it? Linking to a separate repo as a usage example from the js-sdk docs seems like a thing we could do. |
I'm going to go ahead and close this as per my last comment. I'd like to see this spun out to its own repo, especially if someone can take an active role in keeping it up to date. Thanks for your efforts in making this, it's great to see it be useful to people! I think it's just a bit large to have a home as an example in the js-sdk itself. |
This PR adds a NodeJS TypeScript example with E2EE enabled to the examples, this should help people figure out how to use the E2EE in a NodeJS environment.
E2EE is one of the primary reasons to use Matrix and the docs/examples are really scarce on how to handle it properly, this example is up to date and should really help with that.
Related issues:
This PR currently has none of the required changelog labels.
A reviewer can add one of:
T-Deprecation
,T-Enhancement
,T-Defect
,T-Task
to indicate what type of change this is, or addType: [enhancement/defect/task]
to the description and I'll add them for you.