# inji/inji-certify architecture

> Architecture diagram of the GitHub repository inji/inji-certify, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/inji/inji-certify
- Repository: https://github.com/inji/inji-certify

## Overview

1. **Repository shape**
   - This is a multi-module Java/Maven system centered on **Inji Certify**, a Spring Boot service for OpenID4VCI issuance.
   - The main runtime service is `certify-service`; shared contracts and domain types live in `certify-core`; plugin-facing SPI contracts live in `certify-integration-api`.
   - The repo also contains a large **API test rig** (`api-test`) and the operational assets needed for databases, Docker, and Kubernetes.

2. **Primary runtime boundary: `certify-service`**
   - `certify-service` is the production application entrypoint (`CertifyServiceApplication`).
   - Incoming requests go through Spring MVC controllers such as `OAuthController`, `VCIssuanceController`, `CredentialConfigController`, `PreAuthorizedCodeController`, `WellKnownController`, and `RenderingTemplateController`.
   - Security is enforced by filters and config in `SecurityConfig`, `AccessTokenValidationFilter`, `LocalAccessTokenValidationFilter`, and related auth helpers.

3. **Core issuance and protocol flows**
   - The service implements the issuer side of **OpenID4VCI draft 13**.
   - Main flows include:
     - issuer metadata and OAuth/OIDC discovery
     - credential configuration management
     - pre-authorized code issuance
     - interactive authorization request handling
     - token exchange
     - credential issuance
     - credential status / revocation
   - The codebase explicitly supports multiple VC formats: **W3C JSON-LD VC**, **SD-JWT VC**, and a **mock mDoc/mDL** path.

4. **Service-layer decomposition**
   - Business logic is in `certify-service/src/main/java/io/mosip/certify/services`.
   - Key service boundaries include:
     - `CredentialConfigurationServiceImpl` for config lifecycle
     - `VCIssuanceServiceImpl` and `CertifyIssuanceServiceImpl` for credential generation/issue
     - `IarServiceImpl`, `IarSessionService`, and `IarVpRequestService` for interactive authorization request state
     - `PreAuthorizedCodeService` for pre-auth code flow
     - `CredentialStatusServiceImpl` and `StatusListCredentialService` for revocation/status list handling
     - `RenderingTemplateServiceImpl` for template-driven credential rendering
     - `JwksServiceImpl` and `OAuthAuthorizationServerMetadataService` for discovery and key publication

5. **Data model and persistence**
   - Persistence is JPA-based, with repositories under `certify-service/repository`.
   - Important persisted entities include `CredentialConfig`, `IarSession`, `Ledger`, `RenderingTemplate`, `CredentialStatusTransaction`, and status-list tables.
   - The DB schema is versioned and managed separately in `db_scripts` and `db_upgrade_script`, which is important because service behavior depends on specific schema tables and upgrade scripts.

6. **Credential construction pipeline**
   - The service separates “what credential to issue” from “how to format/sign it”.
   - Format-specific code lives in:
     - `credential/` for `Credential`, `SDJWT`, `W3CJsonLD`, `MDocCredential`
     - `validators/` for request and configuration validation by format
     - `proof/` and `proofgenerators/` for proof validation and signing
     - `vcformatters/` for templating and serialization
   - This makes format support a plug-in-like internal boundary even before external plugins are invoked.

7. **Plugin integration boundary**
   - `certify-integration-api` defines SPI contracts for extension points:
     - `DataProviderPlugin`
     - `VCIssuancePlugin`
     - `AuditPlugin`
   - The service can either generate credentials directly or delegate data retrieval/issuance behavior through these plugin interfaces.
   - The README highlights two major plugin styles: **Data Provider plugins** (e.g., Postgres, CSV) and **VC Issuance plugins**.

8. **Core shared module**
   - `certify-core` holds the protocol-neutral contract layer shared across service implementations and plugins.
   - It contains:
     - DTOs for auth requests/responses, credential configs, ledger search, status lists, metadata, and verifiable presentation verification
     - constants and error models
     - validators and SPI interfaces
     - common utilities and exception types
   - This module is the main boundary that keeps API shapes and domain objects stable across the service and plugin layers.

9. **Test and simulation environment**
   - `api-test` is a separate Spring/Java test rig built with TestNG and Maven.
   - It contains many request templates, sample biometric assets, and scenario folders for different credential ecosystems and use cases.
   - The files under `src/main/resources/injicertify` and the `testNgXmlFiles` indicate it is used to run end-to-end scripted API scenarios against the service and related dependencies, not just unit tests.

10. **Configuration and templating system**
    - The service relies heavily on externalized configuration in `src/main/resources`, including credential configuration JSON, VP request config, bootstrap/application property files, and template resources.
    - Rendering uses Velocity/templating support and stored credential templates; this is central to how credential payloads are assembled from configured claims and issuer-specific layouts.
    - The `RenderingTemplateController` and template repository show that templates are first-class runtime data, not just static assets.

