sanitization-arrayvec 2.0.2

ArrayVec integration wrappers for the sanitization crate.
Documentation

sanitization-arrayvec

Small arrayvec integration crate for sanitization.

The main sanitization crate stays dependency-free. This sister crate provides SecretArrayVec<T, CAP>, a clear-on-drop wrapper around arrayvec::ArrayVec for projects that already use arrayvec. Live values are sanitized and dropped before the wrapper volatile-clears the complete inline MaybeUninit<T> backing region, including bytes left by earlier pop, truncate, clear, reuse, or wrapping operations. Spare storage is passed directly to sanitization::wipe::maybe_uninit; the wrapper never constructs references to uninitialized byte values. SecretArrayVec::from_arrayvec is intentionally a runtime constructor in 2.0 because it clears historical spare bytes immediately.

use sanitization::SecretBytes;
use sanitization_arrayvec::SecretArrayVec;

let mut keys = SecretArrayVec::<SecretBytes<32>, 4>::new();
keys.push(SecretBytes::from_array([7; 32])).unwrap();
keys.clear_secret();

If push reaches capacity, arrayvec::CapacityError returns the original element unchanged. The caller must securely reuse or sanitize it. Use push_or_sanitize when rejection should consume and clear the element instead; that method returns a payload-free SanitizedCapacityError. pop returns the removed secret to the caller but clears its stale inline slot before returning. truncate sanitizes removed elements before their destructors run.