~mmach/netext73/webkit2gtk

« back to all changes in this revision

Viewing changes to Tools/TestWebKitAPI/Tests/WebKitCocoa/web-authentication-make-credential-hid-pin-get-pin-token-error.html

  • Committer: mmach
  • Date: 2023-06-16 17:21:37 UTC
  • Revision ID: netbit73@gmail.com-20230616172137-2rqx6yr96ga9g3kp
1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<input type="text" id="input">
 
2
<script>
 
3
    const testCtapPinInvalidErrorBase64 = "MQ==";
 
4
    const testPinGetRetriesResponseBase64 = "AKEDCA==";
 
5
    const testPinGetKeyAgreementResponseBase64 = "AKEBpQECAzgYIAEhWCDodiWJbuTkbcAydm6Ah5YvNt+d/otWfzdjAVsZkKYOFCJYICfeYS1mQYvaGVBYHrxcjB2tcQyxTCL4yXBF9GEvsgyR";
 
6
    const testCtapInvalidParameterErrorBase64 = "Ag==";
 
7
    if (window.internals) {
 
8
        internals.setMockWebAuthenticationConfiguration({ hid: { supportClientPin: true, payloadBase64: [testCtapPinInvalidErrorBase64, testPinGetRetriesResponseBase64, testPinGetKeyAgreementResponseBase64, testCtapInvalidParameterErrorBase64] } });
 
9
        internals.withUserGesture(() => { input.focus(); });
 
10
    }
 
11
 
 
12
    const options = {
 
13
        publicKey: {
 
14
            rp: {
 
15
                name: "localhost",
 
16
            },
 
17
            user: {
 
18
                name: "John Appleseed",
 
19
                id: new Uint8Array(16),
 
20
                displayName: "Appleseed",
 
21
            },
 
22
            challenge: new Uint8Array(16),
 
23
            pubKeyCredParams: [{ type: "public-key", alg: -7 }]
 
24
        }
 
25
    };
 
26
 
 
27
    navigator.credentials.create(options).then(credential => {
 
28
        // console.log("Succeeded!");
 
29
        window.webkit.messageHandlers.testHandler.postMessage("Succeeded!");
 
30
    }, error => {
 
31
        // console.log(error.message);
 
32
        window.webkit.messageHandlers.testHandler.postMessage(error.message);
 
33
    });
 
34
</script>