this repo has no description

Add missing auth files

+62 -4
+14
app/.well-known/jwks.json/route.ts
··· 1 + import { JoseKey } from "@atproto/oauth-client-node"; 2 + import { NextResponse } from "next/server"; 3 + 4 + const PRIVATE_KEY = process.env.PRIVATE_KEY; 5 + 6 + export async function GET() { 7 + if (!PRIVATE_KEY) { 8 + return NextResponse.json({ keys: [] }); 9 + } 10 + 11 + const key = await JoseKey.fromJWK(JSON.parse(PRIVATE_KEY)); 12 + 13 + return NextResponse.json({ keys: [key.publicJwk] }); 14 + }
+30 -4
app/library/page.tsx
··· 1 - const Library = () => { 2 - return <div></div> 3 - } 1 + import { getSession } from "@/lib/auth/session"; 2 + import { Agent } from "@atproto/api"; 3 + import { redirect } from "next/navigation"; 4 + 5 + const Library = async () => { 6 + const session = await getSession(); 7 + 8 + if (!session) { 9 + redirect("/"); 10 + } 4 11 5 - export default Library; 12 + const agent = new Agent(session); 13 + 14 + let error, profile; 15 + 16 + try { 17 + const response = await agent.getProfile({ actor: session.did }); 18 + 19 + profile = response.data; 20 + 21 + console.log(profile); 22 + } catch (error) { 23 + console.error("Error fetching profile:", error); 24 + 25 + error = 26 + error instanceof Error ? error.message : "Failed to fetch profile"; 27 + } 28 + return <div></div>; 29 + }; 30 + 31 + export default Library;
+8
app/oauth-client-metadata.json/route.ts
··· 1 + import { getOAuthClient } from "@/lib/auth/client"; 2 + import { NextResponse } from "next/server"; 3 + 4 + export async function GET(){ 5 + const client = await getOAuthClient(); 6 + 7 + return NextResponse.json(client.clientMetadata) 8 + }
+10
scripts/generateKey.ts
··· 1 + import { JoseKey } from "@atproto/oauth-client-node"; 2 + 3 + const main = async () => { 4 + const kid = Date.now().toString(); 5 + const key = await JoseKey.generate(["ES256"], kid); 6 + 7 + console.log(JSON.stringify(key.privateJwk)); 8 + }; 9 + 10 + main();