Skip to main content
Every request to Parmana carries an API key in the header Authorization: Bearer <key>. The deployment stores only the SHA-256 hash of each key, in parmana-local/api-keys.json. Manage that file with docker/local/api-keys.mjs, never by hand: the script checks every change with the same rules the server uses, so it never saves a file the server would refuse to start with. All commands run from the repository root. On Windows in Git Bash, run export MSYS_NO_PATHCONV=1 first.
The server reads the keys only when it starts. After every add or remove, run docker compose restart api.

List keys

Example output:
It never prints a key or a hash.

Add a key

The command prints the new key once, on the line that starts with pk_local_:
It cannot be shown again. Give it to its holder through your secret store.

Examples

A service that sends refund requests:
A person who proposes policy changes:
A person who approves policy changes. They first make a step up key pair on their own machine and send you only the public key, as described in Approve a policy:

Rotate a key

  1. Add a second key for the same caller ID, with the same options as the first:
    Both keys now work.
  2. Give the holder the new key and wait until they use it.
  3. Remove every older key of that caller ID, keeping the one added last:
Check: the old key now gets 401 and the new key 200 from GET /callers/me.

Remove a key

It removes every key of that caller ID. Add --keep-newest to keep the key added last, as in a rotation. It refuses to remove the last key in the file, because the server cannot start without one.

Errors