bitwarden_core/mobile/
client_kdf.rs

1use bitwarden_crypto::{CryptoError, HashPurpose, Kdf};
2
3use crate::{mobile::kdf::hash_password, Client};
4
5/// A client for the KDF operations.
6pub struct KdfClient {
7    pub(crate) _client: crate::Client,
8}
9
10impl KdfClient {
11    /// Hashes the password using the provided KDF parameters and purpose.
12    pub async fn hash_password(
13        &self,
14        email: String,
15        password: String,
16        kdf_params: Kdf,
17        purpose: HashPurpose,
18    ) -> Result<String, CryptoError> {
19        hash_password(email, password, kdf_params, purpose).await
20    }
21}
22
23impl Client {
24    /// Access to KDF functionality.
25    pub fn kdf(&self) -> KdfClient {
26        KdfClient {
27            _client: self.clone(),
28        }
29    }
30}