sanitization 1.0.0-rc.2

Dependency-free no_std secret memory sanitization with safe defaults and an explicit volatile wipe backend.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#[cfg(feature = "unsafe-wipe")]
use sanitization::unsafe_wipe::{volatile_sanitize_bytes, VolatileOnDrop};

fn main() {
    #[cfg(feature = "unsafe-wipe")]
    {
        let mut bytes = [0xA5; 32];
        volatile_sanitize_bytes(&mut bytes);
        assert_eq!(bytes, [0; 32]);

        let secret = VolatileOnDrop::new([1_u8, 2, 3, 4]);
        assert_eq!(secret.with_secret(|bytes| bytes.len()), 4);
    }
}