aboutsummaryrefslogtreecommitdiff
path: root/javascript/demo.html
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-07-10 11:57:53 +0100
committerMark Haines <mark.haines@matrix.org>2015-07-10 11:57:53 +0100
commitb6e248c9a58cccbcd5dea7bdc8e3cdee4af03722 (patch)
tree0924e69d210b7d6878c7fb11f68b942b15f3ca6c /javascript/demo.html
parent373acefde7be92f86b8294b325519ad916b1e054 (diff)
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
Diffstat (limited to 'javascript/demo.html')
-rw-r--r--javascript/demo.html21
1 files changed, 7 insertions, 14 deletions
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();
}