Commit Graph

28 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
4dbd0ac965 (sidebar)forget redis, better parallization 2026-04-06 13:32:46 -04:00
f056cf05d3 hopeful 2026-01-07 20:19:26 -05:00
041b2f8dc2 oof 2026-01-07 14:37:40 -05:00
ea556b3677 fledged out analytics, self gather, remove vercel speed insights 2026-01-06 01:34:55 -05:00
a620a9f4c5 perf improvements 2026-01-04 14:53:30 -05:00
4b78aef5a5 Add performance testing infrastructure 2026-01-04 11:37:47 -05:00
cb33f36377 removed old stuff 2026-01-03 09:56:16 -05:00
1ba20339a8 security hardening 2025-12-28 20:04:29 -05:00
85f3caa67d fix for pdf not loading - seemed to be Orion only(but i use that so) 2025-12-27 21:43:10 -05:00
53a4ae1a43 oh baby boy 2025-12-26 13:41:50 -05:00
76ad636c90 fix some bs 2025-12-22 23:27:41 -05:00
281654081d references and spinner fixes 2025-12-22 01:18:49 -05:00
2a1e1196c7 some styling issues, but it works 2025-12-21 10:07:39 -05:00
291971a1d7 collapsables 2025-12-21 00:43:42 -05:00
72bf84d7b0 task items 2025-12-21 00:35:14 -05:00
9007aa00ea table 2025-12-21 00:20:51 -05:00
e9a2b00254 remove temp debounce 2025-12-20 13:34:18 -05:00
803d49d7fc nvm not necessary 2025-12-19 19:36:21 -05:00
70870c3448 speed-insights 2025-12-19 18:14:57 -05:00
0459c9536c migrated editing client 2025-12-19 12:54:03 -05:00
324141441b better initial load 2025-12-19 11:48:00 -05:00
4b64f50670 looking decent 2025-12-17 23:22:12 -05:00
1bc57c61eb migration of comments 2025-12-17 22:47:19 -05:00
e02476b207 starting refinement 2025-12-17 13:51:13 -05:00
7479378dd1 most done, outside the blog 2025-12-17 01:11:14 -05:00
b3df3eedd2 continued migration 2025-12-16 23:31:12 -05:00
8fb748f401 init 2025-12-16 22:42:05 -05:00