How openwallet-foundation/multipaz works
Project Type and Purpose
• This is a single Git repository hosting a multi-module Kotlin Multiplatform (“KMP”) library suite plus supporting command-line tools, server-side microservices, and sample wallet apps.
• Core functionality: ISO mdoc, SD-JWT VCs, presentment (BLE, NFC, web), zero-knowledge proofs, cryptography, storage, RPC transport, plus UI components for Compose and Vision (barcode/face).
High-Level File Structure & Patterns
• Top‐level: Gradle settings, scripts, CI workflows.
• Library modules (all Gradle subprojects):
• multipaz (core commonMain domain logic + platformMain adapters)
• multipaz-models (stateful domain models)
• multipaz-compose (Compose UI components)
• multipaz-vision (camera/barcode/face utilities)
• multipaz-doctypes, multipaz-longfellow, multipaz-cbor-rpc (graph hashing + codegen)
• multipaz-android-legacy (old Java Android API)
• SwiftBridge & xcframework for iOS packaging
• CLI: multipazctl (thin wrapper over core libs)
• Server microservices (each a Ktor HTTP service):
• multipaz-backend-server (OpenID4VCI backend)
• multipaz-csa-server & multipaz-csa (cloud secure area)
• multipaz-openid4vci-server (issuer API)
• multipaz-records-server (record storage API)
• multipaz-verifier-server (VC verifier API)
• Sample cross‐platform app: samples/testapp (Android + iOS Compose Multiplatform)
Key Architectural Components
• Common Library Layer (KMP commonMain)
• Domain: mdoc, credential, cbor, cose, crypto, storage, rpc, provisioning, mdoc transport, ZK proofs, document types.
• Platform Adapter Layer (androidMain, iosMain, jvmMain, javaSharedMain)
• Concrete implementations: BLE/NFC transports, Android Keystore, iOS Secure Enclave, JDBC storage, HTTP transport via Ktor.
• Application & Tooling Layer
• CLI (multipazctl)
• Sample app (samples/testapp)
• SwiftBridge / xcframework for Swift usage
• Service Layer (microservices)
• Each service is an independent Ktor server module exposing REST/HTTP endpoints and static web assets; they depend on core provisioning / openid4vci / records / verification logic.
Relationships & Data Flows
• All apps, CLI, and servers depend on one or more core library modules.
• multipaz-models, compose, vision depend on multipaz core.
• microservices depend on multipaz core + provisioning/openid4vci sub-modules.
• SwiftBridge / xcframework wrap multipaz core for Swift clients.
• Sample apps & third-party apps use multipaz core to:
– Discover and engage BLE/NFC mdoc readers via transport adapters.
– Call provisioning/issuance APIs over HTTP to issuer microservices (openid4vci-server, backend-server).
– Present digital credentials via W3C DC API or URI schemes.
• CLI (multipazctl) executes local credential operations and can call remote services via HTTP.
• Verifier-server exposes VC verification endpoints; records-server stores and retrieves identity records; csa-server enforces cloud secure area policies.
Architectural Patterns & Principles
• Kotlin Multiplatform: share common business logic, isolate platform specifics.
• Hexagonal / Clean Separation: domain logic in commonMain, ports/adapters in platformMain, applications and services at the outer ring.
• Microservices: each backend function (issuance, storage, verification, CSA) is its own module with its own REST API and configuration.
• Code generation: multipaz-cbor-rpc uses Kotlin Symbol Processing for RPC stubs.
• Single monorepo with fine-grained modules, consistent Gradle KTS builds.
Essential Elements
• Module names exactly as in Gradle (multipaz, multipaz-models, etc.).