# HG changeset patch # User Goffi # Date 1665064925 -7200 # Node ID cc27052257781f8fd308613861ee4f0501319b9e # Parent 993cc8e56aef6bac2d11812a3fc8c1198ef611ee core (memory/encryption): helper method to get currently utilised e2ee algorithm's namespace: rel 379 diff -r 993cc8e56aef -r cc2705225778 sat/memory/encryption.py --- a/sat/memory/encryption.py Thu Oct 06 16:02:05 2022 +0200 +++ b/sat/memory/encryption.py Thu Oct 06 16:02:05 2022 +0200 @@ -346,6 +346,18 @@ raise ValueError("Full jid given when expecting bare jid") return self._sessions.get(entity) + def get_namespace(self, entity: jid.JID) -> Optional[str]: + """Helper method to get the current encryption namespace used + + @param entity: get the namespace for this entity must be a bare jid + @return: the algorithm namespace currently used in this session, or None if no + e2ee is currently used. + """ + session = self.getSession(entity) + if session is None: + return None + return session["plugin"].namespace + def getTrustUI(self, entity_jid, namespace=None): """Retrieve encryption UI