aboutsummaryrefslogtreecommitdiff
path: root/python/olm/outbound_group_session.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-18 17:20:06 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-24 13:39:34 +0100
commit8b1514c0a653ccc3f49db70131d7d4f7524f1f9b (patch)
tree098b5a61c4b08905e191515a5829dbcd8d10e194 /python/olm/outbound_group_session.py
parente545ad7eaf55ac8b7dc7d37c046c541e35cef542 (diff)
Implement functions to get the state of outbound session
We need to be able to inspect an outbound session so that we can tell our peer how to set up an inbound session.
Diffstat (limited to 'python/olm/outbound_group_session.py')
-rw-r--r--python/olm/outbound_group_session.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/python/olm/outbound_group_session.py b/python/olm/outbound_group_session.py
index 6182647..56f0962 100644
--- a/python/olm/outbound_group_session.py
+++ b/python/olm/outbound_group_session.py
@@ -34,12 +34,21 @@ outbound_group_session_function(
outbound_group_session_function(lib.olm_init_outbound_group_session_random_length)
outbound_group_session_function(lib.olm_init_outbound_group_session, c_void_p, c_size_t)
+
+lib.olm_outbound_group_session_message_index.argtypes = [c_void_p]
+lib.olm_outbound_group_session_message_index.restype = c_uint32
+
outbound_group_session_function(lib.olm_group_encrypt_message_length, c_size_t)
outbound_group_session_function(lib.olm_group_encrypt,
c_void_p, c_size_t, # Plaintext
c_void_p, c_size_t, # Message
)
+outbound_group_session_function(lib.olm_outbound_group_session_id_length)
+outbound_group_session_function(lib.olm_outbound_group_session_id, c_void_p, c_size_t)
+outbound_group_session_function(lib.olm_outbound_group_session_key_length)
+outbound_group_session_function(lib.olm_outbound_group_session_key, c_void_p, c_size_t)
+
class OutboundGroupSession(object):
def __init__(self):
@@ -81,3 +90,18 @@ class OutboundGroupSession(object):
message_buffer, message_length,
)
return message_buffer.raw
+
+ def session_id(self):
+ id_length = lib.olm_outbound_group_session_id_length(self.ptr)
+ id_buffer = create_string_buffer(id_length)
+ lib.olm_outbound_group_session_id(self.ptr, id_buffer, id_length);
+ return id_buffer.raw
+
+ def message_index(self):
+ return lib.olm_outbound_group_session_message_index(self.ptr)
+
+ def session_key(self):
+ key_length = lib.olm_outbound_group_session_key_length(self.ptr)
+ key_buffer = create_string_buffer(key_length)
+ lib.olm_outbound_group_session_key(self.ptr, key_buffer, key_length);
+ return key_buffer.raw