pub struct EncryptionManager { /* private fields */ }Expand description
Encryption manager for data at rest.
Provides AES-256-GCM encryption for sensitive data. Key is loaded from
file, environment variable, or system keyring. When encryption is disabled,
encrypt and decrypt are passthrough operations.
§Examples
use crawlkit_engine::{EncryptionManager, EncryptionConfig};
let manager = EncryptionManager::default();
assert!(!manager.is_enabled());
// When disabled, encrypt/decrypt are identity operations
let data = b"hello";
assert_eq!(manager.encrypt(data).unwrap(), data);Implementations§
Source§impl EncryptionManager
impl EncryptionManager
Sourcepub fn new(config: EncryptionConfig) -> Self
pub fn new(config: EncryptionConfig) -> Self
Create new encryption manager.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if encryption is enabled.
Sourcepub fn initialize(&self) -> Result<(), EncryptionError>
pub fn initialize(&self) -> Result<(), EncryptionError>
Initialize encryption by loading the key.
§Errors
Returns error if key cannot be loaded or is invalid.
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check if initialized.
Sourcepub fn config(&self) -> &EncryptionConfig
pub fn config(&self) -> &EncryptionConfig
Get configuration.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EncryptionManager
impl !UnwindSafe for EncryptionManager
impl Freeze for EncryptionManager
impl Send for EncryptionManager
impl Sync for EncryptionManager
impl Unpin for EncryptionManager
impl UnsafeUnpin for EncryptionManager
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> 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