Re: Resolving the issue of JSON and preserving order

There is a subsection of the CBOR spec at 4.2.2 that discusses a
deterministic subset of CBOR. It is unfortunately not fully clear on some
specific issues.

We (Blockchain Commons) have submitted spec for dCBOR to clarify these
issues and have implementation libraries in multiple languages:
https://datatracker.ietf.org/doc/draft-mcnally-deterministic-cbor/05/ There
is also a high level article about this, and a YouTube video at
https://www.blockchaincommons.com/specifications/dCBOR-IETF/

We have a fairly strict interpretation of requirements for dCBOR, some of
which some people think may be too strict as we also do numeric reduction,
so instead this document is being advanced, where our dCBOR will be one
profile of it:
https://datatracker.ietf.org/doc/draft-bormann-cbor-dcbor/

Either way, maps in CBOR can be fully deterministic.

— Christopher Allen [via iPhone]


On Thu, Sep 28, 2023 at 6:03 AM Orie Steele <orie@transmute.industries>
wrote:

> JSON-LD is required to represent W3C Verifiable Credentials.
>
> By default JSON-LD does not preserve array order.
>
> https://www.w3.org/TR/json-ld11/#representing-lists-as-arrays
>
> CBOR is not a solution to meeting the normative requirements of W3C
> Verifiable Credentials... since CBOR Maps are not conforming documents.
>
> IMO CBOR is a better building block, but that's not the question being
> asked.
>
> OS
>
>
> On Thu, Sep 28, 2023 at 5:54 AM Anders Rundgren <
> anders.rundgren.net@gmail.com> wrote:
>
>> The example in the link shows individual claims with multiple keys.  Such
>> claims must either be canonicalized (or wrapped in B64), in order to be
>> signed or hashed.
>>
>> Deterministic CBOR does not require any special handling of data to be
>> signed.
>>
>> Anders
>>
>> On Sat, Sep 23, 2023, 10:10 Andy Miller <theafmiller@gmail.com> wrote:
>>
>>> Since order is maintained in JSON arrays, I think this would maintain
>>> the order of credential subjects (ref:
>>> https://www.w3.org/TR/vc-data-model-2.0/#example-specifying-multiple-subjects-in-a-verifiable-credential
>>> ):
>>>
>>> {"credentialSubject": [
>>>     {"id": "id-1"},
>>>     {"id": "id-2"}
>>> ]}
>>>
>>> Andy
>>>
>>> On Sat, Sep 23, 2023 at 4:57 PM Anders Rundgren <
>>> anders.rundgren.net@gmail.com> wrote:
>>>
>>>> Another solution is using deterministic CBOR which seems like an
>>>> excellent fit for credentials and such.
>>>> Deterministic CBOR will most likely become and IETF standard.
>>>>
>>>> https://github.com/cyberphone/D-CBOR#example
>>>>
>>>> Anders
>>>>
>>>> On 2023-09-22 14:38, Orie Steele wrote:
>>>> > You can use JSON-LD language features to preserve order.
>>>> >
>>>> > If you use SD-JWT, because the JSON is signed instead of N-Quads,
>>>> order is preserved by the signature.
>>>> >
>>>> > OS
>>>> >
>>>> > On Fri, Sep 22, 2023, 4:57 AM ステファニー タン(SBIホールディングス) <
>>>> tstefan@sbigroup.co.jp <mailto:tstefan@sbigroup.co.jp>> wrote:
>>>> >
>>>> >     Hi all,
>>>> >
>>>> >     It's Stefannie again. Once again I would like to thank everyone
>>>> for their help so far. We would be happy to participate in the next weekly
>>>> call to introduce ourselves properly.
>>>> >
>>>> >     Our next question is to do with VC and establishing a certain
>>>> order. Inside the VC is the proof and other attributes, such as Credential
>>>> Subject. Since JSON is unordered or does not preserve a certain order, what
>>>> do you do when you want to establish a certain order for multiple
>>>> credential subjects while preserving extensibility?
>>>> >
>>>> >     Thank you for any advice or suggestion you might have.
>>>> >
>>>> >     Best,
>>>> >     Stefannie
>>>> >
>>>>
>>>>
>>>>
>
> --
>
>
> ORIE STEELE
> Chief Technology Officer
> www.transmute.industries
>
> <https://transmute.industries>
>

Received on Thursday, 28 September 2023 14:40:13 UTC