import { VorionError } from '../common/errors.js';
import { type IntrospectionResult } from './types.js';
/**
 * Introspection-specific error
 */
export declare class IntrospectionError extends VorionError {
    code: string;
    statusCode: number;
    constructor(message: string, details?: Record<string, unknown>);
}
/**
 * Token inactive error
 */
export declare class TokenInactiveError extends VorionError {
    code: string;
    statusCode: number;
    constructor(reason?: string);
}
/**
 * Introspection service options
 */
export interface IntrospectionServiceOptions {
    /** Default cache TTL in milliseconds (default: 5000 = 5 seconds) */
    defaultCacheTTL?: number;
    /** Maximum cache TTL in milliseconds (default: 60000 = 1 minute) */
    maxCacheTTL?: number;
    /** Request timeout in milliseconds (default: 5000 = 5 seconds) */
    requestTimeout?: number;
    /** Client credentials for introspection endpoint */
    clientId?: string;
    /** Client secret for introspection endpoint */
    clientSecret?: string;
    /** Custom fetch implementation (for testing) */
    fetch?: typeof fetch;
}
/**
 * Token Introspection Service for real-time token validation
 *
 * @example
 * ```typescript
 * const introspection = new TokenIntrospectionService(
 *   'https://auth.example.com/oauth2/introspect',
 *   {
 *     clientId: 'my-resource-server',
 *     clientSecret: 'secret',
 *     defaultCacheTTL: 5000,
 *   }
 * );
 *
 * // Introspect a token
 * const result = await introspection.introspect(accessToken);
 *
 * // Cached introspection with custom TTL
 * const cachedResult = await introspection.cachedIntrospect(accessToken, 10000);
 *
 * // Clear cache for a token
 * introspection.clearCache(accessToken);
 * ```
 */
export declare class TokenIntrospectionService {
    private introspectionEndpoint;
    private cache;
    private options;
    /**
     * Create a new token introspection service
     *
     * @param introspectionEndpoint - OAuth 2.0 introspection endpoint URL
     * @param options - Service options
     */
    constructor(introspectionEndpoint: string, options?: IntrospectionServiceOptions);
    /**
     * Introspect a token (synchronous check, bypasses cache)
     *
     * @param token - Access token to introspect
     * @returns Introspection result
     */
    introspect(token: string): Promise<IntrospectionResult>;
    /**
     * Cached introspection with configurable TTL
     *
     * Returns cached result if available and within TTL, otherwise
     * performs fresh introspection.
     *
     * @param token - Access token to introspect
     * @param maxCacheAge - Maximum cache age in milliseconds (default: config value)
     * @returns Introspection result
     */
    cachedIntrospect(token: string, maxCacheAge?: number): Promise<IntrospectionResult>;
    /**
     * Clear introspection cache
     *
     * @param token - Optional specific token to clear (clears all if not provided)
     */
    clearCache(token?: string): void;
    /**
     * Call the introspection endpoint
     */
    private callIntrospectionEndpoint;
    /**
     * Map introspection response to result
     */
    private mapResponseToResult;
    /**
     * Get introspection endpoint URL
     */
    getEndpoint(): string;
    /**
     * Destroy the service (cleanup)
     */
    destroy(): void;
}
/**
 * Create a mock introspection service for testing
 *
 * @param mockResponses - Map of token to response
 */
export declare function createMockIntrospectionService(mockResponses?: Map<string, Partial<IntrospectionResult>>): TokenIntrospectionService;
/**
 * Create a token introspection service
 */
export declare function createTokenIntrospectionService(introspectionEndpoint: string, options?: IntrospectionServiceOptions): TokenIntrospectionService;
//# sourceMappingURL=introspection.d.ts.map