Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aldigjo committed Jan 2, 2025
1 parent 4ad6377 commit fdb7307
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
3 changes: 1 addition & 2 deletions internal/api/verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,14 @@ 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
} else {
log.Error(ctx, "checking verification", "err", err, "issuerDID", issuerDID, "id", verificationQueryID)
return CheckVerification500JSONResponse{N500JSONResponse{Message: err.Error()}}, nil
}

}

// Check if a response exists
Expand Down
4 changes: 1 addition & 3 deletions internal/api/verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
15 changes: 3 additions & 12 deletions internal/core/services/verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
}
Expand Down

0 comments on commit fdb7307

Please sign in to comment.