Simple API that authenticates users via login:password using SHA-512 crypt ($6$) and returns a decrypted access string.
- GET
/<prefix>/login:password - Server looks up the user in a JSON file
- Verifies the password against the stored SHA-512 crypt hash
- Decrypts the
accessfield using the password (OpenSSL AES-256-CBC) - Returns the decrypted access string as
text/plain
{
"users": [
{
"login": "ivan",
"password": "$6$O0pY1wVZvyPo9g9L$...",
"access": "U2FsdGVkX1+YNcwyHYyz..."
}
]
}| Variable | Default | Description |
|---|---|---|
HOST |
0.0.0.0 |
Listen address |
PORT |
8080 |
Listen port |
PREFIX |
(required) | URL path prefix |
JSON_FILE |
data.json |
Path to JSON file |
go build -o server .
JSON_FILE=data/data.json PREFIX=/api ./serverdocker compose upMount a volume with your data.json to /data/data.json.