Source code for doubleratchet.types

from __future__ import annotations

from typing import List, Mapping, NamedTuple, OrderedDict, Tuple, TypeAlias, Union


__all__ = [
    "EncryptedMessage",
    "Header",
    "JSONType",
    "JSONObject",
    "SkippedMessageKeys"
]


################
# Type Aliases #
################

JSONType: TypeAlias = Union[Mapping[str, "JSONType"], List["JSONType"], str, int, float, bool, None]
JSONObject: TypeAlias = Mapping[str, "JSONType"]

SkippedMessageKeys: TypeAlias = OrderedDict[Tuple[bytes, int], bytes]


############################
# Structures (NamedTuples) #
############################





[docs] class EncryptedMessage(NamedTuple): """ A Double Ratchet-encrypted message, consisting of the header and ciphertext. """ header: Header ciphertext: bytes