aboutsummaryrefslogtreecommitdiff
path: root/python/olm/session.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-04-24 12:35:17 +0100
committerRichard van der Hoff <richard@matrix.org>2017-04-24 12:35:17 +0100
commit853ea8fbc7b393455c69de1ce95011117f1423fe (patch)
tree155ef868e0927f227dd956674237489e0b6c9b01 /python/olm/session.py
parent1225de14d7aa5e53da51c7008046130996fdaca1 (diff)
parent51840d82dc6799687873be9839b99738fcd931a6 (diff)
Merge branch 'master'
Merge master into patched branch to fix conflicts prior to merge back to master
Diffstat (limited to 'python/olm/session.py')
-rw-r--r--python/olm/session.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/python/olm/session.py b/python/olm/session.py
index ff733b3..019ea9e 100644
--- a/python/olm/session.py
+++ b/python/olm/session.py
@@ -69,7 +69,7 @@ session_function(
c_void_p, c_size_t, # Plaintext
c_void_p, c_size_t, # Random
c_void_p, c_size_t, # Message
-);
+)
session_function(
lib.olm_decrypt_max_plaintext_length,
c_size_t, # Message Type
@@ -82,6 +82,7 @@ session_function(
c_void_p, c_size_t, # Plaintext
)
+
class Session(object):
def __init__(self):
self.buf = create_string_buffer(lib.olm_session_size())
@@ -118,7 +119,9 @@ class Session(object):
)
def create_inbound(self, account, one_time_key_message):
- one_time_key_message_buffer = create_string_buffer(one_time_key_message)
+ one_time_key_message_buffer = create_string_buffer(
+ one_time_key_message
+ )
lib.olm_create_inbound_session(
self.ptr,
account.ptr,
@@ -127,7 +130,9 @@ class Session(object):
def create_inbound_from(self, account, identity_key, one_time_key_message):
identity_key_buffer = create_string_buffer(identity_key)
- one_time_key_message_buffer = create_string_buffer(one_time_key_message)
+ one_time_key_message_buffer = create_string_buffer(
+ one_time_key_message
+ )
lib.olm_create_inbound_session_from(
self.ptr,
account.ptr,
@@ -138,11 +143,13 @@ class Session(object):
def session_id(self):
id_length = lib.olm_session_id_length(self.ptr)
id_buffer = create_string_buffer(id_length)
- lib.olm_session_id(self.ptr, id_buffer, id_length);
+ lib.olm_session_id(self.ptr, id_buffer, id_length)
return id_buffer.raw
def matches_inbound(self, one_time_key_message):
- one_time_key_message_buffer = create_string_buffer(one_time_key_message)
+ one_time_key_message_buffer = create_string_buffer(
+ one_time_key_message,
+ )
return bool(lib.olm_matches_inbound_session(
self.ptr,
one_time_key_message_buffer, len(one_time_key_message)
@@ -150,7 +157,9 @@ class Session(object):
def matches_inbound_from(self, identity_key, one_time_key_message):
identity_key_buffer = create_string_buffer(identity_key)
- one_time_key_message_buffer = create_string_buffer(one_time_key_message)
+ one_time_key_message_buffer = create_string_buffer(
+ one_time_key_message,
+ )
return bool(lib.olm_matches_inbound_session(
self.ptr,
identity_key_buffer, len(identity_key),