Skip to content

Commit

Permalink
Extract <dfn> for CollectedClientData serialization algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
emlun committed Aug 14, 2024
1 parent 6b3e0fb commit ed7bad3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2966,7 +2966,7 @@ value and terminate the operation.
</xmp>
<div dfn-type="attribute" dfn-for="AuthenticatorResponse">
: <dfn>clientDataJSON</dfn>
:: This attribute contains a [[#clientdatajson-serialization|JSON-compatible serialization]] of the [=client data=], the [=hash of the serialized client data|hash of which=] is passed to the
:: This attribute contains a [=JSON-compatible serialization of client data|JSON-compatible serialization=] of the [=client data=], the [=hash of the serialized client data|hash of which=] is passed to the
authenticator by the client in its call to either {{CredentialsContainer/create()}} or {{CredentialsContainer/get()}} (i.e., the
[=client data=] itself is not sent to the authenticator).
</div>
Expand Down Expand Up @@ -3763,7 +3763,7 @@ Note: The {{CollectedClientData}} may be extended in the future. Therefore it's
The {{CollectedClientData}} structure is used by the client to compute the following quantities:

: <dfn dfn>JSON-compatible serialization of client data</dfn>
:: This is the result of performing the [JSON-compatible serialization algorithm](#clientdatajson-serialization) on the {{CollectedClientData}} dictionary.
:: This is the result of performing the [=CollectedClientData/JSON-compatible serialization algorithm=] on the {{CollectedClientData}} dictionary.

: <dfn dfn>Hash of the serialized client data</dfn>
:: This is the hash (computed using SHA-256) of the [=JSON-compatible serialization of client data=], as constructed by the client.
Expand All @@ -3773,7 +3773,9 @@ Note: The {{CollectedClientData}} may be extended in the future. Therefore it's

The serialization of the {{CollectedClientData}} is a subset of the algorithm for [=serialize JSON to bytes|JSON-serializing to bytes=]. I.e. it produces a valid JSON encoding of the {{CollectedClientData}} but also provides additional structure that may be exploited by verifiers to avoid integrating a full JSON parser. While verifiers are recommended to perform standard JSON parsing, they may use the [more limited algorithm](#clientdatajson-verification) below in contexts where a full JSON parser is too large. This verification algorithm requires only [=base64url encoding=], appending of bytestrings (which could be implemented by writing into a fixed template), and simple conditional checks (assuming that inputs are known not to need escaping).

The serialization algorithm works by appending successive byte strings to an, initially empty, partial result until the complete result is obtained.
The
<dfn for="CollectedClientData">JSON-compatible serialization algorithm</dfn>
works by appending successive byte strings to an, initially empty, partial result until the complete result is obtained:

1. Let |result| be an empty byte string.
1. Append 0x7b2274797065223a (`{"type":`) to |result|.
Expand Down

0 comments on commit ed7bad3

Please sign in to comment.