Skip to content

Commit

Permalink
Infer crossOrigin argument from topOrigin
Browse files Browse the repository at this point in the history
  • Loading branch information
emlun committed Aug 14, 2024
1 parent 213cb24 commit 60fc0e8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3831,8 +3831,7 @@ Verifiers may use the following algorithm to verify an encoded {{CollectedClient
1. A string, |type|, that contains the expected {{CollectedClientData/type}}.
1. A byte string, |challenge|, that contains the challenge byte string that was given in the {{PublicKeyCredentialRequestOptions}} or {{PublicKeyCredentialCreationOptions}}.
1. A string, |origin|, that contains the expected {{CollectedClientData/origin}} that issued the request to the user agent.
1. A boolean, |crossOrigin|, that is true if, and only if, the request should have been performed within a cross-origin <{iframe}>.
1. An optional string, |topOrigin|, that contains the expected {{CollectedClientData/topOrigin}} that issued the request to the user agent if |crossOrigin| is true and if available.
1. An optional string, |topOrigin|, that contains the expected {{CollectedClientData/topOrigin}} that issued the request to the user agent, if available.
1. A boolean, |requireTopOrigin|, that is true if, and only if, the verification should fail
if |topOrigin| is defined and the {{CollectedClientData/topOrigin}} attribute is not present in |clientDataJSON|.

Expand All @@ -3850,15 +3849,14 @@ Verifiers may use the following algorithm to verify an encoded {{CollectedClient
1. Append 0x2c226f726967696e223a (`,"origin":`) to |expected|.
1. Append [=CCDToString=](|origin|) to |expected|.
1. Append 0x2c2263726f73734f726967696e223a (`,"crossOrigin":`) to |expected|.
1. If |crossOrigin| is true:
1. If |topOrigin| is defined:
1. Append 0x74727565 (`true`) to |expected|.
1. If |topOrigin| is defined:
1. If |requireTopOrigin| is true
or if 0x2c22746f704f726967696e223a (`,"topOrigin":`) is a prefix
of the substring of |clientDataJSON| beginning at the offset equal to the length of |expected|:
1. Append 0x2c22746f704f726967696e223a (`,"topOrigin":`) to |expected|.
1. Append [=CCDToString=](|topOrigin|) to |expected|.
1. Otherwise, i.e. |crossOrigin| is false:
1. If |requireTopOrigin| is true
or if 0x2c22746f704f726967696e223a (`,"topOrigin":`) is a prefix
of the substring of |clientDataJSON| beginning at the offset equal to the length of |expected|:
1. Append 0x2c22746f704f726967696e223a (`,"topOrigin":`) to |expected|.
1. Append [=CCDToString=](|topOrigin|) to |expected|.
1. Otherwise, i.e. |topOrigin| is not defined:
1. Append 0x66616c7365 (`false`) to |expected|.
1. If |expected| is not a prefix of |clientDataJSON| then the verification has failed.
1. If |clientDataJSON| is not at least one byte longer than |expected| then the verification has failed.
Expand Down

0 comments on commit 60fc0e8

Please sign in to comment.