Re: Seeking Advice with Verifiable Credential Context

Hi Charles,

Thank you for your response. If I have interpreted your response correctly,
the "credentialSubject" would have the type of "Employee" like so:

{
    "VerifiableCredential": {
        "@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
        "@context": {
            "credentialSubject": {
                "@id": "cred:credentialSubject",
                "@type": "https://example.com#Employee"
            }
            //...
        }
        //...
    }
}

Do I have this right?

Many Thanks,
Ashley


On Mon, 13 Nov 2023 at 15:58, Charles E. Lehner <cel@celehner.com> wrote:

> 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
> >
>
>

-- 


---
The content of this email and attachments are considered 
confidential. If you are not the intended recipient, please delete the 
email and any copies, and notify the sender immediately.  The information 
in this email must only be used, reproduced, copied, or disclosed for the 
purposes for which it was supplied.

Received on Monday, 13 November 2023 22:11:42 UTC