# rsh-454/crypt architecture

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

- Interactive diagram: https://gitdiagram.com/rsh-454/crypt
- Repository: https://github.com/rsh-454/crypt

## Overview

CRYPT is a single-file Python credential manager. The user enters through a console menu, establishes or verifies the master password, then saves, searches, updates, deletes, or lists account credentials; a separate menu action resets the master password. Credential operations read and write a JSON vault, while password values are encrypted with Fernet and the master password is stored as a hash. The README’s security warning conflicts with the sampled code, which encrypts credential values; the broader architecture is limited to the one sampled source file.

Main entry points: [`CRYPT.py`](https://github.com/rsh-454/crypt/blob/main/CRYPT.py) (Startup and menus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI flow"]
  node_entry["Startup and menus<br/>[CRYPT.py]"]
  node_header["Display header<br/>[CRYPT.py]"]
end

subgraph group_auth["Access control"]
  node_access["Authenticate access<br/>[CRYPT.py]"]
  node_hash["Password hashing<br/>[CRYPT.py]"]
  node_authfile[("Auth hash file<br/>[CRYPT.py]")]
  node_reset["Reset master password<br/>[CRYPT.py]"]
end

subgraph group_vault["Credential vault"]
  node_save["Save credential<br/>[CRYPT.py]"]
  node_search["Search credential<br/>[CRYPT.py]"]
  node_update["Update credential<br/>[CRYPT.py]"]
  node_delete["Delete credential<br/>[CRYPT.py]"]
  node_view["View all credentials<br/>[CRYPT.py]"]
  node_vaultio["Vault file access<br/>[CRYPT.py]"]
  node_vaultfile[("JSON credential vault<br/>[CRYPT.py]")]
  node_crypto["Credential encryption<br/>[CRYPT.py]"]
  node_keyio["Key loading<br/>[CRYPT.py]"]
  node_keyfile[("Fernet key file<br/>[CRYPT.py]")]
end

node_user(("User"))

node_user -->|"chooses options"| node_entry
node_entry -->|"displays"| node_header
node_entry -->|"authenticates"| node_access
node_access -->|"hashes input"| node_hash
node_access -->|"reads or writes"| node_authfile
node_reset -->|"reads or writes"| node_authfile
node_reset -->|"hashes passwords"| node_hash
node_entry -->|"dispatches reset"| node_reset
node_entry -->|"dispatches save"| node_save
node_entry -->|"dispatches search"| node_search
node_entry -->|"dispatches update"| node_update
node_entry -->|"dispatches delete"| node_delete
node_entry -->|"dispatches view"| node_view
node_save -->|"encrypts password"| node_crypto
node_save -->|"loads and saves"| node_vaultio
node_search -->|"loads vault"| node_vaultio
node_search -->|"decrypts match"| node_crypto
node_update -->|"loads and saves"| node_vaultio
node_update -->|"encrypts replacement"| node_crypto
node_delete -->|"loads and saves"| node_vaultio
node_view -->|"loads vault"| node_vaultio
node_view -->|"decrypts entries"| node_crypto
node_vaultio -->|"reads or writes"| node_vaultfile
node_crypto -->|"loads key"| node_keyio
node_keyio -->|"reads or creates"| node_keyfile

click node_entry "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_header "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_access "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_hash "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_authfile "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_reset "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_save "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_search "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_update "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_delete "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_view "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_vaultio "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_vaultfile "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_crypto "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_keyio "https://github.com/rsh-454/crypt/blob/main/CRYPT.py"
click node_keyfile "https://github.com/rsh-454/crypt/blob/main/CRYPT.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_entry,node_header,node_user toneBlue
class node_access,node_hash,node_authfile,node_reset toneAmber
class node_save,node_search,node_update,node_delete,node_view,node_vaultio,node_vaultfile,node_crypto,node_keyio,node_keyfile toneMint
```

## Components

### CLI flow

- [Startup and menus](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Display header](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`

### Access control

- [Authenticate access](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Password hashing](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Auth hash file](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Reset master password](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`

### Credential vault

- [Save credential](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Search credential](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Update credential](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Delete credential](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [View all credentials](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Vault file access](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [JSON credential vault](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Credential encryption](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Key loading](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`
- [Fernet key file](https://github.com/rsh-454/crypt/blob/main/CRYPT.py): `CRYPT.py`

### Other components

- **User**

## Connections

- User → Startup and menus: chooses options
- Startup and menus → Display header: displays
- Startup and menus → Authenticate access: authenticates
- Authenticate access → Password hashing: hashes input
- Authenticate access → Auth hash file: reads or writes
- Reset master password → Auth hash file: reads or writes
- Reset master password → Password hashing: hashes passwords
- Startup and menus → Reset master password: dispatches reset
- Startup and menus → Save credential: dispatches save
- Startup and menus → Search credential: dispatches search
- Startup and menus → Update credential: dispatches update
- Startup and menus → Delete credential: dispatches delete
- Startup and menus → View all credentials: dispatches view
- Save credential → Credential encryption: encrypts password
- Save credential → Vault file access: loads and saves
- Search credential → Vault file access: loads vault
- Search credential → Credential encryption: decrypts match
- Update credential → Vault file access: loads and saves
- Update credential → Credential encryption: encrypts replacement
- Delete credential → Vault file access: loads and saves
- View all credentials → Vault file access: loads vault
- View all credentials → Credential encryption: decrypts entries
- Vault file access → JSON credential vault: reads or writes
- Credential encryption → Key loading: loads key
- Key loading → Fernet key file: reads or creates
