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 059a7932..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 @@ -247,15 +255,4 @@ /> {/if} - - -
- Monitoring {selectedEVaults.length} eVault{selectedEVaults.length !== 1 - ? 's' - : ''} and {selectedPlatforms.length} platform{selectedPlatforms.length !== 1 - ? 's' - : ''} -
- {#if currentFlowStep > 0} -