diff --git a/pkg/doc/presexch/definition.go b/pkg/doc/presexch/definition.go index 82ddd1b75..84470227d 100644 --- a/pkg/doc/presexch/definition.go +++ b/pkg/doc/presexch/definition.go @@ -545,7 +545,7 @@ func (pd *PresentationDefinition) MatchSubmissionRequirement(credentials []*veri // ErrNoCredentials when any credentials do not satisfy requirements. var ErrNoCredentials = errors.New("credentials do not satisfy requirements") -// nolint: funlen +// nolint: funlen,gocyclo func (pd *PresentationDefinition) matchRequirement(req *requirement, creds []*verifiable.Credential, documentLoader ld.DocumentLoader, opts *matchRequirementsOpts) (*MatchedSubmissionRequirement, error) { matchedReq := &MatchedSubmissionRequirement{ @@ -584,6 +584,12 @@ func (pd *PresentationDefinition) matchRequirement(req *requirement, creds []*ve if err != nil { return nil, err } + + // TODO: remove this workaround after refactoring "merge" function to get rid of + // TODO: the trick with the modification of credential id. + for _, cred := range matchedVCs { + cred.ID = trimTmpID(cred.ID) + } } else { for _, credRes := range filtered { matchedVCs = append(matchedVCs, credRes.credential) diff --git a/pkg/doc/presexch/match_submission_requirements_test.go b/pkg/doc/presexch/match_submission_requirements_test.go index 549a7c0de..3ca6e3415 100644 --- a/pkg/doc/presexch/match_submission_requirements_test.go +++ b/pkg/doc/presexch/match_submission_requirements_test.go @@ -238,6 +238,8 @@ func TestInstance_GetSubmissionRequirements(t *testing.T) { matchedVC := matched[0].Descriptors[0].MatchedVCs[0] + require.Equal(t, vc.ID, matchedVC.ID) + subject := matchedVC.Subject.([]verifiable.Subject)[0] degree := subject.CustomFields["degree"] require.NotNil(t, degree)