UNPKG

@softlock/sdk

Version:

Official Softlock SDK for access key validation and management

44 lines 1.58 kB
import { SoftlockMiddlewareOptions } from './types'; /** * Express middleware for protecting routes with Softlock access keys */ export declare function createExpressMiddleware(options?: SoftlockMiddlewareOptions): (req: any, res: any, next: any) => Promise<any>; /** * Next.js middleware for protecting routes with Softlock access keys */ export declare function createNextMiddleware(options?: SoftlockMiddlewareOptions): (request: any) => Promise<Response | undefined>; /** * Utility function to extract Softlock data from Next.js request headers */ export declare function getSoftlockDataFromHeaders(headers: Headers): { valid: boolean; userId: string | undefined; userTag: string | undefined; keyId: string | undefined; }; /** * Higher-order function for protecting API routes */ export declare function withSoftlockAuth(handler: (req: any, res: any) => Promise<any>, options?: SoftlockMiddlewareOptions): (req: any, res: any) => Promise<unknown>; declare global { namespace Express { interface Request { softlock?: { valid: boolean; key?: { id: string; status: string; discord_user_id?: string; discord_tag?: string; created_at: string; expires_at?: string; }; user?: { discordId?: string; discordTag?: string; }; }; } } } //# sourceMappingURL=middleware.d.ts.map