enrollment.https.html (2821B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <meta name="timeout" content="long"> 4 <title>Test for registering a PublicKeyCredential with "payment" extension</title> 5 <link rel="help" href="https://w3c.github.io/secure-payment-confirmation/#client-extension-processing-registration"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="/resources/testdriver.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <script src=../webauthn/helpers.js></script> 11 <body></body> 12 <script> 13 class CreatePaymentCredentialsTest extends CreateCredentialsTest { 14 constructor(authenticatorSelection) { 15 super('options.publicKey.extensions', { 16 payment: { isPayment: true }, 17 }); 18 this.testObject.options.publicKey.authenticatorSelection = { 19 userVerification: 'required', 20 residentKey: 'required', 21 authenticatorAttachment: 'platform', 22 }; 23 authenticatorSelection ||= {}; 24 // Override specific fields. 25 extendObject(this.testObject.options.publicKey.authenticatorSelection, authenticatorSelection); 26 } 27 } 28 29 standardSetup(function() { 30 // good creates 31 new CreatePaymentCredentialsTest().runTest('Payment credential is created successfully.'); 32 new CreatePaymentCredentialsTest({residentKey: 'preferred'}) 33 .runTest('Payment credential allows residentKey to be "preferred".'); 34 35 // bad creates 36 new CreatePaymentCredentialsTest({userVerification: 'preferred'}) 37 .runTest('Payment credential requires userVerification to be "required", not "preferred".', "NotSupportedError"); 38 new CreatePaymentCredentialsTest({userVerification: 'discouraged'}) 39 .runTest('Payment credential requires userVerification to be "required", not "discouraged".', "NotSupportedError"); 40 new CreatePaymentCredentialsTest({residentKey: 'discouraged'}) 41 .runTest('Payment credential does not allow residentKey to be "discouraged".', "NotSupportedError"); 42 new CreatePaymentCredentialsTest({authenticatorAttachment: 'cross-platform'}) 43 .runTest('Payment credential requires authenticatorAttachment to be "platform", not "cross-platform".', "NotSupportedError"); 44 45 // abort creates 46 let abortController = new AbortController(); 47 abortController.abort(); 48 new CreatePaymentCredentialsTest() 49 .modify("options.signal", abortController.signal) 50 .runTest("Payment credential abort without reason", "AbortError"); 51 52 abortController = new AbortController(); 53 abortController.abort(new Error('error')); 54 new CreatePaymentCredentialsTest() 55 .modify("options.signal", abortController.signal) 56 .runTest("Payment credential abort reason with Error", Error); 57 }, { 58 protocol: 'ctap2_1', 59 transport: 'internal', 60 hasResidentKey: true, 61 hasUserVerification: true, 62 isUserVerified: true, 63 }); 64 </script>