Skip to content

Commit

Permalink
api: add encrypted package on /votes/:voteID
Browse files Browse the repository at this point in the history
Signed-off-by: p4u <[email protected]>
  • Loading branch information
p4u committed May 8, 2024
1 parent 695f88b commit 187dcb1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ func (a *API) getVoteHandler(_ *apirest.APIdata, ctx *httprouter.HTTPContext) er
// If VotePackage is valid JSON, it's not encrypted, so we can include it.
if json.Valid(voteData.VotePackage) {
vote.VotePackage = voteData.VotePackage
} else {
evp, err := json.Marshal(map[string][]byte{"encrypted": voteData.VotePackage})
if err != nil {
return err
}
vote.VotePackage = evp
}

var data []byte
Expand Down

0 comments on commit 187dcb1

Please sign in to comment.