tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

authentication-requires-user-activation.https.html (1632B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Test for the 'secure-payment-confirmation' payment method authentication - requires user activation</title>
      4 <link rel="help" href="https://w3c.github.io/secure-payment-confirmation/sctn-authentication">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/testdriver.js"></script>
      8 <script src="/resources/testdriver-vendor.js"></script>
      9 <script src="utils.sub.js"></script>
     10 <script>
     11 'use strict';
     12 
     13 promise_test(async t => {
     14  const authenticator = await window.test_driver.add_virtual_authenticator(
     15      AUTHENTICATOR_OPTS);
     16  t.add_cleanup(() => {
     17    return window.test_driver.remove_virtual_authenticator(authenticator);
     18  });
     19 
     20  await window.test_driver.set_spc_transaction_mode("autoAccept");
     21  t.add_cleanup(() => {
     22    return window.test_driver.set_spc_transaction_mode("none");
     23  });
     24 
     25 
     26  const credential = await createCredential();
     27 
     28  const challenge = 'server challenge';
     29  const payeeOrigin = 'https://merchant.com';
     30  const displayName = 'Troycard ***1234';
     31  const request = new PaymentRequest([{
     32    supportedMethods: 'secure-payment-confirmation',
     33    data: {
     34      credentialIds: [credential.rawId],
     35      challenge: Uint8Array.from(challenge, c => c.charCodeAt(0)),
     36      rpId: window.location.hostname,
     37      payeeOrigin,
     38      timeout: 60000,
     39      instrument: {
     40        displayName,
     41        icon: ICON_URL,
     42      },
     43    }
     44  }], PAYMENT_DETAILS);
     45 
     46  return promise_rejects_dom(t, "SecurityError", request.show());
     47 }, 'SPC authentication not allowed without a user activation');
     48 </script>