/** * Base Auth Adapter * * Abstract base class for stream authentication adapters. * Follows the adapter pattern used in @plyaz/storage. */ import type { StreamAuthAdapterConfig, StreamAuthResult, StreamChannel } from '@plyaz/types/core'; /** * BaseAuthAdapter - Abstract base class for all stream auth adapters * * Provides: * - Common configuration handling * - Interface for authentication and authorization * * Subclasses must implement: * - authenticate() - Validate connection request * - canSubscribe() - Check channel subscription permissions * * @example * ```ts * class MyAuthAdapter extends BaseAuthAdapter { * async authenticate(request: Request): Promise { * // Custom authentication logic * } * * canSubscribe(userId, channel, scopes): boolean { * // Custom authorization logic * } * } * ``` */ export declare abstract class BaseAuthAdapter { /** Adapter name for logging/debugging */ readonly name: string; /** Whether this adapter is enabled */ readonly enabled: boolean; constructor(config: StreamAuthAdapterConfig); /** * Authenticate a connection request * * @param request - HTTP request or WebSocket upgrade request * @returns Authentication result with user info if authenticated */ abstract authenticate(request: Request): Promise; /** * Check if user can subscribe to a channel * * @param userId - User ID (undefined for anonymous connections) * @param channel - Channel to subscribe to * @param scopes - User's allowed scopes from authentication * @returns Whether subscription is allowed */ abstract canSubscribe(userId: string | undefined, channel: StreamChannel, scopes?: string[]): boolean; /** * Get adapter info for debugging */ getAdapterInfo(): { name: string; enabled: boolean; }; } //# sourceMappingURL=BaseAuthAdapter.d.ts.map