@fedify/fedify
Version:
An ActivityPub server framework
65 lines • 2.26 kB
TypeScript
import { type TracerProvider } from "@opentelemetry/api";
import { type DocumentLoader } from "../runtime/docloader.js";
import { type Actor } from "../vocab/actor.js";
import { type Activity, CryptographicKey } from "../vocab/vocab.js";
export { exportJwk, generateCryptoKeyPair, importJwk } from "./key.js";
/**
* Options for {@link doesActorOwnKey}.
* @since 0.8.0
*/
export 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.
*/
export declare function doesActorOwnKey(activity: Activity, key: CryptographicKey, options: DoesActorOwnKeyOptions): Promise<boolean>;
/**
* Options for {@link getKeyOwner}.
* @since 0.8.0
*/
export 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
*/
export declare function getKeyOwner(keyId: URL | CryptographicKey, options: GetKeyOwnerOptions): Promise<Actor | null>;
//# sourceMappingURL=owner.d.ts.map