1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

add new memory concept to crypto service calls in cli

This commit is contained in:
Jacob Fink
2023-05-30 11:24:12 -04:00
parent 4772166e83
commit 711d643d68
2 changed files with 7 additions and 4 deletions

View File

@@ -475,8 +475,8 @@ export class LoginCommand {
/**
* Collect new master password and hint from the CLI. The collected password
* is validated against any applicable master password policies and a new encryption
* key is generated
* is validated against any applicable master password policies, a new master
* key is generated, and we use it to re-encrypt the user symmetric key
* @param prompt - Message that is displayed during the initial prompt
* @param error
*/
@@ -576,7 +576,10 @@ export class LoginCommand {
const newPasswordHash = await this.cryptoService.hashPassword(masterPassword, newMasterKey);
// Grab user's symmetric key
const userSymKey = await this.cryptoService.getUserKey();
const userSymKey = await this.cryptoService.getUserKeyFromMemory();
if (!userSymKey) {
throw new Error("User key not found.");
}
// Re-encrypt user's symmetric key with new master key
const newUserSymKey = await this.cryptoService.encryptUserSymKeyWithMasterKey(

View File

@@ -126,7 +126,7 @@ export class CreateCommand {
return Response.error("Premium status is required to use this feature.");
}
const userSymKey = await this.cryptoService.getUserKey();
const userSymKey = await this.cryptoService.getUserKeyFromMemory();
if (userSymKey == null) {
return Response.error(
"You must update your encryption key before you can use this feature. " +