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: change DI VM purpose resolution #3630

Closed mishasizov-SK closed 1 year ago

mishasizov-SK commented 1 year ago

Using ResolveSigningVMWithRelationship function causes a bug in VM relationship verification for Data integrity.

  1. For instance, let's take issuer's DID, that after resolving has the following structure:
    {
    "verificationMethod": [
    ID: "abc",
    .....
    ],
    "authentication": [
    ID: "abc",
    .....
    ]
    }
  2. Function docRes.DIDDocument.VerificationMethods() with empty arguments returns a map with 2 elements: key VerificationRelationshipGeneral and Authentication. Values for those keys are verification methods with the same ID field.
  3. Because func docRes.DIDDocument.VerificationMethods() returns a map, the order of elements in for ... range loop is not predictable. It might be a case, when first element will be VerificationRelationshipGeneral.
  4. In this case function verificationRelationshipName() returns ""
  5. Then, condition
if rel == "" {
            rel = "assertionMethod"
        }

takes place and declares hardcoded relationship.

codecov[bot] commented 1 year ago

Codecov Report

Merging #3630 (82c6456) into main (717faac) will decrease coverage by 0.01%. The diff coverage is 82.19%.

@@            Coverage Diff             @@
##             main    #3630      +/-   ##
==========================================
- Coverage   86.93%   86.92%   -0.01%     
==========================================
  Files         367      367              
  Lines       50046    50098      +52     
==========================================
+ Hits        43507    43549      +42     
- Misses       4954     4961       +7     
- Partials     1585     1588       +3     
Files Changed Coverage Δ
component/models/dataintegrity/signer.go 83.57% <81.15%> (+0.23%) :arrow_up:
.../models/dataintegrity/suite/ecdsa2019/ecdsa2019.go 93.18% <100.00%> (-0.37%) :arrow_down: