# hirokazu-kobayashi-koba-hiro/vc-wallet-android-app architecture

> Architecture diagram of the GitHub repository hirokazu-kobayashi-koba-hiro/vc-wallet-android-app, 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/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app
- Repository: https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app

## Overview

- Wallet App (Frontend): Represent all major Android components inside “app” (Activities such as LauncherActivity, custom & library activities, ViewModels) which directly interact with the user.
- Verifiable Credentials Library (Business Logic Layer): This module encapsulates protocols (OID4VC, OID4VP), domain logic (packages like domain, repository, UI, util), and configuration management. It covers functions from key and account management to issuance and presentation.
- Domain/Business Logic Components: Break down the library into its functional areas:
– Domain: Contains protocol logic, error handling (e.g., classes for OIDC flows, credential issuance results, token handling, error classes).
– Repository: Handles data persistence like AppDatabase, data sources for credentials and user management.
– UI & Activity Components: Library-provided UI screens that help in credential issuance, presentation, and account management.
– Utility Layers: Helper classes for HTTP clients, JSON processing, hash functions, secure storage, and crypto utilities.
- External Services: Mark integrations with external identity providers (OIDC endpoints, Authlete service, eudi issuer) and blockchain services for key/pair generation and operations.
- Continuous Integration/Deployment: Note the existence of a GitHub workflows folder (.github/workflows) and build configuration files. These are supporting components for build and release management.

- Data Flow Direction:
– Start at the User interacting with the Wallet App UI.
– Flow from activities (e.g., LauncherActivity and custom credentials activities) through ViewModels to the verifiable credentials client (initialized via VerifiableCredentialsClient.initialize() in the library).
– Data flows from the library’s business logic (protocol handling, key generation, issuance flows) to external services (OIDC provider, blockchain services) via HTTP/secure communication.
– Repository components persist and retrieve user data, credential records, and wallet configurations.
– From the Wallet App to the Verifiable Credentials Library (highlighting the integration via build.gradle dependencies).
– From the Verifiable Credentials Library’s UI and domain layers to its own underlying utility and repository layers.
– From external services (OIDC endpoints, Authlete trial, eudi issuer) into the library’s network and protocol management parts.

##### Architectural Patterns and Technologies
- MVVM Pattern: Indicate the separation of UI (Activities, Fragments) from ViewModels and the domain logic within the library.
- Modular Architecture: Clearly separate the wallet app from the verifiable credentials library, showing how the app “depends” on the library.
- Protocol Handling: Detail the key OIDC flows (Authorization Code Flow, Pre-authorization flow, Deferred issuing), and the multi-method issuing support for different credential formats (sd-jwt-vc, jwt_vc_json, etc.).
- Technology Notes:
– Android SDK/API usage (minimum Android 8, API level 26).
– Use of Gradle build scripts for module configuration.
– Integration with external services (OIDC providers and blockchain via web3).
– Custom activities in the library for various credential issuance and presentation workflows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    User["User"]:::ui

    %% Wallet App Frontend
    subgraph "Wallet App Frontend"
        WALLET["Android UI (LauncherActivity, ViewModels, LocalAuthenticator)"]:::ui
    end

    %% Verifiable Credentials Library (Business Logic Layer)
    subgraph "Verifiable Credentials Library (Business Logic Layer)"
        VCC["VerifiableCredentialsClient"]:::business

        subgraph "Domain & Protocol Components"
            DOMAIN["Domain Logic & Protocol (OIDC, VC Issuance)"]:::business
            BLOCKCHAIN["Blockchain & Key Management"]:::business
        end

        subgraph "Repository Components"
            REPO["Data Persistence (AppDatabase, Data Sources)"]:::repository
        end

        subgraph "Library UI Components"
            ACTIVITIES["Library Activities"]:::ui
            UI_SCREENS["Library UI Screens"]:::ui
        end

        subgraph "Utility Layers"
            UTIL["Utility Functions (HTTP, JSON, Crypto)"]:::util
        end
    end

    %% External Services Integration Points
    subgraph "External Services"
        OIDC["OIDC Provider"]:::external
        AUTHLETE["Authlete Service"]:::external
        EUDI["Eudi Issuer"]:::external
        BLOCKCHAIN_EXT["Blockchain Network"]:::external
    end

    %% Continuous Integration/Deployment
    subgraph "Continuous Integration/Deployment"
        GITHUB["GitHub Workflows"]:::cicd
        GRADLE["Gradle Build Configurations"]:::cicd
    end

    %% Data flow connections
    User -->|"interacts"| WALLET
    WALLET -->|"initializes"| VCC
    VCC -->|"uses"| DOMAIN
    DOMAIN -->|"invokes"| BLOCKCHAIN
    DOMAIN -->|"calls"| OIDC
    DOMAIN -->|"calls"| AUTHLETE
    DOMAIN -->|"calls"| EUDI
    DOMAIN -->|"calls"| BLOCKCHAIN_EXT
    VCC -->|"accesses"| REPO
    VCC -->|"triggers"| ACTIVITIES
    ACTIVITIES -->|"displays"| UI_SCREENS
    VCC -->|"utilizes"| UTIL

    %% CI/CD connections
    WALLET -->|"built via"| GRADLE
    VCC -->|"built via"| GITHUB

    %% Click Events
    click WALLET "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/app/src/main/java/org/idp/wallet/app"
    click VCC "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library"
    click DOMAIN "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library/domain"
    click BLOCKCHAIN "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library/domain/cert/blockchain"
    click REPO "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library/repository"
    click ACTIVITIES "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library/activity"
    click UI_SCREENS "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library/ui"
    click UTIL "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library/util"
    click OIDC "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/verifiable-credentials-library/src/main/java/org/idp/wallet/verifiable_credentials_library/domain/openid_connect"
    click GITHUB "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/tree/main/.github/workflows"
    click GRADLE "https://github.com/hirokazu-kobayashi-koba-hiro/vc-wallet-android-app/blob/main/build.gradle.kts"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef business fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef repository fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef util fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef external fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef cicd fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
