pub struct LogEncryptionKey { /* private fields */ }Expand description
A 32-byte master key used to derive per-entry AES-256-GCM keys and nonces.
Implementations§
Source§impl LogEncryptionKey
impl LogEncryptionKey
Sourcepub fn new(key_bytes: [u8; 32]) -> Self
pub fn new(key_bytes: [u8; 32]) -> Self
Create a LogEncryptionKey from a raw 32-byte array.
Sourcepub fn from_slice(bytes: &[u8]) -> RaftResult<Self>
pub fn from_slice(bytes: &[u8]) -> RaftResult<Self>
Create a LogEncryptionKey from a byte slice.
§Errors
Returns RaftError::StorageError when bytes.len() != 32.
Sourcepub fn random() -> Self
pub fn random() -> Self
Generate a random LogEncryptionKey without an external RNG crate.
Entropy comes from four independent std::collections::hash_map::RandomState
instances (each OS-seeded) mixed with the current nanosecond timestamp,
then stretched to 32 bytes via HKDF-SHA256.
Auto Trait Implementations§
impl Freeze for LogEncryptionKey
impl RefUnwindSafe for LogEncryptionKey
impl Send for LogEncryptionKey
impl Sync for LogEncryptionKey
impl Unpin for LogEncryptionKey
impl UnsafeUnpin for LogEncryptionKey
impl UnwindSafe for LogEncryptionKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more