diff --git a/include/olm/inbound_group_session.h b/include/olm/inbound_group_session.h index f8a0bc3..3e5a8b2 100644 --- a/include/olm/inbound_group_session.h +++ b/include/olm/inbound_group_session.h @@ -165,6 +165,13 @@ size_t olm_inbound_group_session_id( uint8_t * id, size_t id_length ); +/** + * Get the first message index we know how to decrypt. + */ +uint32_t olm_inbound_group_session_first_known_index( + const OlmInboundGroupSession *session +); + #ifdef __cplusplus } // extern "C" diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js index 1b7fcfe..5fd56b3 100644 --- a/javascript/olm_inbound_group_session.js +++ b/javascript/olm_inbound_group_session.js @@ -105,4 +105,10 @@ InboundGroupSession.prototype['session_id'] = restore_stack(function() { return Pointer_stringify(session_id); }); +InboundGroupSession.prototype['first_known_index'] = restore_stack(function() { + return inbound_group_session_method( + Module['_olm_inbound_group_session_first_known_index'] + )(this.ptr); +}); + olm_exports['InboundGroupSession'] = InboundGroupSession; diff --git a/src/inbound_group_session.c b/src/inbound_group_session.c index a54e55f..6f3c7e0 100644 --- a/src/inbound_group_session.c +++ b/src/inbound_group_session.c @@ -391,3 +391,9 @@ size_t olm_inbound_group_session_id( session->signing_key.public_key, GROUP_SESSION_ID_LENGTH, id ); } + +uint32_t olm_inbound_group_session_first_known_index( + const OlmInboundGroupSession *session +) { + return session->initial_ratchet.counter; +}