Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | 15 |
1 files changed, 6 insertions, 9 deletions
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 de8e7f6..01ba122 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -1,120 +1,117 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2011 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz's Javascript Crypto Library. | 5 | This file is part of Clipperz Community Edition. |
6 | Javascript Crypto Library provides web developers with an extensive | 6 | Clipperz Community Edition is an online password manager. |
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | 7 | For further information about its features and functionalities please |
11 | refer to http://www.clipperz.com | 8 | refer to http://www.clipperz.com. |
12 | 9 | ||
13 | * Javascript Crypto Library is free software: you can redistribute | 10 | * Clipperz Community Edition is free software: you can redistribute |
14 | it and/or modify it under the terms of the GNU Affero General Public | 11 | it and/or modify it under the terms of the GNU Affero General Public |
15 | License as published by the Free Software Foundation, either version | 12 | License as published by the Free Software Foundation, either version |
16 | 3 of the License, or (at your option) any later version. | 13 | 3 of the License, or (at your option) any later version. |
17 | 14 | ||
18 | * Javascript Crypto Library is distributed in the hope that it will | 15 | * Clipperz Community Edition is distributed in the hope that it will |
19 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 16 | be useful, but WITHOUT ANY WARRANTY; without even the implied |
20 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
21 | See the GNU Affero General Public License for more details. | 18 | See the GNU Affero General Public License for more details. |
22 | 19 | ||
23 | * You should have received a copy of the GNU Affero General Public | 20 | * You should have received a copy of the GNU Affero General Public |
24 | License along with Javascript Crypto Library. If not, see | 21 | License along with Clipperz Community Edition. If not, see |
25 | <http://www.gnu.org/licenses/>. | 22 | <http://www.gnu.org/licenses/>. |
26 | 23 | ||
27 | */ | 24 | */ |
28 | 25 | ||
29 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { | 26 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { |
30 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; | 27 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; |
31 | } | 28 | } |
32 | 29 | ||
33 | //============================================================================= | 30 | //============================================================================= |
34 | 31 | ||
35 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { | 32 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { |
36 | args = args || {}; | 33 | args = args || {}; |
37 | 34 | ||
38 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); | 35 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); |
39 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); | 36 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); |
40 | this._shouldPayTolls = args.shouldPayTolls || false; | 37 | this._shouldPayTolls = args.shouldPayTolls || false; |
41 | 38 | ||
42 | this._tolls = {}; | 39 | this._tolls = {}; |
43 | this._currentStaticConnection = null; | 40 | this._currentStaticConnection = null; |
44 | 41 | ||
45 | return this; | 42 | return this; |
46 | } | 43 | } |
47 | 44 | ||
48 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | 45 | Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { |
49 | 46 | ||
50 | //------------------------------------------------------------------------- | 47 | //------------------------------------------------------------------------- |
51 | 48 | ||
52 | 'isReadOnly': function () { | 49 | 'isReadOnly': function () { |
53 | return this._isReadOnly; | 50 | return this._isReadOnly; |
54 | }, | 51 | }, |
55 | 52 | ||
56 | //------------------------------------------------------------------------- | 53 | //------------------------------------------------------------------------- |
57 | 54 | ||
58 | 'shouldPayTolls': function() { | 55 | 'shouldPayTolls': function() { |
59 | return this._shouldPayTolls; | 56 | return this._shouldPayTolls; |
60 | }, | 57 | }, |
61 | 58 | ||
62 | //------------------------------------------------------------------------- | 59 | //------------------------------------------------------------------------- |
63 | 60 | ||
64 | 'data': function () { | 61 | 'data': function () { |
65 | return this._data; | 62 | return this._data; |
66 | }, | 63 | }, |
67 | 64 | ||
68 | //------------------------------------------------------------------------- | 65 | //------------------------------------------------------------------------- |
69 | 66 | ||
70 | 'tolls': function () { | 67 | 'tolls': function () { |
71 | return this._tolls; | 68 | return this._tolls; |
72 | }, | 69 | }, |
73 | 70 | ||
74 | //========================================================================= | 71 | //========================================================================= |
75 | 72 | ||
76 | 'resetData': function() { | 73 | 'resetData': function() { |
77 | this._data = { | 74 | this._data = { |
78 | 'users': { | 75 | 'users': { |
79 | 'catchAllUser': { | 76 | 'catchAllUser': { |
80 | __masterkey_test_value__: 'masterkey', | 77 | __masterkey_test_value__: 'masterkey', |
81 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', | 78 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', |
82 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' | 79 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' |
83 | } | 80 | } |
84 | } | 81 | } |
85 | }; | 82 | }; |
86 | }, | 83 | }, |
87 | 84 | ||
88 | //------------------------------------------------------------------------- | 85 | //------------------------------------------------------------------------- |
89 | 86 | ||
90 | 'setupWithEncryptedData': function(someData) { | 87 | 'setupWithEncryptedData': function(someData) { |
91 | this._data = Clipperz.Base.deepClone(someData); | 88 | this._data = Clipperz.Base.deepClone(someData); |
92 | }, | 89 | }, |
93 | 90 | ||
94 | //------------------------------------------------------------------------- | 91 | //------------------------------------------------------------------------- |
95 | 92 | ||
96 | 'setupWithData': function(someData) { | 93 | 'setupWithData': function(someData) { |
97 | var deferredResult; | 94 | var deferredResult; |
98 | var resultData; | 95 | var resultData; |
99 | var i, c; | 96 | var i, c; |
100 | 97 | ||
101 | //Clipperz.log(">>> Proxy.Test.setupWithData"); | 98 | //Clipperz.log(">>> Proxy.Test.setupWithData"); |
102 | resultData = this._data; | 99 | resultData = this._data; |
103 | 100 | ||
104 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); | 101 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); |
105 | c = someData['users'].length; | 102 | c = someData['users'].length; |
106 | 103 | ||
107 | for (i=0; i<c; i++) { | 104 | for (i=0; i<c; i++) { |
108 | varnewConnection; | 105 | varnewConnection; |
109 | varrecordConfiguration; | 106 | varrecordConfiguration; |
110 | 107 | ||
111 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); | 108 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); |
112 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { | 109 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { |
113 | //console.log("SERIALIZED USER", aUserSerializationContext); | 110 | //console.log("SERIALIZED USER", aUserSerializationContext); |
114 | resultData['users'][aUserSerializationContext['credentials']['C']] = { | 111 | resultData['users'][aUserSerializationContext['credentials']['C']] = { |
115 | 's': aUserSerializationContext['credentials']['s'], | 112 | 's': aUserSerializationContext['credentials']['s'], |
116 | 'v': aUserSerializationContext['credentials']['v'], | 113 | 'v': aUserSerializationContext['credentials']['v'], |
117 | 'version': aUserSerializationContext['data']['connectionVersion'], | 114 | 'version': aUserSerializationContext['data']['connectionVersion'], |
118 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], | 115 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], |
119 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], | 116 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], |
120 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], | 117 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], |