Class TransformerAbstract

Transformer that transforms values in a numeric domain to values in a range equal to the domain or to another range defined by a callback function. In other words, the domain determines valid input values and, without a callback, the range of valid output values.

The concept is similar to format-preserving encryption, where input values within a specified domain (e.g., payment card numbers ranging from 8-19 digits) are transformed into values in the same domain, typically for storage in a database where the data type and length are already fixed and exfiltration of the data can have significant repercussions.

Two subclasses are supported directly by this class: IdentityTransformer (which operates based on a domain only) and EncryptionTransformer (which operates based on a domain and a tweak). If an application is expected to make repeated use of a transformer with the same domain and (optional) tweak and can't manage the transformer object, an in-memory cache is available via the get method. Properties in IdentityTransformer and EncryptionTransformer are read-only once constructed, so there is no issue with their shared use.

Hierarchy (View Summary)

Constructors

Accessors

Methods

Constructors

Accessors

Methods

  • Do the work of transforming a value forward.

    Parameters

    • value: bigint

      Value.

    Returns bigint

    Transformed value.

  • Do the work of transforming a value in reverse.

    Parameters

    • transformedValue: bigint

      Transformed value.

    Returns bigint

    Value.

  • Transform a value in reverse.

    Parameters

    • transformedValue: number | bigint

      Transformed value.

    Returns bigint

    Value.