API reference
yatta/webfinger
WebFinger discovery: a lookup in, a JRD document out.
5 exported symbols and 7 members, read from src/func/webfinger.ts.
Construct
createUserWebFingerLookup
functionA lookup that answers from the auth store.
Best-effort pre-filled: `profile-page` points at the app URL and `self` at this same endpoint. Add a real `acct:` discovery result if clients should be able to resolve the address from another server.
createUserWebFingerLookup(deps: { findUserByEmail(email: string): Promise<{ id: string; email: string; } | null>; appUrl: string; hosts?: string[]; }): WebFingerLookupcreateWebFingerHandler
functionBuild the WebFinger handler.
createWebFingerHandler(lookup: WebFingerLookup, options?: { path?: string; }): (req: Request) => Promise<Response>- lookup
- Your discovery logic. Returning null is a plain 404 — say nothing rather than guess.
Returns A `(req) => Promise<Response>` for a router or `Bun.serve`.
Types
WebFingerLink
interfaceOne link in a JRD document, keyed by `rel`.
interface WebFingerLink4 members
relpropertyrel: stringtypepropertytype?: stringhrefpropertyhref?: stringtemplatepropertytemplate?: string
WebFingerSubject
interfaceWhat a lookup knows about a resource: its canonical name and its links.
interface WebFingerSubject3 members
subjectpropertysubject: stringaliasespropertyaliases?: string[]linkspropertylinks: WebFingerLink[]
WebFingerLookup
typeReturns what is known about a resource, or null.
type WebFingerLookup = (resource: string) => Promise<WebFingerSubject | null>- resource
- The URI the client asked about, like `"acct:ada@example.com"`. It arrives decoded; validate it as you see fit.
Tip
Most of the types above are inferred. You rarely import
AuthConfig or JobPayload — declaring your schema once is enough for the rest to follow. See Typed keys.