Skip to content

Commit 1dbdc83

Browse files
devin-ai-integration[bot]seth@gumroad.comautofix-ci[bot]
authored
Remove APPEAL_ENCRYPTION_KEY and legacy token validation (#94)
* Remove APPEAL_ENCRYPTION_KEY and legacy token validation Co-Authored-By: [email protected] <[email protected]> * [autofix.ci] apply automated fixes --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 4f8134f commit 1dbdc83

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

lib/env.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ const envSchema = z
3838
.object({
3939
OPENAI_API_KEY: z.string(),
4040
FIELD_ENCRYPTION_KEY: z.string(),
41-
APPEAL_ENCRYPTION_KEY: z.string().optional(),
4241
SECRET_KEY: z.string(),
4342
CLERK_SECRET_KEY: z.string(),
4443
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string(),

services/appeals.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ export function generateAppealToken(userId: string) {
1313
return `${userId}-${signature}`;
1414
}
1515

16-
export function generateLegacyAppealToken(userId: string) {
17-
if (!env.APPEAL_ENCRYPTION_KEY) {
18-
throw new Error("APPEAL_ENCRYPTION_KEY is not set");
19-
}
20-
const signature = crypto.createHmac("sha256", env.APPEAL_ENCRYPTION_KEY).update(userId).digest("hex");
21-
return `${userId}-${signature}`;
22-
}
23-
2416
export function validateAppealToken(token: string): [isValid: false, userId: null] | [isValid: true, userId: string] {
2517
const [userId, _] = token.split("-");
2618
if (!userId) {
@@ -31,11 +23,6 @@ export function validateAppealToken(token: string): [isValid: false, userId: nul
3123
return [true, userId];
3224
}
3325

34-
// TODO(s3ththompson): Remove once all old appeals have been closed
35-
if (env.APPEAL_ENCRYPTION_KEY && token === generateLegacyAppealToken(userId)) {
36-
return [true, userId];
37-
}
38-
3926
return [false, null];
4027
}
4128

0 commit comments

Comments
 (0)