# meisapps/pcbu-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/meisapps/pcbu-desktop
- Repository: https://github.com/meisapps/pcbu-desktop

## Overview

PulseUnlock is a cross-platform desktop companion that lets a paired Android phone approve authentication without sending the PC password to the phone. The main path is pairing and saving device credentials, then an OS authentication request invokes the shared unlock handler; it selects a transport, obtains the phone’s response, and returns credentials for normal platform verification. The repository also includes privileged login integrations, SSH prompts, configuration, and administration. README documents several capabilities whose implementation files were not sampled, so those subsystem links are shown only where documented.

Main entry points: [`common/src/handler/UnlockHandler.cpp`](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/handler/UnlockHandler.cpp) (Unlock handler), [`natives/pcbu-ssh-askpass/src/main.cpp`](https://github.com/meisapps/pcbu-desktop/blob/main/natives/pcbu-ssh-askpass/src/main.cpp) (SSH askpass), [`desktop/src/ui/MainWindow.cpp`](https://github.com/meisapps/pcbu-desktop/blob/main/desktop/src/ui/MainWindow.cpp) (Desktop interface), [`common/src/storage/PairedDevicesStorage.cpp`](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/storage/PairedDevicesStorage.cpp) (Paired devices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pairing["Pairing and devices"]
  node_pairing_ui["Pairing interface<br/>[PairingForm.cpp]"]
  node_pairing_server["Pairing services"]
  node_paired_devices[("Paired devices")]
  node_discovery["Device discovery"]
end

subgraph group_unlock["Unlock transport"]
  node_unlock_entry["Unlock handler<br/>[UnlockHandler.cpp]"]
  node_unlock_state["Unlock state<br/>[UnlockState.h]"]
  node_local_transport["Local transports"]
  node_bluetooth_transport["Bluetooth transport<br/>[BTUnlockClient.cpp]"]
  node_cloud_transport["Cloud transport"]
  node_wol["Wake-on-LAN"]
end

subgraph group_auth["Authentication integrations"]
  node_windows_auth["Windows credential provider"]
  node_unix_auth["PAM authentication<br/>[main.cpp]"]
  node_ssh_auth["SSH askpass<br/>[main.cpp]"]
  node_mac_agent["macOS auth agent<br/>[AgentController.h]"]
  node_pam_module["PAM module<br/>[pam_auth.cpp]"]
  node_ssh_prompt["SSH prompt parsing<br/>[SshPrompt.cpp]"]
end

subgraph group_desktop["Desktop management"]
  node_desktop_ui["Desktop interface<br/>[MainWindow.cpp]"]
  node_settings[("App settings<br/>[AppSettings.cpp]")]
  node_installer["Service installer"]
  node_logs["Logging system<br/>[LoggingSystem.cpp]"]
end

subgraph group_platform["Platform services"]
  node_crypto["Cryptography<br/>[CryptUtils.cpp]"]
  node_shell["Privileged shell<br/>[Shell.cpp]"]
  node_elevator["Elevator service"]
  node_platform_login["Platform login check<br/>[PlatformHelper.h]"]
end

node_user(("PC user"))
node_phone(("Android phone"))
node_cloud_relay{{"Cloud relay"}}

node_user -.->|"starts pairing"| node_pairing_ui
node_pairing_ui -.->|"pairs by QR"| node_phone
node_pairing_ui -.->|"saves device"| node_paired_devices
node_discovery -.->|"discovers locally"| node_phone
node_user -.->|"requests unlock"| node_windows_auth
node_user -.->|"requests unlock"| node_unix_auth
node_user -.->|"requests SSH login"| node_ssh_auth
node_user -.->|"requests auth"| node_mac_agent
node_windows_auth -->|"invokes"| node_unlock_entry
node_unix_auth -->|"invokes"| node_unlock_entry
node_ssh_auth -->|"invokes"| node_unlock_entry
node_ssh_auth -->|"parses prompt"| node_ssh_prompt
node_unlock_entry -->|"loads devices"| node_paired_devices
node_unlock_entry -->|"selects transport"| node_local_transport
node_unlock_entry -->|"selects transport"| node_bluetooth_transport
node_unlock_entry -->|"selects transport"| node_cloud_transport
node_unlock_entry -.->|"produces result"| node_unlock_state
node_local_transport -.->|"exchanges encrypted data"| node_phone
node_bluetooth_transport -.->|"exchanges encrypted data"| node_phone
node_cloud_transport -.->|"connects outbound"| node_cloud_relay
node_cloud_relay -.->|"relays encrypted traffic"| node_phone
node_phone -.->|"returns approval"| node_unlock_entry
node_unlock_entry -->|"verifies credentials"| node_platform_login
node_ssh_auth -->|"checks login"| node_platform_login
node_ssh_auth -->|"filters devices"| node_paired_devices
node_ssh_auth -->|"decrypts SSH secret"| node_crypto
node_pam_module -.->|"supports PAM flow"| node_unix_auth
node_desktop_ui -.->|"configures app"| node_settings
node_desktop_ui -.->|"manages pairings"| node_paired_devices
node_desktop_ui -.->|"configures service"| node_installer
node_desktop_ui -.->|"views logs"| node_logs
node_installer -->|"runs system actions"| node_shell
node_shell -.->|"dispatches privileged work"| node_elevator
node_user -.->|"may wake PC"| node_wol
node_unlock_entry -->|"reads configuration"| node_settings

click node_pairing_ui "https://github.com/meisapps/pcbu-desktop/blob/main/desktop/src/ui/PairingForm.cpp"
click node_pairing_server "https://github.com/meisapps/pcbu-desktop/tree/main/common/src/connection/pairing"
click node_paired_devices "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/storage/PairedDevicesStorage.cpp"
click node_discovery "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/pairing/UDPPairingBroadcaster.cpp"
click node_unlock_entry "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/handler/UnlockHandler.cpp"
click node_unlock_state "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/handler/UnlockState.h"
click node_local_transport "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/unlock/clients/TCPUnlockClient.cpp"
click node_bluetooth_transport "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/unlock/clients/BTUnlockClient.cpp"
click node_cloud_transport "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/unlock/clients/CloudUnlockClient.cpp"
click node_crypto "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/utils/CryptUtils.cpp"
click node_windows_auth "https://github.com/meisapps/pcbu-desktop/blob/main/natives/win_pulseunlock/src/CSampleProvider.cpp"
click node_unix_auth "https://github.com/meisapps/pcbu-desktop/blob/main/natives/pcbu-auth/src/main.cpp"
click node_ssh_auth "https://github.com/meisapps/pcbu-desktop/blob/main/natives/pcbu-ssh-askpass/src/main.cpp"
click node_mac_agent "https://github.com/meisapps/pcbu-desktop/blob/main/natives/mac_pulseunlock/src/AgentController.h"
click node_pam_module "https://github.com/meisapps/pcbu-desktop/blob/main/natives/pam_pulseunlock/src/pam_auth.cpp"
click node_ssh_prompt "https://github.com/meisapps/pcbu-desktop/blob/main/natives/pcbu-ssh-askpass/src/SshPrompt.cpp"
click node_desktop_ui "https://github.com/meisapps/pcbu-desktop/blob/main/desktop/src/ui/MainWindow.cpp"
click node_settings "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/storage/AppSettings.cpp"
click node_installer "https://github.com/meisapps/pcbu-desktop/blob/main/desktop/src/installer/ServiceInstaller.Linux.cpp"
click node_logs "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/storage/LoggingSystem.cpp"
click node_shell "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/shell/Shell.cpp"
click node_elevator "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/shell/ElevatorService.cpp"
click node_platform_login "https://github.com/meisapps/pcbu-desktop/blob/main/common/src/platform/PlatformHelper.h"
click node_wol "https://github.com/meisapps/pcbu-desktop/tree/main/common/src/connection"

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_pairing_ui,node_pairing_server,node_paired_devices,node_discovery,node_user toneBlue
class node_unlock_entry,node_unlock_state,node_local_transport,node_bluetooth_transport,node_cloud_transport,node_wol toneAmber
class node_windows_auth,node_unix_auth,node_ssh_auth,node_mac_agent,node_pam_module,node_ssh_prompt toneMint
class node_desktop_ui,node_settings,node_installer,node_logs toneRose
class node_crypto,node_shell,node_elevator,node_platform_login,node_phone,node_cloud_relay toneIndigo
```

## Components

### Pairing and devices

- [Pairing interface](https://github.com/meisapps/pcbu-desktop/blob/main/desktop/src/ui/PairingForm.cpp): `desktop/src/ui/PairingForm.cpp`
- [Pairing services](https://github.com/meisapps/pcbu-desktop/tree/main/common/src/connection/pairing): `common/src/connection/pairing`
- [Paired devices](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/storage/PairedDevicesStorage.cpp): `common/src/storage/PairedDevicesStorage.cpp`
- [Device discovery](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/pairing/UDPPairingBroadcaster.cpp): `common/src/connection/pairing/UDPPairingBroadcaster.cpp`

### Unlock transport

- [Unlock handler](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/handler/UnlockHandler.cpp): `common/src/handler/UnlockHandler.cpp`
- [Unlock state](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/handler/UnlockState.h): `common/src/handler/UnlockState.h`
- [Local transports](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/unlock/clients/TCPUnlockClient.cpp): `common/src/connection/unlock/clients/TCPUnlockClient.cpp`
- [Bluetooth transport](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/unlock/clients/BTUnlockClient.cpp): `common/src/connection/unlock/clients/BTUnlockClient.cpp`
- [Cloud transport](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/connection/unlock/clients/CloudUnlockClient.cpp): `common/src/connection/unlock/clients/CloudUnlockClient.cpp`
- [Wake-on-LAN](https://github.com/meisapps/pcbu-desktop/tree/main/common/src/connection): `common/src/connection`

### Authentication integrations

- [Windows credential provider](https://github.com/meisapps/pcbu-desktop/blob/main/natives/win_pulseunlock/src/CSampleProvider.cpp): `natives/win_pulseunlock/src/CSampleProvider.cpp`
- [PAM authentication](https://github.com/meisapps/pcbu-desktop/blob/main/natives/pcbu-auth/src/main.cpp): `natives/pcbu-auth/src/main.cpp`
- [SSH askpass](https://github.com/meisapps/pcbu-desktop/blob/main/natives/pcbu-ssh-askpass/src/main.cpp): `natives/pcbu-ssh-askpass/src/main.cpp`
- [macOS auth agent](https://github.com/meisapps/pcbu-desktop/blob/main/natives/mac_pulseunlock/src/AgentController.h): `natives/mac_pulseunlock/src/AgentController.h`
- [PAM module](https://github.com/meisapps/pcbu-desktop/blob/main/natives/pam_pulseunlock/src/pam_auth.cpp): `natives/pam_pulseunlock/src/pam_auth.cpp`
- [SSH prompt parsing](https://github.com/meisapps/pcbu-desktop/blob/main/natives/pcbu-ssh-askpass/src/SshPrompt.cpp): `natives/pcbu-ssh-askpass/src/SshPrompt.cpp`

### Desktop management

- [Desktop interface](https://github.com/meisapps/pcbu-desktop/blob/main/desktop/src/ui/MainWindow.cpp): `desktop/src/ui/MainWindow.cpp`
- [App settings](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/storage/AppSettings.cpp): `common/src/storage/AppSettings.cpp`
- [Service installer](https://github.com/meisapps/pcbu-desktop/blob/main/desktop/src/installer/ServiceInstaller.Linux.cpp): `desktop/src/installer/ServiceInstaller.Linux.cpp`
- [Logging system](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/storage/LoggingSystem.cpp): `common/src/storage/LoggingSystem.cpp`

### Platform services

- [Cryptography](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/utils/CryptUtils.cpp): `common/src/utils/CryptUtils.cpp`
- [Privileged shell](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/shell/Shell.cpp): `common/src/shell/Shell.cpp`
- [Elevator service](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/shell/ElevatorService.cpp): `common/src/shell/ElevatorService.cpp`
- [Platform login check](https://github.com/meisapps/pcbu-desktop/blob/main/common/src/platform/PlatformHelper.h): `common/src/platform/PlatformHelper.h`

### Other components

- **PC user**
- **Android phone**
- **Cloud relay**

## Connections

- PC user → Pairing interface: starts pairing
- Pairing interface → Android phone: pairs by QR
- Pairing interface → Paired devices: saves device
- Device discovery → Android phone: discovers locally
- PC user → Windows credential provider: requests unlock
- PC user → PAM authentication: requests unlock
- PC user → SSH askpass: requests SSH login
- PC user → macOS auth agent: requests auth
- Windows credential provider → Unlock handler: invokes (evidence: `natives/win_pulseunlock/src/CSampleProvider.cpp`)
- PAM authentication → Unlock handler: invokes (evidence: `natives/pcbu-auth/src/main.cpp`)
- SSH askpass → Unlock handler: invokes (evidence: `natives/pcbu-ssh-askpass/src/main.cpp`)
- SSH askpass → SSH prompt parsing: parses prompt (evidence: `natives/pcbu-ssh-askpass/src/main.cpp`)
- Unlock handler → Paired devices: loads devices
- Unlock handler → Local transports: selects transport (evidence: `common/src/handler/UnlockHandler.cpp`)
- Unlock handler → Bluetooth transport: selects transport (evidence: `common/src/handler/UnlockHandler.cpp`)
- Unlock handler → Cloud transport: selects transport (evidence: `common/src/handler/UnlockHandler.cpp`)
- Unlock handler → Unlock state: produces result
- Local transports → Android phone: exchanges encrypted data
- Bluetooth transport → Android phone: exchanges encrypted data
- Cloud transport → Cloud relay: connects outbound
- Cloud relay → Android phone: relays encrypted traffic
- Android phone → Unlock handler: returns approval
- Unlock handler → Platform login check: verifies credentials
- SSH askpass → Platform login check: checks login (evidence: `natives/pcbu-ssh-askpass/src/main.cpp`)
- SSH askpass → Paired devices: filters devices (evidence: `natives/pcbu-ssh-askpass/src/main.cpp`)
- SSH askpass → Cryptography: decrypts SSH secret (evidence: `natives/pcbu-ssh-askpass/src/main.cpp`)
- PAM module → PAM authentication: supports PAM flow
- Desktop interface → App settings: configures app
- Desktop interface → Paired devices: manages pairings
- Desktop interface → Service installer: configures service
- Desktop interface → Logging system: views logs
- Service installer → Privileged shell: runs system actions (evidence: `desktop/src/installer/ServiceInstaller.Linux.cpp`)
- Privileged shell → Elevator service: dispatches privileged work
- PC user → Wake-on-LAN: may wake PC
- Unlock handler → App settings: reads configuration (evidence: `common/src/handler/UnlockHandler.cpp`)
