diff --git a/package.json b/package.json index b67918e..8a5d2ec 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@fastify/cors": "^8.5.0", "@fastify/passport": "^2.4.0", "@fastify/reply-from": "^9.7.0", - "@fastify/secure-session": "^7.3.0", + "@fastify/secure-session": "^7.5.1", "@sentry/node": "^7.76.0", "axios": "^1.6.0", "date-fns": "^2.30.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9002602..24adb70 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ dependencies: specifier: ^9.7.0 version: 9.7.0 '@fastify/secure-session': - specifier: ^7.3.0 - version: 7.3.0 + specifier: ^7.5.1 + version: 7.5.1 '@sentry/node': specifier: ^7.76.0 version: 7.76.0 @@ -402,8 +402,8 @@ packages: undici: 5.28.4 dev: false - /@fastify/secure-session@7.3.0: - resolution: {integrity: sha512-9d7CMZ2OrOVsrWtkCf60weyfhQcscrnboUdnETMAAhEyUXrZtO66Zu99DH/g/VfGW1mUU5tKHq7jCkm+itvDWA==} + /@fastify/secure-session@7.5.1: + resolution: {integrity: sha512-3xnTmlI4rhboyLtXtGDnrAXz8MLbrkwn9Owo4CZ2/GC9H3Eux0D5QWwKowxmn4VaFadj2wC67RoycFFi/46xaw==} hasBin: true dependencies: '@fastify/cookie': 9.1.0 diff --git a/src/index.ts b/src/index.ts index 4b6bc30..d165148 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,13 +29,17 @@ const app = Fastify({ logger: true, }); +const SESSION_DURATION = 365 * 24 * 60 * 60; + app.register(secureSession, { key: process.env.NODE_ENV === "development" ? fs.readFileSync(path.join(__dirname, "../.secret-key.development")) : fs.readFileSync(path.join(__dirname, "../secret-key")), + expiry: SESSION_DURATION, cookie: { path: "/", + maxAge: SESSION_DURATION, }, }); app.register(cors, {