biip/lib.rs
1//! `biip` is a library to scrub personally identifiable information (PII) from
2//! text.
3//!
4//! It provides a flexible way to define and apply redaction rules to any
5//! string.
6//!
7//! # How it works
8//!
9//! `biip` works by applying a series of "redactors" to the input text. Each
10//! redactor is responsible for finding and replacing a specific type of
11//! sensitive information. The library includes redactors for common patterns
12//! like usernames, environment secrets, IP addresses, API keys, and more.
13//!
14//! # Example
15//!
16//! ```
17//! use biip::Biip;
18//! use std::env;
19//!
20//! // Setting env vars for the example
21//! # unsafe {
22//! # env::set_var("USER", "awesome-user");
23//! # env::set_var("HOME", "/Users/awesome-user");
24//! # env::set_var("MY_SECRET_KEY", "mAM3zwogXpV6Czj6J");
25//! # }
26//!
27//! let input = r#"
28//! Hi, I am "Awesome-User". My home is /Users/awesome-user.
29//! My IP is 8.8.8.8 and the gateway is 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
30//! My secret is mAM3zwogXpV6Czj6J.
31//! "#;
32//!
33//! let biip = Biip::new();
34//! let redacted = biip.process(input);
35//!
36//! assert!(redacted.contains(r#"Hi, I am "user". My home is ~."#));
37//! assert!(redacted.contains("My IP is ••.••.••.•• and the gateway is ••:••:••:••:••:••:••:••."));
38//! assert!(redacted.contains("My secret is ••••⚿•."));
39//! ```
40pub mod biip;
41pub mod redactor;
42pub mod redactors;
43
44pub use biip::Biip;
45pub use redactor::Redactor;