Skip to content

docs(readme): fix quickstart demo API key to match server hashing#100

Merged
marevol merged 1 commit into
mainfrom
docs/quickstart-demo-api-key
May 17, 2026
Merged

docs(readme): fix quickstart demo API key to match server hashing#100
marevol merged 1 commit into
mainfrom
docs/quickstart-demo-api-key

Conversation

@marevol

@marevol marevol commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

The quickstart in README.md shipped a demo X-API-Key that the server rejects unconditionally, so following the quickstart end-to-end always failed with {"detail":"Invalid API key","code":"invalid_api_key"}. This patches the demo plaintext and hash so the example works as written.

Changes Made

  • README.md: replace RECOTEM_API_PLAINTEXT="recotem-quickstart" (18 chars) with recotem-quickstart-demo-key-0000 (32 chars), meeting _API_KEY_MIN_LEN = 32 enforced in src/recotem/serving/auth.py.
  • README.md: replace the RECOTEM_API_KEYS digest with the correct scrypt(N=2, r=8, p=1, dklen=32, salt=b"recotem.api-key.v1") hex of the new plaintext (21be5c3b…f125). The previous value was a plain sha256() of the old plaintext, which never matches what recotem.serving.auth._hash_api_key computes — the sha256: token on the wire is a digest-family label, not the algorithm name.

Testing

  • Re-derived the digest via recotem.serving.auth._hash_api_key("recotem-quickstart-demo-key-0000") and confirmed it equals the new README value byte-for-byte.
  • Length check: len("recotem-quickstart-demo-key-0000") == 32, so the _API_KEY_MIN_LEN guard no longer rejects it.

Breaking Changes

None — README-only documentation fix. Operators following the quickstart will set new env values, but no code, schema, or wire format changed.

Additional Notes

  • This regression was introduced by docs(readme): use demo keys in quickstart to remove keygen step #95 (docs(readme): use demo keys in quickstart to remove keygen step), which precomputed the hash with the wrong algorithm and a too-short plaintext.
  • The new demo plaintext is still obviously a demo (…-demo-key-0000); the existing "DEMO ONLY — for production, generate fresh keys" warning above it is unchanged.

The plaintext (`recotem-quickstart`, 18 chars) was below
`_API_KEY_MIN_LEN = 32`, and the published hash was a plain
sha256 instead of the scrypt KDF the server actually uses, so the
quickstart `curl /predict/...` always returned `invalid_api_key`.

Replace with a 32-char plaintext and the matching
`scrypt(N=2, r=8, p=1, salt=b"recotem.api-key.v1")` hex digest.
@marevol marevol merged commit 9444999 into main May 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant