This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
VCVerifier is a FIWARE component implementing SIOP-2/OIDC4VP authentication flows. It exchanges Verifiable Credentials (VCs) for JWTs, enabling VC-based authentication and authorization. Supports multiple trust frameworks (EBSI, Gaia-X) and credential formats (JSON-LD VCs, SD-JWTs).
# Build
go build -o VCVerifier .
# Run all tests
go test ./... -v
# Run all tests with coverage
go test ./... -v -coverprofile=profile.cov
# Run tests for a single package
go test ./verifier/... -v
# Run a specific test
go test ./verifier/... -v -run TestVerifyConfig
# Docker build (multi-platform)
docker build -t vcverifier .There is no Makefile or linter configuration. CI runs go test ./... -v with Go 1.24.
Runtime config is loaded from server.yaml (override with CONFIG_FILE env var). The config is parsed by config.ReadConfig() using gookit/config with YAML driver and mapstructure tags.
Key config sections: server (port, timeouts, template/static dirs), logging, verifier (DID, TIR address, policies, validation mode, key algorithm), ssiKit (auditor URL), configRepo (dynamic service configurations with scopes and trust endpoints).
Entry point: main.go — reads config, initializes logging and verifier, sets up Gin router with routes from openapi/, serves on configured port with graceful shutdown.
-
verifier/— Core package (~1500 lines inverifier.go). Session management, JWT creation (RS256/ES256), QR code generation, nonce/state management. Request object modes:urlEncoded,byValue,byReference. Also contains:presentation_parser.go— Parses VP tokens (JSON-LD and SD-JWT formats), JSON-LD document loading with cachingjwt_verifier.go— VC validation with modes:none,combined,jsonLd,baseContext. DID verification method resolution for did:key, did:web, did:jwktrustedissuer.go/trustedparticipant.go— EBSI registry verificationcompliance.go— Policy compliance checking (signatures, dates, etc.)holder.go— Holder verificationgaiax.go— Gaia-X compliance checkselsi_proof_checker.go— JAdES signature validation for did:elsicredentialsConfig.go— Credential configuration managementcaching_client.go— HTTP caching layer
-
openapi/— HTTP handlers generated from OpenAPI spec (api/api.yaml). Routes defined inrouters.go. Handlers inapi_api.go(token, authorization, authentication) andapi_frontend.go(frontend endpoints, WebSocket polling). -
tir/— Trusted Issuers Registry client. Queries EBSI v3/v4 endpoints, caches results. Includes M2M auth viatokenProvider.goandauthorizationClient.go. -
gaiax/— Gaia-X compliance client. did:web resolution, X.509 certificate chain validation, trust anchor verification. -
jades/— JAdES signature validation for did:elsi credentials. -
config/— Configuration structs and YAML parsing. Test fixtures inconfig/data/. -
logging/— Zap-based structured logging with Gin middleware integration. -
common/— Shared types: cache interfaces (ServiceCache, TirEndpoints, IssuersCache), clock utilities, HTTP helpers, token signer interfaces. -
views/— HTML templates and static assets for QR code presentation frontend.
- Client hits OpenAPI endpoints (
/api/v1/authorization,/token, etc.) openapi/handlers delegate toverifier/for session management and credential exchange- Verifier validates presentations using the VC verification chain (parsing, signature validation, policy compliance, trust registry checks)
- Trust anchors are consulted via
tir/(EBSI) orgaiax/clients - On success, a JWT is issued to the client
- Uses
github.com/stretchr/testifyfor assertions - Table-driven tests with
type test structandt.Run()loops - Mock implementations within test files (e.g.,
mockNonceGenerator,mockSessionCache) - Test fixtures in
config/data/(YAML files) - Logging is initialized in tests with a shared
LOGGING_CONFIGvariable
- trustbloc/vc-go, did-go, kms-go — VC verification, DID resolution, key management
- gin-gonic/gin — HTTP framework
- lestrrat-go/jwx/v3 — JWT/JWS/JWK handling
- piprate/json-gold — JSON-LD processing
- gookit/config — Configuration management
- foolin/goview — Template rendering for Gin