Skip to content

basalt / audit/src / pseudonymize

Function: pseudonymize() ​

> pseudonymize(value, key?): string

Defined in: audit/src/index.ts:453

Deterministically pseudonymizes a value with HMAC-SHA256 under key: the same input and key always map to the same opaque 128-bit token, so records stay correlatable without persisting the raw PII — and without the key the token cannot be reversed by hashing candidate emails or phone numbers.

Without a key a random per-process key is used (and a warning is logged once).

Parameters ​

value ​

string

key? ​

PseudonymizationKey

Returns ​

string

Released under the MIT License.