Last active
May 2, 2024 21:18
-
-
Save iamandrewluca/dc631d8af1e6697347ad50736b0430d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createAuth } from "@keystone-6/auth"; | |
import { statelessSessions } from "@keystone-6/core/session"; | |
import type { Lists } from ".keystone/types"; | |
type Session = { | |
name: string; | |
createdAt: string; | |
}; | |
type Join<T extends string, U extends string = T> = | |
| U | |
| (T extends any ? `${T} ${Join<Exclude<U, T>>}` : never); | |
export const { withAuth } = createAuth<Lists.User.TypeInfo<Session>>({ | |
listKey: "User", | |
identityField: "email", | |
sessionData: "name createdAt" satisfies Join<keyof Session>, | |
secretField: "password", | |
}); | |
export const session = statelessSessions<Session>({ | |
maxAge: 60 * 60 * 24 * 30, | |
secret: "00000000000000000000000000000000", | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment