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

Function createLoginStatusDb

freebuff/web/src/app/api/auth/cli/status/_db.ts:19–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19export function createLoginStatusDb(): LoginStatusDb {
20 return {
21 getCliSessionForAuth: async (fingerprintId, fingerprintHash) => {
22 const users = await db
23 .select({
24 id: schema.user.id,
25 email: schema.user.email,
26 name: schema.user.name,
27 authToken: schema.session.sessionToken,
28 })
29 .from(schema.session)
30 .innerJoin(schema.user, eq(schema.session.userId, schema.user.id))
31 .where(
32 and(
33 eq(schema.session.fingerprint_id, fingerprintId),
34 eq(schema.session.cli_auth_hash, fingerprintHash),
35 eq(schema.session.type, 'cli'),
36 gt(schema.session.expires, new Date()),
37 ),
38 )
39 .limit(1)
40
41 return users[0] ?? null
42 },
43 }
44}

Callers 1

GETFunction · 0.90

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected