The vault server stores a person's encrypted vault and hands out device credentials. The mobile app is one of its device clients: it never signs in with a password or a cookie, it only presents a bearer derived from a credential the person approved in the browser. The server cannot read the vault; everything it stores for the app is ciphertext.
Base URL
The vault URL is whatever the person enters on the vault screen; the field's initial value is https://hyper.media/vault (root state vaultURL). It is normalized to scheme, host and path with no trailing slash, and every endpoint below is appended to it. The network grants net.fetch https: and net.fetch http: cover it (Grants and capabilities).
Endpoints the app calls
Method and path | Auth | Request | Success response |
|---|---|---|---|
| bearer | none |
|
| bearer | JSON |
|
| none | none |
|
| bearer | none | success status |
The person's browser also loads {vaultUrl}/connect#token=...&siteName=..., which the app opens but never fetches.
Field encodings on the wire:
encryptedData: unpadded base64url of nonce(24) || ciphertext || tag(16), XChaCha20-Poly1305 over the gzipped CBOR state under the vault's data key (Crypto: vault envelope and state codec).
credentials[]: {kind, credentialId, wrappedDEK, salt?}. The app uses only entries with kind: "secret" and its own credentialId; wrappedDEK is the data key encrypted under that credential's 32-byte secret, in base64url.
Error bodies are JSON {error: "..."}; the app shows that text when present.
Bearer
Authorization: Bearer <credentialId>:<b64url(authKey)>
authKey = HKDF-SHA256(secret, no salt, info "seed-hypermedia-vault-secret-authentication", 32 bytes)The secret is the 32-byte device credential secret received during connect and kept in the Keychain. The raw secret is never sent: the server sees only the derived key, and the same secret separately unwraps the data key on the device. A comment in the client notes that the server verifies the bearer with Argon2id, which is why authenticated calls get a 20 s timeout against 5 s for the mailbox. Derivation: Crypto: primitives and key derivation.
Versions and conflicts
The server keeps one integer version per vault for optimistic concurrency. It is unrelated to the state schema version (2) inside the ciphertext.
GET with knownVersion equal to the current version answers {unchanged: true}, and the app skips decryption.
POST carries the version the app last fetched, meaning "replace exactly this version". The server increments the version on success.
A mismatch is HTTP 409. The app refetches, merges and retries, at most 3 attempts per sync or per connection, then reports remote vault write conflict and tries again on the next sync.
Details: Vault: API and sync and Vault: merge and tombstones.
The connect mailbox
The mailbox is how a credential travels from the browser to the app without the server being able to read it.
The app creates 32 random token bytes and puts them only in the URL fragment of the connect page.
The mailbox id is b64url(sha256(token)). The server learns the id, not the token.
After the person approves, the browser stores b64url(XChaCha20-Poly1305(JSON, token)) under that id. The JSON is {vaultUrl, userId, credentialId, secret}.
The app polls the unauthenticated GET every 2 s for up to 15 minutes. A read consumes the entry: the mailbox is one-time, so the app holds the ciphertext in memory until it has finished or failed permanently.
Details: Vault: connect ceremony.
Status handling in the app
Status | Treatment |
|---|---|
404 on the mailbox | not yet approved; keep polling |
409 on | write conflict; refetch and retry |
408, 429, 5xx during connect | transient; retry with the approval already held |
401 and other 4xx during connect | stop and show the error; authentication failures "fail closed" |
any failure during sync | recorded as the sync error in the envelope; local identities are kept |
Which code calls it
Only src/vault/api.ts, used by connect.ts, sync.ts and store.ts in the Vault package. No other module contacts the vault server. The other services are listed under Services the app talks to.
How it is tested
Harness | What stands in for the server |
|---|---|
| |
The repository's real vault server and web UI with temporary databases, driven through Playwright Chromium. 9 tests, opt-in with |
The mock confirms the protocol as the app understands it; the real suite confirms the app's understanding matches the server.
Limits
The app implements the secret-credential device role only. Signing in to the vault happens in the browser.
Disconnecting ("Switch to local" or "Log out") makes no server call, so the device credential remains on the server until removed elsewhere (inferred from the code: disconnect sends no request). cleanupOldCredential exists for deleting a credential but is not called by the app in this snapshot.
See also Current limits and known gaps.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime