1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Redacting wrappers for secret-bearing strings.
//!
//! Types in this module keep their value reachable for serialization and
//! runtime use while preventing accidental disclosure through
//! [`Debug`](std::fmt::Debug) formatting. They are used for durable and
//! handoff fields that carry provider credentials.
//!
//! # Serialization
//!
//! [`SecretString`] serializes transparently as a plain JSON string, so
//! existing serialized sessions and handoff bundles remain compatible and
//! credential portability is preserved. The redaction only affects debug
//! output, not persistence.
use fmt;
use ;
/// A string wrapper that serializes transparently but redacts its value in
/// [`Debug`](fmt::Debug) output.
///
/// Use this for fields that must round-trip through serialized payloads (for
/// example durable sessions and handoff bundles) but should never appear in
/// logs or debug-rendered state. The wrapped value is still serialized as a
/// plain string, preserving compatibility with previously persisted data.
///
/// # Examples
///
/// ```
/// use iron_core::SecretString;
///
/// let key = SecretString::new("sk-example".to_string());
/// assert_eq!(key.reveal(), "sk-example");
/// assert_eq!(format!("{key:?}"), "SecretString(<redacted>)");
/// ```
;