pub struct EncryptionOpts { /* private fields */ }Expand description
EncryptionOpts selects the cipher and key for on-disk encryption.
See https://docs.turso.tech/tursodb/encryption
Example ciphers: “aegis256”, “aes256gcm”. For 256-bit keys, hexkey is 64 chars.
The key is decoded from hex at construction and held in a fixed-size
zeroizing buffer (SensitiveKey) that is wiped when dropped. The
constructor borrows the caller’s hex string; the caller stays responsible
for wiping its own copy.
Implementations§
Source§impl EncryptionOpts
impl EncryptionOpts
Sourcepub fn new(cipher: &str, hexkey: &str) -> Result<Self>
pub fn new(cipher: &str, hexkey: &str) -> Result<Self>
Create encryption options from a cipher name and a hex-encoded key.
The key is copied into zeroizing storage; the borrowed hexkey is left
untouched (callers should wipe their own copy, e.g. with zeroize).
Returns an error if the hex is malformed or its length does not match
the cipher’s key size.
Sourcepub fn with_key(cipher: &str, key: SensitiveKey) -> Result<Self>
pub fn with_key(cipher: &str, key: SensitiveKey) -> Result<Self>
Create encryption options from a cipher name and an already-decoded key.
Trait Implementations§
Source§impl Clone for EncryptionOpts
impl Clone for EncryptionOpts
Source§fn clone(&self) -> EncryptionOpts
fn clone(&self) -> EncryptionOpts
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EncryptionOpts
impl RefUnwindSafe for EncryptionOpts
impl Send for EncryptionOpts
impl Sync for EncryptionOpts
impl Unpin for EncryptionOpts
impl UnsafeUnpin for EncryptionOpts
impl UnwindSafe for EncryptionOpts
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
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
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>
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>
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