aboutsummaryrefslogtreecommitdiff
path: root/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'javascript')
-rwxr-xr-xjavascript/build.py1
-rw-r--r--javascript/demo.html18
-rw-r--r--javascript/olm_post.js3
3 files changed, 13 insertions, 9 deletions
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
);