Abstract
Constructor.
Domain.
Static
getGet a transformer, constructing it if necessary. The type returned is IdentityTransformer if tweak is undefined, EncryptionTransformer if tweak is defined. Note that although an EncryptionTransformer with a zero tweak operates as an IdentityTransformer, EncryptionTransformer is still the type returned if a zero tweak is explicitly specified.
Domain.
Optional
tweak: number | bigintTweak.
IdentityTransformer if tweak is undefined, EncryptionTransformer if tweak is defined.
Protected
Abstract
doTransform value(s) forward.
Value(s) input type.
Value(s). If this is an instance of Sequence, the minimum and maximum values are validated prior to transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
Transformed value(s).
Transform value(s) forward, optionally applying a transformation.
Value(s) input type.
Transformation callback output type.
Value(s). If this is an instance of Sequence, the minimum and maximum values are validated prior to transformation. Otherwise, the individual value(s) is/are validated at the time of transformation.
Called after each value is transformed to convert it to its final value.
Transformed value(s).
Protected
Abstract
do
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.