11. **Operational dependencies**
    - The service assumes external identity and trust infrastructure:
      - an OAuth/OIDC authorization server such as **Keycloak/eSignet**
      - a database for config, sessions, templates, ledger, and status data
      - optional Redis cache support via `RedisCacheConfig`
      - key management / signing infrastructure, especially for data-integrity and proof generation
    - There are also crypto- and trust-related assets in `.github/keys` and deployment scripts for production environments.

12. **Deployment topology**
    - Local execution is supported both via **Docker Compose** and direct service startup.
    - Production deployment is Kubernetes-based, with Helm charts in `helm/inji-certify` and deployment scripts in `deploy/`.
    - The repo also contains Dockerfiles for the service and testing rig, plus workflow automation for build, linting, and publishing charts.

13. **How to diagram the system**
    - A useful diagram should show:
      - clients/wallets calling the Spring Boot issuer API
      - security/auth server interaction for token and metadata flows
      - controllers delegating to service-layer orchestration
      - service-layer access to DB/repositories, template storage, status lists, and ledger records
      - optional plugin calls for data-provider or issuance customization
      - proof/signing and format-specific rendering as a separate internal lane
      - deployment wrappers around the service: Docker/Kubernetes/Helm, plus the separate test harness and DB scripts

Main entry points: [`certify-service/src/main/java/io/mosip/certify/services`](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/services) (Flow Services), [`certify-service/src/main/java/io/mosip/certify/controller`](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/controller) (HTTP API), [`certify-service/src/main/java/io/mosip/certify/credential`](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/credential) (Credential Pipeline), [`api-test/src/main/java/io/inji/testrig/apirig/injicertify/testrunner/InjiTestRunner.java`](https://github.com/inji/inji-certify/blob/master/api-test/src/main/java/io/inji/testrig/apirig/injicertify/testrunner/InjiTestRunner.java) (API Test Rig)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_runtime["Runtime"]
  node_n1["Certify App<br/>Spring Boot entrypoint"]
  node_n2["HTTP API<br/>REST controllers"]
  node_n3["Security<br/>filters/config"]
  node_n4["Flow Services<br/>business orchestration"]
  node_n5["Credential Pipeline<br/>format engine"]
  node_n6[("Persistence<br/>JPA entities/repos")]
  node_n7["VC Formatters<br/>templating"]
  node_n8{{"Proof & Signing<br/>crypto/proof"}}
  node_n9["Plugin Bridge<br/>service plugin"]
  node_n12["App Config<br/>spring config"]
  node_n13["Status Lists<br/>revocation support"]
  node_n17["Discovery<br/>issuer metadata"]
  node_n18["Pre-Auth Flow<br/>issuance flow"]
  node_n19["Interactive Flow<br/>IAR flow"]
  node_n20["Ledger API<br/>search/retrieval"]
end

subgraph group_grp_shared["Shared"]
  node_n10["Core Contracts<br/>shared domain"]
  node_n11["Plugin SPI<br/>integration api"]
end

subgraph group_grp_ops["Ops"]
  node_n14["DB Scripts<br/>schema management<br/>[ddl.sql]"]
  node_n15["Deployments<br/>k8s/docker<br/>[Chart.yaml]"]
end

subgraph group_grp_test["Test Rig"]
  node_n16["API Test Rig<br/>e2e harness"]
end

node_n1 -->|"hosts"| node_n2
node_n1 -->|"protects"| node_n3
node_n2 -->|"delegates"| node_n4
node_n2 -->|"exposes"| node_n17
node_n2 -->|"exposes"| node_n18
node_n2 -->|"exposes"| node_n19
node_n2 -->|"exposes"| node_n20
node_n4 -->|"builds"| node_n5
node_n4 -->|"persists"| node_n6
node_n4 -->|"renders"| node_n7
node_n4 -->|"signs"| node_n8
node_n4 -->|"invokes"| node_n9
node_n4 -->|"updates"| node_n13
node_n4 -->|"publishes"| node_n17
node_n4 -->|"orchestrates"| node_n18
node_n4 -->|"orchestrates"| node_n19
node_n4 -->|"queries"| node_n20
node_n5 -->|"formats with"| node_n7
node_n5 -->|"validated by"| node_n8
node_n5 -->|"shares types"| node_n10
node_n9 -->|"implements"| node_n11
node_n11 -->|"depends on"| node_n10
node_n12 -->|"wires"| node_n4
node_n12 -->|"configures"| node_n5
node_n13 -->|"stores"| node_n6
node_n14 -->|"backs"| node_n6
node_n15 -->|"packages"| node_n1
node_n15 -->|"supports"| node_n16
node_n16 -->|"drives"| node_n2
node_n16 -->|"initializes"| node_n14

click node_n1 "https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java"
click node_n2 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/controller"
click node_n3 "https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/config/SecurityConfig.java"
click node_n4 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/services"
click node_n5 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/credential"
click node_n6 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/repository"
click node_n7 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/vcformatters"
click node_n8 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/proof"
click node_n9 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/plugin"
click node_n10 "https://github.com/inji/inji-certify/tree/master/certify-core/src/main/java/io/mosip/certify/core"
click node_n11 "https://github.com/inji/inji-certify/tree/master/certify-integration-api/src/main/java/io/mosip/certify/api/spi"
click node_n12 "https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/config"
click node_n13 "https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/StatusListCredentialService.java"
click node_n14 "https://github.com/inji/inji-certify/blob/master/db_scripts/inji_certify/ddl.sql"
click node_n15 "https://github.com/inji/inji-certify/blob/master/helm/inji-certify/Chart.yaml"
click node_n16 "https://github.com/inji/inji-certify/blob/master/api-test/src/main/java/io/inji/testrig/apirig/injicertify/testrunner/InjiTestRunner.java"
click node_n17 "https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/controller/WellKnownController.java"
click node_n18 "https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/PreAuthorizedCodeService.java"
click node_n19 "https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/IarServiceImpl.java"
click node_n20 "https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/CredentialLedgerServiceImpl.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_n1,node_n2,node_n3,node_n4,node_n5,node_n6,node_n7,node_n8,node_n9,node_n12,node_n13,node_n17,node_n18,node_n19,node_n20 toneBlue
class node_n10,node_n11 toneAmber
class node_n14,node_n15 toneMint
class node_n16 toneRose
```

## Components

### Runtime

Production issuer service and its internal layers.

- [Certify App](https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java): Spring Boot entrypoint · Main production service for OpenID4VCI issuance. · `certify-service/src/main/java/io/mosip/certify/CertifyServiceApplication.java`
- [HTTP API](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/controller): REST controllers · Issuer endpoints for OAuth, credential issuance, config, revocation, templates, and discovery. · `certify-service/src/main/java/io/mosip/certify/controller`
- [Security](https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/config/SecurityConfig.java): filters/config · Request authentication and access-token enforcement around the service API. · `certify-service/src/main/java/io/mosip/certify/config/SecurityConfig.java`
- [Flow Services](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/services): business orchestration · Core issuance, pre-auth, interactive authorization, discovery, JWKS, status, and template orchestration. · `certify-service/src/main/java/io/mosip/certify/services`
- [Credential Pipeline](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/credential): format engine · Format-specific credential modeling, validation, proof generation, and serialization. · `certify-service/src/main/java/io/mosip/certify/credential`
- [Persistence](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/repository): JPA entities/repos · Repositories and entities for configs, sessions, ledgers, templates, and status lists. · `certify-service/src/main/java/io/mosip/certify/repository`
- [VC Formatters](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/vcformatters): templating · Velocity-based rendering and serialization of credential payloads. · `certify-service/src/main/java/io/mosip/certify/vcformatters`
- [Proof & Signing](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/proof): crypto/proof · Proof validation and proof generation for JWT, DID, and data-integrity flows. · `certify-service/src/main/java/io/mosip/certify/proof`
- [Plugin Bridge](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/plugin): service plugin · Runtime adapter that invokes audit and issuance/data-provider plugins. · `certify-service/src/main/java/io/mosip/certify/plugin`
- [App Config](https://github.com/inji/inji-certify/tree/master/certify-service/src/main/java/io/mosip/certify/config): spring config · Service wiring for MVC, Velocity, MDoc, verification, batch jobs, and auth conversion. · `certify-service/src/main/java/io/mosip/certify/config`
- [Status Lists](https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/StatusListCredentialService.java): revocation support · Status-list issuance, index management, and scheduled updates for credential revocation state. · `certify-service/src/main/java/io/mosip/certify/services/StatusListCredentialService.java`
- [Discovery](https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/controller/WellKnownController.java): issuer metadata · Well-known, OAuth authorization server metadata, and JWKS publication. · `certify-service/src/main/java/io/mosip/certify/controller/WellKnownController.java`
- [Pre-Auth Flow](https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/PreAuthorizedCodeService.java): issuance flow · Pre-authorized code issuance and token exchange path for issuance without interactive user auth. · `certify-service/src/main/java/io/mosip/certify/services/PreAuthorizedCodeService.java`
- [Interactive Flow](https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/IarServiceImpl.java): IAR flow · Interactive authorization request session handling and VP presentation during issuance. · `certify-service/src/main/java/io/mosip/certify/services/IarServiceImpl.java`
- [Ledger API](https://github.com/inji/inji-certify/blob/master/certify-service/src/main/java/io/mosip/certify/services/CredentialLedgerServiceImpl.java): search/retrieval · Credential ledger lookup and issuance history access. · `certify-service/src/main/java/io/mosip/certify/services/CredentialLedgerServiceImpl.java`

### Shared

Protocol-neutral contracts and plugin-facing SPI.

- [Core Contracts](https://github.com/inji/inji-certify/tree/master/certify-core/src/main/java/io/mosip/certify/core): shared domain · Protocol-neutral DTOs, SPI interfaces, validators, constants, and errors shared by service and plugins. · `certify-core/src/main/java/io/mosip/certify/core`
- [Plugin SPI](https://github.com/inji/inji-certify/tree/master/certify-integration-api/src/main/java/io/mosip/certify/api/spi): integration api · Extension contracts for data providers, VC issuance plugins, and audit plugins. · `certify-integration-api/src/main/java/io/mosip/certify/api/spi`

### Ops

Database, deployment, and runtime packaging assets.

- [DB Scripts](https://github.com/inji/inji-certify/blob/master/db_scripts/inji_certify/ddl.sql): schema management · Initial schema, seed data, and upgrade/rollback scripts for the certify database. · `db_scripts/inji_certify/ddl.sql`
- [Deployments](https://github.com/inji/inji-certify/blob/master/helm/inji-certify/Chart.yaml): k8s/docker · Docker Compose, Dockerfiles, Helm chart, and deployment scripts for local and production runtime. · `helm/inji-certify/Chart.yaml`

### Test Rig

End-to-end API scenario harness and fixtures.

- [API Test Rig](https://github.com/inji/inji-certify/blob/master/api-test/src/main/java/io/inji/testrig/apirig/injicertify/testrunner/InjiTestRunner.java): e2e harness · Separate TestNG-based scenario runner with request templates, sample assets, and environment configs. · `api-test/src/main/java/io/inji/testrig/apirig/injicertify/testrunner/InjiTestRunner.java`

## Connections

- Certify App → HTTP API: hosts · Application exposes issuer endpoints through controllers.
- Certify App → Security: protects · Security filters guard incoming requests.
- HTTP API → Flow Services: delegates · Controllers forward protocol operations to service-layer orchestration.
- HTTP API → Discovery: exposes · Discovery endpoints are served through HTTP controllers.
- HTTP API → Pre-Auth Flow: exposes · Pre-authorized code endpoints are handled by the API layer.
- HTTP API → Interactive Flow: exposes · Interactive authorization request endpoints are handled by the API layer.
- HTTP API → Ledger API: exposes · Ledger-related endpoints are served through the API layer.
- Flow Services → Credential Pipeline: builds · Issuance services assemble credentials through the credential pipeline.
- Flow Services → Persistence: persists · Business flows read and write configs, sessions, templates, and status data.
- Flow Services → VC Formatters: renders · Template service formats credential payloads and display content.
- Flow Services → Proof & Signing: signs · Proof and signing components validate proofs and generate signatures.
- Flow Services → Plugin Bridge: invokes · Services can delegate data retrieval or issuance customization to plugins.
- Flow Services → Status Lists: updates · Credential status flows maintain revocation and status lists.
- Flow Services → Discovery: publishes · Discovery services generate metadata and JWKS documents.
- Flow Services → Pre-Auth Flow: orchestrates · Pre-auth service manages code issuance and token exchange.
- Flow Services → Interactive Flow: orchestrates · IAR services manage session state and VP request handling.
- Flow Services → Ledger API: queries · Ledger services provide search and issuance history access.
- Credential Pipeline → VC Formatters: formats with · Credential objects are serialized through formatter/template support.
- Credential Pipeline → Proof & Signing: validated by · Proof validators and generators secure credential construction.
- Credential Pipeline → Core Contracts: shares types · Format code relies on common contracts and DTOs.
- Plugin Bridge → Plugin SPI: implements · Runtime plugin bridge uses the SPI contracts.
- Plugin SPI → Core Contracts: depends on · Integration contracts align with shared DTOs and errors.
- App Config → Flow Services: wires · Spring configuration composes the service-layer beans.
- App Config → Credential Pipeline: configures · Configuration enables format-specific behavior.
- Status Lists → Persistence: stores · Status list state is persisted via repositories.
- DB Scripts → Persistence: backs · Database scripts define the schema used by repositories.
- Deployments → Certify App: packages · Docker and Helm assets package and deploy the service.
- Deployments → API Test Rig: supports · Deployment assets also run the API test rig and local stack.
- API Test Rig → HTTP API: drives · Test scenarios exercise the service through HTTP flows.
- API Test Rig → DB Scripts: initializes · The test rig uses DB fixtures and cleanup scripts.
