aboutsummaryrefslogtreecommitdiff
path: root/python/olm/inbound_group_session.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-01-06 17:40:39 +0000
committerRichard van der Hoff <richard@matrix.org>2017-01-09 17:45:46 +0000
commita2f0c93a93f6914291954b08a7518b4f17561c11 (patch)
treefc75bc7e84808868bc4b9eb3844115bab277ada2 /python/olm/inbound_group_session.py
parent5fbeb3e29b6440a799d9320e871a1d4d509130b8 (diff)
Implement importing group session data
olm_import_inbound_group_session, which reads the format written by olm_export_inbound_group_session to initialise a group session.
Diffstat (limited to 'python/olm/inbound_group_session.py')
-rw-r--r--python/olm/inbound_group_session.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/python/olm/inbound_group_session.py b/python/olm/inbound_group_session.py
index 67906b2..4390b34 100644
--- a/python/olm/inbound_group_session.py
+++ b/python/olm/inbound_group_session.py
@@ -37,6 +37,10 @@ inbound_group_session_function(
)
inbound_group_session_function(
+ lib.olm_import_inbound_group_session, c_void_p, c_size_t
+)
+
+inbound_group_session_function(
lib.olm_group_decrypt_max_plaintext_length, c_void_p, c_size_t
)
inbound_group_session_function(
@@ -83,6 +87,12 @@ class InboundGroupSession(object):
self.ptr, key_buffer, len(session_key)
)
+ def import_session(self, session_key):
+ key_buffer = create_string_buffer(session_key)
+ lib.olm_import_inbound_group_session(
+ self.ptr, key_buffer, len(session_key)
+ )
+
def decrypt(self, message):
message_buffer = create_string_buffer(message)
max_plaintext_length = lib.olm_group_decrypt_max_plaintext_length(