Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly specify binary encoding for string truncation #2017

Merged
merged 8 commits into from
May 27, 2024
11 changes: 7 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3194,7 +3194,9 @@ associated with or [=scoped=] to, respectively.

When [=clients=], [=client platforms=], or [=authenticators=] display a {{PublicKeyCredentialEntity/name}}'s value, they should always use UI elements to provide a clear boundary around the displayed value, and not allow overflow into other elements [[css-overflow-3]].

Authenticators MAY truncate a {{PublicKeyCredentialEntity/name}} member's value so that it fits within 64 bytes, if the authenticator stores the value. See [[#sctn-strings-truncation]] about truncation and other considerations.
When storing a {{PublicKeyCredentialEntity/name}} member's value,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor nit: this comma (and in the next diff hunk) read oddly to me, but I'm happy either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I see. If you don't mind I'll keep it as is, if only for consistency with the first sentence in the paragraph immediately preceding this (and also the next hunk).

[=authenticators=] MUST support any value whose length in the UTF-8 character encoding is 64 bytes or less.
emlun marked this conversation as resolved.
Show resolved Hide resolved
Authenticators MAY truncate the value as described in [[#sctn-strings-truncation]].
</div>


Expand Down Expand Up @@ -3265,8 +3267,9 @@ credential.

When [=clients=], [=client platforms=], or [=authenticators=] display a {{PublicKeyCredentialUserEntity/displayName}}'s value, they should always use UI elements to provide a clear boundary around the displayed value, and not allow overflow into other elements [[css-overflow-3]].

[=Authenticators=] MUST accept and store a 64-byte minimum length for a {{PublicKeyCredentialUserEntity/displayName}}
member's value. Authenticators MAY truncate a {{PublicKeyCredentialUserEntity/displayName}} member's value so that it fits within 64 bytes. See [[#sctn-strings-truncation]] about truncation and other considerations.
When storing a {{PublicKeyCredentialUserEntity/displayName}} member's value,
[=authenticators=] MUST support any value whose length in the UTF-8 character encoding is 64 bytes or less.
emlun marked this conversation as resolved.
Show resolved Hide resolved
Authenticators MAY truncate the value as described in [[#sctn-strings-truncation]].
</div>


Expand Down Expand Up @@ -4919,7 +4922,7 @@ Authenticators may be required to store arbitrary strings chosen by a [=[RP]=],

### String Truncation ### {#sctn-strings-truncation}

Each arbitrary string in the API will have some accommodation for the potentially limited resources available to an [=authenticator=]. If string value truncation is the chosen accommodation then authenticators MAY truncate in order to make the string fit within a length equal or greater than the specified minimum supported length. Such truncation SHOULD also respect UTF-8 sequence boundaries or [=grapheme cluster=] boundaries [[UAX29]]. This defines the maximum truncation permitted and authenticators MUST NOT truncate further.
Each arbitrary string in the API will have some accommodation for the potentially limited resources available to an [=authenticator=]. If string value truncation is the chosen accommodation then authenticators MAY truncate in order to make the string fit within a length equal to or greater than the specified minimum supported length. Such truncation SHOULD also respect UTF-8 sequence boundaries or [=grapheme cluster=] boundaries [[UAX29]]. This defines the maximum truncation permitted and authenticators MUST NOT truncate further.
emlun marked this conversation as resolved.
Show resolved Hide resolved

For example, in <a href="#fig-stringTruncation">figure <span class="figure-num-following"></span></a> the string is 65 bytes long. If truncating to 64 bytes then the final 0x88 byte must be removed purely because of space reasons. Since that leaves a partial UTF-8 sequence the remainder of that sequence may also be removed. Since that leaves a partial [=grapheme cluster=] an authenticator may remove the remainder of that cluster.

Expand Down