File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 3333 });
3434
3535 function maybeUpdateSummary() {
36- ballotSummary = shouldSummarize ? (async () => {
36+ ballotSummary = shouldSummarize && ballot ? (async () => {
3737 // Lazy-loading as the summary is only a nice-to-have.
3838 const { getSummarizedBallot } = await import (" ./ballotSummary.ts" );
3939 return getSummarizedBallot (ballot );
4343 encryptDataPromise = (async () => {
4444 const { encryptedSecret, saltedCiphertext } = await encryptData (
4545 textEncoder .encode (ballotContent ) as Uint8Array ,
46- await fetchedPublicKey
46+ await publicKey
4747 );
4848 return JSON .stringify ({
4949 encryptedSecret: uint8ArrayToBase64 (new Uint8Array (encryptedSecret )),
Original file line number Diff line number Diff line change 3131 {#await fetchedPublicKey }
3232 <button type =" submit" disabled >Loading public key…</button >
3333 {:then }
34- <button type =" submit" >Encrypt ballot </button >
34+ <button type =" submit" >Next </button >
3535 {/await }
3636 </form >
3737{:catch error }
Original file line number Diff line number Diff line change 66
77export function getSummarizedBallot ( ballotStr : string ) {
88 const ballot = yaml . load ( ballotStr ) as { preferences : Array < { title : string , score : number } > } ;
9+ if ( ! Array . isArray ( ballot ?. preferences ) ) {
10+ throw new Error ( 'Ballot does not contain a list of preferences' ) ;
11+ }
912 return summarizeCondorcetBallotForVoter (
1013 _getSummarizedBallot ( {
1114 voter : { } ,
You can’t perform that action at this time.
0 commit comments