aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_inbound_group_session.js
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 /javascript/olm_inbound_group_session.js
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 'javascript/olm_inbound_group_session.js')
-rw-r--r--javascript/olm_inbound_group_session.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js
index 2e4727f..8721a10 100644
--- a/javascript/olm_inbound_group_session.js
+++ b/javascript/olm_inbound_group_session.js
@@ -123,4 +123,21 @@ 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);
+});
+
+InboundGroupSession.prototype['export_session'] = restore_stack(function(message_index) {
+ var key_length = inbound_group_session_method(
+ Module['_olm_export_inbound_group_session_length']
+ )(this.ptr);
+ var key = stack(key_length + NULL_BYTE_PADDING_LENGTH);
+ outbound_group_session_method(Module['_olm_export_inbound_group_session'])(
+ this.ptr, key, key_length, message_index
+ );
+ return Pointer_stringify(key);
+});
+
olm_exports['InboundGroupSession'] = InboundGroupSession;