Remove fingerprint from get_trust_for_jid, simply wrap the omemo lib method

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-08-25 23:20:13 +02:00
parent 508a1fe987
commit 2b63352626
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -392,8 +392,8 @@ class XEP_0384(BasePlugin):
""" """
Fetches trust for JID. The returned dictionary will contain active Fetches trust for JID. The returned dictionary will contain active
and inactive devices. Each of these dict will contain device ids and inactive devices. Each of these dict will contain device ids
as keys, and a dict with 'key', 'trust' and 'fingerprint' as as keys, and a dict with 'key', 'trust' as values that can also be
values that can also be None. None.
Example: Example:
{ {
@ -401,7 +401,6 @@ class XEP_0384(BasePlugin):
123456: { 123456: {
'key': bytes, 'key': bytes,
'trust': bool, 'trust': bool,
'fingerprint': str,
} }
} }
'inactive': { 'inactive': {
@ -410,14 +409,7 @@ class XEP_0384(BasePlugin):
} }
""" """
devices = self._omemo.getTrustForJID(jid.bare) return self._omemo.getTrustForJID(jid.bare)
for trust in devices['active'].values():
if trust is not None:
trust['fingerprint'] = fp_from_ik(trust['key'])
for trust in devices['inactive'].values():
if trust is not None:
trust['fingerprint'] = fp_from_ik(trust['key'])
return devices
def is_encrypted(self, msg: Message) -> bool: def is_encrypted(self, msg: Message) -> bool:
return msg.xml.find('{%s}encrypted' % OMEMO_BASE_NS) is not None return msg.xml.find('{%s}encrypted' % OMEMO_BASE_NS) is not None