Skip to content

Commit

Permalink
[SPC] Rename rp --> rpId in CollectedClientAdditionalPaymentData (#35602
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmcgruer authored Aug 25, 2022
1 parent 3f74169 commit 642097f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,21 @@
assert_false(clientDataJSON.crossOrigin);

// Payment-specific information.
assert_equals(clientDataJSON.payment.rp, window.location.hostname);
assert_equals(clientDataJSON.payment.rpId, window.location.hostname);
assert_equals(clientDataJSON.payment.topOrigin, window.location.origin);
assert_equals(clientDataJSON.payment.payeeOrigin, payeeOrigin);
assert_equals(clientDataJSON.payment.total.value, PAYMENT_DETAILS.total.amount.value);
assert_equals(clientDataJSON.payment.total.currency, PAYMENT_DETAILS.total.amount.currency);
assert_equals(clientDataJSON.payment.instrument.icon, ICON_URL);
assert_equals(clientDataJSON.payment.instrument.displayName, displayName);

// If the User Agent still supports the legacy 'rp' output parameter, it
// should be identical to the 'rpId' output parameter. See
// https://github.com/w3c/secure-payment-confirmation/pull/198
if ('rp' in clientDataJSON.payment) {
assert_equals(clientDataJSON.payment.rp, clientDataJSON.payment.rpId);
}

// TODO: Verify cred.response.signature, to validate that it covers all fields
// from clientDataJSON.
}, 'Successful SPC authentication');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
// The origin should be ourselves, whilst the RP should be the alt hostname
// (as the owner of the credential).
assert_equals(clientDataJSON.origin, window.location.origin);
assert_equals(clientDataJSON.payment.rp, '{{hosts[alt][]}}');
assert_equals(clientDataJSON.payment.rpId, '{{hosts[alt][]}}');
}, 'Cross-origin SPC authentication ceremony');
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
assert_equals(result.clientDataJSON.origin, 'https://{{hosts[alt][]}}:{{ports[https][0]}}');
assert_equals(result.clientDataJSON.payment.topOrigin, window.location.origin);
// The credential was created in this frame, and so we are the rp.
assert_equals(result.clientDataJSON.payment.rp, window.location.hostname);
assert_equals(result.clientDataJSON.payment.rpId, window.location.hostname);
// The payeeOrigin should be unrelated to what the origin and topOrigin are.
assert_equals(result.clientDataJSON.payment.payeeOrigin, 'https://merchant.com');
}, 'SPC authentication ceremony in cross-origin iframe');
Expand Down

0 comments on commit 642097f

Please sign in to comment.