comparison sat/core/core_types.py @ 3911:8289ac1b34f4

plugin XEP-0384: Fully reworked to adjust to the reworked python-omemo: - support for both (modern) OMEMO under the `urn:xmpp:omemo:2` namespace and (legacy) OMEMO under the `eu.siacs.conversations.axolotl` namespace - maintains one identity across both versions of OMEMO - migrates data from the old plugin - includes more features for protocol stability - uses SCE for modern OMEMO - fully type-checked, linted and format-checked - added type hints to various pieces of backend code used by the plugin - added stubs for some Twisted APIs used by the plugin under stubs/ (use `export MYPYPATH=stubs/` before running mypy) - core (xmpp): enabled `send` trigger and made it an asyncPoint fix 375
author Syndace <me@syndace.dev>
date Tue, 23 Aug 2022 21:06:24 +0200
parents 722a38e78fd1
children 5a42c7842556
comparison
equal deleted inserted replaced
3910:199598223f82 3911:8289ac1b34f4
14 # GNU Affero General Public License for more details. 14 # GNU Affero General Public License for more details.
15 15
16 # You should have received a copy of the GNU Affero General Public License 16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 18
19 from collections import namedtuple
20 from typing import Dict
21 from typing_extensions import TypedDict
19 from twisted.words.protocols.jabber import jid as t_jid 22 from twisted.words.protocols.jabber import jid as t_jid
23 from twisted.words.xish import domish
20 24
21 25
22 class SatXMPPEntity: 26 class SatXMPPEntity:
23 27
24 jid: t_jid.JID 28 jid: t_jid.JID
25 is_component: bool 29 is_component: bool
30
31
32 EncryptionPlugin = namedtuple("EncryptionPlugin", ("instance",
33 "name",
34 "namespace",
35 "priority",
36 "directed"))
37
38
39 class EncryptionSession(TypedDict):
40 plugin: EncryptionPlugin
41
42
43 # Incomplete types built through observation rather than code inspection.
44 MessageDataExtra = TypedDict(
45 "MessageDataExtra",
46 { "encrypted": bool, "origin_id": str },
47 total=False
48 )
49
50
51 MessageData = TypedDict("MessageData", {
52 "from": t_jid.JID,
53 "to": t_jid.JID,
54 "uid": str,
55 "message": Dict[str, str],
56 "subject": Dict[str, str],
57 "type": str,
58 "timestamp": float,
59 "extra": MessageDataExtra,
60 "ENCRYPTION": EncryptionSession,
61 "xml": domish.Element
62 }, total=False)