diff --git a/internal/api/verification.go b/internal/api/verification.go index 4dd224f0..a1ed5061 100644 --- a/internal/api/verification.go +++ b/internal/api/verification.go @@ -43,7 +43,7 @@ func (s *Server) CheckVerification(ctx context.Context, request CheckVerificatio // Use the VerificationService to check for existing response or query response, query, err := s.verificationService.GetVerificationStatus(ctx, *issuerDID, verificationQueryID) if err != nil { - //if error is not found, return 404 + // if error is not found, return 404 if err.Error() == "verification query not found" { log.Error(ctx, "checking verification, not found", "err", err, "issuerDID", issuerDID, "id", verificationQueryID) return CheckVerification404JSONResponse{N404JSONResponse{Message: "Verification query not found"}}, nil @@ -51,7 +51,6 @@ func (s *Server) CheckVerification(ctx context.Context, request CheckVerificatio log.Error(ctx, "checking verification", "err", err, "issuerDID", issuerDID, "id", verificationQueryID) return CheckVerification500JSONResponse{N500JSONResponse{Message: err.Error()}}, nil } - } // Check if a response exists diff --git a/internal/api/verification_test.go b/internal/api/verification_test.go index d5f61b36..69075b2c 100644 --- a/internal/api/verification_test.go +++ b/internal/api/verification_test.go @@ -9,10 +9,8 @@ import ( "testing" "github.com/google/uuid" - "github.com/jackc/pgtype" - core "github.com/iden3/go-iden3-core/v2" - + "github.com/jackc/pgtype" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/core/services/verification.go b/internal/core/services/verification.go index c66659bf..53aaee46 100644 --- a/internal/core/services/verification.go +++ b/internal/core/services/verification.go @@ -29,15 +29,6 @@ type scope struct { Id uint32 `json:"id"` Params json.RawMessage `json:"params,omitempty"` Query json.RawMessage `json:"query"` - // TransactionData *transactionData `json:"transactionData,omitempty"` -} - -// TransactionData is a property of Scope, and it's required for the authRequest -type transactionData struct { - ChainID int `json:"chainID"` - ContractAddress string `json:"contractAddress"` - MethodID string `json:"methodID"` - Network string `json:"network"` } const ( @@ -91,7 +82,7 @@ func (vs *VerificationService) CreateVerificationQuery(ctx context.Context, issu verificationQuery.ID = queryID - authRequest, err := vs.getAuthRequestOffChain(&verificationQuery, serverURL) + authRequest, err := vs.getAuthRequestOffChain(ctx, &verificationQuery, serverURL) if err != nil { return nil, fmt.Errorf("failed to generate auth request: %w", err) } @@ -171,7 +162,7 @@ func (s *VerificationService) key(id uuid.UUID) string { return "issuer-node:qr-code:" + id.String() } -func (vs *VerificationService) getAuthRequestOffChain(req *domain.VerificationQuery, serverURL string) (protocol.AuthorizationRequestMessage, error) { +func (vs *VerificationService) getAuthRequestOffChain(ctx context.Context, req *domain.VerificationQuery, serverURL string) (protocol.AuthorizationRequestMessage, error) { id := uuid.NewString() authReq := auth.CreateAuthorizationRequest(vs.getReason(nil), req.IssuerDID, vs.getUri(serverURL, req.IssuerDID, req.ID)) authReq.ID = id @@ -182,7 +173,7 @@ func (vs *VerificationService) getAuthRequestOffChain(req *domain.VerificationQu if req.Scope.Status == pgtype.Present { err := json.Unmarshal(req.Scope.Bytes, &scopes) if err != nil { - log.Error(context.Background(), "failed to unmarshal scope", "error", err) + log.Error(ctx, "failed to unmarshal scope", "error", err) return protocol.AuthorizationRequestMessage{}, fmt.Errorf("failed to unmarshal scope: %w", err) } }