Git Product home page Git Product logo

Comments (5)

rvagg avatar rvagg commented on August 30, 2024 1

Since DAG-COSE is its own codec, separate from DAG-CBOR where we have strict rules about which parts of CBOR we use, you should be free to define it as allowing integer keys in the encoding layer. It's when these things are presented in the Data Model that you have to ensure that map have string keys.

For practical purposes this just usually means you have some struct that has fields which have names that may or may not correspond to the integers or strings that existing in the encoding. As long as you can clearly define how the bytes convert into memory in the data model and back again then it doesn't matter too much.

My main concern would be with this phrasing and how it's going to work with JavaScript:

COSE allows the header to be keyed with strings, but all default fields ( those that every implementation has to understand & that are registered with IANA ) are keyed by integer, where positive AND negative integers are allowed.

Can the header have integers and string representations of integers? Could it have { 1: 'foo', '1': 'bar' }? If that's the case and these header values can have arbitrary keys (can they?) then it could get dicey. If there's not going to be a conflict then maybe you could make the codec have a rule that "in the data model, header keys are strings, including the string form of integers, but when encoded, any key that can be converted from a string to an integer (atoi() style) will be encoded as an integer in CBOR. It's this space of having conflicting string/int keys and the possible necessity of disambiguating between "2" and 2. But I don't know COSE so I don't know how much this matters.

from specs.

JonasKruckenberg avatar JonasKruckenberg commented on August 30, 2024

I'll try to chime into the call next week, since this is a real blocker for the codec and I'd like to get this sorted before the first Encryption WG meeting in January!

from specs.

vmx avatar vmx commented on August 30, 2024

If you mean the weekly IPLD meeting, we've cancled the ones till the end of the year. The first one will be on Monday 2020-01-04.

from specs.

JonasKruckenberg avatar JonasKruckenberg commented on August 30, 2024

Oooh I see, duh. Well then let's figure something out this way if you're available and maybe discuss is further next year :)

from specs.

JonasKruckenberg avatar JonasKruckenberg commented on August 30, 2024

Thanks for the response! I already figured something like that would be the way to go and to address your concern:
yes in theory both is allowed,BUT since all keys that can be mapped to integer are well known (there exists an IANA registry) one could simply disallow users to use well known integer keys in string form.
Another solution would be to just disallow string keys in the binary representation all together.
I'll have to see about that though.
Anyway thanks for the response!

from specs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.