Skip to content

Commit

Permalink
Lift comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-garcia committed Mar 28, 2024
1 parent eaef2ca commit 975e6c1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/bitwarden/src/auth/tde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use bitwarden_crypto::{

use crate::{error::Result, Client};

/// This function generates a new user key and key pair, initializes the client's crypto with the
/// generated user key, and encrypts the user key with the organization public key for admin
/// password reset. If remember_device is true, it also generates a device key.
pub(super) fn make_register_tde_keys(
client: &mut Client,
org_public_key: String,
Expand All @@ -15,8 +18,6 @@ pub(super) fn make_register_tde_keys(

let mut rng = rand::thread_rng();

// Generate a new user key and key pair, and encrypt the user key with the org public key for
// admin password reset
let user_key = UserKey::new(SymmetricCryptoKey::generate(&mut rng));
let key_pair = user_key.make_key_pair()?;

Check warning on line 22 in crates/bitwarden/src/auth/tde.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden/src/auth/tde.rs#L19-L22

Added lines #L19 - L22 were not covered by tests

Expand All @@ -29,8 +30,6 @@ pub(super) fn make_register_tde_keys(
None

Check warning on line 30 in crates/bitwarden/src/auth/tde.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden/src/auth/tde.rs#L30

Added line #L30 was not covered by tests
};

// Initialize the crypto with the generated user key, this way it doesn't need to leave the
// client
client.initialize_user_crypto_decrypted_key(user_key.0, key_pair.private.clone())?;

Check warning on line 33 in crates/bitwarden/src/auth/tde.rs

View check run for this annotation

Codecov / codecov/patch

crates/bitwarden/src/auth/tde.rs#L33

Added line #L33 was not covered by tests

Ok(RegisterTdeKeyResponse {
Expand Down

0 comments on commit 975e6c1

Please sign in to comment.