How inji/mimoto works
1. What this repo is
- This is a Spring Boot 3 / Java 21 backend for Inji Mobile and Inji Web.
- It is not just an API app; it is the orchestration layer for wallets, credentials, identity-provider login, verifiable presentations, and issuer/verifier configuration.
2. Main runtime boundary
- The runnable service is src/main/java/io/mosip/mimoto.
- HTTP endpoints are split by domain in controller/, and they delegate almost all work to service/ implementations.
- MimotoServiceApplication is the bootstrap entry point.
3. Core domain areas exposed by the API
- Wallet management: create, unlock, lock, delete, and list wallets.
- Credential management: request, store, verify, download, share, and render credentials.
- Presentation flows: OpenID4VP / verifiable presentation generation and submission.
- Issuer/verifier discovery and onboarding: issuer config, trusted verifiers, well-known metadata, and policy discovery.
- User/IDP flows: login, token handling, and user metadata.
4. Service-layer structure
- The service/ package holds the orchestration logic; service/impl/ contains the concrete workflows.
- Important subservices include:
- WalletService, WalletLockService, WalletUnlockService
- CredentialService, CredentialRequestService, CredentialShareService, CredentialVerifierService
- PresentationService, PresentationSubmissionService, PresentationActionService
- IssuersService, TrustedVerifierService, VerifierService
- IdpService, TokenService, TokenDecoder
- Several flows are factory-based, especially credential format handling and signing algorithms.
5. Persistence and state
- The application persists operational state in Postgres through Spring Data repositories.
- Repositories cover wallets, credentials, verifiable presentations, trusted verifiers, user metadata, and proof-signing keys.
- Redis is supported for distributed cache and session storage; the README explicitly calls out Caffeine as the default in-memory cache and Redis as the shared option for multi-instance deployments.
6. Credential and wallet data model
- Domain objects under model/ represent wallet state, credential metadata, verifiable credentials/presentations, passcode controls, trusted verifiers, and key metadata.
- The wallet is a first-class security boundary: credentials are stored and accessed through wallet lock/unlock logic and encryption utilities.
7. External identity and issuer integration
- The service integrates with external OIDC/OAuth2 providers, especially Google login, via security/oauth2/.
- It also consumes issuer metadata and credential issuer configuration from JSON resources and remote well-known endpoints.
- Several flows depend on external IDP, resident, and credential-issuance APIs represented by the many DTOs in dto/resident, dto/idp, dto/mimoto, and dto/openid.
8. Presentation / verifier flow
- The repo includes a full OpenID4VP path: discover verifier, build presentation request, select matching credentials, submit presentation, and handle acceptance/rejection.
- Trusted verifier registration and verifier policy/configuration are persistent concerns, not just request-time validation.
9. Cryptography and key management
- Crypto is a major architectural boundary.
- Key material is loaded from a PKCS#12 keystore and used for wallet encryption/decryption, signing, and onboarding/OIDC client operations.
- The code includes algorithm-specific signing handlers for ES256, ES256K, Ed25519, and RS256, plus utilities for JWT/JWS, JOSE, and encryption/decryption.
- There is also attestation verification support, both online and offline.
10. Content generation and credential formats
- Credential formatting is abstracted behind CredentialFormatHandler and its factory.
- The repository supports multiple formats, including LDP VC and SD-JWT variants.
- It can also generate PDF representations of credentials, using HTML templates under src/main/resources/templates/ and credential-template.html.
11. Configuration model
- Runtime behavior is heavily configuration-driven.
- The app reads issuer configs, trusted verifier configs, application properties, cache/session settings, and token/OAuth settings from src/main/resources/ and environment-specific property files.
- This means deployment correctness depends on external config more than on code changes.
12. Supporting test rig in api-test/
- api-test/ is a separate Maven-based test harness, not the main service.
- It contains TestNG suites, YAML-driven scenario definitions, Handlebars templates, sample biometric/device artifacts, and certificates for exercising Mimoto APIs end to end.
- This module is useful to diagram as a consumer/test client around the backend rather than part of the backend runtime itself.
13. Deployment and operations
- The repo includes Docker, docker-compose, Helm charts, K8s deploy scripts, DB schema/init scripts, and upgrade SQLs.
- Operationally, the main dependencies are Postgres, optional Redis, and external OAuth/OIDC services; nginx is used in local docker-compose setups to serve static assets.
- The database schema is managed under db_scripts/ and versioned upgrades are provided under db_upgrade_script/.
14. High-level data flow
- Client request enters a controller.
- Controller delegates to a domain service.
- Service may consult cache/session state, database repositories, keystore/crypto utilities, and external issuer/IDP/verifier services.
- Results are persisted where needed, transformed into DTOs/models, and returned to the client.
- For presentation and credential flows, the service often acts as the mediator between wallet state and external identity/issuer ecosystems.
Main entry points: controller Controllers · CredentialService.java Credential core · mimoto Main tests · WalletService.java Wallet core
Components 19
Backend runtime
Spring Boot service and its domain subsystems.
- Mimoto app · Bootstrap for the backend service.
src/main/java/io/mosip/mimoto/MimotoServiceApplication.java - Controllers · Domain controllers that expose wallet, credential, presentation, issuer, verifier, IDP, and user endpoints.
src/main/java/io/mosip/mimoto/controller - Wallet core · Create, unlock, lock, delete, and validate wallet state and passcode flows.
src/main/java/io/mosip/mimoto/service/WalletService.java - Credential core · Request, store, verify, download, share, and render credentials.
src/main/java/io/mosip/mimoto/service/CredentialService.java - Presentation core · Build, submit, and manage verifiable presentations and OpenID4VP sessions.
src/main/java/io/mosip/mimoto/service/PresentationService.java - Issuer & verifier · Issuer configuration, trusted verifier registration, policy discovery, and verifier management.
src/main/java/io/mosip/mimoto/service/IssuersService.java - IDP auth · Identity-provider login, token handling, and user metadata flows.
src/main/java/io/mosip/mimoto/service/IdpService.java - Format factory · Selects format handlers for credential processing and signing workflows.
src/main/java/io/mosip/mimoto/service/CredentialFormatHandlerFactory.java - Format handlers · Representative handlers for LDP VC and SD-JWT credential formats.
src/main/java/io/mosip/mimoto/service/impl/LdpVcCredentialFormatHandler.java
Infrastructure
Persistence, security, crypto, and external integration boundaries.
- Crypto core · Encryption, decryption, JWT/JWS, keystore access, and algorithm-specific signing.
src/main/java/io/mosip/mimoto/util/CryptoUtil.java - OAuth2 security · Google/OIDC login integration and authentication handlers.
src/main/java/io/mosip/mimoto/security/oauth2/CustomOAuth2UserService.java - Persistence · Spring Data repositories for wallets, credentials, presentations, verifiers, user metadata, and proof keys.
src/main/java/io/mosip/mimoto/repository - Session & cache · Session state and caching configuration using in-memory and Redis-backed options.
src/main/java/io/mosip/mimoto/config/SessionCacheConfig.java - External APIs · Issuer, verifier, resident, IDP, and data-share calls coordinated through REST clients and DTOs.
src/main/java/io/mosip/mimoto/service/RestClientService.java - Domain model · Wallet, credential, presentation, trusted verifier, and key metadata models.
src/main/java/io/mosip/mimoto/model - Runtime config · Application properties, keystore, issuer config, trusted verifier config, and templates.
src/main/resources
Test harness
Main test suites and separate API rig.
- Main tests · Controller, service, security, util, and factory tests for the backend.
src/test/java/io/mosip/mimoto - API test rig · Standalone test client and scenario runner for end-to-end API validation.
api-test
Operations
Deployment, database, and packaging assets.
- Ops assets · Docker, compose, Helm, Kubernetes, schema, and upgrade scripts.
deploy
Connections 29
- Mimoto app → Controllers: starts · Bootstraps the HTTP API runtime and wiring.
- Controllers → Wallet core: wallet routes · Wallet endpoints delegate to wallet services.
- Controllers → Credential core: credential routes · Credential endpoints delegate to credential services.
- Controllers → Presentation core: presentation routes · Presentation endpoints delegate to VP workflows.
- Controllers → Issuer & verifier: issuer/verifier routes · Issuer, verifier, and trusted-verifier endpoints.
- Controllers → IDP auth: login routes · IDP and token endpoints.
- Wallet core → Crypto core: encrypts · Wallet lock/unlock and secure storage use cryptography.
- Wallet core → Persistence: stores wallet · Persists wallet state and metadata.
- Wallet core → Session & cache: session state · Uses session and cache state for wallet flow coordination.
- Credential core → Format factory: formats · Chooses credential format handlers.
- Credential core → Crypto core: signs/verifies · Credential processing uses signing and verification utilities.
- Credential core → Persistence: stores creds · Persists credential records and metadata.
- Credential core → External APIs: fetches issuer data · Requests and downloads credential data from remote services.
- Presentation core → Crypto core: signs VP · Presentation construction and submission use crypto and JWT tools.
- Presentation core → Persistence: stores VP · Persists verifiable presentation and trust state.
- Presentation core → External APIs: verifier calls · Interacts with verifier and presentation endpoints.
- Issuer & verifier → External APIs: discovers metadata · Reads issuer well-known endpoints and verifier config.
- Issuer & verifier → Persistence: stores trust · Persists trusted verifiers and onboarding state.
- IDP auth → OAuth2 security: uses · External login is handled by OAuth2 security components.
- IDP auth → External APIs: tokens/profile · Calls IDP and resident APIs for auth and user data.
- Crypto core → Runtime config: loads keys · Reads keystore and cryptographic configuration.
- Main tests → Controllers: covers · Primary test surface for API behavior.
- Main tests → Wallet core: covers · Service tests cover wallet workflows.
- Main tests → Credential core: covers · Service tests cover credential workflows.
- Main tests → Presentation core: covers · Service tests cover presentation workflows.
- Main tests → Crypto core: covers · Utility and signing tests validate crypto behavior.
- API test rig → Controllers: drives APIs · Separate harness exercises the backend end to end.
- Ops assets → Runtime config: deploys with · Operational assets package the runtime configuration and templates.
- Ops assets → Persistence: provisions db · Database schema and upgrade scripts define persistent state.