MaskingParser class for handling the masking and rehydrating of messages.

Hierarchy

  • MaskingParser

Constructors

Methods

  • Adds a transformer to the parser.

    Parameters

    • transformer: MaskingTransformer

      An instance of a class extending MaskingTransformer.

    Returns void

  • Getter method for retrieving the current state.

    Returns Map<string, string>

    The current state map.

  • Masks the provided message using the added transformers. This method sequentially applies each transformer's masking logic to the message. It utilizes a state map to track original values corresponding to their masked versions.

    Parameters

    • message: string

      The message to be masked.

    Returns Promise<string>

    A masked version of the message.

    Throws

    If the message is not a string.

    Throws

    If no transformers are added.

  • Rehydrates a masked message back to its original form. This method sequentially applies the rehydration logic of each added transformer in reverse order. It relies on the state map to correctly map the masked values back to their original values.

    The rehydration process is essential for restoring the original content of a message that has been transformed (masked) by the transformers. This process is the inverse of the masking process.

    Parameters

    • message: string

      The masked message to be rehydrated.

    • Optional state: Map<string, string>

    Returns Promise<string>

    The original (rehydrated) version of the message.

Generated using TypeDoc