The contract between the server (server/), the phones (Java, ServerFolder.java and friends) and the
web app (the Restock web build running in a browser, served by the server). Three people build these at
once: change this file only when you must, keep the change small, and list it under "Changes" at the end.
v3 (0.9.4), where the server is the household's owner and can read what phones share, is the section
"v3" at the end (design and reasons: docs/server-v3-design.md). Everything above it is v2, which a server
keeps serving byte for byte while it's in v2 mode.
The 0.9.1 RC patch (restock-server-0.9.1.patch, one shared access code, read-only viewer) was never
released. v2 replaces its auth; its file storage, sealing and tests are the starting point.
These are v2's principles, kept for the record. Every server since 0.14.0 runs v3, where the server is the household's owner: it holds the household key and can read what the phones share (see the "v3" section at the end, and
docs/server-v3-design.md). The "End to end" point below is true of v2 only. Likewise, the web page's shop search described under "v3, 0.9.5" went in 0.19.0: the server no longer contacts any shop.
- End to end. The server stores and hands back sealed files. It never has the household key, the server key or anything that opens them. A full copy of the server's data volume reveals nothing but file names, sizes, times, device names and the activity log.
- Local first. Phones never wait for the server. Everything works without it.
- One household per server.
householdKey,keyv: the phones' household key and its version (unchanged from 0.9.1).serverKey = HMAC-SHA256(householdKey, "restock-server-files-v1")(32 bytes). Every file stored on the server is sealed with the serverKey of the key version it names. The web never gets the householdKey.- Sealed file format: the same
RSF1format as folder sync (SyncFolder.java):RSF1+ 12-byte nonce + AES-256-GCM(gzip(JSON)). The JSON names itskeyv.
- Each phone has its own ECDSA P-256 key pair for the server (
server_dev_privin sync meta, sealed bySyncKeystore). The server stores only the public key, so the server's files can't be used to pose as a phone. - Adding a phone: a signed-in web user taps Add a phone →
POST /api/v2/invites→{ invite, expires }(32 random bytes, base64url; works once, for 10 minutes). The page shows the QR coderestock-server:2?h=<home URL>&a=<away URL>&i=<invite>(aoptional; URL-encoded). The phone scans it and callsPOST /api/v2/devices{ invite, device, name, pub }(deviceis the phone's sync device id,pubthe SPKI public key, base64). One invite, one phone. - Signed requests (every phone request after joining):
Authorization: Restock2 d=<device>, t=<unix ms>, n=<16 random bytes b64url>, s=<sig b64>where sig = ECDSA-SHA256 (DER) overMETHOD\nPATH_AND_QUERY\nt\nn\nhex(sha256(body)). Within 5 minutes of the server's clock; on{"error":"clock"}(401) with headerX-Restock-Time, retry once with the offset. Each nonce works once (keep 10 minutes of nonces). DELETE /api/v2/devices/<device>(web user or the phone itself) removes a phone's access. The web's Phones page lists them with name, last seen and a Remove button.- Home first, then away: phones try
hthena(as in the RC patch). Plain http only to private,.local,.lanor Tailscale (100.64.0.0/10) addresses, using 0.9.1'sSyncDavHTTP client rules.
- One user. First start:
RESTOCK_USER(defaultadmin) andRESTOCK_PASSWORD(defaultadmin) from the environment, used only while no passphrase has been set. Logging in with them gives a session that can do nothing but set the passphrase (mustChange). - Passphrase: at least 20 characters or 4 words, checked in the page with a strength meter (no common
passwords, not the user name, not
admin). The browser derivesPBKDF2-HMAC-SHA256(NFKC(passphrase), salt, 600000, 64 bytes): bytes 0–31authKey(sent to the server, which keeps onlyscrypt(authKey)), bytes 32–63vaultKey(never leaves the browser).GET /api/v2/login/salt?user=→{ salt }(a fake, stable salt for unknown users)POST /api/v2/login{ user, password }(setup only) or{ user, auth }→ sets the session cookie (HttpOnly; SameSite=Strict; Path=/, plusSecureon https), returns{ mustChange, vault }.POST /api/v2/passphrase{ salt, auth, vault }(session) sets or changes it. Changing it re-locks the vault in the browser and sends the newvault.- Rate limits: 10 wrong logins per address → 15-minute lockout; sessions expire after 30 days unused, and Sign out everywhere on the Account page.
- Vault:
RSV2+ nonce + AES-256-GCM(vaultKey, JSON{ webId, webPriv, keys: { "<keyv>": "<serverKey b64>" } }), stored on the server (GET/PUT /api/v2/vault, session only).webPrivis the web's own ECDH P-256 private key; its public key is registered with the server (webPub, inGET /api/v2/web). - Linking the household to the web (once): after the passphrase is set and the vault has no keys, the page
shows Link with a phone: the browser makes a link request
POST /api/v2/link→{ id }and showsrestock-link:2?u=<origin>&s=<id>&k=<web ECDH public key b64url>. A joined phone scans it (Sync screen → Restock server → Scan the web page's code), asks "Let this browser see your household?", and postsPOST /api/v2/link/<id>(signed){ pub: <phone ephemeral ECDH pub>, sealed }where sealed = AES-256-GCM(HKDF-SHA256(ECDH, info "restock-link-v2"), JSON{ keys: {keyv: serverKey}, household }). The browser pollsGET /api/v2/link/<id>, opens it, adds the keys to the vault and saves it. The QR carries the browser's public key, so the server can't swap in its own. - Sign in with a phone (QR login, any time): the login page does
POST /api/v2/qrlogin→{ id }with a fresh ECDH key and showsrestock-login:2?u=<origin>&s=<id>&k=<pub>; a joined phone scans and approves; it posts like linking; the server then gives that browser a session; the browser opens the keys. A browser signed in this way keeps the keys for the session only (it can't open the vault without the passphrase). - After a rekey (a phone removed): phones keep writing
webkeys/<webId>.bin= the current serverKey and keyv sealed to each registeredwebPub(ECDH with a fresh phone key, same HKDF/AES as linking). The web adds it to its vault next time it's open. A removed web user (Sign out everywhere / new passphrase) gets a new webId.
GET /api/v2/files → { files: [{ name, size, modified, version, by }] }; GET/PUT/DELETE /api/v2/files/<name>.
Phones: read everything, write their own names. Web session: read everything, write only
restock-sync-web-<webId>.bin. Allowed names (anything else is refused):
restock-sync-<device>.bin: that device's sealed changes (the folder-sync file; the web's device isweb-<webId>).restock-sync-keys-<hid>.json: the owner's rekey file (as folder sync).archive/<device>/<yyyy-mm>.bin: sealed{ prices: [...], receipts: [...] }that phone moved off itself (see Offload). Written once per month file, replaced when it grows.photos/<sha256 hex>.bin: a sealed receipt or product photo, named by the sha256 of the photo bytes.webkeys/<webId>.bin: as above. Bodies:.binmust start withRSF1(orRSE2for ECDH-sealed webkeys),.jsonmust be JSON; size caps 32 MB per file, 2 GB per data volume (setting). Writes are atomic.
- With a server connected, the phone's Keep price history for setting is how much it keeps on the phone.
Prices older than that, and receipt photos older than that, go to
archive/andphotos/. - The phone deletes its own copy only after a
GET /api/v2/filesshows the archive/photo with the same size andversionit uploaded. Nothing is deleted while the server is unreachable. - Without a server, 0.9.1 behaviour is unchanged.
The real Restock UI (the web build), served by the server at /, in "server mode": it keeps a local sql.js
database in the browser, fills it by reading and merging every restock-sync-*.bin and the archive/
files with the same merge rules as SyncEngine.apply, and writes its own edits as
restock-sync-web-<webId>.bin. Shop searches, price checks, shop sign-ins and anything that needs the
phone's hardware are hidden with a plain note ("Do this on a phone: shops don't let a web page check
prices"). Cards (loyalty and gift) show greyed out with the shop's name and "Kept on your phones for privacy"; their
numbers are never shown (the web build strips them on read).
| Method and path | Who |
|---|---|
GET /api/v2/health |
anyone ({ ok, app, version, api: 2 }) |
GET /api/v2/login/salt, POST /api/v2/login, POST /api/v2/logout |
anyone / session |
POST /api/v2/passphrase, GET/PUT /api/v2/vault, GET /api/v2/web |
session |
POST /api/v2/invites, GET /api/v2/devices, DELETE /api/v2/devices/<id> |
session (delete: also the phone) |
POST /api/v2/devices |
invite holder |
POST /api/v2/link, GET /api/v2/link/<id> |
session |
POST /api/v2/qrlogin, GET /api/v2/qrlogin/<id> |
anyone (rate-limited, 2-minute expiry) |
POST /api/v2/link/<id>, POST /api/v2/qrlogin/<id> |
phone (signed) |
GET /api/v2/files, GET/PUT/DELETE /api/v2/files/<name> |
phone (signed) or session |
GET /api/v2/activity |
session |
- (web) Exact wire formats the web app uses where the text above leaves them open. All bytes in JSON
bodies and QR parameters are base64url without padding (readers also take plain base64).
- Public keys (
pub,k,webPub,owner_pub) are P-256 SPKI DER (Java'sgetEncoded(), 91 bytes). - Link / QR sign-in:
sealed= 12-byte nonce + AES-256-GCM (no associated data) with key HKDF-SHA256(ikm = ECDH shared x-coordinate (32 bytes), no salt, inforestock-link-v2, 32 bytes). Plaintext{ keys: { "<keyv>": "<serverKey>" }, household: { name, owner_pub } }.GET /api/v2/link/<id>andGET /api/v2/qrlogin/<id>answer{ pending: true }until the phone posted, then{ pub, sealed }. webkeys/<webId>.bin=RSE2+ the phone's one-off public key (SPKI, 91 bytes) + nonce + ciphertext, sealed as the link (same HKDF info, no associated data); plaintext{ keys: { "<keyv>": "<serverKey>" } }.- Vault:
RSV2+ nonce + AES-256-GCM(vaultKey, JSON), associated dataRSV2(browser only).GET /api/v2/vault→{ vault }(null if none);PUT /api/v2/vault{ vault, webId, webPub }; the login answer'svaultis the same base64url string.POST /api/v2/passphrasealso carrieswebId, webPub(that registers the web's id and public key, so the server knowsrestock-sync-web-<webId>.binis the session's own name).GET /api/v2/web→{ user, webId, webPub, mustChange }. POST /api/v2/logout{ everywhere: true }ends every session (Account → Sign out everywhere). Before it, the browser gives itself a new webId and key pair (PUT /api/v2/vault).GET /api/v2/devices→{ devices: [{ device, name, added, seen }] };GET /api/v2/activity→{ activity: [{ at, who, what, file, size }] }(the web shows what's there; extra fields are fine).- The web's own file is a folder-sync file exactly as
SyncFolder.writeOwnwrites it (formatrestock-sync,v1,deviceweb-<webId>,name,keyv,at,top,seen,entries), sealed with the newest serverKey. It never carrieshouseholdorcardsentries, and no prices. archive/<device>/<yyyy-mm>.binplaintext:{ format: "restock-archive", device, keyv, prices: [price rows, no id], receipts: [receipt rows], photos: { "<receipt photo path>": "<sha256 hex>" } }. Anyrestock-sync-*.binmay carry the same top-levelphotosmap.photos/<sha256>.binplaintext:{ type: "image/jpeg", data: "<base64>" }(sha256 of the photo's bytes).
- Public keys (
- (phones) What the phones do where the text above leaves it open, matching the web's formats above.
- Signing:
n= 16 random bytes base64url;s= the DER signature, standard base64 (Node's base64 reads both).hex(sha256(body))is lowercase; no body hashes the empty string. File names go in the path as they are, slashes included (/api/v2/files/archive/<device>/2026-08.bin), no percent-encoding; PATH_AND_QUERY is exactly the request target the phone sends, so a proxy in front mustn't rewrite the path. 401 refusals the phone tells apart byerror:clock(withX-Restock-Time, retried once) andremoved(taken off the server's list: "Scan a new code"); anything else shows the server'smessage. POST /api/v2/devices{ invite, device, name, pub }(pub SPKI, base64url): any 2xx is joined;invite(not this server's),usedandexpiredrefusals are told apart. A good invite for a device id already listed replaces that device's key and name (a phone joining again after Stop), as the server does.- Addition:
PUT /api/v2/files/<name>answers{ name, size, version }(as in the listing). A phone deletes an offloaded copy only after a laterGET /api/v2/fileslists that name with the same size and version; no version in the answer, nothing is deleted. GET /api/v2/websigned by a phone: the phone readswebs: [{ webId, webPub }](as the server answers).- Addition: phones seal keys (webkeys/) only to a webPub they can trust: one this phone approved by
scanning that browser's link code, or the
webPub(SPKI, base64url) inside that web's own sealedrestock-sync-web-<webId>.bin, which only a browser that already has a serverKey can write. So the web writes its file right after linking (emptyentriesis fine) and always includeswebPub. A webPub the server adds by itself gets nothing. - Link and QR sign-in from the phone: the phone refuses a code whose
uhost isn't its server's home or away host. Plaintext{ keys, keyv, household: { name, owner_pub } };keys(base64url, as the vault) holds every serverKey that phone has known, older key versions too, so older archive and photo files stay readable. webkeys files carry{ keys, keyv }. - Archive months: a price's month is the first 7 characters of its
date; a receipt photo's is the receipt'sscanned_at. The file also hasmonthandv: 1. A phone rewrites a month file when it adds to it, and when one of its receipts is deleted (the row and itsphotosentries go, and so doesphotos/<sha256>.bin). A phone that findsphotos/<sha256>.binalready listed (another phone had the same photo) opens it, checks the sha256 and uses it. Photo files are RSF1 with{ format: "restock-photo", v: 1, keyv, sha256, type: "image/jpeg", data }. - What's offloaded is only what the household already shares: prices of products on the tabs this phone
syncs, and photos of receipts only when the household shares receipts. The rest stays on the phone and
is tidied as before. The phone's own
restock-sync-<device>.bincarries prices changed in the last 60 days and a top-levelphotosmap of its offloaded photos. - Addition (phone review): on a server, a phone passes over any
restock-sync-*.binwhosedeviceisn't the one in its name, and leaves outhousehold,cardsandpricesentries from aweb-…device's file. Before deleting its own copy it also reads the file back and checks it's the bytes it sent (and that the PUT answer'ssizewas their length). A month file is read before it's rewritten even when the listing doesn't show it. Offloaded photos aren't fetched back over the Wi-Fi.photos/<sha256>.binis deleted only once the receipt has gone and no other device's sync file lists that sha256 in itsphotosmap (a phone's map leaves out photos whose receipt has gone).
- Signing:
- (server) What the server adds or pins down (all additive; the web app's client above already works with it).
- Port 8787 (the RC's). Errors are
{ error: "<code>", message: "<plain words>" }; codes includeauth,clock,replay,removed(a removed phone),signed-out,mustChange,passphrase(needs a passphrase session),forbidden,name,sealed,too-big(413),full(507),invite,used,expired(410),locked(429,Retry-After),rate,setup. GET /api/v2/login/saltaddssetup: truewhile no passphrase is set.- While the password is still the default
admin, the first-start login only works from home: the socket address must be loopback, private, link-local or Tailscale (100.64.0.0/10), and so must any address inX-Forwarded-For,X-Real-IP,CF-Connecting-IP,True-Client-IPorForwarded. Otherwise 403setup-remote. Headers only make it stricter. With their ownRESTOCK_PASSWORD, from anywhere. POST /api/v2/passphrase:vault,webIdandwebPubare optional (the server's setup page sends only{ salt, auth }; the web app then makes the vault at its first sign-in). A new passphrase can't reuse the current or a retired webId. Every other session is signed out; this one carries on.- The web key is registered by
PUT /api/v2/vault { vault, webId, webPub }orPUT /api/v2/web { webId, webPub }(passphrase session). A new webId retires the old one, and retired webIds are refused.GET /api/v2/webis also open to phones (signed), forwebkeys/:{ webId, webPub, webs: [{ webId, webPub }] }; sessions also getuser,mustChangeandsession: { kind, webId, approvedBy }. - Sign out everywhere is
POST /api/v2/logout { everywhere: true }: ends every session and every waiting link or sign-in code. It doesn't change the webId (the web app moves to a new one first, as above). - Sessions:
passphrase(30 days unused);phone(signed in with a phone: writes as the household's webId, can't change the vault or web key or make link codes, ends after 12 hours unused or when the phone that let it in is removed); the first-start session (1 hour, nothing but the passphrase). POST /api/v2/invitesalso returnsexpiresIn,home,awayandcode(the wholerestock-server:2?…text).homeisRESTOCK_HOME_URL, else the address the page was opened with;awayisRESTOCK_AWAY_URL.- Link and sign-in polls answer
{ pending: true, status: "waiting", expires }, then once{ pending: false, status: "done", pub, sealed, device, deviceName }(sign-in addsmustChange,webId). Link codes last 10 minutes and only the session that made one can read it.POST /api/v2/qrloginsets an HttpOnlyrestock_qrcookie (Path/api/v2/qrlogin), and only the browser holding it can collect the session, so someone who photographs the code can't take it. It's refused (409setup) before a passphrase is set, and limited to 10 per 10 minutes per address. - Phones: a
deviceid can't start withweb-. A known id joining again with a new invite replaces its key.GET /api/v2/devices→{ devices: [{ device, name, added, lastSeen, seen }] }. A phone may write its own sync file and archive, anyrestock-sync-keys-*.json,photos/andwebkeys/.webkeys/bodies must beRSE2, other.binRSF1; webIds are 8–60 ofA-Z a-z 0-9 _ -. - Signed requests:
PATH_AND_QUERYis the request target exactly as sent;nis 16–32 base64url characters;smay be base64 or base64url (DER; a 64-byte raw signature is also taken). Serve the server at the root of its host name. FileGETs carryETagandX-Restock-Version(304 onIf-None-Match); names may use/or%2F. GET /api/v2/activity?limit=→{ activity: [{ at, what, file?, by?, who?, device?, size?, ip? }], devices, server: { version, started, files, bytes, maxBytes, maxFileBytes } }, newest first; addresses are masked.
- Port 8787 (the RC's). Errors are
- (security review) Tightened, all compatible with the phones (the phones never use these endpoints).
POST /api/v2/passphraseonce a passphrase is set: only apassphrasesession (a phone sign-in gets 403passphrase), and it must carrycurrent, the current passphrase's authKey (missing: 400current; wrong: 403current, counted towards the lockout). The answer sets a new session cookie (the setup one stops working).GET /api/v2/vaultis forpassphrasesessions only.- A session's
POSTmust beContent-Type: application/json(else 415): over plain http browsers send noSec-Fetch-Site, and a page on another port of the same computer counts as the same site. - The first-start login is home-only while
RESTOCK_PASSWORDis any well-known one (admin, the compose file'schange-me-now, ...). Proxy headers are believed only on connections from a home address. Lockouts and rate limits count an IPv6 /64 as one address. - Web: a
webkeys/file is only a candidate (anyone can seal to a public webPub). A key version the browser already has is never replaced; a new one is taken once it opens a phone's sync file that carries a household change signed by the pinned owner key (before one is pinned: one exactly as the browser already has it). A browser signed in with a phone has no web key pair, so its own file carries thewebPubalready sealed in that file (from the passphrase browser), never the oneGET /api/v2/webgave it. - Replaces the two lines above that say a known device id joining again replaces its key:
POST /api/v2/devicesfor an id that's listed with a different public key is refused, 409device-taken("That phone is already on this server. Remove it on the Phones page first, then add it again."); the invite stays unused. The same key again is fine (as before). A phone that has lost its key is removed on the Phones page first (Stop already takes a phone off the list). - Trash: deleting
archive/…orphotos/…, or another writer replacing one with different bytes, moves the old copy totrash/<when>/<name>in the data volume (outsidefiles/, never listed or served) for 30 days; it counts towards the volume cap. A phone mayDELETEonlyarchive/<its device>/…(as before). ADELETEof aphotos/…file by a phone that wasn't the last to write it is answered 200{ deleted: null, kept: <name> }and the file stays (that phone has let go of it; the phone that put it there deletes it). A missing file is still 404.
- (0.9.3) Household settings and the phones' summaries. Additive: an older phone or web build passes
over both (an unknown table's entries and an unknown top-level field are skipped; checked against
0.9.0–0.9.2 in tools/sync-test).
- Entries of a new synced table,
household_settings(pk= itsk;row={ k, v },vJSON), in everyrestock-sync-*.bin(phones' and the web's), as in folder and Wi-Fi sync. One row per setting:shopAroundMin,defaultThresholdPct,listCompare,productOrder,recalls.enabled,tab:keg/tab:pharmacy(on),shop:<chain>{ on }and, for shops people added,shop:custom-…{ on, shop: { id, name, website, section, search?, createdAt }, removed? }. The later change wins per row (stamp, thendevice), like any synced record; any phone and the web may write them (no signature). Rows for a tab are only in the files of devices that sync that tab. The owner phone seeds missing rows from its own settings withstamp1, so any real change wins. Branches and store numbers are never in them. Rules:src/lib/sharedSettings.ts(web) andSharedSettings.java. - A phone's own
restock-sync-<device>.binon a server (not a folder's or WebDAV's) has a top-levelsummary:{ v: 1, version, checks: { everyHours, weekday?, background, lastAt?, lastItems? }, notifications: { catalogueDay, catalogueWeekday, daily, dailyTime?, greatDeals, monthly, stockUp, stockUpTips }, accounts: { woolworths, coles } (signed in, yes/no), cards (a count), backups: { on, everyDays, keep, lastAt?, photos }, historyWeeks, tabs, away ("none" | "folder" | "webdav" | "nextcloud" | "server"), homeAssistant: { on, entity? }, look: { theme, text ("Normal" … "Largest") }, receipts, sharedPrices, updates: { on, everyDays (1 or 7) } }. Built from an allow-list (PhoneSummary.java) and checked again by the web (src/lib/phoneSummary.ts); never an address, sign-in, password, token, card number, store number, area or folder. The web never writes one. - Phones list
GET /api/v2/filesevery 60 seconds while Restock is open, and run a round only when a file'sversionchanged (or their own file needs writing). Unchanged otherwise. - The shopping list's rows, in the same
household_settingstable (they aren't settings: applying the settings passes over them):alias:<words>→"<item id>"("Always use this for 'milk'";<words>asmatchKeyinsrc/lib/haMatch.tsleaves them),keep:<list line id>→true("Keep it as just 'milk'"), andha:phone→"<device id>"(the one phone in the household that syncs the shopping list with Home Assistant; never aweb-id). Checked strictly (checkListRowinsrc/lib/sharedSettings.ts): a key or value of any other shape, or a sample (demo-) item or line, is ignored. Any phone and the web may write them; the later change wins per row. A phone with Home Assistant already on and no row yet writesha:phonewithstamp1 (like the seed), so a phone named elsewhere still wins. A phone that leaves keeps itsalias:andkeep:rows. - List lines that a phone made from Home Assistant's list have an
idstartingha-(still just an id: older phones and both sync engines treat it as one). A line like that, not linked to an item or a shop's product and not ticked, shows "Pick my …" on every phone and the web unless akeep:row says not to. - The web reads a file's author from its name, as phones on a server always have: in
restock-sync-<device>.bin(and a browser'srestock-sync-web-<webId>.bin) the top-leveldevicemust be<device>, or the whole file is passed over (noted as seen, nothing taken in). A browser's file never changeshousehold,cardsorpricesentries, on the web as on a phone. Unchanged for writers: every device already writes its own name with its own id inside.
- Entries of a new synced table,
The design, its decisions and the work packages are in docs/server-v3-design.md; this section pins the
bytes. The code is src/server-mode/crypto.ts (marked "0.9.4, protocol v3"), src/server-mode/engine.ts
(role: 'server') and src/lib/haSync.ts (haLineId), bundled for the server as
restock-core.mjs (npm run build:server-core, src/server-core/index.ts). Test vectors:
tools/sync-test/vectors-v3.json, made with Node's own crypto and checked by src/server-core/core.test.ts;
the server's and the phones' (Java) tests read the same file.
- Bytes in JSON, QR codes and headers are base64url without padding (readers also take plain base64).
- Public keys are P-256 SPKI DER (91 bytes, Java's
getEncoded()). Private keys the server receives or hands out (owner_priv) are PKCS#8 DER as Java writes them; the core reads Java's and Node's encodings (privOfPkcs8) and writes the short form (pkcs8Of), which both read. - ECDH is P-256; its secret is the shared point's x-coordinate (32 bytes), as Java's
KeyAgreement. - HKDF is HKDF-SHA256 with 32 bytes out. "No salt" is RFC 5869's default (32 zero bytes). A salt that
travels as base64url (
n,c, an invite, a token, a sign-in id) is its decoded bytes. - Sealed = 12-byte random nonce + AES-256-GCM (16-byte tag) over UTF-8 JSON, with the associated data
named below (as UTF-8;
+ deviceappends the device id). - Invites, handover tokens, challenges and sign-in ids are 32 random bytes;
nis 16. - ECDSA is SHA256withECDSA, DER signatures (as v2 and
SyncHousehold.java).
- Server keys (
keys.json):kex(ECDH P-256, its SPKI isk=in every v3 code), the owner key (PKCS#8 + SPKI),keyv, household keys{ "<keyv>": key }for the versions it has, and serverKeys{ "<keyv>": serverKey }for every version (a phone keeps older versions as serverKeys only:server_filekeys).serverKey = HMAC-SHA256(householdKey, "restock-server-files-v1"), as v2. - The household record's owner-only rows are signed by the owner key, as 0.9.0 (
restock-hh1|pk|v=…|stamp). The server writes them throughWebSyncEngine.writeHousehold(k, v): the change goes through the database's triggers (stamped and noted assrv-<sid>), then its note gets the signature, as a phone's collect signs. The server keepssync_meta owner_pin= its ownowner_pub. server(new owner-only row, inownerOnlyon both sides):{ "v": 3, "sid", "home", "away" (or null), "kex" (server kex SPKI), "keepMonths" (0.9.4: 3, 6, 9, 12 or null; 0.9.5: a whole number 1–120 or null) }(parseServerRow). Writeowner = srv-<sid>beforeserver, so a 0.9.3 phone (noserverin itsownerOnly) takesserverin throughlegacyAllowedas the owner's.member:<device>={ "name": <label>, "pub": <the phone's my_pub> }, signed by the server.- The recovery copy (
recoveryrow) is 0.9.0's: base64url(sealed, no associated data) with keySHA-256("restock-recovery" ‖ r),r20 random bytes shown asformatRecovery(r)(base32 in fours), JSON{ secrets: { device: secret }, owner_priv, owner_pubkey, key, keyv (a string), oldkey?, oldkey_until? }(sealRecovery/openRecovery). Each phone'ssecretis 32 random bytes the server makes at join.
- Add a phone code:
restock-server:3?h=<home>&a=<away>&i=<invite>&k=<server kex SPKI>(URL-encoded). - Invite join body:
{ invite, device, name, pub, kex, myPub, n }(pub: the phone's request-signing key, as v2;kex: its ECDH key;myPub: its household signing key). - Member join body (no invite):
{ member: true, device, pub, kex, n, sig },sig= ECDSA by the phone's household signing key (my_priv) overmemberJoinText:"restock-member-v3\n" + device + "\n" + pub + "\n" + kex + "\n" + n(the strings as sent). The server checks it withmember:<device>.pub. - Upgrade body (signed with the phone's v2 key, so
deviceis the signer):{ kex, myPub, n, ha? }. - Answer (all three):
{ sealed }, sealed withjoinKey= HKDF(ECDH(server kex, phone kex), saltn, inforestock-join-v3), associated data"RSJ3" + device, JSON:{ format: "restock-join", v: 3, device, label, seed, household: { name, hid, sid, owner_pub }, keyv, keys: { "<keyv>": householdKey } (every version the server has, at least the current one), serverKeys: { "<keyv>": serverKey } (every version), secret, server: { home, away, keepMonths } }. haon upgrade: sealed with HKDF(ECDH(server kex, phone kex), saltn, inforestock-ha-v3), associated data"RSA3" + device, JSON{ address, entity, enabled, token, state }(state: itsHA_STATE).
"RSE3" + sealed with HKDF(ECDH(server kex, phone kex), no salt, info restock-keys-v3), associated data
"RSE3" + device, JSON { keyv, keys: { "<keyv>": householdKey } } (at least the new one). Written by
the server only, readable by that device only. A phone takes only a higher keyv than it has.
- Code on the web:
restock-handover:3?u=<origin>&t=<token>&k=<server kex SPKI>. - Body (signed with the owner phone's v2 key):
{ epub, sealed };epuba one-off ECDH key; sealed with HKDF(ECDH(e, server kex), salt token, inforestock-handover-v3), associated data"RSH3", JSON{ format: "restock-handover", v: 3, key (current household key), keyv, serverKeys: { "<keyv>": serverKey } (its server_filekeys and the current one), oldkey?, oldkey_until?, owner_priv (PKCS#8), owner_pubkey (SPKI), owner_secrets: { device: secret } (the other phones'), secret (its own), recovery? (base32), recovery_saved?, hid, name, ha? }.
loginKey = HKDF(authKey, no salt, "restock-login-v3")(authKey is v2's PBKDF2 bytes 0–31).GET /api/v3/login/challenge?user=→{ salt, c, kex }.POST /api/v3/login{ user, c, epub, proof },proof = HMAC-SHA256(loginKey, "restock-login-v3\n" + c + "\n" + epub)(candepubas the base64url strings sent).sessionKey = HKDF(ECDH(server kex, epub) ‖ loginKey, salt c, "restock-session-v3")(the 32-byte secret, then the 32-byte loginKey). Answer{ session, expires, sealed },sealed= base64url of RSF1 with the sessionKey ("RSF1"+ nonce + AES-GCM(gzip(JSON)), associated data"RSF1", as v2's files) of{ keys: { "<keyv>": serverKey } (every version), keyv, webId, household: { name, owner_pub } }.- Sign in with a phone:
POST /api/v3/qrlogin { epub }→{ id, kex, expires }; the code isrestock-login:3?u=<origin>&s=<id>&k=<epub>;sessionKey = HKDF(ECDH(server kex, epub), salt id, "restock-session-v3"). - Every later request:
Authorization: RestockWeb3 s=<session>, t=<unix ms>, n=<16 random bytes>, m=<mac>,mac = HMAC-SHA256(sessionKey, METHOD\nPATH_AND_QUERY\nt\nn\nhex(sha256(body))), the same text a phone signs (requestText; body the bytes sent, sealed ones included; no body hashes the empty string). Clock window and nonces as v2's phone requests. - Answers with household data, and request bodies with secrets, are raw RSF1 bytes sealed with the
sessionKey,
Content-Type: application/x-restock-sealed.
- Names:
allowedNameV3: v2's lessrestock-sync-keys-*.jsonandwebkeys/, pluskeys/<device>.bin.restock-sync-srv-<sid>.bin(serverFileName) is the server's own, written by the server only. - A phone's own file on a v3 server is v2's plus top-level
shares: { tabs: ["pantry" | "keg" | "pharmacy"], receipts: bool, cards: bool }(pantryis the groceries: pantry and shopping list). - The server's merge (
takeFile, roleserver) takes from each phone only what it shares: a record of a tab, receipts or cards it doesn't share is passed over, and so is amoveddelete of one; a plain delete of one is taken only when that phone made the record (itsoriginon the server, below; not merely the last to change it): "Also take what this phone shared off the server" (the phone sends deletes for its own records of that tab, the receipts' and the cards' too, even though it no longer shares them). A record whose maker isn't known stays. A file withoutshares(0.9.3 phones, browsers) is taken as it is. What a phone last declared is insync_meta phone_shares:<device>(sharesOf);lastDroppedcounts what was passed over, for the log. - Who made a record (0.9.4 final fixes):
sync_log.origin(schema.tsSYNC_094), a device id or null (not known). The triggers set it to this device when a record is made (or made again, the momentscreatedis set; a receipt saved again keeps it) and keep it through edits and deletes. Entries carry it as an optionaloriginin every sync file and Wi-Fi message (older readers pass it over). Taken in (SyncEngine.originOf, engine.tsoriginOf): a record that's here and live keeps its own unless the change made it again (a newercreated); a new one, or one made again, takes the entry'sorigin, else the entry'sdevicewhen that change was the one that made it (stamp = created); it's never filled in later. The server also doesn't believe a file whose phone claims to have made a record someone else changed last. Records from before 0.9.4: known only wherestamp = created(their device made them and nobody changed them since); the rest stay unknown, so they're never taken back. - Deletes and tabs (0.9.4 final fixes, phones and the engine alike): a plain delete of a record whose
copy here is on a tab this device doesn't sync is passed over, like that tab's changes (so what a phone
takes back never reaches a phone that doesn't share the tab, and its own copy stays). A
moveddelete (the record's own stamp) wins only when it's newer than the copy here, never by "a delete beats edits", so turning a tab off on one phone (whose file other phones read too) never deletes the others' copies of records it changed last. - The server's own file is a sync file like a phone's: everything but
cards, prices changed in the last 60 days, the household's rows with their signatures,seen;nameis the house's name. - Auto delete (0.9.4: Keep data for):
keepCutoff(keepMonths, now)= ISO time ofnow − keepMonths × 2,629,800,000 ms(a year's 365.25 days over 12; null for Until I delete). Phones use the same arithmetic withkeepMonthsfrom the signedserverrow. Incoming prices dated before it are passed over unless nothing newer for that product is on the server or in the same file (the latest stays, aspruneHistory); receipts scanned before it unless pinned; the same for archives.prune(cutoff)drops them quietly (no deletes go out) and returns the receipts that went, for their photos. compact(): deletes older than 90 days that everymember:phone has seen (seenin their files).
A line made from Home Assistant's item uid on the list entity has the id
haLineId(entity, uid) = "ha-" + the first 24 hex characters of
sha256("restock-ha-v1\n" + entity + "\n" + uid) (UTF-8). A store adds it with INSERT OR IGNORE and
returns that id whether it added it or it was there (Store.addLine(line, uid)); syncRound then pairs
the item with the line already there. 0.9.3's random ha- ids stay as they are.
All additive to the shapes the web (P5) codes against; extra fields can be passed over.
- Sessions: each v3 browser session has its own
webId(its file isrestock-sync-web-<webId>.bin). The login, setup andGET /api/v3/sessiongift is{ keys, keyv, webId, household: { name, owner_pub }, mode }(keys{}andhouseholdnull outside modev3);sessionaddsuser, kind, expires. Every 2xx JSON answer to a RestockWeb3 request is sealed; errors stay plain JSON.POST /api/v3/setupalso takes the setup page's v2 passphrase cookie (then answers plain{ ok, mode, house: { name } }), and{ name, afresh: true }in modereleasedstarts the server afresh (old files to the trash). POST /api/v3/qrlogin/<id>(phone): body{}or{ k }(the code'sk; if sent it must be that sign-in's epub).GETanswers{ pending: true, status, expires }, then once{ pending: false, status: "done", session, expires, sealed }; the sealed gift addsdevice, deviceName.POST /api/v3/joinbring (a phone household onto a new, empty server, design section 7): the invite body plusbring: { epub, sealed },sealed=sealHandover(handoverKey(e, server kex, salt = the invite's decoded bytes), <the RSH3 payload>). Taken only while no phone has joined the server (else 409not-empty); the answer is the usual RSJ3 gift with the brought household's keys (seed: false,household.name= the server's house name).POST /api/v3/upgradeanswers{ sealed, ha?: true }(hawhen the server took the phone's Home Assistant: only from the phonehousehold_settings ha:phonenames). A phone with aremoved:<device>row gets 401removed; one with nomember:<device>row 403member(being on the server isn't being in the household).POST /api/v3/setupandPOST /api/v3/handoveranswer 409signinuntil the server has the passphrase'sloginKey(a v2 session from before the update): sign in again (v2) first.- Home Assistant
PUT/testwith an address on another origin than the saved one need the token again (400token/ok: false). GET /api/v3/phonesrows addapi(2: not upgraded yet).POST /api/v3/phonesaddsexpiresIn, label, home, away.DELETE /api/v3/phones/<d>(passphrase session) →{ removed, keyv }(the new key version: browsers askGET /api/v3/sessionagain).PATCH→{ device, label }.GET /api/v3/browsersrows addexpires,device?(the phone that let a phone sign-in in),ip?(masked).- The passphrase again (0.9.4 final fixes) for the dangerous admin actions: the body carries
confirm: { c, proof },ca fresh challenge fromGET /api/v3/login/challenge(used once),proof= HMAC-SHA256(loginKey,"restock-login-v3\n" + c + "\n" + <this session's id>) (loginProof(loginKey, c, sid), as a passphrase change proves the current one; session.tsconfirmPassphrase). Without it: 403confirm; a wrong one 403current(counted towards the sign-in lockout). Needed by:POST /api/v3/recovery { confirm }(the key),POST /api/v3/backup,POST /api/v3/prune,PUT /api/v3/settingswhenkeepMonthsgets shorter (or goes from Until I delete to a window: data is deleted), andDELETE /api/v3/phones/<d>(its body{ confirm }). GET /api/v3/settings→{ name, keepMonths };PUTtakes either (passphrase session) and answers the same; changingkeepMonthsre-signs theserverrow and prunes at once.POST /api/v3/prune { before, confirm }→{ cutoff, prices, receipts, photos, archives, logs }(counts).GET /api/v3/recovery→{ saved };POST /api/v3/recovery { confirm }→{ recovery, saved };POST /api/v3/recovery { saved: true }notes it was saved.- Receipt photos (0.9.4 final fixes): a
PUTofphotos/<sha256>.binmust open with one of the household's serverKeys as{ format: "restock-photo", sha256, data }withsha256= the name's and = SHA-256 ofdata's bytes, or it's refused (400photo), new or replacing. The path → photo map a phone's file or archive gives (photos) is noted per path for that phone (srv_photos.device): another phone's file can't point a path at another photo, and a photo that isn't on the server isn't noted. - Connections (0.9.4 final fixes): a request's headers must arrive within 20 seconds and all of it within 10 minutes; a kept-alive connection with no request goes after 10 seconds, and one where nothing moves either way after 2 minutes. No endpoint holds an answer back (sign-in and link codes are polled, each poll answered at once), so only a client that stopped sending is cut off.
POST /api/v3/backup { passphrase, confirm }refuses a backup passphrase that fails the passphrase rules (400weak). The file:RSB3, 2-byte length, header JSON{ v: 1, kdf: "scrypt", N, r, p, salt }, 12-byte nonce, AES-256-GCM(gzip(tar)) with the 16-byte tag at the end; associated data = everything before the nonce.scripts/restore.mjsreads it.- Activity and log rows add
who("Web page", "The server", the phone's label, "A removed phone"). GET /api/v3/historyrows addmember_only, source.GET /api/v3/stats?months=→{ months: [{ month ("yyyy-mm"), receipts: { <tab>: total }, receiptCount, productsTracked, specialsSeen }] }.GET /api/v3/specials→{ specials: [latest special price per product, 14 days, with product name/chain/image], lists, catalogues }(lists/cataloguesas in the server's own file, below).- Home Assistant:
GETaddsphoneName,offOn,blocked(why the server isn't running it, in words, or null);PUTalso takesoffOn: "<device>"("It's off on ", for a 0.9.3 phone still named inha:phone), andenabled: falsedeletes theha:phonerow if it names the server.testaddsversion;syncaddscame, went, heldwhenok. household_settingsbranch:<chain>(chain[a-z0-9][a-z0-9_-]{0,63}) ={ "name" (1–80), "storeNo"? ([A-Za-z0-9 _-]{1,16}) }and nothing else; anything else underbranch:is passed over by the server.- Shared specials: a phone file's top-level
specials(lists≤ 60, ≤ 1000 items each, ≤ 512 KB a list) andcatalogues(http(s)url≤ 500,note≤ 300) are kept per chain, newestatwins, only for chains on tabs that file'ssharesincludes; items keep onlystoreProductId, name, price, wasPrice, promo, imageUrl (http(s)), isSpecial. The server's own file carriesspecials: { at, lists }(lists of the last 14 days) andcatalogues. - The household's
tabsandreceiptsafter a handover or a bring stay as the household had them until every member that isn't removed is on v3; then the server signstabs = "pantry,keg,pharmacy"andreceipts = "1"(loggedhousehold-widened). A fresh house starts with both all on. Phones keep deciding by their own shares. - Home Assistant: when the server takes it over (turned on from the web, "It's off on ", a handover or an
upgrade that brings it, while it's on), it writes
household_settingsha:phone = "srv-<sid>"as its own change (noted assrv-<sid>, so it's in the server's file, newer than the phone's): the phone that ran it deletes its token and stops. Turned off on the web, the server deletes the row if it names itself. Whileha:phonenames a phone still on 0.9.3 (api: 2) without "It's off on ", the server neither runs it nor writes the row. - Errors v3 adds:
mode(409, withmode),released(409),update(403,api: 3; also a 0.9.4 phone that hasn't upgraded yet on a v3 path other than upgrade),v3(409: a v2 endpoint the server no longer serves),done/handover(409),member(401),not-empty(409),challenge(401: the challenge was used or expired),current(403),weak(400),core(503: no Restock core in this copy),node(503).
All within the shapes above; the server (P2) already answers them.
- Codes.
restock-server:3?h=&a=&i=&k=(an Add a phone code without a P-256kis turned down as damaged),restock-handover:3?u=&t=&k=(the phone checksu's host is its server's, as for sign-in codes) andrestock-login:3?u=&s=&k=. A 0.9.4 phone still readsrestock-server:2and the v2 web codes. - Before joining the phone asks
GET /api/v3/health(unsigned). It readsempty(a boolean) only if the server sends one; otherwise an owner phone in a phone household is offered Bring, and a 409not-empty(the invite isn't used) offers leaving its household and joining instead. - Joining fresh (a phone in no household, or one that just left its own): it shares
tabs = "pantry",share_receipts = "0",share_cards = "0", Wi-Fi sync off (sync_meta wifi_sync = "0"), label "Home" for the server (server_label). Its own records go up "giving way": theirsync_logstamps are set to -1 (below any other phone's), so wherever the house already has a record the house's copy wins, and a record only it has still goes up. The first phone of a new house (seed: true) keeps its stamps and seedshousehold_settings(sync_meta seed_settings = "1"), as the 0.9.3 owner did. - Upgrade (after
403 update): the answer is opened with the server's kex key pinned from a code (the owner phone pins it from the handover code). A phone that never scanned a v3 code takes it from the answer'skex, else health'skex, elseGET /api/v3/login/challenge'skex(public, in every code), and keeps it only because the opened gift holds this household's own key and itsowner_pubequals the phone's pinned owner key. It then shares what it shared: its tabs and cards as they were, receipts asreceipts_effwas. POST /api/v3/qrlogin/<id>(phone):{ approve: true, k },kthe code's browser key.- "Also take what this phone shared off the server" (design 14):
sync_meta server_takeback={ "keg" | "pharmacy" | "receipts" | "cards": <ms when ticked> }. While a kind is in it, the phone's own file carries, instead of collect'smoveddeletes, a plain delete for each record of that kind this phone made (sync_log.origin= its id; a tab's categories, products, items, list lines, receipts and prices), stampedmax(ticked, its stamp + 1); records other phones made, or whose maker isn't known, stay. They're found a table at a time (joined with what their tab comes from), not a query a record. The phone keeps its own copy: it never takes in a delete by itself of a record it's taking back. Turning the kind on again clears it. - Leaving with take-back:
syncStopServer({ bringBack, takeBack }). The Leave sheet offers a box for each personal kind the phone shares (Keg, Health, receipts, loyalty cards; never groceries; gift cards ride with loyalty cards, below), all unticked. Ticked ones are turned off and taken back as above, then one round puts the phone's file with the deletes on the server, then it leaves; if that round can't reach the server it doesn't leave (the error starts "Couldn't take those things off the server"), and the sheet offers leaving without taking them back. - Shared specials (design 15) in the phone's file on any Restock server:
specials: { at, lists: [{ chain, at, items: [{ storeProductId, name, price, wasPrice, promo, imageUrl, isSpecial }] }] }from what its Specials page already fetched (kvspecials; at most 120 items a chain), andcatalogues: { "<chain>": { url, note? } }for the shops it follows, from what its Catalogues page found (https only). Nothing is fetched for them. household_settings branch:<chain>(the web's default branch): a phone uses it only where it hasn't picked its own:StoreChoice.primaryempty, or still the default it took (householdBranch); Coles'branchStoreNolikewise (householdStoreNo). It's applied only for the tabs the phone syncs, and never seeded.- In a house the phone never writes or reads a keys file,
webkeys/or a vault link; folder (and WebDAV) sync is turned off (D13); Wi-Fi sync stays, off by default for a phone that joined fresh. A401 removedmakes the phone forget the household and keep everything (notice = "server-removed"); Leave isDELETE /api/v3/devices/<me>(best effort, after bringing offloaded receipt photos back if it can), then the same.
Removed. The web page's search went in 0.19.0 with the old web app, and the code for it (
src/server-core/search.ts,src/stores/node.ts,settings.webSearch) in 0.20.1. The server contacts no shop. What follows is how it worked.
The one time the server contacts a shop (Declan, 10 Nov 2026: option B). A server setting, off by default
(and off on servers from before: a state.json without it is off), stored in state.json settings.webSearch
(the server's own, not a household row: phones never see it). Only the admin turns it on or off.
GET /api/v3/settingsaddswebSearch: boolean.PUT /api/v3/settings { webSearch: true | false }(a passphrase session, as every settings change; anything but a boolean is 400webSearch). Loggedweb-search-on/web-search-off. Turning it off also forgets every search kept for Track.POST /api/v3/search(any signed-in browser, RestockWeb3; sealed answer){ q, section?: "pantry" | "keg" | "pharmacy" (default "pantry"), chain?: "<one of the household's shops on that tab>", barcode?: "<8–14 digits>" }→{ search: "<id>", at, expires, text: "<q as searched: normaliseQuery>", section, shops: [answer…] }, one answer per shop, in the order the phone lists them:{ chain, name, status: "ok", items: [product…], top: ["<storeProductId>"…], message? }:itemsbest first (searchHelpscoreAll, counting where the shop put it, as Add.tsx), at most 40;topthe ones the phone would recommend (topPicks);messagewhen a web shop's page had nothing the server could read.{ chain, name, status: "blocked", blocked: true, message: "<Shop> blocked the search from your server. Search it on a phone instead." }: the shop turned the direct request away (where the phone would use its hidden browser).{ chain, name, status: "error", message }: too slow (10 s), too big (3 MB), sent elsewhere, unreachable.{ chain, name, status: "skipped", message }: a shop people added (never asked from the server), or a built-in web shop with no known search page.- A product is the phone's
StoreProduct:{ chain, storeProductId, name, brand?, size?, barcode?, imageUrl? (https only), price?, wasPrice? (the usual price, only above price), isSpecial, halfPrice? (exactly half), memberOnly, promo?, unitPriceText? (the shop's), unitText? (the phone's unitTextOf), inStock?, itemId?, itemName? };itemId/itemNamewhen one of the household's pantry items already has that product. - The shops: the household's shops on that tab (server
kv settingsenabledChains,sections; one per website,searchChainsIn), Coles at thebranch:colesrow'sstoreNo(falling back to its online shop, as the phone). With a barcode, Woolworths and Coles are also searched for the barcode itself (exact first). - Errors (plain JSON): 403
web-search-off"Turn on Let the web page search the shops in Settings." (checked first, before anything is read or counted); 401auth; 403forbiddenfor a phone; 400q(empty, or over 100 characters),barcode,section,chain("That isn't one of your shops."),shops(the tab is off or has no shops); 429rate(10 searches a minute per browser session) orrate-server(60 an hour for the whole server), withRetry-After. One search runs at a time; the others wait their turn.
POST /api/v3/search/add(the same browser that searched, within 15 minutes; sealed answer){ search: "<id>", picks: [{ chain, storeProductId }…] (1–6, from that search), target?: "pantry" | "list" | "both" (default "pantry"), list?: "general" (the line on General instead of the tab's list: withtarget "list"only, no category), name?, categoryId?, qty? (1–99, default 1) }→{ item: { id, name, section } | null, products: ["<product id>"…], line: { id, list } | null }. As the phone's Add saves: forpantry/botheach pick's product (an existing one with the same chain and shop id is reused) with today's price as the shop gave it (source "auto"; the browser never sends a price), then a pantry item (first pick = My pick, the others the same thing at other shops;nameorgenericName; alert "good"); forlist/botha list line (with the item, or on its own with the cheapest pick's chain, price andproductdetails). The search's tab is the item's and line's. Written by the server (its sync triggers: devicesrv-<sid>), so they go out in the server's file to every phone (0.9.4 phones take them like any of the server's rows; no new kinds); each record'ssync_log.originis the browser'sweb-<id>. Errors: 403web-search-off; 410search-gone(unknown, expired, or another browser's search); 400picks,target,categoryId(must be a category on that tab),qty,list(not a list of that tab or General, or General with Track).- How the server asks (
src/stores/node.ts, throughhttp.tssetTransport, only in the server's core build):fetchwith the phone's own URLs and headers for its direct requests (woolworths.ts, coles.ts, aldi.ts, endeavour.ts; a built-in bottle shop or chemist's known search page, read for its JSON-LD or embedded data only),User-Agent: Restock server (self-hosted grocery price tracker)unless the shop's connection sets its own; https only, only the hosts inSHOP_HOSTS(the built-in shops' websites and search pages from shops.ts, andapi.aldi.com.au,api.danmurphys.com.au,api.bws.com.au), no port, no sign-in part; a redirect only to another host of the same shop (at most 3); 10 s for each shop's whole search; 3 MB an answer (after unzipping); cookies in a jar for that one search, dropped when it ends; nothing outside a search (no timer, no background). - Logged (srv_log activity):
shops-searched { tab, shops: { "<chain>": "<status>" } }andadded-from-search { tab, tracked, listed, shops }, by the browser. Never what was searched for, nor its length.
Server side in server/src/v3/data.mjs. Every endpoint below is a browser session's (RestockWeb3: no session
401 auth, a bad MAC 401, a phone 403 forbidden); every 2xx answer is sealed, errors stay plain JSON.
Spending is what gets ticked off, not receipts. Server table srv_spend (household.db, so it's in the
encrypted backup and goes with Delete everything), one row a tick: entry_id, checked_at (ms; the key), at
(ISO of checked_at), chain, section, item_id, product_id, text (the item's name, else the line's),
qty, price (per pack), total (price × qty), usual, special (0/1), src (line | price | none).
- Noted by a sweep of
list_entriesafter every merge and every change the server makes itself (Home Assistant, the web's own file, joins: whatever goes through the server's own file), and at start (so a server updated with ticked lines on its list fills it in). Idempotent. - A line with
checked = 1andchecked_atset is one purchase. Price: the line's ownprice(per pack; the list totals price × qty), else the newest price on or before the tick of the item's products at the line's shop (its usual product first, then the same ones, then the ones it would also take), else, with no shop on the line, the cheapest such price of its usual and same products (and that's its shop), elsepricenull ("ticked without a price", counted asunpriced). A one-off line found at a shop uses itsproduct'sstoreProductIdfor its product. usualis verdict.tscomputeStats().typicalported (hasCard: the server can't know): the last reading of each day in the 183 days to the tick, the median of those not on special, else the median of the shops' "was" prices, else the shared history'smarket.normal. Saved on specials = Σ (usual − price) × qty over purchases with both known and usual > price.- Unticked within 48 hours of the tick (the line still there,
checked = 0with a laterchecked_at): that purchase is taken back. Ticked again: a new one (a re-tick within 48 hours of an earlier tick replaces it, as there was an untick between). A line cleared off the list keeps its purchase; one unticked later than 48 hours (needed again) does too. Lines and items withdemo-ids aren't counted. - Not noted when older than Auto delete's cut-off, or older than the last time statistics were deleted
(
sync_meta srv_spend_floor), so a line still ticked on the list doesn't come back after a delete.
Reads
GET /api/v3/data/summary→{ kinds: { prices: { count, products, archives, oldest, bytes }, receipts: { count, pinned, photos, oldest, bytes }, stats: { count, oldest, bytes }, logs: { count, activity, oldest, bytes }, backups: { count (files), folders, oldest, bytes, nightly: false, keptDays: 30 } }, total, other, database, files, measured: "dbstat" | "estimate", disk: { free, size } | null, autoDelete: { months, cutoff }, resend: { at, next }, at }. Bytes: SQLitedbstatpages of each kind's tables and indexes (an estimate from row lengths where dbstat isn't built in), plusarchive/files (prices) andphotos/files (receipts). The server makes no nightly copies of its own (the backup is a download), so "backups" is its trash:archive/andphotos/files deleted or replaced, kept 30 days.total= household.db (+ WAL) + files/ + trash;other= what isn't in a kind (sync bookkeeping, sync files).diskfromstatfson the data folder.GET /api/v3/data/stats?period=<1–120 | all>(months back from the start of this month, server's time zone; default 12) →{ period, from (ISO | null for all), to, spending: { total, count, unpriced, months: [{ month "yyyy-mm", total, count, unpriced }] (every month in the period, oldest first) }, shops: [{ chain | null, total, count, unpriced }] (biggest first), sections: [{ section, name, total, count }] (by shopping list:pantry"Groceries",keg,pharmacy"Health",general"General" on its own; a line with none is the groceries'), saved: { total, count }, itemsTracked (pantry items), productsTracked (with a price in the period), prices: { count, first (oldest date, all time), inPeriod }, top: <the first page of top> }. 400periodotherwise.GET /api/v3/data/top?period=&offset=(0…)&limit=(1–50, default 10)→{ items: [{ key, itemId | null, name, times, qty, total, lastAt, lastPaid: { price, chain, at } | null, usual | null, cheapest: { chain, price, productId, date } | null }], offset, limit, total }, most often bought first. Lines without an item group by their words (key=text:<words>).GET /api/v3/data/series?item=<item id>&period=→{ item: { id, name }, period, from, usual, chains: [{ chain, productId, usual }], weeks: [{ week ("yyyy-mm-dd", the Wednesday a specials week starts), chain, price (the cheapest that week), special }], paid: [{ at, chain, price, qty }] (≤ 200) }, over the item's usual and same products (or, with none, the ones it would also take). 404not-foundfor no such item.
Export: restock-export v1. The browser builds the spreadsheet, CSV and full export file from it.
GET /api/v3/data/export→{ format: "restock-export", v: 1, app: "restock-server", version, at, house: { name }, autoDelete, tables: { items, products, categories, list, receipts, shops, settings, aliases, spending }, paged: { prices: { count, path, limit }, ticked: { count, path, limit } }, truncated: [<table>] }. Rows are the household.db columns, cleaned:items.same_product_ids/alt_product_idsas arrays,not_atandlist.productparsed;receiptsare metadata only (id, scanned_at, shop, chain, receipt_date, total, section, note, pinned, photos(how many)), never their text or photos;shops=[{ id, on, name?, website?, section?, removed?, branch?: { name, storeNo? } }]fromshop:andbranch:rows;settings= the other household settings{ k: value };aliases=[{ words, item_id }];spending= all-time months as in stats. Small tables are capped at 50,000 rows (named intruncated).GET /api/v3/data/export/prices?after=<id>&limit=(1–10000, default 5000)and…/export/ticked?…→{ table, rows, next }(keyset pages: ask again withafter = nextuntilnextis null).pricesrows:id, product_id, date, price, was_price, is_special, member_only, promo, source;tickedrows: srv_spend's, withid. The full export file is the first answer withtables.pricesandtables.tickedfilled from the pages (andpageddropped).- Never in it: loyalty cards and gift cards (no cards table at all; their numbers and PINs never reach household.db), Costco prices (a phone's Costco lines, products, prices and picks are never sent), receipt text, the
passphrase or anything made from it, keys (household, server, owner, kex, phones'), sessions, the recovery
key, the Home Assistant token or which phone runs it,
demo-rows. A future import takesformatandvfirst and refuses a higherv. - 0.9.6: never Costco's prices (Declan, 11 Nov 2026): products with
chaincostcoand their prices are left out (paged.prices.counttoo), a list line at Costco haspricenull and no price or unit price text inproduct, and a ticked purchase there keeps what and when but hasprice,total,usualnull (the monthlyspendingtotals still count it). When any were left out the answer sayswithheld: { costco: { products, prices } }. The web page leaves them out again itself (exportFiles.ts withoutCostco), so a 0.9.5 server's export saved from a 0.9.6 page has none either. (0.9.6 phones never send Costco's records at all.) - 0.9.6:
summary.kinds.prices.importedandstats.prices.importedcount prices withsourceimported; aseriesweek whose cheapest price was imported hasimported: true.
Manage. Every delete is two steps on the web; the server checks both: body { …, typed, confirm: { c, proof } } (confirm as for Remove). Order: no confirm → 403 confirm; typed not exactly the word → 400 typed
(the challenge isn't used); a wrong passphrase → 403 current (counts towards the lockout). Passphrase sessions
only. Nothing here deletes the shopping list, the pantry (items, products), categories, household settings or
each product's newest price (prune's rule: date < MAX(date) for that product); pinned receipts stay. Prices
and receipts go quietly (no deletes go out to phones; a deleted receipt's sync record stays, so a phone's
unchanged copy doesn't bring it back). Logged in srv_log activity with who (data-deleted,
deleted-everything, auto-delete-changed, phones-asked-to-resend, recounted, data-exported).
POST /api/v3/data/delete { kinds: ["prices" | "receipts" | "stats" | "logs" | "backups"…], before?: ISO (in the past), typed: "DELETE", confirm }→{ deleted: { cutoff, prices, receipts, photos, archives, stats, logs, backups }, kinds, before }(counts;beforenull = everything of those kinds).prices: price history (andarchive/months wholly before the date);receipts: receipts and their photos (and those archive months);stats: srv_spend;logs: srv_log (activity and logs);backups: trash folders made before the date (all without one). Photos and archive files go to the trash (30 days) unless "backups" is in the same delete without a date; rows in household.db are gone at once. 400kinds/before. An archive month goes only when everything in it goes (its prices only withprices, its receipts only withreceipts) and never one holding a pinned receipt; the rest stay, and what was deleted of them stays out when one is read again (sync_metaprices_floor,receipts_floor).POST /api/v3/data/delete { kinds, before?, dryRun: true }(0.9.5 review) →{ counts: <as deleted>, kinds, before, dryRun: true }: exactly what that delete would take, by the same rules, deleting nothing. Any browser session (no passphrase, no typed word). The web's Step 1 (Clean up, Delete…, Auto delete) shows these numbers.POST /api/v3/data/delete-everything { typed: "DELETE EVERYTHING", confirm }→{ ok, mode: "new", phones }. The household goes: household.db, every file, the trash, the household's keys and Home Assistant settings (token included). Every phone is unlinked as by Remove: its next request is 401removed, so it forgets the household and keeps all its own things (notice = "server-removed"); it can be added again later. The admin's sign-in and the server's settings (Auto delete, Let the web page search the shops) stay, and so does the browser session that asked (its page wipes its own copy). 0.9.5 (review): every other browser session ends (each one's copy of the household would go into the next one). Each household has an id (state.house.id) and each session notes the one it was made for (house; a session from before 0.9.5 is of the one there is); a browser's sync file from a session of another household is refused (409household), and the web drops a copy whose pinned owner key isn't the household's (live.ts, the PWA's offline copy too). A browser's file whose session is gone is never merged again and goes to the trash (at a merge, a start, and nightly). The server is new again: Set up this server (POST /api/v3/setup { name }).- Auto delete (replaces Keep data for; same
state.json settings.keepMonths):null(off) or a whole number of months 1–120. New servers start off; a server that has a value keeps it (0.9.4's default was 12); a value that isn't one reads as 12.GET /api/v3/data/autodelete→{ months, cutoff }.PUT /api/v3/data/autodelete { months, typed?, confirm? }→{ months, cutoff, was, deleted: <as delete> | null }; turning it on or shortening it deletes at once, so it needstyped: "DELETE"andconfirm; longer or off needs neither. 400months.PUT /api/v3/settings { keepMonths }takes the same values with the same checks, andGET /api/v3/settingsaddsautoDelete(=keepMonths). Runs nightly (the 3 o'clock hour in the server's zone:TZ, else Node's local zone, else UTC; worked out with Intl, as the Data tab's months and days are, at most once a day, and once soon after a start), over prices, receipts and photos, archives, statistics and logs. The signedserverrow carrieskeepMonthsas it is: a 0.9.4 phone reads a value other than 3, 6, 9, 12 as no cut-off (it shows Auto delete as off, offloads all it would, and the server passes over what's older than its cut-off). 0.9.5 phones and the web (parseServerRow,keepCutoff,SyncHousehold.keepMonthsOk) take any whole number 1–120. - Ask phones to resend:
POST /api/v3/data/resend→{ at, next }; passphrase sessions only (403passphrase); at most once a day (else 429ratewithretryAfter,next, which the web shows). The server re-signs itsserverrow withresend: <ms>. A 0.9.5 phone (ServerSync.resendIfAsked) seeing aresendit hasn't answered (sync_meta server_resent) writes its whole file again with every price it has (not just the last 60 days' changes), once. The server merges it as any file, so nothing doubles. A 0.9.4 phone'sparseServerRowpasses over the field. A resend that fails waits a day (server_resend_wait) and is then answered; one refused for its size is answered at once: never every round. - Recount:
POST /api/v3/data/recount→{ added, removed, checked, repriced }: the sweep, then every purchase priced again from what's known now (the line's own price if it's still there with that tick). The statistics are computed from srv_spend and prices when asked; nothing else is cached. Passphrase sessions only (403passphrase), one at a time and not within 60 seconds of the last (429busy/ratewithretryAfter); 500 rows at a time, the server answering other requests in between. POST /api/v3/prune(0.9.4's Delete older data) stays as it was (passphrase, no typed word): prices, receipts (their photos and archive months) and logs, never the statistics; the Data tab uses/api/v3/data/delete.
Server side in server/src/v3/import.mjs, the web in src/server-mode/ui/DeskDataImport.tsx and
importFile.ts. The file format, with an example, is docs/restock-import.md. An import merges a file ON TOP
of the server's data: it only adds products (the catalogue) and prices (price history). It never
replaces or deletes anything, never touches the shopping list, the pantry (items), categories, receipts,
settings or cards, and every price it adds has source: "imported" (apart from auto, prices a phone checked,
and manual, typed in). Costco is never imported (as it is never exported).
The browser reads the file (the Full export file .json, a restock-export v1; or the Data tab's CSV
.zip, of which it reads Products.csv and Prices.csv; a spreadsheet .xlsx is refused with what to use
instead), refuses one carrying anything secret (a table named like cards, keys, sessions, recovery; a field
named like number, pin, password, passphrase, secret, token, key, recovery, or a receipt's text, photo,
pages; a data: picture), and sends its products in chunks. Every chunk is checked again on the server.
All four endpoints are a browser session's (RestockWeb3: none 401 auth, a bad MAC 401, a phone 403
forbidden), POST, plain JSON bodies under the server's 256 KB request cap, every 2xx answer sealed, errors
plain JSON.
- A chunk's body:
{ products: [product…] }(importandntoo for/chunk), at most 2,000 products and 5,000 prices (400chunk). A product:{ ref?, chain, store_product_id?, barcode?, name, brand?, size?, image_url?, qty?, qty_unit?, more?, prices?: [price…] }; a price:{ date, price, was_price?, is_special?, member_only?, promo? }. Any other field, or a product or price that isn't an object, refuses the whole request (400fields/products/prices) before anything is read or written.more: trueis the rest of a product an earlier chunk started (the web splits a product with many prices between days). - Each field (a product or price that fails is left out and counted in
problems, the rest go on):chaina shop the server knows (a built-in shop or one of the household's own; notother; lower case, trimmed) elseshop;costco(or any shop whose records stay on one phone) is counted incostco, never kept.name1–200 characters after tidying (NFC, control characters out, spaces collapsed) elsename.store_product_idtext or a number (anything else: the product is left out,shop-number), ≤ 100,brand≤ 100,size≤ 40 characters (longer: left out). Arefis per shop: the same ref at two shops is two products.barcode8, 12, 13 or 14 digits (a GTIN-14 with leading zeros as its 13), else left out (barcode-left-out, a note).image_urlonly https, no user, password or port, and only from a host the household's own products at that shop already show pictures from, else left out (picture-left-out, a note).qty> 0 and ≤ 100,000 withqty_unitg,mlorea, else both left out. At most 5,000 prices a product (too-many-prices, its prices counted inproduct-ignored-prices). A price'sdate:yyyy-mm-dd(noon that day in the server's zone), a date and time with no zone (the server's zone) or an ISO time withZor an offset; from 2000 to no later than a day from now, a real day, elsedate.pricea number from 0.01 to 10,000 (to the cent) elseprice;was_pricekept only when above the price and ≤ 10,000;is_special,member_onlybooleans or 0/1 (absent false) elseflag;promo≤ 120 characters. The server's ownid,sourceandcreated_atare never taken from a file. - Which product: the one the server has with the file's
refas its id at the same shop, else the same shop andstore_product_id, else the same shop andbarcode, else (only for a product with neither) the same shop, name and size (ignoring case). An existing product is never changed. A new one getsrefas its id when that's free (and doesn't startdemo-), else a new UUID;created_atnow. The server holds at most 50,000 products in all: past that an import adds no new ones (full, its pricesproduct-ignored-prices). - Which prices: one a day per product (the day in the server's zone): the newest of each day in the file
(the others are counted in
skipped). One the server already has that day at the same price is a duplicate (skipped); when the server has that day at another price, the newest wins: the import's is added only when it's later than the server's reading that day, elseskipped. A day the product already has an imported price for (an earlier chunk or import) isskippedtoo, so one a day holds across chunks: the first one in wins. Nothing already there is changed. POST /api/v3/data/import/check { products }(the dry run; any browser session) →{ products: { add, matched }, prices: { add, skipped }, costco: { products, prices }, problems: { "<code>": n } }. Writes nothing. A product withmorethe server doesn't have counts as one an earlier chunk counted.POST /api/v3/data/import/start { confirm }(a passphrase session, 403passphrase; the passphrase again as for Remove: noconfirm403confirm, a wrong one 403current, counting towards the lockout) →{ import: "<id>", until, idleMs, limits }. One import at a time on the server: another going is 409busy(said before the passphrase is used). At most 10 starts an hour (429rate); 507fullwith under 200 MB free on the server's disk.POST /api/v3/data/import/chunk { import, n, products }(the same session) →{ products: { added, matched }, prices: { added, skipped, toPhones }, costco, problems, n, next }. Chunks in order from 0 (409orderwithnext). Each chunk is one transaction: all of it or none. At most 25,000 products and 500,000 prices an import (413too-many). An import is over after 10 minutes without a chunk, or 2 hours in all (410import-gone, also for another session's id); what its chunks added stays.POST /api/v3/data/import/finish { import, cancelled? }→{ products, prices, costco, problems, chunks, how: "finished" | "cancelled" }. Cancel iscancelled: true. Logged in srv_log activity with who:data-imported(ordata-import-stoppedfor a cancelled or abandoned one){ how, products, prices, skipped, ignored, costco }(counts only).checkandchunktogether: at most 300 a minute per browser session (429ratewithretryAfter; the web waits and goes on).- What the phones get: products are written by the server (its sync triggers: device
srv-<sid>, origin the browser'sweb-<id>, as Track from a web search), so they go out in the server's file to every phone sharing that shop's tab. Of a product's prices, only its newest imported one goes out with them, and only when it is newer than any price the server had for it and from the last 60 days (as the server's file carries recent prices). The older history is written quietly (no sync record, as the months phones offload are): it stays on the server, in the Data tab's charts and counts, the export and the encrypted backup. This keeps the server's file small for the phones. 0.9.5 phones and pages take these rows as any of the server's products and prices (no new record kind;sourceis a plain text column they copy and show as checked). - The web: Import data on the Data tab, below Download your data: Choose a file → Checking the file (the dry run, chunk by chunk, Cancel) → Step 1 ("Will add 12,000 products and 90,000 prices, skip 300 already there, ignore 12 it couldn't read", why rows were left out, Costco left out, the tables not taken) → Step 2 (the passphrase) → Importing (how far, Cancel stops after the chunk being sent, the page asks before it's closed) → Imported / Import stopped. The web sends at most 500 products and 2,500 prices a request so the server answers everyone else in between. Files up to 100 MB (300 MB unzipped).
- No new record kinds. Move to another list is ordinary list changes: between Groceries and General the line is updated in place; across tabs it is a new line plus a delete of the old one. A 0.9.5 phone or server needs nothing.
- Costco (0.9.6 only; see 0.9.7 below): a 0.9.6 phone never sends Costco products, prices, list-line details or item picks that point at Costco products.
- Gift cards and Cards in the web page: never sent to a browser. Gift cards live in a phone-only table (
gift_cards); from 0.20.2 a phone that shares them mirrors each intocards(below). - Import: see the "Data: Import" section above and restock-import.md.
- Price checks at a set time are per phone (
checkTime), not a shared setting.
- Costco is an ordinary shop. Picked with the household's shops (
enabledChains, a household setting like the others), its products, prices, list lines and item picks sync like any shop's, and the server keeps, exports and imports them (NEVER_SHOPno longer matches any shop;withheld.costcois never sent). A 0.9.6 phone still keeps its own Costco records back; a 0.9.7 phone sends them. No new record kinds. - The server's web search may ask Costco when "Let the web page search the shops" is on, still only when Search is pressed.
- Phones ask Costco from inside Costco's own page (
storeFetch, chaincostco), its product search first (/rest/v2/australia/products/search), then the search page. A sign-in there (accounts.costco) gives member prices.
- Nothing. No new record kinds, endpoints or settings keys. Costco's product search asks for 48 a page and pages with
currentPage("Get more from Costco"). Notifications carry arestockActionextra (item:<id>,deals,catalogue,daily,cards,sync,updates) that only the phone itself reads.
- Nothing. Stock tags, the shop Edit sheet and branch advice use what phones already sync (
products.in_stock,in_stock2,stock_at, the shop picks).
- Nothing.
- Nothing between phones and the Restock server. The settings key
priceHelper({ enabled, url, key, searches }) and thepriceHelper/priceHelperOutboxstore entries stay on the phone that has them: they're never synced, and the key is left out of backups. A price helper phone posts{ format: "restock-helper", version: 1, chain, products }to the restock-prices collector'sPOST /helper/prices(withAuthorization: Bearer <HELPER_KEY>), never to the Restock server. "Pick my …" with Add to list replaces the line (a new list line, the old one deleted), as Search the shops already did.
- Nothing. The price helper's
priceHelperstore entry gainsrunningSince(this phone only, never synced). The restock-prices collector's STATUS.md gains a "From the price helper phone" column.
- Nothing between phones and the Restock server. The settings gain
marketData.days(56, 182 or 365; 56 when missing) andbeta: { enabled };sharePricesis unchanged (on unless"no"). The store entriesinstallIdandfeedbackOutboxstay on the phone (never synced or backed up). - Day-one downloads read only the restock-prices collector's
window/<shop>-<days>d.json.gzfiles ({ format: "restock-window", v: 1, chain, days, from, to, products: { <shop product id>: [[day, cents, flags?], …] } }, withdaycounted fromfrom; flags 1 = special, 2 = member price), andwindow/index.jsonfor their sizes. Phones no longer read hotprices.org or the collector'slatest/files. - Feedback goes from the app (phone or web page) to the collector's
POST /feedback:{ format: "restock-feedback", v: 1, install, kind: "wrong" | "idea" | "like" | "other", message, email?, app, platform: "android" | "web" | "iphone", device?, screen?, diagnostics?, screenshots?: [{ type, data (base64) }] }, at most 3 screenshots and 8 MB. It answers200 { ok, id },400,413or429 { error }. The web app's Content-Security-Policy allowsconnect-srctohttps://restock-prices.plentysoftware.orgfor this, and nothing else new.
- A phone may read the statistics.
GET /api/v3/data/summary,/stats,/topand/seriesnow answer a household phone's signed request too (Settings → Your data on the phone), with the same JSON a browser gets, not sealed (the phone signs every request). Everything else under/api/v3/data/stays a browser session's (403 for a phone). - Settings:
marketData.every("weekly", the default, or"daily");marketData.daysnow followshistoryWeeks(8, 26 or 52 weeks: 56, 182 or 365 days; 4 and 13 weeks become 8 and 26). The store entriespriceShareOutbox,priceShareCursorandpriceShare, and thespend_logtable (spending from ticks), stay on the phone: never synced or backed up. - Send prices back (phones, not the server):
POST https://restock-prices.plentysoftware.org/share/priceswith{ format: "restock-share", v: 1, install, chain, products },chainone of coles, woolworths, aldi, costco, at most 2000 products, each{ id, chain, store_product_id, name, brand?, size?, barcode?, image_url?, day, price: { price, was_price?, is_special, member_only, promo? } }. Only prices read from the shop (price checks'source = "auto"and search results), nevermanualorimportones. It answers200 { ok, kept },400,413or429. - restock-prices'
window/index.jsongainsupdatedand, per shop,full(the day of its last full collection) besideto. A phone set to weekly downloads oncefullis newer than what it has; daily, oncetois.
- A phone may add spending.
POST /api/v3/data/spend(a household phone's signed request only; 403 for a browser) with{ rows: [ { entry_id, checked_at, at?, chain?, section?, item_id?, product_id?, text, qty?, price?, total?, usual?, special? } ] }, at most 5,000 rows: the ticks a phone counted on its own (Settings → Your data) before it joined, or while the server was out of reach.checked_atis in milliseconds. Rows are added withsrc = "phone"andINSERT OR IGNOREon (entry_id,checked_at), so sending twice adds nothing; sample items (demo-…), rows with no text, and rows older than Auto delete keeps are skipped. It answers{ added, skipped }and notesspending-addedin the activity log. Nothing can be changed or deleted this way. - Settings:
yourData: { server }(on unlessfalse): whether Your data reads the server's figures and the phone sends its earlier spending (once, then the store entryspendSentToServer, which stays on the phone).sharePricesnow defaults to"yes", andmarketData.enabledis always the same assharePrices !== "no"(one switch, Shared prices). The store entrysharedPrices010(the one-time question for a phone that had sharing off) stays on the phone. - Shared prices (was Send prices back; phones, not the server): a phone only sends prices it read itself. A price row that came from another device (in
sync_logwith anotherdevice) isn't sent. Turning Shared prices back on movespriceShareCursorto the newest price and emptiespriceShareOutbox, so nothing read while it was off is sent.
- Your data, sealed. A phone may send
X-Restock-Seal: rsf1with any request a phone may make under/api/v3/data/. The answer is thenapplication/x-restock-sealed: the JSON, plusreqN(the request's own nonce,n=in itsRestock2signature), sealed as an RSF1 file with the household's current serverKey. The phone opens it with any serverKey it knows and refuses an answer whosereqNisn't its request's.POST /api/v3/data/spendmay likewise be sent sealed (Content-Type: application/x-restock-sealed, the body{ rows }sealed the same way); a body no serverKey opens is400 sealed. Requests without the header are answered plain, as before (0.9.14 and 0.10.0 phones). - Shopping list totals (phones and the web app, not on the wire): shopping around and each shop's items from other shops pick from the same per-shop lines that are added up, measured the way the list is set (same shopping or at the till), in stock first, and only at the shops being compared.
Nothing new between phones and servers. On the phone only (never synced, never in a backup): the store entry aisles ({ "<product id>": { "1": { s: store number, a: aisle, side, o: order, at }, "2": … } }, from Coles' product locations at your branches, read by Aisles.java and colesAisle in coles.ts) and checkLog (the last 12 scheduled price checks, PriceCheckWorker.java). Settings gain shopSort: { by: "aisle" | "category" | "az", down? }.
- Two more tabs, Baby and Pets (
section"baby"and"pets"on items, categories, list lines and receipts). For sharing they go with Groceries, as the General list does: a record on Baby or Pets is on thepantrytab wherever tabs are compared (SyncEngine.javashared, engine.tssharedTab, sharedSettings.tsrowTab), so phones and servers still share three tabs, andtabsin the household record is unchanged. A phone on 0.10.2 or older keeps these records and shows them in its Pantry. - New shops (chains):
iga(on Pantry),babybunting,bigw,kmart,target(Baby),petbarn,petstock,petcircle,bunnings(Pets). Each shop's own tab is the one its products are shared with. - Any shop on any tab. Settings gain
shopTabs({ "<chain>": ["pantry", "baby"] }): the tabs each shop is in when that isn't just its own tab. A shop not listed is on its own tab only.sectionsgainsbabyandpets(written once switched on). - Household settings:
tab:babyandtab:pets(true | false, shared with Groceries), andshop:<chain>rows may carrytabs({ on, tabs? },{ on, shop, removed?, tabs? }for a shop someone added): the tabs it's in, known tabs in order, at least one; none means its own tab. Older phones readonand leavetabsalone. - Always on special (phones and the web app, not on the wire): a product on special at least 14 of the last 21 days it has a price for, and never at its "was" price in that time, is judged
fake(Always on special), on the phone's screens (verdict.ts) and its background alerts (Deals.java) alike (tools/sync-test/always-parity.sh). - Loyalty cards: a known card's name (IGA Rewards, Bunnings PowerPass…) is its
label, as any other card's; nothing new is synced. The kind of barcode picked for a card is kept where the cards are (the phone's store entrycardCodeTypes, or the browser's card store), never synced.
Nothing new between phones and servers. On the phone only (never synced): the store entry hiddenShopWarnings ({ "<chain>": "<until, ISO time>" }, Hide for a day, at most 24 hours ahead) and storeHealth errors from a shop that turned Restock away (403 or a bot check) are shown as "blocked", with Unblock (Unblock.tsx, health.ts).
Nothing. Fixes only (the Shopping list's buttons, search boxes, big text, Dan Murphy's and BWS departments).
- Custom sections. Besides
pantry,keg,pharmacy,babyandpets, an item, list line or category can be inc1toc6(a section someone made). Like Baby and Pets they're shared with Groceries. A phone on 0.10.6 or older shows them under Groceries. - Household settings rows:
tab:c1…tab:c6(true or false, a custom section switched on) andcustom:<section>({ name, colour, icon }: up to 30 characters; one of pink, blue, teal, purple, orange, amber, green, slate;pack:<icon>or an emoji), both with Groceries. Checked the same in sharedSettings.ts and SharedSettings.java. - Stock: background price checks don't save stock any more; it's only asked for by Check stock on the list.
- The shop map is on the phone only. The server's web page doesn't load maps, so its Content-Security-Policy is unchanged.
- Custom sections' rows (
custom:<section>) are checked more tightly, the same in sharedSettings.ts and SharedSettings.java: the icon ispack:<icon>or emoji only (up to 16 UTF-16 units from the emoji blocks, with joiners, skin tones and variation marks), and a name with invisible or bidirectional control characters is refused. A 0.10.7 phone still accepts what a 0.10.8 phone sends. - Nothing else changed between phones and the server.
- Nothing between phones and the server. Shopping mode's shop-by-shop view is on the screen only (which shops are done isn't saved or synced).
- Nothing between phones and the server. The Keg and Health tabs are now called Bottle shop and Chemist on the screen; their ids (
keg,pharmacy) are the same, and the server's list names (data.mjsLIST_NAMES) follow.
- Nothing between phones and the server.
- Nothing between phones and the server.
- POST /api/v3/data/seen (new): a phone sends what its searches and scans found, sealed like
/data/spend, up to 500 rows a request:{ rows: [{ chain, store_product_id, day (YYYY-MM-DD), name, brand, size, barcode, image_url, price, was_price, is_special, member_only, promo, in_stock }] }. The server checks each row, keeps one a product and day insrv_seen(a later reading of the same day replaces it), and answers{ added, skipped }. Only phones may send it. A server before 0.11.0 answers 404 and the phone keeps the rows to send later. - A phone's summary may carry
checks.days(the weekdays it checks on,[]when off),checks.time("04:00") andsearchKeepWeeks. Older servers and web pages pass over them. - Nothing else: phones on 0.9.4 to 0.10.12 sync as before.
- Nothing between phones and the server.
- Nothing between phones and the server.
- Nothing in how phones and the server talk.
- New shops (chains), all read from their websites:
foodworks,drakes,harrisfarm,spudshed,foodland,nqr,supabarn(Pantry);liquorlegends,bottlemart(Bottle shop);babykingdom,babyland,babyvillage(Baby);bestfriendspets,peto,budgetpet,petquarters(Pets); and, with Pets as the tab their products are shared with unlessshopTabssays otherwise,supercheap,repco,autobarn,autopro,burson,mitre10,totaltools,sydneytools,homehardware,bcf,anaconda,kings,tentworld,kathmandu,rebel,decathlon,jbhifi,officeworks,goodguys,harveynorman,binglee,spotlight,lincraft,ikea,adairs,pillowtalk,mecca,adorebeauty,rejectshop,cheapaschips,reddot. A phone or server before 0.11.3 doesn't know them: it keeps their products and prices, and shows the shop as "Other shop". - Shared prices (restock-prices, not this server):
costcois no longer sent or downloaded. What searches find still goes to the household's own server for every shop, Costco included. - Kept on a phone only (not synced, not sent): kv
shelfWatch, what that phone's price checks noticed about a product besides its price (a pack that changed size, a product its shop no longer lists).
- Nothing in how phones and the server talk. 0.12.0 is a change to the screens.
- Kept on a phone only (not synced, not sent): the setting
shopsAsked(falseon a phone set up with the short setup, until its first search has asked "Where do you shop?"; unset on older phones and restores).
Admin phones. Each phone on a server is a user or an admin (devices[d].role, "admin" or
absent). Phones on a server before 0.18.0 have no role, so they are users.
GET /api/v3/me(a phone):{ device, role, label }, so an admin phone shows Phones and tablets.GET /api/v3/phones: the web page, or an admin phone. Each phone hasrole, and the asking phoneme: true.POST /api/v3/phones{ label, admin? }: a code, as before.admin: truemakes a code for an admin: the web page signed in with the passphrase, or an admin phone. The phone that joins with it is an admin.PATCH /api/v3/phones/<d>{ label?, role? }: Rename, as before;role("admin"or"user") needs the passphrase sign-in on the web page, or an admin phone. Noted asphone-rolein the activity log.DELETE /api/v3/phones/<d>: the web page with the passphrase again (as before), or an admin phone (not itself: a phone takes itself off withDELETE /api/v3/devices/<me>). The answer to a phone is sealed with the key it asked with; the new one reaches it inkeys/<device>.bin.- From a phone, all of these must be sealed both ways (
X-Restock-Seal: rsf1, a sealed body): the codes let a new phone in, so they never cross the network readable. A user phone gets 403admin.
Nothing a server or phone from 0.14.0 on can't carry: the new things are rows and a column that older versions pass along without reading.
- 0.20.0
household_settingstrip:<list>: the household's shared shopping trip (JSON: who, which shops, where they are, when it was saved). Deleted when the trip ends. - 0.20.0
prices.online_price: a price's online-only price beside its shelf price (null when there's none).GET /api/v3/data/export/pricesincludes it. - 0.20.0
sync_metaresyncon a phone (never sent): its next sync compares everything again. - 0.20.1
household_settingsbeta:truewhen the server's Beta testing features switch is on. Written by the server (through the triggers, likeha:phone), read by phones on 0.20.1: each turns its own switch on and can't turn it off.falseor no row: each phone chooses. - 0.20.2 shared gift cards, with no change to the tables or the file format. A phone with Gift cards
on (Resync; only while it shares loyalty cards) mirrors each gift card as a
cardsrow:id=gift:<gift card id>,program=gift,label=Gift card: <name>,expiry, andnumber= JSON{ v: 1, card }(the whole card without photos or the reminder;card.updatedAtdecides which copy is newer). The server stripsnumberfromcardsrows as always, so its database holds the name and expiry only. A phone never shows agift:row as a loyalty card (0.20.2 on); older phones do, as "Gift card: ". Deleting the row deletes the gift card on every phone that shares them. - 0.20.2 Android
RestockNative.checkNow({ slot, byHand }):byHand(a pressed Check now) is the only check that doesn't leave out what another phone read today. Inside the app; nothing on the wire. - 0.20.3 the oldest Restock a server takes is 0.20.0 (
MIN_APP; it was 0.14.0): an older phone gets 403old-app. A phone asksGET /api/v3/healthwhen a code is scanned and doesn't join a server whoseversionis older than 0.20.0. Backup files carrymadeWith(the Restock that wrote them); one without it and dated before 28 November 2026, or with an oldermadeWith, isn't opened. The household'sbetarow is now called Extra shops and tabs on screen; the row and the API field keep their names. Copies of the app from Google Play and the App Store take no notice of the row. - 0.20.3 phones say their Restock version to each other:
app(for example"0.20.3") in every message on the Wi-Fi (thehelloand each answer) and in a phone's ownrestock-sync-<device>.bin. Ahellowhoseappis older thanMIN_APPis answered{ error: "Update Restock on this phone to 0.20.0 or newer…" }; an asker that gets an olderappback stops there; a file with an olderappis passed over (marked seen). Each side notes it insync_metaold_peer({ device, name, app }, never sent) for the Sync screen, and clears it when that device next says a version that's fine. Noappat all (0.20.2 and older) is taken as before. The server's own file carries none; the server judges phones byX-Restock-Appas it always has. - 0.20.3 "Add when it's on special", shared with the household:
household_settingswait:<group id>→ JSON{ at }(when it was asked). Written by a phone that shares it (settings.shareWaiting, on unless false; its own choice in Resync), deleted when the item goes on the list or someone stops it. The list line a phone adds has the idws-<group id>-<at in ms>, so two phones that find the special at once add the same row. Servers and older phones carry the rows without reading them. A phone outside a household, or with sharing off, keeps its own inkvwaitForSpecial({ <group id>: <at> }), never sent. - 0.20.3 "Every week", shared the same way:
household_settingsweekly:<group id>→{ at }for each item, and one rowweekly-plan→{ day, every, from, ran }: the big shop's day (0 Sunday to 6 Saturday), every 1 to 4 weeks, counted fromfrom, andran, the time (ms) of the last round a phone added, so another phone doesn't add that round again. A round is due at 18:00 the day after the shop day. Its list lines have the idwk-<group id>-<round in ms>. Outside a household, or with sharing off:kvweeklyItems,kvweeklyRanandsettings.bigShop. - 0.20.1
GET /api/v3/settingsaddsbeta(the switch, orbetaInUse) andbetaInUse(the household's rows hold atab:<section>that'strue, or ashop:<chain>withon: truefor a shop besidescoles,woolworthsandaldi).PUT /api/v3/settings { beta: true | false }: anything but a boolean is 400beta;falsewhilebetaInUseis 409beta-in-use. Noted asbeta-on/beta-offin the activity log.