File: bundle.py

package info (click to toggle)
python-omemo 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 584 kB
  • sloc: python: 3,511; makefile: 13
file content (60 lines) | stat: -rw-r--r-- 1,342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from abc import ABC, abstractmethod


__all__ = [
    "Bundle"
]


class Bundle(ABC):
    """
    The bundle of a device, containing the cryptographic information required for active session building.

    Note:
        All usages of "identity key" in the public API refer to the public part of the identity key pair in
        Ed25519 format.
    """

    @property
    @abstractmethod
    def namespace(self) -> str:
        pass

    @property
    @abstractmethod
    def bare_jid(self) -> str:
        pass

    @property
    @abstractmethod
    def device_id(self) -> int:
        pass

    @property
    @abstractmethod
    def identity_key(self) -> bytes:
        pass

    @abstractmethod
    def __eq__(self, other: object) -> bool:
        """
        Check an object for equality with this Bundle instance.

        Args:
            other: The object to compare to this instance.

        Returns:
            Whether the other object is a bundle with the same contents as this instance.

        Note:
            The order in which pre keys are included in the bundles does not matter.
        """

    @abstractmethod
    def __hash__(self) -> int:
        """
        Hash this instance in a manner that is consistent with :meth:`__eq__`.

        Returns:
            An integer value representing this instance.
        """