Diff

Differences From Artifact [b583369d4a]:

To Artifact [f4c949a3a4]:


10
11
12
13
14
15
16

17
18
19
20
21
22
23

/*
 * Handle for the CACKey NaCl Target
 */
var cackeyHandle = null;
var cackeyPCSCHandle = null;
var cackeyPCSCHandleUsable = false;


/*
 * Handle and ID for outstanding callbacks
 */
var cackeyOutstandingCallbacks = {}
var cackeyOutstandingCallbackCounter = -1;








>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

/*
 * Handle for the CACKey NaCl Target
 */
var cackeyHandle = null;
var cackeyPCSCHandle = null;
var cackeyPCSCHandleUsable = false;
var cackeyPCSCHandleLastUsed = (new Date()).getTime();

/*
 * Handle and ID for outstanding callbacks
 */
var cackeyOutstandingCallbacks = {}
var cackeyOutstandingCallbackCounter = -1;

539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
 */
function cackeyUninitPCSC() {
	console.log("[cackey] cackeyUninitPCSC() called");

	if (cackeyPCSCHandle != null) {
		console.log("[cackey] Deleting PCSC handle");

		delete cackeyPCSCHandle;

		cackeyPCSCHandle = null;
	}

	cackeyPCSCHandleUsable = false;

	console.log("[cackey] cackeyUninitPCSC() returning");








<
<







540
541
542
543
544
545
546


547
548
549
550
551
552
553
 */
function cackeyUninitPCSC() {
	console.log("[cackey] cackeyUninitPCSC() called");

	if (cackeyPCSCHandle != null) {
		console.log("[cackey] Deleting PCSC handle");



		cackeyPCSCHandle = null;
	}

	cackeyPCSCHandleUsable = false;

	console.log("[cackey] cackeyUninitPCSC() returning");

669
670
671
672
673
674
675

676
677
678










679
680
681
682
683
684
685
/*
 * Initialize the PCSC connection
 */
function cackeyInitPCSC(callbackAfterInit, callbackInitFailed) {
	/*
	 * Start the Google PCSC Interface
	 */


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











	/*
	 * Queue this callback to be completed when initialization is complete
	 */
	if (callbackAfterInit) {
		cackeyCallbackAfterInit.push({"successCallback": callbackAfterInit, "failureCallback": callbackInitFailed});
	}








>



>
>
>
>
>
>
>
>
>
>







668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
/*
 * Initialize the PCSC connection
 */
function cackeyInitPCSC(callbackAfterInit, callbackInitFailed) {
	/*
	 * Start the Google PCSC Interface
	 */
	var now, lastUsedMillisecondsAgo;

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

	now = (new Date()).getTime();
	lastUsedMillisecondsAgo = now - cackeyPCSCHandleLastUsed;

	if (lastUsedMillisecondsAgo > 30000) {
		console.log("[cackey] PCSC handle was last used " + lastUsedMillisecondsAgo + "ms ago, restarting to get a new handle");
		cackeyRestart();
	}

	cackeyPCSCHandleLastUsed = now;

	/*
	 * Queue this callback to be completed when initialization is complete
	 */
	if (callbackAfterInit) {
		cackeyCallbackAfterInit.push({"successCallback": callbackAfterInit, "failureCallback": callbackInitFailed});
	}