[omemo] Set trust per JID

Closes #442.
This commit is contained in:
Marcin Mielniczuk
2019-08-20 22:37:51 +02:00
parent 28b302d373
commit ddebd9381b
3 changed files with 7 additions and 6 deletions

View File

@@ -230,7 +230,7 @@ class LiteAxolotlStore(AxolotlStore):
CREATE TABLE IF NOT EXISTS secret (
device_id INTEGER, public_key BLOB, private_key BLOB);
INSERT INTO secret (device_id, public_key, private_key)
SELECT registration_id + 1, public_key, private_key
SELECT registration_id + 1, public_key, private_key
FROM identities
WHERE recipient_id = -1;
"""
@@ -587,10 +587,11 @@ class LiteAxolotlStore(AxolotlStore):
self._con.execute(query, fingerprints)
self._con.commit()
def setTrust(self, identityKey, trust):
query = 'UPDATE identities SET trust = ? WHERE public_key = ?'
def setTrust(self, recipient_id, identityKey, trust):
query = '''UPDATE identities SET trust = ? WHERE public_key = ?
AND recipient_id = ?'''
public_key = identityKey.getPublicKey().serialize()
self._con.execute(query, (trust, public_key))
self._con.execute(query, (trust, public_key, recipient_id))
self._con.commit()
def isTrusted(self, recipient_id, device_id):

View File

@@ -296,7 +296,7 @@ class KeyRow(Gtk.ListBoxRow):
image.set_tooltip_text(tooltip)
backend = self.get_toplevel()._omemo.backend
backend.storage.setTrust(self._identity_key, self.trust)
backend.storage.setTrust(self.jid, self._identity_key, self.trust)
@property
def active(self):

View File

@@ -1,7 +1,7 @@
[info]
name: OMEMO
short_name: omemo
version: 2.6.63
version: 2.6.64
description: OMEMO is an XMPP Extension Protocol (XEP) for secure multi-client end-to-end encryption based on Axolotl and PEP. You need to install some dependencies, you can find install instructions for your system in the Github Wiki.
authors: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
Daniel Gultsch <daniel@gultsch.de>