Commit feecd20
Add GitHub + Google OAuth login with encrypted API key storage
Implement NextAuth.js v5 authentication with GitHub and Google OAuth
providers, backed by Drizzle ORM adapter storing users/accounts in the
existing PostgreSQL database. Logged-in users can save their Anthropic
API key and GitHub PAT encrypted (AES-256-GCM) in the database instead
of localStorage, so keys persist across devices and sessions. Non-logged-in
users retain the existing localStorage flow unchanged.
- Add users, accounts, sessions, verification_tokens tables to schema
- Create auth config with JWT session strategy and Drizzle adapter
- Add AES-256-GCM encryption utilities for API key storage
- Add server actions for saving/loading/clearing encrypted keys
- Add Sign In button with avatar dropdown in header
- Update API key and Private Repos dialogs for dual-mode storage
- Update useDiagram hook to prefer DB-stored keys when logged in
- Add identity rewrite in next.config.js to prevent /api/auth/* proxying
- Add SessionProvider to app providers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 5b8e017 commit feecd20
18 files changed
Lines changed: 1294 additions & 46 deletions
File tree
- diagrams
- src
- app
- _actions
- api/auth/[...nextauth]
- components
- ui
- hooks
- lib
- server/db
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
0 commit comments