Re: Seeking Advice with Verifiable Credential Context

Hi Ashley,

I think the type "Employee" should be of the credential subject.
Then your scoped context definition for the "name" property should work.
The credential could have a different 2nd type, e.g. "EmployeeCredential".

Regards,
Charles

On Mon, 13 Nov 2023 11:24:48 +1100
Ashley Harwood <ashley.harwood@gosource.com.au> wrote:

> Hello everyone,
> 
> I'm seeking advice on the proper way to specify a type for the
> subject in a verifiable credential with the use of context.
> 
> My understanding was that typing a Verifiable Credential as follows:
> 
> "type": [
> "VerifiableCredential",
> "Employee"
> ]
> 
> and then defining a context like this:
> 
> {
> "@context": {
> "@version": 1.1,
> "@protected": true,
> "Employee": {
> "@id": "https://example.com#Employee",
> "@context": {
> "name": "xsd:string"
> }
> }
> }
> }
> 
> followed by constructing the credential in this manner:
> 
> {
> "type": [
> "VerifiableCredential",
> "Employee"
> ],
> "@context": [
> "https://www.w3.org/2018/credentials/v1",
> "https://example.com/employee.jsonld"
> ],
> "credentialSubject": {
> "id": "{{EMPLOYEE_DID_WEB}}",
> "name": "Ashley"
> }
> //...
> }
> 
> would establish the necessary context for the credential subject.
> However, I encounter errors indicating that the "name" is not defined
> in the context.
> 
> I know that using:
> 
> "@vocab": "https://www.w3.org/ns/credentials/issuer-dependent#"
> 
> acts as a universal solution for undefined terms, yet it compromises
> validation during credential creation.
> 
> I'm also aware that defining terms "inline" like this:
> 
> {
> "@context": [
> {
> "@version": 1.1
> },
> "https://www.w3.org/ns/odrl.jsonld",
> {
> "name": "xsd:string"
> }
> ]
> }
> 
> works but appears to go against the grain of JSON-LD's intent and
> disrupts the link between the credentialSubject and 'Employee'
> definition.
> 
> Am I overlooking an aspect of this process?
> 
> Many Thanks,
> Ashley
> 

Received on Monday, 13 November 2023 04:17:48 UTC