gs1 / VC-Data-Model

Apache License 2.0
3 stars 1 forks source link

Signing GS1PrefixLicenseCredential fails - JSON-LD Error #11

Closed F-Node-Karlsruhe closed 1 year ago

F-Node-Karlsruhe commented 1 year ago

Signing a GS1PrefixLicenseCredential with the context on https://ref.gs1.org/gs1/vc/licence-context/ results in a JSON-LD SafeModeWarning, which results in not being able to sign the credential.

 2023-05-12T10:11:06.980Z [error] jsonld.ValidationError: Safe mode validation error.
     at safeEventHandler (/usr/src/app/node_modules/jsonld/lib/events.js:133:11)
     at _handle (/usr/src/app/node_modules/jsonld/lib/events.js:82:7)
     at api.handleEvent (/usr/src/app/node_modules/jsonld/lib/events.js:71:3)
     at /usr/src/app/node_modules/jsonld/lib/expand.js:619:17
     at Array.map (<anonymous>)
     at _expandObject (/usr/src/app/node_modules/jsonld/lib/expand.js:612:25)
     at processTicksAndRejections (node:internal/process/task_queues:96:5)
     at async api.expand (/usr/src/app/node_modules/jsonld/lib/expand.js:251:3)
     at async Function.jsonld.expand (/usr/src/app/node_modules/jsonld/lib/jsonld.js:321:18)
     at async Function.jsonld.toRDF (/usr/src/app/node_modules/jsonld/lib/jsonld.js:680:16)
 2023-05-12T10:11:06.980Z [error] Error details:
 {
   "event": {
     "type": [
       "JsonLdEvent"
     ],
     "code": "relative @type reference",
     "level": "warning",
     "message": "Relative @type reference found.",
     "details": {
       "type": "GS1PrefixLicenseCredential"
     }
   }
 }

The error origins from here https://github.com/digitalbazaar/jsonld.js/blob/main/lib/expand.js#L617

Not sure what exactly causes the error, but i will investigate further.

F-Node-Karlsruhe commented 1 year ago

The issue was that the issuer still referenced the credential type as GS1PrefixLicenseCredential, which was no longer specified, as it is now under gs1:GS1PrefixLicenceCredential