Skip to main content

derive_key

Function derive_key 

Source
pub fn derive_key(passphrase: &str, salt: &[u8]) -> Result<Vec<u8>, SyncError>
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 machines that share the salt and passphrase.

§Arguments

  • passphrase - The user’s passphrase
  • salt - A random salt (stored in the ref tree at meta/salt and reused)

§Returns

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