this repo has no description

feat: add handle resolution endpoint

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Changed files
+25 -1
src
+25 -1
src/pds.js
··· 640 641 async fetch(request) { 642 const url = new URL(request.url) 643 if (url.pathname === '/init') { 644 const body = await request.json() 645 if (!body.did || !body.privateKey) { ··· 749 export default { 750 async fetch(request, env) { 751 const url = new URL(request.url) 752 - const did = url.searchParams.get('did') 753 754 if (!did) { 755 return new Response('missing did param', { status: 400 }) 756 }
··· 640 641 async fetch(request) { 642 const url = new URL(request.url) 643 + 644 + // Handle resolution - doesn't require ?did= param 645 + if (url.pathname === '/.well-known/atproto-did') { 646 + const did = await this.getDid() 647 + if (!did) { 648 + return new Response('User not found', { status: 404 }) 649 + } 650 + return new Response(did, { 651 + headers: { 'Content-Type': 'text/plain' } 652 + }) 653 + } 654 + 655 if (url.pathname === '/init') { 656 const body = await request.json() 657 if (!body.did || !body.privateKey) { ··· 761 export default { 762 async fetch(request, env) { 763 const url = new URL(request.url) 764 765 + // For /.well-known/atproto-did, extract DID from subdomain 766 + // e.g., alice.atproto-pds.chad-53c.workers.dev -> look up "alice" 767 + if (url.pathname === '/.well-known/atproto-did') { 768 + const host = request.headers.get('Host') || '' 769 + // For now, use the first Durable Object (single-user PDS) 770 + // Extract handle from subdomain if present 771 + const did = url.searchParams.get('did') || 'default' 772 + const id = env.PDS.idFromName(did) 773 + const pds = env.PDS.get(id) 774 + return pds.fetch(request) 775 + } 776 + 777 + const did = url.searchParams.get('did') 778 if (!did) { 779 return new Response('missing did param', { status: 400 }) 780 }