-
Notifications
You must be signed in to change notification settings - Fork 119
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
E2E Messaging #100
Comments
Looking into this - probably olm should be wrapped into a distro supported package for this to be accessible as well? |
Outbound sessions for the Olm ( Here is a code snippet to get started if anyone wants to play around with it: OLM_BASE_DIR = '/home/pik/git/olm'
MY_DEVICE_ID = 'MY_MATRIX_PYTHON_SDK_DEVICE'
MY_USER_ID = '@pik:pik-test'
MY_PASSWORD = '1234'
HOMIE_USER_ID = '@homie:pik-test'
import os
import sys
sys.path.append(os.path.join(OLM_BASE_DIR, 'python'))
from matrix_client import client, api, crypto
cli = client.MatrixClient('http://localhost:8008')
olm_device = crypto.OlmDevice.load_or_create_olm_device(cli.api, MY_USER_ID, MY_DEVICE_ID)
# Pass to the device_id to the login method otherwise Synapse will auto-generate
# a new one for us
cli.login_with_password(MY_USER_ID, MY_PASSWORD, device_id=MY_DEVICE_ID)
sessions = olm_device.create_outbound_sessions_to_user(HOMIE_USER_ID)
def get_first_session(d):
return get_first_session(list(d.values())[0]) if isinstance(d, dict) else d
outbound_session = get_first_session(sessions)
# room should be a room with encryption enabled via. the m.room.encryption event
# to do this create a room and an m.room_encryption event e.g.
room = cli.create_room('homes_are_invited')
room.invite_user(HOMIE_USER_ID) # Accept Invite
cli.api.send_state_event(room.room_id, 'm.room.encryption',
{'algorithm': 'm.olm.v1.curve25519-aes-sha2'}
)
olm_device.send_encrypted_message_to_session(room.room_id, outbound_session, 'Hello via. e2e on matrix-python-sdk') |
News? :) |
If anyone comes here after me, and wants to play and not try to deduce what's necessary to do that: get pik's branch: I'm yet unwilling to learn the entire git lexicon, so I'm sure for those in deep git cover there's a different way. but, above works for the novitiate. Edit |
any news on this since october? sadly cannot find any SDK that has working e2e yet, other than android/ios |
there's a GSOC project this year to finish this. Meanwhile, matrix-js-sdk is the reference for working e2e. |
wow, glad to hear that 👍 |
Hi, I do the GSoC project :) |
thanks for responding here! Thanks too for working on it and good luck! ;) |
Good luck ! |
All the PRs for basic E2E support are now opened! Here are some instructions in order to try it out (and help track down eventual bugs). DisclaimerThe implementation is mostly unreviewed, and shouldn't be trusted. InstallationThe Olm C library is needed. It can be installed from source, or with a package manager (Archlinux, Debian...). Using encryptionIn order to enable encryption support, the only modification needed is to pass Sample codeAssuming we can join the existing room
Finding and reporting bugsMost bugs will include undecryptable sent or received messages. There are a lot of different possible causes, which might be hard to track down if they are race conditions. |
Nevermind :D I was on the wrong branch. |
The end of my GSoC has come. I'll stay around, get everything merged and fix bugs, but this is a good opportunity to post an update! The new branch https://github.com/Zil0/matrix-python-sdk/tree/e2e_beta_2 is available for anyone wanting to test E2E. The instructions are alike to those above, except there is a new feature that spares having to keep track of device ID. Simply do All the missing features are also out since the last update (encrypted attachments, device verification, key sharing, import/export of room keys). There might be some rough edges, let me know! Last but not least, I've written up a file which explains more of what can be done with E2E. It is present at the root of the repo as |
Are there any news on sending encrypted files, e.g., sending an encrypted PDF? |
@warp1337 the missing bit was that the This solution is most likely temporary while more E2E code gets reviewed and while we think about a better upload process in general :) |
Any news why PRs aren't merged yet? |
They are still awaiting review by someone from Matrix core team. Last ETA given by @uhoreg is that it should start happening in a month, and no one knows how long the whole process will take, since I may or may not be busy with other things at that time. |
It's currently very awkward to try to store the same access token across restarts (specifically it's difficult to create a new MatrixClient capable of E2EE from an existing access token), if you want to make a program that keeps the session across restarts and doesn't store the account password. I think this would need to be solved before E2EE is ready for production. |
: smiley : |
FYI. you folks may want to read https://github.com/matrix-org/matrix-python-sdk#project-status |
all the GSoC work here eventually got used to implement E2E in matrix-nio, which has ended up with excellent E2E support (it powers github.com/matrix-org/pantalaimon etc). I'm inclined to close this wontfix? |
Yeah, there is no work being done here. Folks wishing to continue there E2E adventures will want to checkout |
This is the issue for looking at implementing https://matrix.org/git/olm in the SDK. It looks like the lib includes bindings for python so it should be a case of staring at the js-sdk's implementation and trying to fit that into our code.
This is likely going to be a long and tedious task so it might be months before this gets ticked off.
The text was updated successfully, but these errors were encountered: