UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

33 lines 1.61 kB
/** * Shared helpers for console auth route handlers (TOTP + token management). * * Extracted to eliminate duplication between totpRoutes.ts and tokenRoutes.ts. * Both routers need the same error-mapping, structured-error-response, and * body-field-extraction logic. * * @since v2.1.0 — Issue #1795 */ import type { Response } from 'express'; import type { TotpErrorCode } from '../console/consoleToken.js'; /** * Maps a store error code to the appropriate HTTP status. * Centralized so all console auth endpoints return consistent status codes * for the same failure class. The `satisfies never` exhaustiveness check * ensures new TotpErrorCode values get mapped at compile time. */ export declare function httpStatusForStoreError(code: TotpErrorCode): number; /** * Send a structured error response with both a human-readable message and * a machine-readable code. Shape is stable so the CLI and Security tab UI * can branch on `code` instead of string-matching the message. */ export declare function sendStoreError(res: Response, status: number, code: string, message: string): void; /** * Safely extract a string field from an unknown request body and NFC-normalize * it (DMCP-SEC-004). Returns null if the body is not an object or the field * is missing / not a string. Normalization blocks homograph, bidi, and * zero-width abuse before the value reaches downstream parsers (TOTP codes, * otpauth URI labels, pending-id lookups). */ export declare function getNormalizedStringField(body: unknown, field: string): string | null; //# sourceMappingURL=consoleRouteHelpers.d.ts.map