diff --git a/agent/common/identityhub/identityhub.go b/agent/common/identityhub/identityhub.go index 4cc369e..b0a0cd4 100644 --- a/agent/common/identityhub/identityhub.go +++ b/agent/common/identityhub/identityhub.go @@ -27,7 +27,7 @@ import ( ) const ( - CreateParticipantURL = "/v1alpha/participants" + CreateParticipantURL = "/v1beta/participants" ) const ( @@ -56,7 +56,7 @@ func (a HttpIdentityAPIClient) DeleteParticipantContext(ctx context.Context, par return fmt.Errorf("failed to get API access token: %w", err) } - url := fmt.Sprintf("%s/v1alpha/participants/%s", a.BaseURL, participantContextID) + url := fmt.Sprintf("%s/v1beta/participants/%s", a.BaseURL, participantContextID) req, err := http.NewRequestWithContext(ctx, http.MethodDelete, url, nil) if err != nil { return err @@ -85,7 +85,7 @@ func (a HttpIdentityAPIClient) QueryCredentialByType(ctx context.Context, partic return nil, fmt.Errorf("failed to get API access token: %w", err) } - url := fmt.Sprintf("%s/v1alpha/participants/%s/credentials?type=%s", a.BaseURL, participantContextID, credentialType) + url := fmt.Sprintf("%s/v1beta/participants/%s/credentials?type=%s", a.BaseURL, participantContextID, credentialType) req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) if err != nil { return nil, err @@ -124,7 +124,7 @@ func (a HttpIdentityAPIClient) RequestCredentials(ctx context.Context, participa return "", err } - url := fmt.Sprintf("%s/v1alpha/participants/%s/credentials/request", a.BaseURL, participantContextID) + url := fmt.Sprintf("%s/v1beta/participants/%s/credentials/request", a.BaseURL, participantContextID) req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewBuffer(payload)) if err != nil { return "", err @@ -156,7 +156,7 @@ func (a HttpIdentityAPIClient) GetCredentialRequestState(ctx context.Context, pa return "", fmt.Errorf("failed to get API access token: %w", err) } - url := fmt.Sprintf("%s/v1alpha/participants/%s/credentials/request/%s", a.BaseURL, participantContextID, credentialRequestID) + url := fmt.Sprintf("%s/v1beta/participants/%s/credentials/request/%s", a.BaseURL, participantContextID, credentialRequestID) req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) if err != nil { return "", err diff --git a/agent/common/identityhub/identityhub_test.go b/agent/common/identityhub/identityhub_test.go index c900f9c..de7c36f 100644 --- a/agent/common/identityhub/identityhub_test.go +++ b/agent/common/identityhub/identityhub_test.go @@ -31,7 +31,7 @@ import ( func TestIdentityAPIClient_CreateParticipantContext(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/v1alpha/participants" && r.Method == http.MethodPost { + if r.URL.Path == "/v1beta/participants" && r.Method == http.MethodPost { body, err := io.ReadAll(r.Body) require.NoError(t, err) @@ -147,7 +147,7 @@ func TestIdentityAPIClient_BadRequest(t *testing.T) { func TestHttpIdentityAPIClient_DeleteParticipantContext(t *testing.T) { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { participantContextID := "test-id" - if r.URL.Path == "/v1alpha/participants/"+participantContextID && r.Method == http.MethodDelete { + if r.URL.Path == "/v1beta/participants/"+participantContextID && r.Method == http.MethodDelete { require.Equal(t, "Bearer token", r.Header.Get("Authorization")) w.WriteHeader(http.StatusOK) } else { diff --git a/agent/common/issuerservice/issuer.go b/agent/common/issuerservice/issuer.go index 85b41a4..b5edc3d 100644 --- a/agent/common/issuerservice/issuer.go +++ b/agent/common/issuerservice/issuer.go @@ -56,7 +56,7 @@ func (i HttpApiClient) QueryCredentialsByType(ctx context.Context, holderID stri return nil, fmt.Errorf("failed to get API access token: %w", err) } - url := fmt.Sprintf("%s/v1alpha/participants/%s/credentials/query", i.BaseURL, i.IssuerID) + url := fmt.Sprintf("%s/v1beta/participants/%s/credentials/query", i.BaseURL, i.IssuerID) body := common.NewQuerySpec(common.WithFilterCriteria( common.Criterion{ OperandLeft: "verifiableCredential.credential.type", @@ -110,7 +110,7 @@ func (i HttpApiClient) DeleteHolder(ctx context.Context, holderID string) error return fmt.Errorf("failed to get API access token: %w", err) } - url := fmt.Sprintf("%s/v1alpha/participants/%s/holders/%s", i.BaseURL, i.IssuerID, holderID) + url := fmt.Sprintf("%s/v1beta/participants/%s/holders/%s", i.BaseURL, i.IssuerID, holderID) req, err := http.NewRequestWithContext(ctx, http.MethodDelete, url, nil) if err != nil { return err @@ -154,7 +154,7 @@ func (i HttpApiClient) CreateHolder(ctx context.Context, did string, holderID st return fmt.Errorf("error marshalling payload: %w", err) } - url := fmt.Sprintf("%s/v1alpha/participants/%s/holders", i.BaseURL, i.IssuerID) + url := fmt.Sprintf("%s/v1beta/participants/%s/holders", i.BaseURL, i.IssuerID) req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewBuffer(payload)) if err != nil { return fmt.Errorf("error creating request: %w", err) @@ -184,7 +184,7 @@ func (i HttpApiClient) RevokeCredential(ctx context.Context, participantContextI if err != nil { return err } - url := fmt.Sprintf("%s/v1alpha/participants/%s/credentials/%s/revoke", i.BaseURL, participantContextID, credentialID) + url := fmt.Sprintf("%s/v1beta/participants/%s/credentials/%s/revoke", i.BaseURL, participantContextID, credentialID) req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, nil) if err != nil { return err diff --git a/agent/common/issuerservice/issuer_test.go b/agent/common/issuerservice/issuer_test.go index b254a63..61686fc 100644 --- a/agent/common/issuerservice/issuer_test.go +++ b/agent/common/issuerservice/issuer_test.go @@ -32,7 +32,7 @@ import ( ) func TestHttpApiClient_CreateHolder(t *testing.T) { - template := "/v1alpha/participants/.*/holders" + template := "/v1beta/participants/.*/holders" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if r.Method == http.MethodPost && matched { @@ -81,7 +81,7 @@ func TestHttpApiClient_CreateHolder_AuthError(t *testing.T) { } func TestHttpApiClient_CreateHolder_ApiReturnsError(t *testing.T) { - template := "/v1alpha/participants/.*/holders" + template := "/v1beta/participants/.*/holders" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if r.Method == http.MethodPost && matched { @@ -107,7 +107,7 @@ func TestHttpApiClient_CreateHolder_ApiReturnsError(t *testing.T) { } func TestHttpApiClient_RevokeCredential(t *testing.T) { - template := "/v1alpha/participants/.*/credentials/.*/revoke" + template := "/v1beta/participants/.*/credentials/.*/revoke" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if matched && r.Method == http.MethodPost { @@ -132,7 +132,7 @@ func TestHttpApiClient_RevokeCredential(t *testing.T) { } func TestHttpApiClient_RevokeCredential_ClientError(t *testing.T) { - template := "/v1alpha/participants/.*/credentials/.*/revoke" + template := "/v1beta/participants/.*/credentials/.*/revoke" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if matched && r.Method == http.MethodPost { @@ -157,7 +157,7 @@ func TestHttpApiClient_RevokeCredential_ClientError(t *testing.T) { } func TestHttpApiClient_RevokeCredential_NotFound(t *testing.T) { - template := "/v1alpha/participants/.*/credentials/.*/revoke" + template := "/v1beta/participants/.*/credentials/.*/revoke" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if matched && r.Method == http.MethodPost { @@ -182,7 +182,7 @@ func TestHttpApiClient_RevokeCredential_NotFound(t *testing.T) { } func TestHttpApiClient_DeleteHolder(t *testing.T) { - template := "/v1alpha/participants/.*/holders/.*" + template := "/v1beta/participants/.*/holders/.*" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if r.Method == http.MethodDelete && matched { @@ -207,7 +207,7 @@ func TestHttpApiClient_DeleteHolder(t *testing.T) { } func TestHttpApiClient_DeleteHolder_NotFound(t *testing.T) { - template := "/v1alpha/participants/.*/holders/.*" + template := "/v1beta/participants/.*/holders/.*" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if r.Method == http.MethodDelete && matched { @@ -232,7 +232,7 @@ func TestHttpApiClient_DeleteHolder_NotFound(t *testing.T) { } func TestHttpApiClient_DeleteHolder_AuthError(t *testing.T) { - template := "/v1alpha/participants/.*/holders/.*" + template := "/v1beta/participants/.*/holders/.*" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if r.Method == http.MethodDelete && matched { @@ -257,7 +257,7 @@ func TestHttpApiClient_DeleteHolder_AuthError(t *testing.T) { } func TestHttpApiClient_QueryCredentialsByType(t *testing.T) { - template := "/v1alpha/participants/.*/credentials/query" + template := "/v1beta/participants/.*/credentials/query" credentials := []IssuerCredentialResourceDto{ { ID: "cred-1", @@ -327,7 +327,7 @@ func TestHttpApiClient_QueryCredentialsByType_AuthError(t *testing.T) { } func TestHttpApiClient_QueryCredentialsByType_ApiReturnsError(t *testing.T) { - template := "/v1alpha/participants/.*/credentials/query" + template := "/v1beta/participants/.*/credentials/query" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if r.Method == http.MethodPost && matched { @@ -353,7 +353,7 @@ func TestHttpApiClient_QueryCredentialsByType_ApiReturnsError(t *testing.T) { } func TestHttpApiClient_QueryCredentialsByType_InvalidJson(t *testing.T) { - template := "/v1alpha/participants/.*/credentials/query" + template := "/v1beta/participants/.*/credentials/query" server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { matched, _ := regexp.MatchString(template, r.URL.Path) if r.Method == http.MethodPost && matched {