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

function

A 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[]; }): WebFingerLookup

createWebFingerHandler

function

Build 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

interface

One link in a JRD document, keyed by `rel`.

interface WebFingerLink

4 members

  • relproperty
    rel: string
  • typeproperty
    type?: string
  • hrefproperty
    href?: string
  • templateproperty
    template?: string

WebFingerSubject

interface

What a lookup knows about a resource: its canonical name and its links.

3 members

  • subjectproperty
    subject: string
  • aliasesproperty
    aliases?: string[]
  • linksproperty
    links: WebFingerLink[]

WebFingerLookup

type

Returns 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.