# blaze-809/sih-2026 architecture

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

- Interactive diagram: https://gitdiagram.com/blaze-809/sih-2026
- Repository: https://github.com/blaze-809/sih-2026

## Overview

PRAMAAN is a local Python prototype for the ERASE → VERIFY → RECOVER → PROVE workflow, with both a CLI and a browser console. The web path generates a test image, requires a recovery scan before sanitization, verifies the overwrite and performs a residual scan, then builds a certificate; audit entries record the operations. The console also presents recovered artifacts, audit-chain status, certificate data, and a policy-table stub. The graph reflects the supplied README and sampled source; unsampled frontend markup and fixture implementation are represented only at their documented paths.

Main entry points: [`app.py`](https://github.com/blaze-809/sih-2026/blob/main/app.py) (HTTP backend), [`pramaan/cli.py`](https://github.com/blaze-809/sih-2026/blob/main/pramaan/cli.py) (CLI driver), [`static/app.js`](https://github.com/blaze-809/sih-2026/blob/main/static/app.js) (Web console), [`fixtures/generate_fixtures.py`](https://github.com/blaze-809/sih-2026/blob/main/fixtures/generate_fixtures.py) (Fixture generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_frontend["Web console<br/>[app.js]"]
  node_cli["CLI driver<br/>[cli.py]"]
end

subgraph group_orchestration["Workflow orchestration"]
  node_web_api["HTTP backend<br/>[app.py]"]
end

subgraph group_pipeline["Erasure pipeline"]
  node_fixture_gen["Fixture generator"]
  node_carver["JPEG carver<br/>[carver.py]"]
  node_sanitize["Overwrite sanitizer<br/>[sanitize.py]"]
  node_verify["Overwrite verifier<br/>[verify.py]"]
end

subgraph group_evidence["Evidence and session"]
  node_session["Session state<br/>[session.py]"]
  node_image[("Test disk image")]
  node_manifest["Ground-truth manifest"]
  node_audit["Hash-chain audit<br/>[audit.py]"]
  node_certificate["Certificate builder<br/>[certificate.py]"]
  node_policy["Policy-table stub<br/>[media-table.json]"]
end

node_operator(("Operator / analyst"))
node_cli_user(("CLI user"))

node_operator -->|"uses"| node_frontend
node_frontend -->|"calls endpoints"| node_web_api
node_cli_user -->|"runs pipeline"| node_cli
node_cli -->|"generates fixtures"| node_fixture_gen
node_cli -->|"scans and scores"| node_carver
node_cli -->|"overwrites image"| node_sanitize
node_cli -->|"verifies overwrite"| node_verify
node_cli -->|"records operations"| node_audit
node_cli -->|"builds certificate"| node_certificate
node_web_api -->|"reads and updates"| node_session
node_web_api -->|"generates image"| node_fixture_gen
node_fixture_gen -->|"writes image"| node_image
node_fixture_gen -->|"writes manifest"| node_manifest
node_web_api -->|"scans and scores"| node_carver
node_carver -->|"reads bytes"| node_image
node_web_api -->|"overwrites image"| node_sanitize
node_sanitize -->|"writes bytes"| node_image
node_web_api -->|"verifies overwrite"| node_verify
node_verify -->|"reads bytes"| node_image
node_verify -->|"runs residual scan"| node_carver
node_web_api -->|"records operations"| node_audit
node_web_api -->|"builds certificate"| node_certificate
node_web_api -->|"serves table"| node_policy
node_frontend -->|"fetches table"| node_policy
node_frontend -->|"requests audit and certificate"| node_web_api

click node_frontend "https://github.com/blaze-809/sih-2026/blob/main/static/app.js"
click node_cli "https://github.com/blaze-809/sih-2026/blob/main/pramaan/cli.py"
click node_web_api "https://github.com/blaze-809/sih-2026/blob/main/app.py"
click node_session "https://github.com/blaze-809/sih-2026/blob/main/pramaan/session.py"
click node_fixture_gen "https://github.com/blaze-809/sih-2026/blob/main/fixtures/generate_fixtures.py"
click node_image "https://github.com/blaze-809/sih-2026/tree/main/web_session"
click node_manifest "https://github.com/blaze-809/sih-2026/tree/main/web_session"
click node_carver "https://github.com/blaze-809/sih-2026/blob/main/pramaan/carver.py"
click node_sanitize "https://github.com/blaze-809/sih-2026/blob/main/pramaan/sanitize.py"
click node_verify "https://github.com/blaze-809/sih-2026/blob/main/pramaan/verify.py"
click node_audit "https://github.com/blaze-809/sih-2026/blob/main/pramaan/audit.py"
click node_certificate "https://github.com/blaze-809/sih-2026/blob/main/pramaan/certificate.py"
click node_policy "https://github.com/blaze-809/sih-2026/blob/main/data/media-table.json"

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_frontend,node_cli,node_cli_user toneBlue
class node_web_api toneAmber
class node_fixture_gen,node_carver,node_sanitize,node_verify toneMint
class node_session,node_image,node_manifest,node_audit,node_certificate,node_policy toneRose
class node_operator toneIndigo
```

## Components

### User interfaces

- [Web console](https://github.com/blaze-809/sih-2026/blob/main/static/app.js): `static/app.js`
- [CLI driver](https://github.com/blaze-809/sih-2026/blob/main/pramaan/cli.py): `pramaan/cli.py`

### Workflow orchestration

- [HTTP backend](https://github.com/blaze-809/sih-2026/blob/main/app.py): `app.py`

### Erasure pipeline

- [Fixture generator](https://github.com/blaze-809/sih-2026/blob/main/fixtures/generate_fixtures.py): `fixtures/generate_fixtures.py`
- [JPEG carver](https://github.com/blaze-809/sih-2026/blob/main/pramaan/carver.py): `pramaan/carver.py`
- [Overwrite sanitizer](https://github.com/blaze-809/sih-2026/blob/main/pramaan/sanitize.py): `pramaan/sanitize.py`
- [Overwrite verifier](https://github.com/blaze-809/sih-2026/blob/main/pramaan/verify.py): `pramaan/verify.py`

### Evidence and session

- [Session state](https://github.com/blaze-809/sih-2026/blob/main/pramaan/session.py): `pramaan/session.py`
- [Test disk image](https://github.com/blaze-809/sih-2026/tree/main/web_session): `web_session`
- [Ground-truth manifest](https://github.com/blaze-809/sih-2026/tree/main/web_session): `web_session`
- [Hash-chain audit](https://github.com/blaze-809/sih-2026/blob/main/pramaan/audit.py): `pramaan/audit.py`
- [Certificate builder](https://github.com/blaze-809/sih-2026/blob/main/pramaan/certificate.py): `pramaan/certificate.py`
- [Policy-table stub](https://github.com/blaze-809/sih-2026/blob/main/data/media-table.json): `data/media-table.json`

### Other components

- **Operator / analyst**
- **CLI user**

## Connections

- Operator / analyst → Web console: uses
- Web console → HTTP backend: calls endpoints
- CLI user → CLI driver: runs pipeline
- CLI driver → Fixture generator: generates fixtures
- CLI driver → JPEG carver: scans and scores
- CLI driver → Overwrite sanitizer: overwrites image
- CLI driver → Overwrite verifier: verifies overwrite
- CLI driver → Hash-chain audit: records operations
- CLI driver → Certificate builder: builds certificate
- HTTP backend → Session state: reads and updates
- HTTP backend → Fixture generator: generates image
- Fixture generator → Test disk image: writes image
- Fixture generator → Ground-truth manifest: writes manifest
- HTTP backend → JPEG carver: scans and scores
- JPEG carver → Test disk image: reads bytes
- HTTP backend → Overwrite sanitizer: overwrites image
- Overwrite sanitizer → Test disk image: writes bytes
- HTTP backend → Overwrite verifier: verifies overwrite
- Overwrite verifier → Test disk image: reads bytes
- Overwrite verifier → JPEG carver: runs residual scan
- HTTP backend → Hash-chain audit: records operations
- HTTP backend → Certificate builder: builds certificate
- HTTP backend → Policy-table stub: serves table
- Web console → Policy-table stub: fetches table
- Web console → HTTP backend: requests audit and certificate
