From 4722a779fb3e0501c2732261f137481aeee24c46 Mon Sep 17 00:00:00 2001 From: Andrii Holovko Date: Fri, 29 Nov 2024 15:46:30 +0200 Subject: [PATCH] fix(sdk): disable data integrity proof for multi cred scenario Signed-off-by: Andrii Holovko --- pkg/openid4vp/openid4vp.go | 31 ++++++++++++------------- pkg/openid4vp/openid4vp_test.go | 40 ++++++++++++++++----------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/pkg/openid4vp/openid4vp.go b/pkg/openid4vp/openid4vp.go index 3f6d09b0..61c15f92 100644 --- a/pkg/openid4vp/openid4vp.go +++ b/pkg/openid4vp/openid4vp.go @@ -731,21 +731,22 @@ func createAuthorizedResponseMultiCred( //nolint:funlen,gocyclo // Unable to dec return nil, e } - if signer != nil { - e = addDataIntegrityProof( - fullVMID(holderDID, signingVM.ID), - didResolver, - documentLoader, - signer, - presentation, - ecdsa2019.SuiteTypeNew, - requestObject.Nonce, - requestObject.ClientID, - ) - if e != nil { - return nil, fmt.Errorf("failed to add data integrity proof to VP: %w", e) - } - } + // TODO: Refactor data integrity proof implementation + //if signer != nil { + // e = addDataIntegrityProof( + // fullVMID(holderDID, signingVM.ID), + // didResolver, + // documentLoader, + // signer, + // presentation, + // ecdsa2019.SuiteTypeNew, + // requestObject.Nonce, + // requestObject.ClientID, + // ) + // if e != nil { + // return nil, fmt.Errorf("failed to add data integrity proof to VP: %w", e) + // } + //} jwtSigner, e := getHolderSigner(signingVM, crypto) if e != nil { diff --git a/pkg/openid4vp/openid4vp_test.go b/pkg/openid4vp/openid4vp_test.go index db3413e5..65015e3a 100644 --- a/pkg/openid4vp/openid4vp_test.go +++ b/pkg/openid4vp/openid4vp_test.go @@ -764,26 +764,26 @@ func TestOpenID4VP_PresentCredential(t *testing.T) { ) require.ErrorContains(t, err, "no supported linked data proof found") }) - t.Run("multiple credentials", func(t *testing.T) { - localKMS, err := localkms.NewLocalKMS(localkms.Config{ - Storage: localkms.NewMemKMSStore(), - }) - require.NoError(t, err) - - signer, err := localKMS.AriesSuite.KMSCryptoSigner() - require.NoError(t, err) - - _, err = createAuthorizedResponse( - credentials, - reqObject, - CustomClaims{}, - &didResolverMock{ResolveValue: mockDoc}, - &cryptoMock{}, - lddl, - &presentOpts{signer: signer}, - ) - require.ErrorContains(t, err, "failed to add data integrity proof to VP") - }) + //t.Run("multiple credentials", func(t *testing.T) { + // localKMS, err := localkms.NewLocalKMS(localkms.Config{ + // Storage: localkms.NewMemKMSStore(), + // }) + // require.NoError(t, err) + // + // signer, err := localKMS.AriesSuite.KMSCryptoSigner() + // require.NoError(t, err) + // + // _, err = createAuthorizedResponse( + // credentials, + // reqObject, + // CustomClaims{}, + // &didResolverMock{ResolveValue: mockDoc}, + // &cryptoMock{}, + // lddl, + // &presentOpts{signer: signer}, + // ) + // require.ErrorContains(t, err, "failed to add data integrity proof to VP") + //}) }) t.Run("fail to send authorized response", func(t *testing.T) {