From 000a5e1440590381441390ba2b9eee71fa73907e Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 23 Mar 2014 13:19:53 -0400 Subject: [PATCH] Fix up a few things so registration works --- js/api.js | 5 +++++ js/helpers.js | 2 +- js/options.js | 2 +- options.html | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/api.js b/js/api.js index 023a4398..66fba915 100644 --- a/js/api.js +++ b/js/api.js @@ -99,6 +99,11 @@ var API = new function() { }; this.registerKeys = function(keys, success_callback, error_callback) { + //TODO: Do this conversion somewhere else? + var identityKey = btoa(getString(keys.keys[0].identityKey)); + for (var i = 0; i < keys.keys.length; i++) + keys.keys[i] = {keyId: i, publicKey: btoa(getString(keys.keys[i].publicKey)), identityKey: identityKey}; + keys.lastResortKey = {keyId: keys.lastResortKey.keyId, publicKey: btoa(getString(keys.lastResortKey.publicKey)), identityKey: identityKey}; this.doAjax({ call : 'keys', httpType : 'PUT', diff --git a/js/helpers.js b/js/helpers.js index f6a9d558..9c0f2d33 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -855,7 +855,7 @@ var crypto_tests = {}; if (identityKey === undefined) crypto_storage.getNewPubKeySTORINGPrivKey("identityKey", function(pubKey) { identityKeyCalculated(pubKey); }); else - identityKeyCalculated(pubKey); + identityKeyCalculated(identityKey); } }( window.crypto = window.crypto || {}, jQuery )); diff --git a/js/options.js b/js/options.js index 615f6e66..381c7cef 100644 --- a/js/options.js +++ b/js/options.js @@ -58,7 +58,7 @@ $('#init-go').click(function() { $('#verify4done').html(''); $('#verify').show(); - API.confirmCode(code, number, password, signaling_key, single_device, + API.confirmCode($('#code').val(), number, password, signaling_key, single_device, function(response) { if (single_device) response = 1; diff --git a/options.html b/options.html index b5d34b2d..fad6e53c 100644 --- a/options.html +++ b/options.html @@ -41,7 +41,6 @@ -