Comments (5)
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.
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.
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.
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.
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)
- graphsync spec - clarify relationships between libp2p connections, streams, messages and requests HOT 1
- Self describing objects in the data model layer HOT 2
- Defining Any and its behaviors HOT 13
- Endianness in IPLD Codecs HOT 2
- CBOR: Data model serialization in Rust HOT 22
- Add more examples to Selector specs HOT 3
- Invariants for IPLD Codecs HOT 3
- Define "component specifier" HOT 1
- Spec for inline CID’s
- Request: Magic AMT HOT 2
- Representation of Infinity and NaN in DAG-JSON HOT 11
- Confusion about envelope (and inline) representation of unions HOT 5
- Best practices for IEEE-754 non-fintite numbers (NaN, Infinity) HOT 1
- Documentation about "context" HOT 1
- codec: pathed link HOT 9
- Data Model claims (erroneously?) that DAG-CBOR rejects integers outside of 64 bit range HOT 1
- Is the String kind conceptually a series of bytes or characters? HOT 15
- Why is the reified form of IPLD Schemas "generally presented as JSON" instead of IPLD itself? HOT 1
- Register MIME type application/car with IANA HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from specs.