author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2014-06-02 11:39:16 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2014-06-02 16:35:38 (UTC) |
commit | 0422224521f62da210d1ae6ee15ecdf09f47f1f8 (patch) (unidiff) | |
tree | df7c0394fbcd1f8bc588ca8aab3ee83f5dc9f0cf /frontend | |
parent | 7fdb41fa2b1f621636882ad9059c1f3ecfb74083 (diff) | |
download | clipperz-0422224521f62da210d1ae6ee15ecdf09f47f1f8.zip clipperz-0422224521f62da210d1ae6ee15ecdf09f47f1f8.tar.gz clipperz-0422224521f62da210d1ae6ee15ecdf09f47f1f8.tar.bz2 |
Fixed authentication procedure for offline copy
3 files changed, 83 insertions, 26 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js index 1a5caff..b0b9b63 100644 --- a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -1,432 +1,459 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2013 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz, the online password manager. | 5 | This file is part of Clipperz, the online password manager. |
6 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
7 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
8 | 8 | ||
9 | * Clipperz is free software: you can redistribute it and/or modify it | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
10 | under the terms of the GNU Affero General Public License as published | 10 | under the terms of the GNU Affero General Public License as published |
11 | by the Free Software Foundation, either version 3 of the License, or | 11 | by the Free Software Foundation, either version 3 of the License, or |
12 | (at your option) any later version. | 12 | (at your option) any later version. |
13 | 13 | ||
14 | * Clipperz is distributed in the hope that it will be useful, but | 14 | * Clipperz is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
18 | 18 | ||
19 | * 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 |
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { |
25 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; | 25 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; |
26 | } | 26 | } |
27 | 27 | ||
28 | //============================================================================= | 28 | //============================================================================= |
29 | 29 | ||
30 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { | 30 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { |
31 | args = args || {}; | 31 | args = args || {}; |
32 | 32 | ||
33 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); | 33 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); |
34 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); | 34 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); |
35 | this._shouldPayTolls = args.shouldPayTolls || false; | 35 | this._shouldPayTolls = args.shouldPayTolls || false; |
36 | 36 | ||
37 | this._tolls = {}; | 37 | this._tolls = {}; |
38 | this._connections = {}; | 38 | this._connections = {}; |
39 | 39 | ||
40 | this._C = null; | ||
40 | this._b = null; | 41 | this._b = null; |
41 | this._B = null; | 42 | this._B = null; |
42 | this._A = null; | 43 | this._A = null; |
43 | this._userData = null; | 44 | this._userData = null; |
44 | 45 | ||
45 | return this; | 46 | return this; |
46 | } | 47 | } |
47 | 48 | ||
48 | //Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | 49 | //Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { |
49 | Clipperz.PM.Proxy.Offline.DataStore.prototype = MochiKit.Base.update(null, { | 50 | Clipperz.PM.Proxy.Offline.DataStore.prototype = MochiKit.Base.update(null, { |
50 | 51 | ||
51 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
52 | 53 | ||
53 | 'isReadOnly': function () { | 54 | 'isReadOnly': function () { |
54 | return this._isReadOnly; | 55 | return this._isReadOnly; |
55 | }, | 56 | }, |
56 | 57 | ||
57 | //------------------------------------------------------------------------- | 58 | //------------------------------------------------------------------------- |
58 | 59 | ||
59 | 'shouldPayTolls': function() { | 60 | 'shouldPayTolls': function() { |
60 | return this._shouldPayTolls; | 61 | return this._shouldPayTolls; |
61 | }, | 62 | }, |
62 | 63 | ||
63 | //------------------------------------------------------------------------- | 64 | //------------------------------------------------------------------------- |
64 | 65 | ||
65 | 'data': function () { | 66 | 'data': function () { |
66 | return this._data; | 67 | return this._data; |
67 | }, | 68 | }, |
68 | 69 | ||
69 | //------------------------------------------------------------------------- | 70 | //------------------------------------------------------------------------- |
70 | 71 | ||
71 | 'tolls': function () { | 72 | 'tolls': function () { |
72 | return this._tolls; | 73 | return this._tolls; |
73 | }, | 74 | }, |
74 | 75 | ||
75 | //------------------------------------------------------------------------- | 76 | //------------------------------------------------------------------------- |
76 | 77 | ||
77 | 'connections': function () { | 78 | 'connections': function () { |
78 | return this._connections; | 79 | return this._connections; |
79 | }, | 80 | }, |
80 | 81 | ||
81 | //========================================================================= | 82 | //========================================================================= |
82 | 83 | ||
83 | 'resetData': function() { | 84 | 'resetData': function() { |
84 | this._data = { | 85 | this._data = { |
85 | 'users': { | 86 | 'users': { |
86 | 'catchAllUser': { | 87 | 'catchAllUser': { |
87 | __masterkey_test_value__: 'masterkey', | 88 | __masterkey_test_value__: 'masterkey', |
88 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', | 89 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', |
89 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' | 90 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' |
90 | } | 91 | } |
91 | } | 92 | } |
92 | }; | 93 | }; |
93 | }, | 94 | }, |
94 | 95 | ||
95 | //------------------------------------------------------------------------- | 96 | //------------------------------------------------------------------------- |
96 | 97 | ||
97 | 'setupWithEncryptedData': function(someData) { | 98 | 'setupWithEncryptedData': function(someData) { |
98 | this._data = Clipperz.Base.deepClone(someData); | 99 | this._data = Clipperz.Base.deepClone(someData); |
99 | }, | 100 | }, |
100 | 101 | ||
101 | //------------------------------------------------------------------------- | 102 | //------------------------------------------------------------------------- |
102 | 103 | ||
103 | 'setupWithData': function(someData) { | 104 | 'setupWithData': function(someData) { |
104 | var deferredResult; | 105 | var deferredResult; |
105 | var resultData; | 106 | var resultData; |
106 | var i, c; | 107 | var i, c; |
107 | 108 | ||
108 | //Clipperz.log(">>> Proxy.Test.setupWithData"); | 109 | //Clipperz.log(">>> Proxy.Test.setupWithData"); |
109 | resultData = this._data; | 110 | resultData = this._data; |
110 | 111 | ||
111 | deferredResult = new MochiKit.Async.Deferred(); | 112 | deferredResult = new MochiKit.Async.Deferred(); |
112 | c = someData['users'].length; | 113 | c = someData['users'].length; |
113 | 114 | ||
114 | for (i=0; i<c; i++) { | 115 | for (i=0; i<c; i++) { |
115 | varnewConnection; | 116 | varnewConnection; |
116 | varrecordConfiguration; | 117 | varrecordConfiguration; |
117 | 118 | ||
118 | deferredResult.addCallback(MochiKit.Base.method(this, 'userSerializedEncryptedData', someData['users'][i])); | 119 | deferredResult.addCallback(MochiKit.Base.method(this, 'userSerializedEncryptedData', someData['users'][i])); |
119 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { | 120 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { |
120 | //console.log("SERIALIZED USER", aUserSerializationContext); | 121 | //console.log("SERIALIZED USER", aUserSerializationContext); |
121 | resultData['users'][aUserSerializationContext['credentials']['C']] = { | 122 | resultData['users'][aUserSerializationContext['credentials']['C']] = { |
122 | 's': aUserSerializationContext['credentials']['s'], | 123 | 's': aUserSerializationContext['credentials']['s'], |
123 | 'v': aUserSerializationContext['credentials']['v'], | 124 | 'v': aUserSerializationContext['credentials']['v'], |
124 | 'version': aUserSerializationContext['data']['connectionVersion'], | 125 | 'version': aUserSerializationContext['data']['connectionVersion'], |
125 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], | 126 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], |
126 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], | 127 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], |
127 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], | 128 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], |
128 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], | 129 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], |
129 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) | 130 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) |
130 | } | 131 | } |
131 | }, this)); | 132 | }, this)); |
132 | } | 133 | } |
133 | 134 | ||
134 | deferredResult.addCallback(MochiKit.Base.bind(function() { | 135 | deferredResult.addCallback(MochiKit.Base.bind(function() { |
135 | //console.log("this._data", resultData); | 136 | //console.log("this._data", resultData); |
136 | this._data = resultData; | 137 | this._data = resultData; |
137 | }, this)); | 138 | }, this)); |
138 | 139 | ||
139 | deferredResult.callback(); | 140 | deferredResult.callback(); |
140 | //Clipperz.log("<<< Proxy.Test.setupWithData"); | 141 | //Clipperz.log("<<< Proxy.Test.setupWithData"); |
141 | 142 | ||
142 | return deferredResult; | 143 | return deferredResult; |
143 | }, | 144 | }, |
144 | 145 | ||
145 | //========================================================================= | 146 | //========================================================================= |
146 | 147 | ||
148 | 'C': function() { | ||
149 | return this._C; | ||
150 | }, | ||
151 | |||
152 | 'set_C': function(aValue) { | ||
153 | this._C = aValue; | ||
154 | }, | ||
155 | |||
156 | //------------------------------------------------------------------------- | ||
157 | |||
147 | 'b': function() { | 158 | 'b': function() { |
148 | return this._b; | 159 | return this._b; |
149 | }, | 160 | }, |
150 | 161 | ||
151 | 'set_b': function(aValue) { | 162 | 'set_b': function(aValue) { |
152 | this._b = aValue; | 163 | this._b = aValue; |
153 | }, | 164 | }, |
154 | 165 | ||
155 | //------------------------------------------------------------------------- | 166 | //------------------------------------------------------------------------- |
156 | 167 | ||
157 | 'B': function() { | 168 | 'B': function() { |
158 | return this._B; | 169 | return this._B; |
159 | }, | 170 | }, |
160 | 171 | ||
161 | 'set_B': function(aValue) { | 172 | 'set_B': function(aValue) { |
162 | this._B = aValue; | 173 | this._B = aValue; |
163 | }, | 174 | }, |
164 | 175 | ||
165 | //------------------------------------------------------------------------- | 176 | //------------------------------------------------------------------------- |
166 | 177 | ||
167 | 'A': function() { | 178 | 'A': function() { |
168 | return this._A; | 179 | return this._A; |
169 | }, | 180 | }, |
170 | 181 | ||
171 | 'set_A': function(aValue) { | 182 | 'set_A': function(aValue) { |
172 | this._A = aValue; | 183 | this._A = aValue; |
173 | }, | 184 | }, |
174 | 185 | ||
175 | //------------------------------------------------------------------------- | 186 | //------------------------------------------------------------------------- |
176 | 187 | ||
177 | 'userData': function() { | 188 | 'userData': function() { |
178 | return this._userData; | 189 | return this._userData; |
179 | }, | 190 | }, |
180 | 191 | ||
181 | 'setUserData': function(aValue) { | 192 | 'setUserData': function(aValue) { |
182 | this._userData = aValue; | 193 | this._userData = aValue; |
183 | }, | 194 | }, |
184 | 195 | ||
185 | //========================================================================= | 196 | //========================================================================= |
186 | 197 | ||
187 | 'getTollForRequestType': function (aRequestType) { | 198 | 'getTollForRequestType': function (aRequestType) { |
188 | varresult; | 199 | varresult; |
189 | vartargetValue; | 200 | vartargetValue; |
190 | var cost; | 201 | var cost; |
191 | 202 | ||
192 | targetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); | 203 | targetValue = Clipperz.Crypto.PRNG.defaultRandomGenerator().getRandomBytes(32).toHexString().substring(2); |
193 | switch (aRequestType) { | 204 | switch (aRequestType) { |
194 | case 'REGISTER': | 205 | case 'REGISTER': |
195 | cost = 5; | 206 | cost = 5; |
196 | break; | 207 | break; |
197 | case 'CONNECT': | 208 | case 'CONNECT': |
198 | cost = 5; | 209 | cost = 5; |
199 | break; | 210 | break; |
200 | case 'MESSAGE': | 211 | case 'MESSAGE': |
201 | cost = 2; | 212 | cost = 2; |
202 | break; | 213 | break; |
203 | } | 214 | } |
204 | 215 | ||
205 | result = { | 216 | result = { |
206 | requestType: aRequestType, | 217 | requestType: aRequestType, |
207 | targetValue: targetValue, | 218 | targetValue: targetValue, |
208 | cost: cost | 219 | cost: cost |
209 | } | 220 | } |
210 | 221 | ||
211 | if (this.shouldPayTolls()) { | 222 | if (this.shouldPayTolls()) { |
212 | this.tolls()[targetValue] = result; | 223 | this.tolls()[targetValue] = result; |
213 | } | 224 | } |
214 | 225 | ||
215 | return result; | 226 | return result; |
216 | }, | 227 | }, |
217 | 228 | ||
218 | //------------------------------------------------------------------------- | 229 | //------------------------------------------------------------------------- |
219 | 230 | ||
220 | 'checkToll': function (aFunctionName, someParameters) { | 231 | 'checkToll': function (aFunctionName, someParameters) { |
221 | if (this.shouldPayTolls()) { | 232 | if (this.shouldPayTolls()) { |
222 | var localToll; | 233 | var localToll; |
223 | vartollParameters; | 234 | vartollParameters; |
224 | 235 | ||
225 | tollParameters = someParameters['toll']; | 236 | tollParameters = someParameters['toll']; |
226 | localToll = this.tolls()[tollParameters['targetValue']]; | 237 | localToll = this.tolls()[tollParameters['targetValue']]; |
227 | 238 | ||
228 | if (localToll != null) { | 239 | if (localToll != null) { |
229 | if (! Clipperz.PM.Toll.validate(tollParameters['targetValue'], tollParameters['toll'], localToll['cost'])) { | 240 | if (! Clipperz.PM.Toll.validate(tollParameters['targetValue'], tollParameters['toll'], localToll['cost'])) { |
230 | throw "Toll value too low."; | 241 | throw "Toll value too low."; |
231 | }; | 242 | }; |
232 | } else { | 243 | } else { |
233 | throw "Missing toll"; | 244 | throw "Missing toll"; |
234 | } | 245 | } |
235 | } | 246 | } |
236 | }, | 247 | }, |
237 | 248 | ||
238 | //========================================================================= | 249 | //========================================================================= |
239 | 250 | ||
240 | 'processMessage': function(aFunctionName, someParameters) { | 251 | 'processMessage': function (aFunctionName, someParameters) { |
241 | var result; | 252 | var result; |
242 | 253 | ||
243 | switch(aFunctionName) { | 254 | switch(aFunctionName) { |
244 | case 'knock': | 255 | case 'knock': |
245 | result = this._knock(someParameters); | 256 | result = this._knock(someParameters); |
246 | break; | 257 | break; |
247 | case 'registration': | 258 | case 'registration': |
248 | this.checkToll(aFunctionName, someParameters); | 259 | this.checkToll(aFunctionName, someParameters); |
249 | result = this._registration(someParameters.parameters); | 260 | result = this._registration(someParameters.parameters); |
250 | break; | 261 | break; |
251 | case 'handshake': | 262 | case 'handshake': |
252 | this.checkToll(aFunctionName, someParameters); | 263 | this.checkToll(aFunctionName, someParameters); |
253 | result = this._handshake(someParameters.parameters); | 264 | result = this._handshake(someParameters.parameters); |
254 | break; | 265 | break; |
255 | case 'message': | 266 | case 'message': |
256 | this.checkToll(aFunctionName, someParameters); | 267 | this.checkToll(aFunctionName, someParameters); |
257 | result = this._message(someParameters.parameters); | 268 | result = this._message(someParameters.parameters); |
258 | break; | 269 | break; |
259 | case 'logout': | 270 | case 'logout': |
260 | result = this._logout(someParameters.parameters); | 271 | result = this._logout(someParameters.parameters); |
261 | break; | 272 | break; |
262 | } | 273 | } |
263 | 274 | ||
264 | return result; | 275 | return result; |
265 | }, | 276 | }, |
266 | 277 | ||
267 | //========================================================================= | 278 | //========================================================================= |
268 | 279 | ||
269 | '_knock': function(someParameters) { | 280 | '_knock': function(someParameters) { |
270 | var result; | 281 | var result; |
271 | 282 | ||
272 | result = { | 283 | result = { |
273 | toll: this.getTollForRequestType(someParameters['requestType']) | 284 | toll: this.getTollForRequestType(someParameters['requestType']) |
274 | // toll: { | 285 | // toll: { |
275 | // requestType: someParameters['requestType'], | 286 | // requestType: someParameters['requestType'], |
276 | // targetValue: "3a1ba0be23580f902885c6c8a6b035e228ed1ca74d77de5f9bb0e0c899f07cfe", | 287 | // targetValue: "3a1ba0be23580f902885c6c8a6b035e228ed1ca74d77de5f9bb0e0c899f07cfe", |
277 | // cost: | 288 | // cost: |
278 | // } | 289 | // } |
279 | } | 290 | } |
280 | 291 | ||
281 | return result; | 292 | return result; |
282 | }, | 293 | }, |
283 | 294 | ||
284 | //------------------------------------------------------------------------- | 295 | //------------------------------------------------------------------------- |
285 | 296 | ||
286 | '_registration': function(someParameters) { | 297 | '_registration': function(someParameters) { |
287 | //console.log("_registration", someParameters); | 298 | //console.log("_registration", someParameters); |
288 | if (this.isReadOnly() == false) { | 299 | if (this.isReadOnly() == false) { |
289 | if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') { | 300 | if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') { |
290 | this.data()['users'][someParameters['credentials']['C']] = { | 301 | this.data()['users'][someParameters['credentials']['C']] = { |
291 | 's': someParameters['credentials']['s'], | 302 | 's': someParameters['credentials']['s'], |
292 | 'v': someParameters['credentials']['v'], | 303 | 'v': someParameters['credentials']['v'], |
293 | 'version':someParameters['credentials']['version'], | 304 | 'version':someParameters['credentials']['version'], |
294 | // 'lock': someParameters['user']['lock'], | 305 | // 'lock': someParameters['user']['lock'], |
295 | 'lock': Clipperz.Crypto.Base.generateRandomSeed(), | 306 | 'lock': Clipperz.Crypto.Base.generateRandomSeed(), |
296 | // 'maxNumberOfRecords':'100', | 307 | // 'maxNumberOfRecords':'100', |
297 | 'userDetails': someParameters['user']['header'], | 308 | 'userDetails': someParameters['user']['header'], |
298 | 'statistics': someParameters['user']['statistics'], | 309 | 'statistics': someParameters['user']['statistics'], |
299 | 'userDetailsVersion':someParameters['user']['version'], | 310 | 'userDetailsVersion':someParameters['user']['version'], |
300 | 'records':{} | 311 | 'records':{} |
301 | } | 312 | } |
302 | } else { | 313 | } else { |
303 | throw "user already exists"; | 314 | throw "user already exists"; |
304 | } | 315 | } |
305 | } else { | 316 | } else { |
306 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 317 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
307 | } | 318 | } |
308 | 319 | ||
309 | result = { | 320 | result = { |
310 | result: { | 321 | result: { |
311 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], | 322 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], |
312 | 'result':'done' | 323 | 'result':'done' |
313 | }, | 324 | }, |
314 | toll: this.getTollForRequestType('CONNECT') | 325 | toll: this.getTollForRequestType('CONNECT') |
315 | } | 326 | } |
316 | 327 | ||
317 | return MochiKit.Async.succeed(result); | 328 | return MochiKit.Async.succeed(result); |
318 | }, | 329 | }, |
319 | 330 | ||
320 | //------------------------------------------------------------------------- | 331 | //------------------------------------------------------------------------- |
321 | 332 | ||
322 | '_handshake': function(someParameters) { | 333 | '_handshake': function(someParameters) { |
323 | var result; | 334 | var result; |
324 | varnextTollRequestType; | 335 | varnextTollRequestType; |
325 | 336 | ||
326 | //Clipperz.log(">>> Proxy.Offline.DataStore._handshake"); | 337 | //Clipperz.log(">>> Proxy.Offline.DataStore._handshake"); |
327 | result = {}; | 338 | result = {}; |
328 | if (someParameters.message == "connect") { | 339 | if (someParameters.message == "connect") { |
329 | var userData; | 340 | var userData; |
330 | var randomBytes; | 341 | var randomBytes; |
331 | var b, B, v; | 342 | var b, B, v; |
332 | 343 | ||
333 | //console.log(">>> Proxy.Offline.DataStore._handshake.connect", someParameters); | 344 | //console.log(">>> Proxy.Offline.DataStore._handshake.connect", someParameters); |
334 | userData = this.data()['users'][someParameters.parameters.C]; | 345 | userData = this.data()['users'][someParameters.parameters.C]; |
335 | 346 | ||
336 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { | 347 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { |
337 | this.setUserData(userData); | 348 | this.setUserData(userData); |
338 | } else { | 349 | } else { |
339 | this.setUserData(this.data()['users']['catchAllUser']); | 350 | this.setUserData(this.data()['users']['catchAllUser']); |
340 | } | 351 | } |
341 | 352 | ||
342 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); | 353 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); |
354 | this.set_C(someParameters.parameters.C); | ||
343 | this.set_b(new Clipperz.Crypto.BigInt(randomBytes, 16)); | 355 | this.set_b(new Clipperz.Crypto.BigInt(randomBytes, 16)); |
344 | v = new Clipperz.Crypto.BigInt(this.userData()['v'], 16); | 356 | v = new Clipperz.Crypto.BigInt(this.userData()['v'], 16); |
345 | this.set_B(v.add(Clipperz.Crypto.SRP.g().powerModule(this.b(), Clipperz.Crypto.SRP.n()))); | 357 | this.set_B((Clipperz.Crypto.SRP.k().multiply(v)).add(Clipperz.Crypto.SRP.g().powerModule(this.b(), Clipperz.Crypto.SRP.n()))); |
346 | 358 | ||
347 | this.set_A(someParameters.parameters.A); | 359 | this.set_A(someParameters.parameters.A); |
348 | 360 | ||
349 | result['s'] = this.userData()['s']; | 361 | result['s'] = this.userData()['s']; |
350 | result['B'] = this.B().asString(16); | 362 | result['B'] = this.B().asString(16); |
351 | 363 | ||
352 | nextTollRequestType = 'CONNECT'; | 364 | nextTollRequestType = 'CONNECT'; |
353 | } else if (someParameters.message == "credentialCheck") { | 365 | } else if (someParameters.message == "credentialCheck") { |
354 | var v, u, S, A, K, M1; | 366 | var v, u, s, S, A, K, M1; |
367 | var stringHash = function (aValue) { | ||
368 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aValue)).toHexString().substring(2); | ||
369 | }; | ||
355 | 370 | ||
356 | //console.log(">>> Proxy.Offline.DataStore._handshake.credentialCheck", someParameters); | 371 | //console.log(">>> Proxy.Offline.DataStore._handshake.credentialCheck", someParameters); |
357 | v = new Clipperz.Crypto.BigInt(this.userData()['v'], 16); | 372 | v = new Clipperz.Crypto.BigInt(this.userData()['v'], 16); |
358 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(this.B().asString(10))).toHexString(), 16); | ||
359 | A = new Clipperz.Crypto.BigInt(this.A(), 16); | 373 | A = new Clipperz.Crypto.BigInt(this.A(), 16); |
374 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + this.B().asString(10))).toHexString(), 16); | ||
375 | s = new Clipperz.Crypto.BigInt(this.userData()['s'], 16); | ||
360 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(this.b(), Clipperz.Crypto.SRP.n()); | 376 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(this.b(), Clipperz.Crypto.SRP.n()); |
361 | 377 | ||
362 | K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2); | 378 | K = stringHash(S.asString(10)); |
363 | 379 | ||
364 | M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + this.B().asString(10) + K)).toHexString().slice(2); | 380 | M1 = stringHash( |
381 | "597626870978286801440197562148588907434001483655788865609375806439877501869636875571920406529" + | ||
382 | stringHash(this.C()) + | ||
383 | s.asString(10) + | ||
384 | A.asString(10) + | ||
385 | this.B().asString(10) + | ||
386 | K | ||
387 | ); | ||
365 | if (someParameters.parameters.M1 == M1) { | 388 | if (someParameters.parameters.M1 == M1) { |
366 | var M2; | 389 | var M2; |
367 | 390 | ||
368 | M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2); | 391 | M2 = stringHash( |
392 | A.asString(10) + | ||
393 | someParameters.parameters.M1 + | ||
394 | K | ||
395 | ); | ||
369 | result['M2'] = M2; | 396 | result['M2'] = M2; |
370 | } else { | 397 | } else { |
371 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); | 398 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); |
372 | } | 399 | } |
373 | 400 | ||
374 | nextTollRequestType = 'MESSAGE'; | 401 | nextTollRequestType = 'MESSAGE'; |
375 | } else if (someParameters.message == "oneTimePassword") { | 402 | } else if (someParameters.message == "oneTimePassword") { |
376 | var otpData; | 403 | var otpData; |
377 | 404 | ||
378 | //console.log("HANDSHAKE WITH OTP", someParameters.parameters.oneTimePasswordKey); | 405 | //console.log("HANDSHAKE WITH OTP", someParameters.parameters.oneTimePasswordKey); |
379 | //console.log("someParameters", someParameters); | 406 | //console.log("someParameters", someParameters); |
380 | //console.log("data.OTP", Clipperz.Base.serializeJSON(this.data()['onetimePasswords'])); | 407 | //console.log("data.OTP", Clipperz.Base.serializeJSON(this.data()['onetimePasswords'])); |
381 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; | 408 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; |
382 | 409 | ||
383 | try { | 410 | try { |
384 | if (typeof(otpData) != 'undefined') { | 411 | if (typeof(otpData) != 'undefined') { |
385 | if (otpData['status'] == 'ACTIVE') { | 412 | if (otpData['status'] == 'ACTIVE') { |
386 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { | 413 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { |
387 | result = { | 414 | result = { |
388 | 'data': otpData['data'], | 415 | 'data': otpData['data'], |
389 | 'version':otpData['version'] | 416 | 'version':otpData['version'] |
390 | } | 417 | } |
391 | 418 | ||
392 | otpData['status'] = 'REQUESTED'; | 419 | otpData['status'] = 'REQUESTED'; |
393 | } else { | 420 | } else { |
394 | otpData['status'] = 'DISABLED'; | 421 | otpData['status'] = 'DISABLED'; |
395 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; | 422 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; |
396 | } | 423 | } |
397 | } else { | 424 | } else { |
398 | throw "The requested One Time Password was not active"; | 425 | throw "The requested One Time Password was not active"; |
399 | } | 426 | } |
400 | } else { | 427 | } else { |
401 | throw "The requested One Time Password has not been found" | 428 | throw "The requested One Time Password has not been found" |
402 | } | 429 | } |
403 | } catch (exception) { | 430 | } catch (exception) { |
404 | result = { | 431 | result = { |
405 | 'data': Clipperz.PM.Crypto.randomKey(), | 432 | 'data': Clipperz.PM.Crypto.randomKey(), |
406 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion | 433 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion |
407 | } | 434 | } |
408 | } | 435 | } |
409 | nextTollRequestType = 'CONNECT'; | 436 | nextTollRequestType = 'CONNECT'; |
410 | } else { | 437 | } else { |
411 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); | 438 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); |
412 | } | 439 | } |
413 | //console.log("<<< Proxy.Offline._handshake", result); | 440 | //console.log("<<< Proxy.Offline._handshake", result); |
414 | 441 | ||
415 | result = { | 442 | result = { |
416 | result: result, | 443 | result: result, |
417 | toll: this.getTollForRequestType(nextTollRequestType) | 444 | toll: this.getTollForRequestType(nextTollRequestType) |
418 | } | 445 | } |
419 | 446 | ||
420 | return MochiKit.Async.succeed(result); | 447 | return MochiKit.Async.succeed(result); |
421 | }, | 448 | }, |
422 | 449 | ||
423 | //------------------------------------------------------------------------- | 450 | //------------------------------------------------------------------------- |
424 | 451 | ||
425 | '_message': function(someParameters) { | 452 | '_message': function(someParameters) { |
426 | var result; | 453 | var result; |
427 | 454 | ||
428 | result = {}; | 455 | result = {}; |
429 | 456 | ||
430 | //===================================================================== | 457 | //===================================================================== |
431 | // | 458 | // |
432 | // R E A D - O N L Y M e t h o d s | 459 | // R E A D - O N L Y M e t h o d s |
diff --git a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js index 3f16f70..d03f873 100644 --- a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js +++ b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.Offline.LocalStorageDataStore.js | |||
@@ -27,151 +27,166 @@ try { if (typeof(Clipperz.PM.Proxy.Offline.DataStore) == 'undefined') { throw "" | |||
27 | 27 | ||
28 | //============================================================================= | 28 | //============================================================================= |
29 | 29 | ||
30 | Clipperz.PM.Proxy.Offline.LocalStorageDataStore = function(args) { | 30 | Clipperz.PM.Proxy.Offline.LocalStorageDataStore = function(args) { |
31 | args = args || {}; | 31 | args = args || {}; |
32 | 32 | ||
33 | //this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); | 33 | //this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); |
34 | this._data = JSON.parse(localStorage.getItem('clipperz_dump_data')); | 34 | this._data = JSON.parse(localStorage.getItem('clipperz_dump_data')); |
35 | 35 | ||
36 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); | 36 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); |
37 | this._shouldPayTolls = args.shouldPayTolls || false; | 37 | this._shouldPayTolls = args.shouldPayTolls || false; |
38 | 38 | ||
39 | this._tolls = {}; | 39 | this._tolls = {}; |
40 | this._currentStaticConnection = null; | 40 | this._currentStaticConnection = null; |
41 | 41 | ||
42 | //Clipperz.PM.Proxy.Offline.LocalStorageDataStore.superclass.constructor.apply(this, arguments); | 42 | //Clipperz.PM.Proxy.Offline.LocalStorageDataStore.superclass.constructor.apply(this, arguments); |
43 | 43 | ||
44 | return this; | 44 | return this; |
45 | } | 45 | } |
46 | 46 | ||
47 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.LocalStorageDataStore, Clipperz.PM.Proxy.Offline.DataStore, { | 47 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.LocalStorageDataStore, Clipperz.PM.Proxy.Offline.DataStore, { |
48 | 48 | ||
49 | //========================================================================= | 49 | //========================================================================= |
50 | 50 | ||
51 | '_knock': function(aConnection, someParameters) { | 51 | '_knock': function(aConnection, someParameters) { |
52 | var result; | 52 | var result; |
53 | 53 | ||
54 | result = { | 54 | result = { |
55 | toll: this.getTollForRequestType(someParameters['requestType']) | 55 | toll: this.getTollForRequestType(someParameters['requestType']) |
56 | } | 56 | } |
57 | 57 | ||
58 | return result; | 58 | return result; |
59 | }, | 59 | }, |
60 | 60 | ||
61 | //------------------------------------------------------------------------- | 61 | //------------------------------------------------------------------------- |
62 | 62 | ||
63 | '_registration': function(aConnection, someParameters) { | 63 | '_registration': function(aConnection, someParameters) { |
64 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 64 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
65 | }, | 65 | }, |
66 | 66 | ||
67 | //------------------------------------------------------------------------- | 67 | //------------------------------------------------------------------------- |
68 | 68 | ||
69 | '_handshake': function(aConnection, someParameters) { | 69 | '_handshake': function(aConnection, someParameters) { |
70 | var result; | 70 | var result; |
71 | varnextTollRequestType; | 71 | varnextTollRequestType; |
72 | 72 | ||
73 | result = {}; | 73 | result = {}; |
74 | if (someParameters.message == "connect") { | 74 | if (someParameters.message == "connect") { |
75 | var userData; | 75 | var userData; |
76 | var randomBytes; | 76 | var randomBytes; |
77 | var v; | 77 | var v; |
78 | 78 | ||
79 | userData = this.data()['users'][someParameters.parameters.C]; | 79 | userData = this.data()['users'][someParameters.parameters.C]; |
80 | 80 | ||
81 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { | 81 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { |
82 | aConnection['userData'] = userData; | 82 | aConnection['userData'] = userData; |
83 | aConnection['C'] = someParameters.parameters.C; | 83 | aConnection['C'] = someParameters.parameters.C; |
84 | } else { | 84 | } else { |
85 | aConnection['userData'] = this.data()['users']['catchAllUser']; | 85 | aConnection['userData'] = this.data()['users']['catchAllUser']; |
86 | } | 86 | } |
87 | 87 | ||
88 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); | 88 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); |
89 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); | 89 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); |
90 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 90 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
91 | aConnection['B'] = v.add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); | 91 | aConnection['B'] = (Clipperz.Crypto.SRP.k().multiply(v)).add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); |
92 | 92 | ||
93 | aConnection['A'] = someParameters.parameters.A; | 93 | aConnection['A'] = someParameters.parameters.A; |
94 | 94 | ||
95 | result['s'] = aConnection['userData']['s']; | 95 | result['s'] = aConnection['userData']['s']; |
96 | result['B'] = aConnection['B'].asString(16); | 96 | result['B'] = aConnection['B'].asString(16); |
97 | 97 | ||
98 | nextTollRequestType = 'CONNECT'; | 98 | nextTollRequestType = 'CONNECT'; |
99 | } else if (someParameters.message == "credentialCheck") { | 99 | } else if (someParameters.message == "credentialCheck") { |
100 | var v, u, S, A, K, M1; | 100 | var v, u, s, S, A, K, M1; |
101 | var stringHash = function (aValue) { | ||
102 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aValue)).toHexString().substring(2); | ||
103 | }; | ||
101 | 104 | ||
102 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 105 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
103 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aConnection['B'].asString(10))).toHexString(), 16); | ||
104 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); | 106 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); |
107 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10))).toHexString(), 16); | ||
108 | s = new Clipperz.Crypto.BigInt(aConnection['userData']['s'], 16); | ||
105 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); | 109 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); |
106 | 110 | ||
107 | K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2); | 111 | K = stringHash(S.asString(10)); |
108 | 112 | ||
109 | M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10) + K)).toHexString().slice(2); | 113 | M1 = stringHash( |
114 | "597626870978286801440197562148588907434001483655788865609375806439877501869636875571920406529" + | ||
115 | stringHash(aConnection['C']) + | ||
116 | s.asString(10) + | ||
117 | A.asString(10) + | ||
118 | aConnection['B'].asString(10) + | ||
119 | K | ||
120 | ); | ||
110 | if (someParameters.parameters.M1 == M1) { | 121 | if (someParameters.parameters.M1 == M1) { |
111 | var M2; | 122 | var M2; |
112 | 123 | ||
113 | M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2); | 124 | M2 = stringHash( |
125 | A.asString(10) + | ||
126 | someParameters.parameters.M1 + | ||
127 | K | ||
128 | ); | ||
114 | result['M2'] = M2; | 129 | result['M2'] = M2; |
115 | } else { | 130 | } else { |
116 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); | 131 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); |
117 | } | 132 | } |
118 | 133 | ||
119 | nextTollRequestType = 'MESSAGE'; | 134 | nextTollRequestType = 'MESSAGE'; |
120 | } else if (someParameters.message == "oneTimePassword") { | 135 | } else if (someParameters.message == "oneTimePassword") { |
121 | var otpData; | 136 | var otpData; |
122 | 137 | ||
123 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; | 138 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; |
124 | 139 | ||
125 | try { | 140 | try { |
126 | if (typeof(otpData) != 'undefined') { | 141 | if (typeof(otpData) != 'undefined') { |
127 | if (otpData['status'] == 'ACTIVE') { | 142 | if (otpData['status'] == 'ACTIVE') { |
128 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { | 143 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { |
129 | result = { | 144 | result = { |
130 | 'data': otpData['data'], | 145 | 'data': otpData['data'], |
131 | 'version':otpData['version'] | 146 | 'version':otpData['version'] |
132 | } | 147 | } |
133 | 148 | ||
134 | otpData['status'] = 'REQUESTED'; | 149 | otpData['status'] = 'REQUESTED'; |
135 | } else { | 150 | } else { |
136 | otpData['status'] = 'DISABLED'; | 151 | otpData['status'] = 'DISABLED'; |
137 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; | 152 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; |
138 | } | 153 | } |
139 | } else { | 154 | } else { |
140 | throw "The requested One Time Password was not active"; | 155 | throw "The requested One Time Password was not active"; |
141 | } | 156 | } |
142 | } else { | 157 | } else { |
143 | throw "The requested One Time Password has not been found" | 158 | throw "The requested One Time Password has not been found" |
144 | } | 159 | } |
145 | } catch (exception) { | 160 | } catch (exception) { |
146 | result = { | 161 | result = { |
147 | 'data': Clipperz.PM.Crypto.randomKey(), | 162 | 'data': Clipperz.PM.Crypto.randomKey(), |
148 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion | 163 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion |
149 | } | 164 | } |
150 | } | 165 | } |
151 | nextTollRequestType = 'CONNECT'; | 166 | nextTollRequestType = 'CONNECT'; |
152 | } else { | 167 | } else { |
153 | Clipperz.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); | 168 | Clipperz.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); |
154 | } | 169 | } |
155 | 170 | ||
156 | result = { | 171 | result = { |
157 | result: result, | 172 | result: result, |
158 | toll: this.getTollForRequestType(nextTollRequestType) | 173 | toll: this.getTollForRequestType(nextTollRequestType) |
159 | } | 174 | } |
160 | 175 | ||
161 | return result; | 176 | return result; |
162 | }, | 177 | }, |
163 | 178 | ||
164 | //------------------------------------------------------------------------- | 179 | //------------------------------------------------------------------------- |
165 | 180 | ||
166 | '_message': function(aConnection, someParameters) { | 181 | '_message': function(aConnection, someParameters) { |
167 | var result; | 182 | var result; |
168 | 183 | ||
169 | result = {}; | 184 | result = {}; |
170 | 185 | ||
171 | //===================================================================== | 186 | //===================================================================== |
172 | // | 187 | // |
173 | // R E A D - O N L Y M e t h o d s | 188 | // R E A D - O N L Y M e t h o d s |
174 | // | 189 | // |
175 | //===================================================================== | 190 | //===================================================================== |
176 | if (someParameters.message == 'getUserDetails') { | 191 | if (someParameters.message == 'getUserDetails') { |
177 | var recordsStats; | 192 | var recordsStats; |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js index b806cb7..e5f68a8 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -1,103 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2013 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz, the online password manager. | 5 | This file is part of Clipperz, the online password manager. |
6 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
7 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
8 | 8 | ||
9 | * Clipperz is free software: you can redistribute it and/or modify it | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
10 | under the terms of the GNU Affero General Public License as published | 10 | under the terms of the GNU Affero General Public License as published |
11 | by the Free Software Foundation, either version 3 of the License, or | 11 | by the Free Software Foundation, either version 3 of the License, or |
12 | (at your option) any later version. | 12 | (at your option) any later version. |
13 | 13 | ||
14 | * Clipperz is distributed in the hope that it will be useful, but | 14 | * Clipperz is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
18 | 18 | ||
19 | * 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 |
20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
21 | 21 | ||
22 | */ | 22 | */ |
23 | 23 | ||
24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { |
25 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; | 25 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; |
26 | } | 26 | } |
27 | 27 | ||
28 | //============================================================================= | 28 | //============================================================================= |
29 | 29 | ||
30 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { | 30 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { |
31 | args = args || {}; | 31 | args = args || {}; |
32 | 32 | ||
33 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); | 33 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); |
34 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); | 34 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); |
35 | this._shouldPayTolls = args.shouldPayTolls || false; | 35 | this._shouldPayTolls = args.shouldPayTolls || false; |
36 | 36 | ||
37 | this._tolls = {}; | 37 | this._tolls = {}; |
38 | this._currentStaticConnection = null; | 38 | this._currentStaticConnection = null; |
39 | 39 | ||
40 | return this; | 40 | return this; |
41 | } | 41 | } |
42 | 42 | ||
43 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | 43 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { |
44 | 44 | ||
45 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
46 | 46 | ||
47 | 'isReadOnly': function () { | 47 | 'isReadOnly': function () { |
48 | return this._isReadOnly; | 48 | return this._isReadOnly; |
49 | }, | 49 | }, |
50 | 50 | ||
51 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
52 | 52 | ||
53 | 'shouldPayTolls': function() { | 53 | 'shouldPayTolls': function() { |
54 | return this._shouldPayTolls; | 54 | return this._shouldPayTolls; |
55 | }, | 55 | }, |
56 | 56 | ||
57 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
58 | 58 | ||
59 | 'data': function () { | 59 | 'data': function () { |
60 | return this._data; | 60 | return this._data; |
61 | }, | 61 | }, |
62 | 62 | ||
63 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
64 | 64 | ||
65 | 'tolls': function () { | 65 | 'tolls': function () { |
66 | return this._tolls; | 66 | return this._tolls; |
67 | }, | 67 | }, |
68 | 68 | ||
69 | //========================================================================= | 69 | //========================================================================= |
70 | 70 | ||
71 | 'resetData': function() { | 71 | 'resetData': function() { |
72 | this._data = { | 72 | this._data = { |
73 | 'users': { | 73 | 'users': { |
74 | 'catchAllUser': { | 74 | 'catchAllUser': { |
75 | __masterkey_test_value__: 'masterkey', | 75 | __masterkey_test_value__: 'masterkey', |
76 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', | 76 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', |
77 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' | 77 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' |
78 | } | 78 | } |
79 | } | 79 | } |
80 | }; | 80 | }; |
81 | }, | 81 | }, |
82 | 82 | ||
83 | //------------------------------------------------------------------------- | 83 | //------------------------------------------------------------------------- |
84 | 84 | ||
85 | 'setupWithEncryptedData': function(someData) { | 85 | 'setupWithEncryptedData': function(someData) { |
86 | this._data = Clipperz.Base.deepClone(someData); | 86 | this._data = Clipperz.Base.deepClone(someData); |
87 | }, | 87 | }, |
88 | 88 | ||
89 | //------------------------------------------------------------------------- | 89 | //------------------------------------------------------------------------- |
90 | 90 | ||
91 | 'setupWithData': function(someData) { | 91 | 'setupWithData': function(someData) { |
92 | var deferredResult; | 92 | var deferredResult; |
93 | var resultData; | 93 | var resultData; |
94 | var i, c; | 94 | var i, c; |
95 | 95 | ||
96 | //Clipperz.log(">>> Proxy.Test.setupWithData"); | 96 | //Clipperz.log(">>> Proxy.Test.setupWithData"); |
97 | resultData = this._data; | 97 | resultData = this._data; |
98 | 98 | ||
99 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); | 99 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); |
100 | c = someData['users'].length; | 100 | c = someData['users'].length; |
101 | 101 | ||
102 | for (i=0; i<c; i++) { | 102 | for (i=0; i<c; i++) { |
103 | varnewConnection; | 103 | varnewConnection; |
@@ -230,189 +230,204 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
230 | 'processMessage': function (aFunctionName, someParameters) { | 230 | 'processMessage': function (aFunctionName, someParameters) { |
231 | var result; | 231 | var result; |
232 | varconnection; | 232 | varconnection; |
233 | 233 | ||
234 | connection = this.getConnectionForRequest(aFunctionName, someParameters); | 234 | connection = this.getConnectionForRequest(aFunctionName, someParameters); |
235 | 235 | ||
236 | switch(aFunctionName) { | 236 | switch(aFunctionName) { |
237 | case 'knock': | 237 | case 'knock': |
238 | result = this._knock(connection, someParameters); | 238 | result = this._knock(connection, someParameters); |
239 | break; | 239 | break; |
240 | case 'registration': | 240 | case 'registration': |
241 | this.checkToll(aFunctionName, someParameters); | 241 | this.checkToll(aFunctionName, someParameters); |
242 | result = this._registration(connection, someParameters.parameters); | 242 | result = this._registration(connection, someParameters.parameters); |
243 | break; | 243 | break; |
244 | case 'handshake': | 244 | case 'handshake': |
245 | this.checkToll(aFunctionName, someParameters); | 245 | this.checkToll(aFunctionName, someParameters); |
246 | result = this._handshake(connection, someParameters.parameters); | 246 | result = this._handshake(connection, someParameters.parameters); |
247 | break; | 247 | break; |
248 | case 'message': | 248 | case 'message': |
249 | this.checkToll(aFunctionName, someParameters); | 249 | this.checkToll(aFunctionName, someParameters); |
250 | result = this._message(connection, someParameters.parameters); | 250 | result = this._message(connection, someParameters.parameters); |
251 | break; | 251 | break; |
252 | case 'logout': | 252 | case 'logout': |
253 | this._currentStaticConnection = null; | 253 | this._currentStaticConnection = null; |
254 | result = this._logout(connection, someParameters.parameters); | 254 | result = this._logout(connection, someParameters.parameters); |
255 | break; | 255 | break; |
256 | } | 256 | } |
257 | 257 | ||
258 | this.storeConnectionForRequestWithConnectionAndResponse(aFunctionName, someParameters, connection, result); | 258 | this.storeConnectionForRequestWithConnectionAndResponse(aFunctionName, someParameters, connection, result); |
259 | 259 | ||
260 | return MochiKit.Async.succeed(result); | 260 | return MochiKit.Async.succeed(result); |
261 | }, | 261 | }, |
262 | 262 | ||
263 | //========================================================================= | 263 | //========================================================================= |
264 | 264 | ||
265 | '_knock': function(aConnection, someParameters) { | 265 | '_knock': function(aConnection, someParameters) { |
266 | var result; | 266 | var result; |
267 | 267 | ||
268 | result = { | 268 | result = { |
269 | toll: this.getTollForRequestType(someParameters['requestType']) | 269 | toll: this.getTollForRequestType(someParameters['requestType']) |
270 | } | 270 | } |
271 | 271 | ||
272 | return result; | 272 | return result; |
273 | }, | 273 | }, |
274 | 274 | ||
275 | //------------------------------------------------------------------------- | 275 | //------------------------------------------------------------------------- |
276 | 276 | ||
277 | '_registration': function(aConnection, someParameters) { | 277 | '_registration': function(aConnection, someParameters) { |
278 | if (this.isReadOnly() == false) { | 278 | if (this.isReadOnly() == false) { |
279 | if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') { | 279 | if (typeof(this.data()['users'][someParameters['credentials']['C']]) == 'undefined') { |
280 | this.data()['users'][someParameters['credentials']['C']] = { | 280 | this.data()['users'][someParameters['credentials']['C']] = { |
281 | 's': someParameters['credentials']['s'], | 281 | 's': someParameters['credentials']['s'], |
282 | 'v': someParameters['credentials']['v'], | 282 | 'v': someParameters['credentials']['v'], |
283 | 'version':someParameters['credentials']['version'], | 283 | 'version':someParameters['credentials']['version'], |
284 | // 'lock': Clipperz.Crypto.Base.generateRandomSeed(), | 284 | // 'lock': Clipperz.Crypto.Base.generateRandomSeed(), |
285 | 'userDetails': someParameters['user']['header'], | 285 | 'userDetails': someParameters['user']['header'], |
286 | 'statistics': someParameters['user']['statistics'], | 286 | 'statistics': someParameters['user']['statistics'], |
287 | 'userDetailsVersion':someParameters['user']['version'], | 287 | 'userDetailsVersion':someParameters['user']['version'], |
288 | 'records':{} | 288 | 'records':{} |
289 | } | 289 | } |
290 | } else { | 290 | } else { |
291 | throw "user already exists"; | 291 | throw "user already exists"; |
292 | } | 292 | } |
293 | } else { | 293 | } else { |
294 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 294 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
295 | } | 295 | } |
296 | 296 | ||
297 | result = { | 297 | result = { |
298 | result: { | 298 | result: { |
299 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], | 299 | 'lock': this.data()['users'][someParameters['credentials']['C']]['lock'], |
300 | 'result':'done' | 300 | 'result':'done' |
301 | }, | 301 | }, |
302 | toll: this.getTollForRequestType('CONNECT') | 302 | toll: this.getTollForRequestType('CONNECT') |
303 | } | 303 | } |
304 | 304 | ||
305 | return result; | 305 | return result; |
306 | }, | 306 | }, |
307 | 307 | ||
308 | //------------------------------------------------------------------------- | 308 | //------------------------------------------------------------------------- |
309 | 309 | ||
310 | '_handshake': function(aConnection, someParameters) { | 310 | '_handshake': function(aConnection, someParameters) { |
311 | var result; | 311 | var result; |
312 | varnextTollRequestType; | 312 | varnextTollRequestType; |
313 | 313 | ||
314 | result = {}; | 314 | result = {}; |
315 | if (someParameters.message == "connect") { | 315 | if (someParameters.message == "connect") { |
316 | var userData; | 316 | var userData; |
317 | var randomBytes; | 317 | var randomBytes; |
318 | var v; | 318 | var v; |
319 | 319 | ||
320 | userData = this.data()['users'][someParameters.parameters.C]; | 320 | userData = this.data()['users'][someParameters.parameters.C]; |
321 | 321 | ||
322 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { | 322 | if ((typeof(userData) != 'undefined') && (userData['version'] == someParameters.version)) { |
323 | aConnection['userData'] = userData; | 323 | aConnection['userData'] = userData; |
324 | aConnection['C'] = someParameters.parameters.C; | 324 | aConnection['C'] = someParameters.parameters.C; |
325 | } else { | 325 | } else { |
326 | aConnection['userData'] = this.data()['users']['catchAllUser']; | 326 | aConnection['userData'] = this.data()['users']['catchAllUser']; |
327 | } | 327 | } |
328 | 328 | ||
329 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); | 329 | randomBytes = Clipperz.Crypto.Base.generateRandomSeed(); |
330 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); | 330 | aConnection['b'] = new Clipperz.Crypto.BigInt(randomBytes, 16); |
331 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 331 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
332 | aConnection['B'] = v.add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); | 332 | aConnection['B'] = (Clipperz.Crypto.SRP.k().multiply(v)).add(Clipperz.Crypto.SRP.g().powerModule(aConnection['b'], Clipperz.Crypto.SRP.n())); |
333 | 333 | ||
334 | aConnection['A'] = someParameters.parameters.A; | 334 | aConnection['A'] = someParameters.parameters.A; |
335 | 335 | ||
336 | result['s'] = aConnection['userData']['s']; | 336 | result['s'] = aConnection['userData']['s']; |
337 | result['B'] = aConnection['B'].asString(16); | 337 | result['B'] = aConnection['B'].asString(16); |
338 | 338 | ||
339 | nextTollRequestType = 'CONNECT'; | 339 | nextTollRequestType = 'CONNECT'; |
340 | } else if (someParameters.message == "credentialCheck") { | 340 | } else if (someParameters.message == "credentialCheck") { |
341 | var v, u, S, A, K, M1; | 341 | var v, u, s, S, A, K, M1; |
342 | 342 | var stringHash = function (aValue) { | |
343 | return Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aValue)).toHexString().substring(2); | ||
344 | }; | ||
345 | |||
343 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); | 346 | v = new Clipperz.Crypto.BigInt(aConnection['userData']['v'], 16); |
344 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(aConnection['B'].asString(10))).toHexString(), 16); | ||
345 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); | 347 | A = new Clipperz.Crypto.BigInt(aConnection['A'], 16); |
348 | u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10))).toHexString(), 16); | ||
349 | s = new Clipperz.Crypto.BigInt(aConnection['userData']['s'], 16); | ||
346 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); | 350 | S = (A.multiply(v.powerModule(u, Clipperz.Crypto.SRP.n()))).powerModule(aConnection['b'], Clipperz.Crypto.SRP.n()); |
347 | 351 | ||
348 | K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(S.asString(10))).toHexString().slice(2); | 352 | K = stringHash(S.asString(10)); |
349 | 353 | ||
350 | M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + aConnection['B'].asString(10) + K)).toHexString().slice(2); | 354 | M1 = stringHash( |
355 | "597626870978286801440197562148588907434001483655788865609375806439877501869636875571920406529" + | ||
356 | stringHash(aConnection['C']) + | ||
357 | s.asString(10) + | ||
358 | A.asString(10) + | ||
359 | aConnection['B'].asString(10) + | ||
360 | K | ||
361 | ); | ||
351 | if (someParameters.parameters.M1 == M1) { | 362 | if (someParameters.parameters.M1 == M1) { |
352 | var M2; | 363 | var M2; |
353 | 364 | ||
354 | M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(A.asString(10) + someParameters.parameters.M1 + K)).toHexString().slice(2); | 365 | M2 = stringHash( |
366 | A.asString(10) + | ||
367 | someParameters.parameters.M1 + | ||
368 | K | ||
369 | ); | ||
355 | result['M2'] = M2; | 370 | result['M2'] = M2; |
356 | } else { | 371 | } else { |
357 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); | 372 | throw new Error("Client checksum verification failed! Expected <" + M1 + ">, received <" + someParameters.parameters.M1 + ">.", "Error"); |
358 | } | 373 | } |
359 | 374 | ||
360 | nextTollRequestType = 'MESSAGE'; | 375 | nextTollRequestType = 'MESSAGE'; |
361 | } else if (someParameters.message == "oneTimePassword") { | 376 | } else if (someParameters.message == "oneTimePassword") { |
362 | var otpData; | 377 | var otpData; |
363 | 378 | ||
364 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; | 379 | otpData = this.data()['onetimePasswords'][someParameters.parameters.oneTimePasswordKey]; |
365 | 380 | ||
366 | try { | 381 | try { |
367 | if (typeof(otpData) != 'undefined') { | 382 | if (typeof(otpData) != 'undefined') { |
368 | if (otpData['status'] == 'ACTIVE') { | 383 | if (otpData['status'] == 'ACTIVE') { |
369 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { | 384 | if (otpData['key_checksum'] == someParameters.parameters.oneTimePasswordKeyChecksum) { |
370 | result = { | 385 | result = { |
371 | 'data': otpData['data'], | 386 | 'data': otpData['data'], |
372 | 'version':otpData['version'] | 387 | 'version':otpData['version'] |
373 | } | 388 | } |
374 | 389 | ||
375 | otpData['status'] = 'REQUESTED'; | 390 | otpData['status'] = 'REQUESTED'; |
376 | } else { | 391 | } else { |
377 | otpData['status'] = 'DISABLED'; | 392 | otpData['status'] = 'DISABLED'; |
378 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; | 393 | throw "The requested One Time Password has been disabled, due to a wrong keyChecksum"; |
379 | } | 394 | } |
380 | } else { | 395 | } else { |
381 | throw "The requested One Time Password was not active"; | 396 | throw "The requested One Time Password was not active"; |
382 | } | 397 | } |
383 | } else { | 398 | } else { |
384 | throw "The requested One Time Password has not been found" | 399 | throw "The requested One Time Password has not been found" |
385 | } | 400 | } |
386 | } catch (exception) { | 401 | } catch (exception) { |
387 | result = { | 402 | result = { |
388 | 'data': Clipperz.PM.Crypto.randomKey(), | 403 | 'data': Clipperz.PM.Crypto.randomKey(), |
389 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion | 404 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion |
390 | } | 405 | } |
391 | } | 406 | } |
392 | nextTollRequestType = 'CONNECT'; | 407 | nextTollRequestType = 'CONNECT'; |
393 | } else { | 408 | } else { |
394 | Clipperz.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); | 409 | Clipperz.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); |
395 | } | 410 | } |
396 | 411 | ||
397 | result = { | 412 | result = { |
398 | result: result, | 413 | result: result, |
399 | toll: this.getTollForRequestType(nextTollRequestType) | 414 | toll: this.getTollForRequestType(nextTollRequestType) |
400 | } | 415 | } |
401 | 416 | ||
402 | return result; | 417 | return result; |
403 | }, | 418 | }, |
404 | 419 | ||
405 | //------------------------------------------------------------------------- | 420 | //------------------------------------------------------------------------- |
406 | 421 | ||
407 | '_message': function(aConnection, someParameters) { | 422 | '_message': function(aConnection, someParameters) { |
408 | var result; | 423 | var result; |
409 | 424 | ||
410 | result = {}; | 425 | result = {}; |
411 | 426 | ||
412 | //===================================================================== | 427 | //===================================================================== |
413 | // | 428 | // |
414 | // R E A D - O N L Y M e t h o d s | 429 | // R E A D - O N L Y M e t h o d s |
415 | // | 430 | // |
416 | //===================================================================== | 431 | //===================================================================== |
417 | if (someParameters.message == 'getUserDetails') { | 432 | if (someParameters.message == 'getUserDetails') { |
418 | var recordsStats; | 433 | var recordsStats; |