filip26 / iron-verifiable-credentials

A Verifiable Credentials Processor & API
https://apicatalog.com
Apache License 2.0
14 stars 7 forks source link

Bump rdf-urdna dependency to 1.3 #142

Closed andresrosenthal closed 2 months ago

andresrosenthal commented 5 months ago

Given JSON-LD document:

{
  "@context": [
    "https://www.w3.org/2018/credentials/v1",
    "https://w3id.org/security/suites/jws-2020/v1",
    "https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#"
  ],
  "type": [
    "VerifiableCredential"
  ],
  "id": "https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json",
  "issuer": "did:web:xroad-8-member1.s3.eu-west-1.amazonaws.com",
  "issuanceDate": "2024-02-15T14:20:56.969Z",
  "credentialSubject": {
    "gx:legalName": "NIIS",
    "gx:headquarterAddress": {
      "gx:countrySubdivisionCode": "EE-37"
    },
    "gx:legalRegistrationNumber": {
      "id": "https://xroad-8-member1.s3.eu-west-1.amazonaws.com/lrn.json#cs"
    },
    "gx:legalAddress": {
      "gx:countrySubdivisionCode": "EE-37"
    },
    "type": "gx:LegalParticipant",
    "gx-terms-and-conditions:gaiaxTermsAndConditions": "70c1d713215f95191a11d38fe2341faed27d19e083917bc8732ca4fea4976700",
    "id": "https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs"
  }
}

With rdf-urdna 1.1 the RDF normalization results in:

<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <gx-terms-and-conditions:gaiaxTermsAndConditions> "70c1d713215f95191a11d38fe2341faed27d19e083917bc8732ca4fea4976700" .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#LegalParticipant> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#headquarterAddress> _:c14n0 .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#legalAddress> _:c14n1 .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#legalName> "NIIS" .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#legalRegistrationNumber> <https://xroad-8-member1.s3.eu-west-1.amazonaws.com/lrn.json#cs> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/2018/credentials#VerifiableCredential> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <https://www.w3.org/2018/credentials#credentialSubject> <https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <https://www.w3.org/2018/credentials#issuanceDate> "2024-02-15T14:20:56.969Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <https://www.w3.org/2018/credentials#issuer> <did:web:xroad-8-member1.s3.eu-west-1.amazonaws.com> .
_:c14n0 <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#countrySubdivisionCode> "EE-37" .
_:c14n1 <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#countrySubdivisionCode> "EE-37" .

While with 1.3 the normalization results in (as expected):

<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <gx-terms-and-conditions:gaiaxTermsAndConditions> "70c1d713215f95191a11d38fe2341faed27d19e083917bc8732ca4fea4976700" .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#LegalParticipant> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#headquarterAddress> _:c14n1 .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#legalAddress> _:c14n0 .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#legalName> "NIIS" .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#legalRegistrationNumber> <https://xroad-8-member1.s3.eu-west-1.amazonaws.com/lrn.json#cs> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/2018/credentials#VerifiableCredential> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <https://www.w3.org/2018/credentials#credentialSubject> <https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json#cs> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <https://www.w3.org/2018/credentials#issuanceDate> "2024-02-15T14:20:56.969Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://xroad-8-member1.s3.eu-west-1.amazonaws.com/participant.json> <https://www.w3.org/2018/credentials#issuer> <did:web:xroad-8-member1.s3.eu-west-1.amazonaws.com> .
_:c14n0 <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#countrySubdivisionCode> "EE-37" .
_:c14n1 <https://registry.lab.gaia-x.eu/development/api/trusted-shape-registry/v1/shapes/jsonld/trustframework#countrySubdivisionCode> "EE-37" .

Currently it causes failures when the mentioned JSON-LD document is turned into a Verifiable Credential with some other library & verified with this one (or the other way around), as the hash changes due to the inconsistent normalization