From dea966734110a664904fc5b9370fe14d857f13a7 Mon Sep 17 00:00:00 2001 From: Lyuben Penkovski <lyuben.penkovski@vereign.com> Date: Fri, 19 May 2023 12:04:47 +0300 Subject: [PATCH] Update OCM client according to OCM API changes --- .gitlab-ci.yml | 6 +++--- errors/errors.go | 10 +++++----- graceful/graceful_test.go | 2 +- ocm/client.go | 2 +- ocm/types.go | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7cfd8f..d6cb6aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,7 @@ before_script: - cd /go/src/gitlab.com/${CI_PROJECT_PATH} unit tests: - image: golang:1.20.2 + image: golang:1.20.4 stage: test tags: - amd64-docker @@ -18,7 +18,7 @@ unit tests: lint: - image: golangci/golangci-lint:v1.50.1 + image: golangci/golangci-lint:latest stage: test tags: - amd64-docker @@ -28,7 +28,7 @@ lint: - golangci-lint run govulncheck: - image: golang:1.20.2 + image: golang:1.20.4 stage: test tags: - amd64-docker diff --git a/errors/errors.go b/errors/errors.go index 2f1c090..ffa1f25 100644 --- a/errors/errors.go +++ b/errors/errors.go @@ -96,12 +96,12 @@ func New(args ...interface{}) error { case Kind: e.Kind = arg case *Error: - copy := *arg - e.Err = © - e.ID = copy.ID - innerKind = copy.Kind + errCopy := *arg + e.Err = &errCopy + e.ID = errCopy.ID + innerKind = errCopy.Kind if e.Message == "" { - e.Message = copy.Message + e.Message = errCopy.Message } case error: e.Err = arg diff --git a/graceful/graceful_test.go b/graceful/graceful_test.go index 5e0c60c..05933f3 100644 --- a/graceful/graceful_test.go +++ b/graceful/graceful_test.go @@ -19,7 +19,7 @@ type handler struct { requestTime time.Duration } -func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (h *handler) ServeHTTP(_ http.ResponseWriter, _ *http.Request) { time.Sleep(h.requestTime) } diff --git a/ocm/client.go b/ocm/client.go index 4d1b2fa..4d8674a 100644 --- a/ocm/client.go +++ b/ocm/client.go @@ -146,7 +146,7 @@ func (c *Client) findByPresentationID(ctx context.Context, presentationID string } v := url.Values{} - v.Add("presentationId", presentationID) + v.Add("proofRecordId", presentationID) req.URL.RawQuery = v.Encode() resp, err := c.httpClient.Do(req) diff --git a/ocm/types.go b/ocm/types.go index 4cda322..9a26a0e 100644 --- a/ocm/types.go +++ b/ocm/types.go @@ -7,7 +7,7 @@ type LoginProofInvitationResponse struct { } type LoginProofInvitationResponseData struct { - PresentationID string `json:"presentationId"` + ProofRecordID string `json:"proofRecordId"` PresentationMessage string `json:"presentationMessage"` } @@ -18,11 +18,11 @@ type LoginProofResultResponse struct { } type LoginProofResultResponseData struct { - State string `json:"state"` - Data []Credential `json:"presentations"` + State string `json:"state"` + Presentations []Presentation `json:"presentations"` } -type Credential struct { +type Presentation struct { SchemaID string `json:"schemaId"` CredDefID string `json:"credDefId"` Claims map[string]interface{} `json:"credentialSubject"` -- GitLab