Expand description
A data type for holding sensitive data to avoid accidentally leaking it.
Once a Sensitive
value has been created, it contains a string
value. It can be created by de-serializing using serde
.
The sensitive data can be accessed with Sensitive::as_str
. The
caller needs to be careful to not leak that.
Sensitive
value itself can’t be printed (via the Display
trait), even in debug mode (Debug
trait), or serialized with
serde
. Instead, the value is replaced with the string
<REDACTED>
.
Note that this does not prevent the value from ending up in a core dump.
Structs§
- Hold a sensitive string, such as a password or an API token. The value can be accessed (
Sensitive::as_str
), but won’t be printed, even in debug output, and won’t be serialized byserde
.