Module: message

class omemo.message.Content[source]

Bases: ABC

The encrypted content of an OMEMO-encrypted message. Contains for example the ciphertext, but can contain other backend-specific data that is shared between all recipients.

abstract property empty: bool

Returns: Whether this instance corresponds to an empty OMEMO message purely used for protocol stability reasons.

class omemo.message.EncryptedKeyMaterial[source]

Bases: ABC

Encrypted key material. When decrypted, the key material can in turn be used to decrypt the content. One collection of key material is included in an OMEMO-encrypted message per recipient. Defails are backend-specific.

abstract property bare_jid: str
abstract property device_id: int
class omemo.message.KeyExchange[source]

Bases: ABC

Key exchange information, generated by the active part of the session building process, then transferred to and consumed by the passive part of the session building process. Details are backend-specific.

abstract property identity_key: bytes
abstractmethod builds_same_session(other)[source]
Parameters:

other (KeyExchange) – The other key exchange instance to compare to this instance.

Return type:

bool

Returns:

Whether the key exchange information stored in this instance and the key exchange information stored in the other instance would build the same session.

class omemo.message.Message(namespace, bare_jid, device_id, content, keys)[source]

Bases: NamedTuple

Simple structure representing an OMEMO-encrypted message.

Parameters:
namespace: str

Alias for field number 0

bare_jid: str

Alias for field number 1

device_id: int

Alias for field number 2

content: Content

Alias for field number 3

keys: FrozenSet[Tuple[EncryptedKeyMaterial, KeyExchange | None]]

Alias for field number 4

class omemo.message.PlainKeyMaterial[source]

Bases: ABC

Key material which be used to decrypt the content. Defails are backend-specific.