BitwardenBar is a macOS menu bar client for Bitwarden built in Swift. The active implementation lives in the BitwardenBar/ Swift package, which exposes a reusable BitwardenBar library and a thin BitwardenBarStandalone executable that launches the shared AppKit delegate.
This workspace also contains a small Xcode host app, OpenSpec change artifacts, and large upstream Bitwarden reference repos used to confirm protocol details. In normal development, you should expect to edit BitwardenBar/ and treat references/ as documentation.
BitwardenBar/: main app code, Swift package manifest, tests, and the standalone executable target.BitwardenBarApp/: thin Xcode host app that embeds the sharedBitwardenBarlibrary via@NSApplicationDelegateAdaptor.openspec/: capability specs and change artifacts for planned or in-progress work.references/clients/: official Bitwarden TypeScript clients for request, response, and protocol verification.references/ios/: official Bitwarden iOS codebase for Swift-side modeling and behavior checks.
The current codebase is organized around a menu bar workflow:
- authenticate against Bitwarden using the identity and API services
- support two-step login and session unlock flows
- decrypt and cache vault data locally
- present vault items in a popover UI
- expose app settings, including global shortcut configuration
The app uses:
- AppKit
NSStatusItemandNSPopoverfor the menu bar shell - SwiftUI for login, unlock, vault, and settings screens
- pure Swift crypto for Bitwarden key derivation and decryption
- GRDB for the local SQLite-backed vault cache
- Keychain and
UserDefaultsfor persisted account and credential state
- macOS 13 or newer
- Xcode 26+ with Swift 5.9 toolchain support
From BitwardenBar/:
swift build
swift testTo launch the standalone package executable (no .app bundle):
cd BitwardenBar
swift run BitwardenBarStandaloneOpen BitwardenBarApp/BitwardenBarApp.xcodeproj in Xcode and run the BitwardenBarApp target. The host app reuses the same BitwardenBarAppDelegate implementation as the standalone executable.
The Xcode project includes an Embed Native Messaging Host build phase that automatically builds BitwardenBrowserHost and BitwardenBrowserHostWrapper via swift build and copies them into .app/Contents/MacOS/. No manual steps are needed.
The app is distributed unsigned. Users download the .app bundle and run xattr -cr to bypass Gatekeeper.
cd BitwardenBarApp
./build-release.shThis script will:
- Build the app in Release configuration via
xcodebuild - Verify that
BitwardenBrowserHostandBitwardenBrowserHostWrapperare embedded in the bundle - Create a ZIP archive (
BitwardenBarApp-YYYYMMDD.zip)
- Xcode → Product → Archive
- Right-click the archive in Organizer → Show in Finder
- Copy
BitwardenBarApp.appfrom the archive'sProducts/Applications/directory - Zip it for distribution:
ditto -c -k --keepParent BitwardenBarApp.app BitwardenBarApp.zip
After downloading the ZIP and extracting:
xattr -cr BitwardenBarApp.app
open BitwardenBarApp.appThe first launch will install native messaging manifests for all detected browsers automatically. No additional configuration is needed.
BitwardenBar integrates with browser extensions via the native messaging protocol. The app bundles two helper executables:
BitwardenBrowserHost: the native messaging host that communicates with browser extensions via stdioBitwardenBrowserHostWrapper: a thin wrapper around the host for debugging and environment setup
When the app launches, BrowserManifestInstaller writes manifest JSON files to each browser's NativeMessagingHosts directory. The manifest contains an absolute path pointing to BitwardenBrowserHost inside the running app bundle:
/path/to/BitwardenBarApp.app/Contents/MacOS/BitwardenBrowserHost
The path is resolved automatically at runtime — no manual configuration is needed. If you move the app to a different location, simply relaunch it and the manifests will be updated.
- Google Chrome (stable, Beta, Dev, Canary)
- Mozilla Firefox
- Microsoft Edge (stable, Beta, Dev, Canary)
- Chromium
- Vivaldi
- Zen Browser
- Helium
During development, you can override the host binary path with the BWB_BROWSER_HOST_PATH environment variable:
BWB_BROWSER_HOST_PATH=/path/to/BitwardenBrowserHost open BitwardenBarApp.appThe wrapper executable also supports BWB_REAL_BROWSER_HOST_PATH to point to a specific BitwardenBrowserHost binary.
BitwardenBar/Sources/BitwardenBar/App/: app delegate, menu bar controller, service wiring, app state, and hotkey registrationBitwardenBar/Sources/BitwardenBar/Core/Auth/: Bitwarden login and token flowBitwardenBar/Sources/BitwardenBar/Core/Network/: request building and API communicationBitwardenBar/Sources/BitwardenBar/Core/Crypto/: key derivation and decryption primitivesBitwardenBar/Sources/BitwardenBar/Core/Vault/: sync and vault processingBitwardenBar/Sources/BitwardenBar/Core/Storage/: account state, keychain, hotkey settings, and cached vault storageBitwardenBar/Sources/BitwardenBar/UI/: login, unlock, vault, root, and settings views
BitwardenBar/Sources/BitwardenBarStandalone/main.swift: standalone executable entry pointBitwardenBar/Sources/BitwardenBar/App/AppDelegate.swift: shared AppKit lifecycle entry used by both the standalone target and the Xcode host appBitwardenBarApp/BitwardenBarApp/BitwardenBarAppApp.swift: thin SwiftUI app wrapper around the shared delegate
Unit tests live in BitwardenBar/Tests/BitwardenBarTests/ and currently cover core areas such as auth, crypto, cipher handling, TOTP, and hotkey settings.
- The active package product is
BitwardenBar; the Xcode host app should stay thin. setup.shexists to clone and patch a vendoredsdk-swiftcopy for reference use. The current app does not depend on that SDK at runtime.references/is intentionally large and should usually be treated as read-only support material.openspec/documents capability specs and change history for features such as desktop auth sessions, global shortcuts, and vault detail presentation.
BitwardenBar/Sources/BitwardenBar/App/StatusBarController.swift: popover lifecycle and menu bar behaviorBitwardenBar/Sources/BitwardenBar/App/ServiceContainer.swift: application wiring and service constructionBitwardenBar/Sources/BitwardenBar/Core/Auth/AuthService.swift: login, token, and profile flowBitwardenBar/Sources/BitwardenBar/Core/Crypto/BWCrypto.swift: Bitwarden cryptography primitivesBitwardenBar/Sources/BitwardenBar/Core/Vault/SyncService.swift: vault sync and decryption pipelineBitwardenBar/Sources/BitwardenBar/UI/Auth/LoginView.swift: login and two-factor UI flowBitwardenBar/Sources/BitwardenBar/UI/Vault/VaultRootView.swift: top-level vault presentation
- Make changes in
BitwardenBar/first. - Use
swift buildorswift testfromBitwardenBar/for quick validation. - Cross-check protocol-sensitive changes against
references/clients/andreferences/ios/before changing auth or crypto behavior. - Update or consult
openspec/when a change affects documented capabilities or active work items.
BitwardenBar references and draws inspiration from the following official Bitwarden open source projects:
- bitwarden/ios — official Bitwarden iOS client, used as reference for Swift-side modeling and behavior.
- bitwarden/clients — official Bitwarden TypeScript clients, used for request, response, and protocol verification.
This project is licensed under the GNU General Public License v3.0.