from __future__ import annotations
import enum
from typing import Dict, FrozenSet, List, Mapping, NamedTuple, Optional, Tuple, Union
from typing_extensions import TypeAlias
__all__ = [
"AsyncFramework",
"DeviceInformation",
"DeviceList",
"JSONType",
"OMEMOException",
"SignedLabel",
"TrustLevel"
]
[docs]
@enum.unique
class AsyncFramework(enum.Enum):
"""
Frameworks for asynchronous code supported by python-omemo.
"""
ASYNCIO = "ASYNCIO"
TWISTED = "TWISTED"
[docs]
class OMEMOException(Exception):
"""
Parent type for all custom exceptions in this library.
"""
[docs]
class SignedLabel(NamedTuple):
"""
Structure containing a device label and the corresponding signature.
"""
label: str
signature: bytes
[docs]
@enum.unique
class TrustLevel(enum.Enum):
"""
The three core trust levels.
"""
TRUSTED = "TRUSTED"
DISTRUSTED = "DISTRUSTED"
UNDECIDED = "UNDECIDED"
DeviceList: TypeAlias = Dict[int, Optional[SignedLabel]]
JSONType: TypeAlias = Union[Mapping[str, "JSONType"], List["JSONType"], str, int, float, bool, None]