mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-01 23:01:28 +01:00
[EC-598] feat: add general error handling for attestation
This commit is contained in:
parent
b3d5ab4472
commit
e7454501ea
@ -724,6 +724,15 @@ describe("FidoAuthenticatorService", () => {
|
|||||||
// Signatures are non-deterministic, and webcrypto can't verify DER signature format
|
// Signatures are non-deterministic, and webcrypto can't verify DER signature format
|
||||||
// expect(result.signature).toMatchSnapshot();
|
// expect(result.signature).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** Spec: If any error occurred while generating the assertion signature, return an error code equivalent to "UnknownError" and terminate the operation. */
|
||||||
|
it("should throw unkown error if creation fails", async () => {
|
||||||
|
cipherService.updateWithServer.mockRejectedValue(new Error("Internal error"));
|
||||||
|
|
||||||
|
const result = async () => await authenticator.getAssertion(params);
|
||||||
|
|
||||||
|
await expect(result).rejects.toThrowError(Fido2AutenticatorErrorCode.Unknown);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +173,7 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
throw new Fido2AutenticatorError(Fido2AutenticatorErrorCode.NotAllowed);
|
throw new Fido2AutenticatorError(Fido2AutenticatorErrorCode.NotAllowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const selectedCredentialId =
|
const selectedCredentialId =
|
||||||
params.allowCredentialDescriptorList?.length > 0
|
params.allowCredentialDescriptorList?.length > 0
|
||||||
? selectedCipher.fido2Key.nonDiscoverableId
|
? selectedCipher.fido2Key.nonDiscoverableId
|
||||||
@ -205,6 +206,9 @@ export class Fido2AuthenticatorService implements Fido2AuthenticatorServiceAbstr
|
|||||||
},
|
},
|
||||||
signature,
|
signature,
|
||||||
};
|
};
|
||||||
|
} catch {
|
||||||
|
throw new Fido2AutenticatorError(Fido2AutenticatorErrorCode.Unknown);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async vaultContainsCredentials(
|
private async vaultContainsCredentials(
|
||||||
|
Loading…
Reference in New Issue
Block a user