@fedify/fedify
Version:
An ActivityPub server framework
104 lines (103 loc) • 3.88 kB
TypeScript
import { Temporal } from "@js-temporal/polyfill";
import { URLPattern } from "urlpattern-polyfill";
import { DocumentLoader, DocumentLoaderFactoryOptions } from "./docloader-Q42SMRIB.js";
import { HttpMessageSignaturesSpecDeterminer } from "./http-DMTrO3Ye.js";
import { TracerProvider } from "@opentelemetry/api";
//#region runtime/authdocloader.d.ts
/**
* Options for {@link getAuthenticatedDocumentLoader}.
* @see {@link getAuthenticatedDocumentLoader}
* @since 1.3.0
*/
interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
/**
* An optional spec determiner for HTTP Message Signatures.
* It determines the spec to use for signing requests.
* It is used for double-knocking
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
* @since 1.6.0
*/
specDeterminer?: HttpMessageSignaturesSpecDeterminer;
/**
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
* is used.
* @since 1.6.0
*/
tracerProvider?: TracerProvider;
}
/**
* Gets an authenticated {@link DocumentLoader} for the given identity.
* Note that an authenticated document loader intentionally does not cache
* the fetched documents.
* @param identity The identity to get the document loader for.
* The actor's key pair.
* @param options The options for the document loader.
* @returns The authenticated document loader.
* @throws {TypeError} If the key is invalid or unsupported.
* @since 0.4.0
*/
declare function getAuthenticatedDocumentLoader(identity: {
keyId: URL;
privateKey: CryptoKey;
}, {
allowPrivateAddress,
userAgent,
specDeterminer,
tracerProvider
}?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
//#endregion
//#region runtime/key.d.ts
/**
* Imports a PEM-SPKI formatted public key.
* @param pem The PEM-SPKI formatted public key.
* @returns The imported public key.
* @throws {TypeError} If the key is invalid or unsupported.
* @since 0.5.0
*/
declare function importSpki(pem: string): Promise<CryptoKey>;
/**
* Exports a public key in PEM-SPKI format.
* @param key The public key to export.
* @returns The exported public key in PEM-SPKI format.
* @throws {TypeError} If the key is invalid or unsupported.
* @since 0.5.0
*/
declare function exportSpki(key: CryptoKey): Promise<string>;
/**
* Imports a PEM-PKCS#1 formatted public key.
* @param pem The PEM-PKCS#1 formatted public key.
* @returns The imported public key.
* @throws {TypeError} If the key is invalid or unsupported.
* @since 1.5.0
*/
declare function importPkcs1(pem: string): Promise<CryptoKey>;
/**
* Imports a PEM formatted public key (SPKI or PKCS#1).
* @param pem The PEM formatted public key to import (SPKI or PKCS#1).
* @returns The imported public key.
* @throws {TypeError} If the key is invalid or unsupported.
* @since 1.5.0
*/
declare function importPem(pem: string): Promise<CryptoKey>;
/**
* Imports a [Multibase]-encoded public key.
*
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
* @param key The Multibase-encoded public key.
* @returns The imported public key.
* @throws {TypeError} If the key is invalid or unsupported.
* @since 0.10.0
*/
declare function importMultibaseKey(key: string): Promise<CryptoKey>;
/**
* Exports a public key in [Multibase] format.
*
* [Multibase]: https://www.w3.org/TR/vc-data-integrity/#multibase-0
* @param key The public key to export.
* @returns The exported public key in Multibase format.
* @throws {TypeError} If the key is invalid or unsupported.
* @since 0.10.0
*/
declare function exportMultibaseKey(key: CryptoKey): Promise<string>;
//#endregion
export { GetAuthenticatedDocumentLoaderOptions, exportMultibaseKey, exportSpki, getAuthenticatedDocumentLoader, importMultibaseKey, importPem, importPkcs1, importSpki };