Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
543 B · 21 lines
TypeScript
at main
12345678910111213141516171819202122import { cookies } from "next/headers";import { getOAuthClient } from "./client";import type { OAuthSession } from "@atproto/oauth-client-node";
export async function getSession(): Promise<OAuthSession | null> { const did = await getDid(); if (!did) return null;
try { const client = await getOAuthClient(); return await client.restore(did); } catch { return null; }}
export async function getDid(): Promise<string | null> { const cookieStore = await cookies(); return cookieStore.get("did")?.value ?? null;}