From b6e248c9a58cccbcd5dea7bdc8e3cdee4af03722 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 10 Jul 2015 11:57:53 +0100 Subject: Output simpler JSON for the account keys, don't sign the JSON but instead provide a olm_account_sign method so that the user of the library can sign the JSON themselves --- javascript/demo.html | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'javascript/demo.html') diff --git a/javascript/demo.html b/javascript/demo.html index 2120f95..20e780b 100644 --- a/javascript/demo.html +++ b/javascript/demo.html @@ -19,8 +19,8 @@ document.addEventListener("DOMContentLoaded", function (event) { return {start:start, done:done}; } - var alice = new Olm.Account(); - var bob = new Olm.Account(); + window.alice = new Olm.Account(); + window.bob = new Olm.Account(); var a_session = new Olm.Session(); var b_session = new Olm.Session(); var message_1; @@ -32,19 +32,12 @@ document.addEventListener("DOMContentLoaded", function (event) { bob.generate_one_time_keys(1); }]); tasks.push(["alice", "Create outbound session", function() { - var bobs_id_keys = JSON.parse(bob.identity_keys("bob", "bob_device", 0, 0)); - var bobs_id_key; - for (key in bobs_id_keys.keys) { - if (key.startsWith("curve25519:")) { - bobs_id_key = bobs_id_keys.keys[key]; - } - } + var bobs_id_keys = JSON.parse(bob.identity_keys()); + var bobs_id_key = bobs_id_keys.curve25519; 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]; - } + for (key in bobs_ot_keys.curve25519) { + bobs_ot_key = bobs_ot_keys.curve25519[key]; } a_session.create_outbound(alice, bobs_id_key, bobs_ot_key); }]); @@ -104,7 +97,7 @@ document.addEventListener("DOMContentLoaded", function (event) { task[2](); p.done(); window.setTimeout(do_tasks, 50, next); - }, 0) + }, 50) } else { next(); } -- cgit v1.2.3