Skip to main content

Built and signed on GitHub Actions

Works with
This package works with Node.js, Deno, BunIt is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score100%
License
MIT
Downloads33/wk
Published14 hours ago (2.3.8)

ActivityPub relay support for Fedify

Functions

f
createRelay(
type: RelayType,
options: RelayOptions
): Relay

Factory function to create a relay instance.

Interfaces

I

Public interface for ActivityPub relay implementations. Use createRelay to create a relay instance.

  • fetch(request: Request): Promise<Response>

    Handle incoming HTTP requests.

  • getActorUri(): Promise<URL>

    Gets the URI of the relay actor.

  • getFollower(actorId: string): Promise<RelayFollower | null>

    Gets a specific follower by actor ID.

  • getSharedInboxUri(): Promise<URL>

    Gets the shared inbox URI of the relay.

  • listFollowers(): AsyncIterableIterator<RelayFollower>

    Lists all followers of the relay.

I

A follower of the relay with validated Actor instance. This is the public API type returned by follower query methods.

  • actor: Actor

    The validated Actor object.

  • actorId: string

    The actor ID (URL) of the follower.

  • state: "pending" | "accepted"

    The follower's state.

I

Configuration options for the ActivityPub relay.

  • authenticatedDocumentLoaderFactory: AuthenticatedDocumentLoaderFactory

    Factory function for creating an authenticated document loader that signs HTTP requests when fetching remote objects.

  • documentLoaderFactory: DocumentLoaderFactory

    Factory function for creating a document loader to fetch remote ActivityPub objects.

  • kv: KvStore

    Key-value store for persisting relay data such as follower information and cryptographic keys.

  • name: string

    Display name for the relay actor. Defaults to "ActivityPub Relay".

  • origin: string

    The origin URL where the relay is hosted. Must be a full URL including the protocol (e.g., "https://relay.example.com").

  • queue: MessageQueue

    Message queue for background activity processing. Recommended for production to handle activity forwarding asynchronously.

  • subscriptionHandler: SubscriptionRequestHandler

    Handler function that determines whether to approve or reject subscription requests from remote actors. Return true to approve or false to reject.

Type Aliases

T
RelayType = "mastodon" | "litepub"

Supported relay types.

T
SubscriptionRequestHandler = (
ctx: Context<RelayOptions>,
clientActor: Actor
) => Promise<boolean>

Handler for subscription requests (Follow/Undo activities).

Variables

v
No documentation available

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/relay

Import symbol

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

Import directly with a jsr specifier

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