visitor

tcmts.hub.visitor · #3w5bpkrg · term · runs on the server

uses tcmts.server.cookie, which uses tcmts.server.requestNow, which uses tcmts.server.callNow, which uses #tcm/host (call)

Who the page is for: the DID the visitor's browser says it's signed in as. Only what they're shown depends on it (whose releases they follow, which libraries they use); what anyone can write is checked against their repository.

import type { Trusted } from "#codebase/tcmts/cli/attest";
import { people, SIGNED_IN_COOKIE } from "#codebase/tcmts/hub";
import { cookie } from "#codebase/tcmts/server";

export async function visitor(): Promise<Trusted | undefined> {
  const did = cookie(SIGNED_IN_COOKIE);
  if (!did || !did.startsWith("did:")) return undefined;
  const p = await people.findOne({ did });
  return { did, ...(p?.value.handle ? { handle: p.value.handle } : {}) };
}

uses

used by