Skip to main content

redact

Function redact 

Source
pub fn redact(schema: &Value, value: &Value) -> Value
Expand description

The input as it may be stored: every value the schema marks sensitive replaced.

use majordomus_cli::execution::redact::{redact, REDACTED};
use serde_json::json;
let schema = json!({
    "type": "object",
    "properties": {
        "user": { "type": "string" },
        "token": { "type": "string", "format": "password" }
    }
});
let safe = redact(&schema, &json!({ "user": "ada", "token": "hunter2" }));
assert_eq!(safe["user"], "ada");
assert_eq!(safe["token"], REDACTED);