Subject: [Cbor] Cutting down base64 (b64'....') in diagnostic notation examples, before elision

From: Carsten Bormann <[email-masked]>
Date: Wed, 23 Mar 2022 07:47:37 +0100

(1) Random observation, most relevant until we have elision: 

If you randomly truncate a base64 string (no padding), there is only a 1 out of 3 chance (actually 21/64) that the result will still be a base64 string (no padding).  
If you cut it down to a multiple of 4 characters, the result will always be valid.

(2) The current implementation of cbor-diag does not allow comments in b64’…' (https://github.com/cabo/cbor-diag/issues/22).
However, they already work in h’…’ byte strings, so…

h’47110815/.../‘

…or more verbosely…

h’47110815/... (rest of CWT omitted)/‘

…leaves your diagnostic notation parsable (but with truncated values, of course).

Note that an apostroph terminates the byte string prematurely, so don’t use something like...

h’47110815/... (rest of client’s key omitted)/‘

…in your h’…’ comments.

Because of the abovementioned bug, I’d use

b64’A7ii08iS'/... (rest of CWT omitted)/

…for now if b64 is needed (but see note about truncation above).

(Apologies for smartquotes.)

Grüße, Carsten

---

From: Michael Richardson <[email-masked]>
Date: Thu, 24 Mar 2022 19:17:00 +0100

> If you randomly truncate a base64 string (no padding), there is only a
    > 1 out of 3 chance (actually 21/64) that the result will still be a
    > base64 string (no padding).  If you cut it down to a multiple of 4
    > characters, the result will always be valid.

That's a good point.
I wonder if this is worth sharing with the RPC people in some fashion.

    > (2) The current implementation of cbor-diag does not allow comments in
    > b64’…' (https://github.com/cabo/cbor-diag/issues/22).  However, they
    > already work in h’…’ byte strings, so…

    > h’47110815/... (rest of CWT omitted)/‘

Very Very Cool.

    > …for now if b64 is needed (but see note about truncation above).

This email needs to go into some reference for people.

Maybe two slides posted to CBOR WG meeting tracker, URL sent around to
wgchairs.

"Is you internet-draft suffering from CBOR diagnostic notation bloat?"
"Is xml2rfc complaining about too long lines, and you just aren't sure how to
fix that?"
"Available now, for an unlimited time, the CBOR how-to-elide HOWTO"

--
]               Never tell me the odds!                 | ipv6 mesh networks [
]   Michael Richardson, Sandelman Software Works        | network architect  [
]     [email-masked]  http://www.sandelman.ca/        |   ruby on rails    [

---

From: Carsten Bormann <[email-masked]>
Date: Thu, 24 Mar 2022 21:18:06 +0100

>> characters, the result will always be valid.

I once said that we don’t need CBOR or CDDL doctors.
I still strongly believe that, but this is an example of arcane ancient knowledge that is never written up properly…

> I wonder if this is worth sharing with the RPC people in some fashion.

So far, RPC was not the place where examples were checked.
But it is knowledge they could pass on to authors.

I’m wondering what checking I could add to kramdown-rfc to make it easier to submit healthy examples.  (Kramdown-rfc already checks your JSON.)

> "Is xml2rfc complaining about too long lines, and you just aren't sure how to

{::include-fold foo1.cbor-diag}

(Ouch, this is more for YANG than for CBOR EDN.)

> "Available now, for an unlimited time, the CBOR how-to-elide HOWTO"

Yes, we need to start the WG wiki…

Grüße, Carsten

---

From: Michael Richardson <[email-masked]>
Date: Fri, 25 Mar 2022 10:46:11 +0100

> Yes, we need to start the WG wiki…

For now, just put some wiki text into github
   https://github.com/cbor-wg/CBORbis

until we have the newer WG wiki online.

--
Michael Richardson <[email-masked]>, Sandelman Software Works
 -= IPv6 IoT consulting =-

---

From: Carsten Bormann <[email-masked]>
Date: Fri, 25 Mar 2022 16:07:43 +0100

Not so sure that “CBORbis” is the best repo to put this in.

I think we should do a new repo for this, e.g., “doc”, and use the repo for more well-developed texts, and the wiki for starting work on some.

Chairs: Would you mind creating such a repo under cbor-wg?

Grüße, Carsten