summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js66
1 files changed, 31 insertions, 35 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
index 834e21b..fbca1ff 100644
--- a/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
+++ b/frontend/gamma/js/Clipperz/PM/DataModel/OneTimePassword.js
@@ -2,6 +2,5 @@
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
@@ -9,10 +8,10 @@ refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
@@ -20,4 +19,3 @@ refer to http://www.clipperz.com.
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
@@ -145,8 +143,8 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
145 encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String(); 143 encodedPassphrase = new Clipperz.ByteArray(this.user().passphrase()).toBase64String();
146//MochiKit.Logging.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length); 144//Clipperz.logDebug("--- encodedPassphrase.length: " + encodedPassphrase.length);
147 prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String(); 145 prefixPadding = getRandomBytes(getRandomBytes(1).byteAtIndex(0)).toBase64String();
148//MochiKit.Logging.logDebug("--- prefixPadding.length: " + prefixPadding.length); 146//Clipperz.logDebug("--- prefixPadding.length: " + prefixPadding.length);
149 suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String(); 147 suffixPadding = getRandomBytes((500 - prefixPadding.length - encodedPassphrase.length) * 6 / 8).toBase64String();
150//MochiKit.Logging.logDebug("--- suffixPadding.length: " + suffixPadding.length); 148//Clipperz.logDebug("--- suffixPadding.length: " + suffixPadding.length);
151//MochiKit.Logging.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length)); 149//Clipperz.logDebug("--- total.length: " + (prefixPadding.length + encodedPassphrase.length + suffixPadding.length));
152 150
@@ -160,4 +158,4 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
160 result = packedPassphrase; 158 result = packedPassphrase;
161//MochiKit.Logging.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result); 159//Clipperz.logDebug("===== OTP packedPassprase: [" + result.length + "]" + result);
162//MochiKit.Logging.logDebug("<<< OneTimePassword.packedPassphrase"); 160//Clipperz.logDebug("<<< OneTimePassword.packedPassphrase");
163 161
@@ -178,4 +176,4 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
178 176
179//MochiKit.Logging.logDebug(">>> OneTimePassword.encryptedData"); 177//Clipperz.logDebug(">>> OneTimePassword.encryptedData");
180//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference()); 178//Clipperz.logDebug("--- OneTimePassword.encryptedData - id: " + this.reference());
181 result = { 179 result = {
@@ -187,10 +185,10 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
187 } 185 }
188//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result)); 186//Clipperz.logDebug("--- OneTimePassword.encryptedData - 2: " + Clipperz.Base.serializeJSON(result));
189 deferredResult = new MochiKit.Async.Deferred(); 187 deferredResult = new MochiKit.Async.Deferred();
190//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 3"); 188//Clipperz.logDebug("--- OneTimePassword.encryptedData - 3");
191//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;}); 189//deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 1: " + res); return res;});
192 //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase()); 190 //# deferredResult.addCallback(Clipperz.PM.Crypto.deferredEncryptWithCurrentVersion, this.passwordValue(), this.packedPassphrase());
193 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase')); 191 deferredResult.addCallback(MochiKit.Base.method(this, 'encryptedPackedPassphrase'));
194//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 4"); 192//Clipperz.logDebug("--- OneTimePassword.encryptedData - 4");
195//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;}); 193//deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 2: [" + res.length + "]" + res); return res;});
196 deferredResult.addCallback(function(aResult, res) { 194 deferredResult.addCallback(function(aResult, res) {
@@ -199,6 +197,6 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
199 }, result); 197 }, result);
200//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 5"); 198//Clipperz.logDebug("--- OneTimePassword.encryptedData - 5");
201//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); 199//deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.encryptedData - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
202 deferredResult.callback(); 200 deferredResult.callback();
203//MochiKit.Logging.logDebug("--- OneTimePassword.encryptedData - 6"); 201//Clipperz.logDebug("--- OneTimePassword.encryptedData - 6");
204 202
@@ -213,3 +211,3 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
213 211
214//MochiKit.Logging.logDebug(">>> OneTimePassword.saveChanges"); 212//Clipperz.logDebug(">>> OneTimePassword.saveChanges");
215 result = {}; 213 result = {};
@@ -232,3 +230,3 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
232 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData'); 230 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_sendingData');
233//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;}); 231//deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 1: " + Clipperz.Base.serializeJSON(res)); return res;});
234 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword'); 232 deferredResult.addCallback(MochiKit.Base.method(this.user().connection(), 'message'), 'addNewOneTimePassword');
@@ -236,8 +234,8 @@ Clipperz.PM.DataModel.OneTimePassword.prototype = MochiKit.Base.update(null, {
236 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface'); 234 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'updatedProgressState', 'saveOTP_updatingInterface');
237//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); 235//deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;});
238 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated'); 236 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'notify', 'OTPUpdated');
239 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null); 237 deferredResult.addCallback(Clipperz.NotificationCenter.deferredNotification, this, 'oneTimePassword_saveChanges_done', null);
240//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;}); 238//deferredResult.addBoth(function(res) {Clipperz.logDebug("OneTimePassword.saveChanges - 2: " + res); return res;});
241 deferredResult.callback(); 239 deferredResult.callback();
242//MochiKit.Logging.logDebug("<<< OneTimePassword.saveChanges"); 240//Clipperz.logDebug("<<< OneTimePassword.saveChanges");
243 241
@@ -310,3 +308,2 @@ Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue = function(aPa
310 //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg" 308 //"yaxx k7ww - f8y6 tqz5 - 58b6 th44 - 9cwv q0fg"
311//console.log("Clipperz.PM.DataModel.OneTimePassword.isValidOneTimePasswordValue", aPassword);
312 if (aPassword.replace(/[\s\-]/g, '').length == 32) { 309 if (aPassword.replace(/[\s\-]/g, '').length == 32) {
@@ -349,3 +346,2 @@ Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword = function(aPass
349 346
350//console.log("Clipperz.PM.DataModel.OneTimePassword.normalizedOneTimePassword", aPassword, result);
351 return result; 347 return result;