Skip to main content

derive_key

Function derive_key 

Source
pub fn derive_key(passphrase: &str, salt: &[u8]) -> Result<Vec<u8>, CloudError>
Expand description

Derives an encryption key from a passphrase and salt using Argon2id.

Uses Argon2id with secure default parameters suitable for key derivation. The same passphrase and salt will always produce the same key, allowing encryption and decryption across sessions.

§Arguments

  • passphrase - The user’s passphrase
  • salt - A random salt (should be stored and reused for the same account)

§Returns

A 32-byte key suitable for AES-256-GCM encryption.