Skip to main content

Security

How Garnet Sync keeps your notes private

Garnet Sync encrypts your files on your device before they upload, and decrypts them on your other devices. This page describes the design: what is used, which keys exist, what Garnet's servers can see, and where the protection stops.

The short version

Files in your Space are ordinary local files, and Garnet does not encrypt them. When you turn on sync, each file is encrypted on your device with keys that never reach Garnet in a form that opens them. Garnet's servers keep encrypted files and locked copies of those keys. Garnet cannot read your notes, and cannot recover your passphrase or recovery key for you.

Some of the steps below, such as setting up sync without a passphrase, approving a device, removing a device, Start fresh, passkey unlock, a recovery contact and a recovery key copy in iCloud Keychain, are rolling out in stages, so your app may not show all of them yet. For a plainer account, read How encryption works in the Help Center.

What is used

  • Passphrase to key: Argon2id. Today's settings are 64 MiB of memory, 3 iterations and 1 lane, with a random 16-byte salt and a 32-byte result. Each stored key records the settings it was made with, so raising them later never locks out an older key. After a successful unlock of a weaker one, the app upgrades it.
  • Encryption and key wrapping: AES-256-GCM, with a 12-byte random nonce and a 128-bit tag. Each wrap is bound to its purpose and to your Account, so a wrapped key cannot be reused for something else.
  • Key derivation from a shared secret: HKDF-SHA256.
  • Approving a new device: ECDH on curve P-256, with a six-digit code both devices compute.
  • Versioned. Your stored key bundle records its crypto version. An older app refuses a bundle with a newer version instead of rewriting it.

These are standard algorithms from the browser's Web Crypto API, plus an Argon2id implementation that runs on your device.

The keys

  • Passphrase key. Made on your device from your passphrase with Argon2id. It opens the Account Key. A passphrase is optional when your devices can approve each other.
  • Account Key. A random 256-bit key. It opens the Space Keys. Garnet stores it only locked: under your recovery key, and under your passphrase key if you set one. While you approve a new device, the server also briefly holds an approval: the Account Key wrapped for that device, which the server cannot open, until the device takes it or the request expires.
  • Recovery key. A random 256-bit key, shown once in your Recovery Kit. It opens the Account Key if you lose your passphrase. Garnet never receives it.
  • Space Keys. One random key per synced Space, stored locked under the Account Key. Each file is encrypted with its own random key, which the Space Key locks. When you replace your keys, a Space gets a new Space Key generation, and files are tried against the newest key first.
  • Passkey key (rolling out). If you add a passkey for unlocking, your device asks the passkey for a WebAuthn PRF secret, derives a key from it with HKDF-SHA256, and wraps the Account Key with it. The PRF secret never leaves your device. A passkey here unlocks sync only; it does not sign you in.
  • Recovery contact shares (rolling out). If you set up a recovery contact, your device makes two random 32-byte shares and wraps the Account Key under a key derived from both with HKDF-SHA256. Garnet keeps one share, the server share. The other becomes the contact code you give to someone you trust, and Garnet never receives it. Neither share opens anything alone.
  • Recovery key copy in iCloud Keychain (rolling out). On iPhone and iPad you can choose to keep a copy of your recovery key in your own iCloud Keychain, which Apple syncs to your Apple devices. It is off unless you turn it on, and Garnet never receives it.
  • Device keys. A device that keeps the Account Key does so in the operating system's key store where it has one. Where the app has no key store, the key stays in memory and you unlock again after a restart.

Your passphrase, recovery key, Account Key and Space Keys are never sent to Garnet, never written to logs or error reports, and never part of analytics. Garnet's tests run the whole key lifecycle against a test server and fail if any of them shows up in a request, a log line or an error report.

Adding a new device

A new device signs in, then asks a device you already use to hand it the Account Key. Nothing is typed. The exchange is built so that Garnet's servers, which relay it, cannot slip in their own key unnoticed:

  1. The new device makes a one-time ECDH P-256 key pair that lives in memory only, and a random 32-byte nonce. It sends its public key and a SHA-256 commitment to the nonce, never the nonce.
  2. A device that is signed in and unlocked makes its own one-time key pair and nonce and answers.
  3. Only now does the new device reveal its nonce. Both devices work out the same six-digit code from the request, both public keys and both nonces.
  4. You compare the codes on the two screens and tap Approve on the unlocked device. If a typed code differs, the request is refused.
  5. The unlocked device derives a wrapping key with ECDH and HKDF-SHA256, wraps the Account Key with it using AES-256-GCM, and sends only that wrapped key. The new device unwraps it and checks it against the key check stored with your keys.

Each side commits to its nonce before it sees the other's, so a substituted key would show a matching code only by chance, about one in a million per request, and a request works once. A request lasts 10 minutes, and the server deletes the wrapped key as soon as the new device takes it. The new device can also unlock with your passphrase or recovery key.

What Garnet's servers store and see

Encrypted on your device before upload: the contents of every synced file, the list of your files with their paths, sizes and times, each Space's name, and the keys themselves, which Garnet only holds locked.

