Skip to content
Snippets Groups Projects
Commit 9109f705 authored by Yordan Kinkov's avatar Yordan Kinkov
Browse files

Merge branch 'provide-proof-manager-address-instead-of-OCM-address' into 'main'

Provide proof manager address instead of OCM address in OCM client

See merge request gaia-x/data-infrastructure-federation-services/tsa/golib!4
parents 8031967e 375486cd
No related branches found
No related tags found
No related merge requests found
Pipeline #60065 failed with stage
in 57 seconds
......@@ -6,7 +6,7 @@ before_script:
- cd /go/src/gitlab.com/${CI_PROJECT_PATH}
unit tests:
image: golang:1.19.2
image: golang:1.19.4
stage: test
tags:
- amd64-docker
......@@ -18,7 +18,7 @@ unit tests:
lint:
image: golangci/golangci-lint:v1.50.0
image: golangci/golangci-lint:v1.50.1
stage: test
tags:
- amd64-docker
......@@ -28,7 +28,7 @@ lint:
- golangci-lint run
govulncheck:
image: golang:1.19.2
image: golang:1.19.4
stage: test
tags:
- amd64-docker
......
......@@ -11,21 +11,21 @@ import (
)
const (
proofOutOfBandPath = "/proof/v1/out-of-band-proof"
proofPresentationPath = "/proof/v1/find-by-presentation-id"
proofOutOfBandPath = "/v1/out-of-band-proof"
proofPresentationPath = "/v1/find-by-presentation-id"
)
// Client is the OCM service client
type Client struct {
addr string
httpClient *http.Client
proofManagerAddr string
httpClient *http.Client
}
// New initializes an OCM service client given the OCM service address
func New(addr string, opts ...Option) *Client {
func New(proofManagerAddr string, opts ...Option) *Client {
c := &Client{
addr: addr,
httpClient: http.DefaultClient,
proofManagerAddr: proofManagerAddr,
httpClient: http.DefaultClient,
}
for _, opt := range opts {
......@@ -38,7 +38,7 @@ func New(addr string, opts ...Option) *Client {
// GetLoginProofInvitation calls the "invitation" endpoint on
// the "out-of-band" protocol in the OCM.
func (c *Client) GetLoginProofInvitation(ctx context.Context, credTypes []string) (*LoginProofInvitationResponse, error) {
req, err := http.NewRequestWithContext(ctx, "POST", c.addr+proofOutOfBandPath, nil)
req, err := http.NewRequestWithContext(ctx, "POST", c.proofManagerAddr+proofOutOfBandPath, nil)
if err != nil {
return nil, err
}
......@@ -72,7 +72,7 @@ func (c *Client) GetLoginProofInvitation(ctx context.Context, credTypes []string
// GetLoginProofResult calls the "find-by-presentation-id" endpoint in the OCM.
func (c *Client) GetLoginProofResult(ctx context.Context, presentationID string) (*LoginProofResultResponse, error) {
req, err := http.NewRequestWithContext(ctx, "GET", c.addr+proofPresentationPath, nil)
req, err := http.NewRequestWithContext(ctx, "GET", c.proofManagerAddr+proofPresentationPath, nil)
if err != nil {
return nil, err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment