Skip to content

Commit

Permalink
Expose make_key_connector_keys to uniffi
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Aug 15, 2024
1 parent 3f5cb9e commit 52154b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions crates/bitwarden-core/src/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ mod tde;
pub use tde::RegisterTdeKeyResponse;
#[cfg(feature = "internal")]
mod key_connector;
#[cfg(feature = "internal")]
pub use key_connector::KeyConnectorResponse;

#[cfg(feature = "internal")]
use crate::error::Result;
Expand Down
19 changes: 16 additions & 3 deletions crates/bitwarden-uniffi/src/auth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use std::sync::Arc;

use bitwarden::auth::{
password::MasterPasswordPolicyOptions, AuthRequestResponse, RegisterKeyResponse,
RegisterTdeKeyResponse,
use bitwarden::{
auth::{
password::MasterPasswordPolicyOptions, AuthRequestResponse, KeyConnectorResponse,
RegisterKeyResponse, RegisterTdeKeyResponse,
},
Error,
};
use bitwarden_crypto::{AsymmetricEncString, EncString, HashPurpose, Kdf, TrustDeviceResponse};

Expand Down Expand Up @@ -79,6 +82,16 @@ impl ClientAuth {
.make_register_tde_keys(email, org_public_key, remember_device)?)
}

/// Generate keys needed to onboard a new user without master key to key connector
pub fn make_key_connector_keys(&self) -> Result<KeyConnectorResponse> {
Ok(self
.0
.0
.auth()
.make_key_connector_keys()
.map_err(Error::Crypto)?)
}

/// Validate the user password
///
/// To retrieve the user's password hash, use [`ClientAuth::hash_password`] with
Expand Down

0 comments on commit 52154b8

Please sign in to comment.