How end-to-end encrypted vault sync works in Kubexer Terminal, and what the server can see
Every SSH client that syncs your hosts across machines asks you to trust it with the most sensitive files you own: private keys, passwords, the list of every server you can reach. "It is encrypted" is not an answer. This post explains how Kubexer Terminal's vault sync is built, in enough detail that you can decide for yourself, including the parts that are not encrypted.
Vault sync is a Pro feature. Vaults themselves, and the encryption described below, are free and work entirely on your device.
What a vault holds
A connection vault is a named, password-protected container. It holds hosts (with their known host keys), identities (usernames with a password, private key, passphrase or certificate), groups, port forwards and access profiles. You can have several, for example one for work and one for personal servers, each with its own password.
Some things are deliberately not in a vault. Shell history is not. Command snippets sync separately and are plain text on the server by default, unless you choose one vault as the snippets vault, in which case their name, description and body are encrypted with that vault's key. Themes and highlight rules sync with your account settings.
The key hierarchy
Each vault uses envelope encryption, so the password protects a key and the key protects the data:
- When you create a vault, the app generates a random 32-byte data key. Every record in the vault is encrypted with it.
- Your vault password is run through scrypt with a random 16-byte salt and parameters N=217, r=8, p=1, which costs about 128 MiB of memory per attempt. The result is a key-encryption key.
- The data key is encrypted ("wrapped") with the key-encryption key.
Records and the wrapped key use AES-256-GCM with a fresh 12-byte random IV and a 16-byte authentication tag. There is no password hash stored anywhere. A wrong password is detected because the GCM tag fails when the app tries to unwrap the data key.
This split has a practical benefit: changing a vault password only re-wraps the data key. Nothing else has to be re-encrypted.
The recovery key
At creation the app also shows a recovery key: 32 random bytes written as groups of base32 characters. A second copy of the data key is wrapped with a key derived from it through HKDF-SHA256. The recovery key is shown once and never stored. If you lose both the password and the recovery key, the vault cannot be decrypted by anyone, including us. Write it down somewhere that is not the vault itself.
Where the crypto runs
Encryption and decryption happen in the app's main process. Your password and the data key never cross into the user interface. SSH credentials are resolved in the main process when a connection opens and stay there.
What the server stores
When you turn on Cloud sync for a vault, the server receives:
- For the vault: an identifier, the vault name, the salt, the scrypt parameters, and the two wrapped copies of the data key.
- For each record: an identifier, the encrypted content, and a fingerprint, which is an HMAC-SHA256 keyed by the data key so the app can detect changes without the server learning anything.
It never receives your password, the data key or the key-encryption key. The contents of every host, identity and forward are ciphertext.
What is not encrypted, stated plainly: the vault name, the identifiers of vaults and records, how many records there are, their sizes and when they changed. If the name of a vault would itself leak something, name it accordingly.
There is one more defence worth mentioning. A malicious or compromised server could try to send back weakened scrypt parameters so that a later password check is cheap to brute-force, or absurd ones to exhaust your memory. The app validates the parameters it reads: N must be a power of two between 214 and 220, r between 1 and 16, p between 1 and 4, and memory at most 256 MiB.
Adding a second device
There is no QR pairing and no device-to-device key exchange. Access is simply your account plus the vault password:
- Sign in to Kubexer Terminal on the new machine with the same account.
- Sync pulls each synced vault's metadata. The vaults appear on Home, locked. Their contents stay ciphertext until you unlock them.
- Unlock with the vault password, or choose Use recovery key instead.
Your account allows three desktop devices per product, and separately three mobile devices, so a laptop, a desktop and a work machine can all carry the same vaults. The limit is checked when you sign in.
Once unlocked, the data key is kept on that machine, wrapped by the operating system's secure storage, so the vault opens again on the next launch. Lock removes it. On a Linux desktop without a keyring service the vault still unlocks for the session but will not reopen itself after a restart.
When sync runs and how conflicts resolve
Sync runs when the app starts, when you turn it on for a vault, when you press Sync on Home or Sync now in the vault settings, and after local changes are written. Each pass pushes local changes first, then pulls.
Conflicts resolve per record, last writer wins. If you edit host A on your laptop and host B on your desktop, both edits survive, because they are different records. If you edit the same host on two devices before either syncs, the later write wins; there is no field-level merge and no version history. Deletions travel as tombstones, so a host deleted on one machine disappears on the others.
Sync fails open. If the service is unreachable you keep working; the app reports "Couldn't reach the sync service. Your vaults are safe on this device and will upload when the connection returns."
Turning sync off
Turning off Cloud sync for a vault deletes the cloud copy. The vault stays on this device. Other devices treat it as deleted elsewhere and remove their copy on the next sync, losing any changes they had not uploaded, which is why the app asks you to confirm. Turning sync back on uploads it again.
If your plan lapses, uploads stop (and the server refuses them too), but downloads and deletes keep working, so you can still pull your data down and clean up. Local vaults keep working without a plan.
What this design does not protect against
- A weak vault password. scrypt makes guessing expensive, not impossible.
- Malware on an unlocked machine, which can read what the app can read.
- Metadata: names, counts, sizes and timing, as listed above.
Try it
Create a vault in Kubexer Terminal, save the recovery key, and turn on Cloud sync in the vault settings. For how vaults protect data on a single machine, see encrypted SSH connection vaults.