MCPcopy Index your code
hub / github.com/BingyanStudio/github-analyzer / getUserSession

Function getUserSession

api/src/services/auth.ts:89–104  ·  view source on GitHub ↗
(
  req: BunRequest
)

Source from the content-addressed store, hash-verified

87
88// Helper function to get user session from request
89export async function getUserSession(
90 req: BunRequest
91): Promise<UserSession | null> {
92 const cookies = req.headers.get("cookie");
93 if (!cookies) return null;
94
95 const sessionCookie = cookies
96 .split(";")
97 .map((c) => c.trim())
98 .find((c) => c.startsWith("session="));
99
100 if (!sessionCookie) return null;
101
102 const sessionId = sessionCookie.split("=")[1];
103 return await sessionStore.getSession(sessionId);
104}
105
106// Helper to create an authenticated Octokit instance from a session
107export function createOctokitFromSession(session: UserSession): Octokit {

Callers 1

getAuthenticatedUserFunction · 0.85

Calls 1

getSessionMethod · 0.45

Tested by

no test coverage detected