abstimm-idD/README.md

120 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

2020-10-20 14:10:57 +02:00
# Abstimm-ID Daemon
Abstimm-ID Daemon - Dienst zum Erstellen und Abfragen von Abstimm-IDs (https://git.netzbegruenung.de/NB-Public/abstimm-id).
2020-10-20 13:33:03 +02:00
2020-10-29 20:32:50 +01:00
Daemon for retrieving Argon2 hashes for user vote result lists. The program also comes with a result list sigining and publication function.
2020-10-20 14:19:28 +02:00
2020-11-05 11:51:33 +01:00
2020-10-20 14:19:28 +02:00
# API definition
2020-11-05 11:51:33 +01:00
## Register event
Creates an event for which hashes can be generated and retrieved. The event token should be regarded a secret. We use a UUID for the token.
### Request Headers (endpoint requires SSL client certificate)
2020-10-20 14:10:57 +02:00
```http
2020-11-05 11:51:33 +01:00
POST /register_event HTTP/1.1
2020-10-20 14:10:57 +02:00
Host: abstimmidd.netzbegruenung.de
Content-Type: application/json
```
2020-11-05 11:51:33 +01:00
### Request Body
2020-10-20 14:10:57 +02:00
```javascript
{
2020-11-05 11:51:33 +01:00
"event_token": String // Secret event token to identify event
2020-10-20 14:10:57 +02:00
}
```
2020-11-05 11:51:33 +01:00
### Response
2020-10-20 14:10:57 +02:00
```javascript
2020-11-05 11:51:33 +01:00
{
"success": Boolean // If the registration of the event was successful
}
2020-10-20 14:10:57 +02:00
```
2020-11-05 11:51:33 +01:00
## Get vote ID
Retrieve hashes / vote IDs for a list of user names and a known event. If the hashes don't exist yet, they will be generated on-the-fly.
### Request Headers (endpoint requires SSL client certificate)
2020-10-27 20:23:57 +01:00
```http
2020-11-05 11:51:33 +01:00
POST /get_ids HTTP/1.1
2020-10-27 20:23:57 +01:00
Host: abstimmidd.netzbegruenung.de
Content-Type: application/json
```
2020-11-05 11:51:33 +01:00
### Request Body
2020-10-27 20:23:57 +01:00
```javascript
{
2020-11-05 11:51:33 +01:00
"event_token": String, // Secret event token to identify event
"round": Number, // nth vote round
"user_names": [ // User names for which the hash should be retrieved
String,
[...] // Repeated for all users for which the hash is needed
]
2020-10-27 20:23:57 +01:00
}
```
2020-11-05 11:51:33 +01:00
### Response
2020-10-27 20:23:57 +01:00
```javascript
2020-11-05 11:51:33 +01:00
[
{
"round": Number, // nth vote round
"user_name": String, // Name of a user
"hash": String // Argon2 hash of user with round in the salt
},
[...] // Repeated for all users listed in request
]
2020-10-29 13:45:39 +01:00
```
2020-11-05 11:51:33 +01:00
2020-10-29 13:45:39 +01:00
## Create result export
2020-11-05 11:51:33 +01:00
Create vote result files to allow for validation the results. The files can be synchronized to a remote location for publication. Currently implemented are TXT and PDF files. The SHA256 hashes of the files and the signing key ID are returned.
### Request Headers (endpoint requires SSL client certificate)
2020-10-29 13:45:39 +01:00
```http
POST /export_result HTTP/1.1
Host: abstimmidd.netzbegruenung.de
Content-Type: application/json
```
2020-11-05 11:51:33 +01:00
### Request Body
2020-10-29 13:45:39 +01:00
```javascript
{
2020-11-05 11:51:33 +01:00
"event_token": String, // Secret event token to identify event
"event_title": String, // Used in export file name
"vote_round": Number, // nth vote round
2020-10-29 13:45:39 +01:00
"votes": [
2020-11-05 11:51:33 +01:00
{
"hash": String,
"vote": [
String, // Description of vote (against, for, abstinence, name of nominee, etc)
[...] // Repeated if multiple votes are possible
2020-10-29 13:45:39 +01:00
]
},
2020-11-05 11:51:33 +01:00
[...] // Repeated for each voter
2020-10-29 13:45:39 +01:00
]
}
```
2020-11-05 11:51:33 +01:00
### Response
2020-10-29 13:45:39 +01:00
```javascript
{
2020-11-05 11:51:33 +01:00
"success": Boolean, // Registration of event was successful
"hash_txt": String, // SHA256 hash of generated TXT file
"hash_pdf": String, // SHA256 hash of generated PDF file
"signing_key": String // ID of key used to sign result file
2020-10-29 13:45:39 +01:00
}
2020-10-27 20:23:57 +01:00
```
2020-11-05 11:51:33 +01:00
2020-10-28 17:34:35 +01:00
# Pre-generate vote IDs
For large events with many votes, generating the vote IDs takes a long time. `generate_hashes.sh` helps to generate a large amount of hashes in advance, chunked in many smaller requests.
2020-11-05 11:51:33 +01:00
The script uses the following parameters:
`./generate_hashes.sh FILE_USERNAMES EVENT_ID VOTING_ROUNDS`.
- `FILE_USERNAMES` is the path to a text file containing the names of voters, one name per line.
- `EVENT_ID` is the already existing token of an event.
- `VOTING_ROUNDS` is the maximum number of expected voting rounds. To be sure, generate IDs for more rounds than expected.
2020-10-28 17:34:35 +01:00
The script expects the client key and certificate to be located in the same directory and to be named `client.key` and `client.crt`. Edit the script, if you need to change this. Also, the host URL is set in a variable within the script.
2020-10-28 17:36:14 +01:00
If there are huge amounts of hashes that need to be generated, split the files with user names into smaller files, and run the script in parallel.