fix init account validation

This commit is contained in:
Jake Fink 2024-05-03 12:08:55 -04:00
parent 69ed6ce1f5
commit 83c00c2827
No known key found for this signature in database
GPG Key ID: FD482F8453480035
1 changed files with 3 additions and 9 deletions

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.");
}