diff --git a/lib/create_helpers.ts b/lib/create_helpers.ts index 62e3a2a..66d348d 100644 --- a/lib/create_helpers.ts +++ b/lib/create_helpers.ts @@ -273,3 +273,13 @@ export function createHelpers( }, }; } + +export async function getSessionId(request: Request, cookieName?: string) { + const sessionId = getSessionIdCookie( + request, + cookieName + ); + return (sessionId !== undefined && await isSiteSession(sessionId)) + ? sessionId + : undefined; +} \ No newline at end of file