/**
 * PIV/CAC Fastify Middleware
 *
 * Fastify middleware and plugin for PIV/CAC smart card authentication.
 *
 * Features:
 * - Certificate extraction from headers
 * - Certificate validation
 * - User identity mapping
 * - Session binding
 * - Card removal monitoring
 *
 * @packageDocumentation
 */
import type { FastifyRequest, FastifyPluginCallback, preHandlerHookHandler } from 'fastify';
import { type PIVCACConfig, type PIVAuthContext, type PIVMiddlewareOptions, type MappedUserIdentity } from './types.js';
import { CertificateAuthService } from './certificate-auth.js';
import { OCSPValidator } from './ocsp-validator.js';
import { CRLValidator } from './crl-validator.js';
import { CertificateMapper } from './certificate-mapper.js';
import { CardRemovalHandler } from './card-removal-handler.js';
/**
 * PIV authentication service bundle
 */
export interface PIVAuthServices {
    certAuth: CertificateAuthService;
    ocspValidator: OCSPValidator;
    crlValidator: CRLValidator;
    certificateMapper: CertificateMapper;
    cardRemovalHandler: CardRemovalHandler;
}
/**
 * PIV plugin options
 */
export interface PIVPluginOptions extends PIVMiddlewareOptions {
    /** PIV/CAC configuration */
    config?: Partial<PIVCACConfig>;
    /** Pre-initialized services */
    services?: Partial<PIVAuthServices>;
    /** Enable metrics */
    enableMetrics?: boolean;
}
declare module 'fastify' {
    interface FastifyRequest {
        pivAuth?: PIVAuthContext;
    }
    interface FastifyInstance {
        pivAuthServices?: PIVAuthServices;
    }
}
/**
 * Create PIV authentication middleware
 */
export declare function pivAuthMiddleware(services: PIVAuthServices, config: PIVCACConfig, options?: PIVMiddlewareOptions): preHandlerHookHandler;
/**
 * PIV authentication Fastify plugin
 */
export declare const pivAuthPlugin: FastifyPluginCallback<PIVPluginOptions>;
/**
 * Require PIV authentication middleware
 */
export declare function requirePIVAuth(): preHandlerHookHandler;
/**
 * Require specific certificate attribute middleware
 */
export declare function requireCertificateAttribute(attribute: string, pattern?: RegExp): preHandlerHookHandler;
/**
 * Require EDIPI (DoD ID) middleware
 */
export declare function requireEDIPI(): preHandlerHookHandler;
/**
 * Get PIV auth context from request
 */
export declare function getPIVAuth(request: FastifyRequest): PIVAuthContext | undefined;
/**
 * Check if request has PIV authentication
 */
export declare function hasPIVAuth(request: FastifyRequest): boolean;
/**
 * Get PIV user from request
 */
export declare function getPIVUser(request: FastifyRequest): MappedUserIdentity | undefined;
/**
 * Get PIV user ID from request
 */
export declare function getPIVUserId(request: FastifyRequest): string | undefined;
/**
 * Get certificate fingerprint from request
 */
export declare function getCertificateFingerprint(request: FastifyRequest): string | undefined;
/**
 * Get EDIPI from request
 */
export declare function getEDIPI(request: FastifyRequest): string | undefined;
//# sourceMappingURL=piv-middleware.d.ts.map