Skip to content

Commit

Permalink
fix(sdk): disable data integrity proof for multi cred scenario (#843)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrii Holovko <[email protected]>
  • Loading branch information
aholovko authored Nov 29, 2024
1 parent f968958 commit eeb9638
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
31 changes: 16 additions & 15 deletions pkg/openid4vp/openid4vp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
40 changes: 20 additions & 20 deletions pkg/openid4vp/openid4vp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit eeb9638

Please sign in to comment.