# solar-network/ledger-app-solar architecture

> Architecture diagram of the GitHub repository solar-network/ledger-app-solar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/solar-network/ledger-app-solar
- Repository: https://github.com/solar-network/ledger-app-solar

## Overview

##### Key Relationships

- Data flow from APDU → Command Handlers → Transaction Processing
- Bidirectional flow between UI and Command Handlers
- Crypto operations integration points
- Context management across components

##### Important Elements

- Error handling paths
- Response flow back to device interface
- Clear separation of concerns between layers

##### Technical Details to Highlight

- APDU protocol implementation
- Transaction type support
- Cryptographic operation flows
- UI state management

##### Security boundary view

Special Considerations:

##### Test coverage boundaries

- Component types
- Data flow directions
- Security boundaries
- Hardware interaction points
- Error handling paths

- Communication layer
- Command processing
- Transaction handling
- Cryptographic operations
- User interface

This will provide a comprehensive view of the application's architecture while maintaining clarity about its security-critical nature as a hardware wallet application.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External
        LED[Ledger Device Interface]
    end

    subgraph APDU[APDU Communication Layer]
        DISP[Dispatcher]
        OFF[Offsets Handler]
    end

    subgraph CMD[Command Handlers]
        ADDR[Get Address]
        PKEY[Get Public Key]
        NAME[Get App Name]
        VER[Get Version]
        SIGN[Sign Transaction]
    end

    subgraph TRANS[Transaction Processing]
        DES[Deserializer]
        subgraph TTypes[Transaction Types]
            BURN[Burn]
            IPFS[IPFS]
            TRANS_T[Transfer]
            VOTE[Vote]
        end
    end

    subgraph CRYPTO[Cryptographic Operations]
        CRYP[Crypto Module]:::security
    end

    subgraph UI[User Interface]
        DISP_M[Display Manager]
        MENU[Menu System]
        VAL[Action Validator]
        subgraph TX_UI[Transaction Displays]
            BURN_UI[Burn Display]
            IPFS_UI[IPFS Display]
            TRANS_UI[Transfer Display]
            VOTE_UI[Vote Display]
        end
    end

    subgraph CORE[Core Application]
        APP[App Main]
        CTX[Context Manager]
        GLOB[Globals]
    end

    %% Relationships
    LED <--> DISP
    DISP <--> OFF
    DISP --> CMD
    CMD <--> CRYPTO
    CMD <--> TRANS
    TRANS <--> CRYPTO
    CMD <--> UI
    TRANS <--> UI
    APP --> CMD
    APP --> UI
    CTX --> CMD
    CTX --> TRANS
    GLOB --> CMD
    GLOB --> TRANS

    %% Click Events
    click DISP "https://github.com/solar-network/ledger-app-solar/blob/main/src/apdu/dispatcher.c"
    click OFF "https://github.com/solar-network/ledger-app-solar/blob/main/src/apdu/offsets.h"
    click ADDR "https://github.com/solar-network/ledger-app-solar/blob/main/src/handler/get_address.c"
    click PKEY "https://github.com/solar-network/ledger-app-solar/blob/main/src/handler/get_public_key.c"
    click NAME "https://github.com/solar-network/ledger-app-solar/blob/main/src/handler/get_app_name.c"
    click VER "https://github.com/solar-network/ledger-app-solar/blob/main/src/handler/get_version.c"
    click SIGN "https://github.com/solar-network/ledger-app-solar/blob/main/src/handler/sign_tx.c"
    click DES "https://github.com/solar-network/ledger-app-solar/blob/main/src/transaction/deserialise.c"
    click BURN "https://github.com/solar-network/ledger-app-solar/blob/main/src/transaction/types/burn.c"
    click IPFS "https://github.com/solar-network/ledger-app-solar/blob/main/src/transaction/types/ipfs.c"
    click TRANS_T "https://github.com/solar-network/ledger-app-solar/blob/main/src/transaction/types/transfer.c"
    click VOTE "https://github.com/solar-network/ledger-app-solar/blob/main/src/transaction/types/vote.c"
    click CRYP "https://github.com/solar-network/ledger-app-solar/blob/main/src/crypto/crypto.c"
    click DISP_M "https://github.com/solar-network/ledger-app-solar/blob/main/src/ui/display.c"
    click MENU "https://github.com/solar-network/ledger-app-solar/blob/main/src/ui/menu.c"
    click VAL "https://github.com/solar-network/ledger-app-solar/blob/main/src/ui/action/validate.c"
    click BURN_UI "https://github.com/solar-network/ledger-app-solar/blob/main/src/ui/transactions/burn_display.c"
    click IPFS_UI "https://github.com/solar-network/ledger-app-solar/blob/main/src/ui/transactions/ipfs_display.c"
    click TRANS_UI "https://github.com/solar-network/ledger-app-solar/blob/main/src/ui/transactions/transfer_display.c"
    click VOTE_UI "https://github.com/solar-network/ledger-app-solar/blob/main/src/ui/transactions/vote_display.c"
    click APP "https://github.com/solar-network/ledger-app-solar/blob/main/src/app_main.c"
    click CTX "https://github.com/solar-network/ledger-app-solar/blob/main/src/context.c"
    click GLOB "https://github.com/solar-network/ledger-app-solar/blob/main/src/globals.h"

    %% Styling
    classDef external fill:#87CEEB
    classDef apdu fill:#4169E1
    classDef cmd fill:#90EE90
    classDef trans fill:#FFD700
    classDef crypto fill:#FF6B6B
    classDef ui fill:#DDA0DD
    classDef core fill:#A9A9A9
    classDef security stroke:#FF0000,stroke-width:4px

    class LED external
    class DISP,OFF apdu
    class ADDR,PKEY,NAME,VER,SIGN cmd
    class DES,BURN,IPFS,TRANS_T,VOTE trans
    class CRYP crypto
    class DISP_M,MENU,VAL,BURN_UI,IPFS_UI,TRANS_UI,VOTE_UI ui
    class APP,CTX,GLOB core
```
