hyperledger-identus / hyperledger-identus/cloud-agent
Extendable JSON-LD Context for VC issuance [OpenBadges 3.0]
- Dominant language
- Scala
- Stars
- 95
- Forks
- 34
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 14
Description
## Summary
This feature request is to modify the Hyperledger Identus agent to allow for a flexible `@context` property in Verifiable Credentials (VCs). This change is necessary to achieve full compatibility with OpenBadges 3.0 and to provide more versatility in credential contexts.
For further discussion on what OpenBadges 3.0 is and why to achieve compatibility with it, please refer to the [Achieve compatibility with OpenBadges 3.0 [Summary]](https://github.com/hyperledger/identus/issues/7).
## Current Situation
Currently, the Identus agent uses a fixed value for the `@context` property when creating a VC:
```json
"@context": ["https://www.w3.org/2018/credentials/v1"]
```
## Proposed Changes
To align with the OpenBadges 3.0 specification, which should have additional contexts, and to enhance the versatility of Identus-issued credentials, I propose to make the @context property settable to an array of strings within the current API.
Add an **optional** property to the existing endpoint for offering credentials: `/issue-credentials/credentials-offers`
```json
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
]
```
If the `@context` property is not set, the default value should be `["https://www.w3.org/2018/credentials/v1"]` as it is now (Note: when updating to VC 2.0, the W3C context should be updated to `https://www.w3.org/ns/credentials/v2`)
There should be some additional checks to verify that the provided contexts are valid set of URIs and that the W3C VC context is always the first in the list.
This is a relatively simple change and should not have any significant side effects. It's a good candidate for a "Good First Issue" for contributors.
Further note, that `@context` could theoretically also contain objects. I think for the first iteration it would be easier to reject those and just focus on valid URIs.
Here is an example which I would propose to reject for now: https://www.w3.org/TR/vc-data-model-2.0/#example-usage-of-the-termsofuse-property-by-a-holder
## Additional resources:
[Context explanation from the VC 2.0 spec](https://www.w3.org/TR/vc-data-model-2.0/#contexts)
[Difference between contexts and types](https://w3c.github.io/vc-data-model/#differences-between-contexts-types-and-credentialschemas)
[Json-LD reference inside of the OB 3.0 spec](https://www.imsglobal.org/spec/ob/v3p0/#json-ld)
Contributor guide
Assessment
This issue has not been assessed yet.