From 41c514f6e1db4b4aaba77c3145990f0f99c5bd7b Mon Sep 17 00:00:00 2001 From: Emil Lundberg Date: Wed, 2 Oct 2024 22:35:41 +0200 Subject: [PATCH 1/2] Consistently use instead of <pre> for code examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using `<pre>` sometimes causes some characters to be converted into others. This is especially apparent in CDDL examples, where for example the first single quote in `foo = h'001122'` gets converted into "’" (U+2019) instead of "'" (U+0027), which is incorrect and also breaks CDDL syntax highlighting. See the [Bikeshed documentation][1] for more on using `<xmp>`. [1]: https://speced.github.io/bikeshed/#xmp --- index.bs | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/index.bs b/index.bs index f537878e3..260976e74 100644 --- a/index.bs +++ b/index.bs @@ -536,7 +536,7 @@ In this flow, the [=[WRP]=] does not have a preference for [=platform authentica The sample code for generating and registering a new key follows: -<pre class="example" highlight="js"> +<xmp class="example" highlight="js"> if (!window.PublicKeyCredential) { /* Client not capable. Handle error. */ } var publicKey = { @@ -591,7 +591,7 @@ The sample code for generating and registering a new key follows: }).catch(function (err) { // No acceptable authenticator or user refused consent. Handle appropriately. }); -</pre> + ### Registration Specifically with User-Verifying Platform Authenticator ### {#sctn-sample-registration-with-platform-authenticator} @@ -613,7 +613,7 @@ a [=user-verifying platform authenticator=]. 1. Upon successful credential creation, the [=[RP]=] script conveys the new credential to the server. -
+
     if (!window.PublicKeyCredential) { /* Client not capable of the API. Handle error. */ }
 
     PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
@@ -637,7 +637,7 @@ a [=user-verifying platform authenticator=].
         }).catch(function (err) {
             // Something went wrong. Handle appropriately.
         });
-</pre>
+
 
 ### Authentication ### {#sctn-sample-authentication}
 
@@ -679,7 +679,7 @@ credential.
 If the [=[RP]=] script does not have any hints available (e.g., from locally stored data) to help it narrow the list of
 credentials, then the sample code for performing such an authentication might look like this:
 
-
+
     if (!window.PublicKeyCredential) { /* Client not capable. Handle error. */ }
 
     // credentialId is generated by the authenticator and is an opaque random byte array
@@ -697,12 +697,12 @@ credentials, then the sample code for performing such an authentication might lo
     }).catch(function (err) {
         // No acceptable credential or user refused consent. Handle appropriately.
     });
-</pre>
+
 
 On the other hand, if the [=[RP]=] script has some hints to help it narrow the list of credentials, then the sample code for
 performing such an authentication might look like the following. Note that this sample also demonstrates how to use the [=credProps|Credential Properties Extension=].
 
-
+
     if (!window.PublicKeyCredential) { /* Client not capable. Handle error. */ }
 
     var encoder = new TextEncoder();
@@ -729,14 +729,14 @@ performing such an authentication might look like the following. Note that this
     }).catch(function (err) {
         // No acceptable credential or user refused consent. Handle appropriately.
     });
-</pre>
+
 
 ### Aborting Authentication Operations ### {#sctn-sample-aborting}
 
 The below example shows how a developer may use the AbortSignal parameter to abort a
 credential registration operation. A similar procedure applies to an authentication operation.
 
-
+
     const authAbortController = new AbortController();
     const authAbortSignal = authAbortController.signal;
 
@@ -764,7 +764,7 @@ credential registration operation. A similar procedure applies to an authenticat
     if (widget == "disappear") {
         authAbortController.abort();
     }
-</pre>
+
 
 
 ### Decommissioning ### {#sctn-sample-decommissioning}
@@ -5669,7 +5669,7 @@ Below is an example of a COSE_Key-encoded Elliptic Curve public key in EC2 forma
 on the P-256 curve, to be used with the ES256 signature
 algorithm (ECDSA w/ SHA-256, see [=Section 2.1=] of [[!RFC9053]]):
 
-
+
   {
     1:   2,  ; kty: EC2 key type
     3:  -7,  ; alg: ES256 signature algorithm
@@ -5679,12 +5679,12 @@ algorithm (ECDSA w/ SHA-256, see [=Section 2.1=] of [[!RFC9053]]):
    -3:   y   ; y-coordinate as byte string 32 bytes in length
              ; e.g., in hex: 1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c
   }
-</pre>
+
 
 Below is the above Elliptic Curve public key encoded in the [=CTAP2 canonical CBOR encoding form=], whitespace and line breaks
 are included here for clarity and to match the CDDL [[!RFC8610]] presentation above:
 
-
+
   A5
      01  02
 
@@ -5695,14 +5695,14 @@ are included here for clarity and to match the CDDL [[!RFC8610]] presentation ab
      21  58 20   65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c08551d
 
      22  58 20   1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd0084d19c
