Module: session
- class omemo.session.Initiation(*values)[source]
Bases:
EnumEnumeration identifying whether a session was built through active or passive session initiation.
- ACTIVE = 'ACTIVE'
- PASSIVE = 'PASSIVE'
- class omemo.session.Session[source]
Bases:
ABCClass representing an OMEMO session. Used to encrypt/decrypt key material for/from a single recipient/sender device in a perfectly forwared secure manner.
Warning
Changes to a session may only be persisted when
store_session()is called.Warning
Multiple sessions for the same device can exist in memory, however only one session per device can exist in storage. Which one of the in-memory sessions is persisted in storage is controlled by calling the
store_session()method.Note
The API of the
Sessionclass was intentionally kept thin. All “complex” interactions with session objects happen via methods ofBackend. This allows backend implementors to have theSessionclass be a simple “stupid” data holding structure type, while all of the more complex logic is located in the implementation of theBackendclass itself. Backend implementations are obviously free to implement logic on their respectiveSessionimplementations and forward calls to them from theBackendmethods.- abstract property initiation: Initiation
Returns: Whether this session was actively initiated or passively.
- abstract property confirmed: bool
In case this session was built through active session initiation, this flag should indicate whether the session initiation has been “confirmed”, i.e. at least one message was received and decrypted using this session.
- abstract property key_exchange: KeyExchange
Either the key exchange information received during passive session building, or the key exchange information created as part of active session building. The key exchange information is needed by the protocol for stability reasons, to make sure that all sides can build the session, even if messages are lost or received out of order.
- Returns:
The key exchange information associated with this session.