| Crates.io | snitch-transform |
| lib.rs | snitch-transform |
| version | 0.0.6 |
| created_at | 2023-07-10 03:41:56.646274+00 |
| updated_at | 2023-07-27 17:37:01.680041+00 |
| description | JSON data transformation lib used by snitch components |
| homepage | |
| repository | https://github.com/streamdal/snitch-transform |
| max_upload_size | |
| id | 912512 |
| size | 20,224 |
Library used by snitch-wasm to perform transformations on JSON payloads.
Currently only has support for overwrite, mask and obfuscate.
fn main() {
let sample_json = r#"{"hello": "world"}"#;
let req = Request {
data: sample_json.into(),
path: "hello".to_string(),
value: r#""baz""#.to_string(),
};
let updated_json = snitch_transform::transform::overwrite(&req).unwrap();
println!(
"Input JSON: {} || Result JSON: {}",
sample_json, updated_json,
)
}
overwrite()
"123")mask()
2. Works for numbers and strings
3. For numbers, it will replace 80% of the number characters with 0
4. For strings, it will replace 80% of the characters with *obfuscate()
2. Works ONLY on strings
3. Will replace 100% of the characters with a sha256 hash