Skip to main content
Home
Works with
This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score88%
License
MIT
Downloads1,239/wk
Publisheda week ago (2.3.4)

An ActivityPub/fediverse server framework

Classes

c
CircuitBreaker(options: CircuitBreakerCreateOptions)

Tracks reachability state for remote outbox delivery hosts.

  • beforeSend(
    remoteHost: string,
    message: { readonly circuitHeldSince?: string; }
    ): Promise<CircuitBreakerBeforeSendDecision>
    No documentation available
  • capHeldDelay(
    heldSince: Temporal.Instant,
    delay: Temporal.Duration
    ): Temporal.Duration
    No documentation available
  • dropActivity(
    remoteHost: string,
    details: CircuitBreakerActivityDrop
    ): Promise<void>
    No documentation available
  • getState(remoteHost: string): Promise<CircuitBreakerKvState | undefined>
    No documentation available
  • options(): NormalizedCircuitBreakerOptions
    No documentation available
  • pendingSweep(): Promise<void> | undefined

    The currently running background legacy sweep, if any.

  • recordFailure(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>
    No documentation available
  • recordReachableFailure(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>
    No documentation available
  • recordSuccess(remoteHost: string): Promise<CircuitBreakerStateChange | undefined>
    No documentation available
c
InProcessMessageQueue(options?: InProcessMessageQueueOptions)

A message queue that processes messages in the same process. Do not use this in production as it does neither persist messages nor distribute them across multiple processes.

  • enqueue(
    message: any,
    options?: MessageQueueEnqueueOptions
    ): Promise<void>
    No documentation available
  • enqueueMany(
    messages: readonly any[],
    options?: MessageQueueEnqueueOptions
    ): Promise<void>
    No documentation available
  • getDepth(): Promise<MessageQueueDepth>
    No documentation available
  • listen(
    handler: (message: any) => Promise<void> | void,
    options?: MessageQueueListenOptions
    ): Promise<void>
    No documentation available
  • nativeRetrial: boolean

    In-process message queue does not provide native retry mechanisms.

c

A key–value store that stores values in memory. Do not use this in production as it does not persist values.

  • cas(
    key: KvKey,
    expectedValue: unknown,
    newValue: unknown,
    options?: KvStoreSetOptions
    ): Promise<boolean>

    {@inheritDoc KvStore.cas}

  • delete(key: KvKey): Promise<void>

    {@inheritDoc KvStore.delete}

  • get<T = unknown>(key: KvKey): Promise<T | undefined>

    {@inheritDoc KvStore.get}

  • list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>

    {@inheritDoc KvStore.list}

  • set(
    key: KvKey,
    value: unknown,
    options?: KvStoreSetOptions
    ): Promise<void>

    {@inheritDoc KvStore.set}

c
ParallelMessageQueue(
queue: MessageQueue,
workers: number
)

A message queue that processes messages in parallel. It takes another MessageQueue, and processes messages in parallel up to a certain number of workers.

  • enqueue(
    message: any,
    options?: MessageQueueEnqueueOptions
    ): Promise<void>
    No documentation available
  • enqueueMany(
    messages: readonly any[],
    options?: MessageQueueEnqueueOptions
    ): Promise<void>
    No documentation available
  • getDepth: () => Promise<MessageQueueDepth>
    No documentation available
  • listen(
    handler: (message: any) => Promise<void> | void,
    options?: MessageQueueListenOptions
    ): Promise<void>
    No documentation available
  • nativeRetrial: boolean

    Inherits the native retry capability from the wrapped queue.

  • queue: MessageQueue
    No documentation available
  • workers: number
    No documentation available
c
SendActivityError(
inbox: URL,
statusCode: number,
message: string,
responseBody: string,
responseHeaders?: HeadersInit
)

An error that is thrown when an activity fails to send to a remote inbox. It contains structured information about the failure, including the HTTP status code, the inbox URL, and the response body.

  • inbox: URL

    The inbox URL that the activity was being sent to.

  • responseBody: string

    The response body from the inbox, if any. Note that this may be truncated to a maximum of 1 KiB to prevent excessive memory consumption when remote servers return large error pages (e.g., Cloudflare error pages). If truncated, the string will end with "… (truncated)".

  • The response headers from the inbox.

  • statusCode: number

    The HTTP status code returned by the inbox.

c
Router(options?: _RouterOptions)

URL router and constructor based on URI Template (RFC 6570).

  • add(
    template: string,
    name: string
    ): Set<string>

    Adds a new path rule to the router.

  • build(
    name: string,
    values: Record<string, string>
    ): string | null

    Constructs a URL/path from a path name and values.

  • clone(): Router

    Clones this router.

  • has(name: string): boolean

    Checks if a path name exists in the router.

  • route(url: string): RouterRouteResult | null

    Resolves a path name and values from a URL, if any match.

  • Whether to ignore trailing slashes when matching paths.

c
RouterError(message: string)

An error thrown by the Router.

Functions

f
actorDehydrator<TContextData>(
activity: Activity,
_context: Context<TContextData>
): Activity

An activity transformer that dehydrates the actor property of an activity so that it only contains the actor's URI. For example, suppose we have an activity like this:

f
attachSignature(
jsonLd: unknown,
signature: Signature
): { signature: Signature; }

Attaches a LD signature to the given JSON-LD document.

f
autoIdAssigner<TContextData>(
activity: Activity,
context: Context<TContextData>
): Activity

An activity transformer that assigns a new random ID to an activity if it does not already have one. This is useful for ensuring that activities have an ID before they are sent to other servers.

f
buildCollectionSynchronizationHeader(
collectionId: string | URL,
actorIds: Iterable<string | URL>
): Promise<string>

Builds Collection-Synchronization header content.

f
createExponentialBackoffPolicy(options?: CreateExponentialBackoffPolicyOptions): RetryPolicy

Creates an exponential backoff retry policy. The delay between retries starts at the initialDelay and is multiplied by the factor for each subsequent retry, up to the maxDelay. The policy will give up after maxAttempts attempts. The actual delay is randomized to avoid synchronization (jitter).

f
createFederation<TContextData>(options: FederationOptions<TContextData>): Federation<TContextData>

Create a new Federation instance.

f
createFederationBuilder<TContextData>(): FederationBuilder<TContextData>

Creates a new FederationBuilder instance.

f
createProof(
object: Object,
privateKey: CryptoKey,
keyId: URL,
unnamed 3?: CreateProofOptions
): Promise<DataIntegrityProof>

Creates a proof for the given object.

f
createSignature(
jsonLd: unknown,
privateKey: CryptoKey,
keyId: URL,
unnamed 3?: CreateSignatureOptions
): Promise<Signature>

Creates a LD signature for the given JSON-LD document.

f
detachSignature(jsonLd: unknown): unknown

Detaches Linked Data Signatures from the given JSON-LD document.

f
digest(uris: Iterable<string | URL>): Promise<Uint8Array>
f
doesActorOwnKey(
activity: Activity,
key: CryptographicKey,
options: DoesActorOwnKeyOptions
): Promise<boolean>

Checks if the actor of the given activity owns the specified key.

f
exportJwk(key: CryptoKey): Promise<JsonWebKey>

Exports a key in JWK format.

f
fetchKey<T extends CryptographicKey | Multikey>(
keyId: URL | string,
cls: FetchableKeyClass<T>,
options?: FetchKeyOptions
): Promise<FetchKeyResult<T>>

Fetches a CryptographicKey or Multikey from the given URL. If the given URL contains an Actor object, it tries to find the corresponding key in the publicKey or assertionMethod property.

f
fetchKeyDetailed<T extends CryptographicKey | Multikey>(
keyId: URL | string,
cls: FetchableKeyClass<T>,
options?: FetchKeyOptions
): Promise<FetchKeyDetailedResult<T>>

Fetches a CryptographicKey or Multikey from the given URL, preserving transport-level fetch failures for callers that need to inspect why the key could not be loaded.

f
formatAcceptSignature(members: AcceptSignatureMember[]): string

Serializes an array of AcceptSignatureMember objects into an Accept-Signature header value string (RFC 9421 §5.1).

f
fulfillAcceptSignature(
entry: AcceptSignatureMember,
localKeyId: string,
localAlg: string
): FulfillAcceptSignatureResult | null

Attempts to translate an AcceptSignatureMember challenge into RFC 9421 signing options that the local signer can fulfill.

f
generateCryptoKeyPair(algorithm?: "RSASSA-PKCS1-v1_5" | "Ed25519"): Promise<CryptoKeyPair>

Generates a key pair which is appropriate for Fedify.

f
getAuthenticatedDocumentLoader(
identity: { keyId: URL; privateKey: CryptoKey; },
unnamed 1?: GetAuthenticatedDocumentLoaderOptions
): DocumentLoader

Gets an authenticated DocumentLoader for the given identity. Note that an authenticated document loader intentionally does not cache the fetched documents.

f
getDefaultActivityTransformers<TContextData>(): readonly ActivityTransformer<TContextData>[]

Gets the default activity transformers that are applied to all outgoing activities.

f
getKeyOwner(
keyId: URL | CryptographicKey,
options: GetKeyOwnerOptions
): Promise<Actor | null>

Gets the actor that owns the specified key. Returns null if the key has no known owner.

f
getNodeInfo(
url: URL | string,
options?: GetNodeInfoOptions
): Promise<NodeInfo | JsonValue | undefined>
2 overloads

Fetches a NodeInfo document from the given URL.

f
handleWebFinger<TContextData>(
request: Request,
options: WebFingerHandlerParameters<TContextData>
): Promise<Response>

Handles a WebFinger request. You would not typically call this function directly, but instead use Federation.fetch method.

f
hasProofLike(jsonLd: unknown): boolean

Checks if the given JSON-LD document has a DataIntegrityProof-like object, without fully deserializing it into vocabulary classes.

f
hasSignatureLike(jsonLd: unknown): boolean

Checks if the given JSON-LD document has a Linked Data Signature-like object, without restricting it to a single suite-specific shape.

f
importJwk(
jwk: JsonWebKey,
type: "public" | "private"
): Promise<CryptoKey>

Imports a key from JWK format.

f
kvCache(unnamed 0: KvCacheParameters): DocumentLoader

Decorates a DocumentLoader with a cache backed by a KvStore.

f
nodeInfoToJson(nodeInfo: NodeInfo): JsonValue

Converts a NodeInfo object to a JSON value.

f
normalizeCircuitBreakerOptions(options: CircuitBreakerOptions): NormalizedCircuitBreakerOptions

Normalizes user-provided circuit breaker options into the internal policy shape used while processing queued outbox deliveries.

f
parseAcceptSignature(header: string): AcceptSignatureMember[]

Parses an Accept-Signature header value (RFC 9421 §5.1) into an array of AcceptSignatureMember objects.

f
parseCircuitBreakerKvState(value: unknown): CircuitBreakerKvState | undefined

Parses a value loaded from the circuit breaker KV store.

f
parseNodeInfo(
data: unknown,
options?: ParseNodeInfoOptions
): NodeInfo | null

Parses a NodeInfo document.

f
respondWithObject(
object: Object,
options?: RespondWithObjectOptions
): Promise<Response>

Responds with the given object in JSON-LD format.

f
respondWithObjectIfAcceptable(
object: Object,
request: Request,
options?: RespondWithObjectOptions
): Promise<Response | null>

Responds with the given object in JSON-LD format if the request accepts JSON-LD.

f
signJsonLd(
jsonLd: unknown,
privateKey: CryptoKey,
keyId: URL,
options: SignJsonLdOptions
): Promise<{ signature: Signature; }>

Signs the given JSON-LD document with the private key and returns the signed JSON-LD document.

f
signObject<T extends Object>(
object: T,
privateKey: CryptoKey,
keyId: URL,
options?: SignObjectOptions
): Promise<T>

Signs the given object with the private key and returns the signed object.

f
signRequest(
request: Request,
privateKey: CryptoKey,
keyId: URL,
options?: SignRequestOptions
): Promise<Request>

Signs a request using the given private key.

f
validateAcceptSignature(members: AcceptSignatureMember[]): AcceptSignatureMember[]

Filters out AcceptSignatureMember entries whose covered components include response-only identifiers (@status) that are not applicable to request-target messages, as required by RFC 9421 §5.

f
verifyJsonLd(
jsonLd: unknown,
options?: VerifyJsonLdOptions
): Promise<boolean>

Verify the authenticity of the given JSON-LD document using Linked Data Signatures. If the document is signed, this function verifies the signature and checks if the document is attributed to the owner of the public key. If the document is not signed, this function returns false.

f
verifyObject<T extends Object>(
cls:
(new (...args: any[]) => T)
& { fromJsonLd(
jsonLd: unknown,
options: VerifyObjectOptions
): Promise<T>; }
,
jsonLd: unknown,
options?: VerifyObjectOptions
): Promise<T | null>

Verifies the given object. It will verify all the proofs in the object, and succeed only if all the proofs are valid and all attributions and actors are authenticated by the proofs.

f
verifyProof(
jsonLd: unknown,
proof: DataIntegrityProof,
options?: VerifyProofOptions
): Promise<Multikey | null>

Verifies the given proof for the object.

f
verifyRequest(
request: Request,
options?: VerifyRequestOptions
): Promise<CryptographicKey | null>

Verifies the signature of a request.

f
verifyRequestDetailed(
request: Request,
options?: VerifyRequestOptions
): Promise<VerifyRequestDetailedResult>

Verifies the signature of a request and returns a structured failure reason when verification does not succeed.

f
verifySignature(
jsonLd: unknown,
options?: VerifySignatureOptions
): Promise<CryptographicKey | null>

Verifies Linked Data Signatures of the given JSON-LD document.

Interfaces

I

Represents a single member of the Accept-Signature Dictionary Structured Field, as defined in RFC 9421 §5.1.

  • components: AcceptSignatureComponent[]

    The exact list of covered component identifiers requested for the target signature, including all applicable component parameters, as required by RFC 9421 §5.1.

  • label: string

    The label that uniquely identifies the requested message signature within the context of the target HTTP message (e.g., "sig1").

  • parameters: AcceptSignatureParameters

    Optional signature metadata parameters requested by the verifier.

I

Signature metadata parameters that may appear in an Accept-Signature member, as defined in RFC 9421 §5.1.

  • alg: string

    If present, the signer is requested to use the indicated algorithm from the HTTP Signature Algorithms registry.

  • created: true

    If true, the signer is requested to generate and include a creation timestamp. This parameter has no associated value in the wire format.

  • expires: true

    If true, the signer is requested to generate and include an expiration timestamp. This parameter has no associated value in the wire format.

  • keyid: string

    If present, the signer is requested to use the indicated key material to create the target signature.

  • nonce: string

    If present, the signer is requested to include this value as the signature nonce in the target signature.

  • tag: string

    If present, the signer is requested to include this value as the signature tag in the target signature.

I

Additional settings for the actor dispatcher.

  • authorize(predicate: AuthorizePredicate<TContextData>): ActorCallbackSetters<TContextData>

    Specifies the conditions under which requests are authorized.

  • mapActorAlias(
    path: `/${string}`,
    identifier: string
    ): ActorCallbackSetters<TContextData>

    Maps a fixed path to a sentinel identifier. It is useful for exposing a single, instance-level actor at a fixed path, such as /actor for a relay or /bot for a bot.

  • mapAlias(mapper: ActorAliasMapper<TContextData>): ActorCallbackSetters<TContextData>

    Sets the callback function that maps a WebFinger query to the corresponding actor's identifier or username. If it's omitted, the WebFinger handler only supports the actor URIs and acct: URIs. If you want to support other queries, you should set this dispatcher.

  • mapHandle(mapper: ActorHandleMapper<TContextData>): ActorCallbackSetters<TContextData>

    Sets the callback function that maps a WebFinger username to the corresponding actor's identifier. If it's omitted, the identifier is assumed to be the same as the WebFinger username, which makes your actors have the immutable handles. If you want to let your actors change their fediverse handles, you should set this dispatcher.

  • setKeyPairsDispatcher(dispatcher: ActorKeyPairsDispatcher<TContextData>): ActorCallbackSetters<TContextData>

    Sets the key pairs dispatcher for actors.

I

A pair of a public key and a private key in various formats.

  • cryptographicKey: CryptographicKey

    A CryptographicKey instance of the public key.

  • keyId: URL

    The URI of the public key for CryptographicKey, which is used for verifying HTTP Signatures and Linked Data Signatures. Note that this is the ID of the cryptographicKey, not of the multikey; the Multikey instance has a distinct ID of its own.

  • multikey: Multikey

    A Multikey instance of the public key.

I

Details passed to CircuitBreakerOptions.onActivityDrop when a held activity expires before the remote host recovers.

  • activity: Activity

    The activity that was dropped.

  • activityId: string

    The activity ID, when known.

  • activityType: string

    The activity type.

  • actorIds: readonly URL[]

    The actor IDs represented by this inbox.

  • heldSince: Temporal.Instant

    The time when Fedify first held this activity.

  • inbox: URL

    The inbox URL that would have received the activity.

I

The JSON-serializable state stored in the configured KvStore.

  • failures: readonly string[]
    No documentation available
  • halfOpened: string
    No documentation available
  • opened: string
    No documentation available
  • state: CircuitBreakerState
    No documentation available
I

A circuit breaker state transition.

  • newState: CircuitBreakerState
    No documentation available
  • previousState: CircuitBreakerState
    No documentation available
I

Additional settings for a collection dispatcher.

  • authorize(predicate: AuthorizePredicate<TContextData>): CollectionCallbackSetters<TContext, TContextData, TFilter>

    Specifies the conditions under which requests are authorized.

  • setCounter(counter: CollectionCounter<TContextData, TFilter>): CollectionCallbackSetters<TContext, TContextData, TFilter>

    Sets the counter for the collection.

  • setFirstCursor(cursor: CollectionCursor<TContext, TContextData, TFilter>): CollectionCallbackSetters<TContext, TContextData, TFilter>

    Sets the first cursor for the collection.

  • setLastCursor(cursor: CollectionCursor<TContext, TContextData, TFilter>): CollectionCallbackSetters<TContext, TContextData, TFilter>

    Sets the last cursor for the collection.

I

A context.

  • The canonical origin of the federated server, including the scheme (http:// or https://) and the host (e.g., example.com:8080).

  • clone(data: TContextData): Context<TContextData>

    Creates a new context with the same properties as this one, but with the given data.

  • contextLoader: DocumentLoader

    The context loader for loading remote JSON-LD contexts.

  • data: TContextData

    The user-defined data associated with the context.

  • documentLoader: DocumentLoader

    The document loader for loading remote JSON-LD documents.

  • federation: Federation<TContextData>

    The federation object that this context belongs to.

  • getActorKeyPairs(identifier: string): Promise<ActorKeyPair[]>

    Gets the key pairs for an actor.

  • getActorUri(identifier: string): URL

    Builds the URI of an actor with the given identifier.

  • getCollectionUri<TParam extends Record<string, string>>(
    name: string | symbol,
    values: TParam
    ): URL

    Builds the URI of a collection of objects with the given name and values.

  • getDocumentLoader(identity: { identifier: string; } | { username: string; }): Promise<DocumentLoader>

    Gets an authenticated DocumentLoader for the given identity. Note that an authenticated document loader intentionally does not cache the fetched documents.

  • getFeaturedTagsUri(identifier: string): URL

    Builds the URI of an actor's featured tags collection with the given identifier.

  • getFeaturedUri(identifier: string): URL

    Builds the URI of an actor's featured collection with the given identifier.

  • getFollowersUri(identifier: string): URL

    Builds the URI of an actor's followers collection with the given identifier.

  • getFollowingUri(identifier: string): URL

    Builds the URI of an actor's following collection with the given identifier.

  • Builds the URI of the shared inbox.

  • getLikedUri(identifier: string): URL

    Builds the URI of an actor's liked collection with the given identifier.

  • Builds the URI of the NodeInfo document.

  • getObjectUri<TObject extends Object>(
    cls: ConstructorWithTypeId<TObject>,
    values: Record<string, string>
    ): URL

    Builds the URI of an object with the given class and values.

  • getOutboxUri(identifier: string): URL

    Builds the URI of an actor's outbox with the given identifier.

  • host: string

    The host of the federated server, including the hostname (e.g., example.com) and the port following a colon (e.g., :8080) if it is not the default port for the scheme.

  • hostname: string

    The hostname of the federated server (e.g., example.com). This is the same as the host without the port.

  • lookupNodeInfo(
    url: URL | string,
    options?: GetNodeInfoOptions & { parse?: "strict" | "best-effort"; }
    ): Promise<NodeInfo | undefined>

    Fetches the NodeInfo document from the given URL.

  • lookupObject(
    identifier: string | URL,
    options?: LookupObjectOptions
    ): Promise<Object | null>

    Looks up an ActivityStreams object by its URI (including acct: URIs) or a fediverse handle (e.g., @user@server or user@server).

  • lookupWebFinger(
    resource: URL | string,
    options?: LookupWebFingerOptions
    ): Promise<ResourceDescriptor | null>

    Looks up a WebFinger resource.

  • meterProvider: MeterProvider

    The OpenTelemetry meter provider.

  • origin: string

    The origin of the federated server, including the scheme (http:// or https://) and the host (e.g., example.com:8080).

  • parseUri(uri: URL | null): ParseUriResult | null

    Determines the type of the URI and extracts the associated data.

  • routeActivity(
    recipient: string | null,
    activity: Activity,
    options?: RouteActivityOptions
    ): Promise<boolean>

    Manually routes an activity to the appropriate inbox listener.

  • sendActivity(
    sender:
    SenderKeyPair
    | SenderKeyPair[]
    | { identifier: string; }
    | { username: string; },
    recipients: Recipient | Recipient[],
    activity: Activity,
    options?: SendActivityOptions
    ): Promise<void>

    Sends an activity to recipients' inboxes.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider.

  • traverseCollection(
    collection: Collection,
    options?: TraverseCollectionOptions
    ): AsyncIterable<Object | Link>

    Traverses a collection, yielding each item in the collection. If the collection is paginated, it will fetch the next page automatically.

  • factor: number

    The factor to multiply the previous delay by for each retry. Defaults to 2.

  • initialDelay: Temporal.DurationLike

    The initial delay before the first retry. Defaults to 1 second.

  • jitter: boolean

    Whether to add jitter to the delay to avoid synchronization. Turned on by default.

  • maxAttempts: number

    The maximum number of attempts before giving up. Defaults to 10.

  • maxDelay: Temporal.DurationLike

    The maximum delay between retries. Defaults to 12 hours.

  • context:
    string
    | Record<string, string>
    | (string | Record<string, string>)[]

    The JSON-LD context to use for serializing the object to sign.

  • contextLoader: DocumentLoader

    The context loader for loading remote JSON-LD contexts.

  • created: Temporal.Instant

    The time when the proof was created. If not specified, the current time will be used.

I

Options for creating Linked Data Signatures.

  • contextLoader: DocumentLoader

    The context loader for loading remote JSON-LD contexts.

  • created: Temporal.Instant

    The time when the signature was created. If not specified, the current time will be used.

I

Additional settings for a custom collection dispatcher.

  • authorize(predicate: ObjectAuthorizePredicate<TContextData, string>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>

    Specifies the conditions under which requests are authorized.

  • setCounter(counter: CustomCollectionCounter<TParam, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>

    Sets the counter for the custom collection.

  • setFirstCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>

    Sets the first cursor for the custom collection.

  • setLastCursor(cursor: CustomCollectionCursor<TParam, TContext, TContextData>): CustomCollectionCallbackSetters<TParam, TContext, TContextData>

    Sets the last cursor for the custom collection.

  • contextLoader: DocumentLoader

    The context loader to use for JSON-LD context retrieval.

  • documentLoader: DocumentLoader

    The document loader to use for fetching the actor.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider to use for tracing. If omitted, the global tracer provider is used.

I

A common interface between Federation and FederationBuilder.

  • setActorDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: ActorDispatcher<TContextData>
    ): ActorCallbackSetters<TContextData>

    Registers an actor dispatcher.

  • setCollectionDispatcher<TObject extends Object, TParam extends string>(
    name: string | symbol,
    itemType: ConstructorWithTypeId<TObject>,
    path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`,
    dispatcher: CustomCollectionDispatcher<
    TObject,
    TParam,
    RequestContext<TContextData>,
    TContextData
    >
    ): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>

    Registers a collection of objects dispatcher.

  • setFeaturedDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: CollectionDispatcher<Object, RequestContext<TContextData>, TContextData, void>
    ): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>

    Registers a featured collection dispatcher.

  • setFeaturedTagsDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: CollectionDispatcher<Hashtag, RequestContext<TContextData>, TContextData, void>
    ): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>

    Registers a featured tags collection dispatcher.

  • setFollowersDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: CollectionDispatcher<Recipient, Context<TContextData>, TContextData, URL>
    ): CollectionCallbackSetters<Context<TContextData>, TContextData, URL>

    Registers a followers collection dispatcher.

  • setFollowingDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: CollectionDispatcher<
    Actor | URL,
    RequestContext<TContextData>,
    TContextData,
    void
    >
    ): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>

    Registers a following collection dispatcher.

  • setInboxDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>
    ): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>

    Registers an inbox dispatcher.

  • setInboxListeners(
    inboxPath: `${string}${Rfc6570Expression<"identifier">}${string}`,
    sharedInboxPath?: string
    ): InboxListenerSetters<TContextData>

    Assigns the URL path for the inbox and starts setting inbox listeners.

  • setLikedDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: CollectionDispatcher<
    Object | URL,
    RequestContext<TContextData>,
    TContextData,
    void
    >
    ): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>

    Registers a liked collection dispatcher.

  • setNodeInfoDispatcher(
    path: string,
    dispatcher: NodeInfoDispatcher<TContextData>
    ): void

    Registers a NodeInfo dispatcher.

  • setObjectDispatcher<TObject extends Object, TParam extends string>(
    cls: ConstructorWithTypeId<TObject>,
    path: `${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}{${TParam}}${string}`,
    dispatcher: ObjectDispatcher<TContextData, TObject, TParam>
    ): ObjectCallbackSetters<TContextData, TObject, TParam>

    Registers an object dispatcher.

  • setOrderedCollectionDispatcher<TObject extends Object, TParam extends string>(
    name: string | symbol,
    itemType: ConstructorWithTypeId<TObject>,
    path: `${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}${Rfc6570Expression<TParam>}${string}`,
    dispatcher: CustomCollectionDispatcher<
    TObject,
    TParam,
    RequestContext<TContextData>,
    TContextData
    >
    ): CustomCollectionCallbackSetters<TParam, RequestContext<TContextData>, TContextData>

    Registers an ordered collection of objects dispatcher.

  • setOutboxDispatcher(
    path: `${string}${Rfc6570Expression<"identifier">}${string}`,
    dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>
    ): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>

    Registers an outbox dispatcher.

  • setOutboxListeners(outboxPath: `${string}${Rfc6570Expression<"identifier">}${string}`): OutboxListenerSetters<TContextData>

    Assigns the URL path for the outbox and starts setting outbox listeners.

  • setOutboxPermanentFailureHandler(handler: OutboxPermanentFailureHandler<TContextData>): void

    Registers a handler for permanent delivery failures.

  • setWebFingerLinksDispatcher(dispatcher: WebFingerLinksDispatcher<TContextData>): void

    Registers a links dispatcher to WebFinger

I

An object that registers federation-related business logic and dispatches requests to the appropriate handlers.

  • createContext(
    baseUrl: URL,
    contextData: TContextData
    ): Context<TContextData>

    Create a new context.

  • fetch(
    request: Request,
    options: FederationFetchOptions<TContextData>
    ): Promise<Response>

    Handles a request related to federation. If a request is not related to federation, the onNotFound or onNotAcceptable callback is called.

  • processQueuedTask(
    contextData: TContextData,
    message: Message
    ): Promise<void>

    Processes a queued message task. This method handles different types of tasks such as fanout, outbox, and inbox messages.

  • startQueue(
    contextData: TContextData,
    options?: FederationStartQueueOptions
    ): Promise<void>

    Manually start the task queue.

I

Options for cooperative benchmark mode.

I

A builder for creating a Federation object. It defers the actual instantiation of the Federation object until the build method is called so that dispatchers and listeners can be registered before the Federation object is instantiated.

  • build(options: FederationOptions<TContextData>): Promise<Federation<TContextData>>

    Builds the federation object.

  • contextData: TContextData

    The context data to pass to the Context.

  • onNotAcceptable: (request: Request) => Response | Promise<Response>

    A callback to handle a request when the request's Accept header is not acceptable. If not provided, a 406 response is returned.

  • onNotFound: (request: Request) => Response | Promise<Response>

    A callback to handle a request when the route is not found. If not provided, a 404 response is returned.

  • onUnauthorized: (request: Request) => Response | Promise<Response>

    A callback to handle a request when the request is unauthorized. If not provided, a 401 response is returned.

I

Prefixes for namespacing keys in the Deno KV store.

  • The key prefix used for storing Accept-Signature challenge nonces. Only used when InboxChallengePolicy.requestNonce is true.

  • The key prefix used for storing whether activities have already been processed or not.

  • The key prefix used for storing outbound delivery circuit breaker state.

  • The key prefix used for caching HTTP Message Signatures specs. The cached spec is used to reduce the number of requests to make signed requests ("double-knocking" technique).

  • publicKey: KvKey

    The key prefix used for caching public keys.

  • The key prefix used for storing remote JSON-LD documents.

I

Options for creating a Federation object.

  • activityTransformers: readonly ActivityTransformer<TContextData>[]

    Activity transformers that are applied to outgoing activities. It is useful for adjusting outgoing activities to satisfy some ActivityPub implementations.

  • Whether to allow fetching private network addresses in the document loader.

  • authenticatedDocumentLoaderFactory: AuthenticatedDocumentLoaderFactory

    A factory function that creates an authenticated document loader for a given identity. This is used for fetching documents that require authentication.

  • benchmarkMode: boolean | FederationBenchmarkOptions

    Whether to enable cooperative benchmark mode. This mode exposes benchmark-only endpoints and relaxes selected defaults for benchmark targets. Pass an object to configure benchmark trigger delivery. Do not enable this option in production.

  • circuitBreaker: false | CircuitBreakerOptions

    The circuit breaker for queued outbound activity delivery. When enabled, Fedify tracks repeated failures per remote host and temporarily holds queued activities instead of repeatedly hammering an unreachable server.

  • contextLoaderFactory: DocumentLoaderFactory

    A custom JSON-LD context loader factory. By default, this uses the same loader as the document loader.

  • documentLoaderFactory: DocumentLoaderFactory

    A custom JSON-LD document loader factory. By default, this uses the built-in cache-backed loader that fetches remote documents over HTTP(S).

  • firstKnock: HttpMessageSignaturesSpec

    The HTTP Signatures specification to use for the first signature attempt when communicating with unknown servers. This option affects the "double-knocking" mechanism as described in the ActivityPub HTTP Signature documentation.

  • inboxChallengePolicy: InboxChallengePolicy

    The policy for emitting Accept-Signature challenges on inbox 401 responses (RFC 9421 §5). When enabled, failed HTTP Signature verification responses will include an Accept-Signature header telling the sender which components and parameters to include.

  • inboxRetryPolicy: RetryPolicy

    The retry policy for processing incoming activities. By default, this uses an exponential backoff strategy with a maximum of 10 attempts and a maximum delay of 12 hours.

  • kv: KvStore

    The key–value store used for caching, outbox queues, and inbox idempotence.

  • kvPrefixes: Partial<FederationKvPrefixes>

    Prefixes for namespacing keys in the Deno KV store. By default, all keys are prefixed with ["_fedify"].

  • Whether to start the task queue manually or automatically.

  • meterProvider: MeterProvider

    The OpenTelemetry meter provider for recording metrics. If not provided, the default global meter provider is used.

  • onOutboxError: OutboxErrorHandler

    A callback that handles errors during outbox processing. Note that this callback can be called multiple times for the same activity, because the delivery is retried according to the backoff schedule until it succeeds or reaches the maximum retry count.

  • origin: string | FederationOrigin

    The canonical base URL of the server. This is used for constructing absolute URLs and fediverse handles.

  • outboxRetryPolicy: RetryPolicy

    The retry policy for sending activities to recipients' inboxes. By default, this uses an exponential backoff strategy with a maximum of 10 attempts and a maximum delay of 12 hours.

  • permanentFailureStatusCodes: readonly number[]

    HTTP status codes that should be treated as permanent delivery failures. When an inbox returns one of these codes, the delivery will not be retried and the permanent failure handler (if registered via Federatable.setOutboxPermanentFailureHandler) will be called.

  • queue: FederationQueueOptions | MessageQueue

    The message queue for sending and receiving activities. If not provided, activities will not be queued and will be processed immediately.

  • signatureTimeWindow: Temporal.Duration | Temporal.DurationLike | false

    The time window for verifying HTTP Signatures of incoming requests. If the request is older or newer than this window, it is rejected. Or if it is false, the request's timestamp is not checked at all.

  • Whether to skip HTTP Signatures verification for incoming activities. This is useful for testing purposes, but should not be used in production.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider for tracing operations. If not provided, the default global tracer provider is used.

  • Whether the router should be insensitive to trailing slashes in the URL paths. For example, if this option is true, /foo and /foo/ are treated as the same path. Turned off by default.

  • userAgent: GetUserAgentOptions | string

    Options for making User-Agent strings for HTTP requests. If a string is provided, it is used as the User-Agent header. If an object is provided, it is passed to the getUserAgent function.

I

Options for FederationOptions.origin when it is not a string.

  • handleHost: string

    The canonical hostname for fediverse handles (which are looked up through WebFinger). This is used for WebFinger lookups. It has to be a valid hostname, e.g., "example.com".

  • webOrigin: string

    The canonical origin for web URLs. This is used for constructing absolute URLs. It has to start with either "http://" or "https://", and must not contain a path or query string, e.g., "https://example.com".

I

Configures the task queues for sending and receiving activities.

  • fanout: MessageQueue

    The message queue for fanning out outgoing activities. If not provided, outgoing activities will not be fanned out in the background, but will be fanned out immediately, which causes slow response times on Context.sendActivity calls.

  • inbox: MessageQueue

    The message queue for incoming activities. If not provided, incoming activities will not be queued and will be processed immediately.

  • outbox: MessageQueue

    The message queue for outgoing activities. If not provided, outgoing activities will not be queued and will be sent immediately.

  • queue: "inbox" | "outbox" | "fanout"

    Starts the task worker only for the specified queue. If unspecified, which is the default, the task worker starts for all three queues: inbox, outbox, and fanout.

  • signal: AbortSignal

    The signal to abort the task queue.

  • fetchError: FetchKeyErrorResult

    The error that occurred while fetching the key, if fetching failed before a document could be parsed.

  • contextLoader: DocumentLoader

    The context loader for loading remote JSON-LD contexts.

  • documentLoader: DocumentLoader

    The document loader for loading remote JSON-LD documents.

  • keyCache: KeyCache

    The key cache to use for caching public keys.

  • meterProvider: MeterProvider

    The OpenTelemetry meter provider to use for recording activitypub.key.lookup and activitypub.key.lookup.duration. If omitted, the global meter provider is used.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider to use for tracing. If omitted, the global tracer provider is used.

I

The result of fetchKey.

  • cached: boolean

    Whether the key is fetched from the cache.

  • key: T & { publicKey: CryptoKey; } | null

    The fetched (or cached) key.

I

The result of fulfillAcceptSignature. This can be used directly as the rfc9421 option of SignRequestOptions.

  • components: AcceptSignatureComponent[]

    The merged set of covered component identifiers, including all component parameters, ready to be passed to the signer.

  • expires: true

    If true, the challenger requested that the signer generate and include an expiration timestamp in the signature parameters.

  • label: string

    The label for the signature.

  • nonce: string

    The nonce requested by the challenge, if any.

  • tag: string

    The tag requested by the challenge, if any.

  • tombstone: "suppress" | "passthrough"

    Controls how tombstoned actors are returned.

  • contextLoader: DocumentLoader

    The context loader to use for JSON-LD context retrieval.

  • documentLoader: DocumentLoader

    The document loader to use for fetching the key and its owner.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider to use for tracing. If omitted, the global tracer provider is used.

I

Options for getNodeInfo function.

  • direct: boolean

    Whether to directly fetch the NodeInfo document from the given URL. Otherwise, the NodeInfo document will be fetched from the .well-known location of the given URL.

  • parse: "strict" | "best-effort" | "none"

    How strictly to parse the NodeInfo document.

  • userAgent: GetUserAgentOptions | string

    The options for making User-Agent header. If a string is given, it is used as the User-Agent header value. If an object is given, it is passed to getUserAgent to generate the User-Agent header value.

I

Options for Context.getSignedKey method.

  • contextLoader: DocumentLoader

    The context loader for loading remote JSON-LD contexts.

  • documentLoader: DocumentLoader

    The document loader for loading remote JSON-LD documents.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider. If omitted, the global tracer provider is used.

I

A spec determiner for HTTP Message Signatures. It determines the spec to use for signing requests. It is used for double-knocking (see https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions).

  • determineSpec(origin: string):
    HttpMessageSignaturesSpec
    | Promise<HttpMessageSignaturesSpec>

    Determines the spec to use for signing requests.

  • rememberSpec(
    origin: string,
    spec: HttpMessageSignaturesSpec
    ): void | Promise<void>

    Remembers the successfully used spec for the given origin.

I

Policy for emitting Accept-Signature challenges on inbox 401 responses, as defined in RFC 9421 §5.

  • components: string[]

    The covered component identifiers to request. Only request-applicable identifiers should be used (@status is automatically excluded).

  • enabled: boolean

    Whether to emit Accept-Signature headers on 401 responses caused by HTTP Signature verification failures.

  • The time-to-live (in seconds) for stored nonces. After this period, nonces expire and are no longer accepted.

  • requestNonce: boolean

    Whether to generate and require a one-time nonce for replay protection. When enabled, a cryptographically random nonce is included in each challenge and verified on subsequent requests. Requires a KvStore.

I

A context for inbox listeners.

  • clone(data: TContextData): InboxContext<TContextData>

    Creates a new context with the same properties as this one, but with the given data.

  • forwardActivity(
    forwarder:
    SenderKeyPair
    | SenderKeyPair[]
    | { identifier: string; }
    | { username: string; },
    recipients: Recipient | Recipient[],
    options?: ForwardActivityOptions
    ): Promise<void>

    Forwards a received activity to the recipients' inboxes. The forwarded activity will be signed in HTTP Signatures by the forwarder, but its payload will not be modified, i.e., Linked Data Signatures and Object Integrity Proofs will not be added. Even when Fedify internally normalizes a Linked Data Signature activity for parsing, this method still forwards the original received payload so the sender's signatures/proofs are preserved as-is. Therefore, if the activity is not signed (i.e., it has neither Linked Data Signatures nor Object Integrity Proofs), the recipient probably will not trust the activity.

  • recipient: string | null

    The identifier of the recipient of the inbox. If the inbox is a shared inbox, it is null.

I

Registry for inbox listeners for different activity types.

  • on<TActivity extends Activity>(
    type: new (...args: any[]) => TActivity,
    listener: InboxListener<TContextData, TActivity>
    ): InboxListenerSetters<TContextData>

    Registers a listener for a specific incoming activity type.

  • onError(handler: InboxErrorHandler<TContextData>): InboxListenerSetters<TContextData>

    Registers an error handler for inbox listeners. Any exceptions thrown from the listeners are caught and passed to this handler.

  • onUnverifiedActivity(handler: UnverifiedActivityHandler<TContextData>): InboxListenerSetters<TContextData>

    Registers a callback for incoming activities whose HTTP signatures could not be verified.

  • setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>

    Configures a callback to dispatch the key pair for the authenticated document loader of the Context passed to the shared inbox listener.

  • withIdempotency(strategy: IdempotencyStrategy | IdempotencyKeyCallback<TContextData>): InboxListenerSetters<TContextData>

    Configures the strategy for handling activity idempotency in inbox processing.

  • pollInterval: Temporal.Duration | Temporal.DurationLike

    The interval to poll for messages in the queue. 5 seconds by default.

I

A cache for storing cryptographic keys.

  • get(keyId: URL): Promise<CryptographicKey | Multikey | null | undefined>

    Gets a key from the cache.

  • set(
    keyId: URL,
    key: CryptographicKey | Multikey | null
    ): Promise<void>

    Sets a key to the cache.

I

An abstract interface for a key–value store.

  • cas: (
    key: KvKey,
    expectedValue: unknown,
    newValue: unknown,
    options?: KvStoreSetOptions
    ) => Promise<boolean>

    Compare-and-swap (CAS) operation for the key–value store.

  • delete(key: KvKey): Promise<void>

    Deletes the value for the given key.

  • get<T = unknown>(key: KvKey): Promise<T | undefined>

    Gets the value for the given key.

  • list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>

    Lists all entries in the store that match the given prefix. If no prefix is given, all entries are returned.

  • set(
    key: KvKey,
    value: unknown,
    options?: KvStoreSetOptions
    ): Promise<void>

    Sets the value for the given key.

I

An entry returned by the KvStore.list method.

  • key: KvKey

    The key of the entry.

  • value: unknown

    The value of the entry.

I

Additional options for setting a value in a key–value store.

  • ttl: Temporal.Duration

    The time-to-live (TTL) for the value.

I

An abstract interface for a message queue.

  • enqueue(
    message: any,
    options?: MessageQueueEnqueueOptions
    ): Promise<void>

    Enqueues a message in the queue.

  • enqueueMany: (
    messages: readonly any[],
    options?: MessageQueueEnqueueOptions
    ) => Promise<void>

    Enqueues multiple messages in the queue. This operation is optional, and may not be supported by all implementations. If not supported, Fedify will invoke enqueue for each message.

  • getDepth(): Promise<MessageQueueDepth>

    Gets the number of messages waiting in the queue.

  • listen(
    handler: (message: any) => Promise<void> | void,
    options?: MessageQueueListenOptions
    ): Promise<void>

    Listens for messages in the queue.

  • nativeRetrial: boolean

    Whether the message queue backend provides native retry mechanisms. When true, Fedify will skip its own retry logic and rely on the backend to handle retries. When false or omitted, Fedify will handle retries using its own retry policies.

I

The number of messages waiting in a message queue.

  • delayed: number

    The number of queued messages scheduled for later delivery.

  • queued: number

    The total number of messages still waiting in the backend queue.

  • ready: number

    The number of queued messages eligible for immediate processing.

I

Additional options for enqueuing a message in a queue.

  • delay: Temporal.Duration

    The delay before the message is enqueued. No delay by default.

  • orderingKey: string

    An optional key that ensures messages with the same ordering key are processed sequentially (one at a time). Messages with different ordering keys (or no ordering key) may be processed in parallel.

I

Additional options for listening to a message queue.

  • signal: AbortSignal

    The signal to abort listening to the message queue.

I

A NodeInfo object as defined in the NodeInfo 2.1 schema.

  • metadata: Readonly<Record<string, JsonValue>>

    Free form key value pairs for software specific values. Clients should not rely on any specific key present.

  • Whether this server allows open self-registration. Defaults to false.

  • protocols: readonly Protocol[]

    The protocols supported on this server. At least one protocol must be supported.

  • services: Services

    The third party sites this server can connect to via their application API.

  • software: Software

    Metadata about server software in use.

  • usage: Usage

    Usage statistics for this server.

I

Additional settings for an object dispatcher.

  • authorize(predicate: ObjectAuthorizePredicate<TContextData, TParam>): ObjectCallbackSetters<TContextData, TObject, TParam>

    Specifies the conditions under which requests are authorized.

I

A context for outbox listeners.

  • clone(data: TContextData): OutboxContext<TContextData>

    Creates a new context with the same properties as this one, but with the given data.

  • forwardActivity(
    forwarder:
    SenderKeyPair
    | SenderKeyPair[]
    | { identifier: string; }
    | { username: string; },
    recipients: Recipient | Recipient[],
    options?: ForwardActivityOptions
    ): Promise<void>

    Forwards a posted activity to the recipients' inboxes without re-serializing the original payload. The forwarded activity will be signed in HTTP Signatures by the forwarder, but its payload will not be modified, i.e., Linked Data Signatures and Object Integrity Proofs will not be added. Therefore, if the posted activity is not signed (i.e., it has neither Linked Data Signatures nor Object Integrity Proofs), the recipients probably will not trust the activity.

  • Indicates whether the posted activity has been delivered during the current outbox listener invocation.

  • identifier: string

    The identifier of the actor whose outbox received the POST.

I

Registry for outbox listeners for different activity types.

  • authorize(predicate: AuthorizePredicate<TContextData>): OutboxListenerSetters<TContextData>

    Registers a callback to authorize POST requests to the outbox.

  • on<TActivity extends Activity>(
    type: new (...args: any[]) => TActivity,
    listener: OutboxListener<TContextData, TActivity>
    ): OutboxListenerSetters<TContextData>

    Registers a listener for a specific incoming activity type.

  • onError(handler: OutboxListenerErrorHandler<TContextData>): OutboxListenerSetters<TContextData>

    Registers an error handler for outbox listeners. Any exceptions thrown from the listeners are caught and passed to this handler.

I

A page of items.

  • items: readonly TItem[]
    No documentation available
  • nextCursor: string | null
    No documentation available
  • prevCursor: string | null
    No documentation available
I

Options for parseNodeInfo function.

  • tryBestEffort: boolean

    Whether to try to parse the NodeInfo document even if it is invalid. If turned on, the function will return a best-effort result.

I

A context for a request.

  • clone(data: TContextData): RequestContext<TContextData>

    Creates a new context with the same properties as this one, but with the given data.

  • getActor(identifier: string): Promise<Actor | null>

    Gets an Actor object for the given identifier.

  • getObject<TObject extends Object>(
    cls: ConstructorWithTypeId<TObject>,
    values: Record<string, string>
    ): Promise<TObject | null>

    Gets an object of the given class with the given values.

  • getSignedKey(): Promise<CryptographicKey | null>

    Gets the public key of the sender, if any exists and it is verified. Otherwise, null is returned.

  • getSignedKeyOwner(): Promise<Actor | null>

    Gets the owner of the signed key, if any exists and it is verified. Otherwise, null is returned.

  • request: Request

    The request object.

  • url: URL

    The URL of the request.

  • contextLoader: DocumentLoader

    The document loader to use for compacting JSON-LD.

I

The context passed to a RetryPolicy callback.

  • attempts: number

    The number of attempts so far.

  • elapsedTime: Temporal.Duration

    The elapsed time since the first attempt.

I

Options for customizing the RFC 9421 signature label, covered components, and metadata parameters. These are typically derived from an Accept-Signature challenge.

  • components: AcceptSignatureComponent[]

    The covered component identifiers. When omitted, the default set ["@method", "@target-uri", "@authority", "host", "date"] (plus "content-digest" when a body is present) is used.

  • expires: true

    If true, an expiration timestamp is generated and included in the signature parameters. The expiration time defaults to one hour after the signature creation time.

  • label: string

    The label for the signature in Signature-Input and Signature headers.

  • nonce: string

    A nonce value to include in the signature parameters.

  • tag: string

    A tag value to include in the signature parameters.

  • contextLoader: DocumentLoader

    The context loader for loading remote JSON-LD contexts.

  • documentLoader: DocumentLoader

    The document loader for loading remote JSON-LD documents.

  • immediate: boolean

    Whether to skip enqueuing the activity and invoke the listener immediately. If no inbox queue is available, this option is ignored and the activity will be always invoked immediately.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider. If omitted, the global tracer provider is used.

  • excludeBaseUris: readonly URL[]

    The base URIs to exclude from the recipients' inboxes. It is useful for excluding the recipients having the same shared inbox with the sender.

  • fanout: "auto" | "skip" | "force"

    Determines how activities are queued when sent to multiple recipients.

  • immediate: boolean

    Whether to send the activity immediately, without enqueuing it. If true, the activity will be sent immediately and the retrial policy will not be applied.

  • Whether to apply Fedify's outgoing JSON-LD wire-format compatibility fixes to activities that already carry Object Integrity Proofs.

  • orderingKey: string

    An optional key to ensure ordered delivery of activities. Activities with the same orderingKey are guaranteed to be delivered in the order they were enqueued, per recipient server.

  • Whether to prefer the shared inbox for the recipients.

I

Options for Context.sendActivity method when sending to a collection.

  • Whether to synchronize the collection using Collection-Synchronization header (FEP-8fcf).

I

A key pair for an actor who sends an activity.

  • keyId: URL

    The public key ID that corresponds to the private key.

  • privateKey: CryptoKey

    The actor's private key to sign the request.

I

The third party sites this server can connect to via their application API.

  • inbound: readonly InboundService[]

    The third party sites this server can retrieve messages from for combined display with regular traffic.

  • outbound: readonly OutboundService[]

    The third party sites this server can publish messages to on the behalf of a user.

I

Options for signing JSON-LD documents.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider for tracing the signing process. If omitted, the global tracer provider is used.

  • documentLoader: DocumentLoader

    The document loader for loading remote JSON-LD documents.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider. If omitted, the global tracer provider is used.

  • body: ArrayBuffer | null

    The request body as ArrayBuffer. If provided, avoids cloning the request body.

  • currentTime: Temporal.Instant

    The current time. If not specified, the current time is used. This is useful for testing.

  • rfc9421: Rfc9421SignRequestOptions

    Options specific to the RFC 9421 signing path. These options are ignored when spec is "draft-cavage-http-signatures-12".

  • spec: HttpMessageSignaturesSpec

    The HTTP message signatures specification to use for signing.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider. If omitted, the global tracer provider is used.

I

Metadata about server software in use.

  • The URL of the homepage of this server software.

  • name: string

    The canonical name of this server software. This must comply with pattern /^[a-z0-9-]+$/.

  • The URL of the source code repository of this server software.

  • version: string

    The version of this server software.

I

Usage statistics for this server.

  • The amount of comments that were made by users that are registered on this server. This number has to be an integer greater than or equal to zero.

  • localPosts: number

    The amount of posts that were made by users that are registered on this server. This number has to be an integer greater than or equal to zero.

  • users: { readonly total?: number; readonly activeHalfyear?: number; readonly activeMonth?: number; }

    Statistics about the users of this server.

I

Options for verifying JSON-LD documents.

  • contextLoader: DocumentLoader

    The context loader for loading remote JSON-LD contexts.

  • documentLoader: DocumentLoader

    The document loader for loading remote JSON-LD documents.

  • keyCache: KeyCache

    The key cache to use for caching public keys.

  • meterProvider: MeterProvider

    The OpenTelemetry meter provider. If omitted, the global meter provider is used.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider. If omitted, the global tracer provider is used.

  • contextLoader: DocumentLoader

    The context loader to use for JSON-LD context retrieval.

  • currentTime: Temporal.Instant

    The current time. If not specified, the current time is used. This is useful for testing.

  • documentLoader: DocumentLoader

    The document loader to use for fetching the public key.

  • keyCache: KeyCache

    The key cache to use for caching public keys.

  • meterProvider: MeterProvider

    The OpenTelemetry meter provider. If omitted, the global meter provider is used.

  • spec: HttpMessageSignaturesSpec

    The HTTP message signatures specification to use for verifying.

  • timeWindow: Temporal.Duration | Temporal.DurationLike | false

    The time window to allow for the request date. The actual time window is twice the value of this option, with the current time as the center. Or if it is false, no time check is performed.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider. If omitted, the global tracer provider is used.

I

Options for verifying Linked Data Signatures.

  • contextLoader: DocumentLoader

    The context loader to use for JSON-LD context retrieval.

  • documentLoader: DocumentLoader

    The document loader to use for fetching the public key.

  • keyCache: KeyCache

    The key cache to use for caching public keys.

  • meterProvider: MeterProvider

    The OpenTelemetry meter provider. If omitted, the global meter provider is used.

  • tracerProvider: TracerProvider

    The OpenTelemetry tracer provider for tracing the verification process. If omitted, the global tracer provider is used.

  • actorAliasMapper: ActorAliasMapper<TContextData>

    The callback for mapping a WebFinger query to the corresponding actor's internal identifier or username, or null if the query is not found.

  • actorDispatcher: ActorDispatcher<TContextData>

    The callback for dispatching the actor.

  • actorHandleMapper: ActorHandleMapper<TContextData>

    The callback for mapping a WebFinger username to the corresponding actor's internal identifier, or null if the username is not found.

  • context: RequestContext<TContextData>

    The request context.

  • host: string

    The canonical hostname of the server, if it's explicitly configured.

  • meterProvider: MeterProvider

    The OpenTelemetry meter provider used to record the webfinger.handle counter and webfinger.handle.duration histogram. When omitted, no WebFinger-specific measurements are emitted (the request still contributes to fedify.http.server.request.* because that metric is recorded one layer up in Federation.fetch).

  • onNotFound(request: Request): Response | Promise<Response>

    The function to call when the actor is not found.

  • span: Span

    The span for the request.

  • tracer: Tracer

    The OpenTelemetry tracer.

  • webFingerLinksDispatcher: WebFingerLinksDispatcher<TContextData>

    The callback for dispatching the Links of webFinger.

I

Options for the Router.

I

The result of Router.route method.

Type Aliases

T
ActivityTransformer<TContextData> = (
activity: Activity,
context: Context<TContextData>
) => Activity

A function that transforms an activity object.

T
ActorAliasMapper<TContextData> = (
context: RequestContext<TContextData>,
resource: URL
) =>
{ identifier: string; }
| { username: string; }
| null
| Promise<{ identifier: string; } | { username: string; } | null>

A callback that maps a WebFinger query to the corresponding actor's internal identifier or username, or null if the query is not found.

T
ActorDispatcher<TContextData> = (
context: RequestContext<TContextData>,
identifier: string
) => Actor | Tombstone | null | Promise<Actor | Tombstone | null>

A callback that dispatches an Actor object or a Tombstone.

T
ActorHandleMapper<TContextData> = (
context: Context<TContextData>,
username: string
) => string | null | Promise<string | null>

A callback that maps a WebFinger username to the corresponding actor's internal identifier, or null if the username is not found.

T
ActorKeyPairsDispatcher<TContextData> = (
context: Context<TContextData>,
identifier: string
) => CryptoKeyPair[] | Promise<CryptoKeyPair[]>

A callback that dispatches key pairs for an actor.

T
AuthorizePredicate<TContextData> = (
context: RequestContext<TContextData>,
identifier: string
) => boolean | Promise<boolean>

A callback that determines if a request is authorized or not.

T
CircuitBreakerFailurePolicy =
{ readonly failureThreshold?: never; readonly failureWindow?: never; failure(timestamps: readonly Temporal.Instant[]): boolean; }
| { readonly failure?: never; readonly failureThreshold?: number; readonly failureWindow?: Temporal.Duration | Temporal.DurationLike; }

Configures how a remote host circuit opens after repeated delivery failures.

T
CircuitBreakerOptions =
CircuitBreakerFailurePolicy
& { readonly recoveryDelay?: Temporal.Duration | Temporal.DurationLike; readonly heldActivityTtl?: Temporal.Duration | Temporal.DurationLike; readonly releaseInterval?: Temporal.Duration | Temporal.DurationLike; readonly stateTtl?: Temporal.Duration | Temporal.DurationLike; readonly onStateChange?: (
remoteHost: string,
previousState: CircuitBreakerState,
newState: CircuitBreakerState
) => void | Promise<void>
; readonly onActivityDrop?: (
remoteHost: string,
details: CircuitBreakerActivityDrop
) => void | Promise<void>
; }

Options for Fedify's outbound activity circuit breaker.

T
CircuitBreakerState = "closed" | "open" | "half-open"

The state of a remote host circuit breaker.

T
CollectionCounter<TContextData, TFilter> = (
context: RequestContext<TContextData>,
identifier: string,
filter?: TFilter
) => number | bigint | null | Promise<number | bigint | null>

A callback that counts the number of items in a collection.

T
CollectionCursor<
TContext extends Context<TContextData>,
TContextData,
TFilter
>
= (
context: TContext,
identifier: string,
filter?: TFilter
) => string | null | Promise<string | null>

A callback that returns a cursor for a collection.

T
CollectionDispatcher<
TItem,
TContext extends Context<TContextData>,
TContextData,
TFilter
>
= (
context: TContext,
identifier: string,
cursor: string | null,
filter?: TFilter
) => PageItems<TItem> | null | Promise<PageItems<TItem> | null>

A callback that dispatches a collection.

T
ConstructorWithTypeId<TObject extends Object> = (new (...args: any[]) => TObject) & { typeId: URL; }

Represents an object with a type ID, which is either a constructor or an instance of the object.

T
CustomCollectionCounter<TParam extends string, TContextData> = (
context: RequestContext<TContextData>,
values: Record<TParam, string>
) => number | bigint | null | Promise<number | bigint | null>

A callback that counts the number of items in a custom collection.

T
CustomCollectionCursor<
TParam extends string,
TContext extends Context<TContextData>,
TContextData
>
= (
context: TContext,
values: Record<TParam, string>
) => string | null | Promise<string | null>

A callback that returns a cursor for a custom collection.

T
CustomCollectionDispatcher<
TItem,
TParam extends string,
TContext extends Context<TContextData>,
TContextData
>
= (
context: TContext,
values: Record<TParam, string>,
cursor: string | null
) => PageItems<TItem> | null | Promise<PageItems<TItem> | null>

A callback that dispatches a custom collection.

T
FetchKeyErrorResult =
{ readonly status: number; readonly response: Response; }
| { readonly error: Error; }

Detailed fetch failure information from fetchKeyDetailed.

T
ForwardActivityOptions =
Omit<SendActivityOptions, "fanout">
& { skipIfUnsigned: boolean; }

Options for InboxContext.forwardActivity method.

T
HttpMessageSignaturesSpec = "draft-cavage-http-signatures-12" | "rfc9421"

The standard to use for signing and verifying HTTP signatures.

T
IdempotencyKeyCallback<TContextData> = (
ctx: InboxContext<TContextData>,
activity: Activity
) => string | null | Promise<string | null>

A callback to generate a custom idempotency key for an activity. Returns the cache key to use, or null to skip idempotency checking.

T
IdempotencyStrategy = "global" | "per-origin" | "per-inbox"

The strategy for handling activity idempotency in inbox processing.

T
InboundService =
"atom1.0"
| "gnusocial"
| "imap"
| "pnut"
| "pop3"
| "pumpio"
| "rss2.0"
| "twitter"

The third party sites this server can retrieve messages from for combined display with regular traffic.

T
InboxErrorHandler<TContextData> = (
context: Context<TContextData>,
error: Error
) => void | Promise<void>

A callback that handles errors in an inbox.

T
InboxListener<TContextData, TActivity extends Activity> = (
context: InboxContext<TContextData>,
activity: TActivity
) => void | Promise<void>

A callback that listens for activities in an inbox.

T
JsonValue =
{ [key: string]: JsonValue | undefined; }
| JsonValue[]
| string
| number
| boolean
| null

The type of the result of parsing JSON.

T
KvKey = readonly [string] | readonly [string, ...string[]]

A key for a key–value store. An array of one or more strings.

T
Message = FanoutMessage | OutboxMessage | InboxMessage

A message that represents a task to be processed by the background worker. The concrete type of the message depends on the type property.

T
NodeInfoDispatcher<TContextData> = (context: RequestContext<TContextData>) => NodeInfo | Promise<NodeInfo>

A callback that dispatches a NodeInfo object.

T
ObjectAuthorizePredicate<TContextData, TParam extends string> = (
context: RequestContext<TContextData>,
values: Record<TParam, string>
) => boolean | Promise<boolean>

A callback that determines if a request is authorized or not.

T
ObjectDispatcher<
TContextData,
TObject extends Object,
TParam extends string
>
= (
context: RequestContext<TContextData>,
values: Record<TParam, string>
) => TObject | null | Promise<TObject | null>

A callback that dispatches an object.

T
OutboundService =
"atom1.0"
| "blogger"
| "buddycloud"
| "diaspora"
| "dreamwidth"
| "drupal"
| "facebook"
| "friendica"
| "gnusocial"
| "google"
| "insanejournal"
| "libertree"
| "linkedin"
| "livejournal"
| "mediagoblin"
| "myspace"
| "pinterest"
| "pnut"
| "posterous"
| "pumpio"
| "redmatrix"
| "rss2.0"
| "smtp"
| "tent"
| "tumblr"
| "twitter"
| "wordpress"
| "xmpp"

The third party sites this server can publish messages to on the behalf of a user.

T
OutboxErrorHandler = (
error: Error,
activity: Activity | null
) => void | Promise<void>

A callback that handles errors during outbox processing.

T
OutboxListener<TContextData, TActivity extends Activity> = (
context: OutboxContext<TContextData>,
activity: TActivity
) => void | Promise<void>

A callback that listens for activities in an outbox.

T
OutboxListenerErrorHandler<TContextData> = (
context: OutboxContext<TContextData>,
error: Error
) => void | Promise<void>

A callback that handles errors in an outbox listener.

T
OutboxPermanentFailureHandler<TContextData> = (
context: Context<TContextData>,
values: { readonly reason: "http" | "circuit-breaker-ttl"; readonly inbox: URL; readonly activity: Activity; readonly error: SendActivityError; readonly statusCode: number; readonly circuitHeldSince?: Temporal.Instant; readonly actorIds: readonly URL[]; }
) => void | Promise<void>

A callback that handles permanent delivery failures when sending activities to remote inboxes.

T
ParseUriResult =
{ readonly type: "actor"; readonly identifier: string; }
| { readonly type: "object"; readonly class: ConstructorWithTypeId<Object>; readonly typeId: URL; readonly values: Record<string, string>; }
| { readonly type: "inbox"; readonly identifier: undefined; }
| { readonly type: "inbox"; readonly identifier: string; }
| { readonly type: "outbox"; readonly identifier: string; }
| { readonly type: "following"; readonly identifier: string; }
| { readonly type: "followers"; readonly identifier: string; }
| { readonly type: "liked"; readonly identifier: string; }
| { readonly type: "featured"; readonly identifier: string; }
| { readonly type: "featuredTags"; readonly identifier: string; }
| { readonly type: "collection"; readonly name: string | symbol; readonly class: ConstructorWithTypeId<Object>; readonly typeId: URL; readonly values: Record<string, string>; }
| { readonly type: "orderedCollection"; readonly name: string | symbol; readonly class: ConstructorWithTypeId<Object>; readonly typeId: URL; readonly values: Record<string, string>; }

A result of parsing an URI.

T
Protocol =
"activitypub"
| "buddycloud"
| "dfrn"
| "diaspora"
| "libertree"
| "ostatus"
| "pumpio"
| "tent"
| "xmpp"
| "zot"

The protocols supported on this server.

T
RetryPolicy = (context: RetryContext) => Temporal.Duration | null

A policy that determines the delay before the next retry.

T
Rfc6570Expression<Param extends string> =
`{${Param}}`
| `{+${Param}}`
| `{#${Param}}`
| `{.${Param}}`
| `{/${Param}}`
| `{;${Param}}`
| `{?${Param}}`
| `{&${Param}}`

Defines a union of all valid RFC 6570 URI Template expressions for a given parameter name.

T
SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =>
SenderKeyPair
| { identifier: string; }
| { username: string; }
| null
| Promise<
SenderKeyPair
| { identifier: string; }
| { username: string; }
| null
>

A callback that dispatches the key pair for the authenticated document loader of the Context passed to the shared inbox listener.

T
UnverifiedActivityHandler<TContextData> = (
context: RequestContext<TContextData>,
activity: Activity,
reason: UnverifiedActivityReason
) => void | Response | Promise<void | Response>

A callback that handles activities whose signatures could not be verified.

T
UnverifiedActivityReason = VerifyRequestFailureReason

The reason why an incoming activity could not be verified.

T
VerifyRequestDetailedResult =
{ readonly verified: true; readonly key: CryptographicKey; readonly signatureLabel?: string; }
| { readonly verified: false; readonly reason: VerifyRequestFailureReason; }

The detailed result of verifyRequestDetailed.

T
VerifyRequestFailureReason =
{ readonly type: "keyFetchError"; readonly keyId: URL; readonly result: FetchKeyErrorResult; }
| { readonly type: "invalidSignature"; readonly keyId?: URL; }
| { readonly type: "noSignature"; }

The reason why verifyRequestDetailed could not verify a request.

T
WebFingerLinksDispatcher<TContextData> = (
context: RequestContext<TContextData>,
resource: URL
) => readonly Link[] | Promise<readonly Link[]>

A callback that dispatches a array of Link.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import * as mod from "@fedify/fedify";
or

Import directly with a jsr specifier

import * as mod from "jsr:@fedify/fedify";