Crates.io | redact-engine |
lib.rs | redact-engine |
version | 0.1.2 |
source | src |
created_at | 2022-10-17 18:56:02.652942 |
updated_at | 2022-10-17 20:18:42.160413 |
description | Protect confidentiality with dynamic redaction by replacing sensitive data from string or JSON format |
homepage | https://github.com/rusty-ferris-club/redact-engine |
repository | https://github.com/rusty-ferris-club/redact-engine |
max_upload_size | |
id | 690312 |
size | 68,271 |
Protect confidentiality with dynamic redaction by replacing sensitive data from string or JSON format API Docs
Add this to Cargo.toml:
[dependencies]
redact-engine = { version = "0.1.2" }
use text_redaction::{Pattern, Redaction};
let text = "some string message that you want to redact: foo,bar";
let redaction = Redaction::new().add_value("foo")?;
let redacted_string = redaction.redact_str(text);
// println!("{}", redacted_string);
// some string message that you want to redact: [TEXT_REDACTED],bar
To see all code example, run the command cargo run --example
redact-json
- Redact from JSON formatredact-info
- Return redact capture information (position and pattern ID)Redact type | function | Times | Size | Results |
---|---|---|---|---|
Text | add_patterns | 1,000 | 70 chars | 29.016 µs |
Text | add_values | 1,000 | 70 chars | 27.881s µs |
Text | redact_reader | 1,000 | 70 chars | 117.75 µs |
Text | redact_str_with_info | 1,000 | 70 chars | 36.532 µs |
JSON | add_keys | 1,000 | 15 keys | 8.5483 µs |
JSON | add_paths | 1,000 | 15 keys | 7.0353 µs |
JSON | from_value | 1,000 | 15 keys | 8.7555 µs |
We are accepting PRs. Feel free to submit PRs.
To all Contributors - you make this happen, thanks!
Copyright (c) 2022 @kaplanelad. See LICENSE for further details.