# maxgoedjen/secretive architecture

> Architecture diagram of the GitHub repository maxgoedjen/secretive, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maxgoedjen/secretive
- Repository: https://github.com/maxgoedjen/secretive

## Overview

Based on our analysis of the file tree and README, Secretive is an application designed for securely storing and managing SSH keys using macOS’ Secure Enclave (or, alternatively, a Smart Card on older Macs). The project is implemented in Swift and comprises both the native management app (the UI and control logic) and several internal libraries (Swift packages) that encapsulate the core security and key-management functionality.

##### Project Type and Purpose
- This is a native macOS application built in Swift. Its primary purpose is to securely store and manage SSH keys by leveraging the Secure Enclave and Keychain APIs.
- The README also mentions Touch ID (or Apple Watch) authentication, notifications for key access, and support for Smart Cards.
- Key indicators: “Secretive” is a management app, and the directory structure under Sources/Packages shows multiple libraries (the “SecretAgentKit”, “SecretKit”, “SecureEnclaveSecretKit”, and “SmartCardSecretKit”) that provide modular functionality.

##### Analyzing the File Structure
- Top-level directories:
- .github: Contains CI/CD configuration (workflows for build, test, release), indicating an auditable build and release process.
- Sources: Contains the bulk of the source code, broken down into distinct modules:
◦ Sources/Secretive: The primary application. This directory contains the main app entry point (App.swift), views (SwiftUI components, e.g., ContentView, SetupView), controllers/logic, and configuration files.
◦ Sources/SecretAgent: Likely a helper application or background “agent” that might manage system-level interactions (for example, communicating with Keychain or handling notifications).
◦ Sources/Packages: Contains multiple Swift packages which are the reusable libraries forming the core of secret handling. Each package (e.g., SecretAgentKit, SecretKit, SecureEnclaveSecretKit, SmartCardSecretKit) encapsulates a part of the functionality (communication with OS-level secure hardware, key operations, protocol interfaces, and so on).
◦ Sources/Config and various configuration files (e.g., .xcconfig, project.pbxproj) indicate a careful separation of environment and build settings.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface Layer"
        A["Secretive UI"]:::ui
    end

    subgraph "Background Services"
        B["SecretAgent Background Component"]:::background
    end

    subgraph "Core Libraries"
        C1["SecretAgentKit Library"]:::library
        C2["SecretKit Library"]:::library
        C3["SecureEnclaveSecretKit Library"]:::library
        C4["SmartCardSecretKit Library"]:::library
    end

    subgraph "External OS Services"
        D1["macOS Keychain"]:::external
        D2["Secure Enclave"]:::external
        D3["Touch ID/Apple Watch"]:::external
        D4["Notification Services"]:::external
    end

    subgraph "CI/CD Pipeline"
        E["CI/CD and Build Process"]:::ci
    end

    %% Interactions between components
    A -->|"use"| C1
    A -->|"use"| C2
    A -->|"use"| C3
    A -->|"use"| C4

    A <-->|"interacts_with"| B

    B -->|"assist"| C1
    B -->|"assist"| C2
    B -->|"notify"| D4

    C1 -->|"access"| D1
    C2 -->|"access"| D1
    C3 -->|"access"| D2
    C4 -->|"access"| D3
    C2 -->|"auth"| D3

    E -->|"build_test"| A
    E -->|"build_test"| B
    E -->|"build_test"| C1
    E -->|"build_test"| C2
    E -->|"build_test"| C3
    E -->|"build_test"| C4

    %% Click Events
    click A "https://github.com/maxgoedjen/secretive/tree/main/Sources/Secretive"
    click B "https://github.com/maxgoedjen/secretive/tree/main/Sources/SecretAgent"
    click C1 "https://github.com/maxgoedjen/secretive/tree/main/Sources/Packages/Sources/SecretAgentKit"
    click C2 "https://github.com/maxgoedjen/secretive/tree/main/Sources/Packages/Sources/SecretKit"
    click C3 "https://github.com/maxgoedjen/secretive/tree/main/Sources/Packages/Sources/SecureEnclaveSecretKit"
    click C4 "https://github.com/maxgoedjen/secretive/tree/main/Sources/Packages/Sources/SmartCardSecretKit"
    click E "https://github.com/maxgoedjen/secretive/tree/main/.github/workflows"

    %% Styling of nodes
    classDef ui fill:#a4d3ee,stroke:#000,stroke-width:2px;
    classDef background fill:#d3a4ee,stroke:#000,stroke-width:2px;
    classDef library fill:#aee4a4,stroke:#000,stroke-width:2px;
    classDef external fill:#e4a4a4,stroke:#000,stroke-width:2px;
    classDef ci fill:#e4d3a4,stroke:#000,stroke-width:2px;
```
