bitwarden_core/mobile/
client_kdf.rs

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