-
-
Notifications
You must be signed in to change notification settings - Fork 604
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
E2EE text messaging example. #3754
Conversation
Shows how to prepare an existing room for end-to-end-encryption (E2EE) and send a text message.
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.
A few specific points but I think this would need a bit of work generally before being an example we could accept. Some more general points:
- Comments, comments, comments! This is documentation so it needs to be explaining what it's doing and why in detail so the reader understands the process. eg. why does it need to wait for the 'PREPARED' sync state?
- It really ought to conform to our code style. In fact it would be nice if it got checked by the linters.
- It would be even nicer if it got run as part of CI to make sure it still worked every time
- We don't tend to use the 'mjs' extension - is it necessary? Why?
- You've use MemoryCryptoStore: this is great for this example but again, needs a comment to say why it's appropriate here and what the limitations are.
- Some doc of how to run it would feel useful too.
@@ -0,0 +1,126 @@ | |||
// Description: |
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.
Don't forget license header and copyright attribution (to yourself)
// | ||
// - NodeJS v18.17.1 | ||
// - matrix-js-sdk v28.2.0 | ||
// - olm v3.1.5 |
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.
This probably wants to be a block comment?
function log(msg) | ||
{ | ||
console.log(`${sLogPrefix}${msg}`); | ||
}; |
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.
This whole log wrapper and prefix feels weird and distracting for an example, especially since the prefix is hardcoded.
import olm from 'olm'; | ||
|
||
const sLogPrefix = '*** MAIN ***: ', | ||
sC = { |
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.
What does sC
mean?
process.exit(1); | ||
} | ||
|
||
// Marking all devices as verified: |
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.
Okay, but... why?
Shows how to prepare an existing room for end-to-end-encryption (E2EE) and send a text message.
Addresses issues #437 and #1156.
Signed-off-by: Marcel Timm [email protected]
Here's what your changelog entry will look like:
✨ Features