[omemo] Dont fail on invalid session

This commit is contained in:
Philipp Hörist
2019-02-19 23:41:22 +01:00
parent 49ad0b1f84
commit 2f0aafba11
2 changed files with 16 additions and 11 deletions

View File

@@ -491,13 +491,17 @@ class LiteAxolotlStore(AxolotlStore):
def isTrusted(self, recipient_id, device_id):
record = self.loadSession(recipient_id, device_id)
identity_key = record.getSessionState().getRemoteIdentityKey()
try:
identity_key = record.getSessionState().getRemoteIdentityKey()
except Exception:
log.exception('Unable to determine trust for %s %s',
recipient_id, device_id)
return False
return self.getTrustForIdentity(
recipient_id, identity_key) == Trust.TRUSTED
def isUntrusted(self, recipient_id, device_id):
record = self.loadSession(recipient_id, device_id)
identity_key = record.getSessionState().getRemoteIdentityKey()
def isUntrustedIdentity(self, recipient_id, identity_key):
return self.getTrustForIdentity(
recipient_id, identity_key) not in (Trust.TRUSTED, Trust.UNDECIDED)