magiclogger - v0.1.0
    Preparing search index...

    Class Redactor

    Comprehensive PII and sensitive data redactor.

    Redactor

    Index

    Constructors

    • Creates a new Redactor instance.

      Parameters

      • options: RedactorOptions = {}

        Configuration options for the redactor

        Redactor configuration options.

        • OptionalauditTrail?: boolean

          Enable audit trail for compliance.

          false
          
        • OptionalcacheEnabled?: boolean

          Cache redacted values for performance.

          true
          
        • OptionalcontextAware?: boolean

          Enable context-aware redaction.

          true
          
        • Optionaldeep?: boolean

          Enable deep object traversal.

          true
          
        • Optionalenabled?: boolean

          Enable redaction.

          true
          
        • OptionalexcludeFields?: string[]

          Fields to never redact.

        • Optionalfields?: string[]

          Fields to always redact.

        • OptionalmaxCacheSize?: number

          Maximum cache size.

          1000
          
        • OptionalmaxDepth?: number

          Maximum traversal depth.

          10
          
        • Optionalpatterns?: RedactionPattern[]

          Custom redaction patterns.

        • Optionalpreset?: RedactionPreset

          Redaction preset level.

        • OptionaltokenSalt?: string

          Tokenization salt for consistent tokens.

      Returns Redactor

    Methods

    • Export token map for recovery.

      Returns Map<string, string>

    • Get audit trail.

      Returns {
          field?: string;
          original: string;
          pattern: string;
          redacted: string;
          timestamp: Date;
      }[]

    • Get redaction statistics.

      Returns {
          cacheSize: number;
          fieldRedactions: Map<string, number>;
          patternHits: Map<string, number>;
          tokenCount: number;
          totalRedactions: number;
      }

    • Import token map for consistency.

      Parameters

      • tokens: Map<string, string>

      Returns void

    • Redact sensitive data from any value.

      Parameters

      • data: unknown
      • fieldPath: string = ''

      Returns unknown

    • Remove redaction pattern by name.

      Parameters

      • name: string

      Returns void