/
create-databases.sh
executable file
·39 lines (24 loc) · 1.03 KB
/
create-databases.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Create databases
# Authority Public Key database
curl -X PUT http://localhost:5984/authority_public_key
# Voters Public Keys database
curl -X PUT http://localhost:5984/voters_public_keys
# Candidates List database
curl -X PUT http://localhost:5984/candidates_list
# Ballots database
curl -X PUT http://localhost:5984/ballots
# Multiplied Ballots database
curl -X PUT http://localhost:5984/multiplied_ballots
# Dummy Share database
curl -X PUT http://localhost:5984/dummy_share
# Partial Decryptions database
curl -X PUT http://localhost:5984/partial_decryptions
# Result of the Election database
curl -X PUT http://localhost:5984/election_result
# Create users
# Create user:admin pass:admin
curl -X PUT http://localhost:5984/_config/admins/admin -d '"admin"'
# Create views
# Create view to retrieve the ballots associated with a voter id
curl -X PUT http://localhost:5984/ballots/_design/query/ -d '{"language":"javascript", "views": { "ballot": { "map" : "function(doc) {\n emit(doc.voter_id, doc.encrypted_vote);\n}"}}}'