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 } }