1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

fix init account validation (#9034)

This commit is contained in:
Jake Fink 2024-05-03 12:23:12 -04:00 committed by GitHub
parent 69ed6ce1f5
commit 4c860e12d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -771,16 +771,10 @@ export class CryptoService implements CryptoServiceAbstraction {
publicKey: string;
privateKey: EncString;
}> {
// Verify keys don't exist
// Verify user key doesn't exist
const existingUserKey = await this.getUserKey();
const existingPrivateKey = await this.getPrivateKey();
if (existingUserKey != null || existingPrivateKey != null) {
if (existingUserKey != null) {
this.logService.error("Tried to initialize account with existing user key.");
}
if (existingPrivateKey != null) {
this.logService.error("Tried to initialize account with existing private key.");
}
if (existingUserKey != null) {
this.logService.error("Tried to initialize account with existing user key.");
throw new Error("Cannot initialize account, keys already exist.");
}