From 0e988237f6fcb826afc42719adc335dcc7ca0e2e Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Wed, 8 Jul 2015 16:00:08 +0100 Subject: Don't pass a key id when creating a new outbound session --- javascript/build.py | 1 + javascript/demo.html | 18 +++++++++++------- javascript/olm_post.js | 3 +-- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'javascript') diff --git a/javascript/build.py b/javascript/build.py index 68b7e45..9766906 100755 --- a/javascript/build.py +++ b/javascript/build.py @@ -59,6 +59,7 @@ compile_args += source_files compile_args += ("--pre-js", pre_js) compile_args += ("--post-js", post_js) compile_args += ("-s", "EXPORTED_FUNCTIONS=@" + exported_functions) +compile_args += sys.argv[1:] library = "build/olm.js" diff --git a/javascript/demo.html b/javascript/demo.html index 5a32e96..c9cad8b 100644 --- a/javascript/demo.html +++ b/javascript/demo.html @@ -30,16 +30,20 @@ document.addEventListener("DOMContentLoaded", function (event) { tasks.push(["bob", "Creating account", function() { bob.create() }]); tasks.push(["alice", "Create outbound session", function() { var bobs_id_keys = JSON.parse(bob.identity_keys("bob", "bob_device", 0, 0)); - var bobs_curve25519_key; + var bobs_id_key; for (key in bobs_id_keys.keys) { if (key.startsWith("curve25519:")) { - bobs_curve25519_key = bobs_id_keys.keys[key]; + bobs_id_key = bobs_id_keys.keys[key]; } } - var bobs_keys_2 = JSON.parse(bob.one_time_keys())[1]; - a_session.create_outbound( - alice, bobs_curve25519_key, bobs_keys_2[0], bobs_keys_2[1] - ); + var bobs_ot_keys = JSON.parse(bob.one_time_keys()); + var bobs_ot_key; + for (key in bobs_ot_keys) { + if (key.startsWith("curve25519:")) { + bobs_ot_key = bobs_ot_keys[key]; + } + } + a_session.create_outbound(alice, bobs_id_key, bobs_ot_key); }]); tasks.push(["alice", "Encrypt first message", function() { message_1 = a_session.encrypt(""); @@ -96,7 +100,7 @@ document.addEventListener("DOMContentLoaded", function (event) { window.setTimeout(function() { task[2](); p.done(); - window.setTimeout(do_tasks, 0, next); + window.setTimeout(do_tasks, 50, next); }, 0) } else { next(); diff --git a/javascript/olm_post.js b/javascript/olm_post.js index 0494460..7bcc580 100644 --- a/javascript/olm_post.js +++ b/javascript/olm_post.js @@ -172,7 +172,7 @@ Session.prototype['unpickle'] = restore_stack(function(key, pickle) { }); Session.prototype['create_outbound'] = restore_stack(function( - account, their_identity_key, their_one_time_key_id, their_one_time_key + account, their_identity_key, their_one_time_key ) { var random_length = session_method( Module['_olm_create_outbound_session_random_length'] @@ -185,7 +185,6 @@ Session.prototype['create_outbound'] = restore_stack(function( session_method(Module['_olm_create_outbound_session'])( this.ptr, account.ptr, identity_key_buffer, identity_key_array.length, - their_one_time_key_id, one_time_key_buffer, one_time_key_array.length, random, random_length ); -- cgit v1.2.3