Expand description
Authentication for the OpenAI-compatible surface.
This module used to carry its own copy of the middleware, the loopback test
and the startup posture check. That copy is gone: dravr-tronc now serves
all three to the whole fleet, and the version there is the one this file’s
design was lifted into. Keeping a second implementation would mean a fix
landing in one and not the other, which is the failure the shared crate
exists to prevent.
What remains is the only part that is genuinely embacle’s: the name of the variable holding the key.
The wire shape is unchanged by the move. Both crates answer a refusal with
{"error":{"type":"authentication_error","message":"…"}} — embacle’s
OpenAI envelope carries param and code as well, but both are None
for an auth error and both are skipped when serialising, so the bytes a
client sees are the same.
Structs§
- Insecure
Bind Error - A server was asked to serve a reachable interface with no key.
Enums§
- Auth
Mode - The authentication posture a server resolved at startup.
Functions§
- api_
key_ configured - Whether a usable key is configured.
- require_
auth - Validate the bearer token against
EMBACLE_API_KEY. - resolve_
startup_ auth - Resolve the startup posture for a bind, or refuse it.