-
Notifications
You must be signed in to change notification settings - Fork 45
Service endpoint identification matrix parameter #90
Comments
Couldn't find a rationale for the need of semicolon syntax in #72. Can the |
This is what I had counter-proposed, but folks pushed back for reasons I can't remember anymore. I think the push back was that it would be impossible to tell when the DID-based URL ends and the HTTP-based URL begins. @talltree @mikelodder7 @peacekeeper -- any thoughts on this? |
In that scenario, how do you know when the DID-based URL ends and the HTTP-based URL begins. For example:
Would you do something like this?
If yes, then what happens if there are two |
Why someone needs to construct URL like this? Embedding one URL into another |
isn't "serviceEndpoint" property supposed to carry the url of the service? Why put it in the "@id"? |
Have we come to any consensus on this issue? (Would be helpful to have this resolved, so we can validate service endpoint IDs in our code.) |
I have an open PR that I thought addressed this 95 or am I misunderstanding something? |
Hey @mikelodder7, it looks like @msporny had some open questions on the PR. |
ContextSo, here's the context for this conversation, for those joining in. The value proposition for DIDs is that they provide stable user-controlled identifiers that can help with two main things: management of cryptographic materials, and portability of service endpoints. With crypto material management, the idea is that a user's identifier can stay the same while underneath, keys and the like can change -- be added, rotated, revoked, and so on. Similarly, with portability of service endpoints, the idea is that some sort of DID-based URI stays the same for a given service, and meanwhile the user can migrate from one service provider to another (and that stable DID-based URI for a service does not have to change). So for a trivial example, say that a user has a service that stores their user profile picture. And currently, they're storing it at: What you want to be able to do instead, is to use a service URI based on a DID, so the URL above now becomes something like:
And then inside that DID Document, in the So for example, if Alice's DID was "service": [
{
"id": "did:example:123#user_pictures",
"serviceEndpoint": "https://facebook.com"
}
] The userpic URI would be something like And when this URI would be passed to a DID Resolver, it would automatically be resolved to: And later, when she migrated to another userpic service, the contents of the DID Document would change to: "service": [
{
"id": "#user_pictures", // <- still the same as previously
"serviceEndpoint": "https://new-friendster.com"
}
] The picture's URI would remain the same, But now, a resolver would translate that URI to: So that's the general idea - to enable DID-aware apps to use stable URIs for well known service types, and those URIs would remain the same even if the user migrated to a different service. (And yes, this whole setup does depend on the path part of the URI staying the same from service to service. But there's actually a surprising amount of use cases where that would be true.) The Arguments So FarThe argument is about two things:
Note that these are two separate topics. Let's examine the second one, the format of service URIs, because I will argue that the solution to the first issue should remain the same, regardless of what we decide. Service URI FormatEach proposed approach needs to address two main things:
Option 1 - Semicolon based service URIs (current consensus)The group consensus so far is to use one of the reserved URI delimiter characters, Benefits:
Downsides/Implications:
Open Questions (Stuff that's being argued): If the Option 1a: - (This is the option currently proposed in PR #95 by @mikelodder7) For example: The implications (at first glance) with this option is that the Resolver:
Except here's the problem. Although the the examples in the spec and the PR give a single camel-cased string as a type (like
Notice what that does to the parsing algorithm. It's no longer possible to just parse up to the first So the actual Option 1a would require URL-encoding the service locator, like this:
Benefits:
Drawbacks:
Option 1b: - Service or Type directly, no keyword, then Path (no separator) Example: The implication with this option is that the Resolver:
Option 1c: - Service or Type directly, no keyword, This is same as 1b, but uses a Example: The idea being, this makes it slightly easier to parse and separate service locator and path. Except just like with the previous options, you still end up having to URL-encode the service type (because of the colon in the http URL). Option 1d: - Service or Type directly, no keyword, If we switch to re-using the
This makes the parsing easier - split on Option 2 - Query Params or Hash Fragment Query Params (considered and rejected)As @Fak3 and others have asked, why not specify the service id/type and the service path as either query parameters or hash fragment query parameters?
or
Reasons not to go with this approach:
Option 3 - Magnet URI style (not yet considered?)I'm not sure if this has already been discussed, but @cwebber brought up the possibility of using Magnet URIs for this (and other) use cases. Magnet URIs basically consist So our Service URI would be something like:
This option would require us to define and reserve the query parameters (like SummarySo, we still need to determine which of these options we should take. If we go with the current consensus ( My personal vote is either Option 1d, or Option 3. |
There must be some unvoiced requirement that i am not aware of, which is a cornerstone of how the URI would look like. So I am wondering what is that. Are you saying that DID resolver must tell if the did-based url is a service url without resolving that url to a document and looking at the contents? Why is that? Why this requirement does not apply to the key material urls like |
Great summary, I think Option 1b is what we've been assuming for a while; but others have advantages too. Maybe we should revisit this topic on an upcoming CCG call. My preference would be either Option 1a or 1b. |
Hmm, this is missing an option 1e that we also discussed (I think), which I'll ask @dlongley to elaborate upon since he has the details. |
@msporny, actually the "option 1e" you mention would fall under "option 1b" (just imagine the ID for the service that gets url encoded has a |
I also want to mention that we should specify a "proxy" (full name TBD) service type to help assist with potential GDPR issues (we don't know yet what the issues will be but we should plan ahead). A DID resolver that sees this "proxy" service type in a DID document could follow its service endpoint to resolve to a final URL. This would allow a non-PII |
@msporny, actually maybe "option 1e" could still be a bit different from 1b. Here's "option 1e": Consider this service entry in a DID Document: "service": [
{
"id": "did:example:123#user_pictures",
"serviceEndpoint": "https://new-friendster.com"
}
] Remember that here, if we want to return the information from the DID Document graph for the service itself, we look up So, now if we want to add the DID resolution feature, the way it works is we change the hash
So, to resolve a full path we would do... Example: In other words: Example: This option could also be mixed with some of the other options to use an extra colon |
among The key benefit of
This could be achieved in
|
I think #85 fixes this. Simply The presence of the DID query has two main syntactical interpretations. When a DID path component is present the DID query is a modifier on the did path resource in the same way that it works on a URL. When a DID path component is not present then the DID Query is a modifier on the Did meta-data obtained from the DDO and narrowed by the did fragment if present. In the latter case above the did query parameters operate on the meta data in the DDO so having a reserved query parameters that correspond to metadata keys such as “service” is unambiguous and does not impede the use of query parameters in the former case above |
I think that we should accept #85 as did query was left out as an oversight and any discussion on service endpoint should be with the assumption that did query is an existing constraint. It would be bad to not support query in general otherwise much of the tooling that makes the url like syntax of the did so convenient gets thrown away. The semantic switch based on the presence of the path syntax is a simple way of assigning what the query is modifying. Adding semantics to metadata query is then decoupled from generic querysemantics |
An even cleaner approach is to use JSON PTR #86 to narrow the context. #86 uses the same semantic switch, that is, If the DID Path is present the DID Fragment JSON PTR identifies an element of the resource identified by the path. IF the DID Path is NOT present the DID fragment JSON PTR identifies an element of the metadata in the DDO. Combining the two gives the cleanest way of specifying operations without encumbering the query parameters (ie reserved query key names). IF the DID Path is not present and the DID Fragment is present and is a JSON PTR then the DID Query operates on the DDO element identified by the DID Fragment JSON PTR. In this narrowed context then the Query parameters can have specified meaning without encumbering their meaning in any other context. Because we have already reserved certain element names for the DDO, reserving DID Query param names for those same reserved DDO elements is the minimally encumbering approach. This way we keep the URL syntax clean (ie do not specially redefine ";") We just use existing syntactical elements in an unambiguous way. From a DID resolver parsing logic perspective: If the DID Path is present the method, idstring and any service endpoints are resolved in a default metadata context. The remainder of the DID (path, query, fragment) is applied to the resulting resolved resource not the metadata If the DID Path is NOT present the method, idstring, and any service endpoints are resolved as modified by the query and fragment with json ptr in the fragment allowing high specificity of which metadata element(s) are to be modified. This allows very fine granularity in how the metadata is interpreted without impeding the use of the query and fragment on non metadata resources. We can then specify contextual semantics for the DID query without having to reserve query names in general. |
This approach nicely future proofs the specification and allows stable syntax.As we now have a contextual way of creating new semantics without ever changing syntax. |
Alternatively since the default context is DID Method specific. Each method could define custom reserved query parameter names like "service". Did resolvers just need a lookup table per method. Or alternatively the idstring ":" separator can be used on a method specific basis to identify different service endpoints where the last component of a multi-part idstring specifies its a service endpoint did:mymethod:idstringfirst:service |
I don't think this will continue to be true due to a large number of discussions in the JSON-LD WG and the VCWG WG. We're trying to make it such that you don't need JSON-LD processors to use DID Documents and one of the results of that is that all DID Methods MUST use the DID Context (as defined by the DID WG) as the first element in the @context array. They may then layer their own vocabulary terms on top of that. So, it would most likely look like this:
It's pedantic, don't know if it affects your proposal, just noting it in case it does. |
Update: the current consensus on the format of the Service endpoint reference is reflected in PR #168. In terms of this discussion, it's option |
The endpoint identification format of
did:example:123456789abcdefghi;openid
was introduced in #75. The;
usage may cause URI parsers to expect matrix parameters. I think matrix parameters are still a proposal [1] vs an actual spec. It does look like the somewhat rare usage in the wild useskey=value
pairs [2][3][... many search results ...]. In the 1996 proposal there is an example that considers a relative matrix param that's just a key as something that blanks out that key. It may make sense to usekey=value
syntax in dids to align with other usage. Could be as simple asservice=openid
.#72 mentions the need to describe the
;
syntax, but that has not been addressed.[1] https://www.w3.org/DesignIssues/MatrixURIs.html
[2] https://stackoverflow.com/questions/401981/when-to-use-query-parameters-versus-matrix-parameters
[3] medialize/URI.js#181
The text was updated successfully, but these errors were encountered: