OmemoState

class omemo.state.OmemoState(own_jid, connection)[source]
__init__(own_jid, connection)[source]

Instantiates an OmemoState object.

Parameters:connection – an sqlite3.Connection
__module__ = 'omemo.state'
add_device(name, device_id)[source]
add_own_device(device_id)[source]
build_session(recipient_id, device_id, bundle_dict)[source]
bundle

.. highlight – python Returns all data needed to announce bundle information.

bundle_dict = {
    'signedPreKeyPublic': bytes,
    'prekeys': [(int, bytes) (int, bytes)],
    'identityKey': bytes,
    'signedPreKeyId': int,
    'signedPreKeySignature': bytes
}
create_msg(from_jid, jid, plaintext)[source]
decrypt_msg(msg_dict)[source]
device_list_for(jid)[source]

Return a list of known device ids for the specified jid.

Parameters:jid (string) – The contacts jid
devices_without_sessions(jid)[source]

List device_ids for the given jid which have no axolotl session.

Parameters:jid (string) – The contacts jid
Returns:[int] – A list of device_ids
get_session_cipher(jid, device_id)[source]
handlePreKeyWhisperMessage(recipient_id, device_id, key)[source]
handleWhisperMessage(recipient_id, device_id, key)[source]
own_device_id
own_device_id_published()[source]

Return True only if own device id was added via :py:method:`OmemoState.set_own_devices()`.

own_devices_without_sessions(own_jid)[source]

List own device_ids which have no axolotl session.

Parameters:own_jid (string) – Workaround for missing own jid in OmemoState
Returns:[int] – A list of device_ids
set_devices(name, devices)[source]

Return a an.

Parameters:
  • jid (string) – The contacts jid
  • devices ([int]) – A list of devices
set_own_devices(devices)[source]

Overwrite the current :py:attribute:`OmemoState.own_devices` with the given devices.

Parameters:devices ([int]) – A list of device_ids