Add Python wrapper for olm_session_describe
Signed-off-by: Tulir Asokan <tulir@beeper.com>
This commit is contained in:
parent
60122a2c2d
commit
9946acac23
1 changed files with 18 additions and 0 deletions
|
@ -391,6 +391,24 @@ class Session(object):
|
||||||
|
|
||||||
return bool(ret)
|
return bool(ret)
|
||||||
|
|
||||||
|
def describe(self, buffer_length=600):
|
||||||
|
# type: (int) -> str
|
||||||
|
"""
|
||||||
|
Generate a string describing the internal state of an olm session
|
||||||
|
for debugging and logging purposes.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
buffer_length(int): The size of buffer for the string.
|
||||||
|
If the buffer is not large enough to hold the entire string, it
|
||||||
|
will be truncated and will end with "...". A buffer length of
|
||||||
|
600 will be enough to hold any output.
|
||||||
|
"""
|
||||||
|
describe_buffer = ffi.new("char[]", buffer_length)
|
||||||
|
lib.olm_session_describe(
|
||||||
|
self._session, describe_buffer, buffer_length
|
||||||
|
)
|
||||||
|
return bytes_to_native_str(ffi.string(describe_buffer))
|
||||||
|
|
||||||
|
|
||||||
class InboundSession(Session):
|
class InboundSession(Session):
|
||||||
"""Inbound Olm session for p2p encrypted communication.
|
"""Inbound Olm session for p2p encrypted communication.
|
||||||
|
|
Loading…
Reference in a new issue