[omemo] Set trust per JID

Closes #442.
parent 28b302d3
...@@ -230,7 +230,7 @@ class LiteAxolotlStore(AxolotlStore): ...@@ -230,7 +230,7 @@ class LiteAxolotlStore(AxolotlStore):
CREATE TABLE IF NOT EXISTS secret ( CREATE TABLE IF NOT EXISTS secret (
device_id INTEGER, public_key BLOB, private_key BLOB); device_id INTEGER, public_key BLOB, private_key BLOB);
INSERT INTO secret (device_id, public_key, private_key) 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 FROM identities
WHERE recipient_id = -1; WHERE recipient_id = -1;
""" """
...@@ -587,10 +587,11 @@ class LiteAxolotlStore(AxolotlStore): ...@@ -587,10 +587,11 @@ class LiteAxolotlStore(AxolotlStore):
self._con.execute(query, fingerprints) self._con.execute(query, fingerprints)
self._con.commit() self._con.commit()
def setTrust(self, identityKey, trust): def setTrust(self, recipient_id, identityKey, trust):
query = 'UPDATE identities SET trust = ? WHERE public_key = ?' query = '''UPDATE identities SET trust = ? WHERE public_key = ?
AND recipient_id = ?'''
public_key = identityKey.getPublicKey().serialize() public_key = identityKey.getPublicKey().serialize()
self._con.execute(query, (trust, public_key)) self._con.execute(query, (trust, public_key, recipient_id))
self._con.commit() self._con.commit()
def isTrusted(self, recipient_id, device_id): def isTrusted(self, recipient_id, device_id):
......
...@@ -296,7 +296,7 @@ class KeyRow(Gtk.ListBoxRow): ...@@ -296,7 +296,7 @@ class KeyRow(Gtk.ListBoxRow):
image.set_tooltip_text(tooltip) image.set_tooltip_text(tooltip)
backend = self.get_toplevel()._omemo.backend 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 @property
def active(self): def active(self):
......
[info] [info]
name: OMEMO name: OMEMO
short_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. 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> authors: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de>
Daniel Gultsch <daniel@gultsch.de> Daniel Gultsch <daniel@gultsch.de>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment