diff --git a/infrastructure/blindvote/src/crypto/pedersen.ts b/infrastructure/blindvote/src/crypto/pedersen.ts index 8404f7f2..4b32f66b 100644 --- a/infrastructure/blindvote/src/crypto/pedersen.ts +++ b/infrastructure/blindvote/src/crypto/pedersen.ts @@ -286,7 +286,16 @@ function addPoints(arr: any[]) { * Helper function to compare encodings */ function encEq(A: any, B: any) { - return Buffer.from(A.toRawBytes()).equals(Buffer.from(B.toRawBytes())); + const bytesA = A.toRawBytes(); + const bytesB = B.toRawBytes(); + + if (bytesA.length !== bytesB.length) return false; + + for (let i = 0; i < bytesA.length; i++) { + if (bytesA[i] !== bytesB[i]) return false; + } + + return true; } export function verifyFinal(C_aggb: Uint8Array, H_Sb: Uint8Array, M: number): boolean { diff --git a/infrastructure/control-panel/src/routes/+layout.svelte b/infrastructure/control-panel/src/routes/+layout.svelte index dc43ad8f..6d243a27 100644 --- a/infrastructure/control-panel/src/routes/+layout.svelte +++ b/infrastructure/control-panel/src/routes/+layout.svelte @@ -31,7 +31,25 @@ size="sm" class="whitespace-nowrap" variant="solid" - callback={() => goto('/monitoring')}>Start Monitoring { + // Get selected items from the current page + const evaultsData = sessionStorage.getItem('selectedEVaults'); + const platformsData = sessionStorage.getItem('selectedPlatforms'); + + // If no items selected, show alert + if ( + (!evaultsData || JSON.parse(evaultsData).length === 0) && + (!platformsData || JSON.parse(platformsData).length === 0) + ) { + alert( + 'Please select eVaults and/or platforms first before starting monitoring.' + ); + return; + } + + // Navigate to monitoring + goto('/monitoring'); + }}>Start Monitoring {:else} diff --git a/infrastructure/control-panel/src/routes/+page.svelte b/infrastructure/control-panel/src/routes/+page.svelte index a9c01d78..d4295749 100644 --- a/infrastructure/control-panel/src/routes/+page.svelte +++ b/infrastructure/control-panel/src/routes/+page.svelte @@ -69,6 +69,10 @@ } else { selectedEVaults = selectedEVaults.filter((i) => i !== index); } + + // Store selections immediately in sessionStorage + const selectedEVaultData = selectedEVaults.map((i) => evaults[i]); + sessionStorage.setItem('selectedEVaults', JSON.stringify(selectedEVaultData)); } // Handle platform selection changes @@ -78,6 +82,10 @@ } else { selectedPlatforms = selectedPlatforms.filter((i) => i !== index); } + + // Store selections immediately in sessionStorage + const selectedPlatformData = selectedPlatforms.map((i) => platforms[i]); + sessionStorage.setItem('selectedPlatforms', JSON.stringify(selectedPlatformData)); } // Navigate to monitoring with selected items diff --git a/infrastructure/control-panel/src/routes/monitoring/+page.svelte b/infrastructure/control-panel/src/routes/monitoring/+page.svelte index 96087aed..4ec6d877 100644 --- a/infrastructure/control-panel/src/routes/monitoring/+page.svelte +++ b/infrastructure/control-panel/src/routes/monitoring/+page.svelte @@ -42,12 +42,11 @@ selectedPlatforms = JSON.parse(platformsData); } - // Check if any items are selected, if not redirect back to home + // Check if any items are selected, if not show selection interface if ( (!selectedEVaults || selectedEVaults.length === 0) && (!selectedPlatforms || selectedPlatforms.length === 0) ) { - goto('/'); return; } @@ -483,69 +482,77 @@ } -
-
-
-
-

Live Monitoring

-

- Monitoring {selectedEVaults.length} eVault{selectedEVaults.length !== 1 - ? 's' - : ''} and {selectedPlatforms.length} platform{selectedPlatforms.length !== 1 - ? 's' - : ''} -

- {#if currentFlowStep > 0} -
-
- - {currentFlowStep === 1 - ? 'Platform creating entry locally' - : currentFlowStep === 2 - ? 'Syncing to eVault' - : currentFlowStep === 3 - ? 'eVault created metaenvelope' - : currentFlowStep === 4 - ? 'Awareness Protocol' - : currentFlowStep === 5 - ? 'All platforms notified' - : 'Complete'} - -
- {/if} -
-
- - +
+
+{:else} +
+
+
+
+

Live Monitoring

+

+ Monitoring {selectedEVaults.length} eVault{selectedEVaults.length !== 1 + ? 's' + : ''} and {selectedPlatforms.length} platform{selectedPlatforms.length !== + 1 + ? 's' + : ''} +

+ {#if currentFlowStep > 0} +
+
+ + {currentFlowStep === 1 + ? 'Platform creating entry locally' + : currentFlowStep === 2 + ? 'Syncing to eVault' + : currentFlowStep === 3 + ? 'eVault created metaenvelope' + : currentFlowStep === 4 + ? 'Awareness Protocol' + : currentFlowStep === 5 + ? 'All platforms notified' + : 'Complete'} + +
{/if} - {isPaused ? 'Resume Live Feed' : 'Pause Live Feed'} - +
+
+ + +
-
- {#if SvelteFlowComponent} - {#if selectedEVaults.length === 0 && selectedPlatforms.length === 0} -
-
-

No Items Selected

-

- Go back to the main page and select eVaults and platforms to monitor. -

-
-
- {:else} + {#if SvelteFlowComponent}
+ {:else} +
+ Loading flow chart... +
{/if} - {:else} -
- Loading flow chart... -
- {/if} -
- - -
-
-

Data Flow

-
- Current Step: {currentFlowStep === 0 - ? 'Waiting for events...' - : currentFlowStep === 1 - ? 'Platform creating entry locally' - : currentFlowStep === 2 - ? 'Syncing to eVault' - : currentFlowStep === 3 - ? 'eVault created metaenvelope' - : currentFlowStep === 4 - ? 'Awareness Protocol' - : currentFlowStep === 5 - ? 'All platforms notified' - : 'Complete'} -
-
- {#each flowMessages as message, i} -
- {message} + +
+
+

Data Flow

+
+ Current Step: {currentFlowStep === 0 + ? 'Waiting for events...' + : currentFlowStep === 1 + ? 'Platform creating entry locally' + : currentFlowStep === 2 + ? 'Syncing to eVault' + : currentFlowStep === 3 + ? 'eVault created metaenvelope' + : currentFlowStep === 4 + ? 'Awareness Protocol' + : currentFlowStep === 5 + ? 'All platforms notified' + : 'Complete'}
- {/each} +
+ +
+ {#each flowMessages as message, i} +
+ {message} +
+ {/each} +
-
-
+ +{/if}