hyperledger-archives / aries-framework-go

Hyperledger Aries Framework Go provides packages for building Agent / DIDComm services.
https://wiki.hyperledger.org/display/ARIES/aries-framework-go
Apache License 2.0
240 stars 161 forks source link

feat: added data integrity jsonld context #3624

Closed mishasizov-SK closed 1 year ago

mishasizov-SK commented 1 year ago

Title: Added data integrity JSON-LD context

Description: Because of the missed DI JSON LD context (and disabled strict validation), Aries on issuance stage generated invalid canonicalProofConfig considering only type field. Example:

_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <DataIntegrityProof> .

Verification part was successful because Aries considered same type field. And because of that, Unit tests did not catch the typo that on verification stage field created was empty.

According to Spec, another fields must be also included in canonicalProofConfig.

After this PR, Aries generates the following canonicalProofConfig:

_:c14n0 <http://purl.org/dc/terms/created> "2023-08-23T16:57:33+03:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
_:c14n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://w3id.org/security#DataIntegrityProof> .
_:c14n0 <https://w3id.org/security#cryptosuite> "ecdsa-2019" .
_:c14n0 <https://w3id.org/security#proofPurpose> <https://w3id.org/security#assertionMethod> .
_:c14n0 <https://w3id.org/security#verificationMethod> <did:foo:bar#key-1> .
codecov[bot] commented 1 year ago

Codecov Report

Merging #3624 (a5a2153) into main (6911901) will decrease coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3624      +/-   ##
==========================================
- Coverage   86.93%   86.92%   -0.01%     
==========================================
  Files         367      367              
  Lines       50024    50033       +9     
==========================================
+ Hits        43487    43493       +6     
- Misses       4951     4953       +2     
- Partials     1586     1587       +1     
Files Changed Coverage Δ
component/models/ld/testutil/document_loader.go 82.14% <ø> (ø)
.../models/dataintegrity/suite/ecdsa2019/ecdsa2019.go 92.00% <100.00%> (+0.04%) :arrow_up:
component/models/dataintegrity/verifier.go 89.88% <100.00%> (-2.71%) :arrow_down: