Skip to main content
This release is a pre-release — the latest non-prerelease version of @fedify/fedify is 0.11.3. Jump to this version

@fedify/fedify@0.12.0-dev.278+8699f21b
Built and signed on GitHub Actions

An ActivityPub/fediverse server framework

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 Score
100%
Published
2 weeks ago (0.12.0-dev.278+8699f21b)
interface Context

A context.

Type Parameters

TContextData

Properties

readonly
origin: string

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

readonly
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.

readonly
hostname: string

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

The user-defined data associated with the context.

readonly
documentLoader: DocumentLoader

The document loader for loading remote JSON-LD documents.

readonly
contextLoader: DocumentLoader

The context loader for loading remote JSON-LD contexts.

Methods

Builds the URI of the NodeInfo document.

Builds the URI of an actor with the given handle.

getObjectUri<TObject extends Object>(
cls: (new (...args: any[]) => TObject) & { typeId: URL; },
values: Record<string, string>,
): URL

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

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

Builds the URI of the shared inbox.

Builds the URI of an actor's inbox with the given handle.

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

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

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

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

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

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

deprecated
getHandleFromActorUri(actorUri: URL): string | null

Extracts the actor's handle from an actor URI, if it is a valid actor URI.

Gets the key pairs for an actor.

deprecated
getActorKey(handle: string): Promise<CryptographicKey | null>

Gets a public RSA-PKCS#1-v1.5 CryptographicKey for an actor, if any exists.

getDocumentLoader(identity: { handle: string; }): Promise<DocumentLoader>

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

getDocumentLoader(identity: { keyId: URL; privateKey: CryptoKey; }): DocumentLoader

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

sendActivity(
sender: ,
recipients: Recipient | Recipient[],
activity: Activity,
): Promise<void>

Sends an activity to recipients' inboxes.

Add Package

deno add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify/federation";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify/federation";

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify/federation";

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify/federation";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { type Context } from "@fedify/fedify/federation";