From aedeb2f47fdb24dd4c9bc3c2786d82bfe94f6207 Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 11 Apr 2026 07:43:07 -0500 Subject: [PATCH] Change default invite TTL from 10 minutes to 72 hours The company invite expiration was set to 10 minutes which was far too short for practical use. Updated to 72 hours to match the bootstrap invite script and give users adequate time to accept invitations. Co-Authored-By: Paperclip --- server/src/__tests__/invite-expiry.test.ts | 4 ++-- server/src/routes/access.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/__tests__/invite-expiry.test.ts b/server/src/__tests__/invite-expiry.test.ts index c84a2a95572..66a7e7d2808 100644 --- a/server/src/__tests__/invite-expiry.test.ts +++ b/server/src/__tests__/invite-expiry.test.ts @@ -2,9 +2,9 @@ import { describe, expect, it } from "vitest"; import { companyInviteExpiresAt } from "../routes/access.js"; describe("companyInviteExpiresAt", () => { - it("sets invite expiration to 10 minutes after invite creation time", () => { + it("sets invite expiration to 72 hours after invite creation time", () => { const createdAtMs = Date.parse("2026-03-06T00:00:00.000Z"); const expiresAt = companyInviteExpiresAt(createdAtMs); - expect(expiresAt.toISOString()).toBe("2026-03-06T00:10:00.000Z"); + expect(expiresAt.toISOString()).toBe("2026-03-09T00:00:00.000Z"); }); }); diff --git a/server/src/routes/access.ts b/server/src/routes/access.ts index e4893765fbc..72fe0ef4d5a 100644 --- a/server/src/routes/access.ts +++ b/server/src/routes/access.ts @@ -62,7 +62,7 @@ const INVITE_TOKEN_PREFIX = "pcp_invite_"; const INVITE_TOKEN_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789"; const INVITE_TOKEN_SUFFIX_LENGTH = 8; const INVITE_TOKEN_MAX_RETRIES = 5; -const COMPANY_INVITE_TTL_MS = 10 * 60 * 1000; +const COMPANY_INVITE_TTL_MS = 72 * 60 * 60 * 1000; function createInviteToken() { const bytes = randomBytes(INVITE_TOKEN_SUFFIX_LENGTH);