diff options
Diffstat (limited to 'include/olm')
-rw-r--r-- | include/olm/olm.hh | 29 | ||||
-rw-r--r-- | include/olm/session.hh | 2 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/olm/olm.hh b/include/olm/olm.hh index 64454e6..f08fb9f 100644 --- a/include/olm/olm.hh +++ b/include/olm/olm.hh @@ -242,6 +242,21 @@ size_t olm_create_inbound_session( void * one_time_key_message, size_t message_length ); +/** Create a new in-bound session for sending/receiving messages from an + * incoming PRE_KEY message. Returns olm_error() on failure. If the base64 + * couldn't be decoded then olm_session_last_error will be "INVALID_BASE64". + * If the message was for an unsupported protocol version then + * olm_session_last_error() will be "BAD_MESSAGE_VERSION". If the message + * couldn't be decoded then then olm_session_last_error() will be + * "BAD_MESSAGE_FORMAT". If the message refers to an unknown one time + * key then olm_session_last_error() will be "BAD_MESSAGE_KEY_ID". */ +size_t olm_create_inbound_session_from( + OlmSession * session, + OlmAccount * account, + void const * their_identity_key, size_t their_identity_key_length, + void * one_time_key_message, size_t message_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 @@ -255,6 +270,20 @@ size_t olm_matches_inbound_session( void * one_time_key_message, size_t message_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 + * couldn't be decoded then olm_session_last_error will be "INVALID_BASE64". + * If the message was for an unsupported protocol version then + * olm_session_last_error() will be "BAD_MESSAGE_VERSION". If the message + * couldn't be decoded then then olm_session_last_error() will be + * "BAD_MESSAGE_FORMAT". */ +size_t olm_matches_inbound_session_from( + OlmSession * session, + void const * their_identity_key, size_t their_identity_key_length, + void * one_time_key_message, size_t message_length +); + /** Removes the one time keys that the session used from the account. Returns * olm_error() on failure. If the account doesn't have any matching one time * keys then olm_account_last_error() will be "BAD_MESSAGE_KEY_ID". */ diff --git a/include/olm/session.hh b/include/olm/session.hh index 125df68..b70ce6a 100644 --- a/include/olm/session.hh +++ b/include/olm/session.hh @@ -50,10 +50,12 @@ struct Session { std::size_t new_inbound_session( Account & local_account, + Curve25519PublicKey const * their_identity_key, std::uint8_t const * one_time_key_message, std::size_t message_length ); bool matches_inbound_session( + Curve25519PublicKey const * their_identity_key, std::uint8_t const * one_time_key_message, std::size_t message_length ); |