[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):