mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
5e8605b43d
Automatic update from web-platform-tests new tests based on Working Draft 7 <!-- Reviewable:start --> <!-- Reviewable:end --> wpt-commits: 025a5577b9a881d14783aec39d4c6963647d09a0 wpt-pr: 9237 reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2, b81999f30c1516a70c153de51a0331d14c8faead
66 lines
3.6 KiB
HTML
66 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>WebAuthn navigator.credentials.create() pubKeyCredParams Tests</title>
|
|
<link rel="author" title="Adam Powers" href="mailto:adam@fidoalliance.org">
|
|
<link rel="help" href="https://w3c.github.io/webauthn/#iface-credential">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src=helpers.js></script>
|
|
<body></body>
|
|
<script>
|
|
standardSetup(function() {
|
|
"use strict";
|
|
|
|
var badType = {
|
|
type: "something-else",
|
|
alg: cose_alg_ECDSA_w_SHA512
|
|
};
|
|
var badTypeEmptyString = cloneObject(badType);
|
|
badTypeEmptyString.type = "";
|
|
var badTypeNull = cloneObject(badType);
|
|
badTypeNull.type = null;
|
|
var badTypeEmptyObj = cloneObject(badType);
|
|
badTypeEmptyObj.type = {};
|
|
|
|
var badAlg = {
|
|
type: "public-key",
|
|
alg: 42
|
|
};
|
|
var badAlgZero = cloneObject(badAlg);
|
|
badAlgZero.alg = 0;
|
|
|
|
// bad pubKeyCredParams values
|
|
new CreateCredentialsTest({path: "options.publicKey.pubKeyCredParams", value: undefined}).runTest("Bad pubKeyCredParams: pubKeyCredParams is undefined", new TypeError());
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", "hi mom").runTest("Bad pubKeyCredParams: pubKeyCredParams is string", new TypeError());
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", null).runTest("Bad pubKeyCredParams: pubKeyCredParams is null", new TypeError());
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badType]).runTest("Bad pubKeyCredParams: first param has bad type (\"something-else\")", new TypeError());
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeEmptyString]).runTest("Bad pubKeyCredParams: first param has bad type (\"\")", new TypeError());
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeNull]).runTest("Bad pubKeyCredParams: first param has bad type (null)", new TypeError());
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badTypeEmptyObj]).runTest("Bad pubKeyCredParams: first param has bad type (empty object)", new TypeError());
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badAlg]).runTest("Bad pubKeyCredParams: first param has bad alg (42)", "NotSupportedError");
|
|
new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [badAlgZero]).runTest("Bad pubKeyCredParams: first param has bad alg (0)", "NotSupportedError");
|
|
|
|
// TODO: come back to this when mock authenticators support multiple cryptos so that we can test the preference ranking
|
|
// function verifyEC256(res) {
|
|
// debug ("verifyEC256 got", res);
|
|
// debug ("client data JSON", ab2str(res.response.clientDataJSON));
|
|
// parseAuthenticatorData(res.response.attestationObject);
|
|
// }
|
|
// new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [pkParamEC256, pkParamEC512])
|
|
// .afterTest(verifyEC256)
|
|
// .runTest("EC256, EC512 pubKeyCredParams");
|
|
// function verifyEC512(res) {
|
|
// debug ("verifyEC512 got", res);
|
|
// debug ("client data JSON", ab2str(res.response.clientDataJSON));
|
|
// // parseAuthenticatorData(res.response.attestationObject);
|
|
// printHex ("clientDataJSON", res.response.clientDataJSON);
|
|
// printHex ("attestationObject", res.response.attestationObject);
|
|
// }
|
|
// new CreateCredentialsTest("options.publicKey.pubKeyCredParams", [pkParamEC512, pkParamEC256])
|
|
// .afterTest(verifyEC512)
|
|
// .runTest("EC512, EC256 pubKeyCredParams");
|
|
});
|
|
|
|
/* JSHINT */
|
|
/* globals standardSetup, CreateCredentialsTest, cose_alg_ECDSA_w_SHA512, cloneObject */
|
|
</script> |