From 9d3915a27c8f8148f6dc54b2e7c36f5a1c7161db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 25 Aug 2019 11:48:48 +0200 Subject: [PATCH] Add docstring for get_trust_for_jid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- slixmpp_omemo/__init__.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/slixmpp_omemo/__init__.py b/slixmpp_omemo/__init__.py index fb4a5d7..f97feb9 100644 --- a/slixmpp_omemo/__init__.py +++ b/slixmpp_omemo/__init__.py @@ -387,7 +387,28 @@ class XEP_0384(BasePlugin): def distrust(self, jid: JID, device_id: int, ik: bytes) -> None: 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) for trust in devices['active'].values(): if trust is not None: