iotaledger / identity.rs

Implementation of the Decentralized Identity standards such as DID and Verifiable Credentials by W3C for the IOTA Tangle.
https://www.iota.org
Apache License 2.0
299 stars 85 forks source link

[Task] Support relative references in `CoreDocument` #1072

Open olivereanderson opened 1 year ago

olivereanderson commented 1 year ago

Description

Add support for representing references to verification methods and services by fragment only in CoreDocument. In other words the following example from the DID core spec should deserialize to a valid CoreDocument.

Motivation

Section 3.2.2 of the DID Core spec states that relative references are often used to reference verification methods and services in DID documents.

Resources

Link to any resources relevant for the task such as issues, PRs, reference implementations, or specifications.

To-do list

Create a task-specific to-do list. Please link PRs that match the TODO list item behind the item after it has been submitted.

Change checklist

Add an x to the boxes that are relevant to your changes, and delete any items that are not.

olivereanderson commented 1 year ago

Here is a list of possible solutions:

  1. Make deserialization expand such fragments to full DID URLs by prepending the document's id.
  2. Similar to 1. , but also make serialization ignore the DID part of a DID URL (as long as it is the same as the document's id).
  3. Expand the MethodRef type to also include a Fragment variant.

Question: Could approach 3. be problematic in the presence of custom JSON-LD @context ?