Commit graph

65 commits

Author SHA1 Message Date
b64371e8fe xep_0384: Move _generate_encrypted_payload out of plugin class
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
2891e92269 xep_0384: move _parse_bundle out of plugin class
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
bc97de440a xep_0384: don't register the plugin twice
We're already calling `register_plugin` in __init__.py

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
b6fb1ec015 xep_0384: rename cache_dir to data_dir. This data should be persisted
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
53d49f838d xep_0384: add bare_jid and device_id to NoAvailableSession exception
We actually had the data all along!

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
a8fb31a4b1 xep_0384: republish our bundle after decryption if necessary
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
4b565c0f7b xep_0384: document & raise NoAvailableSession
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
f81e6525cd xep_0384: import omemo.exceptions directly
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
05ef6d75c3 xep_0384: store sessions to file
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
23ac4a5bff xep_0384: Fix issue when loading session
Slixmpp was never able to load the session as ids would mismatch, thus
unable to decrypt incoming messages.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
4b51f117bb xep_0384: Generate XML from encrypted payload received from the lib
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
c355b14f79 xep_0384: loop again until encryption errors are fixed or until we're stuck
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
112bdddf11 xep_0384: Use set instead of list for no_eligible_devices
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
a12dad7241 xep_0384: Fixup; get check for eligible devices out of the loop
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
bc85bc7efd xep_0384: raise NoEligibleDevices all at once
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
8465936715 xep_0384: Handle NoEligibleDevicesException
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
c192c180e1 xep_0384: fix type annotation for bundles
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
85e5d44bb8 xep_0384: encryption: handle MissingBundleException
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
4bdea25179 xep_0384: encryption, return empty payload (doesn't encrypt anything)
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
fb13027906 xep_0384: Remove custom encode function; use bundle API
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
02f140614f xep_0384: use exception instead of log when missing own key when decrypting
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
3227e58d8a xep_0384: Moar mypy; add types, fix stuff
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
8117248bc7 xep_0384: document encode_public_key fn
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
41919a7a5e xep_0384: some more mypy checks
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
252b789f85 xep_0384: add some types to storage
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
5e55120317 xep_0384: simplify trust management even more for now
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
f15626c6d1 xep_0384: Fix message decryption. Hello world!
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
11cbbdcda4 xep_0384: Make storage synchronous
The OMEMO lib provides a way to do async operations, but slixmpp and
poezio are not entirely ready for this:
- The plugin_init method is not awaited, in slixmpp
- Event handlers are not awaited, in poezio

This would need to be fixed before being able to do what I am trying to
do asynchronously.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
f20a1a8224 xep_0384: b64decode message elements when decrypting
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
3696f3256a xep_0384: Fix decryptMessage call
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
d6b9bef2e2 xep_0384: Fix publishing device list
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
889def5a2b xep_0384: Publish bundle again
The backend library is missing the encodePublicKey method for now.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
9a10492785 xep_0384: Remove unused functions
The fingerprint method is not available anymore. That will need to be
computer from the bundle public key.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
757b6b7b27 xep_0384: Fix important details :)
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
e0bdfc7102 xep_0384: Update device list handling
- Update device list handling to use SessionManager storage.
- Remove clear device list for now as it's not supported in the lib

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
8a22062b5b xep_0384: Fix deviceID variable
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
e58c50338a xep_0384: Update with current python-omemo version
- Update the plugin to integrate changes from the omemo library we are
using.
- Disable handlers for now to be able to gradually see if they are still
up-to-date

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
lumi
04fb45bdea xep_0384: add .my_fingerprint 2019-01-29 18:05:59 +01:00
lumi
7f8fc9f860 Add .my_device_list.
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
lumi
915e0c9c1b Fix list device handling
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
lumi
737f5eae33 Fix decryption.
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
deba255cb0 xep_0384: First attempt at decrypting messages
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
f38fbc6b60 xep_0384: Add interface for .text on Key element
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2019-01-29 18:05:59 +01:00
8b2348698e xep_0384: Add clear_devices helper 2019-01-29 18:05:59 +01:00
6f50f5dee7 xep_0384: is_encrypted helper 2019-01-29 18:05:59 +01:00
67c66eca1b xep_0384: Publish bundle 2019-01-29 18:05:59 +01:00
3322d17aa4 xep_0384: Handle device list
- Split get/store and common operations.
- Always try to set at init time
- Add ourselves in the list if not present
- Correctly cast from/to str/int
2019-01-29 18:05:59 +01:00
e27890c868 xep_0384: Remove JID import 2019-01-29 18:05:59 +01:00
571aa85656 xep_0384: Add omemo session 2019-01-29 18:05:59 +01:00
e7bad69fc7 xep_0384: b64 helpers 2019-01-29 18:05:59 +01:00