Add API token auth system for headless/micro clients
Backend:
- navi/auth/_ddl.py: add api_tokens table with boot-time migration
- navi/auth/deps.py: _resolve_user now falls back to X-Api-Token header
  and ?api_token query param for WebSocket auth
- navi/auth/__init__.py: add ApiToken pydantic model
- navi/api/routes/api_tokens.py: CRUD endpoints (POST/GET/DELETE)
- navi/main.py: wire api_tokens router

Frontend:
- webclient/src/App.vue: add #settings hash routing
- webclient/src/components/settings/: SettingsView, ApiKeysPanel,
  CreateKeyModal with copy-to-clipboard flow
- webclient/src/api/index.js: token CRUD API functions
- webclient/src/stores/apiTokens.js: Pinia store
- webclient/src/components/sidebar/AppSidebar.vue: settings link
- webclient/src/composables/useWebSocket.js: append ?api_token= when
  localStorage token is present

Tests:
- tests/unit/auth/test_api_tokens.py: 10 unit tests covering token
  resolution (header + query param), revoke, missing/revoked tokens,
  orphan users, and CRUD endpoints

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent cd4e5d0 commit 5de0d334c31549c1ad1f32e0e1023583c97f85fe
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored on 24 May
Showing 19 changed files
View
navi/api/routes/api_tokens.py 0 → 100644
View
navi/auth/__init__.py
View
navi/auth/_ddl.py
View
navi/auth/deps.py
View
navi/main.py
View
tests/unit/auth/test_api_tokens.py 0 → 100644
View
webclient/dist/assets/index-BLRp95NP.js 0 → 100644
Not supported
View
webclient/dist/assets/index-BPcN01j5.js 100644 → 0
Not supported
View
webclient/dist/assets/index-CWzYkHtH.css 100644 → 0
View
webclient/dist/assets/index-Wyt5c1oU.css 0 → 100644
View
webclient/dist/index.html
View
webclient/src/App.vue
View
webclient/src/api/index.js
View
webclient/src/components/settings/ApiKeysPanel.vue 0 → 100644
View
webclient/src/components/settings/CreateKeyModal.vue 0 → 100644
View
webclient/src/components/settings/SettingsView.vue 0 → 100644
View
webclient/src/components/sidebar/AppSidebar.vue
View
webclient/src/composables/useWebSocket.js
View
webclient/src/stores/apiTokens.js 0 → 100644