chore: fix issue where ephemeral vault couldnt be deleted with the correct password if not unlocked once before

This commit is contained in:
Aman Harwara
2023-09-04 19:27:04 +05:30
parent 13925e6e8c
commit 4ee5ad8595

View File

@@ -53,6 +53,15 @@ export class AuthorizeVaultDeletion implements UseCaseInterface<boolean> {
const password = value.value as string
if (this.vaultLocks.isVaultLocked(vault)) {
const unlocked = await this.vaultLocks.unlockNonPersistentVault(vault, password)
if (unlocked) {
this.challenges.completeChallenge(challenge)
resolve(Result.ok(true))
return
}
}
const validPassword = this._validateVaultPassword.execute(vault, password).getValue()
if (!validPassword) {
this.challenges.setValidationStatusForChallenge(challenge, value, false)