Add docstring for get_trust_for_jid

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-08-25 11:48:48 +02:00
parent 179db446fe
commit 9d3915a27c
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -387,7 +387,28 @@ class XEP_0384(BasePlugin):
def distrust(self, jid: JID, device_id: int, ik: bytes) -> None: def distrust(self, jid: JID, device_id: int, ik: bytes) -> None:
self._omemo.distrust(jid.bare, device_id, ik) self._omemo.distrust(jid.bare, device_id, ik)
def get_trust_for_jid(self, jid: JID) -> Dict[str, List[Optional[Tuple[bytes, bool, str]]]]: def get_trust_for_jid(self, jid: JID) -> Dict[str, List[Optional[Dict[str, Any]]]]:
"""
Fetches trust for JID. The returned dictionary will contain active
and inactive devices. Each of these dict will contain device ids
as keys, and a dict with 'key', 'trust' and 'fingerprint' as
values that can also be None.
Example:
{
'active': {
123456: {
'key': bytes,
'trust': bool,
'fingerprint': str,
}
}
'inactive': {
234567: None,
}
}
"""
devices = self._omemo.getTrustForJID(jid.bare) devices = self._omemo.getTrustForJID(jid.bare)
for trust in devices['active'].values(): for trust in devices['active'].values():
if trust is not None: if trust is not None: