aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* e2e: Utility to decrypt media dataDr. David Alan Gilbert2018-02-252-0/+60
| | | | | | | Pass the received image data through gcrypt to do the decryption using the previously received keys. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Stash key info for encrypted imagesDr. David Alan Gilbert2018-02-251-14/+45
| | | | | | | m.image messages in the e2e world have a different format and include keys. Decode the extra structures. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Parse media decryption infoDr. David Alan Gilbert2018-02-252-0/+100
| | | | | | | | For encrypted images the decrypted message contains key information to decrypt the actual media once received. Add a structure and a parser to extract the information from the JSON. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add jws decodeDr. David Alan Gilbert2018-02-252-0/+39
| | | | | | | JSON web signatures almost use base64 but with a slightly odd encoding; decoding a JWS to base64. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add device info actionDr. David Alan Gilbert2018-02-253-1/+42
| | | | | | | Add a purple action (i.e. thing on the accounts->matrix-> menu) to display the device ID and public key. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Cleanup inbound megolm sessions in memoryDr. David Alan Gilbert2018-02-253-3/+44
| | | | | | Cleanup on closing the plugin or leaving a conversation. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Update sessionsDr. David Alan Gilbert2018-02-251-3/+68
| | | | | | Update sessions stored in the db after starting sessions. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Store olm sessions in our dbDr. David Alan Gilbert2018-02-251-5/+102
| | | | Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Look for olm sessions in our dbDr. David Alan Gilbert2018-02-251-21/+265
| | | | | | | Keep a hash/list of olm sessions in memory and load them from the db if we find we haven't got one. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Route decrypted messages back upDr. David Alan Gilbert2018-02-253-12/+52
| | | | | | Parse the decrypted JSON and route it back up to the room code. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Decrypt m.room.encryptedDr. David Alan Gilbert2018-02-253-0/+125
| | | | | | | Decrypt m.room.encrypted messages sent to a room; these come out with normal events. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: handle m.room_keyDr. David Alan Gilbert2018-02-251-2/+77
| | | | | | | Decrypted olm messages of type m.room_key create inbound megolm sessions. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Provide storage for inbound megolm sessionsDr. David Alan Gilbert2018-02-251-0/+100
| | | | | | | | Attach to the room storage for inbound megolm sessions. TODO: Store to db TODO: Clean up this list in matrix_room_create_conversation Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Handle the decrypted olm messagesDr. David Alan Gilbert2018-02-251-0/+86
| | | | | | | Check the decrypted messages have matching keys/devices etc before parsing them any further. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: decrypt olm encrypted messageDr. David Alan Gilbert2018-02-251-1/+121
| | | | | | | Create an olm inbound session and use it to decrypt the message. Later patches will handle storing/retrieving the OLM sessions. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Parse received d2d m.room.encrypted messagesDr. David Alan Gilbert2018-02-253-1/+58
| | | | | | Parse the top level of m.room.encrypted messages. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Route key count from syncDr. David Alan Gilbert2018-02-252-1/+7
| | | | | | | Route the count of remaining one time keys out of the sync result. We need the newer (v2?) API for this. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Reorg sync to parse d2d messagesDr. David Alan Gilbert2018-02-251-11/+52
| | | | | | | | | Parse the device-2-device messages in a sync. We have to get the order right since we need the rooms created before parsing the d2d messages, but we may need to have processed the d2d messages to decrypt events in the room. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Wire in sqlite3 to hold e2e databasesDr. David Alan Gilbert2018-02-252-1/+90
| | | | | | | | | We're going to need a: database of olm sessions a device trust database a database of megaolm sessions Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Parse key upload returnDr. David Alan Gilbert2018-02-251-1/+20
| | | | | | | Parse the key upload return to see if we need to send any one time keys. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Create and send one time keysDr. David Alan Gilbert2018-02-251-1/+119
| | | | Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: parse sync_key_counts to decide on key sendingDr David Alan Gilbert2018-02-252-0/+45
| | | | | | | | | | | | | | The server returns the count of one-time-keys that it has, we parse that and detect if we need to send more. It's a little tricky in that a server that doesn't have any keys will send an empty response, so force sending in that case. If we get to the point of multiple types of keys this will need reworking to make sure we only send the key types needed. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Retrieve or create Olm account state, send keysDr. David Alan Gilbert2018-02-253-2/+170
| | | | | | | | If we've got a previously stored olm account state then use it, else create us a new one. Either way, upload the device keys to the server. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: get_id_keysDr. David Alan Gilbert2018-02-251-0/+58
| | | | | | | | | | | | Parse the output of olm_account_identity_keys to get a list of algorithms and the keys for them. There really should be a better way; the algorithm names in here match what we need in the keys section, but we have to append the device id later, so it's a pain that it returns (undocumented) JSON. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: get_randomDr. David Alan Gilbert2018-02-251-0/+20
| | | | | | | Allocate a blob of memory and fill it with random data. (There must be some existing portable function for this?!) Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Restore OLM account state from Purple account dataDr. David Alan Gilbert2018-02-251-0/+77
| | | | Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Store OLM account state to the Purple Account dataDr. David Alan Gilbert2018-02-252-0/+53
| | | | | | | | | | | The OLM account state can be 'pickled'; we store this in Purple's account data store as a JSON string. Note; OLM lets us encrypt the pickle, but we've got no key to encrypt it with; I don't think Purple has anything for wiring into the system key store. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add clear_memDr. David Alan Gilbert2018-02-251-0/+15
| | | | | | | We can't rely on having memset_s, so add our own equivalent that declares itself volatile. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* matrix-json: Add debug to dump json to stderrDr. David Alan Gilbert2018-02-252-0/+18
| | | | Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add matrix_sign_jsonDr. David Alan Gilbert2018-02-252-0/+48
| | | | | | | Given a JsonObject, produce a canonical json blob, sign it and add the signature back into the JsonObject. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Create MatrixE2EData type and matrix-e2e.[ch] filesDr. David Alan Gilbert2018-02-254-0/+62
| | | | | | Somewhere for the e2e magic to happen. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Add matrix_api_upload_keysDr. David Alan Gilbert2018-02-252-0/+70
| | | | | | | Add api call for uploading device and one time keys. It expects the json blobs to be presigned. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Canonical json generatorDr. David Alan Gilbert2018-02-252-0/+107
| | | | | | | Matrix signing relies on signing Json formatted to be 'canonical' as per https://matrix.org/speculator/spec/drafts%2Fe2e/appendices.html#canonical-json Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* matrix-json: Replace tabsDr. David Alan Gilbert2018-02-251-45/+45
| | | | | | Make matrix-json use spaces rather than tabs. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* e2e: Link with libolmDr. David Alan Gilbert2018-02-253-0/+15
| | | | | | | | | | Windows build not tested. Note that libolm doesn't currently have the pkgconf magic. Compile with make -DMATRIX_NO_E2E to disable olm linking and e2e in general. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* Merge pull request #62 from radiocane/mediaDave Gilbert2018-02-243-65/+137
|\ | | | | Handle media messages (m.video, m.audio, m.file)
| * [matrix-room] Update thumbnail request to r0.3.0White_Rabbit2018-02-221-11/+32
| | | | | | | | | | | | | | | | With r0.3.0 thumbnail_info and thumbnail_url for m.image and m.file have been moved from content to content.info. With this commit those objects are looked for at the new location and if they're not found, the old location is checked. Furthermore, if the thumbnail provided is too big, we ask the server to make a thumbnail of it.
| * Improve media handlingWhite_Rabbit2018-02-223-64/+115
| | | | | | | | | | | | | | | | Handle m.video, m.file, m.audio and m.image in _handle_incoming_media. Remove _handle incoming_image. On incoming media, always print a chat message with the download link and mimetype/size. If a thumbnail_url is available and the thumbnail size is small, download and show that. Otherwise, only for m_image, ask for a server generated thumbnail.
* | Merge pull request #29 from zamaudio/join-roomDave Gilbert2018-02-211-2/+2
|\ \ | | | | | | Join by alias or id; the one remaining commit to use the /join/ api looks like it works
| * | matrix-api: Fix join by alias or room-idDamien Zammit2017-12-091-2/+2
| |/
* | Merge pull request #66 from radiocane/masterDave Gilbert2018-02-201-2/+11
|\ \ | | | | | | [README] Add Ubuntu pre-built binaries. Fixes #58
| * | [README] Add Ubuntu pre-built binaries. Fixes #58White_Rabbit2017-11-161-2/+11
| |/
* | Merge pull request #69 from penguin42/typing-crash-fixDave Gilbert2018-02-201-9/+13
|\ \ | | | | | | | | | | | | typing: Fix crash on typing notification to someone not present (Eion OK'd via Purple on Matrix.org)
| * | typing: Fix crash on typing notification to someone not presentDr. David Alan Gilbert2018-02-201-9/+13
| |/ | | | | | | | | | | | | | | | | I've seen a crash where the user_id doesn't appear to be a member of the room; I'm guessing they just left or only just arrived and we got the typing notification after/before. Fixes: 61ee52f3230724b5c1e8f81caeb16ce7887d183c Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
* | Merge pull request #68 from radiocane/w_r/small_stuffDave Gilbert2018-02-201-1/+1
|\ \ | |/ |/| [Makefile] Change fixed pkg-config into variable PKG_CONFIG
| * [Makefile] Change fixed pkg-config into variable PKG_CONFIGWhite_Rabbit2017-12-151-1/+1
|/
* Merge pull request #60 from radiocane/masterMatthew Hodgson2017-09-271-1/+1
|\ | | | | [README] Add xenial-specific libglib package
| * [README] Add xenial-specific libglib packageWhite_Rabbit2017-09-271-1/+1
|/
* Merge pull request #56 from penguin42/response-too-long-hack1Dave Gilbert2017-09-021-1/+1
|\ | | | | bump up max reply size
| * bump up max reply sizeDr. David Alan Gilbert2017-09-021-1/+1
|/ | | | | | | | | | Initial sync's are getting huge, we really need to fix that, but in the mean time bump the max size up. I've seen matrix HQ giving out a 5MB reply in the initial sync. see issue #28. Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>