System Online · Signal Nominal
Operator Lvl · 03XP 1,240
O
Command CenterBUILD AI Lab
LiveAutosaved · just now
Refactor auth middleware
v3 · draft
System
Prompt
{{ file }}{{ style }}
Output · streaming
418 tokens·1.2s
--- a/src/server/auth.ts
+++ b/src/server/auth.ts
@@
-export function withAuth(handler) {
-  return async (req, res) => {
-    if (!req.headers.authorization) return res.status(401).end();
-    ...
-  }
-}
+export const requireAuth = createMiddleware(async (ctx) => {
+  const token = readBearer(ctx.request)
+  if (!token) throw new HttpError(401, "Missing bearer")
+  ctx.user = await verify(token)
+})
Live Signal
OPERATORS·2,847 onlineMB-018·Enterprise Ops · 62 shippingAI LAB·12,481 prompts run todayBROADCAST·Live Build · Wed 8pm ETASSETS·24 new UI kits syncedROADMAP·AI Voice CRM · 219 votesARCHIVE·Field Notes: RLS patterns updatedSTREAK·You · 12 day build streakOPERATORS·2,847 onlineMB-018·Enterprise Ops · 62 shippingAI LAB·12,481 prompts run todayBROADCAST·Live Build · Wed 8pm ETASSETS·24 new UI kits syncedROADMAP·AI Voice CRM · 219 votesARCHIVE·Field Notes: RLS patterns updatedSTREAK·You · 12 day build streak