pub struct KeyDerivationManager { /* private fields */ }Expand description
Key derivation manager
Implementations§
Source§impl KeyDerivationManager
impl KeyDerivationManager
Sourcepub fn derive_master_key(
&self,
password: &str,
) -> EncryptionResult<EncryptionKey>
pub fn derive_master_key( &self, password: &str, ) -> EncryptionResult<EncryptionKey>
Derive a master key from a password (synchronous version)
Note: This is CPU-intensive. Use derive_master_key_async when calling from async context.
Sourcepub async fn derive_master_key_async(
&self,
password: String,
) -> EncryptionResult<EncryptionKey>
pub async fn derive_master_key_async( &self, password: String, ) -> EncryptionResult<EncryptionKey>
Derive a master key from a password (async version using spawn_blocking)
This method offloads the CPU-intensive Argon2 computation to a blocking thread pool.
Sourcepub fn derive_workspace_key(
&self,
master_key: &EncryptionKey,
workspace_id: &str,
) -> EncryptionResult<EncryptionKey>
pub fn derive_workspace_key( &self, master_key: &EncryptionKey, workspace_id: &str, ) -> EncryptionResult<EncryptionKey>
Derive a workspace key from workspace ID and master key
Sourcepub fn derive_key(
&self,
secret: &[u8],
method: KeyDerivationMethod,
salt: &str,
algorithm: EncryptionAlgorithm,
) -> EncryptionResult<EncryptionKey>
pub fn derive_key( &self, secret: &[u8], method: KeyDerivationMethod, salt: &str, algorithm: EncryptionAlgorithm, ) -> EncryptionResult<EncryptionKey>
Derive a key using the specified method
Sourcepub fn verify_password(
&self,
password: &str,
expected_key: &EncryptionKey,
) -> EncryptionResult<bool>
pub fn verify_password( &self, password: &str, expected_key: &EncryptionKey, ) -> EncryptionResult<bool>
Verify a password against a derived key (synchronous version)
Note: This is CPU-intensive. Use verify_password_async when calling from async context.
Sourcepub async fn verify_password_async(
&self,
password: String,
expected_key: EncryptionKey,
) -> EncryptionResult<bool>
pub async fn verify_password_async( &self, password: String, expected_key: EncryptionKey, ) -> EncryptionResult<bool>
Verify a password against a derived key (async version using spawn_blocking)
This method offloads the CPU-intensive Argon2 computation to a blocking thread pool.
Sourcepub fn generate_salt() -> String
pub fn generate_salt() -> String
Generate a secure random salt
Sourcepub fn validate_parameters(
&self,
method: &KeyDerivationMethod,
) -> EncryptionResult<()>
pub fn validate_parameters( &self, method: &KeyDerivationMethod, ) -> EncryptionResult<()>
Validate key derivation parameters
Trait Implementations§
Source§impl Clone for KeyDerivationManager
impl Clone for KeyDerivationManager
Source§fn clone(&self) -> KeyDerivationManager
fn clone(&self) -> KeyDerivationManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more