profileOf

tcmts.hub.profileOf · #qcdrzaj7 · term · runs on the server

uses tcmts.atproto.pdsOf, which uses tcmts.atproto.localNetwork, which uses process

Someone's Bluesky profile (app.bsky.actor.profile/self), as their repository signs it (signedRecord): their display name, bio and picture. Nothing, if they have none.

import { didDocument, NoSuchRecord, pdsOf, signedRecord } from "#codebase/tcmts/atproto";
import { profileFields } from "#codebase/tcmts/hub";
import type { Someone } from "#codebase/tcmts/hub";

export async function profileOf(did: string): Promise<Omit<Someone, "did">> {
  let record: unknown;
  try {
    record = (await signedRecord(did, "app.bsky.actor.profile", "self")).record;
  } catch (e) {
    if (e instanceof NoSuchRecord) return {};
    throw e;
  }
  return profileFields(record, pdsOf(await didDocument(did), did), did);
}

uses

used by