diff --git a/component/models/dataintegrity/signer.go b/component/models/dataintegrity/signer.go index 9fed53a69..f3500850b 100644 --- a/component/models/dataintegrity/signer.go +++ b/component/models/dataintegrity/signer.go @@ -82,7 +82,8 @@ func (s *Signer) AddProof(doc []byte, opts *models.ProofOptions) ([]byte, error) proof, err := signerSuite.CreateProof(doc, opts) if err != nil { - return nil, ErrProofGeneration + // TODO update linter to use go 1.20: https://github.com/hyperledger/aries-framework-go/issues/3613 + return nil, errors.Join(ErrProofGeneration, err) // nolint:typecheck } if proof.Type == "" || proof.ProofPurpose == "" || proof.VerificationMethod == "" { @@ -108,7 +109,8 @@ func (s *Signer) AddProof(doc []byte, opts *models.ProofOptions) ([]byte, error) out, err := sjson.SetRawBytes(doc, proofPath, proofRaw) if err != nil { - return nil, ErrProofGeneration + // TODO update linter to use go 1.20: https://github.com/hyperledger/aries-framework-go/issues/3613 + return nil, errors.Join(ErrProofGeneration, err) // nolint:typecheck } return out, nil diff --git a/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019.go b/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019.go index 909a488a5..4ad1fce8b 100644 --- a/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019.go +++ b/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019.go @@ -323,7 +323,8 @@ func hashData(transformedDoc, confData []byte, h hash.Hash) []byte { func proofConfig(docCtx interface{}, opts *models.ProofOptions) (map[string]interface{}, error) { if opts.Purpose != opts.VerificationRelationship { - return nil, errors.New("verification method is not suitable for purpose") + return nil, fmt.Errorf( + "verification method %s is not suitable for purpose %s", opts.VerificationRelationship, opts.Purpose) } timeStr := opts.Created.Format(models.DateTimeFormat) diff --git a/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019_test.go b/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019_test.go index e180f92ad..6e2225480 100644 --- a/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019_test.go +++ b/component/models/dataintegrity/suite/ecdsa2019/ecdsa2019_test.go @@ -338,7 +338,7 @@ func TestSharedFailures(t *testing.T) { tc := successCase(t) tc.proofOpts.Purpose = fooBar - tc.errStr = "verification method is not suitable for purpose" + tc.errStr = "verification method assertionMethod is not suitable for purpose foo bar" testSign(t, tc) })