-</pre>
+
 
 
 Below is an example of a COSE_Key-encoded 2048-bit RSA public key (see [[RFC8230]] [=Section 4=],
 to be used with the PS256 signature algorithm
 (RSASSA-PSS with SHA-256, see [=RFC8230/Section 2=] of [[RFC8230]]:
 
-
+
   {
     1:   3,  ; kty: RSA key type
     3: -37,  ; alg: PS256
@@ -5711,12 +5711,12 @@ to be used with the PS256 signature algorithm
    -2:   e   ; e:   RSA public exponent e byte string 3 bytes in length
              ;      e.g., in hex: 010001
   }
-</pre>
+
 
 Below is an example of the same COSE_Key-encoded RSA public key as above,
 to be used with the RS256 signature algorithm (RSASSA-PKCS1-v1_5 with SHA-256):
 
-
+
   {
     1:   3,  ; kty: RSA key type
     3:-257,  ; alg: RS256
@@ -5725,7 +5725,7 @@ to be used with the RS256 signature algorithm (RSASSA-PKCS1-v1_5 with SHA-256):
    -2:   e   ; e:   RSA public exponent e byte string 3 bytes in length
              ;      e.g., in hex: 010001
   }
-</pre>
+
 
 
 ### Attestation Statement Formats ### {#sctn-attestation-formats}
@@ -7040,7 +7040,7 @@ Note: Other documents have specified extensions where the extension input does n
 as the entry key.
 New extensions SHOULD follow the above convention.
 
-
+
     var assertionPromise = navigator.credentials.get({
         publicKey: {
             // Other members omitted for brevity
@@ -7054,7 +7054,7 @@ New extensions SHOULD follow the above convention.
             }
         }
     });
-</pre>
+
 
 Extension definitions MUST specify the valid values for their [=client extension input=]. Clients SHOULD ignore extensions with
 an invalid [=client extension input=]. If an extension does not require any parameters from the [=[RP]=], it SHOULD be defined
@@ -7077,14 +7077,14 @@ The following example defines that an extension with [=extension identifier|iden
 takes an unsigned integer as [=authenticator extension input=],
 and returns an array of at least one byte string as [=authenticator extension output=]:
 
-
+
     $$extensionInput //= (
       webauthnExample_foobar: uint
     )
     $$extensionOutput //= (
       webauthnExample_foobar: [+ bytes]
     )
-</pre>
+
 
 Note: Extensions should aim to define authenticator arguments that are as small as possible. Some authenticators communicate
     over low-bandwidth links such as Bluetooth Low-Energy or NFC.

From ef54852bf773d82174798bfff3e87469380db325 Mon Sep 17 00:00:00 2001
From: Emil Lundberg 
Date: Wed, 2 Oct 2024 22:39:49 +0200
Subject: [PATCH 2/2] Fix syntax highlighting tags

---
 index.bs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/index.bs b/index.bs
index 260976e74..ea23ad1f2 100644
--- a/index.bs
+++ b/index.bs
@@ -5669,7 +5669,7 @@ Below is an example of a COSE_Key-encoded Elliptic Curve public key in EC2 forma
 on the P-256 curve, to be used with the ES256 signature
 algorithm (ECDSA w/ SHA-256, see [=Section 2.1=] of [[!RFC9053]]):
 
-
+<xmp class="example" highlight="cddl">
   {
     1:   2,  ; kty: EC2 key type
     3:  -7,  ; alg: ES256 signature algorithm
@@ -5684,7 +5684,7 @@ algorithm (ECDSA w/ SHA-256, see [=Section 2.1=] of [[!RFC9053]]):
 Below is the above Elliptic Curve public key encoded in the [=CTAP2 canonical CBOR encoding form=], whitespace and line breaks
 are included here for clarity and to match the CDDL [[!RFC8610]] presentation above:
 
-<xmp class="example" highlight="json">
+<xmp class="example">
   A5
      01  02
 
@@ -5702,7 +5702,7 @@ Below is an example of a COSE_Key-encoded 2048-bit RSA public key (see [[RFC8230
 to be used with the PS256 signature algorithm
 (RSASSA-PSS with SHA-256, see [=RFC8230/Section 2=] of [[RFC8230]]:
 
-<xmp class="example" highlight="json">
+<xmp class="example" highlight="cddl">
   {
     1:   3,  ; kty: RSA key type
     3: -37,  ; alg: PS256
@@ -5716,7 +5716,7 @@ to be used with the PS256 signature algorithm
 Below is an example of the same COSE_Key-encoded RSA public key as above,
 to be used with the RS256 signature algorithm (RSASSA-PKCS1-v1_5 with SHA-256):
 
-<xmp class="example" highlight="json">
+<xmp class="example" highlight="cddl">
   {
     1:   3,  ; kty: RSA key type
     3:-257,  ; alg: RS256
@@ -7077,7 +7077,7 @@ The following example defines that an extension with [=extension identifier|iden
 takes an unsigned integer as [=authenticator extension input=],
 and returns an array of at least one byte string as [=authenticator extension output=]:
 
-<xmp class="example">
+<xmp class="example" highlight="cddl">
     $$extensionInput //= (
       webauthnExample_foobar: uint
     )