Skip to content

Commit

Permalink
Chore: remove duplicate OpenID4VC format designations
Browse files Browse the repository at this point in the history
  • Loading branch information
reinkrul committed Dec 8, 2023
1 parent e3dafa9 commit 7dc518a
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 49 deletions.
29 changes: 0 additions & 29 deletions openid4vc/types.go

This file was deleted.

4 changes: 2 additions & 2 deletions vcr/api/openid4vci/v0/holder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"encoding/json"
ssi "github.com/nuts-foundation/go-did"
"github.com/nuts-foundation/go-did/did"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/go-did/vc"
"github.com/nuts-foundation/nuts-node/vcr"
"github.com/nuts-foundation/nuts-node/vcr/holder"
"github.com/nuts-foundation/nuts-node/vcr/openid4vci"
Expand Down Expand Up @@ -85,7 +85,7 @@ func TestWrapper_HandleCredentialOffer(t *testing.T) {
CredentialIssuer: issuerDID.String(),
Credentials: []openid4vci.OfferedCredential{
{
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
CredentialDefinition: &openid4vci.CredentialDefinition{
Context: []ssi.URI{ssi.MustParseURI("a"), ssi.MustParseURI("b")},
Type: []ssi.URI{ssi.MustParseURI("VerifiableCredential"), ssi.MustParseURI("HumanCredential")},
Expand Down
4 changes: 2 additions & 2 deletions vcr/api/openid4vci/v0/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/go-did/vc"
"github.com/nuts-foundation/nuts-node/vcr/issuer"
"github.com/nuts-foundation/nuts-node/vcr/openid4vci"
"net/http"
Expand Down Expand Up @@ -108,7 +108,7 @@ func (w Wrapper) RequestCredential(ctx context.Context, request RequestCredentia
}
return RequestCredential200JSONResponse(CredentialResponse{
Credential: &credentialMap,
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
}), nil
}

Expand Down
5 changes: 2 additions & 3 deletions vcr/holder/openid.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"errors"
"fmt"
"github.com/nuts-foundation/nuts-node/auth/oauth"
"github.com/nuts-foundation/nuts-node/openid4vc"
"net/http"
"time"

Expand Down Expand Up @@ -96,7 +95,7 @@ func (h *openidHandler) HandleCredentialOffer(ctx context.Context, offer openid4
}
}
offeredCredential := offer.Credentials[0]
if offeredCredential.Format != openid4vc.VerifiableCredentialJSONLDFormat {
if offeredCredential.Format != vc.JSONLDCredentialProofFormat {
return openid4vci.Error{
Err: fmt.Errorf("credential offer: unsupported format '%s'", offeredCredential.Format),
Code: openid4vci.UnsupportedCredentialType,
Expand Down Expand Up @@ -213,7 +212,7 @@ func (h *openidHandler) retrieveCredential(ctx context.Context, issuerClient ope

credentialRequest := openid4vci.CredentialRequest{
CredentialDefinition: offer,
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
Proof: &openid4vci.CredentialRequestProof{
Jwt: proof,
ProofType: "jwt",
Expand Down
3 changes: 1 addition & 2 deletions vcr/holder/openid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/nuts-foundation/nuts-node/auth/oauth"
"github.com/nuts-foundation/nuts-node/core"
"github.com/nuts-foundation/nuts-node/crypto"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/nuts-node/vcr/openid4vci"
"github.com/nuts-foundation/nuts-node/vcr/types"
"github.com/nuts-foundation/nuts-node/vdr/resolver"
Expand Down Expand Up @@ -275,7 +274,7 @@ func Test_wallet_HandleCredentialOffer(t *testing.T) {
// offeredCredential returns a structure that can be used as CredentialOffer.Credentials,
func offeredCredential() []openid4vci.OfferedCredential {
return []openid4vci.OfferedCredential{{
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
CredentialDefinition: &openid4vci.CredentialDefinition{
Context: []ssi.URI{
ssi.MustParseURI("https://www.w3.org/2018/credentials/v1"),
Expand Down
5 changes: 2 additions & 3 deletions vcr/issuer/openid.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import (
"github.com/nuts-foundation/nuts-node/audit"
"github.com/nuts-foundation/nuts-node/core"
"github.com/nuts-foundation/nuts-node/crypto"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/nuts-node/storage"
"github.com/nuts-foundation/nuts-node/vcr/issuer/assets"
"github.com/nuts-foundation/nuts-node/vcr/log"
Expand Down Expand Up @@ -208,7 +207,7 @@ func (i *openidHandler) OfferCredential(ctx context.Context, credential vc.Verif
}

func (i *openidHandler) HandleCredentialRequest(ctx context.Context, request openid4vci.CredentialRequest, accessToken string) (*vc.VerifiableCredential, error) {
if request.Format != openid4vc.VerifiableCredentialJSONLDFormat {
if request.Format != vc.JSONLDCredentialProofFormat {
return nil, openid4vci.Error{
Err: fmt.Errorf("credential request: unsupported format '%s'", request.Format),
Code: openid4vci.UnsupportedCredentialType,
Expand Down Expand Up @@ -409,7 +408,7 @@ func (i *openidHandler) createOffer(ctx context.Context, credential vc.Verifiabl
offer := openid4vci.CredentialOffer{
CredentialIssuer: i.issuerIdentifierURL,
Credentials: []openid4vci.OfferedCredential{{
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
CredentialDefinition: &openid4vci.CredentialDefinition{
Context: credential.Context,
Type: credential.Type,
Expand Down
3 changes: 1 addition & 2 deletions vcr/issuer/openid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"github.com/nuts-foundation/nuts-node/audit"
"github.com/nuts-foundation/nuts-node/core"
"github.com/nuts-foundation/nuts-node/crypto"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/nuts-node/storage"
"github.com/nuts-foundation/nuts-node/vcr/openid4vci"
"github.com/nuts-foundation/nuts-node/vdr/resolver"
Expand Down Expand Up @@ -144,7 +143,7 @@ func Test_memoryIssuer_HandleCredentialRequest(t *testing.T) {
proof, err := keyStore.SignJWT(ctx, claims, headers, headers["kid"])
require.NoError(t, err)
return openid4vci.CredentialRequest{
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
CredentialDefinition: &openid4vci.CredentialDefinition{
Context: []ssi.URI{
ssi.MustParseURI("https://www.w3.org/2018/credentials/v1"),
Expand Down
4 changes: 2 additions & 2 deletions vcr/openid4vci/issuer_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package openid4vci

import (
"context"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/go-did/vc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"net/http"
Expand Down Expand Up @@ -90,7 +90,7 @@ func Test_httpIssuerClient_RequestCredential(t *testing.T) {
httpClient := &http.Client{}
credentialRequest := CredentialRequest{
CredentialDefinition: &CredentialDefinition{},
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
}
t.Run("ok", func(t *testing.T) {
setup := setupClientTest(t)
Expand Down
4 changes: 2 additions & 2 deletions vcr/openid4vci/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/nuts-foundation/go-did/vc"
"github.com/nuts-foundation/nuts-node/auth/oauth"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/nuts-node/test"
"net/http"
"testing"
Expand All @@ -36,7 +36,7 @@ func setupClientTest(t *testing.T) *oidcClientTestContext {
providerMetadata := new(ProviderMetadata)
walletMetadata := new(OAuth2ClientMetadata)
credentialResponse := CredentialResponse{
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
Credential: &map[string]interface{}{
"@context": []string{"https://www.w3.org/2018/credentials/v1"},
"type": []string{"VerifiableCredential"},
Expand Down
3 changes: 1 addition & 2 deletions vcr/test/openid4vci_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/nuts-foundation/nuts-node/core"
httpModule "github.com/nuts-foundation/nuts-node/http"
"github.com/nuts-foundation/nuts-node/network/log"
"github.com/nuts-foundation/nuts-node/openid4vc"
"github.com/nuts-foundation/nuts-node/vcr/issuer"
"github.com/nuts-foundation/nuts-node/vcr/openid4vci"
"github.com/nuts-foundation/nuts-node/vdr"
Expand Down Expand Up @@ -230,7 +229,7 @@ func TestOpenID4VCIErrorResponses(t *testing.T) {
require.NoError(t, err)

requestBody, _ := json.Marshal(openid4vci.CredentialRequest{
Format: openid4vc.VerifiableCredentialJSONLDFormat,
Format: vc.JSONLDCredentialProofFormat,
})

t.Run("error from API layer (missing access token)", func(t *testing.T) {
Expand Down

0 comments on commit 7dc518a

Please sign in to comment.