OC Vault · Protocol
OC Vault seals entries with OC Lock's primitives (X25519, HKDF-SHA256,
AES-256-GCM). This page describes how vault entries are sealed, how cloud sync
stays metadata-blind, how a new device gets the key, what the portable export
contains, and how an entry leaves as a signed .lock file.
@orangecheck/vault-core on npm implements the entry
record, the cloud blob, the export, wrapping and unwrapping the vault key, team
keys, device grants and the encrypted backup file, for vault.ochk.io, the CLI,
the SDK and the extension.
Why not OC Lock envelopesLink to this section
OC Lock seals each message as a BIP-322-signed .lock envelope addressed to
device keys bound to a Bitcoin address. That takes a wallet signature per seal,
and an address: many vault accounts sign in with an email code, Google or
GitHub. So vault seals everything under a symmetric vault key instead, and
does not store entries as OC Lock envelopes. With a wallet, you can export an
entry as one: see Signed .lock export.
The vault keyLink to this section
On first setup the browser generates a vault key: 32 cryptographically random bytes. It is the AES-256-GCM key for every entry.
- It is stored on vault.ochk.io only wrapped: under your vault passphrase
and under a recovery code (scrypt N = 2^17, r = 8, p = 1, then AES-256-GCM),
filed under your account's
did:oc. Any device you sign in on fetches the wraps and unlocks with either secret. OC holds neither secret and cannot open the wraps. - A device being linked can also receive the key from one that holds it, sealed to its X25519 device key (see below).
- A blob that names scrypt factors outside N 2^14–2^20, r ≤ 16, p ≤ 4 is refused
before any key is derived, by the server, vault.ochk.io, the extension and
@orangecheck/vault-corefrom 0.3.1, which the publishedoc-vaultCLI installs. Until its next release, the GitHub Action's defaultcli-versionstill installs a 0.2 CLI, whose vault-core does not check; setcli-versionto^0.3.3once npm serves it.
Lose both the passphrase and the recovery code, with no encrypted backup file, and the entries are unrecoverable — by construction.
The entry envelopeLink to this section
Each entry is a small JSON record. The secret payload is encrypted; a thin layer of metadata is left in clear so the local UI can index it.
{
"id": "9f2c…", // 16 random bytes, hex
"type": "password",
"name": "github · primary", // plaintext — local index only
"nonce": "b64url(12-byte nonce)",
"ciphertext": "b64url(AES-256-GCM(JSON(fields)))",
"created_at": "2026-05-15T…Z",
"updated_at": "2026-05-15T…Z",
"favorite": false,
"tags": ["work"],
"deleted_at": null // set ⇒ tombstoned (in trash)
}
The fields object inside the ciphertext is type-specific — for a password
entry it holds username, password, url, an optional totp secret,
notes, a passwordHistory array of superseded values, and any user-defined
custom fields. A fresh 12-byte nonce is drawn per encryption, so re-saving an
unchanged entry still produces fresh ciphertext.
Local-only metadata. name, type, tags, favorite and the timestamps
are not encrypted in the local IndexedDB record — they index the dashboard.
They are, however, sealed before they ever reach the server. See below.
Cloud sync · the double-encrypted blobLink to this section
Cloud sync (a paid tier) mirrors encrypted entries to an OC-hosted blob store so they reach every device signed in to the same orangecheck account. To keep OC blind even to entry metadata, the entire entry record is wrapped a second time before transit:
VaultEntry JSON (id + type + name + nonce + ciphertext + dates + tags)
│
▼ AES-256-GCM( · , vault_key, fresh blob_nonce) ← outer wrap
│
▼
{ "v": 1, "blob_nonce": "b64url(…)", "blob_ct": "b64url(…)" } ← what is uploaded
The server therefore stores, per entry, only:
- a random 16-byte envelope id, and
- an
updated_attimestamp.
It cannot read the entry name, the type, the tag list, or even the inner ciphertext's length-class. Both layers use the same vault key with independent nonces; that is safe — AES-GCM is IND-CPA secure under fresh nonces.
Reconciliation goes entry by entry. A newer copy on the server is pulled, and a local edit goes up only over the revision this browser last read, so it never writes over a change another device made since. When both sides changed, both are kept: the server's version keeps the entry, and your edit is saved beside it as "(conflict copy)". If another device deleted the entry and its row is gone, your edit is saved as a new entry. When that happens as you save, the page says "This entry was deleted on another device, so your change was saved as a new entry." From its next release, the browser extension's updates also go over the revision they read; see Browser extension.
Deletes are soft: a deleted entry keeps its row with deleted_at set and a
bumped updated_at, so the tombstone propagates like any other change — a
delete on one device reaches the others. Delete forever from the trash
removes the entry from this device and replaces its blob on the server with an
empty, encrypted marker, which tells your other devices to delete the entry too.
It goes up over the revision it was made from, or, for one made before Delete
forever kept its revision, over the revision the server lists. If it has no
revision and the server lists none (an entry the server never held, or an old
purge whose row is gone), it goes up as a new marker. If another device edited
the entry first, that edit is kept and comes back here, and a notice names each
entry kept this way, saying to delete it again if you still want it gone, until
you dismiss it. The marker stays on the server for 90 days, then a web sync
removes it. A browser whose last full sync is 89 days or more behind moves any
entry the server stopped listing to its own Trash, never away. If that is 20
entries or more and over half of this browser's synced entries, or the server
lists none at all, it asks you first. A device reads its whole list of blobs
before it reconciles: a list it cannot read in full fails the sync, rather than
leaving entries out.
Team vaults · a different sync signalLink to this section
A team vault is a second, parallel vault sealed under a separate 32-byte team
key rather than your personal vault key. Family Circle creates one team you
own; the creating browser generates the team key locally, and every new member
receives it through an invite URL whose fragment (#…) carries the key. A
browser does not send the fragment when it opens the link, so vault.ochk.io
holds the team key only wrapped under each member's personal vault key, as it
holds the personal key only wrapped. An invite that vault.ochk.io emails for you
carries the key sealed. The inviter's browser makes a one-time code (16
Crockford characters, 80 random bits), seals the team key under it with
vault-core's passphrase wrap (scrypt N = 2^17, r = 8, p = 1, then AES-256-GCM),
and sends only c1.<salt>.<nonce>.<ciphertext>, which goes in the emailed
link's fragment. The code is shown to the inviter alone, who tells it to the
invitee another way; the invitee's browser opens the seal. vault.ochk.io and its
mail provider see the sealed key, never the code, so learning the key from an
emailed invite takes both the email and the code. An emailed invite joins only
with its code: a link rewritten to carry a plain key is refused.
Team entries reuse the same packEntryForCloud envelope as the personal
double-encrypted blob, only with the team key in both layers. They are stored on
a separate endpoint family (/api/teams/<id>/blobs) and keyed by random
envelope id, so the server still sees ciphertext plus an updated_at.
The collaborative signal is different from personal sync, and the client-side machinery reflects that:
| Property | Personal cloud sync | Team vault |
|---|---|---|
| Key | personal vault key (per identity) | team key (per team) |
| Key escrow | wrapped under your passphrase and your recovery code | escrowed under your personal vault key so a clean reinstall finds the team key |
| Concurrency | the same identity on multiple devices | many identities, each potentially editing concurrently |
| Reconciliation | per-entry synced_ + remote_, pull/push | compare-and-swap on the server updated_, plus a poll loop |
| Freshness model | "are my local edits backed up yet?" | "how fresh is what I'm looking at relative to my teammates' writes?" |
| Loop | sync once per visibility/focus, then idle | 8-second background poll while the tab is visible |
| Concurrent-edit guard | each write over the revision it read; conflict copies kept | advisory edit-locks (~90 s TTL, heartbeated every 30 s while the editor is open) |
| Surfaced state | cloud sync stat tile · <synced>/ · last-sync time | liveness stat tile · last-refresh time · live across teammates |
The polling loop is index-gated and cheap, but it's still a poll — that's why the team page surfaces its own liveness tile (last-refresh time, with a subtle "refreshing…" while a tick is in flight) and a manual refresh button. While an entry is open in the editor, a tick still refreshes the advisory edit-locks (so the "being edited by …" badge stays live for teammates) but skips the entry-list reload — that preserves the invariant that a background poll never yanks the list out from under an open editor.
The portable exportLink to this section
"Zero lock-in" is a protocol property, not a marketing line. Export produces a single JSON snapshot:
{
"format": "oc-vault-export",
"version": 1,
"exported_at": "2026-05-15T…Z",
"identity": "bc1q…", // the account's Bitcoin address, else its did:oc
"entries": [
/* VaultEntry records, ciphertext intact */
]
}
The entries carry the same per-entry ciphertext as IndexedDB, but not the
vault key. Anyone holding the key can decrypt them with
@orangecheck/lock-crypto directly — the
AES-256-GCM, b64url and JSON conventions are all documented and stable. The
encrypted backup file carries the key too, sealed under a passphrase you
choose (scrypt, then AES-256-GCM), so it restores on a new device without the
server's copy of the wrapped key. Import on vault.ochk.io restores it, and
@orangecheck/vault-core writes and reads it (createEncryptedBackup,
restoreEncryptedBackup).
Signed .lock exportLink to this section
With a Bitcoin wallet, an entry can leave the vault as an OC Lock envelope: open
the entry, then Export as .lock. The file is a plain OC Lock envelope
(v: 2, kind: "identity") made by lock-core's seal(). The sender is the
Bitcoin address linked to your orangecheck account with a BIP-322 proof, and the
recipients are that same address's live OC Lock devices. The vault key is not
used.
- vault.ochk.io reads the address's device records (kind 30078,
dtagoc-lock:device:<address>) from nostr-core's five relays, and goes on only if 4 of the 5 finished answering: the read floor. It judges the union of their records, so a revocation any one of them holds retires the device. Records whose BIP-322 signature fails are dropped. - Before you sign, the sheet lists each device with its id and signed bind date, and says that the file opens on those devices without your vault passphrase, that it shows your Bitcoin address, which relays the list came from, and that those relays see your IP address. You tick every device. One you no longer hold stops the export: revoke it at ochk.io/lock first.
- Your wallet signs the envelope id once. vault.ochk.io checks the signature against your address before it saves anything.
- The browser saves
<entry name>.lock. Nothing is uploaded.
The payload inside the ciphertext is the entry, decrypted, as this object in RFC
8785 canonical JSON (tags and folder only when set):
{
"format": "oc-vault-entries",
"version": 1,
"entries": [
{
"type": "password",
"name": "github · primary",
"fields": { "username": "…", "password": "…" },
"created_at": "2026-05-15T…Z",
"updated_at": "2026-05-15T…Z"
}
]
}
Any listed device opens it:
- at ochk.io/lock, on a device bound there;
- in OC Vault, on a browser bound under the Bitcoin device tier: Import opens it in that browser, checks the sender's signature, and adds the entries;
- with lock-core's
unsealand the device's secret key, anywhere.
Anyone can check who signed it, offline and without a device: the envelope id
is the SHA-256 of its canonical bytes with id and sig.value emptied, and
sig.value is a BIP-322 signature by from.address over that id
(envelope). Any BIP-322 verifier checks it.
Handing the key to a new deviceLink to this section
Besides unlocking with the passphrase, a new device can get the vault key from one that already holds it. Each browser has an X25519 device key, registered with vault.ochk.io under the signed-in session. The holding device, after a fingerprint check by the person, seals the vault key to the new device's key (ephemeral X25519, HKDF-SHA256, AES-256-GCM with the device id as associated data); the server stores and serves that grant opaquely. These device records carry no BIP-322 binding and are not published to Nostr, unless you opt in to the Bitcoin device tier.
The Bitcoin device tierLink to this section
Under Settings → Devices, you can bind this browser's vault device key to your account's Bitcoin address. It is opt-in. Your wallet signs an OC Lock v3 binding statement for the key, and the browser publishes it as an OC Lock device record to nostr-core's five relays. The sheet says first that the record is public, that it links your address to this browser's key, and that those relays see your IP address. Your vault still opens with your passphrase.
Labels. Each device in the list gets a label, worked out again on every read and never stored:
| Label | When |
|---|---|
| Verified by your Bitcoin address | a live bind of that device names the key vault.ochk.io has registered for it |
| Bound to a different key than this device: not verified | a live bind of that device names another key |
| Linked by sign-in (via ochk.io) | no live bind names it, or your account has no Bitcoin address |
| Could not check | fewer than 4 of the 5 relays finished answering |
The first two need a read where 4 of the 5 relays answered, judged on the union of their records.
Bind and revoke. Each takes one wallet signature, checked against your address before anything is published. vault.ochk.io then asks each of the five relays on its own for the record, and reports it done only when 2 serve it back: the write quorum. Below that it says how many did, and to check again before relying on it. A revocation is dated no earlier than the device's latest signed bind. Removing a bound device from the list offers to revoke it as well, because it can still open what is sealed to your address.
The key hand-off. Your account has the tier once your address has a live OC Lock device, bound here or at ochk.io/lock. A browser learns that from a read where 4 of the 5 relays answered, or by binding itself, and remembers it; only a later read of 4 of 5 that finds no live device clears it. From then on that browser sends the vault key only to a device labelled Verified by your Bitcoin address, read fresh at the moment of sending, and sends nothing when fewer than 4 relays answer. Until a browser has seen the tier, its hand-off is the fingerprint check alone.
Opening .lock files. A bound browser is an OC Lock device of your address.
Import opens a .lock file of vault entries sealed to it, in the browser,
and adds the entries. The key lives in vault.ochk.io's storage in that browser,
so ochk.io/lock cannot use it.
One-time share linksLink to this section
Sharing a single entry does not reuse the vault key. The share flow:
- draws a fresh 32-byte AES key and 12-byte nonce,
- encrypts the chosen entry's fields under that key,
- uploads only the ciphertext to
/api/share, and - hands the user a URL whose fragment (
#…) carries the AES key.
Because URL fragments are never sent to a server, vault.ochk.io sees ciphertext only. The row is retrieve-once: it self-destructs on first successful read or at TTL expiry (1 h / 24 h / 7 d).
SDK surfaceLink to this section
| Package | Role |
|---|---|
@ | X25519, HKDF-SHA256, AES-256-GCM, b64url, random — the primitives. |
@ | The vault format: wrapping and unwrapping the vault key, team keys, device grants, entries, cloud blobs, export, the encrypted backup, TOTP. |
@ | Per-browser X25519 device key — what a key hand-off is sealed to; the Bitcoin tier's binding and revocation records. |
@ | seal and unseal: the signed . export. |
@ | The five relays device records are read from and written to. |