Introduction
pii is library for wrapping Personally Identifying Information and providing ways to limit its spread.
Installation
Yarn
NPM
Usage
The concept is simple. Wrap PII
around any PII data as soon as it enters your system.
PII
wraps any data and obscures the details. Attempts to coerce it to other types or convert to JSON will result in a string result of PII<REDACTED>
. Once the PII has flowed through your system, use unwrap
to get the data back out for posting to a third party. Or unwrapObject
which will recursively unwrap PII inside a post body object.
Avoiding unsafe unwrapping and rewrapping
If you want to combine two pieces of PII, such as first and last name, you might want to unwrap, combine and then rewrap them. Once you start using unwrap everywhere, it becomes very hard to maintain safetly. Rather, use the built in methods of this library to mutate and combine PII while keeping the data inside the wrapper.
Modify PII
Combine two things
Note: There are methods for up to 4 PII inputs: zip2With
, zip3With
, zip4With
.
Reduce a list of PII
Inspect or create side-effects using PII contents without unwrapping
Detecting PII in Data
Recurses through a data structure and uses a callback to detect values that should become PII.
Custom PII Redaction
License
pii is licensed under the Hippocratic License. It is an Ethical Source license derived from the MIT License, amended to limit the impact of the unethical use of open source software.
Last updated