# rashad-007/secure-link architecture

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

- Interactive diagram: https://gitdiagram.com/rashad-007/secure-link
- Repository: https://github.com/rashad-007/secure-link

## Overview

SecureLink is a Flask-based secure file-transfer application. A sender submits a file through the transfer routes; the encryption service validates it, hashes and encrypts it, wraps the AES key for the recipient, and records transfer metadata. The recipient accesses the inbox and submits a password to unlock their private key, decrypt the file, and verify integrity. Authentication, audit/history, dashboard metrics, and the documented security/tampering demonstration are also represented. Some route and service internals are unsampled, so uncertain links are omitted.

Main entry points: [`services/transfer_service.py`](https://github.com/rashad-007/secure-link/blob/main/services/transfer_service.py) (Decrypt and verify), [`database/db.py`](https://github.com/rashad-007/secure-link/blob/main/database/db.py) (SQLite access layer), [`app.py`](https://github.com/rashad-007/secure-link/blob/main/app.py) (Flask application), [`services/encryption_service.py`](https://github.com/rashad-007/secure-link/blob/main/services/encryption_service.py) (Upload encryption)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Flask application<br/>[app.py]"]
  node_config["Application settings<br/>[config.py]"]
  node_auth["Authentication and profile<br/>[auth.py]"]
  node_transfer_routes["Transfer routes<br/>[transfer.py]"]
  node_dashboard["Dashboard and guide<br/>[dashboard.py]"]
  node_templates["Web views"]
end

subgraph group_transfer["Transfer workflow"]
  node_encrypt_service["Upload encryption"]
  node_decrypt_service["Decrypt and verify"]
  node_cipher_storage[("Encrypted file storage")]
end

subgraph group_crypto["Cryptography"]
  node_aes["AES-GCM<br/>[aes.py]"]
  node_rsa["RSA and key serialization<br/>[rsa.py]"]
  node_hashing["Hashes and passwords<br/>[hashing.py]"]
  node_key_management["User key management<br/>[key_management.py]"]
end

subgraph group_state["Identity and state"]
  node_database["SQLite access layer<br/>[db.py]"]
  node_sqlite[("Application records")]
end

node_user(("Sender or recipient"))

node_user -->|"uses"| node_app
node_app -->|"loads settings"| node_config
node_app -->|"initializes"| node_database
node_app -->|"registers"| node_auth
node_app -->|"registers"| node_transfer_routes
node_app -->|"registers"| node_dashboard
node_auth -->|"queries and updates"| node_database
node_auth -->|"hashes passwords"| node_hashing
node_auth -->|"creates keys"| node_key_management
node_transfer_routes -->|"processes upload"| node_encrypt_service
node_transfer_routes -->|"requests decryption"| node_decrypt_service
node_transfer_routes -->|"queries records"| node_database
node_transfer_routes -->|"renders views"| node_templates
node_dashboard -->|"gets metrics"| node_decrypt_service
node_dashboard -->|"renders views"| node_templates
node_encrypt_service -->|"hashes plaintext"| node_hashing
node_encrypt_service -->|"encrypts file"| node_aes
node_encrypt_service -->|"gets recipient key"| node_key_management
node_encrypt_service -->|"wraps AES key"| node_rsa
node_encrypt_service -->|"writes ciphertext"| node_cipher_storage
node_encrypt_service -->|"records transfer"| node_database
node_decrypt_service -->|"loads and updates"| node_database
node_decrypt_service -->|"unlocks private key"| node_key_management
node_decrypt_service -->|"unwraps AES key"| node_rsa
node_decrypt_service -->|"decrypts ciphertext"| node_aes
node_decrypt_service -->|"checks digest"| node_hashing
node_decrypt_service -->|"reads ciphertext"| node_cipher_storage
node_key_management -->|"creates and unlocks keys"| node_rsa
node_key_management -->|"loads key records"| node_database
node_database -->|"gets database path"| node_config
node_database -->|"reads and writes"| node_sqlite
node_app -->|"renders errors"| node_templates

click node_app "https://github.com/rashad-007/secure-link/blob/main/app.py"
click node_config "https://github.com/rashad-007/secure-link/blob/main/config.py"
click node_auth "https://github.com/rashad-007/secure-link/blob/main/routes/auth.py"
click node_transfer_routes "https://github.com/rashad-007/secure-link/blob/main/routes/transfer.py"
click node_dashboard "https://github.com/rashad-007/secure-link/blob/main/routes/dashboard.py"
click node_templates "https://github.com/rashad-007/secure-link/tree/main/templates"
click node_encrypt_service "https://github.com/rashad-007/secure-link/blob/main/services/encryption_service.py"
click node_decrypt_service "https://github.com/rashad-007/secure-link/blob/main/services/transfer_service.py"
click node_cipher_storage "https://github.com/rashad-007/secure-link/tree/main/storage/encrypted"
click node_aes "https://github.com/rashad-007/secure-link/blob/main/crypto/aes.py"
click node_rsa "https://github.com/rashad-007/secure-link/blob/main/crypto/rsa.py"
click node_hashing "https://github.com/rashad-007/secure-link/blob/main/crypto/hashing.py"
click node_key_management "https://github.com/rashad-007/secure-link/blob/main/services/key_management.py"
click node_database "https://github.com/rashad-007/secure-link/blob/main/database/db.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_app,node_config,node_auth,node_transfer_routes,node_dashboard,node_templates toneBlue
class node_encrypt_service,node_decrypt_service,node_cipher_storage toneAmber
class node_aes,node_rsa,node_hashing,node_key_management toneMint
class node_database,node_sqlite toneRose
class node_user toneIndigo
```

## Components

### Web application

- [Flask application](https://github.com/rashad-007/secure-link/blob/main/app.py): `app.py`
- [Application settings](https://github.com/rashad-007/secure-link/blob/main/config.py): `config.py`
- [Authentication and profile](https://github.com/rashad-007/secure-link/blob/main/routes/auth.py): `routes/auth.py`
- [Transfer routes](https://github.com/rashad-007/secure-link/blob/main/routes/transfer.py): `routes/transfer.py`
- [Dashboard and guide](https://github.com/rashad-007/secure-link/blob/main/routes/dashboard.py): `routes/dashboard.py`
- [Web views](https://github.com/rashad-007/secure-link/tree/main/templates): `templates`

### Transfer workflow

- [Upload encryption](https://github.com/rashad-007/secure-link/blob/main/services/encryption_service.py): `services/encryption_service.py`
- [Decrypt and verify](https://github.com/rashad-007/secure-link/blob/main/services/transfer_service.py): `services/transfer_service.py`
- [Encrypted file storage](https://github.com/rashad-007/secure-link/tree/main/storage/encrypted): `storage/encrypted`

### Cryptography

- [AES-GCM](https://github.com/rashad-007/secure-link/blob/main/crypto/aes.py): `crypto/aes.py`
- [RSA and key serialization](https://github.com/rashad-007/secure-link/blob/main/crypto/rsa.py): `crypto/rsa.py`
- [Hashes and passwords](https://github.com/rashad-007/secure-link/blob/main/crypto/hashing.py): `crypto/hashing.py`
- [User key management](https://github.com/rashad-007/secure-link/blob/main/services/key_management.py): `services/key_management.py`

### Identity and state

- [SQLite access layer](https://github.com/rashad-007/secure-link/blob/main/database/db.py): `database/db.py`
- **Application records**

### Other components

- **Sender or recipient**

## Connections

- Sender or recipient → Flask application: uses (evidence: `README.md`)
- Flask application → Application settings: loads settings (evidence: `app.py`)
- Flask application → SQLite access layer: initializes (evidence: `app.py`)
- Flask application → Authentication and profile: registers (evidence: `app.py`)
- Flask application → Transfer routes: registers (evidence: `app.py`)
- Flask application → Dashboard and guide: registers (evidence: `app.py`)
- Authentication and profile → SQLite access layer: queries and updates (evidence: `routes/auth.py`)
- Authentication and profile → Hashes and passwords: hashes passwords (evidence: `routes/auth.py`)
- Authentication and profile → User key management: creates keys (evidence: `routes/auth.py`)
- Transfer routes → Upload encryption: processes upload (evidence: `routes/transfer.py`)
- Transfer routes → Decrypt and verify: requests decryption (evidence: `routes/transfer.py`)
- Transfer routes → SQLite access layer: queries records (evidence: `routes/transfer.py`)
- Transfer routes → Web views: renders views (evidence: `routes/transfer.py`)
- Dashboard and guide → Decrypt and verify: gets metrics (evidence: `routes/dashboard.py`)
- Dashboard and guide → Web views: renders views (evidence: `routes/dashboard.py`)
- Upload encryption → Hashes and passwords: hashes plaintext (evidence: `services/encryption_service.py`)
- Upload encryption → AES-GCM: encrypts file (evidence: `services/encryption_service.py`)
- Upload encryption → User key management: gets recipient key (evidence: `services/encryption_service.py`)
- Upload encryption → RSA and key serialization: wraps AES key (evidence: `services/encryption_service.py`)
- Upload encryption → Encrypted file storage: writes ciphertext (evidence: `README.md`)
- Upload encryption → SQLite access layer: records transfer (evidence: `services/encryption_service.py`)
- Decrypt and verify → SQLite access layer: loads and updates (evidence: `services/transfer_service.py`)
- Decrypt and verify → User key management: unlocks private key (evidence: `services/transfer_service.py`)
- Decrypt and verify → RSA and key serialization: unwraps AES key (evidence: `services/transfer_service.py`)
- Decrypt and verify → AES-GCM: decrypts ciphertext (evidence: `services/transfer_service.py`)
- Decrypt and verify → Hashes and passwords: checks digest (evidence: `services/transfer_service.py`)
- Decrypt and verify → Encrypted file storage: reads ciphertext (evidence: `README.md`)
- User key management → RSA and key serialization: creates and unlocks keys (evidence: `services/key_management.py`)
- User key management → SQLite access layer: loads key records (evidence: `services/key_management.py`)
- SQLite access layer → Application settings: gets database path (evidence: `database/db.py`)
- SQLite access layer → Application records: reads and writes (evidence: `README.md`)
- Flask application → Web views: renders errors (evidence: `app.py`)
