diff --git a/auth/api/iam/openid4vp.go b/auth/api/iam/openid4vp.go index 907a988b89..46f7aa5730 100644 --- a/auth/api/iam/openid4vp.go +++ b/auth/api/iam/openid4vp.go @@ -28,8 +28,6 @@ import ( ssi "github.com/nuts-foundation/go-did" "github.com/nuts-foundation/go-did/did" "github.com/nuts-foundation/go-did/vc" - "github.com/nuts-foundation/nuts-node/jsonld" - "github.com/nuts-foundation/nuts-node/vcr" "github.com/nuts-foundation/nuts-node/vcr/credential" "github.com/nuts-foundation/nuts-node/vcr/holder" "net/http" @@ -107,15 +105,9 @@ func (r *Wrapper) handlePresentationRequest(params map[string]string, session *S // TODO: https://github.com/nuts-foundation/nuts-node/issues/2357 // TODO: Retrieve presentation definition - // TODO: Match on wallet instead - searchTerms := []vcr.SearchTerm{ - {IRIPath: jsonld.CredentialSubjectPath, Type: vcr.Exact, Value: session.OwnDID.String()}, - {IRIPath: jsonld.OrganizationNamePath, Type: vcr.NotNil}, - {IRIPath: jsonld.OrganizationCityPath, Type: vcr.NotNil}, - } - credentials, err := r.vcr.Search(ctx, searchTerms, false, nil) + credentials, err := r.vcr.Wallet().List(ctx, session.OwnDID) if err != nil { - return nil, fmt.Errorf("unable to search for credentials: %w", err) + return nil, err } var ownCredentials []vc.VerifiableCredential for _, cred := range credentials { diff --git a/auth/api/iam/openid4vp_test.go b/auth/api/iam/openid4vp_test.go index 734a380f40..32ff266848 100644 --- a/auth/api/iam/openid4vp_test.go +++ b/auth/api/iam/openid4vp_test.go @@ -27,6 +27,7 @@ import ( "github.com/nuts-foundation/nuts-node/auth" "github.com/nuts-foundation/nuts-node/vcr" "github.com/nuts-foundation/nuts-node/vcr/credential" + "github.com/nuts-foundation/nuts-node/vcr/holder" "github.com/nuts-foundation/nuts-node/vcr/pe" "github.com/nuts-foundation/nuts-node/vdr/types" "github.com/stretchr/testify/assert" @@ -94,11 +95,13 @@ func TestWrapper_handlePresentationRequest(t *testing.T) { _ = peStore.LoadFromFile("test/presentation_definition_mapping.json") mockVDR := types.NewMockVDR(ctrl) mockVCR := vcr.NewMockVCR(ctrl) + mockWallet := holder.NewMockWallet(ctrl) + mockVCR.EXPECT().Wallet().Return(mockWallet) mockAuth := auth.NewMockAuthenticationServices(ctrl) - instance := New(mockAuth, mockVCR, mockVDR) mockAuth.EXPECT().PresentationDefinitions().Return(peStore) - mockVCR.EXPECT().Search(gomock.Any(), gomock.Any(), false, nil).Return(walletCredentials, nil) + mockWallet.EXPECT().List(gomock.Any(), holderDID).Return(walletCredentials, nil) mockVDR.EXPECT().IsOwner(gomock.Any(), holderDID).Return(true, nil) + instance := New(mockAuth, mockVCR, mockVDR) params := map[string]string{ "scope": "eOverdracht-overdrachtsbericht",