summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webauthn/createcredential-badargs-user.https.html
blob: e487242571769125238e87f0d22731a54c58bed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<meta charset="utf-8">
<title>WebAuthn navigator.credentials.create() user Tests</title>
<meta name="timeout" content="long">
<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="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src=helpers.js></script>
<body></body>
<script>
standardSetup(function() {
    "use strict";

    // user bad values
    new CreateCredentialsTest({path: "options.publicKey.user", value: undefined}).runTest("Bad user: user missing", TypeError);
    new CreateCredentialsTest("options.publicKey.user", "hi mom").runTest("Bad user: user is string", TypeError);
    new CreateCredentialsTest("options.publicKey.user", {}).runTest("Bad user: user is empty object", TypeError);

    // // user.id
    new CreateCredentialsTest({path: "options.publicKey.user.id", value: undefined}).runTest("Bad user: id is undefined", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", {}).runTest("Bad user: id is object", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", null).runTest("Bad user: id is null", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", "").runTest("Bad user: id is empty String", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", new Array()).runTest("Bad user: id is empty Array", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", new ArrayBuffer(65)).runTest("Bad user: ArrayBuffer id is too long (65 bytes)", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", new Int16Array(33)).runTest("Bad user: Int16Array id is too long (66 bytes)", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", new Int32Array(17)).runTest("Bad user: Int32Array id is too long (68 bytes)", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", new Float32Array(17)).runTest("Bad user: Float32Array id is too long (68 bytes)", TypeError);
    new CreateCredentialsTest("options.publicKey.user.id", new Float64Array(9)).runTest("Bad user: Float64Array id is too long (72 bytes)", TypeError);
    var buf = new ArrayBuffer(65);
    new CreateCredentialsTest("options.publicKey.user.id", new DataView(buf)).runTest("Bad user: id is too long (65 bytes)", TypeError);

    // // user.name
    new CreateCredentialsTest({path: "options.publicKey.user.name", value: undefined}).runTest("user missing name", TypeError);

    // // user.displayName
    new CreateCredentialsTest({path: "options.publicKey.user.displayName", value: undefined}).runTest("Bad user: displayName is undefined", TypeError);
});

/* JSHINT */
/* globals standardSetup, CreateCredentialsTest */
</script>