mirror of
https://github.com/siv-org/siv.git
synced 2026-01-09 10:27:57 -05:00
/api/malware-check/download: Remove unnecessary typing
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { CipherStrings } from 'src/crypto/stringify-shuffle'
|
|
||||||
|
|
||||||
import { firebase, pushover } from '../_services'
|
import { firebase, pushover } from '../_services'
|
||||||
|
|
||||||
@@ -34,9 +33,7 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
// Fetch encrypted vote from database
|
// Fetch encrypted vote from database
|
||||||
const votes = await electionDoc.collection('votes').where('auth', '==', auth_token).get()
|
const votes = await electionDoc.collection('votes').where('auth', '==', auth_token).get()
|
||||||
if (votes.empty) return res.status(404).json({ error: 'Vote not found' })
|
if (votes.empty) return res.status(404).json({ error: 'Vote not found' })
|
||||||
|
|
||||||
const storedVote = votes.docs[0].data()
|
const storedVote = votes.docs[0].data()
|
||||||
const storedEncryptedVote = storedVote.encrypted_vote as Record<string, CipherStrings>
|
|
||||||
|
|
||||||
// Update the specific check entry
|
// Update the specific check entry
|
||||||
const updatedChecks = data.checks.map((entry: { already_seen_device?: null | string; otp?: string }) => {
|
const updatedChecks = data.checks.map((entry: { already_seen_device?: null | string; otp?: string }) => {
|
||||||
@@ -56,7 +53,7 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
encrypted_randomizers: checkEntry.encrypted_randomizers,
|
encrypted_randomizers: checkEntry.encrypted_randomizers,
|
||||||
encrypted_vote: storedEncryptedVote,
|
encrypted_vote: storedVote.encrypted_vote,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user