# krishanu-ghosh/chronolock architecture

> Architecture diagram of the GitHub repository krishanu-ghosh/chronolock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krishanu-ghosh/chronolock
- Repository: https://github.com/krishanu-ghosh/chronolock

## Overview

ChronoLock is a Linux-oriented CLI secret manager. Its main workflow is setup—read plaintext secrets, encrypt them into a vault, and attempt filesystem locking—then daily use: load and decrypt the vault, verify a time-based password and clipboard-copy handshake, let the user select a secret, and copy it to the clipboard. The graph separates CLI orchestration, authentication, configuration and encryption, and user-facing output. Edges reflect shown calls or README-described interactions; unsampled behavior is not inferred.

Main entry points: [`cmd/main.go`](https://github.com/krishanu-ghosh/chronolock/blob/main/cmd/main.go) (CLI entry), [`internal/config/config.go`](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/config.go) (Setup and load), [`internal/ui/ui.go`](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/ui/ui.go) (Terminal prompts), [`internal/clipboard/clipboard.go`](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/clipboard/clipboard.go) (Clipboard copy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_entry["CLI entry<br/>[main.go]"]
end

subgraph group_security["Authentication"]
  node_timeauth["Time password<br/>[auth.go]"]
  node_sessionauth["Session handshake<br/>[auth.go]"]
end

subgraph group_vault["Vault management"]
  node_configpath["Vault path<br/>[config.go]"]
  node_setup["Setup and load<br/>[config.go]"]
  node_crypto["Vault encryption<br/>[crypto.go]"]
  node_models["Config models<br/>[structs.go]"]
  node_vaultfile[("Encrypted vault")]
  node_locking["Immutable locking<br/>[config.go]"]
end

subgraph group_interaction["User interaction"]
  node_ui["Terminal prompts<br/>[ui.go]"]
  node_clipboard["Clipboard copy<br/>[clipboard.go]"]
end

node_user(("User"))
node_plaintext["Plaintext input"]
node_clipboardservice["System clipboard"]
node_chattr["chattr command"]

node_user -->|"runs"| node_entry
node_entry -->|"gets path"| node_configpath
node_entry -->|"sets up or loads"| node_setup
node_entry -->|"prompts and displays"| node_ui
node_ui -->|"returns selection"| node_entry
node_entry -->|"checks password"| node_timeauth
node_entry -->|"checks handshake"| node_sessionauth
node_entry -->|"copies session and secret"| node_clipboard
node_setup -->|"reads"| node_plaintext
node_setup -->|"encrypts or decrypts"| node_crypto
node_setup -->|"writes or reads"| node_vaultfile
node_setup -->|"uses data types"| node_models
node_setup -->|"locks after setup"| node_locking
node_locking -->|"runs"| node_chattr
node_clipboard -->|"writes data"| node_clipboardservice
node_user -->|"enters credentials and choice"| node_ui

click node_entry "https://github.com/krishanu-ghosh/chronolock/blob/main/cmd/main.go"
click node_timeauth "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/auth/auth.go"
click node_sessionauth "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/auth/auth.go"
click node_configpath "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/config.go"
click node_setup "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/config.go"
click node_crypto "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/crypto.go"
click node_models "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/structs.go"
click node_locking "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/config.go"
click node_ui "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/ui/ui.go"
click node_clipboard "https://github.com/krishanu-ghosh/chronolock/blob/main/internal/clipboard/clipboard.go"

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_user toneBlue
class node_timeauth,node_sessionauth toneAmber
class node_configpath,node_setup,node_crypto,node_models,node_vaultfile,node_locking toneMint
class node_ui,node_clipboard toneRose
class node_plaintext,node_clipboardservice,node_chattr toneIndigo
```

## Components

### CLI workflow

- [CLI entry](https://github.com/krishanu-ghosh/chronolock/blob/main/cmd/main.go): `cmd/main.go`

### Authentication

- [Time password](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/auth/auth.go): `internal/auth/auth.go`
- [Session handshake](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/auth/auth.go): `internal/auth/auth.go`

### Vault management

- [Vault path](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/config.go): `internal/config/config.go`
- [Setup and load](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/config.go): `internal/config/config.go`
- [Vault encryption](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/crypto.go): `internal/config/crypto.go`
- [Config models](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/structs.go): `internal/config/structs.go`
- **Encrypted vault**
- [Immutable locking](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/config/config.go): `internal/config/config.go`

### User interaction

- [Terminal prompts](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/ui/ui.go): `internal/ui/ui.go`
- [Clipboard copy](https://github.com/krishanu-ghosh/chronolock/blob/main/internal/clipboard/clipboard.go): `internal/clipboard/clipboard.go`

### Other components

- **User**
- **Plaintext input**
- **System clipboard**
- **chattr command**

## Connections

- User → CLI entry: runs (evidence: `README.md`)
- CLI entry → Vault path: gets path (evidence: `cmd/main.go`)
- CLI entry → Setup and load: sets up or loads (evidence: `cmd/main.go`)
- CLI entry → Terminal prompts: prompts and displays (evidence: `cmd/main.go`)
- Terminal prompts → CLI entry: returns selection (evidence: `cmd/main.go`)
- CLI entry → Time password: checks password (evidence: `cmd/main.go`)
- CLI entry → Session handshake: checks handshake (evidence: `cmd/main.go`)
- CLI entry → Clipboard copy: copies session and secret (evidence: `cmd/main.go`)
- Setup and load → Plaintext input: reads (evidence: `internal/config/config.go`)
- Setup and load → Vault encryption: encrypts or decrypts (evidence: `internal/config/config.go`)
- Setup and load → Encrypted vault: writes or reads (evidence: `internal/config/config.go`)
- Setup and load → Config models: uses data types (evidence: `internal/config/config.go`)
- Setup and load → Immutable locking: locks after setup (evidence: `internal/config/config.go`)
- Immutable locking → chattr command: runs (evidence: `internal/config/config.go`)
- Clipboard copy → System clipboard: writes data (evidence: `internal/clipboard/clipboard.go`)
- User → Terminal prompts: enters credentials and choice (evidence: `README.md`)
