aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_inbound_group_session.js
diff options
context:
space:
mode:
Diffstat (limited to 'javascript/olm_inbound_group_session.js')
-rw-r--r--javascript/olm_inbound_group_session.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/javascript/olm_inbound_group_session.js b/javascript/olm_inbound_group_session.js
index 9722c31..6058233 100644
--- a/javascript/olm_inbound_group_session.js
+++ b/javascript/olm_inbound_group_session.js
@@ -52,12 +52,12 @@ InboundGroupSession.prototype['unpickle'] = restore_stack(function(key, pickle)
);
});
-InboundGroupSession.prototype['create'] = restore_stack(function(message_index, session_key) {
+InboundGroupSession.prototype['create'] = restore_stack(function(session_key) {
var key_array = array_from_string(session_key);
var key_buffer = stack(key_array);
inbound_group_session_method(Module['_olm_init_inbound_group_session'])(
- this.ptr, message_index, key_buffer, key_array.length
+ this.ptr, key_buffer, key_array.length
);
});
@@ -89,4 +89,15 @@ InboundGroupSession.prototype['decrypt'] = restore_stack(function(
return Pointer_stringify(plaintext_buffer);
});
+InboundGroupSession.prototype['session_id'] = restore_stack(function() {
+ var length = inbound_group_session_method(
+ Module['_olm_inbound_group_session_id_length']
+ )(this.ptr);
+ var session_id = stack(length + NULL_BYTE_PADDING_LENGTH);
+ inbound_group_session_method(Module['_olm_inbound_group_session_id'])(
+ this.ptr, session_id, length
+ );
+ return Pointer_stringify(session_id);
+});
+
olm_exports['InboundGroupSession'] = InboundGroupSession;