From 3468886e27c54690cc484662ea656f021997a9c7 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Thu, 16 Jul 2015 11:45:20 +0100 Subject: Add method getting a session id. Update the python and javascript bindings --- include/olm/olm.hh | 13 +++++++++++++ include/olm/session.hh | 6 ++++++ 2 files changed, 19 insertions(+) (limited to 'include/olm') diff --git a/include/olm/olm.hh b/include/olm/olm.hh index f08fb9f..a5a50de 100644 --- a/include/olm/olm.hh +++ b/include/olm/olm.hh @@ -257,6 +257,19 @@ size_t olm_create_inbound_session_from( void * one_time_key_message, size_t message_length ); +/** The length of the buffer needed to return the id for this session. */ +size_t olm_session_id_length( + OlmSession * session +); + +/** An identifier for this session. Will be the same for both ends of the + * conversation. If the id buffer is too small then olm_session_last_error() + * will be "OUTPUT_BUFFER_TOO_SMALL". */ +size_t olm_session_id( + OlmSession * session, + void * id, size_t id_length +); + /** Checks if the PRE_KEY message is for this in-bound session. This can happen * if multiple messages are sent to this account before this account sends a * message in reply. Returns olm_error() on failure. If the base64 diff --git a/include/olm/session.hh b/include/olm/session.hh index b70ce6a..993a8da 100644 --- a/include/olm/session.hh +++ b/include/olm/session.hh @@ -54,6 +54,12 @@ struct Session { std::uint8_t const * one_time_key_message, std::size_t message_length ); + std::size_t session_id_length(); + + std::size_t session_id( + std::uint8_t * id, std::size_t id_length + ); + bool matches_inbound_session( Curve25519PublicKey const * their_identity_key, std::uint8_t const * one_time_key_message, std::size_t message_length -- cgit v1.2.3