1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-22 11:13:46 +00:00

[EC-598] feat: increment counter during assertion

This commit is contained in:
Andreas Coroiu
2023-03-29 16:55:09 +02:00
parent 597bc0b197
commit 5bf4156fc6
2 changed files with 70 additions and 5 deletions

View File

@@ -162,12 +162,19 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
throw new Fido2AutenticatorError(Fido2AutenticatorErrorCode.NotAllowed);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const selectedCredential = await this.userInterface.pickCredential(
const selectedCredentialId = await this.userInterface.pickCredential(
credentialOptions.map((cipher) => cipher.id)
);
const selectedCredential = credentialOptions.find((c) => c.id === selectedCredentialId);
return null;
if (selectedCredential === undefined) {
throw new Fido2AutenticatorError(Fido2AutenticatorErrorCode.NotAllowed);
}
++selectedCredential.fido2Key.counter;
selectedCredential.localData.lastUsedDate = new Date().getTime();
const encrypted = await this.cipherService.encrypt(selectedCredential);
await this.cipherService.updateWithServer(encrypted);
}
private async vaultContainsCredentials(