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

[EC-598] feat: add user confirmation test to assertion

also rewrite to use cipher views in tests
This commit is contained in:
Andreas Coroiu
2023-03-29 16:23:19 +02:00
parent c2ec87a3f3
commit 597bc0b197
2 changed files with 76 additions and 40 deletions

View File

@@ -146,25 +146,28 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
throw new Fido2AutenticatorError(Fido2AutenticatorErrorCode.Constraint);
}
let credentialOptions: Fido2KeyView[];
let credentialOptions: CipherView[];
// eslint-disable-next-line no-empty
if (params.allowCredentialDescriptorList?.length > 0) {
const ciphers = await this.findNonDiscoverableCredentials(
credentialOptions = await this.findNonDiscoverableCredentials(
params.allowCredentialDescriptorList,
params.rpId
);
credentialOptions = ciphers.map((c) => c.fido2Key);
} else {
const ciphers = await this.findDiscoverableCredentials(params.rpId);
credentialOptions = ciphers.map((c) => c.fido2Key);
credentialOptions = await this.findDiscoverableCredentials(params.rpId);
}
if (credentialOptions.length === 0) {
throw new Fido2AutenticatorError(Fido2AutenticatorErrorCode.NotAllowed);
}
throw new Error("Not implemented");
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const selectedCredential = await this.userInterface.pickCredential(
credentialOptions.map((cipher) => cipher.id)
);
return null;
}
private async vaultContainsCredentials(