# fiware/vcverifier architecture

> Architecture diagram of the GitHub repository fiware/vcverifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fiware/vcverifier
- Repository: https://github.com/fiware/vcverifier

## Overview

##### Project Identification and Purpose
- This project is a server-side component written in Go that implements verifiable credentials verification following the SIOP-2/OIDC4VP standards. In other words, it supports authentication flows by exchanging verifiable credentials for a signed JWT.
- The solution is designed to be deployed as a container (with a Dockerfile and Kubernetes helm-chart support), integrates with a configuration service as well as external trusted registries (EBSI and Gaia-X) to validate issuers, and exposes a RESTful API (documented with an OpenAPI spec).

##### Analyzing the File Structure
- Top-level directories like “api”, “config”, “openapi”, “views”, “common”, “gaiax”, “jades”, “tir”, and “verifier” indicate a clear separation of concerns.
- The “api” folder holds the API definitions (e.g. api.yaml) describing the endpoints.
- The “openapi” directory, with files like “routers.go” and the various data model files, shows that the API contracts and request/response models are both specified and tested.
- The “config” directory contains configuration management logic (with sample YAML files) and the service provider interface.
- “common” contains shared utilities (for caching, HTTP utilities, time handling, token signing, etc.).
- The “verifier” and “tir” directories hold the core verification logic and the client implementation to contact external registry services.
- The “views” directory shows that the project also provides a simple UI (like a QR-based login page) to start the authentication flow.
- CI/CD workflows exist under “.github/workflows” for tests, pre-release, and releases.
- A Dockerfile is provided for containerization, emphasizing that deployment scenarios include container-based and Kubernetes use.

##### Key Components and Their Interactions
- Core Server & Endpoints:
- The “main.go” file bootstraps the application.
- Endpoints implemented in the “api” and “openapi” directories deal with SIOP-2/OIDC4VP flows (login, authentication response, token issuance, etc.).
- Presentation Layer:
- The “views” directory, including static assets (CSS, JS, images) and templates (e.g., “verifier_present_qr.html”), comprises the login page that renders the QR code.
- Configuration & Logging:
- Configuration logic (from “config” and YAML files like “server.yaml”) determines service parameters such as port, session expiry, and endpoints for external services.
- The “logging” directory holds logging configuration which is essential for observability.
- External Integration & Verification:
- The “verifier”, “gaiax”, “jades”, and “tir” packages implement the business logic including:
▪ Fetching trusted issuer/participant information from external registries (EBSI, Gaia-X)
▪ Validating incoming verifiable credentials against policies and registry data.
- “common” utilities (e.g. tokenSigner) ensure that JWTs are created and signed properly.
- API Contract & Testing:
- The OpenAPI specification in “api/api.yaml” alongside model definitions (in “openapi”) ensure the endpoints’ contracts are clear.
- Various test files (e.g., tests in “config” and “tir”) support the reliability of these integrations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients
    Client["Client (Browser/Wallet)"]:::client
    Client -->|"request"| UI["QR Login UI (Presentation)"]:::ui

    %% VCVerifier Server Subgraph
    subgraph "VCVerifier Server"
        direction TB
        M["main.go"]:::entry
        M --> Config["Configuration & Service Provider"]:::config
        M --> Log["Logging & Observability"]:::log

        API["API Endpoints"]:::api
        API --> Models["API Data Models & Contracts"]:::data

        API --> Verifier["Verification Logic"]:::business
        API --> TIR["TIR Client"]:::business
        API --> GaiaX["Gaia-X Services"]:::business
        API --> Jades["Jades Validation"]:::business
        API --> Log
        API --> Config
        API --> Util["Shared Utility Library"]:::common

        Verifier -->|"validate"| ExtEBSI["EBSI TrustedIssuers Registry"]:::external
        TIR -->|"lookup"| ExtEBSI
        GaiaX -->|"lookup"| ExtGaiaX["Gaia-X Registry"]:::external

        Verifier -->|"JWTcreate"| Util
        Verifier --> Log
        TIR --> Log
        Jades --> Log
        Util --> API
    end

    %% UI to Server Connection
    UI -->|"QR login request"| API

    %% Click Events
    click M "https://github.com/fiware/vcverifier/blob/main/main.go"
    click API "https://github.com/fiware/vcverifier/blob/main/api/api.yaml"
    click Models "https://github.com/fiware/vcverifier/tree/main/openapi"
    click UI "https://github.com/fiware/vcverifier/blob/main/views/verifier_present_qr.html"
    click Config "https://github.com/fiware/vcverifier/tree/main/config"
    click Log "https://github.com/fiware/vcverifier/blob/main/logging/logging.go"
    click Util "https://github.com/fiware/vcverifier/tree/main/common"
    click GaiaX "https://github.com/fiware/vcverifier/blob/main/gaiax/gaiaXClient.go"
    click Verifier "https://github.com/fiware/vcverifier/blob/main/verifier/verifier.go"
    click TIR "https://github.com/fiware/vcverifier/blob/main/tir/tirClient.go"
    click Jades "https://github.com/fiware/vcverifier/blob/main/jades/jades_validator.go"

    %% Styles
    classDef entry fill:#ffcccc,stroke:#990000,stroke-width:2px;
    classDef api fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef data fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
    classDef config fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef log fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef common fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef business fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef ui fill:#ffeeba,stroke:#856404,stroke-width:2px;
    classDef client fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
```
