flex_alloc_secure/vec.rs
1//! Secure `Vec` container types.
2
3use crate::alloc::SecureAlloc;
4use flex_alloc::vec::Vec;
5
6/// A [`Vec`] which is backed by a secured allocator and keeps its
7/// contents in physical memory. When released, the allocated memory
8/// is securely zeroed, including all intermediate buffers produced in
9/// resizing the vector.
10///
11/// This container should be converted into a
12/// [`ProtectedBox`](crate::boxed::ProtectedBox) or
13/// [`ShieldedBox`](crate::boxed::ShieldedBox) to protect secret data.
14///
15/// This type does NOT protect against accidental output of
16/// contained values using the [`Debug`] trait.
17///
18/// When possible, prefer initialization of the protected container
19/// using the [`ProtectedInit`](`crate::ProtectedInit`) or
20/// [`ProtectedInitSlice`](`crate::ProtectedInitSlice`) traits.
21pub type SecureVec<T> = Vec<T, SecureAlloc>;