@fedify/fedify
Version:
An ActivityPub server framework
67 lines (66 loc) • 2.16 kB
text/typescript
/// <reference lib="esnext.temporal" />
import { Activity, Actor, CryptographicKey } from "@fedify/vocab";
import { DocumentLoader } from "@fedify/vocab-runtime";
import { TracerProvider } from "@opentelemetry/api";
//#region src/sig/owner.d.ts
/**
* Options for {@link doesActorOwnKey}.
* @since 0.8.0
*/
interface DoesActorOwnKeyOptions {
/**
* The document loader to use for fetching the actor.
*/
documentLoader?: DocumentLoader;
/**
* The context loader to use for JSON-LD context retrieval.
*/
contextLoader?: DocumentLoader;
/**
* The OpenTelemetry tracer provider to use for tracing. If omitted,
* the global tracer provider is used.
* @since 1.3.0
*/
tracerProvider?: TracerProvider;
}
/**
* Checks if the actor of the given activity owns the specified key.
* @param activity The activity to check.
* @param key The public key to check.
* @param options Options for checking the key ownership.
* @returns Whether the actor is the owner of the key.
*/
declare function doesActorOwnKey(activity: Activity, key: CryptographicKey, options: DoesActorOwnKeyOptions): Promise<boolean>;
/**
* Options for {@link getKeyOwner}.
* @since 0.8.0
*/
interface GetKeyOwnerOptions {
/**
* The document loader to use for fetching the key and its owner.
*/
documentLoader?: DocumentLoader;
/**
* The context loader to use for JSON-LD context retrieval.
*/
contextLoader?: DocumentLoader;
/**
* The OpenTelemetry tracer provider to use for tracing. If omitted,
* the global tracer provider is used.
* @since 1.3.0
*/
tracerProvider?: TracerProvider;
}
/**
* Gets the actor that owns the specified key. Returns `null` if the key has no
* known owner.
*
* @param keyId The ID of the key to check, or the key itself.
* @param options Options for getting the key owner.
* @returns The actor that owns the key, or `null` if the key has no known
* owner.
* @since 0.7.0
*/
declare function getKeyOwner(keyId: URL | CryptographicKey, options: GetKeyOwnerOptions): Promise<Actor | null>;
//#endregion
export { getKeyOwner as i, GetKeyOwnerOptions as n, doesActorOwnKey as r, DoesActorOwnKeyOptions as t };