Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions agent/common/identityhub/identityhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

const (
CreateParticipantURL = "/v1alpha/participants"
CreateParticipantURL = "/v1beta/participants"
)

const (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions agent/common/identityhub/identityhub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions agent/common/issuerservice/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions agent/common/issuerservice/issuer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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",
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down