|
1 | 1 | import { dev } from "$app/environment"; |
2 | 2 | import { GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET } from "$env/static/private"; |
3 | 3 | import { GitHub } from "arctic"; |
4 | | -import { type Adapter, type DatabaseSession, type DatabaseUser, Lucia, type UserId } from "lucia"; |
5 | 4 | import { PROD_URL } from "$lib/config"; |
6 | 5 |
|
7 | | -class EmptyAdapter implements Adapter { |
8 | | - deleteExpiredSessions(): Promise<void> { |
9 | | - return Promise.resolve(); |
10 | | - } |
11 | | - |
12 | | - // eslint-disable-next-line @typescript-eslint/no-unused-vars |
13 | | - deleteSession(_sessionId: string): Promise<void> { |
14 | | - return Promise.resolve(); |
15 | | - } |
16 | | - |
17 | | - // eslint-disable-next-line @typescript-eslint/no-unused-vars |
18 | | - deleteUserSessions(_userId: UserId): Promise<void> { |
19 | | - return Promise.resolve(); |
20 | | - } |
21 | | - |
22 | | - getSessionAndUser( |
23 | | - // eslint-disable-next-line @typescript-eslint/no-unused-vars |
24 | | - _sessionId: string |
25 | | - ): Promise<[session: DatabaseSession | null, user: DatabaseUser | null]> { |
26 | | - return Promise.resolve([null, null]); |
27 | | - } |
28 | | - |
29 | | - // eslint-disable-next-line @typescript-eslint/no-unused-vars |
30 | | - getUserSessions(_userId: UserId): Promise<DatabaseSession[]> { |
31 | | - return Promise.resolve([]); |
32 | | - } |
33 | | - |
34 | | - // eslint-disable-next-line @typescript-eslint/no-unused-vars |
35 | | - setSession(_session: DatabaseSession): Promise<void> { |
36 | | - return Promise.resolve(); |
37 | | - } |
38 | | - |
39 | | - // eslint-disable-next-line @typescript-eslint/no-unused-vars |
40 | | - updateSessionExpiration(_sessionId: string, _expiresAt: Date): Promise<void> { |
41 | | - return Promise.resolve(); |
42 | | - } |
43 | | -} |
44 | | - |
45 | | -const adapter = new EmptyAdapter(); |
46 | | - |
47 | | -export const lucia = new Lucia(adapter); |
48 | | - |
49 | 6 | export const github = new GitHub(GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, { |
50 | 7 | redirectURI: `${dev ? "http://localhost:5173" : PROD_URL}/login/callback` |
51 | 8 | }); |
0 commit comments