# n-ith/srm architecture

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

- Interactive diagram: https://gitdiagram.com/n-ith/srm
- Repository: https://github.com/n-ith/srm

## Overview

Secure RM is a command-line secure-deletion tool. The main workflow accepts file or recursive-directory targets, confirms unless forced, then orchestrates encryption, overwrite passes, optional metadata sanitization, and filesystem removal; it can also report hashed-path deletion logs. The graph separates CLI, deletion orchestration and operations, and cryptographic support. The README documents these capabilities, while the sampled source shows their principal calls; no separate logging or metadata subsystem exists in the tree.

Main entry points: [`srm/deleter.py`](https://github.com/n-ith/srm/blob/main/srm/deleter.py) (Deletion orchestrator), [`srm/cli.py`](https://github.com/n-ith/srm/blob/main/srm/cli.py) (CLI and confirmation), [`srm/operations.py`](https://github.com/n-ith/srm/blob/main/srm/operations.py) (File operations), [`srm/crypto.py`](https://github.com/n-ith/srm/blob/main/srm/crypto.py) (Ephemeral encryption)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_cli["CLI and confirmation<br/>[cli.py]"]
end

subgraph group_deletion["Deletion workflow"]
  node_deleter["Deletion orchestrator<br/>[deleter.py]"]
  node_fileops["File operations<br/>[operations.py]"]
  node_directoryops["Directory operations<br/>[operations.py]"]
  node_report["Deletion log output<br/>[deleter.py]"]
end

subgraph group_crypto["Cryptographic support"]
  node_encryption["Ephemeral encryption<br/>[crypto.py]"]
  node_patterns["Overwrite patterns<br/>[crypto.py]"]
  node_pathhash["Path hashing<br/>[crypto.py]"]
end

node_user(("User"))
node_targets[("Target files")]
node_filesystem[("Filesystem")]

node_user -->|"supplies targets"| node_cli
node_cli -->|"dispatches deletion"| node_deleter
node_cli -->|"requests log"| node_report
node_deleter -->|"runs file stages"| node_fileops
node_deleter -->|"collects and removes"| node_directoryops
node_fileops -->|"encrypts contents"| node_encryption
node_fileops -->|"generates pass data"| node_patterns
node_deleter -->|"hashes log paths"| node_pathhash
node_cli -->|"counts targets"| node_filesystem
node_fileops -->|"reads and writes files"| node_filesystem
node_directoryops -->|"walks and removes directories"| node_filesystem
node_deleter -->|"validates targets"| node_filesystem
node_report -->|"prints entries"| node_user

click node_cli "https://github.com/n-ith/srm/blob/main/srm/cli.py"
click node_deleter "https://github.com/n-ith/srm/blob/main/srm/deleter.py"
click node_fileops "https://github.com/n-ith/srm/blob/main/srm/operations.py"
click node_directoryops "https://github.com/n-ith/srm/blob/main/srm/operations.py"
click node_encryption "https://github.com/n-ith/srm/blob/main/srm/crypto.py"
click node_patterns "https://github.com/n-ith/srm/blob/main/srm/crypto.py"
click node_pathhash "https://github.com/n-ith/srm/blob/main/srm/crypto.py"
click node_report "https://github.com/n-ith/srm/blob/main/srm/deleter.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_cli,node_user toneBlue
class node_deleter,node_fileops,node_directoryops,node_report,node_targets,node_filesystem toneAmber
class node_encryption,node_patterns,node_pathhash toneMint
```

## Components

### Command line

- [CLI and confirmation](https://github.com/n-ith/srm/blob/main/srm/cli.py): `srm/cli.py`

### Deletion workflow

- [Deletion orchestrator](https://github.com/n-ith/srm/blob/main/srm/deleter.py): `srm/deleter.py`
- [File operations](https://github.com/n-ith/srm/blob/main/srm/operations.py): `srm/operations.py`
- [Directory operations](https://github.com/n-ith/srm/blob/main/srm/operations.py): `srm/operations.py`
- [Deletion log output](https://github.com/n-ith/srm/blob/main/srm/deleter.py): `srm/deleter.py`

### Cryptographic support

- [Ephemeral encryption](https://github.com/n-ith/srm/blob/main/srm/crypto.py): `srm/crypto.py`
- [Overwrite patterns](https://github.com/n-ith/srm/blob/main/srm/crypto.py): `srm/crypto.py`
- [Path hashing](https://github.com/n-ith/srm/blob/main/srm/crypto.py): `srm/crypto.py`

### Other components

- **User**
- **Target files**
- **Filesystem**

## Connections

- User → CLI and confirmation: supplies targets (evidence: `srm/cli.py`)
- CLI and confirmation → Deletion orchestrator: dispatches deletion (evidence: `srm/cli.py`)
- CLI and confirmation → Deletion log output: requests log (evidence: `srm/cli.py`)
- Deletion orchestrator → File operations: runs file stages (evidence: `srm/deleter.py`)
- Deletion orchestrator → Directory operations: collects and removes (evidence: `srm/deleter.py`)
- File operations → Ephemeral encryption: encrypts contents (evidence: `srm/operations.py`)
- File operations → Overwrite patterns: generates pass data (evidence: `srm/operations.py`)
- Deletion orchestrator → Path hashing: hashes log paths (evidence: `srm/deleter.py`)
- CLI and confirmation → Filesystem: counts targets (evidence: `srm/cli.py`)
- File operations → Filesystem: reads and writes files (evidence: `srm/operations.py`)
- Directory operations → Filesystem: walks and removes directories (evidence: `srm/operations.py`)
- Deletion orchestrator → Filesystem: validates targets (evidence: `srm/deleter.py`)
- Deletion log output → User: prints entries (evidence: `srm/deleter.py`)
