Harden auth and mobile session handling

This commit is contained in:
2026-06-29 15:21:31 -04:00
parent d0c916d659
commit ef826dffa9
20 changed files with 403 additions and 106 deletions
+12
View File
@@ -0,0 +1,12 @@
import { and, eq, ne } from "drizzle-orm";
import { db } from "~/server/db";
import { sessions } from "~/server/db/schema";
export async function revokeUserSessions(userId: string, exceptToken?: string | null) {
const condition = exceptToken
? and(eq(sessions.userId, userId), ne(sessions.token, exceptToken))
: eq(sessions.userId, userId);
await db.delete(sessions).where(condition);
}