UNPKG

@fedify/fedify

Version:

An ActivityPub server framework

102 lines 2.84 kB
import * as dntShim from "../_dnt.shims.js"; import { type TracerProvider } from "@opentelemetry/api"; import type { Recipient } from "../vocab/actor.js"; /** * Parameters for {@link extractInboxes}. */ export interface ExtractInboxesParameters { /** * Actors to extract the inboxes from. */ recipients: Recipient[]; /** * Whether to prefer the shared inbox over the personal inbox. * Defaults to `false`. */ preferSharedInbox?: boolean; /** * The base URIs to exclude from the recipients' inboxes. It is useful * for excluding the recipients having the same shared inbox with the sender. * * Note that the only `origin` parts of the `URL`s are compared. * * @since 0.9.0 */ excludeBaseUris?: URL[]; } /** * Extracts the inbox URLs from recipients. * @param parameters The parameters to extract the inboxes. * See also {@link ExtractInboxesParameters}. * @returns The inboxes as a map of inbox URL to actor URIs. */ export declare function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }: ExtractInboxesParameters): Record<string, { actorIds: Set<string>; sharedInbox: boolean; }>; /** * A key pair for an actor who sends an activity. * @since 0.10.0 */ export interface SenderKeyPair { /** * The actor's private key to sign the request. */ privateKey: dntShim.CryptoKey; /** * The public key ID that corresponds to the private key. */ keyId: URL; } /** * Parameters for {@link sendActivity}. */ export interface SendActivityParameters { /** * The activity to send. */ activity: unknown; /** * The activity ID to send. * @since 1.0.0 */ activityId?: string | null; /** * The qualified URI of the activity type. * @since 1.3.0 */ activityType?: string; /** * The key pairs of the sender to sign the request. It must not be empty. * @since 0.10.0 */ keys: SenderKeyPair[]; /** * The inbox URL to send the activity to. */ inbox: URL; /** * Whether the inbox is a shared inbox. * @since 1.3.0 */ sharedInbox?: boolean; /** * Additional headers to include in the request. */ headers?: Headers; /** * The tracer provider for tracing the request. * If omitted, the global tracer provider is used. * @since 1.3.0 */ tracerProvider?: TracerProvider; } /** * Sends an {@link Activity} to an inbox. * * @param parameters The parameters for sending the activity. * See also {@link SendActivityParameters}. * @throws {Error} If the activity fails to send. */ export declare function sendActivity(options: SendActivityParameters): Promise<void>; //# sourceMappingURL=send.d.ts.map