/** * PII Redaction Hooks * * Provides PII detection and redaction for transcript logging. * Supports configurable patterns for various PII types. * Never stores original values - only logs that redaction occurred. * * @module transcripts/redaction */ /** * Types of PII that can be detected and redacted */ export type PIIRedactionType = "email" | "phone" | "ssn" | "credit-card" | "ip-address" | "name" | "address" | "api-key" | "password" | "jwt" | "uuid" | "custom"; /** * Log entry for a redaction (never stores original content) */ export interface RedactionLog { /** Type of PII redacted */ type: PIIRedactionType; /** Starting position in original string */ position: number; /** Length of redacted content */ length: number; /** Placeholder used for redaction */ placeholder: string; /** Hash of original content (for deduplication) */ contentHash?: string; /** Pattern name that matched */ patternName?: string; } /** * Result of redacting content */ export interface RedactionResult { /** Redacted content */ redacted: string; /** Log of all redactions performed */ redactions: RedactionLog[]; /** Whether any PII was found */ hadPII: boolean; /** Original content length */ originalLength: number; /** Redacted content length */ redactedLength: number; } /** * PII detection pattern */ export interface PIIPattern { name: string; type: PIIRedactionType; pattern: RegExp; placeholder?: string; validate?: (match: string) => boolean; } /** * Redaction options */ export interface RedactionOptions { /** Additional custom patterns */ customPatterns?: PIIPattern[]; /** Patterns to exclude by name */ excludePatterns?: string[]; /** Hash original values for deduplication */ hashOriginals?: boolean; /** Placeholder format (default: [REDACTED:{type}]) */ placeholderFormat?: string; /** Maximum redactions per content (prevents DoS) */ maxRedactions?: number; } /** * Default PII detection patterns */ export declare const DEFAULT_PII_PATTERNS: PIIPattern[]; /** * Redact PII from content */ export declare function redactPII(content: string, options?: RedactionOptions): RedactionResult; /** * Check if content contains PII without redacting */ export declare function containsPII(content: string, options?: RedactionOptions): boolean; /** * Get PII statistics for content */ export declare function analyzePII(content: string, options?: RedactionOptions): { totalPII: number; byType: Record; patterns: string[]; }; /** * Redact PII from multiple content strings */ export declare function redactPIIBatch(contents: string[], options?: RedactionOptions): RedactionResult[]; /** * Create a redaction hook for TranscriptLogger */ export declare function createRedactionHook(options?: RedactionOptions): (content: string) => { content: string; redactionLog?: RedactionLog[]; }; /** * Create a custom PII pattern */ export declare function createPIIPattern(name: string, type: PIIRedactionType, pattern: RegExp | string, options?: { placeholder?: string; validate?: (match: string) => boolean; }): PIIPattern; /** * Get all default pattern names */ export declare function getDefaultPatternNames(): string[]; /** * Get patterns by type */ export declare function getPatternsByType(type: PIIRedactionType): PIIPattern[]; /** * Generate redaction summary for logging */ export declare function generateRedactionSummary(results: RedactionResult[]): string; /** * Generate markdown report of redactions */ export declare function generateRedactionReport(results: RedactionResult[]): string; //# sourceMappingURL=redaction.d.ts.map