Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/Proxy') (more/less context) (ignore whitespace changes)
5 files changed, 54 insertions, 88 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js index 5b39b4a..7d10dd4 100755 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.JSON.js | |||
@@ -1,34 +1,32 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | 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. |
19 | 18 | ||
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 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Proxy.JSON = function(args) { | 29 | Clipperz.PM.Proxy.JSON = function(args) { |
32 | Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args); | 30 | Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args); |
33 | 31 | ||
34 | this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter'); | 32 | this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter'); |
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 01ba122..326022c 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -1,34 +1,32 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | 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. |
19 | 18 | ||
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 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { |
27 | 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!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
31 | 29 | ||
32 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { | 30 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { |
33 | args = args || {}; | 31 | args = args || {}; |
34 | 32 | ||
@@ -98,40 +96,38 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
98 | //Clipperz.log(">>> Proxy.Test.setupWithData"); | 96 | //Clipperz.log(">>> Proxy.Test.setupWithData"); |
99 | resultData = this._data; | 97 | resultData = this._data; |
100 | 98 | ||
101 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); | 99 | deferredResult = new Clipperz.Async.Deferred("Proxy.Test.seupWithData", {trace:false}); |
102 | c = someData['users'].length; | 100 | c = someData['users'].length; |
103 | 101 | ||
104 | for (i=0; i<c; i++) { | 102 | for (i=0; i<c; i++) { |
105 | varnewConnection; | 103 | varnewConnection; |
106 | varrecordConfiguration; | 104 | varrecordConfiguration; |
107 | 105 | ||
108 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); | 106 | deferredResult.addMethod(this, 'userSerializedEncryptedData', someData['users'][i]); |
109 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { | 107 | deferredResult.addCallback(MochiKit.Base.bind(function(aUserSerializationContext) { |
110 | //console.log("SERIALIZED USER", aUserSerializationContext); | ||
111 | resultData['users'][aUserSerializationContext['credentials']['C']] = { | 108 | resultData['users'][aUserSerializationContext['credentials']['C']] = { |
112 | 's': aUserSerializationContext['credentials']['s'], | 109 | 's': aUserSerializationContext['credentials']['s'], |
113 | 'v': aUserSerializationContext['credentials']['v'], | 110 | 'v': aUserSerializationContext['credentials']['v'], |
114 | 'version': aUserSerializationContext['data']['connectionVersion'], | 111 | 'version': aUserSerializationContext['data']['connectionVersion'], |
115 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], | 112 | 'userDetails': aUserSerializationContext['encryptedData']['user']['header'], |
116 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], | 113 | 'userDetailsVersion':aUserSerializationContext['encryptedData']['user']['version'], |
117 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], | 114 | 'statistics': aUserSerializationContext['encryptedData']['user']['statistics'], |
118 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], | 115 | 'lock': aUserSerializationContext['encryptedData']['user']['lock'], |
119 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) | 116 | 'records': this.rearrangeRecordsData(aUserSerializationContext['encryptedData']['records']) |
120 | } | 117 | } |
121 | }, this)); | 118 | }, this)); |
122 | } | 119 | } |
123 | 120 | ||
124 | deferredResult.addCallback(MochiKit.Base.bind(function() { | 121 | deferredResult.addCallback(MochiKit.Base.bind(function() { |
125 | //console.log("this._data", resultData); | ||
126 | this._data = resultData; | 122 | this._data = resultData; |
127 | }, this)); | 123 | }, this)); |
128 | 124 | ||
129 | deferredResult.callback(); | 125 | deferredResult.callback(); |
130 | //Clipperz.log("<<< Proxy.Test.setupWithData"); | 126 | //Clipperz.log("<<< Proxy.Test.setupWithData"); |
131 | 127 | ||
132 | return deferredResult; | 128 | return deferredResult; |
133 | }, | 129 | }, |
134 | 130 | ||
135 | //========================================================================= | 131 | //========================================================================= |
136 | 132 | ||
137 | 'getTollForRequestType': function (aRequestType) { | 133 | 'getTollForRequestType': function (aRequestType) { |
@@ -386,25 +382,25 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
386 | } | 382 | } |
387 | } else { | 383 | } else { |
388 | throw "The requested One Time Password has not been found" | 384 | throw "The requested One Time Password has not been found" |
389 | } | 385 | } |
390 | } catch (exception) { | 386 | } catch (exception) { |
391 | result = { | 387 | result = { |
392 | 'data': Clipperz.PM.Crypto.randomKey(), | 388 | 'data': Clipperz.PM.Crypto.randomKey(), |
393 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion | 389 | 'version':Clipperz.PM.Connection.communicationProtocol.currentVersion |
394 | } | 390 | } |
395 | } | 391 | } |
396 | nextTollRequestType = 'CONNECT'; | 392 | nextTollRequestType = 'CONNECT'; |
397 | } else { | 393 | } else { |
398 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); | 394 | Clipperz.logError("Clipperz.PM.Proxy.Test.handshake - unhandled message: " + someParameters.message); |
399 | } | 395 | } |
400 | 396 | ||
401 | result = { | 397 | result = { |
402 | result: result, | 398 | result: result, |
403 | toll: this.getTollForRequestType(nextTollRequestType) | 399 | toll: this.getTollForRequestType(nextTollRequestType) |
404 | } | 400 | } |
405 | 401 | ||
406 | return result; | 402 | return result; |
407 | }, | 403 | }, |
408 | 404 | ||
409 | //------------------------------------------------------------------------- | 405 | //------------------------------------------------------------------------- |
410 | 406 | ||
@@ -516,27 +512,24 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
516 | delete this.data()['users'][oldCValue]; | 512 | delete this.data()['users'][oldCValue]; |
517 | 513 | ||
518 | result = {result:"done", parameters:parameters}; | 514 | result = {result:"done", parameters:parameters}; |
519 | } | 515 | } |
520 | } else { | 516 | } else { |
521 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 517 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
522 | } | 518 | } |
523 | //===================================================================== | 519 | //===================================================================== |
524 | /* } else if (someParameters.message == 'updateData') { | 520 | /* } else if (someParameters.message == 'updateData') { |
525 | if (this.isReadOnly() == false) { | 521 | if (this.isReadOnly() == false) { |
526 | var i, c; | 522 | var i, c; |
527 | 523 | ||
528 | //console.log("###==============================================================="); | ||
529 | //console.log("###>>>", Clipperz.Base.serializeJSON(someParameters)); | ||
530 | //console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData())); | ||
531 | if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) { | 524 | if (this.userData()['lock']!= someParameters['parameters']['user']['lock']) { |
532 | throw "the lock attribute is not processed correctly" | 525 | throw "the lock attribute is not processed correctly" |
533 | } | 526 | } |
534 | 527 | ||
535 | this.userData()['userDetails'] = someParameters['parameters']['user']['header']; | 528 | this.userData()['userDetails'] = someParameters['parameters']['user']['header']; |
536 | this.userData()['statistics'] = someParameters['parameters']['user']['statistics']; | 529 | this.userData()['statistics'] = someParameters['parameters']['user']['statistics']; |
537 | this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version']; | 530 | this.userData()['userDetailsVersions']= someParameters['parameters']['user']['version']; |
538 | 531 | ||
539 | c = someParameters['parameters']['records'].length; | 532 | c = someParameters['parameters']['records'].length; |
540 | for (i=0; i<c; i++) { | 533 | for (i=0; i<c; i++) { |
541 | var currentRecord; | 534 | var currentRecord; |
542 | var currentRecordData; | 535 | var currentRecordData; |
@@ -553,62 +546,53 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
553 | 546 | ||
554 | currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = { | 547 | currentRecord['versions'][currentRecordData['currentRecordVersion']['reference']] = { |
555 | 'data': currentRecordData['currentRecordVersion']['data'], | 548 | 'data': currentRecordData['currentRecordVersion']['data'], |
556 | 'version': currentRecordData['currentRecordVersion']['version'], | 549 | 'version': currentRecordData['currentRecordVersion']['version'], |
557 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], | 550 | 'previousVersion': currentRecordData['currentRecordVersion']['previousVersion'], |
558 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'] | 551 | 'previousVersionKey':currentRecordData['currentRecordVersion']['previousVersionKey'] |
559 | } | 552 | } |
560 | } | 553 | } |
561 | 554 | ||
562 | this.userData()['lock'] = Clipperz.PM.Crypto.randomKey(); | 555 | this.userData()['lock'] = Clipperz.PM.Crypto.randomKey(); |
563 | result['lock'] = this.userData()['lock']; | 556 | result['lock'] = this.userData()['lock']; |
564 | result['result'] = 'done'; | 557 | result['result'] = 'done'; |
565 | //console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData())); | ||
566 | } else { | 558 | } else { |
567 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 559 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
568 | } | 560 | } |
569 | */ //===================================================================== | 561 | */ //===================================================================== |
570 | } else if (someParameters.message == 'saveChanges') { | 562 | } else if (someParameters.message == 'saveChanges') { |
571 | if (this.isReadOnly() == false) { | 563 | if (this.isReadOnly() == false) { |
572 | var i, c; | 564 | var i, c; |
573 | 565 | ||
574 | //console.log("###==============================================================="); | ||
575 | //console.log("###>>>", someParameters); | ||
576 | //console.log("###>>>", Clipperz.Base.serializeJSON(someParameters)); | ||
577 | //console.log("###--- userData", Clipperz.Base.serializeJSON(this.userData())); | ||
578 | //console.log("###==============================================================="); | ||
579 | //console.log("--- userData.lock ", this.userData()['lock']); | ||
580 | //console.log("--- parameters.lock", someParameters['parameters']['user']['lock']); | ||
581 | if (aConnection['userData']['lock']!= someParameters['parameters']['user']['lock']) { | 566 | if (aConnection['userData']['lock']!= someParameters['parameters']['user']['lock']) { |
582 | throw "the lock attribute is not processed correctly" | 567 | throw "the lock attribute is not processed correctly" |
583 | } | 568 | } |
584 | 569 | ||
585 | aConnection['userData']['userDetails'] = someParameters['parameters']['user']['header']; | 570 | aConnection['userData']['userDetails'] = someParameters['parameters']['user']['header']; |
586 | aConnection['userData']['statistics'] = someParameters['parameters']['user']['statistics']; | 571 | aConnection['userData']['statistics'] = someParameters['parameters']['user']['statistics']; |
587 | aConnection['userData']['userDetailsVersions']= someParameters['parameters']['user']['version']; | 572 | aConnection['userData']['userDetailsVersions']= someParameters['parameters']['user']['version']; |
588 | 573 | ||
589 | c = someParameters['parameters']['records']['updated'].length; | 574 | c = someParameters['parameters']['records']['updated'].length; |
590 | for (i=0; i<c; i++) { | 575 | for (i=0; i<c; i++) { |
591 | var currentRecord; | 576 | var currentRecord; |
592 | var currentRecordData; | 577 | var currentRecordData; |
593 | 578 | ||
594 | currentRecordData = someParameters['parameters']['records']['updated'][i]; | 579 | currentRecordData = someParameters['parameters']['records']['updated'][i]; |
595 | currentRecord = aConnection['userData']['records'][currentRecordData['record']['reference']]; | 580 | currentRecord = aConnection['userData']['records'][currentRecordData['record']['reference']]; |
596 | 581 | ||
597 | if ( | 582 | if ( |
598 | (typeof(aConnection['userData']['records'][currentRecordData['record']['reference']]) == 'undefined') | 583 | (typeof(aConnection['userData']['records'][currentRecordData['record']['reference']]) == 'undefined') |
599 | && | 584 | && |
600 | (typeof(currentRecordData['currentRecordVersion']) == 'undefined') | 585 | (typeof(currentRecordData['currentRecordVersion']) == 'undefined') |
601 | ) { | 586 | ) { |
602 | //console.log("######## SHIT HAPPENS"); | ||
603 | throw "Record added without a recordVersion"; | 587 | throw "Record added without a recordVersion"; |
604 | } | 588 | } |
605 | 589 | ||
606 | if (currentRecord == null) { | 590 | if (currentRecord == null) { |
607 | currentRecord = {}; | 591 | currentRecord = {}; |
608 | currentRecord['versions'] = {}; | 592 | currentRecord['versions'] = {}; |
609 | currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 593 | currentRecord['creationDate']= Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
610 | currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); | 594 | currentRecord['accessDate'] = Clipperz.PM.Date.formatDateWithUTCFormat(new Date()); |
611 | 595 | ||
612 | aConnection['userData']['records'][currentRecordData['record']['reference']] = currentRecord; | 596 | aConnection['userData']['records'][currentRecordData['record']['reference']] = currentRecord; |
613 | } | 597 | } |
614 | 598 | ||
@@ -626,43 +610,41 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
626 | 'creationDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), | 610 | 'creationDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), |
627 | 'updateDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), | 611 | 'updateDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()), |
628 | 'accessDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()) | 612 | 'accessDate':Clipperz.PM.Date.formatDateWithUTCFormat(new Date()) |
629 | } | 613 | } |
630 | } | 614 | } |
631 | } | 615 | } |
632 | 616 | ||
633 | c = someParameters['parameters']['records']['deleted'].length; | 617 | c = someParameters['parameters']['records']['deleted'].length; |
634 | for (i=0; i<c; i++) { | 618 | for (i=0; i<c; i++) { |
635 | var currentRecordReference; | 619 | var currentRecordReference; |
636 | 620 | ||
637 | currentRecordReference = someParameters['parameters']['records']['deleted'][i]; | 621 | currentRecordReference = someParameters['parameters']['records']['deleted'][i]; |
638 | //console.log("DELETING records", currentRecordReference); | ||
639 | delete aConnection['userData']['records'][currentRecordReference]; | 622 | delete aConnection['userData']['records'][currentRecordReference]; |
640 | } | 623 | } |
641 | 624 | ||
642 | aConnection['userData']['lock'] = Clipperz.PM.Crypto.randomKey(); | 625 | aConnection['userData']['lock'] = Clipperz.PM.Crypto.randomKey(); |
643 | result['lock'] = aConnection['userData']['lock']; | 626 | result['lock'] = aConnection['userData']['lock']; |
644 | result['result'] = 'done'; | 627 | result['result'] = 'done'; |
645 | //console.log("###<<< userData", Clipperz.Base.serializeJSON(this.userData())); | ||
646 | } else { | 628 | } else { |
647 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; | 629 | throw Clipperz.PM.Proxy.Offline.DataStore.exception.ReadOnly; |
648 | } | 630 | } |
649 | 631 | ||
650 | //===================================================================== | 632 | //===================================================================== |
651 | // | 633 | // |
652 | // U N H A N D L E D M e t h o d | 634 | // U N H A N D L E D M e t h o d |
653 | // | 635 | // |
654 | //===================================================================== | 636 | //===================================================================== |
655 | } else { | 637 | } else { |
656 | MochiKit.Logging.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message); | 638 | Clipperz.logError("Clipperz.PM.Proxy.Test.message - unhandled message: " + someParameters.message); |
657 | } | 639 | } |
658 | 640 | ||
659 | result = { | 641 | result = { |
660 | result: result, | 642 | result: result, |
661 | toll: this.getTollForRequestType('MESSAGE') | 643 | toll: this.getTollForRequestType('MESSAGE') |
662 | } | 644 | } |
663 | 645 | ||
664 | // return MochiKit.Async.succeed(result); | 646 | // return MochiKit.Async.succeed(result); |
665 | return result; | 647 | return result; |
666 | }, | 648 | }, |
667 | 649 | ||
668 | //------------------------------------------------------------------------- | 650 | //------------------------------------------------------------------------- |
@@ -677,30 +659,30 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
677 | 659 | ||
678 | 'isTestData': function(aConnection) { | 660 | 'isTestData': function(aConnection) { |
679 | return (typeof(aConnection['userData']['__masterkey_test_value__']) != 'undefined'); | 661 | return (typeof(aConnection['userData']['__masterkey_test_value__']) != 'undefined'); |
680 | }, | 662 | }, |
681 | 663 | ||
682 | 'userDetails': function(aConnection) { | 664 | 'userDetails': function(aConnection) { |
683 | var result; | 665 | var result; |
684 | 666 | ||
685 | if (this.isTestData(aConnection)) { | 667 | if (this.isTestData(aConnection)) { |
686 | var serializedHeader; | 668 | var serializedHeader; |
687 | var version; | 669 | var version; |
688 | 670 | ||
689 | //MochiKit.Logging.logDebug("### test data"); | 671 | //Clipperz.logDebug("### test data"); |
690 | version = aConnection['userData']['userDetailsVersion']; | 672 | version = aConnection['userData']['userDetailsVersion']; |
691 | serializedHeader = Clipperz.Base.serializeJSON(aConnection['userData']['userDetails']); | 673 | serializedHeader = Clipperz.Base.serializeJSON(aConnection['userData']['userDetails']); |
692 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedHeader); | 674 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(aConnection['userData']['__masterkey_test_value__'], serializedHeader); |
693 | } else { | 675 | } else { |
694 | //MochiKit.Logging.logDebug("### NOT test data"); | 676 | //Clipperz.logDebug("### NOT test data"); |
695 | result = aConnection['userData']['userDetails']; | 677 | result = aConnection['userData']['userDetails']; |
696 | } | 678 | } |
697 | 679 | ||
698 | return result; | 680 | return result; |
699 | }, | 681 | }, |
700 | 682 | ||
701 | 'statistics': function(aConnection) { | 683 | 'statistics': function(aConnection) { |
702 | var result; | 684 | var result; |
703 | 685 | ||
704 | if (aConnection['userData']['statistics'] != null) { | 686 | if (aConnection['userData']['statistics'] != null) { |
705 | if (this.isTestData(aConnection)) { | 687 | if (this.isTestData(aConnection)) { |
706 | var serializedStatistics; | 688 | var serializedStatistics; |
@@ -740,29 +722,27 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | |||
740 | return deferredContext; | 722 | return deferredContext; |
741 | }); | 723 | }); |
742 | deferredResult.addCallback(function(aDeferredContext) { | 724 | deferredResult.addCallback(function(aDeferredContext) { |
743 | var connection; | 725 | var connection; |
744 | 726 | ||
745 | connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]() | 727 | connection = new Clipperz.PM.Connection.communicationProtocol.versions[aDeferredContext['data']['connectionVersion']]() |
746 | aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase()); | 728 | aDeferredContext['credentials'] = connection.serverSideUserCredentials(aDeferredContext['user'].username(),aDeferredContext['user'].passphrase()); |
747 | 729 | ||
748 | return aDeferredContext; | 730 | return aDeferredContext; |
749 | }); | 731 | }); |
750 | 732 | ||
751 | // deferredResult.addCallback(function(aDeferredContext) { | 733 | // deferredResult.addCallback(function(aDeferredContext) { |
752 | //console.log("#-#-#-#-#", aDeferredContext); | ||
753 | // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); | 734 | // return aDeferredContext['user'].serializedDataUsingVersion(MochiKit.Base.values(aDeferredContext['user'].records()), aDeferredContext['data']['version']); |
754 | // }, deferredContext); | 735 | // }, deferredContext); |
755 | // deferredResult.addCallback(function(aUserSerializedData) { | 736 | // deferredResult.addCallback(function(aUserSerializedData) { |
756 | //console.log("USER SERIALIZED DATA", aUserSerializedData); | ||
757 | // }); | 737 | // }); |
758 | // | 738 | // |
759 | // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext); | 739 | // deferredResult.addCallback(MochiKit.Async.succeed, deferredContext); |
760 | deferredResult.callback(deferredContext); | 740 | deferredResult.callback(deferredContext); |
761 | 741 | ||
762 | return deferredResult; | 742 | return deferredResult; |
763 | }, | 743 | }, |
764 | 744 | ||
765 | 'createUserUsingConfigurationData': function(someData) { | 745 | 'createUserUsingConfigurationData': function(someData) { |
766 | var result; | 746 | var result; |
767 | var user; | 747 | var user; |
768 | var recordLabel; | 748 | var recordLabel; |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js index a86ac4f..5764bda 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Offline.js | |||
@@ -1,34 +1,32 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | 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. |
19 | 18 | ||
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 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Proxy.Offline = function(args) { | 29 | Clipperz.PM.Proxy.Offline = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); | 32 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js index 803c590..f628975 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.OfflineCache.js | |||
@@ -1,34 +1,32 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | 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. |
19 | 18 | ||
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 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | 26 | ||
29 | //============================================================================= | 27 | //============================================================================= |
30 | 28 | ||
31 | Clipperz.PM.Proxy.OfflineCache = function(args) { | 29 | Clipperz.PM.Proxy.OfflineCache = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); | 32 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); |
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js index d554c6a..d459726 100644 --- a/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js +++ b/frontend/gamma/js/Clipperz/PM/Proxy/Proxy.Test.js | |||
@@ -1,34 +1,32 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | 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. |
19 | 18 | ||
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 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | 25 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } |
28 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } | 26 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
31 | 29 | ||
32 | Clipperz.PM.Proxy.Test = function(args) { | 30 | Clipperz.PM.Proxy.Test = function(args) { |
33 | Clipperz.PM.Proxy.Test.superclass.constructor.call(this, args); | 31 | Clipperz.PM.Proxy.Test.superclass.constructor.call(this, args); |
34 | 32 | ||
@@ -89,65 +87,59 @@ Clipperz.Base.extend(Clipperz.PM.Proxy.Test, Clipperz.PM.Proxy.Offline, { | |||
89 | 'unexpectedRequests': function () { | 87 | 'unexpectedRequests': function () { |
90 | return this._unexpectedRequests; | 88 | return this._unexpectedRequests; |
91 | }, | 89 | }, |
92 | 90 | ||
93 | 'resetUnexpectedRequests': function () { | 91 | 'resetUnexpectedRequests': function () { |
94 | this._unexpectedRequests = []; | 92 | this._unexpectedRequests = []; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //------------------------------------------------------------------------- | 95 | //------------------------------------------------------------------------- |
98 | 96 | ||
99 | 'testExpectedRequestParameters': function (aPath, anActualRequest, anExpectedRequest) { | 97 | 'testExpectedRequestParameters': function (aPath, anActualRequest, anExpectedRequest) { |
100 | var aKey; | 98 | var aKey; |
101 | //console.log(">>> Proxy.testExpectedRequestParameters [" + aPath + "]", anActualRequest, anExpectedRequest); | ||
102 | for (aKey in anExpectedRequest) { | 99 | for (aKey in anExpectedRequest) { |
103 | if (typeof(anActualRequest[aKey]) == 'undefined') { | 100 | if (typeof(anActualRequest[aKey]) == 'undefined') { |
104 | throw "the expected paramter [" + aKey + "] is missing from the actual request"; | 101 | throw "the expected paramter [" + aKey + "] is missing from the actual request"; |
105 | } | 102 | } |
106 | if (typeof(anExpectedRequest[aKey]) == 'object') { | 103 | if (typeof(anExpectedRequest[aKey]) == 'object') { |
107 | this.testExpectedRequestParameters(aPath + "." + aKey, anActualRequest[aKey], anExpectedRequest[aKey]) | 104 | this.testExpectedRequestParameters(aPath + "." + aKey, anActualRequest[aKey], anExpectedRequest[aKey]) |
108 | } else { | 105 | } else { |
109 | if (! anExpectedRequest[aKey](anActualRequest[aKey])) { | 106 | if (! anExpectedRequest[aKey](anActualRequest[aKey])) { |
110 | throw "wrong value for paramter [" + aKey + "]; got '" + anActualRequest[aKey] + "'"; | 107 | throw "wrong value for paramter [" + aKey + "]; got '" + anActualRequest[aKey] + "'"; |
111 | } | 108 | } |
112 | } | 109 | } |
113 | } | 110 | } |
114 | //console.log("<<< Proxy.testExpectedRequestParameters"); | ||
115 | }, | 111 | }, |
116 | 112 | ||
117 | //------------------------------------------------------------------------- | 113 | //------------------------------------------------------------------------- |
118 | 114 | ||
119 | 'checkRequest': function(aFunctionName, someParameters) { | 115 | 'checkRequest': function(aFunctionName, someParameters) { |
120 | if (this.shouldCheckExpectedRequests()) { | 116 | if (this.shouldCheckExpectedRequests()) { |
121 | var expectedRequest; | 117 | var expectedRequest; |
122 | 118 | ||
123 | //console.log(">>> Proxy.Test.checkRequest - " + aFunctionName, someParameters); | ||
124 | expectedRequest = this.expectedRequests().pop(); | 119 | expectedRequest = this.expectedRequests().pop(); |
125 | //console.log("--- Proxy.Test.checkRequest - expectedRequest", expectedRequest); | ||
126 | if (expectedRequest == null) { | 120 | if (expectedRequest == null) { |
127 | throw "Proxy.Test.sentMessage: no expected result specified. Got request '" + aFunctionName + "': " + someParameters; | 121 | throw "Proxy.Test.sentMessage: no expected result specified. Got request '" + aFunctionName + "': " + someParameters; |
128 | } | 122 | } |
129 | 123 | ||
130 | try { | 124 | try { |
131 | if (aFunctionName != expectedRequest.functionName) { | 125 | if (aFunctionName != expectedRequest.functionName) { |
132 | throw "wrong function name. Got '" + aFunctionName + "', expected '" + expectedRequest.request.functionName + "'"; | 126 | throw "wrong function name. Got '" + aFunctionName + "', expected '" + expectedRequest.request.functionName + "'"; |
133 | } | 127 | } |
134 | 128 | ||
135 | this.testExpectedRequestParameters("parameters", someParameters, expectedRequest.parameters); | 129 | this.testExpectedRequestParameters("parameters", someParameters, expectedRequest.parameters); |
136 | } catch(exception) { | 130 | } catch(exception) { |
137 | //console.log("EXCEPTION: Proxy.Test.sentMessage[" + expectedRequest.name + "]", exception) | ||
138 | throw "Proxy.Test.sentMessage[" + expectedRequest.name + "]: " + exception; | 131 | throw "Proxy.Test.sentMessage[" + expectedRequest.name + "]: " + exception; |
139 | } | 132 | } |
140 | } | 133 | } |
141 | //console.log("<<< Proxy.Test.checkRequest"); | ||
142 | }, | 134 | }, |
143 | 135 | ||
144 | //========================================================================= | 136 | //========================================================================= |
145 | 137 | ||
146 | 'sendMessage': function(aFunctionName, someParameters) { | 138 | 'sendMessage': function(aFunctionName, someParameters) { |
147 | var result; | 139 | var result; |
148 | 140 | ||
149 | if (this.isExpectingRequests() == false) { | 141 | if (this.isExpectingRequests() == false) { |
150 | // throw Clipperz.PM.Connection.exception.UnexpectedRequest; | 142 | // throw Clipperz.PM.Connection.exception.UnexpectedRequest; |
151 | Clipperz.log("UNEXPECTED REQUEST " + aFunctionName /* + ": " + Clipperz.Base.serializeJSON(someParameters) */); | 143 | Clipperz.log("UNEXPECTED REQUEST " + aFunctionName /* + ": " + Clipperz.Base.serializeJSON(someParameters) */); |
152 | this.unexpectedRequests().push({'functionName':aFunctionName, 'someParameters': someParameters}); | 144 | this.unexpectedRequests().push({'functionName':aFunctionName, 'someParameters': someParameters}); |
153 | }; | 145 | }; |