aboutsummaryrefslogtreecommitdiff
path: root/include/olm/inbound_group_session.h
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2017-01-06 12:55:05 +0000
committerRichard van der Hoff <richard@matrix.org>2017-01-06 16:41:56 +0000
commit5fbeb3e29b6440a799d9320e871a1d4d509130b8 (patch)
tree63fd11381cfcd3b3d5b76e288657a3a453b21471 /include/olm/inbound_group_session.h
parentbd6ab72ca40e0484be2a39734ba135437e820d63 (diff)
Enable exporting inbound group session keys
A pair of functions which allow you to export the megolm keys for an inbound group session, so that an application can save/restore them.
Diffstat (limited to 'include/olm/inbound_group_session.h')
-rw-r--r--include/olm/inbound_group_session.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/olm/inbound_group_session.h b/include/olm/inbound_group_session.h
index f8a0bc3..d47af8a 100644
--- a/include/olm/inbound_group_session.h
+++ b/include/olm/inbound_group_session.h
@@ -165,6 +165,37 @@ 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
+);
+
+/**
+ * Get the number of bytes returned by olm_export_inbound_group_session()
+ */
+size_t olm_export_inbound_group_session_length(
+ const OlmInboundGroupSession *session
+);
+
+/**
+ * Export the base64-encoded ratchet key for this session, at the given index,
+ * in a format which can be used by olm_import_inbound_group_session
+ *
+ * Returns the length of the ratchet key on success or olm_error() on
+ * failure. On failure last_error will be set with an error code. The
+ * last_error will be:
+ * * OUTPUT_BUFFER_TOO_SMALL if the buffer was too small
+ * * OLM_UNKNOWN_MESSAGE_INDEX if we do not have a session key corresponding to the
+ * given index (ie, it was sent before the session key was shared with
+ * us)
+ */
+size_t olm_export_inbound_group_session(
+ OlmInboundGroupSession *session,
+ uint8_t * key, size_t key_length, uint32_t message_index
+);
+
#ifdef __cplusplus
} // extern "C"