SLKVS

A Redis-backed key-value store for the reckless and the careful alike.

SLKVS stores values under compound keys of the form kvs_{realm}__{key}. Every operation requires a realm and a key. Optional secure marking protects keys from unauthorised writes.

GET /api?method=get&realm=…&key=…

Retrieves the value for a given realm and key. Returns the raw value on success, or a 404 JSON error if the key does not exist.

Request
curl https://host/api?method=get&realm=production&key=db_url
Response — 200 OK
postgres://user:pass@primary:5432/slkvs
Response — 404 Not Found
{ "error": "Key not found" }
POST /api

Stores a value. If the key has been marked secure, a matching secret must be provided; otherwise the request is rejected with 403.

Request
curl https://host/api \
-X POST \
-H "Content-Type: application/json" \
-d '{ "method": "set", "realm": "staging", "key": "api_key", "value": "sk-abc123" }'
Response
{ "success": true }
POST /api

Deletes a key and its associated security metadata. Like set, this requires the secret if the key is marked secure.

Request
curl https://host/api \
-X POST \
-H "Content-Type: application/json" \
-d '{ "method": "remove", "realm": "staging", "key": "api_key" }'
Response
{ "success": true }
POST /api

Marks a key as secure. Once marked, every set or remove call must include the correct secret. The secret is hashed with bcrypt before storage — SLKVS never stores plaintext secrets. Getting a value never requires a secret.

Request
curl https://host/api \
-X POST \
-H "Content-Type: application/json" \
-d '{ "method": "setsecure", "realm": "production", "key": "db_url", "secret": "hunter2" }'
Response
{ "success": true }

Parameters

NameRequiredDescription
methodalwaysOne of get, set, remove, setsecure
realmalwaysNamespace / partition for keys
keyalwaysThe key name within the realm
valuesetValue to store (string)
secretsetsecure / secure opsSecret for marking or accessing a secure key

Notes