Mid orbitPOST JSON, HMAC-SHA256 signatures, nonces, ordered workflowAPI

A4: Signed Docking

A supply shuttle loaded with wrapping paper is holding off the workshop's main hatch, and the docking computer won't open up for anyone who can't prove who they are. You have a personal docking key. To dock, you ask the hatch for a nonce, sign it with your key, and send the signature back before the nonce expires.

Send Authorization: Bearer YOUR_TOKEN with every request (401 without it). Errors are JSON {"error": "...", "detail": "..."}. On 429, wait Retry-After seconds before retrying.

GET https://outcoded.orimovo.co.uk/api/v1/orbit/A4/dock/key returns your docking key as a hex string. Use the string itself (its ASCII characters) as the HMAC key; don't hex-decode it.

{"key": "9b1f0c2ad4e8..."}

GET https://outcoded.orimovo.co.uk/api/v1/orbit/A4/dock/challenge issues a nonce for the main hatch. It is valid for 5 seconds, and only once. expiresAt is in milliseconds since the Unix epoch:

{"nonce": "n-4c7d1e09ab32f5d6c810", "expiresAt": 1796115600000, "ttl": 5}

POST https://outcoded.orimovo.co.uk/api/v1/orbit/A4/dock with a JSON body {"nonce": "...", "signature": "..."}, where signature is the lower-case hex HMAC-SHA256 of the nonce string, keyed with your docking key:

curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" \
  -d '{"nonce": "n-4c7d1e09ab32f5d6c810", "signature": "e3b0c442..."}' https://outcoded.orimovo.co.uk/api/v1/orbit/A4/dock

{"docked": true, "hatchCode": "QWERTYUI"}

Errors:

  • 400 bad_body: the body isn't a JSON object.
  • 422 missing_fields or bad_signature_format: a field is missing, or the signature isn't 64 hex characters.
  • 409 unknown_nonce, nonce_used, wrong_nonce or nonce_expired: get a fresh nonce. Nonces are held in memory, so one may also be forgotten if the station restarts.
  • 422 bad_signature: the signature is wrong. The nonce is used up either way.

What is the hatchCode?