Skip to content

Commit

Permalink
Resolve review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Dec 7, 2023
1 parent d66cec6 commit ca26d81
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions crates/bitwarden-uniffi/src/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ impl ClientAuth {
}

/// Validate the user password
pub async fn validate_password(&self, password: String) -> Result<bool> {
///
/// To retrieve the user's password hash, use [`ClientAuth::hash_password`] with
/// `HashPurpose::LocalAuthentication` during login and persist it. If the login method has no
/// password, use the email OTP.
pub async fn validate_password(&self, password: String, password_hash: String) -> Result<bool> {
Ok(self
.0
.0
.write()
.await
.auth()
.validate_password(password, "".to_string())
.validate_password(password, password_hash.to_string())
.await?)
}
}
4 changes: 2 additions & 2 deletions crates/bitwarden/src/auth/client_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ impl<'a> ClientAuth<'a> {
send_two_factor_email(self.client, tf).await
}

pub async fn validate_password(&self, password: String, user_key: String) -> Result<bool> {
validate_password(self.client, password, user_key).await
pub async fn validate_password(&self, password: String, password_hash: String) -> Result<bool> {
validate_password(self.client, password, password_hash).await
}
}

Expand Down
5 changes: 5 additions & 0 deletions languages/kotlin/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,15 @@ Generate keys needed for registration process

Validate the user password

To retrieve the user&#x27;s password hash, use [&#x60;ClientAuth::hash_password&#x60;] with
&#x60;HashPurpose::LocalAuthentication&#x60; during login and persist it. If the login method has no
password, use the email OTP.

**Arguments**:

- self:
- password: String
- password_hash: String

**Output**: std::result::Result<,BitwardenError>

Expand Down

0 comments on commit ca26d81

Please sign in to comment.