iya-sts
    Preparing search index...

    A person's profile photo. A static utility class; its one store is declared above.

    Index
    ORIGINS: Readonly<{ FEDERATION: "federation"; PERSON: "person" }> = ORIGINS
    PATH_PREFIX: "/web/photo/" = PATH_PREFIX
    • The base a new address is built on, or a refusal: an address goes into a token, so in product mode a Host header never becomes part of one.

      Parameters

      • req: any

        the request

      Returns any

      { base }, or { base: '', why }

    • Checks a file against the limits and rewrites it for keeping.

      Parameters

      • bytes: Buffer

        the file

      • minPixels: number

        the shortest side allowed

      Returns any

      { ok, bytes, type, width, height }, or { ok: false, code, status, error }

    • Whether a federated sign-in should dial this address now.

      Parameters

      • record: any

        the person's record

      • source: string

        the partner's address

      • now: number

        the instant

      Returns string

      the reason not to, or ''

    • The directory, lazily: it is loaded long after this library.

      Returns any

      the module

    • Removes the row of a directory entry being deleted. The directory calls this from the deletion's own bookkeeping, with what the entry held.

      Parameters

      • values: unknown

        the entry's stsProfilePhoto values

      Returns void

    • What a person choosing a photo is held to, for the page and the refusals.

      Returns any

      { maxFileBytes, maxStoredBytes, minPixels, maxPixels, types }

    • Keeps an image that arrived with a moved entry, under an id of this cell.

      Parameters

      • values: unknown

        the values movingOut() sent

      • pictureUrl: string

        the address the entry arrived with

      Returns any

      { values, pictureUrl }; pictureUrl empty when no image came

    • The entry's attribute value with the image inside it, for the transfer.

      Parameters

      • values: unknown

        the entry's stsProfilePhoto values

      Returns string[]

      the values to send

    • Copies a partner's photo after a federated sign-in. Never awaited by the sign-in, and it never rejects: a photo is not a reason for a sign-in to fail or to wait, and the next sign-in tries again.

      Parameters

      • req: any

        the request, for the base URL

      • username: string

        the person

      • source: string

        the partner's picture, already on pictureUrl

      • relationship: string

        the relationship's id

      Returns Promise<any>

      a promise of what happened, for a test

    • One stored attribute value as a record.

      Parameters

      • value: unknown

        the JSON text, or nothing

      Returns any

      the record, {} for none or for a value that does not parse

    • The realm-relative path a person's own photo is drawn from, for a menu.

      Only this realm's own copy: a URL on pictureUrl that names somewhere else is not admitted by any surface's img-src, and fetching one would tell that party who is looking at a console.

      Parameters

      • username: string

        the person

      Returns string

      the path including the realm's prefix, or ''

    • A person's record: which row is theirs, whose it was, and whether a copy was declined.

      Parameters

      • username: string

        the person

      Returns any

      the record, {} for none, or null with no directory entry

    • Registers GET /web/photo/{rid}.

      Parameters

      • app: any

        the express app

      Returns void

    • A person removing their photo. A copy from a partner is remembered as declined, so that the next sign-in through that partner does not put it back; setting one of their own later clears that.

      Parameters

      • username: string

        the person, from the token

      Returns any

      { ok, removed }

    • The row to answer with, or null where this address answers nothing: no such row, a person who is gone, or a disabled account.

      Parameters

      • rid: string

        the address's id

      Returns any

      the row, or null

    • A person setting their own photo on the portal.

      Parameters

      • req: any

        the request

      • username: string

        the person, from the token

      • bytes: Buffer

        the file

      Returns any

      { ok, path }, or { ok: false, code, status, error }

    • Reads a setting with a fallback for a realm that cannot be asked.

      Parameters

      • key: string

        the setting

      • fallback: unknown

        what to answer when it cannot be read

      Returns unknown

      the value

    • A JPEG or PNG's type and sides, decided by its bytes.

      Parameters

      • bytes: Buffer

        the file

      Returns { height: number; type: string; width: number }

      { type, width, height }, type empty for anything else

    • Keeps a checked image as a person's photo: a new row under a new address, the record and pictureUrl on the entry, then the old row gone.

      Parameters

      • username: string

        the person

      • checked: any

        what checked() answered

      • base: string

        the base the address is built on

      • extra: any

        the record's other members: origin and, for a copy, source, relationship and fetchedAt

      Returns any

      { ok, path }, or a refusal

    • The file as it will be kept, or null when it cannot be rewritten.

      Parameters

      • bytes: Buffer

        the file

      • type: string

        its type, from sniff()

      Returns any

      the rewritten file, or null

    • A JPEG with its metadata segments and anything after its end removed.

      APP0 (JFIF), APP2 (a colour profile) and APP14 (Adobe's colour transform, without which some files decode wrongly) stay; every other application segment and every comment goes. A file that is not walkable to its scan is not an image this service will rewrite, and it answers null.

      Parameters

      • b: Buffer

        the file, starting with the SOI marker

      Returns any

      the rewritten file, or null

    • A PNG holding only the chunks in PNG_KEPT, and nothing after IEND.

      Parameters

      • b: Buffer

        the file, starting with the PNG signature

      Returns any

      the rewritten file, or null when it does not walk to IEND

    • What the portal draws the photo card from.

      Parameters

      • username: string

        the person

      Returns any

      { path, origin, selfService, limits }