Packages / rupm

rs-crypto-secret 0.1.0

A Secret<T> wrapper that redacts Debug and Display and wipes its value on drop (best effort)

Install

cargo add rs-crypto-secret --registry rupm

In Ruststudio: Packages, search for rs-crypto-secret, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-crypto-secret

A Secret<T> wrapper that redacts Debug and Display and wipes its value on drop (best effort)

Add it with `rupm add rs-crypto-secret` (or `cargo add rs-crypto-secret --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 rs_crypto_secret::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);
```