- Notifications
You must be signed in to change notification settings - Fork125
Description
The currentcredentialSubject property is confusing for implementers and anyone inspecting a verifiable credential. It would be more meaningfully namedclaims, which makes it abundantly clear that the section is for theclaims being made in the credential.
This issue is compounded with the current usage of theid property, which is anoptional property within the currentcredentialSubject. There are two sources confusion here:
- Needing to check for an optional property within a confusingly named
credentialSubjectproperty to learnwhom the subject values are about (if they're about no one why are they there?) - Needing to understand that the
idproperty is a special property withspecial processing rules which is identifying the party who the credential subject is about <--- this should be confusing enough for you to agree to rename the property.
So, I propose two changes:
Before
{"@context": ["https://www.w3.org/ns/credentials/v2","https://www.w3.org/ns/credentials/examples/v2" ],"id":"http://example.edu/credentials/3732","type": ["VerifiableCredential","UniversityDegreeCredential"],"issuer":"https://example.edu/issuers/565049","validFrom":"2010-01-01T00:00:00Z","credentialSubject": {"id":"did:example:ebfeb1f712ebc6f1c276e12ec21","degree": {"type":"BachelorDegree","name":"Bachelor of Science and Arts" } }}After
{"@context": ["https://www.w3.org/ns/credentials/v2","https://www.w3.org/ns/credentials/examples/v2" ],"id":"http://example.edu/credentials/3732","type": ["VerifiableCredential","UniversityDegreeCredential"],"issuer":"https://example.edu/issuers/565049","validFrom":"2010-01-01T00:00:00Z","subject":"did:example:ebfeb1f712ebc6f1c276e12ec21","claims": {"degree": {"type":"BachelorDegree","name":"Bachelor of Science and Arts" } }}By elevatingsubject to a top-level property we follow the existing pattern used byissuer. We remove ambiguity about whom the credential is about. By renamingcredentialSubject toclaims we give a meaningful name to the property and remove confusion about its usage, including removing the need to parse its value for any special-case properties. Implementers will rejoice.
Caveats
The only thing that this breaks, as far as I am aware, is multiple subjects. I believe this can be handled like so...
{"@context": ["https://www.w3.org/ns/credentials/v2","https://www.w3.org/ns/credentials/examples/v2" ],"id":"http://example.edu/credentials/3732","type": ["VerifiableCredential","NameCredential"],"issuer":"https://example.edu/issuers/565049","validFrom":"2010-01-01T00:00:00Z","subject": ["did:example:ebfeb1f712ebc6f1c276e12ec21","did:example:6f1c276e12ec21ebfeb1f712ebc"]"claims": [ {"name":"Alice" }, {"name":"Bob" } ]}