snitch-transform

Library used by snitch-wasm to perform transformations on JSON payloads.

Currently only has support for overwrite, mask and obfuscate.

Usage

```rust use snitchprotos as protos; use snitchtransform::transform;

func main() { let sample_json = r#"{"hello": "world"}"#;

let mut req = protos::transform::TransformRequest::new(); req.data = samplejson.into(); req.path = "hello".tostring(); req.value = r#""baz""#.to_string();

let updatedjson = snitchtransform::transform::overwrite(&req).unwrap();

println!("Input JSON: {} || Result JSON: {}", samplejson, updatedjson) } ```

IMPORTANT

  1. overwrite()
    1. Overwrite value will be used as-is - if target is intended to be a string, then make sure to include quotes in the payload ( Ie. "123")
  2. mask()
    1. Works for numbers and strings
    2. For numbers, it will replace 80% of the number characters with 0
    3. For strings, it will replace 80% of the characters with *
  3. obfuscate()
    1. Works ONLY on strings
    2. Will replace 100% of the characters with a sha256 hash

Use as-is - has not been tested in production :)