Skip to content

Commit f0caa24

Browse files
committed
Add missing changes
1 parent 06da986 commit f0caa24

File tree

1 file changed

+17
-13
lines changed
  • crates/bitwarden-core/src/key_management

1 file changed

+17
-13
lines changed

crates/bitwarden-core/src/key_management/crypto.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub(super) async fn initialize_user_crypto(
165165
client.internal.init_user_id(user_id)?;
166166
}
167167

168-
let key_state = (&req).into();
168+
let account_crypto_state = (&req).account_cryptographic_state.to_owned();
169169
let _span_guard = tracing::info_span!(
170170
"User Crypto Initialization",
171171
user_id = ?client.internal.get_user_id(),
@@ -176,9 +176,11 @@ pub(super) async fn initialize_user_crypto(
176176
match req.method {
177177
InitUserCryptoMethod::Password { password, user_key } => {
178178
let master_key = MasterKey::derive(&password, &req.email, &req.kdf_params)?;
179-
client
180-
.internal
181-
.initialize_user_crypto_master_key(master_key, user_key, key_state)?;
179+
client.internal.initialize_user_crypto_master_key(
180+
master_key,
181+
user_key,
182+
account_crypto_state,
183+
)?;
182184
}
183185
InitUserCryptoMethod::MasterPasswordUnlock {
184186
password,
@@ -189,14 +191,14 @@ pub(super) async fn initialize_user_crypto(
189191
.initialize_user_crypto_master_password_unlock(
190192
password,
191193
master_password_unlock,
192-
key_state,
194+
account_crypto_state,
193195
)?;
194196
}
195197
InitUserCryptoMethod::DecryptedKey { decrypted_user_key } => {
196198
let user_key = SymmetricCryptoKey::try_from(decrypted_user_key)?;
197199
client
198200
.internal
199-
.initialize_user_crypto_decrypted_key(user_key, key_state)?;
201+
.initialize_user_crypto_decrypted_key(user_key, account_crypto_state)?;
200202
}
201203
InitUserCryptoMethod::Pin {
202204
pin,
@@ -206,7 +208,7 @@ pub(super) async fn initialize_user_crypto(
206208
client.internal.initialize_user_crypto_pin(
207209
pin_key,
208210
pin_protected_user_key,
209-
key_state,
211+
account_crypto_state,
210212
)?;
211213
}
212214
InitUserCryptoMethod::PinEnvelope {
@@ -216,7 +218,7 @@ pub(super) async fn initialize_user_crypto(
216218
client.internal.initialize_user_crypto_pin_envelope(
217219
pin,
218220
pin_protected_user_key_envelope,
219-
key_state,
221+
account_crypto_state,
220222
)?;
221223
}
222224
InitUserCryptoMethod::AuthRequest {
@@ -238,7 +240,7 @@ pub(super) async fn initialize_user_crypto(
238240
};
239241
client
240242
.internal
241-
.initialize_user_crypto_decrypted_key(user_key, key_state)?;
243+
.initialize_user_crypto_decrypted_key(user_key, account_crypto_state)?;
242244
}
243245
InitUserCryptoMethod::DeviceKey {
244246
device_key,
@@ -251,7 +253,7 @@ pub(super) async fn initialize_user_crypto(
251253

252254
client
253255
.internal
254-
.initialize_user_crypto_decrypted_key(user_key, key_state)?;
256+
.initialize_user_crypto_decrypted_key(user_key, account_crypto_state)?;
255257
}
256258
InitUserCryptoMethod::KeyConnector {
257259
master_key,
@@ -260,9 +262,11 @@ pub(super) async fn initialize_user_crypto(
260262
let mut bytes = master_key.into_bytes();
261263
let master_key = MasterKey::try_from(bytes.as_mut_slice())?;
262264

263-
client
264-
.internal
265-
.initialize_user_crypto_master_key(master_key, user_key, key_state)?;
265+
client.internal.initialize_user_crypto_master_key(
266+
master_key,
267+
user_key,
268+
account_crypto_state,
269+
)?;
266270
}
267271
}
268272

0 commit comments

Comments
 (0)