# crownss/nebula-seal architecture

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

- Interactive diagram: https://gitdiagram.com/crownss/nebula-seal
- Repository: https://github.com/crownss/nebula-seal

## Overview

nebula-seal is a small Rust CLI for password-based file encryption and decryption, including encrypted filenames. The main workflow parses options, reads and trims a password file, then processes inputs one by one using either encryption or decryption before writing (and syncing) each result. The single source file also implements versioned key derivation, authenticated encryption, and the encrypted-file parser. The README documents multi-file operation and legacy PBKDF2 support; the source excerpt confirms these behaviors, but all runtime components share one implementation path.

Main entry points: [`src/main.rs`](https://github.com/crownss/nebula-seal/blob/main/src/main.rs) (File operation loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_args["Argument parsing<br/>[main.rs]"]
  node_password["Password loading<br/>[main.rs]"]
  node_dispatch["File operation loop<br/>[main.rs]"]
end

subgraph group_crypto["Cryptography"]
  node_encrypt["Encryption workflow<br/>[main.rs]"]
  node_decrypt["Decryption workflow<br/>[main.rs]"]
  node_kdf["Versioned key derivation<br/>[main.rs]"]
  node_cipher["AES-GCM encryption<br/>[main.rs]"]
  node_format["Encrypted-file parser<br/>[main.rs]"]
end

node_user(("CLI user"))
node_input["Input files"]
node_output["Output files"]

node_user -->|"supplies options"| node_args
node_args -->|"selects password file"| node_password
node_args -->|"provides file options"| node_dispatch
node_password -->|"provides password"| node_dispatch
node_dispatch -->|"reads files"| node_input
node_dispatch -->|"calls for encryption"| node_encrypt
node_dispatch -->|"calls for decryption"| node_decrypt
node_encrypt -->|"derives keys"| node_kdf
node_encrypt -->|"encrypts name and data"| node_cipher
node_decrypt -->|"parses encrypted bytes"| node_format
node_format -->|"requests keys"| node_kdf
node_decrypt -->|"authenticates and decrypts"| node_cipher
node_dispatch -->|"writes results"| node_output

click node_args "https://github.com/crownss/nebula-seal/blob/main/src/main.rs"
click node_password "https://github.com/crownss/nebula-seal/blob/main/src/main.rs"
click node_dispatch "https://github.com/crownss/nebula-seal/blob/main/src/main.rs"
click node_encrypt "https://github.com/crownss/nebula-seal/blob/main/src/main.rs"
click node_decrypt "https://github.com/crownss/nebula-seal/blob/main/src/main.rs"
click node_kdf "https://github.com/crownss/nebula-seal/blob/main/src/main.rs"
click node_cipher "https://github.com/crownss/nebula-seal/blob/main/src/main.rs"
click node_format "https://github.com/crownss/nebula-seal/blob/main/src/main.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_args,node_password,node_dispatch,node_user toneBlue
class node_encrypt,node_decrypt,node_kdf,node_cipher,node_format toneAmber
class node_input,node_output toneIndigo
```

## Components

### CLI workflow

- [Argument parsing](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`
- [Password loading](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`
- [File operation loop](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`

### Cryptography

- [Encryption workflow](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`
- [Decryption workflow](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`
- [Versioned key derivation](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`
- [AES-GCM encryption](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`
- [Encrypted-file parser](https://github.com/crownss/nebula-seal/blob/main/src/main.rs): `src/main.rs`

### Other components

- **CLI user**
- **Input files**
- **Output files**

## Connections

- CLI user → Argument parsing: supplies options (evidence: `README.md`)
- Argument parsing → Password loading: selects password file (evidence: `src/main.rs`)
- Argument parsing → File operation loop: provides file options (evidence: `src/main.rs`)
- Password loading → File operation loop: provides password (evidence: `src/main.rs`)
- File operation loop → Input files: reads files (evidence: `src/main.rs`)
- File operation loop → Encryption workflow: calls for encryption (evidence: `src/main.rs`)
- File operation loop → Decryption workflow: calls for decryption (evidence: `src/main.rs`)
- Encryption workflow → Versioned key derivation: derives keys (evidence: `src/main.rs`)
- Encryption workflow → AES-GCM encryption: encrypts name and data (evidence: `src/main.rs`)
- Decryption workflow → Encrypted-file parser: parses encrypted bytes (evidence: `src/main.rs`)
- Encrypted-file parser → Versioned key derivation: requests keys (evidence: `src/main.rs`)
- Decryption workflow → AES-GCM encryption: authenticates and decrypts (evidence: `src/main.rs`)
- File operation loop → Output files: writes results (evidence: `src/main.rs`)
