-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON-LD context specific questions about DID Core specification #416
Comments
I pushed the repo to https://github.com/veikkoeeva/DotDecentralized in case someone wants to take a look. This is a draft in a temporary repo and I intend to move it around the end of month. I have not looked if there are other .NET libraries in general nor if there are with this approach in particular. It looks like implementing the specification will not be awfully lot code if implementing JSON-LD processing rules are not needed. The cases are more about interpreting the specification and working out a system that is open enough for extensions and composing (while still being secure to use, maintain reasonable developer ergonomics, fast enough etc.). It appears this draft can parse most samples I could find (not all but easily fixable). It does not implement checking all the rules on DIDs nor cryptographic operations but I intend to add these later after I've turned this into a more proper project. I also came about with new questions (such as what is alsoKnownAs). Some are here and some I think can be discussed in Interop group, thanks for Juan C. for monitoring here and contacting. :) |
I link a few more recent issues and comment from the perspective of using a JSON parser to implement the specification. I think you guys do a good job and the intention is not to demand work but more like write down some notes for myself and others who look from .NET implementation perspective. As a general note reflecting the discussion in linked threads is that while I use a plain forward-only parser, it can use converters almost at any stage in the process. This allows considerable flexibility in parsing and using state within the parser as long as the serialized format is textual JSON (it doesn't even need to be that but things get difficult if not). I think many parsers in strongly typed languages have this kind of a functionality. #432
would make parsing easier. Currently I wrote the parser so it checks if it's a single element string, an array of strings or an object or array of objects. A complication here is that if the shape of As for internal, strongly typed structure, currently it is a collection of either strings or objects and there's logic in deserializing to check this. (*1) It is possible to add a convenience property to make single element arrays appear as a single attribute, but the library user would need to check beforehand if this is the case and it sort of removes the purpose. Here it would help if the specification would be explicit (or did I miss it?) if it said that if it's only a single element, it is written as such, not as an array of one element. Now I decided single element arrays are serialized out as single elements. It feels like that if there is #439
Being a rather rookie with JSON-LD, I think the issue on a strongly typed language is that do I have classes for the types to which parse them, because in business logic parts it would nice to make use of the type system. Maybe not even full types but only to parts I care about and if there's "unknown data", I might want to just store it into a in-memory like structure that can be queried for some attributes. Here it would help if:
What feels problematic is that if it is implied or really needed to have a full JSON-LD processor is needed to all parts the DID documents when parsed. Since it might be possible to come along without one if the rules were possible to make explicit. I do not know if this is possible but maybe useful to be explicit about this. Specifically sticky point is serialized format. It would be easier to explicit if and/or when a format like (*1) Currently they're |
I am trying to parse a question to answer out of this. You don't need to use a JSON-LD parser to parse JSON... anything that passes |
@OR13 You may not need to parse a question out of that. Maybe it is better put so that it is notes about writing code to support the DID Core specification as written now and coming to GH issues to figure out more. It is certainly about thinking
Or something along those lines in various parts. I maybe have misunderstood something. It might be I should ask something but I don't know it yet. This may be a wrong place to jot down such notes. I might have related questions when I get back into writing more in a few weeks. |
@OR13, @veikkoeeva, I think this is related to the WG's current discussion around adding guidance for processing JSON-LD as JSON, whether that be guidance added to the JSON-LD representation and/or guidance added to the JSON representation (or guidance for a single unified representation). I'm very much in favor of providing rules for the simplest way to process the presence of @OR13, some of what @veikkoeeva brings up relates to our discussion over @veikkoeeva -- So, I think the WG is presently considering more language that is related to this issue that may end up addressing your concerns. |
@dlongley Yes, those points and some thoughts about implementing the standard in general. For this particular case I would say it does not matter if it is just Actually I realized now that I could comment on |
@dlongley @veikkoeeva regarding relative URIs (fragment ids).... I deal with them all the time... and they are 100% more annoying that just forbidding them.... pretty much everywhere you need to make sure a https://github.com/transmute-industries/vc.js/blob/master/packages/vc.js/src/vc-ld/__tests__/vc-js.sanity.test.ts#L7 thanks for the requirement to support them from @csuwildcat and @dhh1128 ... :) If we forbid relative refs, everything would be easier.... yes.... but I imagine there would be significant push back to doing that now. |
@OR13 It's not that bad, maybe. :) In spirit of syncing minds with people reading this, I was thinking to handle this particular case at https://github.com/veikkoeeva/DotDecentralized/blob/main/src/DotDecentralized.Core/DidDocument.cs#L352, hence it doesn't use Uri. The plan is to wrap this there and make it transparent to end user either way. This does cause a bit of gymnasics, so treating it like https://github.com/veikkoeeva/DotDecentralized/blob/main/src/DotDecentralized.Core/VerificationRelationshipConverter.cs#L75. E.g. this prevent that There will be more, like a builder pattern, more checks to prevent illegal states etc. but have to start from somewhere. |
I don't know what too do with this issue, since we have examples for both normal and fragment identifiers i suggest we close this. |
No objections to closing issue from @veikkoeeva or WG members since |
My questions seem to be related to DID Core editorial review (2) and DID Core editorial review (1).
I wrote a small parser based on DID Core Specification. It is based on System.Text.Json, which is a very new forward-only .NET JSON parser (but one can store data to objects while processing so everything is possible). It does not have JSON-LD processing rules.
Which brings me to my questions
@context
need to appear as the first element in its respective JSON object? This could be useful while processing the document. I tried to check the specification if the order is always specified so and then also check if JSON-LD specification tells something about it, but didn't find anything conclusive.I think it would be useful to provide more complete examples of DID documents that conform the core specification and then also https://www.w3.org/TR/did-spec-registries/ ones and also some examples that specify something more custom such as
spamCost
.The reason for this separation is that it took a while for me to understand that
publicKeyBase58
is a registered feature. While I think it's excellent to note this in the core document, it would be nice to explicitly note it and link tohttps://www.w3.org/TR/did-spec-registries/
. The reason I think both this and thespamCost
example are very good is that I took a bit more time to understand how to make a parser that can account for these matters.It would be nice if there if there would be a good compilation of conforming documents one could use as test cases. Now I picked up something from the specification and one Veres One document while writing this. I may push the code to GH soon(ish) in case someone in the future finds it a useful starting point. I took a look at https://github.com/w3c/did-test-suite and may try to make this conforming (depending on how much JSON-LD specific processing is needed).
Thank you all for your hard work!
The text was updated successfully, but these errors were encountered: