Skip to content
markksantosPublic

Repository files navigation

🔒 Deadbolt

Lock any macOS app behind Touch ID -- instantly, silently, no content flash.

Swift SwiftUI macOS License


Features

  • Instant App Hiding -- Protected apps are hidden synchronously the moment they activate, before any content is rendered on screen
  • Touch ID Authentication -- Biometric unlock via LAContext with automatic fallback to master password
  • Session Modes -- Three unlock behaviors per app: Every Time, Once Per Session, or Timed (configurable timeout)
  • Emergency Lock -- Cmd+Shift+L instantly locks and hides all protected apps system-wide
  • Auto-Lock -- Automatically re-locks all apps on screen sleep, system sleep, and screen lock
  • Menu Bar App -- Lives in the status bar with no Dock icon, stays out of your way
  • App Picker -- Add protection from running apps or browse /Applications with NSOpenPanel
  • Activity Log -- SQLite-backed log of every auth attempt with app name, method, and success/failure
  • Keychain Storage -- Master password stored as a salted SHA-256 hash via the system Keychain
  • Launch at Login -- Native SMAppService integration for auto-start

Getting Started

Prerequisites

  • macOS 13.0 or later
  • Xcode 15+ or Swift 5.9+ toolchain

Install from Source

git clone https://github.com/markksantos/Deadbolt.git
cd Deadbolt
swift build
swift run DeadboltApp

Build a standalone .app bundle

make bundle        # release build, embeds the icon, ad-hoc code-signs
open Deadbolt.app

The default make bundle produces an ad-hoc–signed app with the Hardened Runtime enabled — fine for running on your own Mac (you may need to right-click > Open the first time). For a distributable build, sign with a Developer ID and notarize:

# 1) Sign with your Developer ID
make bundle SIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)"

# 2) Store a notarytool profile once
xcrun notarytool store-credentials deadbolt-notary \
    --apple-id [email protected] --team-id TEAMID --password APP_SPECIFIC_PW

# 3) Notarize + staple
make notarize SIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)"

Deadbolt is intentionally not App-Sandboxed — hiding and observing other applications is forbidden inside the sandbox — so it cannot ship on the Mac App Store as-is. Distribute it as a notarized direct download.

The app icon lives at Resources/AppIcon.icns and is generated from scripts/generate-icon.swift; regenerate it with make icon.

Permissions

Detecting app activations (NSWorkspace notifications) and hiding apps (NSRunningApplication.hide()) do not require Accessibility access, so auto-lock works the moment you launch.

The one feature that needs Accessibility is the global emergency hotkey (Cmd+Shift+L): system-wide keyboard monitoring is only delivered to apps the user has trusted. Grant it once:

  1. Open System Settings > Privacy & Security > Accessibility
  2. Enable Deadbolt in the list

Without it, every other feature still works — only the global hotkey is inert (you can still use Lock All from the menu).

Other system prompts you may see:

  • Touch ID / password — the first time an app activation triggers a lock, macOS shows the native biometric sheet (governed by NSFaceIDUsageDescription).
  • Keychain — the master-password hash is stored in your login Keychain.

Testing

Run the engine unit tests:

swift test

Manual Smoke-Test Checklist

# Test Expected Result
1 Launch Deadbolt Lock shield icon appears in menu bar, no Dock icon
2 Click menu bar icon Popover opens with "No Protected Apps" empty state
3 Click "+" in popover footer AppPickerView slides in showing running apps
4 Add a running app (e.g. Safari) App appears in list with green checkmark, button replaced
5 Change session mode to "Once Per Session" Dot turns blue, mode persists after lock/unlock
6 Lock All (popover footer) All protected apps immediately hide
7 Activate a protected app App hides instantly, Touch ID prompt appears
8 Enter correct master password App unlocks and becomes frontmost
9 Enter wrong password 5 times App stays locked, "Too many attempts" message shown
10 Cmd+Shift+L hotkey All protected apps lock and hide instantly
11 Lock the Mac (Ctrl+Cmd+Q) On unlock, all protected apps re-lock
12 Settings > Activity Log tab Shows auth attempts with timestamp and method
13 Quit Deadbolt (menu bar > Quit) All services stop cleanly, no crash

How It Works

Write-up: Hide a macOS app the moment it activates, then ask for Touch ID — how the hide-then-authenticate flow works, and what it can't guarantee.

Tech Stack

Component Technology
Language Swift 5.9
UI Framework SwiftUI + AppKit
Architecture MVVM (3-target SPM package)
Auth LocalAuthentication (Touch ID)
Storage UserDefaults, Keychain (SecItem)
Database SQLite.swift 0.16.0
Build Swift Package Manager + Makefile

