Diff

Differences From Artifact [cc6681845c]:

To Artifact [94fd0f8405]:


186
187
188
189
190
191
192



193
194
195
196
197
198
199
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202







+
+
+







 *
 * If an error occured, invoke the callback with no arguments.
 */
function cackeyMessageIncoming(messageEvent) {
	var nextFunction = null;
	var chromeCallback = null;

		console.log("START MESSAGE");
		console.log(messageEvent.data);
		console.log("END MESSAGE");
	if (messageEvent.data.target != "cackey") {
		return;
	}

	if (GoogleSmartCard.IS_DEBUG_BUILD) {
		console.log("START MESSAGE");
		console.log(messageEvent.data);
719
720
721
722
723
724
725

726

727
728
729
730
731
732
733
722
723
724
725
726
727
728
729

730
731
732
733
734
735
736
737







+
-
+







			"smartcardManagerAppId": "khpfeaanjngmcnplbdlpegiifgpfgdco"
		}
	);

	/*
	 * Initialize the PCSC NaCl interface
	 */
	new GoogleSmartCard.NaclModule(cackeyHandle);
	cackeyPCSCHandle = new GoogleSmartCard.PcscNacl(cackeyHandle);
	cackeyPCSCHandle = new GoogleSmartCard.PcscLiteClient.NaclClientBackend(cackeyHandle.messageChannel, "CACKey", "khpfeaanjngmcnplbdlpegiifgpfgdco"); 

	console.log("[cackey] cackeyInitPCSC() complete");

	return;
}

/*
812
813
814
815
816
817
818
819


820
821
822
823
824
825
826
827
828
829
830


831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854

























855
856
857
858
859
860
861
862
863
864
865
816
817
818
819
820
821
822

823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
























838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873







-
+
+











+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+











	chrome.app.runtime.onLaunched.addListener(function() {
		chrome.app.window.create('ui.html', {
			"id": "cackeyUI",
			"focused": true,
			"innerBounds": {
				"width": 350,
				"minWidth": 350,
				"height": 135,
				"height": 136,

				"minHeight": 135
			}
		}, function(uiWindow) {
			if (!uiWindow) {
				return;
			}

			uiWindow.contentWindow.parentWindow = window;
		});
	});

// Google got rid of all of the code we were using to interface with PCSC... 
// This needs to be rewritten to use the new interface
	/*
	 * Register a handler for dealing with the PCSC port being disconnected
	 */
	oldOnPortDisconnectedFunction = GoogleSmartCard.Pcsc.prototype.onPortDisconnected_;
	GoogleSmartCard.Pcsc.prototype.onPortDisconnected_ = function() {
		oldOnPortDisconnectedFunction.apply(this);

		cackeyInitPCSCCompleted("failure");

		cackeyRestart();

		return;
	};

	/*
	 * Register a handler for dealing with the PCSC port being available
	 */
	oldPCSCInitializationCallback = GoogleSmartCard.PcscNacl.prototype.pcscInitializationCallback_;
	GoogleSmartCard.PcscNacl.prototype.pcscInitializationCallback_ = function(requestId, instanceId, instance, error) {
		oldPCSCInitializationCallback.apply(this, [requestId, instanceId, instance, error]);

		return;
	};

//
//	/*
//	 * Register a handler for dealing with the PCSC port being disconnected
//	 */
//	oldOnPortDisconnectedFunction = GoogleSmartCard.Pcsc.prototype.onPortDisconnected_;
//	GoogleSmartCard.Pcsc.prototype.onPortDisconnected_ = function() {
//		oldOnPortDisconnectedFunction.apply(this);
//
//		cackeyInitPCSCCompleted("failure");
//
//		cackeyRestart();
//
//		return;
//	};
//
//	/*
//	 * Register a handler for dealing with the PCSC port being available
//	 */
//	oldPCSCInitializationCallback = GoogleSmartCard.PcscNacl.prototype.pcscInitializationCallback_;
//	GoogleSmartCard.PcscNacl.prototype.pcscInitializationCallback_ = function(requestId, instanceId, instance, error) {
//		oldPCSCInitializationCallback.apply(this, [requestId, instanceId, instance, error]);
//
//		return;
//	};
//
	/*
	 * Initialize global state
	 */
	cackeyInitGlobalState();

	return;
}

/* Initialize CACKey */
cackeyAppInit();
cackeyInit();