# discbrake023/cipherly-encryption architecture

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

- Interactive diagram: https://gitdiagram.com/discbrake023/cipherly-encryption
- Repository: https://github.com/discbrake023/cipherly-encryption

## Overview

Cipherly is a Flask web application for password-based text and file encryption, with a browser UI for encryption, analysis, a scripted security demo, and RSA hybrid encryption. The main workflow is user input → feature panel/API request → Flask route → cryptographic core → encoded text or downloadable file. The README documents KDF, AEAD, envelope, and integrity-check capabilities. Some route implementations and frontend modules were not sampled, so links for those features follow the documented product and repository structure; no persistent store is evident.

Main entry points: [`crypto_core.py`](https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py) (Crypto core), [`static/js/app.js`](https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/app.js) (Application UI), [`app/__init__.py`](https://github.com/discbrake023/cipherly-encryption/blob/main/app/__init__.py) (App factory), [`app/routes/text.py`](https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/text.py) (Text routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser UI"]
  node_ui["Application UI<br/>[app.js]"]
  node_textui["Text panel<br/>[text_panel.js]"]
  node_fileui["File panel<br/>[file_panel.js]"]
  node_demoui["Demo panel<br/>[demo_panel.js]"]
  node_analysisui["Analysis panel<br/>[analysis_panel.js]"]
  node_hybridui["Hybrid panel<br/>[hybrid_panel.js]"]
end

subgraph group_web["Flask API"]
  node_entry["Serverless entry<br/>[index.py]"]
  node_factory["App factory<br/>[__init__.py]"]
  node_text["Text routes<br/>[text.py]"]
  node_file["File routes<br/>[file.py]"]
  node_demo["Demo routes<br/>[demo.py]"]
  node_analysis["Analysis routes<br/>[analysis.py]"]
  node_hybrid["Hybrid routes<br/>[hybrid.py]"]
end

subgraph group_crypto["Cryptography"]
  node_core["Crypto core<br/>[crypto_core.py]"]
  node_kdf{{"Password KDF<br/>[crypto_core.py]"}}
  node_aead{{"AEAD ciphers<br/>[crypto_core.py]"}}
  node_envelope["KRP envelope<br/>[crypto_core.py]"]
  node_hybridcrypto{{"RSA wrapping<br/>[crypto_core.py]"}}
end

subgraph group_features["Product Features"]
  node_metrics["Crypto metrics<br/>[metrics.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_ui
node_ui -->|"initializes"| node_textui
node_ui -->|"initializes"| node_fileui
node_ui -->|"initializes"| node_demoui
node_ui -->|"initializes"| node_analysisui
node_ui -->|"initializes"| node_hybridui
node_entry -->|"creates app"| node_factory
node_factory -->|"registers routes"| node_text
node_factory -->|"registers routes"| node_file
node_factory -->|"registers routes"| node_demo
node_factory -->|"registers routes"| node_analysis
node_factory -->|"registers routes"| node_hybrid
node_textui -->|"requests API"| node_text
node_fileui -->|"uploads/downloads"| node_file
node_demoui -->|"runs scenario"| node_demo
node_analysisui -->|"requests metrics"| node_analysis
node_hybridui -->|"requests API"| node_hybrid
node_text -->|"encrypts/decrypts"| node_core
node_file -->|"encrypts/decrypts"| node_core
node_demo -->|"runs crypto scenario"| node_core
node_analysis -->|"computes metrics"| node_metrics
node_metrics -->|"uses primitives"| node_core
node_hybrid -->|"hybrid operations"| node_core
node_core -->|"derives keys"| node_kdf
node_core -->|"encrypts/authenticates"| node_aead
node_core -->|"encodes parameters"| node_envelope
node_core -->|"wraps session key"| node_hybridcrypto

click node_ui "https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/app.js"
click node_textui "https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/text_panel.js"
click node_fileui "https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/file_panel.js"
click node_demoui "https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/demo_panel.js"
click node_analysisui "https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/analysis_panel.js"
click node_hybridui "https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/hybrid_panel.js"
click node_entry "https://github.com/discbrake023/cipherly-encryption/blob/main/api/index.py"
click node_factory "https://github.com/discbrake023/cipherly-encryption/blob/main/app/__init__.py"
click node_text "https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/text.py"
click node_file "https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/file.py"
click node_demo "https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/demo.py"
click node_analysis "https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/analysis.py"
click node_hybrid "https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/hybrid.py"
click node_core "https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py"
click node_kdf "https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py"
click node_aead "https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py"
click node_envelope "https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py"
click node_hybridcrypto "https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py"
click node_metrics "https://github.com/discbrake023/cipherly-encryption/blob/main/testing/metrics.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_textui,node_fileui,node_demoui,node_analysisui,node_hybridui,node_user toneBlue
class node_entry,node_factory,node_text,node_file,node_demo,node_analysis,node_hybrid toneAmber
class node_core,node_kdf,node_aead,node_envelope,node_hybridcrypto toneMint
class node_metrics toneRose
```

## Components

### Browser UI

- [Application UI](https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/app.js): `static/js/app.js`
- [Text panel](https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/text_panel.js): `static/js/text_panel.js`
- [File panel](https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/file_panel.js): `static/js/file_panel.js`
- [Demo panel](https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/demo_panel.js): `static/js/demo_panel.js`
- [Analysis panel](https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/analysis_panel.js): `static/js/analysis_panel.js`
- [Hybrid panel](https://github.com/discbrake023/cipherly-encryption/blob/main/static/js/hybrid_panel.js): `static/js/hybrid_panel.js`

### Flask API

- [Serverless entry](https://github.com/discbrake023/cipherly-encryption/blob/main/api/index.py): `api/index.py`
- [App factory](https://github.com/discbrake023/cipherly-encryption/blob/main/app/__init__.py): `app/__init__.py`
- [Text routes](https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/text.py): `app/routes/text.py`
- [File routes](https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/file.py): `app/routes/file.py`
- [Demo routes](https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/demo.py): `app/routes/demo.py`
- [Analysis routes](https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/analysis.py): `app/routes/analysis.py`
- [Hybrid routes](https://github.com/discbrake023/cipherly-encryption/blob/main/app/routes/hybrid.py): `app/routes/hybrid.py`

### Cryptography

- [Crypto core](https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py): `crypto_core.py`
- [Password KDF](https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py): `crypto_core.py`
- [AEAD ciphers](https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py): `crypto_core.py`
- [KRP envelope](https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py): `crypto_core.py`
- [RSA wrapping](https://github.com/discbrake023/cipherly-encryption/blob/main/crypto_core.py): `crypto_core.py`

### Product Features

- [Crypto metrics](https://github.com/discbrake023/cipherly-encryption/blob/main/testing/metrics.py): `testing/metrics.py`

### Other components

- **User**

## Connections

- User → Application UI: uses
- Application UI → Text panel: initializes
- Application UI → File panel: initializes
- Application UI → Demo panel: initializes
- Application UI → Analysis panel: initializes
- Application UI → Hybrid panel: initializes
- Serverless entry → App factory: creates app
- App factory → Text routes: registers routes
- App factory → File routes: registers routes
- App factory → Demo routes: registers routes
- App factory → Analysis routes: registers routes
- App factory → Hybrid routes: registers routes
- Text panel → Text routes: requests API
- File panel → File routes: uploads/downloads
- Demo panel → Demo routes: runs scenario
- Analysis panel → Analysis routes: requests metrics
- Hybrid panel → Hybrid routes: requests API
- Text routes → Crypto core: encrypts/decrypts
- File routes → Crypto core: encrypts/decrypts
- Demo routes → Crypto core: runs crypto scenario
- Analysis routes → Crypto metrics: computes metrics
- Crypto metrics → Crypto core: uses primitives
- Hybrid routes → Crypto core: hybrid operations
- Crypto core → Password KDF: derives keys
- Crypto core → AEAD ciphers: encrypts/authenticates
- Crypto core → KRP envelope: encodes parameters
- Crypto core → RSA wrapping: wraps session key