Project Structure

Deadbolt/
├── Package.swift
├── Makefile
├── LICENSE
├── .github/workflows/        # CI (build + test) and tagged Release (zip)
├── scripts/
│     └── generate-icon.swift
├── Resources/
│     ├── Info.plist
│     ├── Deadbolt.entitlements
│     └── AppIcon.icns
├── Sources/
│     ├── DeadboltApp/
│     │     ├── main.swift
│     │     └── AppDelegate.swift
│     ├── DeadboltEngine/
│     │     ├── Models/
│     │     │     ├── ActivityRecord.swift
│     │     │     ├── ProtectedApp.swift
│     │     │     ├── SessionMode.swift
│     │     │     └── UnlockState.swift
│     │     └── Services/
│     │         ├── ActivityLogger.swift
│     │         ├── AppWatcher.swift
│     │         ├── AuthManager.swift
│     │         ├── AutoLockMonitor.swift
│     │         ├── GlobalHotkeyManager.swift
│     │         ├── KeychainManager.swift
│     │         ├── ProtectedAppStore.swift
│     │         ├── SessionManager.swift
│     │         └── WindowHider.swift
│     └── DeadboltUI/
│         ├── ViewModels/
│         │     ├── ActivityLogViewModel.swift
│         │     ├── PopoverViewModel.swift
│         │     └── SettingsViewModel.swift
│         └── Views/
│             ├── ActivityLogView.swift
│             ├── AppPickerView.swift
│             ├── AuthPromptWindow.swift
│             ├── MenuBarPopover.swift
│             ├── ProtectedAppsList.swift
│             └── SettingsView.swift
└── Tests/
     └── DeadboltEngineTests/
         ├── ProtectedAppStoreTests.swift
         └── SessionManagerTests.swift

License

MIT License (C) 2026 Mark Santos


Built with heart by NoSleepLab

Deadbolt icon

**Lock any macOS app behind Touch ID — instantly, silently, no content flash.** [Features](#features) · [Getting Started](#getting-started) · [Tech Stack](#tech-stack) - **Instant App Hiding** — Protected apps are hidden synchronously the moment they activate, before any content is rendered on screen - **Touch ID Authentication** — Biometric unlock via LAContext with automatic fallback to master password - **Session Modes** — Three unlock behaviors per app: Every Time, Once Per Session, or Timed (configurable timeout) - **Emergency Lock** — `Cmd+Shift+L` instantly locks and hides all protected apps system-wide - **Auto-Lock** — Automatically re-locks all apps on screen sleep, system sleep, and screen lock - **Menu Bar App** — Lives in the status bar with no Dock icon, stays out of your way - **App Picker** — Add protection from running apps or browse `/Applications` with NSOpenPanel - **Activity Log** — SQLite-backed log of every auth attempt with app name, method, and success/failure - **Keychain Storage** — Master password stored as a salted SHA-256 hash via the system Keychain - **Launch at Login** — Native SMAppService integration for auto-start ### Installation To build a standalone `.app` bundle: Deadbolt will prompt for the following on first use: - **Accessibility** — Required to detect app activations and hide windows - **Touch ID** — Used for biometric authentication │ └── Info.plist │ ├── DeadboltApp/ │ │ ├── main.swift │ │ └── AppDelegate.swift │ ├── DeadboltEngine/ │ │ ├── Models/ │ │ │ ├── ActivityRecord.swift │ │ │ ├── ProtectedApp.swift │ │ │ ├── SessionMode.swift │ │ │ └── UnlockState.swift │ │ └── Services/ │ │ ├── ActivityLogger.swift │ │ ├── AppWatcher.swift │ │ ├── AuthManager.swift │ │ ├── AutoLockMonitor.swift │ │ ├── GlobalHotkeyManager.swift │ │ ├── KeychainManager.swift │ │ ├── ProtectedAppStore.swift │ │ ├── SessionManager.swift │ │ └── WindowHider.swift │ └── DeadboltUI/ │ ├── ViewModels/ │ │ ├── ActivityLogViewModel.swift │ │ ├── PopoverViewModel.swift │ │ └── SettingsViewModel.swift │ └── Views/ │ ├── ActivityLogView.swift │ ├── AppPickerView.swift │ ├── AuthPromptWindow.swift │ ├── MenuBarPopover.swift │ ├── ProtectedAppsList.swift │ └── SettingsView.swift └── DeadboltEngineTests/ ├── ProtectedAppStoreTests.swift └── SessionManagerTests.swift MIT License © 2026 Mark Santos Built with ❤️ by [NoSleepLab](https://nosleeplab.com)

Releases

Packages

Contributors

Languages