Authentication
Bearer tokens you create in the app. Only the SHA-256 hash is stored.
Create and revoke
Signed-in users manage keys in the app under API keys.
GET /api/keyslists id, prefix, name, status, and timestamps. It does not return the secret.POST /api/keyswith{"name":"Claude"}returns the secret once.POST /api/keys/{key_id}/revokesetsrevoked_at. Later calls with that secret are 401.
These routes use the Google session cookie, not the API key. You can hold up to 10 active keys.
Call the API
Send either header:
Authorization: Bearer hm_live_...
X-API-Key: hm_live_...
Use the Authorization form unless a client cannot set it. Do not put the key in a query string.
Storage
API_KEY_BACKEND selects the store.
| Value | Where |
|---|---|
bigquery (default) |
Table {PROJECT_ID}.{DATASET}.api_keys, clustered by key_hash |
memory |
Process memory. Tests and laptops only. Not durable. |
Columns: key_id, key_prefix, key_hash (SHA-256 hex of the full secret), name, owner_email, owner_sub, created_at, revoked_at, last_used_at, rate_limit_per_minute. The raw secret is not a column. The table is created on first use (CREATE TABLE IF NOT EXISTS) and the SQL is also in sql/create_api_keys.sql.
last_used_at is updated at most every 15 minutes.
Google sign-in
The app session is separate. It is a signed cookie, hopmoen_session, from Google OAuth with PKCE. The redirect URI is https://<host>/auth/callback, so app.hopmoen.com must be listed on the OAuth client next to any run.app host. The consent screen name should be Hopmoen.