Visible to Garnet:

  • your Account: its email address, plan, signed-in devices with their labels, and security events with their times
  • that you use Garnet Sync, when your keys last changed, and the settings the keys were made with
  • how many Spaces you sync, each under a random id, and when each was added and last changed
  • for each encrypted file: its size, a SHA-256 of the encrypted bytes, and when it was uploaded, replaced or deleted, so how many files each Space holds and how much storage you use
  • while you approve a device: its label, one-time public keys and nonces, for at most 10 minutes plus the next daily clean-up
  • for each passkey you add for unlocking: its label, its WebAuthn credential id, its PRF salt, the Account Key wrapped under it, and when it was added and last used
  • for a recovery contact: the name you typed, if any, the server share, the Account Key wrapped under both shares, and the times and state of each recovery request
  • the one-time step-up codes Garnet emails you, stored only as hashes until they expire
  • for each request, the IP address, app details and time, as in any service log

Not visible: what your files say, readable file and folder names, Space names, note titles, your passphrase, your recovery key, and every unlocked key.

One limit applies today. Each synced file is stored under an unkeyed SHA-256 fingerprint of its path in the Space, the same for the same path in every Account. Nobody can read a path from it, but whoever runs the servers can check a guessed one, such as whether a file at People/Anna.md exists. We plan to replace it with a keyed fingerprint; until it ships, this limit stands.

Getting back in

  • Your passphrase, if you set one. It must be at least 12 characters and not a common one.
  • Another device. Approve the new device from one that is signed in and unlocked, as above.
  • Your recovery key. It opens the Account Key without the passphrase. You can replace it in Settings, and the old key stops working at once.
  • A passkey (rolling out), if you added one on a device that was unlocked. It unlocks with no passphrase or recovery key. Replacing your keys after a device removal deletes every passkey entry, so you add them again.
  • Your recovery contact (rolling out). From a signed-in device you start a recovery. It waits 72 hours, during which Garnet emails you and your other signed-in devices show it, and any of them can cancel it. After the wait your contact reads you the code, and your device opens the Account Key with it and the server share.
  • The copy in iCloud Keychain (rolling out), if you turned it on. It works like typing your recovery key.
  • Start fresh, when you have none of these but still have your Space's files on a device. It deletes the synced copy and its keys, and syncs the Space again from your files under new keys. Your local files are never changed. After a recent password reset it waits 24 hours. Garnet emails you when it is requested and when it finishes, and any signed-in device can cancel it while it waits.

Some changes ask for a step-up first: your two-factor code, or, when two-factor is off, a one-time code emailed to you. They are Start fresh, removing a device, setting up, replacing or removing a recovery contact, cancelling a recovery another device started, and changing your passphrase or recovering with your recovery key. Starting a recovery with your contact needs none, because the device asking has lost its keys, not its sign-in.

If you lose your passphrase, your recovery key, every passkey, your recovery contact and every unlocked device, nobody can open the synced copy, including Garnet. Start fresh is then the way forward, and the old synced copy is gone.

Removing a device

Settings lists the devices signed in to your Account. From another unlocked device you can remove one. That ends its session at once, so it can download nothing more. Removing a device asks for a step-up first: your two-factor code, or a one-time code emailed to you when two-factor is off.

For a lost or stolen device you can also replace your keys in the same step. Garnet makes a new Account Key and a new recovery key, and adds a new Space Key generation for each Space. Whatever you sync afterwards is encrypted under keys the removed device never held. Your other devices ask you to unlock again. Files that were already synced stay under the keys they were written with, and the removed device already had them.

Every change to who can open your synced Spaces, such as a new passphrase, a new recovery key, an approved device or a removed one, an added or removed passkey, or a recovery contact set up, used or started, sends an alert email to your Account.

What is not protected

  • Files on your devices are plain files. Anyone who can open the folder, a backup or another app can read them. App lock does not change that. Use your operating system's disk encryption.
  • The path fingerprint above, and the counts, sizes and times the servers see.
  • A device that is unlocked and signed in can read your Spaces, and so can someone who controls it.
  • If you keep a recovery key copy in iCloud Keychain, it also sits in your Apple account: anyone who gets into that account and your Garnet Account can read your synced Spaces.
  • Your recovery contact's code and Garnet's server share together open your Account Key. Someone holding the code who also gets into your Garnet Account could recover your keys, but only after the 72-hour wait, during which you are emailed and your signed-in devices can cancel.
  • Billing, account and support data are not end-to-end encrypted. The Privacy Policy lists what Garnet receives and why.
  • Sync does not hide that you use Garnet from Garnet, or your IP address from the servers you connect to.

Read the Privacy Policy for the full list of what Garnet processes.

Check the numbers

Garnet keeps known-answer test vectors: fixed inputs and the exact bytes they must produce, for Argon2id, HKDF-SHA256, every key wrap, a device approval, the sync file format and the recovery key. They run in Node on every build, and one command runs them in Electron, Chromium and WebKit too. A failing vector means existing keys would stop opening, so the format changes only with a new crypto version and a reader for the old one.

You can reproduce one with any Argon2id implementation. With today's settings (64 MiB, 3 iterations, 1 lane, 32-byte output):

Password (UTF-8)
correct horse battery staple ✓
Salt (hex)
04f8de068081e863e03acc63337d2977
Argon2id output (hex)
cd1c409a1f3d381b216ef2781814f99d45a5ce8f1ac3e7dfe7f5bfec46b84a75

The other vectors are not published for download yet.

Changes to this page

: first published. It covers the passphrase-optional setup, device approval, device removal with key replacement, Start fresh, passkey unlock, the recovery contact, the recovery key copy in iCloud Keychain, and the emailed step-up code when two-factor is off. Questions or a security report: support@garnet.md.