Open eike-hass opened 2 years ago
As of now verification methods under the same scope (authentication
, assertionMethod
, capabilityInvocation
, capabilityDelegation
) in a document must necessarily have different fragments/ids as it is enforced by the library. The same goes for services.
It is however possible to have the same fragment/identifier under different scopes, although certain methods prevent this, it is not a guarantee.
I have updated the issue with a few sub-tasks. Note that we cannot reliably ensure that the custom properties
users can pass in our CoreDocument
don't break fragment/identifier uniqueness because we don't have enough context.
We can however consider embracing JSON-LD support in the future and provide an additional method to check that the document can be serialized to valid JSON-LD. That method cannot be called by serde
though as it will likely need to be asynchronous.
Description
We should enforce uniqueness of fragments in DID documents, since multiple identical fragments in one document could lead to errors or at least unexpected or undefined behavior, during credential validation and other operations.
Motivation
Prevent user errors and keep documents in a consistent state.
Sub-tasks
[ ] Ensure no two methods in the document have the same identifier
[ ] Ensure services and methods have different identifiers
[ ] Ensure custom properties have unique identifiers.
Change checklist
Add an
x
to the boxes that are relevant to your changes, and delete any items that are not.[ ] The feature or fix is implemented in Rust and across all bindings whereas possible.
[ ] The feature or fix has sufficient testing coverage
[ ] All tests and examples build and run locally as expected
[ ] Every piece of code has been document according to the documentation guidelines.
[ ] If conceptual documentation (mdbook) and examples highlighting the feature exist, they are properly updated.
[ ] If the feature is not currently documented, a documentation task Issue has been opened to address this.