Allow sync vault even while locked (Desktop)

Overview

I’d like the desktop app to sync even while locked, both manually and automatically.

Context

I’m trying to write a script which regularly copies the desktop’s encrypted data file (from %AppData%\Bitwarden\data.json to a backup folder.

The desktop app updates its data.json every 30 minutes. However, while the vault is locked the actual vault data doesn’t get synced. I can tell this by looking at the lastSync date.

Issue

I don’t want to keep the desktop app unlocked all the time on my computer, so I’d like the vault sync to happen regularly even while it’s locked.

Precedent

This pull request added similar functionality to the CLI:

Proposed fix

Manual sync

This is easily done by updating menu.file.ts to check if there any authenticated accounts, rather than checking the lock state.

I tried it out locally and the sync works fine, even while locked:

I can create a PR for this part.

Automatic sync

After some more testing it looks like sync does work while locked, it’s just every 6 hours (which is fine by me).

Still creating this feature request for the manual sync part, as I don’t see any reason that shouldn’t be enabled. Also in case I misunderstood the automatic sync and it doesn’t actually work.

Filed a pull request for the manual sync: [desktop] Allow manual sync while locked by davidtorosyan · Pull Request #6126 · bitwarden/clients · GitHub