Mercurial > libervia-backend
comparison libervia/backend/memory/encryption.py @ 4342:17fa953c8cd7
core (types): improve `SatXMPPEntity` core type and type hints.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 13 Jan 2025 01:23:10 +0100 |
parents | e9971a4b0627 |
children |
comparison
equal
deleted
inserted
replaced
4341:e9971a4b0627 | 4342:17fa953c8cd7 |
---|---|
75 ).format(namespace=namespace, entity=entity_jid_s, err=err) | 75 ).format(namespace=namespace, entity=entity_jid_s, err=err) |
76 ) | 76 ) |
77 log.info(_("encryption sessions restored")) | 77 log.info(_("encryption sessions restored")) |
78 | 78 |
79 @classmethod | 79 @classmethod |
80 def register_plugin(cls, plg_instance, name, namespace, priority=0, directed=False): | 80 def register_plugin( |
81 cls, | |
82 plg_instance, | |
83 name: str, | |
84 namespace: str, | |
85 priority: int=0, | |
86 directed: bool=False | |
87 ) -> None: | |
81 """Register a plugin handling an encryption algorithm | 88 """Register a plugin handling an encryption algorithm |
82 | 89 |
83 @param plg_instance(object): instance of the plugin | 90 @param plg_instance(object): instance of the plugin |
84 it must have the following methods: | 91 it must have the following methods: |
85 - get_trust_ui(entity): return a XMLUI for trust management | 92 - get_trust_ui(entity): return a XMLUI for trust management |
90 entity(jid.JID): entity to start encrypted session with | 97 entity(jid.JID): entity to start encrypted session with |
91 - stop_encryption(entity): start encrypted session | 98 - stop_encryption(entity): start encrypted session |
92 entity(jid.JID): entity to stop encrypted session with | 99 entity(jid.JID): entity to stop encrypted session with |
93 if they don't exists, those 2 methods will be ignored. | 100 if they don't exists, those 2 methods will be ignored. |
94 | 101 |
95 @param name(unicode): human readable name of the encryption algorithm | 102 @param name: human readable name of the encryption algorithm |
96 @param namespace(unicode): namespace of the encryption algorithm | 103 @param namespace: namespace of the encryption algorithm |
97 @param priority(int): priority of this plugin to encrypt an message when not | 104 @param priority: priority of this plugin to encrypt an message when not |
98 selected manually | 105 selected manually |
99 @param directed(bool): True if this plugin is directed (if it works with one | 106 @param directed: True if this plugin is directed (if it works with one |
100 device only at a time) | 107 device only at a time) |
101 """ | 108 """ |
102 existing_ns = set() | 109 existing_ns = set() |
103 existing_names = set() | 110 existing_names = set() |
104 for p in cls.plugins: | 111 for p in cls.plugins: |
105 existing_ns.add(p.namespace.lower()) | 112 existing_ns.add(p.namespace.lower()) |