Skip to main content
This release is 3 versions behind 1.3.3 — the latest version of @fedify/fedify. Jump to latest

@fedify/fedify@1.3.0-dev.578+6bbdcb1d
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 months ago (1.3.0-dev.578+6bbdcb1d)
function getActorHandle
getActorHandle(
actor: Actor | URL,
): Promise<`@${string}@${string}` | `${string}@${string}`>

Gets the actor handle, of the form @username@domain, from the given actor or an actor URI.

Examples

Example 1

// Get the handle of an actor object:
await getActorHandle(
  new Person({ id: new URL("https://fosstodon.org/users/hongminhee") })
);

// Get the handle of an actor URI:
await getActorHandle(new URL("https://fosstodon.org/users/hongminhee"));

Parameters

actor: Actor | URL

The actor or actor URI to get the handle from.

optional
options: GetActorHandleOptions

The extra options for getting the actor handle.

Return Type

Promise<`@${string}@${string}` | `${string}@${string}`>

The actor handle. It starts with @ and is followed by the username and domain, separated by @ by default (it can be customized with the options).

Throws

TypeError

If the actor does not have enough information to get the handle.

Add Package

deno add jsr:@fedify/fedify

Import symbol

import { getActorHandle } from "@fedify/fedify";

---- OR ----

Import directly with a jsr specifier

import { getActorHandle } from "jsr:@fedify/fedify";

Add Package

npx jsr add @fedify/fedify

Import symbol

import { getActorHandle } from "@fedify/fedify";

Add Package

yarn dlx jsr add @fedify/fedify

Import symbol

import { getActorHandle } from "@fedify/fedify";

Add Package

pnpm dlx jsr add @fedify/fedify

Import symbol

import { getActorHandle } from "@fedify/fedify";

Add Package

bunx jsr add @fedify/fedify

Import symbol

import { getActorHandle } from "@fedify/fedify";