Skip to content
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

[Bug] Service definition does not match DID spec for type and serviceEndpoint #447

Closed
obany opened this issue Oct 21, 2021 · 6 comments
Closed
Assignees
Labels
Bug Something isn't working.

Comments

@obany
Copy link

obany commented Oct 21, 2021

Bug description

The definition of the service type currently defines the type field as a string, and the serviceEndpoint as a Url

pub(crate) type_: String,
#[serde(rename = "serviceEndpoint")]
pub(crate) service_endpoint: Url,

The spec defines these properties to also allow set of elements
https://www.w3.org/TR/did-core/#service-properties

Expected behaviour

The service type should match the spec.

Actual behaviour

The service type only supports single strings.

@cycraig cycraig added the Bug Something isn't working. label Oct 26, 2021
@cycraig
Copy link
Contributor

cycraig commented Oct 26, 2021

Hi, thank you for opening an issue.

Would you mind detailing the exact functionality you require from a serviceEndpoint? Do you just need a set for your use-case or also a map and nested set of maps?

A string that conforms to the rules of [RFC3986] for URIs, a map, or a set composed of a one or more strings that conform to the rules of [RFC3986] for URIs and/or maps.

The main problem is that It's unclear how options other than a single url interact with the service dereferencing API: https://w3c-ccg.github.io/did-resolution/#service-endpoint-construction

@obany
Copy link
Author

obany commented Nov 1, 2021

In our case we store a set, with alternative endpoints to query if one is down.

@cycraig
Copy link
Contributor

cycraig commented Nov 9, 2021

A Service now allows ordered sets and maps for the serviceEndpoint field but not nested maps. This change is currently only on the dev branch until the next version release.

Sample code using the Wasm bindings to add a new Service with a set of endpoints:

let serviceJSON = {
  id: doc.id + "#linked-domain",
  type: "LinkedDomains",
  serviceEndpoint: ["https://iota.org/", "https://example.com/"],
};
doc.insertService(Service.fromJSON(serviceJSON));

or with a map:

let serviceJSON = {
  id: doc.id + "#linked-domain",
  type: "LinkedDomains",
  serviceEndpoint: {
    "origins": ["https://iota.org/", "https://example.com/"]
  },
};
doc.insertService(Service.fromJSON(serviceJSON));

Please comment here or open a new issue if there are any problems. Thank you.

@cycraig cycraig closed this as completed Nov 9, 2021
@7opf
Copy link
Contributor

7opf commented Jul 12, 2022

@cycraig are there plans to support sets of strings for the type? We have no need for it at the moment, but I came across a comment in our code regarding this issue from @obany.

@cycraig
Copy link
Contributor

cycraig commented Jul 12, 2022

are there plans to support sets of strings for the type?

I forgot this was even a problem! Thanks for the report, will open a PR for it SoonTM.

@cycraig
Copy link
Contributor

cycraig commented Jul 12, 2022

Should be addressed by #944.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

3 participants