# money-ape/cipherlan architecture

> Architecture diagram of the GitHub repository money-ape/cipherlan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/money-ape/cipherlan
- Repository: https://github.com/money-ape/cipherlan

## Overview

CipherLAN is a GUI and CLI for room-based encrypted file transfer over a LAN. Its principal workflow is: create or authenticate a local room, select and encrypt a file, fragment and send it to a peer, store received ciphertext, then explicitly authenticate and open or download the restored file. The graph preserves the separate room-authentication, cryptography, transfer-storage, discovery, and firewall-policy responsibilities. Some receive, resume, and decrypt implementation details are unsampled; edges for documented behavior cite the README where appropriate.

Main entry points: [`cli.py`](https://github.com/money-ape/cipherlan/blob/master/cli.py) (GUI and CLI), [`net.py`](https://github.com/money-ape/cipherlan/blob/master/net.py) (Receive server), [`auth.py`](https://github.com/money-ape/cipherlan/blob/master/auth.py) (Room credentials), [`enc.py`](https://github.com/money-ape/cipherlan/blob/master/enc.py) (Cryptographic operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["User application"]
  node_ui["GUI and CLI<br/>[cli.py]"]
  node_session["Room session<br/>[cli.py]"]
  node_history[("Transfer history<br/>[cli.py]")]
end

subgraph group_security["Room security"]
  node_room_auth[("Room credentials<br/>[auth.py]")]
  node_crypto["Cryptographic operations<br/>[enc.py]"]
end

subgraph group_transfer["Transfer lifecycle"]
  node_sender["Send transfer<br/>[net.py]"]
  node_manifest["Manifest and fragmentation<br/>[transfer.py]"]
  node_blob_store[("Encrypted transfer storage<br/>[transfer.py]")]
  node_restoration["Decrypt and restore<br/>[cli.py]"]
end

subgraph group_network["LAN networking"]
  node_receiver["Receive server<br/>[net.py]"]
  node_peer_discovery["Peer discovery<br/>[net.py]"]
end

subgraph group_policy["Network policy"]
  node_firewall[("Firewall rules<br/>[fwall.py]")]
end

node_user(("User"))
node_peer(("LAN peer"))

node_user -->|"uses"| node_ui
node_ui -->|"opens room"| node_session
node_ui -->|"creates room"| node_room_auth
node_session -->|"verifies credentials"| node_room_auth
node_room_auth -->|"derives verifier"| node_crypto
node_ui -->|"scans peers"| node_peer_discovery
node_ui -->|"starts receiver"| node_receiver
node_session -->|"checks destination"| node_firewall
node_session -->|"requests transfer"| node_sender
node_sender -->|"derives room key"| node_room_auth
node_sender -->|"encrypts file"| node_crypto
node_sender -->|"builds and splits"| node_manifest
node_sender -->|"sends blobs"| node_peer
node_peer -->|"sends blobs"| node_receiver
node_receiver -->|"loads verifier"| node_room_auth
node_receiver -->|"derives session key"| node_crypto
node_receiver -->|"assembles and verifies"| node_manifest
node_receiver -->|"writes blobs"| node_blob_store
node_receiver -->|"reports receipt"| node_ui
node_ui -->|"requests open or download"| node_restoration
node_restoration -->|"checks room access"| node_room_auth
node_restoration -->|"reads encrypted blobs"| node_blob_store
node_restoration -->|"decrypts payload"| node_crypto
node_restoration -->|"records action"| node_history
node_ui -->|"records receipt"| node_history

click node_ui "https://github.com/money-ape/cipherlan/blob/master/cli.py"
click node_session "https://github.com/money-ape/cipherlan/blob/master/cli.py"
click node_history "https://github.com/money-ape/cipherlan/blob/master/cli.py"
click node_room_auth "https://github.com/money-ape/cipherlan/blob/master/auth.py"
click node_crypto "https://github.com/money-ape/cipherlan/blob/master/enc.py"
click node_sender "https://github.com/money-ape/cipherlan/blob/master/net.py"
click node_manifest "https://github.com/money-ape/cipherlan/blob/master/transfer.py"
click node_receiver "https://github.com/money-ape/cipherlan/blob/master/net.py"
click node_blob_store "https://github.com/money-ape/cipherlan/blob/master/transfer.py"
click node_peer_discovery "https://github.com/money-ape/cipherlan/blob/master/net.py"
click node_firewall "https://github.com/money-ape/cipherlan/blob/master/fwall.py"
click node_restoration "https://github.com/money-ape/cipherlan/blob/master/cli.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_session,node_history,node_user toneBlue
class node_room_auth,node_crypto toneAmber
class node_sender,node_manifest,node_blob_store,node_restoration toneMint
class node_receiver,node_peer_discovery toneRose
class node_firewall,node_peer toneIndigo
```

## Components

### User application

- [GUI and CLI](https://github.com/money-ape/cipherlan/blob/master/cli.py): `cli.py`
- [Room session](https://github.com/money-ape/cipherlan/blob/master/cli.py): `cli.py`
- [Transfer history](https://github.com/money-ape/cipherlan/blob/master/cli.py): `cli.py`

### Room security

- [Room credentials](https://github.com/money-ape/cipherlan/blob/master/auth.py): `auth.py`
- [Cryptographic operations](https://github.com/money-ape/cipherlan/blob/master/enc.py): `enc.py`

### Transfer lifecycle

- [Send transfer](https://github.com/money-ape/cipherlan/blob/master/net.py): `net.py`
- [Manifest and fragmentation](https://github.com/money-ape/cipherlan/blob/master/transfer.py): `transfer.py`
- [Encrypted transfer storage](https://github.com/money-ape/cipherlan/blob/master/transfer.py): `transfer.py`
- [Decrypt and restore](https://github.com/money-ape/cipherlan/blob/master/cli.py): `cli.py`

### LAN networking

- [Receive server](https://github.com/money-ape/cipherlan/blob/master/net.py): `net.py`
- [Peer discovery](https://github.com/money-ape/cipherlan/blob/master/net.py): `net.py`

### Network policy

- [Firewall rules](https://github.com/money-ape/cipherlan/blob/master/fwall.py): `fwall.py`

### Other components

- **User**
- **LAN peer**

## Connections

- User → GUI and CLI: uses (evidence: `README.md`)
- GUI and CLI → Room session: opens room (evidence: `cli.py`)
- GUI and CLI → Room credentials: creates room (evidence: `cli.py`)
- Room session → Room credentials: verifies credentials (evidence: `cli.py`)
- Room credentials → Cryptographic operations: derives verifier (evidence: `auth.py`)
- GUI and CLI → Peer discovery: scans peers (evidence: `cli.py`)
- GUI and CLI → Receive server: starts receiver (evidence: `cli.py`)
- Room session → Firewall rules: checks destination (evidence: `cli.py`)
- Room session → Send transfer: requests transfer (evidence: `cli.py`)
- Send transfer → Room credentials: derives room key (evidence: `net.py`)
- Send transfer → Cryptographic operations: encrypts file (evidence: `net.py`)
- Send transfer → Manifest and fragmentation: builds and splits (evidence: `net.py`)
- Send transfer → LAN peer: sends blobs (evidence: `README.md`)
- LAN peer → Receive server: sends blobs (evidence: `README.md`)
- Receive server → Room credentials: loads verifier (evidence: `net.py`)
- Receive server → Cryptographic operations: derives session key (evidence: `net.py`)
- Receive server → Manifest and fragmentation: assembles and verifies (evidence: `net.py`)
- Receive server → Encrypted transfer storage: writes blobs (evidence: `net.py`)
- Receive server → GUI and CLI: reports receipt (evidence: `cli.py`)
- GUI and CLI → Decrypt and restore: requests open or download (evidence: `README.md`)
- Decrypt and restore → Room credentials: checks room access (evidence: `README.md`)
- Decrypt and restore → Encrypted transfer storage: reads encrypted blobs (evidence: `README.md`)
- Decrypt and restore → Cryptographic operations: decrypts payload (evidence: `README.md`)
- Decrypt and restore → Transfer history: records action (evidence: `cli.py`)
- GUI and CLI → Transfer history: records receipt (evidence: `cli.py`)
