RegexMaskingTransformer class for masking and rehydrating messages with Regex.

Hierarchy

Constructors

Methods

Constructors

  • Constructs a RegexMaskingTransformer with given patterns and an optional hash function. Validates the provided patterns to ensure they conform to the expected structure.

    Parameters

    • patterns: {
          [key: string]: MaskingPattern;
      }

      An object containing masking patterns. Each pattern should include a regular expression (regex) and optionally a replacement string or a mask function.

      • [key: string]: MaskingPattern
    • Optional hashFunction: HashFunction

      An optional custom hash function to be used for masking.

    Returns RegexMaskingTransformer

Methods

  • Rehydrates a masked message back to its original form using the provided state.

    Parameters

    • message: string

      The masked message to be rehydrated.

    • state: Map<string, string>

      The state map containing mappings of masked values to their original values.

    Returns Promise<string>

    The rehydrated (original) message.

  • Masks content in a message based on the defined patterns.

    Parameters

    • message: string

      The message to be masked.

    • state: Map<string, string>

      The current state containing original values.

    Returns Promise<[string, Map<string, string>]>

    A tuple of the masked message and the updated state.

Generated using TypeDoc