blob: db63f6ccc75f2831834bd2d7113223f25c76c63f [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>IDL check of WebAuthN</title>
<link rel="help" href="https://www.w3.org/TR/webauthn/#idl-index">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script src="./resources/util.js"></script>
</head>
<body>
<h1 class="instructions">Description</h1>
<p class="instructions">This test verifies that the implementations of the WebAuthN API match with its WebIDL definition.</p>
<div id='log'></div>
<script>
if (window.testRunner)
testRunner.setWebAuthenticationMockConfiguration({
local: {
acceptAuthentication: true,
acceptAttestation: true,
privateKeyBase64: testES256PrivateKeyBase64,
userCertificateBase64: testAttestationCertificateBase64,
intermediateCACertificateBase64: testAttestationIssuingCACertificateBase64
}
});
promise_test(async () => {
const idlURL = ["WebAuthN.idl"];
const idlArray = new IdlArray();
const idlText = await fetch(idlURL).then(r => r.text());
idlArray.add_untested_idls("interface ArrayBuffer {};");
idlArray.add_untested_idls("dictionary CredentialCreationOptions {};");
idlArray.add_untested_idls("dictionary CredentialRequestOptions {};");
idlArray.add_idls(`
[Exposed=Window, SecureContext]
interface Credential {
readonly attribute USVString id;
readonly attribute DOMString type;
};
`);
idlArray.add_idls(idlText);
const creationOptions = {
publicKey: {
rp: {
name: "localhost",
},
user: {
name: "John Appleseed",
id: Base64URL.parse(testUserhandleBase64),
displayName: "Appleseed",
},
challenge: Base64URL.parse("MTIzNDU2"),
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
}
};
createdCredential = await navigator.credentials.create(creationOptions);
const requestOptions = {
publicKey: {
challenge: Base64URL.parse("MTIzNDU2"),
}
};
requestedCredential = await navigator.credentials.get(requestOptions);
idlArray.add_objects({"PublicKeyCredential": ["createdCredential"], "AuthenticatorAttestationResponse": ["createdCredential.response"], "AuthenticatorAssertionResponse": ["requestedCredential.response"]});
idlArray.test();
if (window.testRunner)
testRunner.cleanUpKeychain(testRpId);
}, "Setup for WebAuthN API IDL tests.");
</script>