import { Request, Response, NextFunction } from 'express'; import { UserInfo } from '../../types'; import type { RouterContext } from '../context'; /** * Express middleware that resolves a Backstage user principal to a LiteLLM user ID. * Stores both `tokenEntityRef` and `userId` in res.locals for downstream handlers. * * Returns 401 if the request lacks a valid Backstage user credential. */ export declare function createRequireUser(ctx: RouterContext): (req: Request, res: Response, next: NextFunction) => Promise; /** * Helper to fetch and provision a user from res.locals (populated by requireUser middleware). * Returns the user info or throws ProvisioningError (which the caller must handle and respond to). * Updates `res.locals.userId` to the resolved LiteLLM user id. * * This deduplicates the repeated pattern: * const userInfo = await getProvisionedUser(...); * if (error instanceof ProvisioningError) { res.status(...).json(...); return; } */ export declare function getProvisionedUser(ctx: RouterContext, res: Response): Promise;