[WebAuthN] Import a JS CBOR coder
[WebKit-https.git] / LayoutTests / http / wpt / webauthn / public-key-credential-get-success-local.https.html
index 67771c2..c617e75 100644 (file)
@@ -6,7 +6,7 @@
 <script>
     // Default mock configuration. Tests need to override if they need different configuration.
     if (window.testRunner)
-        testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false, privateKeyBase64: "" } });
+        testRunner.setWebAuthenticationMockConfiguration({ local: { acceptAuthentication: true, acceptAttestation: false } });
 
     function checkResult(credential)
     {
@@ -14,9 +14,9 @@
             testRunner.cleanUpKeychain(testRpId);
 
          // Check respond
-        assert_equals(credential.id, testCredentialIdBase64url);
+        assert_array_equals(Base64URL.parse(credential.id), Base64URL.parse(testCredentialIdBase64));
         assert_equals(credential.type, 'public-key');
-        assert_equals(bytesToHexString(credential.rawId), "48c4971e7805ee110eb04940ef70b7458fbc6d1e");
+        assert_array_equals(new Uint8Array(credential.rawId), Base64URL.parse(testCredentialIdBase64));
         assert_equals(bytesToASCIIString(credential.response.clientDataJSON), '{"type":"webauthn.get","challenge":"MTIzNDU2","origin":"https://localhost:9443","hashAlgorithm":"SHA-256"}');
         assert_equals(bytesToHexString(credential.response.userHandle), "00010203040506070809");
 
@@ -27,7 +27,7 @@
         assert_equals(authData.counter, 0);
 
         // Check signature
-        return crypto.subtle.importKey("raw", Base64URL.parse(testES256PublicKeyBase64url), { name: "ECDSA", namedCurve: "P-256" }, false, ['verify']).then( publicKey => {
+        return crypto.subtle.importKey("raw", Base64URL.parse(testES256PublicKeyBase64), { name: "ECDSA", namedCurve: "P-256" }, false, ['verify']).then( publicKey => {
             return crypto.subtle.digest("sha-256", credential.response.clientDataJSON).then ( hash => {
                 // credential.response.signature is in ASN.1 and WebCrypto expect signatures provides in r|s.
                 return crypto.subtle.verify({name: "ECDSA", hash: "SHA-256"}, publicKey, extractRawSignature(credential.response.signature), concatenateBuffers(credential.response.authenticatorData, hash)).then( verified => {
@@ -58,7 +58,7 @@
                 challenge: Base64URL.parse("MTIzNDU2"),
                 allowCredentials: [
                     { type: "public-key", id: Base64URL.parse(testUserhandleBase64), transports: ["internal"] },
-                    { type: "public-key", id: Base64URL.parse(testCredentialIdBase64url), transports: ["internal"] }
+                    { type: "public-key", id: Base64URL.parse(testCredentialIdBase64), transports: ["internal"] }
                 ]
             }
         };