From b8ac6ee5156815b6367b4974369be7d08b98936d Mon Sep 17 00:00:00 2001 From: NixReaper Date: Sun, 5 Apr 2026 12:13:06 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20server=20TS=20errors=20?= =?UTF-8?q?=E2=80=94=20jwt=20type=20augmentation,=20sign=20options,=20serv?= =?UTF-8?q?ices=20import=20bump=20version=20to=200.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/routes/auth/index.ts | 7 +++---- server/src/routes/nixserver/services.ts | 2 +- server/src/types/index.ts | 9 +++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/src/routes/auth/index.ts b/server/src/routes/auth/index.ts index 048e2e0..0596144 100644 --- a/server/src/routes/auth/index.ts +++ b/server/src/routes/auth/index.ts @@ -28,7 +28,7 @@ function signTokens( const refreshToken = fastify.jwt.sign( { ...payload, type: 'refresh' }, - { secret: config.jwt.refreshSecret, expiresIn: config.jwt.refreshExpiresIn } + { expiresIn: config.jwt.refreshExpiresIn } ) return { accessToken, refreshToken } @@ -157,8 +157,7 @@ export default async function authRoutes(fastify: FastifyInstance) { let payload: JwtPayload & { type?: string } try { payload = fastify.jwt.verify( - body.data.refreshToken, - { secret: config.jwt.refreshSecret } + body.data.refreshToken ) } catch { return reply.code(401).send({ success: false, error: 'Invalid or expired refresh token' }) @@ -183,7 +182,7 @@ export default async function authRoutes(fastify: FastifyInstance) { const accessToken = fastify.jwt.sign(newPayload, { expiresIn: config.jwt.expiresIn }) const newRefresh = fastify.jwt.sign( { ...newPayload, type: 'refresh' }, - { secret: config.jwt.refreshSecret, expiresIn: config.jwt.refreshExpiresIn } + { expiresIn: config.jwt.refreshExpiresIn } ) const expiresAt = new Date() diff --git a/server/src/routes/nixserver/services.ts b/server/src/routes/nixserver/services.ts index 9fca6c5..eaaf5f3 100644 --- a/server/src/routes/nixserver/services.ts +++ b/server/src/routes/nixserver/services.ts @@ -1,7 +1,7 @@ import type { FastifyInstance } from 'fastify' import { z } from 'zod' import { requireAdmin } from '../../middleware/auth.js' -import { exec, MANAGED_SERVICES as _ } from '../../core/exec.js' +import { exec } from '../../core/exec.js' import { getServiceStatus, MANAGED_SERVICES } from '../../core/system.js' const ServiceActionSchema = z.object({ diff --git a/server/src/types/index.ts b/server/src/types/index.ts index 0184e4b..90ed03f 100644 --- a/server/src/types/index.ts +++ b/server/src/types/index.ts @@ -10,11 +10,12 @@ export interface JwtPayload { exp?: number } -// ─── Fastify type augmentation ──────────────────────────────────────────────── +// ─── @fastify/jwt type augmentation ─────────────────────────────────────────── -declare module 'fastify' { - interface FastifyRequest { - user?: JwtPayload +declare module '@fastify/jwt' { + interface FastifyJWT { + payload: JwtPayload + user: JwtPayload } }