Connect my vault to bring my identities to this phone
A person links the phone to their remote vault by approving it in the browser, and their identities arrive.

As an identity holder, I want to connect this phone to my vault by approving it in my browser, so that all my identities arrive without typing any recovery words.

Situation

I keep my identities in a Seed vault and can sign in to it in a browser. This phone has none of them yet. I am on the Me tab, online.

What I do

    Tap "Vault".

    Under "Remote vault", check the address, or type my own vault's address.

    Tap "Connect".

    In the browser page that opens, sign in to my vault and approve this device.

    Return to Seed and wait.

What I should see

    The address field starts with "https://hyper.media/vault", above "Keep your identities in sync across devices. Approve this device in your vault’s browser page."

    On Vault, "Connect" opens a sheet titled "Connect vault" and opens my vault's page in the browser. See Connect vault.

    The sheet says "Approve this device" and "Open your vault in the browser and approve the connection, then return here."

    It offers "Open in browser", shows the link as text I can select, and counts down: "Link expires in 14:32".

    While Seed is in front, it checks for my approval every two seconds.

    After approval the title becomes "Connected" with "Your identities are ready. Returning to your vault…", and the sheet closes by itself after two seconds.

    Vault now shows "Remote" and my vault's address, and my identities are listed there and on Me.

    Identities that were already on the phone are kept and added to my vault.

    If I leave the sheet without cancelling, Vault offers "Continue pending connection" and "Restart connection".

When something goes wrong

    A bad address shows "Invalid vault URL" in red under the field. I correct it and tap "Connect".

    If the vault cannot be reached, a red line appears, starting "Cannot reach the vault server". The wait continues.

    If the connection drops after I approved, I see "Connection interrupted (attempt 2: …). Retrying with your browser approval…". I do not need to approve again.

    After 15 minutes the title becomes "Connection stopped" with "connection token expired". I tap "Try again" for a new link.

    "Cancel" ends the attempt and returns me to Vault, still "Local", with my identities untouched.

Not included

    I cannot sign in to the vault inside the app. Approval always happens in the browser.

    One remote vault at a time. A second one is refused with "Switch to local before connecting another vault."

    Some error wording is unpolished, as the Connect vault page records.

    The automated interface tests stop before approval. A completed approval is proven by unit tests and hand-run drives. See Real vault compatibility suite.

Trace

Story US-VAULT-01, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.

Design

Page

Part it plays

Vault

The Remote vault section with the address field and Connect

Connect vault sheet

The approval sheet: pending, warning, stopped, connected

Me

Entry point (Vault row) and where the identities arrive

Vault connect panel

The connect panel: title, countdown, link, warnings

Vault status panel

The Storage panel that turns from Local to Remote

Identity rows

Vault identity rows that appear after connecting

input, textarea, select and label

The vault address field

header, footer and nav

Cancel in the sheet bar

Badges, countdowns and connection status

The countdown and connection status wording

Loading, failure and empty states

Waiting, warning without ending the wait, stopped with Try again

States for every screen

Every state of Vault and Connect vault

Forms and inputs

The address field and its error line

Cards and panels

The status panel treatment

Stacks, pushes and sheets

The connect sheet as a modal over Vault

Moving between tabs and into the app

Leaving for the browser and coming back

Honest state: loading, failure and empty

The title is the state; a deadline is shown as a clock

Voice and wording

The rough, unpolished error wording noted as a gap

Implementation

Page

Part it plays

Vault: remote vault device role

Orientation: the device role and the two copies of the identities

Vault: connect ceremony

Token, connect link, mailbox, finishing, retry and cancel rules

Vault: screens and tasks

VaultConnectScreen, the poll and countdown tasks, vaultConnect and vaultCancel

Vault: the store and on-device format

VaultStore.start and poll; publishing identities to the Keychain

Vault: API and sync

The mailbox and snapshot requests, timeouts and error classes

Vault: merge and tombstones

How local identities merge into the remote vault on connect

Crypto: vault envelope and state codec

The encrypted envelope and state the connection adopts

Crypto: primitives and key derivation

Token hashing, payload decryption and bearer derivation

Vault server

The endpoints, the connect mailbox and status handling

Root declarations: Me, Profile, Crypto and Vault

vaultStatus, vaultStarted, vaultChanged and the seven tasks

Navigation and routes

The vault and vault-connect routes

Where the app yields for the turn budget

Why connect is split into phases so a real-size vault finishes

Grants and capabilities

Keychain, file and network grants the vault needs

Mock vault

The fixture server and scripted drive that completes an approval

Real vault compatibility suite

The real server and browser approval suite and drives

Contract UI tests

The UI tests for invalid URL, warning, expiry and cancel

Code

File

What

vault.contract L164-213

VaultConnectScreen

vault.contract L120-142

VaultScreen: Remote vault section in local mode

vault.contract L26

vaultCountdown

app.contract L250-273

pkg:vault decl: vaultStatus, mutations, vaultPoll, vaultCountdownTick, vaultConnectedReturn

app.contract L689-708

vaultEditURL, vaultConnect, vaultAfterStart, vaultResume, vaultOpenBrowser

app.contract L712-730

vaultPollTick, vaultClock, vaultRefreshIdentities, vaultCancel

app.contract L919-928

view wiring for the vault-connect route

src/vault/sources.ts L11-43

vaultRead, vaultStart, vaultCommand

src/vault/store.ts L281-380

VaultStore.start and poll

src/vault/store.ts L428-436

VaultStore.cancel

src/vault/connect.ts L27-102

expiry and poll constants, normalizeVaultOriginURL, mintPendingConnection

src/vault/connect.ts L183-281

finishConnection

src/crypto/envelope.ts

The vault envelope format read and written on connect

src/crypto/vault.ts

Wrapping and unwrapping the vault data key

Tests

File

What it checks

vault.test.contract

vault: invalid URL stays local

vault.test.contract

vault: pending connection expires and can be cancelled

src/vault/__tests__/vault.test.ts

token → encrypted mailbox → adopted remote DEK → identities in Me

src/vault/__tests__/vault.test.ts

an Exact-aborted snapshot retries the consumed approval without another browser ceremony; a cached approval expires instead of retrying indefinitely; an authentication refusal after approval stops instead of retrying

src/vault/__tests__/vault.test.ts

cancelling an approved connection suppresses a late aborted reply and never retries it; cancelling while the mailbox request is in flight prevents late connection; pending token expires and cancellation does not create a remote credential

src/vault/__tests__/vault.test.ts

vault URL boundary rejects credentials, fragments, queries and non-http protocols; URL mismatch is rejected even when mailbox decryption succeeds

.tests/real-vault/real-vault.test.ts

identities made in the web vault decrypt on the phone and sign with their principals; connect tokens: unknown, expired, cancelled, and one-time; vault URL forms a person types normalize to what the web vault expects

.tests/real-vault/drive.ts

the built app connects through a real browser approval (run by hand, not in CI)

.tests/real-vault/race.ts

iOS on real time: approval while in the background, a 503 after approval, recovery without a second approval (run by hand)

Delivery

Delivered by #1470.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Comments