MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / checkFingerprintConflict

Function checkFingerprintConflict

freebuff/web/src/app/onboard/_db.ts:93–116  ·  view source on GitHub ↗
(
  fingerprintId: string,
  userId: string,
)

Source from the content-addressed store, hash-verified

91}
92
93export async function checkFingerprintConflict(
94 fingerprintId: string,
95 userId: string,
96): Promise<{ hasConflict: boolean; existingUserId?: string }> {
97 const existingSession = await db
98 .select({
99 userId: schema.session.userId,
100 })
101 .from(schema.session)
102 .where(
103 and(
104 eq(schema.session.fingerprint_id, fingerprintId),
105 ne(schema.session.userId, userId),
106 gt(schema.session.expires, new Date()),
107 ),
108 )
109 .limit(1)
110
111 const activeSession = existingSession[0]
112 if (activeSession) {
113 return { hasConflict: true, existingUserId: activeSession.userId }
114 }
115 return { hasConflict: false }
116}
117
118export async function getSessionTokenFromCookies(): Promise<
119 string | undefined

Callers 1

OnboardFunction · 0.90

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected