# pingidentity/pingone-wallet-mobile-sdk-android architecture

> Architecture diagram of the GitHub repository pingidentity/pingone-wallet-mobile-sdk-android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pingidentity/pingone-wallet-mobile-sdk-android
- Repository: https://github.com/pingidentity/pingone-wallet-mobile-sdk-android

## Overview

##### Main Components

a. Core Components:
- PingOne Wallet SDK (Central Component)
- Mobile Application Layer
- Storage Layer
- Communication Layer
- Authentication/Security Layer

b. External Services:
- PingOne Cloud Services
- Firebase Cloud Messaging (FCM)
- PingOne Mailbox Service
- PingOne Credentials Service

##### Architecture Breakdown

The system should be represented in layers, with the following structure:

**┌─ Mobile Application Layer ─────────────────────────────────────┐**
- ┌─ UI Components ─────┐  ┌─ Application Logic ──────────────┐ │
- Home Fragment     │  │ - MainApplication               │ │
- QR Scanner       │  │ - Dependency Injection          │ │
- Credential Views │  │ - View Models                   │ │
- ┘  └────────────────────────────────┘ │
- PingOne Wallet SDK Layer ───────────────────────────────────┤
- ┌─ Core SDK ──────────┐  ┌─ Wallet Helper ───────────────┐  │
- Client Builder    │  │ - Credential Management       │  │
- Wallet Client     │  │ - Pairing Management         │  │
- Event Handlers    │  │ - Presentation Management    │  │
- ┘  └────────────────────────────────┘  │
- Storage Layer ───────────────────────────────────────────────┤
- ┌─ Secure Storage ────┐  ┌─ Data Repository ─────────────┐   │
- Credential Store  │  │ - Credential Management       │   │
- Key Management    │  │ - Data Access Layer          │   │
- ┘  └────────────────────────────────┘   │
- Communication Layer ──────────────────────────────────────────┤
- ┌─ Network Services ──┐  ┌─ Push Notifications ──────────┐   │
- API Client       │  │ - FCM Integration            │   │
- Request Handling │  │ - Notification Service       │   │
- ┘  └────────────────────────────────┘   │
- ┘

**┌─ External Services ────────────────────────────────────────────┐**
- ┌─ PingOne Cloud ─────┐  ┌─ Firebase ──────────────────────┐ │
- Credentials API   │  │ - Cloud Messaging              │ │
- Mailbox Service   │  └────────────────────────────────┘ │
- ┘                                     │
- ┘

##### Data Flow Indicators

- Credential issuance flow
- Credential presentation flow
- Pairing flow
- Push notification flow

##### Important Elements to Highlight

a. Security Features:
- End-to-end encryption
- Secure storage
- Authentication mechanisms

b. Integration Points:
- FCM integration
- PingOne services integration
- App link handling

c. Key Processes:
- Wallet initialization
- Credential management
- Pairing process
- Presentation handling

##### Additional Notes

- Version information
- Security compliance requirements
- Error handling paths
- Optional components (like ApplicationUiHandler)

##### Implementation Details

- The DI structure (di folder)
- The UI components (ui folder)
- The wallet helper implementation
- The notification handling system

Remember to include notes about the asynchronous nature of many operations and how they're handled through RxJava observables, as evidenced in the code structure.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef application fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef storage fill:#A9A9A9,stroke:#333,stroke-width:2px
    classDef communication fill:#A9A9A9,stroke:#333,stroke-width:2px
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px
    classDef security fill:#FF6B6B,stroke:#333,stroke-width:2px

    %% Mobile Application Layer
    subgraph AppLayer["Mobile Application Layer"]
        MainApp["Main Application"]:::application
        DI["Dependency Injection"]:::application
        subgraph UI["UI Components"]
            Home["Home Fragment"]:::application
            QR["QR Scanner"]:::application
            CredView["Credential Views"]:::application
        end
    end

    %% PingOne Wallet SDK Layer
    subgraph SDKLayer["PingOne Wallet SDK Layer"]
        subgraph CoreSDK["Core SDK"]
            Client["Wallet Client"]:::core
            EventHandlers["Event Handlers"]:::core
        end
        subgraph WalletHelper["Wallet Helper"]
            CredMgmt["Credential Management"]:::core
            PairMgmt["Pairing Management"]:::core
            PresMgmt["Presentation Management"]:::core
        end
    end

    %% Storage Layer
    subgraph StorageLayer["Storage Layer"]
        SecStore["Secure Storage"]:::storage
        DataRepo["Data Repository"]:::storage
        KeyMgmt["Key Management"]:::security
    end

    %% Communication Layer
    subgraph CommLayer["Communication Layer"]
        API["API Client"]:::communication
        PushNotif["Push Notifications"]:::communication
        FCMInteg["FCM Integration"]:::communication
    end

    %% External Services
    subgraph ExtServices["External Services"]
        PingCloud["PingOne Cloud Services"]:::external
        FCM["Firebase Cloud Messaging"]:::external
        Mailbox["PingOne Mailbox Service"]:::external
        CredService["PingOne Credentials Service"]:::external
    end

    %% Relationships
    MainApp --> DI
    DI --> CoreSDK
    UI --> WalletHelper
    CoreSDK --> StorageLayer
    CoreSDK --> CommLayer
    CommLayer --> ExtServices
    WalletHelper --> CoreSDK
    PushNotif --> FCM
    API --> PingCloud

    %% Click events
    click MainApp "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/blob/master/SampleCode/app/src/main/java/com/pingidentity/sdk/pingonewallet/sample/MainApplication.java"
    click DI "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/tree/master/SampleCode/app/src/main/java/com/pingidentity/sdk/pingonewallet/sample/di/"
    click Home "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/tree/master/SampleCode/app/src/main/java/com/pingidentity/sdk/pingonewallet/sample/ui/home/"
    click QR "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/tree/master/SampleCode/app/src/main/java/com/pingidentity/sdk/pingonewallet/sample/ui/qr_scanner/"
    click Client "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/blob/master/docs/com/pingidentity/sdk/pingonewallet/client/PingOneWalletClient.html"
    click EventHandlers "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/tree/master/docs/com/pingidentity/sdk/pingonewallet/types/WalletEvents/"
    click DataRepo "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/blob/master/docs/com/pingidentity/sdk/pingonewallet/storage/data_repository/DataRepository.html"
    click SecStore "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/blob/master/docs/com/pingidentity/sdk/pingonewallet/contracts/StorageManagerContract.html"
    click PushNotif "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/blob/master/SampleCode/app/src/main/java/com/pingidentity/sdk/pingonewallet/sample/notifications/PingOneNotificationService.java"
    click CredMgmt "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/blob/master/SampleCode/app/src/main/java/com/pingidentity/sdk/pingonewallet/sample/models/Credential.java"
    click WalletHelper "https://github.com/pingidentity/pingone-wallet-mobile-sdk-android/blob/master/SampleCode/app/src/main/java/com/pingidentity/sdk/pingonewallet/sample/wallet/PingOneWalletHelper.java"

    %% Legend
    subgraph Legend
        AppComp["Application Component"]:::application
        CoreComp["Core Component"]:::core
        StorageComp["Storage Component"]:::storage
        CommComp["Communication Component"]:::communication
        ExtComp["External Service"]:::external
        SecComp["Security Component"]:::security
    end
```
