aboutsummaryrefslogtreecommitdiff
path: root/javascript/olm_post.js
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-16 11:45:20 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-16 11:45:20 +0100
commit3468886e27c54690cc484662ea656f021997a9c7 (patch)
tree0e0c059c7963505520304c8c1fd7cc851f1ee6ca /javascript/olm_post.js
parent89d9b972a6d629648d18f4227a08596c65c3894d (diff)
Add method getting a session id. Update the python and javascript bindings
Diffstat (limited to 'javascript/olm_post.js')
-rw-r--r--javascript/olm_post.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/javascript/olm_post.js b/javascript/olm_post.js
index 60876b1..94d3e82 100644
--- a/javascript/olm_post.js
+++ b/javascript/olm_post.js
@@ -222,6 +222,29 @@ Session.prototype['create_inbound'] = restore_stack(function(
);
});
+Session.prototype['create_inbound_from'] = restore_stack(function(
+ account, identity_key, one_time_key_message
+) {
+ var identity_key_array = array_from_string(identity_key);
+ var identity_key_buffer = stack(identity_key_array);
+ var message_array = array_from_string(one_time_key_message);
+ var message_buffer = stack(message_array);
+ session_method(Module['_olm_create_inbound_session_from'])(
+ this.ptr, account.ptr,
+ identity_key_buffer, identity_key_array.length,
+ message_buffer, message_array.length
+ );
+});
+
+Session.prototype['session_id'] = restore_stack(function() {
+ var id_length = session_method(Module['_olm_session_id_length'])(this.ptr);
+ var id_buffer = stack(id_length);
+ session_method(Module['_olm_session_id'])(
+ this.ptr, id_buffer, id_length
+ );
+ return Pointer_stringify(id_buffer, id_length);
+});
+
Session.prototype['matches_inbound'] = restore_stack(function(
account, one_time_key_message
) {
@@ -232,6 +255,20 @@ Session.prototype['matches_inbound'] = restore_stack(function(
) ? true : false;
});
+Session.prototype['matches_inbound_from'] = restore_stack(function(
+ account, identity_key, one_time_key_message
+) {
+ var identity_key_array = array_from_string(identity_key);
+ var identity_key_buffer = stack(identity_key_array);
+ var message_array = array_from_string(one_time_key_message);
+ var message_buffer = stack(message_array);
+ return session_method(Module['_olm_matches_inbound_session_from'])(
+ this.ptr, account.ptr,
+ identity_key_buffer, identity_key_array.length,
+ message_buffer, message_array.length
+ ) ? true : false;
+});
+
Session.prototype['encrypt'] = restore_stack(function(
plaintext
) {