As an identity holder, I want my identities to stay the same on all my devices by themselves, so that I never have to move a key by hand again.
Situation
My phone is connected to my remote vault. I also use Seed on a computer and in the web vault. I add, name and remove identities in any of those places and expect the others to follow.
What I do
Use the app as usual. Sync needs nothing from me.
Create, import, rename or remove an identity on the phone.
Or do the same on another device, then open Seed on the phone.
To check, open Me, then "Vault", and read the "Storage" section.
To hurry it, tap "Sync now".
What I should see
Vault shows "Remote", my vault's address, a line such as "Local 4 · Remote 4 · Synced 4", and "Last sync: " with a date and time in UTC, or "Never".
The app syncs every 30 seconds while it is open and in front, once each time I come back to it, and right after I change an identity on the phone.
"Sync now" reads "Syncing…" while it runs.
An identity I add on another device appears in the Vault list and on Me after the next sync, ready to use.
An identity I create or import on the phone appears on my other devices.
An identity I remove on any device disappears from all of them.
A key name I set on the phone reaches devices that have no name for that key. A device that already has its own name keeps it.
If two devices change the vault at the same moment, both changes are kept. I see nothing of it.
When something goes wrong
If a sync fails, the reason appears in red under the counters and "Last sync" shows when it was tried. My identities stay as they are on the phone. I tap "Sync now", or wait for the next automatic try.
Not included
No sync while the app is closed or in the background, and no notification when identities change.
Removing an identity on the phone removes it everywhere, although the removal alert only mentions this device. See Remove an identity from this device.
The counters are plain numbers for diagnosis. There is no simple "up to date" sign, as the Vault status panel page explains.
Sync on the screen is exercised by a scripted drive and unit tests, not by the automated interface tests. See Mock vault.
Trace
Story US-VAULT-02, 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 |
|---|---|
The Storage section in remote mode and the identities list | |
Where synced identities appear and disappear | |
Rename and remove, the edits that travel | |
Mode, address, the three counters, last sync, sync error, Sync now | |
Vault and Me identity rows that follow the sync | |
Sync now and its Syncing… state | |
Counters and last sync time as status text | |
Progress wording on the button while syncing | |
A failure that leaves content in place and offers a retry | |
The connected state of Vault | |
The status panel treatment | |
Sync shown as plain facts | |
The same names in Vault as in Me | |
System red for the sync error |
Implementation
Page | Part it plays |
|---|---|
Orientation: vault state as the source of truth, the Keychain map as a copy | |
One sync pass: fetch, merge, upload decision, conflict retry | |
The merge rules: deletions, re-creation, per-device key names, unknown fields | |
reconcile, rebaseKeys and publishKeys between vault and Keychain | |
vaultSyncTimer, vaultForeground, vaultTrackMe and vaultRestoreIdentities | |
The Keychain map the vault publishes into, and the removal marker | |
The create, import, rename and remove edits that the vault picks up | |
State encoding that keeps fields from newer clients | |
Versions, conflicts (409) and the unchanged answer | |
The sync tasks and the queued vaultEdited mutation | |
vaultChanged refreshes vaultStatus and meIds | |
Yields in every sync phase and per account | |
Why error classes are built the way they are on device | |
The fixture server, conflict injection and the scripted sync drive | |
Two-way sync and a real conflict against the real server | |
The vault unit tests |
Code
File | What |
|---|---|
VaultScreen Storage section: mode, counters, last sync, sync error, Sync now | |
VaultScreen identities section | |
vaultStatus, vaultChanged, vaultEdited, vaultTrackMe, vaultSyncTimer, vaultForeground, vaultRestoreIdentities | |
vaultCommand, vaultSyncTick, vaultMeChanged, vaultAfterChange, vaultRefreshIdentities | |
VaultStore.sync | |
publishKeys, reconcile, rebaseKeys | |
VaultStore.read: reconcile, then sync at once when something changed | |
runRemoteSync | |
mergeStates and mergeNormalizedStates | |
statesEqual, alignDifferingLabels, labelFreeFor | |
getVault and saveVault |
Tests
File | What it checks |
|---|---|
sync downloads remote changes, uploads Me edits, retries 409 and persists counters | |
three conflicts stop with an error; retry recovers without losing local keys | |
rename and deletion in Me synchronize with a tombstone | |
Me edits made during remote fetch survive publication of the remote snapshot | |
merge preserves unknown CBOR fields, notifications and deletion/resurrection ordering | |
a key name is a per-device label: two labels never rewrite the vault, a label fills in where there is none; a label taken from the remote never duplicates a name another local key holds | |
phone add, rename and remove reach the server and the web vault; web vault additions and deletions sync to the phone; a real 409 when the web vault writes mid-sync keeps both edits; an idle sync asks with knownVersion, gets "unchanged" and uploads nothing | |
scripted drive of the built app: Sync now, a sync error shown and cleared (run by hand) |
Delivery
Delivered by #1470.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime