Commit Graph

181 Commits

Author SHA1 Message Date
7287f10c9a feat: migrate Nessa auth to Clerk session tokens (task 03)
- src/server/nessa-auth.ts: replace jose HS256 sign/verify with Clerk
  session JWT verification via @clerk/backend verifyToken (RS256/JWKS).
  signNessaToken removed — frontend now supplies Clerk session tokens.
- src/server/api/utils.ts: createTRPCContext verifies Clerk JWT, resolves
  ctx.nessaUserId via SELECT id FROM users WHERE clerkUserId=? on the
  shared NessaConnectionFactory. Lookup miss throws typed UNAUTHORIZED
  (webhook has not run yet). Invalid/expired tokens are swallowed; the
  enforceNessaUser middleware rejects null nessaUserId.
- src/server/api/routers/nessa-community-authz.test.ts: add clerkUserId
  lookup tests (seeded match, missing row, mismatched id, local≠clerk).
- src/server/nessa-auth.test.ts: verifyNessaToken unit tests with mocked
  @clerk/backend (valid sub, missing sub, malformed/expired/wrong-signature
  rejection) plus static audit that signNessaToken is gone.
- src/server/clerk-user-webhook.ts + src/routes/api/clerk-webhook.ts:
  Clerk user.created/user.updated webhook handler (Svix signature
  verification, idempotent upsert by clerkUserId, lazy ALTER TABLE
  migration) with full test suite.
- src/server/api/routers/nessa.ts: remove legacy register/login/google/
  apple sign-in mutations (Clerk is now the sole identity provider).
- src/env/server.ts: add NESSA_CLERK_SECRET, NESSA_CLERK_JWT_ISSUER,
  NESSA_CLERK_WEBHOOK_SECRET; NESSA_JWT_SECRET moved to optional.
- package.json: add @clerk/backend, svix; lineage/auth.test.ts and
  nessa-ownership.test.ts: add Clerk env vars to env mocks.
- .env.example: document Clerk config vars and rotation.
- delete nessa-google-oauth.test.ts (Google auth removed).

ctx.nessaUserId remains the local users.id — router bodies are untouched.
2026-07-23 01:40:53 -04:00
52174c94dc lineage analytics 2026-07-13 13:26:08 -04:00
30b2d03c68 cleanup 2026-05-28 20:22:30 -04:00
d48bbc0fc3 security cleanup, fix turnstile 2026-05-28 16:48:06 -04:00
b7187721db reference fixes 2026-05-28 13:59:46 -04:00
fbc8215410 turnstile added 2026-05-28 10:24:23 -04:00
8b6551330f input halo sections, sparkle handling 2026-04-30 06:38:54 -04:00
67bf77815e mermaid loading improved 2026-04-03 14:07:42 -04:00
6a6feade42 update gaze links 2026-03-27 06:59:26 -04:00
1a60e606de update min version 2026-03-02 13:18:06 -05:00
40411104d6 gaze pp 2026-02-10 01:06:57 -05:00
c6e9fccc9a marketing page 2026-02-09 19:53:50 -05:00
80daaa29dc quick fix 2026-02-02 15:24:28 -05:00
3845c768e2 blog data fixed 2026-01-21 14:04:04 -05:00
955c856a85 fix: analytics and deprecated warning 2026-01-21 13:58:34 -05:00
7b60494d6d fix: duplication error 2026-01-21 12:57:58 -05:00
58d48dac70 checkpoint 2026-01-21 12:22:19 -05:00
5fc082178c cairn work 2026-01-21 01:56:54 -05:00
962456985b fix: layouting fix 2026-01-14 10:35:35 -05:00
b612d12a51 general: for consistency 2026-01-13 10:49:47 -05:00
e035f3ddc3 general: mostly logs 2026-01-12 10:34:54 -05:00
f68f1f462a session state simplification 2026-01-12 09:24:58 -05:00
55b914cb40 general: min deployment note, seal 2026-01-11 22:11:56 -05:00
b81a3a69d2 fix: needed for sparkle 2026-01-11 20:37:50 -05:00
99e5323871 fix: should fix issues with login/session handling 2026-01-11 20:18:01 -05:00
9cccd0c6b3 feat: auto-update signaler for Gaze 2026-01-11 17:43:04 -05:00
df56a5ede8 fix: button size no longer changes on loading. locking for dl buttons 2026-01-11 14:08:05 -05:00
c8c1b754b1 downloads fix 2026-01-11 13:40:43 -05:00
1fb8f45705 fix: session validation fixes 2026-01-11 11:23:32 -05:00
842a6075f9 remove disabled conditions 2026-01-07 22:36:17 -05:00
8f241ce611 adjust email/pass addition flow, blog ttl extended 2026-01-07 21:21:27 -05:00
ca28237d13 hopefully this solves random hanging 2026-01-07 20:53:21 -05:00
f056cf05d3 hopeful 2026-01-07 20:19:26 -05:00
244c8b6fb5 callback change 2026-01-07 18:53:41 -05:00
1b3c832fc3 change template loading 2026-01-07 18:17:58 -05:00
0810498b13 fixed 2026-01-07 18:08:48 -05:00
6a934880f9 mostly working 2026-01-07 17:53:21 -05:00
5b0f6dba0f fixing things 2026-01-07 16:50:10 -05:00
0a0c0e313e migrated 2026-01-07 16:22:31 -05:00
041b2f8dc2 oof 2026-01-07 14:37:40 -05:00
5e247e54cb fix rate limit async issue, kill old code 2026-01-06 23:52:51 -05:00
445ab6d7de auth querying consolidation 2026-01-06 23:26:51 -05:00
08a9ad35af updating auth token security 2026-01-06 23:11:19 -05:00
4dd3a44711 remove help 2026-01-06 19:59:44 -05:00
dec4162baf continued cleanup 2026-01-06 18:18:04 -05:00
aedcacaa57 clean up 401, simplify terminal error page 2026-01-06 17:57:58 -05:00
b981f953d6 coundown fixed 2026-01-06 14:19:39 -05:00
374c924119 form feedback consolidation 2026-01-06 14:00:22 -05:00
a11f1fee50 consolidation 2026-01-06 13:51:47 -05:00
b81c73a6bc simplifying 2026-01-06 11:13:49 -05:00