secret-tools 0.1.0
A Secret<T> wrapper that redacts Debug and Display and wipes its value on drop (best effort)
Install
cargo add secret-tools --registry rupm
In Ruststudio: Packages, search for secret-tools, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.
Versions
- 0.1.0 2026-11-22
README
# secret-tools
A Secret<T> wrapper that redacts Debug and Display and wipes its value on drop (best effort)
Add it with `rupm add secret-tools` (or `cargo add secret-tools --registry rupm`).
Wiping is best effort: safe Rust cannot stop the optimiser, the allocator or earlier copies (for example a reallocated Vec) from leaving data in memory. It helps keep secrets out of logs and reduces exposure, but is not meant for security-critical use on its own.
```rust
use secret_tools::Secret;
let key = Secret::new(String::from("hunter2"));
assert_eq!(format!("{key:?}"), "Secret([REDACTED])");
assert_eq!(format!("{key}"), "[REDACTED]");
assert_eq!(key.expose().len(), 7);
```