Skip to main content

Built and signed on GitHub Actions

Federation types, validators and cryptography for Versia server implementations.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
52%
Published
2 days ago (0.1.1)
class FederationRequester

Class to handle requests to a remote server.

Examples

const requester = new FederationRequester( new SignatureConstructor(privateKey, keyId), );

const { data, ok } = await requester.get("/users/1");

if (!ok) { console.error(data); }

console.log(data);

Constructors

new
FederationRequester(
signatureConstructor?: SignatureConstructor,
globalCatch?: (error: ResponseError) => void,
)

Methods

private
constructRequest(
url: string | URL,
method: HttpVerb,
body?: object | FormData,
extra?: RequestInit,
): Promise<Request>
get<ReturnType>(
url: string | URL,
extra?: RequestInit,
): Promise<Output<ReturnType>>

Make a GET request to a URL.

post<ReturnType>(
url: string | URL,
body: object,
extra?: RequestInit,
): Promise<Output<ReturnType>>

Make a POST request to a URL.

private
request<ReturnType>(request: Request): Promise<Output<ReturnType>>
webFinger(
username: string,
hostname: string,
contentType?: string,
serverUrl?: string,
): Promise<string>

Get the user's profile link from their username.

Add Package

deno add jsr:@versia/federation

Import symbol

import { FederationRequester } from "@versia/federation";

---- OR ----

Import directly with a jsr specifier

import { FederationRequester } from "jsr:@versia/federation";

Add Package

npx jsr add @versia/federation

Import symbol

import { FederationRequester } from "@versia/federation";

Add Package

yarn dlx jsr add @versia/federation

Import symbol

import { FederationRequester } from "@versia/federation";

Add Package

pnpm dlx jsr add @versia/federation

Import symbol

import { FederationRequester } from "@versia/federation";

Add Package

bunx jsr add @versia/federation

Import symbol

import { FederationRequester } from "@versia/federation";