UNPKG

@skyware/labeler

Version:

A lightweight alternative to Ozone for operating an atproto labeler.

50 lines (49 loc) 2.42 kB
import type { ComAtprotoIdentitySignPlcOperation } from "@atcute/client/lexicons"; import { LoginCredentials } from "./util.js"; /** Options for the {@link plcSetupLabeler} function. */ export interface PlcSetupLabelerOptions extends LoginCredentials { /** The HTTPS URL where the labeler is hosted. */ endpoint: string; /** * The token to use to sign the PLC operation. * If you don't have a token, first call {@link plcRequestToken} to receive one via email. */ plcToken: string; /** * You may choose to provide your own secp256k1 signing key to use for the labeler. * Leave this empty to generate a new keypair. */ privateKey?: string | Uint8Array; /** Whether to overwrite the existing label signing key if one is already set. */ overwriteExistingKey?: boolean; } /** Options for the {@link plcClearLabeler} function. */ export interface PlcClearLabelerOptions extends LoginCredentials { /** * The token to use to sign the PLC operation. * If you don't have a token, first call {@link plcRequestToken} to receive one via email. */ plcToken: string; } /** * This function will update the labeler account's DID document to include the * provided labeler endpoint and signing key. If no private key is provided, a * new keypair will be generated, and the private key will be printed to the * console. This private key will be needed to sign any labels created. * To set up a labeler, call this function followed by {@link declareLabeler}. * @param options Options for the function. * @returns The PLC operation that was submitted. */ export declare function plcSetupLabeler(options: PlcSetupLabelerOptions): Promise<ComAtprotoIdentitySignPlcOperation.Input | undefined>; /** * This function will remove the labeler endpoint and signing key from the labeler account's DID document. * To restore a labeler to a regular account, call this function followed by {@link deleteLabelerDeclaration}. * @param options Options for the function. */ export declare function plcClearLabeler(options: PlcClearLabelerOptions): Promise<void>; /** * Request a PLC token, needed for {@link plcSetupLabeler}. The token will be sent to the email * associated with the labeler account. * @param credentials The credentials of the labeler account. */ export declare function plcRequestToken(credentials: LoginCredentials): Promise<void>;