# raushan728/cfx architecture

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

- Interactive diagram: https://gitdiagram.com/raushan728/cfx
- Repository: https://github.com/raushan728/cfx

## Overview

CFX is a command-line utility for encrypting and decrypting individual files, with additional commands to inspect, verify, and clean up interrupted operations. The main workflow dispatches a command to its operation handler: encryption streams file data into a temporary CFX file, while decryption authenticates and streams data into a temporary output before finalizing it. The handlers use shared cryptography and format modules. The graph reflects the sampled Rust source and README; filesystem interactions are represented at a high level, and no external service is documented.

Main entry points: [`src/main.rs`](https://github.com/raushan728/cfx/blob/main/src/main.rs) (Command Router), [`src/format.rs`](https://github.com/raushan728/cfx/blob/main/src/format.rs) (CFX Format), [`src/ops/encrypt.rs`](https://github.com/raushan728/cfx/blob/main/src/ops/encrypt.rs) (Encrypt), [`src/ops/decrypt.rs`](https://github.com/raushan728/cfx/blob/main/src/ops/decrypt.rs) (Decrypt)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["CLI Commands"]
  node_cli["Command Router<br/>[main.rs]"]
end

subgraph group_operations["File Operations"]
  node_encrypt["Encrypt<br/>[encrypt.rs]"]
  node_decrypt["Decrypt<br/>[decrypt.rs]"]
  node_info["File Info<br/>[info.rs]"]
  node_verify["Verify Integrity<br/>[verify.rs]"]
  node_recover["Recover Temps<br/>[recover.rs]"]
end

subgraph group_internals["Shared Internals"]
  node_crypto["Crypto Services<br/>[crypto.rs]"]
  node_format["CFX Format<br/>[format.rs]"]
end

node_user(("CLI User"))
node_filesystem[("Local Files")]

node_user -->|"runs command"| node_cli
node_cli -->|"dispatches"| node_encrypt
node_cli -->|"dispatches"| node_decrypt
node_cli -->|"dispatches"| node_info
node_cli -->|"dispatches"| node_verify
node_cli -->|"dispatches"| node_recover
node_encrypt -->|"uses encryption"| node_crypto
node_encrypt -->|"writes header"| node_format
node_decrypt -->|"uses decryption"| node_crypto
node_decrypt -->|"reads header"| node_format
node_verify -->|"authenticates chunks"| node_crypto
node_verify -->|"reads header"| node_format
node_info -->|"reads header"| node_format
node_recover -->|"checks temp header"| node_format
node_encrypt -->|"reads and writes"| node_filesystem
node_decrypt -->|"reads and writes"| node_filesystem
node_info -->|"reads file"| node_filesystem
node_verify -->|"reads file"| node_filesystem
node_recover -->|"scans and deletes"| node_filesystem

click node_cli "https://github.com/raushan728/cfx/blob/main/src/main.rs"
click node_encrypt "https://github.com/raushan728/cfx/blob/main/src/ops/encrypt.rs"
click node_decrypt "https://github.com/raushan728/cfx/blob/main/src/ops/decrypt.rs"
click node_info "https://github.com/raushan728/cfx/blob/main/src/ops/info.rs"
click node_verify "https://github.com/raushan728/cfx/blob/main/src/ops/verify.rs"
click node_recover "https://github.com/raushan728/cfx/blob/main/src/ops/recover.rs"
click node_crypto "https://github.com/raushan728/cfx/blob/main/src/crypto.rs"
click node_format "https://github.com/raushan728/cfx/blob/main/src/format.rs"

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_cli,node_user toneBlue
class node_encrypt,node_decrypt,node_info,node_verify,node_recover,node_filesystem toneAmber
class node_crypto,node_format toneMint
```

## Components

### CLI Commands

- [Command Router](https://github.com/raushan728/cfx/blob/main/src/main.rs): `src/main.rs`

### File Operations

- [Encrypt](https://github.com/raushan728/cfx/blob/main/src/ops/encrypt.rs): `src/ops/encrypt.rs`
- [Decrypt](https://github.com/raushan728/cfx/blob/main/src/ops/decrypt.rs): `src/ops/decrypt.rs`
- [File Info](https://github.com/raushan728/cfx/blob/main/src/ops/info.rs): `src/ops/info.rs`
- [Verify Integrity](https://github.com/raushan728/cfx/blob/main/src/ops/verify.rs): `src/ops/verify.rs`
- [Recover Temps](https://github.com/raushan728/cfx/blob/main/src/ops/recover.rs): `src/ops/recover.rs`

### Shared Internals

- [Crypto Services](https://github.com/raushan728/cfx/blob/main/src/crypto.rs): `src/crypto.rs`
- [CFX Format](https://github.com/raushan728/cfx/blob/main/src/format.rs): `src/format.rs`

### Other components

- **CLI User**
- **Local Files**

## Connections

- CLI User → Command Router: runs command (evidence: `src/main.rs`)
- Command Router → Encrypt: dispatches (evidence: `src/main.rs`)
- Command Router → Decrypt: dispatches (evidence: `src/main.rs`)
- Command Router → File Info: dispatches (evidence: `src/main.rs`)
- Command Router → Verify Integrity: dispatches (evidence: `src/main.rs`)
- Command Router → Recover Temps: dispatches (evidence: `src/main.rs`)
- Encrypt → Crypto Services: uses encryption (evidence: `src/ops/encrypt.rs`)
- Encrypt → CFX Format: writes header (evidence: `src/ops/encrypt.rs`)
- Decrypt → Crypto Services: uses decryption (evidence: `src/ops/decrypt.rs`)
- Decrypt → CFX Format: reads header (evidence: `src/ops/decrypt.rs`)
- Verify Integrity → Crypto Services: authenticates chunks (evidence: `src/ops/verify.rs`)
- Verify Integrity → CFX Format: reads header (evidence: `src/ops/verify.rs`)
- File Info → CFX Format: reads header (evidence: `src/ops/info.rs`)
- Recover Temps → CFX Format: checks temp header (evidence: `src/ops/recover.rs`)
- Encrypt → Local Files: reads and writes (evidence: `src/ops/encrypt.rs`)
- Decrypt → Local Files: reads and writes (evidence: `src/ops/decrypt.rs`)
- File Info → Local Files: reads file (evidence: `src/ops/info.rs`)
- Verify Integrity → Local Files: reads file (evidence: `src/ops/verify.rs`)
- Recover Temps → Local Files: scans and deletes (evidence: `src/ops/recover.rs`)
