From 544d2c544f5eb0c0238de62cde60753dd74d02d8 Mon Sep 17 00:00:00 2001 From: Oleg Lomaka Date: Wed, 13 Dec 2023 02:38:53 -0500 Subject: [PATCH] few fixes --- go.mod | 1 - go.sum | 2 -- server/handler.go | 2 +- server/middleware.go | 2 +- service/issuer.go | 6 +++++- service/refresh.go | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 260741c..bd7bf9f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.20 require ( github.com/ethereum/go-ethereum v1.13.1 - github.com/go-chi/chi v1.5.5 github.com/go-chi/chi/v5 v5.0.10 github.com/google/uuid v1.3.0 github.com/iden3/contracts-abi/state/go/abi v1.0.1 diff --git a/go.sum b/go.sum index 29c5eb4..4c6d1de 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,6 @@ github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlK github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/go-chi/chi v1.5.5 h1:vOB/HbEMt9QqBqErz07QehcOKHaWFtuj87tTDVz2qXE= -github.com/go-chi/chi v1.5.5/go.mod h1:C9JqLr3tIYjDOZpzn+BCuxY8z8vmca43EeMgyZt7irw= github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= diff --git a/server/handler.go b/server/handler.go index 1b78dd1..3f52917 100644 --- a/server/handler.go +++ b/server/handler.go @@ -7,8 +7,8 @@ import ( "github.com/0xPolygonID/refresh-service/logger" "github.com/0xPolygonID/refresh-service/service" - "github.com/go-chi/chi/middleware" "github.com/go-chi/chi/v5" + "github.com/go-chi/chi/v5/middleware" "github.com/pkg/errors" "github.com/rs/cors" ) diff --git a/server/middleware.go b/server/middleware.go index aa67f4a..9821295 100644 --- a/server/middleware.go +++ b/server/middleware.go @@ -21,7 +21,7 @@ func zapContextLogger(next http.Handler) http.Handler { "remoteAddr", r.RemoteAddr, "responseTime", fmt.Sprintf("%d ms", time.Since(t1).Milliseconds()), "status", ww.Status()) - logger.DefaultLogger.Sync() + _ = logger.DefaultLogger.Sync() }() next.ServeHTTP(ww, r) diff --git a/service/issuer.go b/service/issuer.go index a49bf41..3785543 100644 --- a/service/issuer.go +++ b/service/issuer.go @@ -72,7 +72,11 @@ func (is *IssuerService) CreateCredential(issuerDID string, credentialRequest cr logger.DefaultLogger.Infof("use issuer node '%s' for issuer '%s'", issuerNode, issuerDID) body := bytes.NewBuffer([]byte{}) - json.NewEncoder(body).Encode(credentialRequest) + err = json.NewEncoder(body).Encode(credentialRequest) + if err != nil { + return id, errors.Wrapf(ErrCreateClaim, + "credential request serialization error") + } resp, err := http.DefaultClient.Post( fmt.Sprintf("%s/api/v1/identities/%s/claims", issuerNode, issuerDID), "application/json", diff --git a/service/refresh.go b/service/refresh.go index 2706dab..9a6271c 100644 --- a/service/refresh.go +++ b/service/refresh.go @@ -80,7 +80,7 @@ func (rs *RefreshService) Process(issuer string, if err != nil { return verifiable.W3CCredential{}, errors.Wrapf(ErrCredentialNotUpdatable, - "for credential '%s' not possible to find a data provider", credential.ID, err) + "for credential '%s' not possible to find a data provider: %v", credential.ID, err) } updatedFields, err := flexibleHTTP.Provide(credential.CredentialSubject)