pub struct SensitiveKey { /* private fields */ }Expand description
A fixed-size, zeroizing container for a database encryption key (DEK).
Supports 128-bit and 256-bit keys (the sizes turso’s ciphers use). The key
bytes live in a Zeroizing<[u8; 32]> that is wiped on drop; no ordinary
heap copy of the key is made by this type. Constructors borrow the caller’s
buffer, so the caller keeps ownership (and wiping responsibility) of its
own copy. No particular zeroizing library is required of callers.
Implementations§
Source§impl SensitiveKey
impl SensitiveKey
Sourcepub fn from_hex(hexkey: &str) -> Result<Self, RekeyError>
pub fn from_hex(hexkey: &str) -> Result<Self, RekeyError>
Decode a hex-encoded key (32 or 64 hex chars) into zeroizing storage.
Sourcepub fn from_bytes(key: &[u8]) -> Result<Self, RekeyError>
pub fn from_bytes(key: &[u8]) -> Result<Self, RekeyError>
Copy a raw 16- or 32-byte key into zeroizing storage.
Trait Implementations§
Source§impl Clone for SensitiveKey
impl Clone for SensitiveKey
Source§fn clone(&self) -> SensitiveKey
fn clone(&self) -> SensitiveKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SensitiveKey
impl RefUnwindSafe for SensitiveKey
impl Send for SensitiveKey
impl Sync for SensitiveKey
impl Unpin for SensitiveKey
impl UnsafeUnpin for SensitiveKey
impl UnwindSafe for SensitiveKey
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
Source§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
Source§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more