Three small follow-ups to the v1.3.3 audit:
- src/lib/auth/__tests__/hmac.test.ts now stubs API_TOKEN_HMAC_KEY via
vi.stubEnv per test instead of mutating process.env in beforeAll, so the
variable is restored cleanly after every case (and worker leaks under
--no-isolate are gone).
- The two native-token issuance tests (password login + passkey login) now
mock hashToken as (raw) => "hashed:" + raw and assert the persisted
tokenHash equals hashToken(plaintext) instead of accepting any string.
Catches a regression where the route would hash the wrong value.
- vitest.config.mts adopts coverage.include for the full src/ tree (the
vitest 4 replacement for coverage.all=true) so untouched files surface
with 0% rather than being silently omitted, and excludes the future
tests/integration/** suite so unit-test runs stay fast.
No production code touched; suite stays at 454 green.
When a request to `/api/auth/login` or `/api/auth/passkey/login-verify`
carries `X-Client-Type: native` (or a `User-Agent` matching `HealthLog-iOS`),
the response now also contains a 90-day `hlk_*` Bearer token alongside
the user object. Browser sessions continue to receive the cookie only —
no extra payload, no behaviour change for them.
Token issuance is gated by header detection in `src/lib/auth/issue-token.ts`
and re-uses the existing `ApiToken` table + HMAC pipeline; nothing new on
the storage side. Audit log records `auth.token.autoissue.native` so each
auto-issued token is traceable to its login event.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Switch defaultLocale from "de" to "en" and make English the code-level
language throughout. All ~145 hardcoded German strings translated:
- API error messages (52 routes) now return English
- Zod validation messages in English
- Classification/analytics functions return English categories
- Notification type labels in English
- Component strings use i18n t() calls (heatmap, mood chart,
medication form, intake history, password strength, insights card)
- ~50 new i18n keys in both de.json and en.json
Route migration:
- /stimmung → /mood, /zielwerte → /targets (new pages)
- 301 redirects in proxy.ts for legacy URLs
- Sidebar + bottom nav updated
Bump version to 1.0.1.
HealthLog — personal health-tracking PWA with weight, blood pressure,
pulse, mood tracking, medication compliance, Withings integration,
doctor report PDF export, and Dracula-themed UI.