MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / createDemoSession

Function createDemoSession

packages/auth/src/session.ts:40–60  ·  view source on GitHub ↗
(
  userId: string
)

Source from the content-addressed store, hash-verified

38};
39
40export async function createDemoSession(
41 userId: string
42): Promise<SessionValidationResult> {
43 const user = await db.user.findUniqueOrThrow({
44 where: {
45 id: userId,
46 },
47 });
48
49 return {
50 user,
51 userId: user.id,
52 session: {
53 id: '1',
54 userId: user.id,
55 expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30 * 365),
56 createdAt: new Date(),
57 updatedAt: new Date(),
58 },
59 };
60}
61
62export const decodeSessionToken = (token: string): string | null => {
63 return token

Callers 1

validateSessionTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected