Where Cuewire keeps your keys, and what 0.1.27 fixes on Linux
Cuewire keeps a few secrets for you: your sign-in, your sync code, your phone pairings and the API keys you give agent accounts. All of them live in your system's keychain. This post says what that means, what went wrong on Linux up to 0.1.26, and what changes in 0.1.27.
0.1.27 is not out yet. The current version is 0.1.26. Everything under "Coming in 0.1.27" below is finished, merged and covered by automated tests, and arrives with that version. The rest describes Cuewire as it is today.
What Cuewire keeps, and where
Four kinds of secret:
- Your sign-in. When you sign in for a paid plan, the Cuewire service gives this computer a session. Cuewire keeps it in the keychain. The service keeps only a scrambled form of it (a hash).
- Your sync code. Settings sync encrypts your settings on your computer with it. The service stores only the encrypted copies and never sees the code.
- Phone pairings. Each phone or browser you pair shares a secret with this computer, and Cuewire has one more key for notifications. The relay in between passes messages on without being able to read them.
- Agent account keys. The API keys of a key pool, and the token of another endpoint. They go only into the environment of the agent that uses them, when it starts, and they never sync.
The keychain is Credential Manager on Windows and the Keychain on a Mac. On Linux it is the Secret Service, usually GNOME Keyring or KWallet. None of these secrets is ever written to a file.
That last rule has no exception. A keychain encrypts what it keeps, locks with your login, and is what the rest of your system already trusts with passwords. A file in Cuewire's data folder would sit on disk unencrypted, and be copied by backups and sync tools. So when there is no keychain, Cuewire says so instead of falling back to a file. Everything that needs no secret from Cuewire keeps working: canvases, notes, the Free plan, and agents that sign in with their own login. Each agent keeps that login itself, and on Linux some agents use the keychain for it too.
What went wrong on Linux, up to 0.1.26
Windows and macOS always have a keychain, ready when you log in, so Windows and Mac users were practically never affected by any of this. On Linux the keychain is a separate program, and sometimes it isn't there: on a minimal or tiling window manager, on some remote desktops, in WSLg or in a container. Or it is there, but starts after Cuewire, or is still locked.
In 0.1.26 and earlier, that went badly:
- Missing until a restart. If the keychain wasn't ready when Cuewire started, Cuewire treated it as missing until you restarted Cuewire, even after you had started or unlocked it.
- Sign-in failed late. You typed your email, got the code by email and typed it in. Only then did Cuewire fail, with the library's raw message: "No default store has been set, so cannot search or create entries". The code was used up, and nothing said what to install.
- A noisy log. The check for your organisation's shared roles and arrangements, which runs every minute, logged a warning each time.
- A short failure could become a lasting one. If a phone pairing's secret couldn't be read at start, Cuewire dropped the pairing, and the next change to your pairings removed it from the list for good. If the notification key couldn't be read, Cuewire made a new one, which cut off the browsers already subscribed. Settings sync showed as off until you restarted.
- Prompts and a frozen window. With a locked keyring, work in the background, such as the check for your organisation's documents and settings sync, could pop up the keyring's unlock dialog. And Cuewire used the keychain on the window's own thread: when the window opened, while the sync sheet was shown, when an agent on an account started, and when you turned sync on, paired a phone or added an agent account. A locked or slow keyring froze the window until you answered, or for good if it never answered.
Coming in 0.1.27
It says what's wrong, before a code is sent
When you click Email me a code, Cuewire checks the keychain first. If there is no Secret Service, the sign-in sheet says:
Signing in needs the system keychain: no Secret Service is running (install and unlock GNOME Keyring or KWallet): …
followed by what actually went wrong, for example that there was no session bus. If the keyring is locked, it says "it is locked: unlock it (for example in Passwords and Keys, or KWallet), then try again". No code is sent, so none is wasted. The log says the same thing once, not every minute.
No restart needed
Cuewire now opens the keychain itself. While it can't, it tries again: at most once a minute in the background, and at once when you click Email me a code. Start GNOME Keyring, or unlock it, and Cuewire finds it.
A locked keyring waits for you
Work that runs in the background asks whether the keyring is locked before reading from it. That covers your organisation's documents, settings sync, phone pairings and the account panel. While the keyring is locked, that work waits for you to unlock it instead of showing a dialog you didn't ask for. Signing in, turning sync on or off, pairing or unpairing a phone, adding or removing an agent account and starting an agent on one don't show it either: they say "unlock it, then try again".
Nothing is lost while the keychain isn't ready
- A pairing whose secret can't be read yet stays, listed as offline, and connects once it can be read.
- The notification key is made only when there surely is none.
- Settings sync waits for its key instead of looking off, and turning sync on can't replace a key that is only unreadable for now.
- The account panel doesn't show you as signed out just because the keychain hasn't answered yet.
Nothing keychain-related freezes the window
Opening Cuewire and its sheets no longer reads the keychain on the window's thread. Turning sync on or off, pairing or unpairing a phone, adding or removing an agent account, and starting an agent on an account all wait for the keychain in the background. Meanwhile the sheet says Turning sync on…, Pairing…, Adding… or Removing…. If the keychain refuses a change, what you had stays as it was (removing a key pool can stop partway; remove it again), and Cuewire tells you why.
An agent that uses a saved key shows Waiting: reading its key from the keychain… and starts by itself once the key is read. A restart, or a move to the next key of a pool, keeps the old program running until the new key is in, and then swaps them. If the key can't be read, the old program keeps running, Cuewire says why, and the agent and key it shows are the ones actually running.
Your existing secrets stay where they are
0.1.27 opens the keychain itself, instead of letting the keychain library open it once at start and keep any failure, but underneath it uses the same keychain code, and it names every entry exactly as 0.1.26 did. Upgrading won't sign you out, or forget your sync code, a pairing or an API key.
We checked this against real keychains on all three systems: Credential Manager on Windows, the login keychain on a Mac, and GNOME Keyring on Linux. Entries written the way 0.1.26 writes them are found and removed by the new code, and entries the new code writes are found the old way.
If you use Linux
- Have a keyring running and unlocked in the session where Cuewire runs: GNOME Keyring or KWallet. Most desktops start one and unlock it when you log in. On a minimal window manager, a remote desktop, WSLg or in a container, check that yours does.
- Without one, Cuewire tells you when you try to sign in, and what is missing. Everything that needs no secret still works.
- Only the computer running the app needs a keychain. An agent on an attached SSH machine or WSL distribution, or in a remote project, gets its key from this computer: Cuewire sends it with the request to start the agent, over its own connection to that machine (SSH, or WSL's), and Cuewire's server there gives it to the agent. It is not saved there.
- Started or unlocked it late? In 0.1.27, do nothing: Cuewire finds it within a minute, or at once when you click Email me a code. In 0.1.26, restart Cuewire.
Limits
- No keychain, no secrets. Without one, you can't sign in to a paid plan, sync settings, pair a phone or keep API keys for agent accounts on that computer. That is on purpose: see above for why there is no file fallback.
- The locked check is a good sign, not a promise. Cuewire asks whether your default keyring is locked. If its entries are in another keyring, for example because you made a different keyring the default after they were saved, and that one is locked, reading may still ask you to unlock it.
- A keychain that never answers. If the keyring program hangs while Cuewire is first connecting to it, the others waiting for it give up after 10 seconds and say "the keychain did not answer within 10 s; restart Cuewire if this lasts". If it hangs later, keychain work waits until it answers: sign-in, sync, pairings and agent keys stay pending. The window keeps working meanwhile; restart the keyring, or Cuewire.
- Windows and macOS. Nothing changes you would notice, apart from the new pending lines, which you will rarely see there because those keychains answer at once. On a Mac, macOS may ask once after the update whether Cuewire may use what it keeps in your keychain, as after every Cuewire update so far: Cuewire for Mac isn't notarized yet, so macOS treats each version as a new program. Click Always Allow.
Read more
The manual describes each part: Sign in, Settings sync, the companion, agent accounts and key pools, and privacy. Cuewire 0.1.26 is on the download page. When 0.1.27 is out, the changelog lists these changes.