Something went wrong. Try again.
Testing building apps with atproto
Something went wrong. Try again.
12345678910111213141516171819202122import { getCookie } from "hono/cookie";import { getOAuthClient } from "./client";import type { Context } from "hono";import type { OAuthSession } from "@atproto/oauth-client-node";
export async function getDid(c: Context): Promise<string | null> { return getCookie(c, "did") ?? null;}
export async function getSession( c: Context): Promise<OAuthSession | null> { const did = await getDid(c); if (!did) return null;
try { const client = await getOAuthClient(); return await client.restore(did); } catch { return null; }}