Skip to content

webapp: read the names service link data and stale nonce, and take links as the chat core does - #19

Open
evgeny-simplex wants to merge 43 commits into
simplex-chat:namesfrom
evgeny-simplex:ep/names-wire
Open

evgeny-simplex wants to merge 43 commits into
simplex-chat:namesfrom
evgeny-simplex:ep/names-wire

Conversation

@evgeny-simplex

@evgeny-simplex evgeny-simplex commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

The names service changes its API in simplex-chat/simplex-chat#8243; the page and the service ship together. This pull request replaces #18, closed when sh/names-webapp was merged into names; its two commits are moved onto names unchanged.

  • Link previews and search entities: the service answers a link's data (type, read state, and of a profile read: names, picture, an address's peer type and business flag, a channel's group type and member count). The page derives the chat's kind (contact, channel, business, bot) and a channel's subscribers from it, as the service did before; deepLink is always a string.
  • Links: the page checks a link by the chat core's rule: the type a or c in either case, an optional / before #, a key in canonical base64url, and a server (h for a simplex:/ link). The four seeded links and the test vectors get canonical keys.
  • Record edits: a stale nonce is answered with 409 stale_nonce; the page re-reads the nonce as on any refused save.
  • The mock answers in the new shape and by the new rule.

Tests: CI run 44128302280 of the webapp workflow at 3d635d2 passed: unit, and the browser tests in Chromium, Firefox and WebKit against the dev server and the production build.

Browser test fixes, as CI ran them for the first time:

  • races in the tests, now waited out: a closed invoice's one read of its balance (balance.spec), a page refit after a viewport change (every test, in the shared page fixture), the scroll room once the styles apply (robustness.spec), a failed order's own first code check (codes.spec), a terms tick that sends the order on (the shared tick helper);
  • rows compared once the fonts have loaded (robustness.spec);
  • skipped where the browser cannot show the behaviour: WebKit sends its own request for a preloaded answer (codes-only.spec) and draws too few frames to sample a glide (app.spec); the production build has no stand-in card form (track.spec);
  • traces kept for failed tests.

Known gaps of the mock: one body cap of 16384 bytes, where the service caps records, reveal, preview, code check and find at 8192; contract.spec.ts 431-441 expects 409 record_reverted for an edit another relayer applied first, where the service answers 200 {"tx": null} (the spec runs against the mock only).

…om /api/config, which no view or search answer repeats
…contact or channel, with an image the core dropped read as none
…ing, reserved or registered with the store resolver's records or none

The answer nests the name's case under "found", tagged by "type"; "community" is present only for a community name, and its "for" only when the service has words for it. A registered name's records are nested as {type: own, contact, channel, nonce, edits} or {type: other}; edits.nextAt is an ISO time, omitted while edits are left. The available case drops "currency" and gives the community name's own years; its "terms" is omitted while they cannot be read.
…type on the names endpoints or by error on the others; edit_limit is 409 with an ISO time

The search, preview, terms, code check and records endpoints, and the rate limit of every names route, answer {type: code, ...}; the order endpoints and those badges share still answer {error: code}. A code the page does not know reads as internal, or network under a gateway status, and every 429 as rate_limited. edit_limit moves from 429 to 409 with nextAt as an ISO time, and record_reverted no longer includes the revert. The mock answers so, its find limit taken as a route limit.
… service answers in place of not_found

restore answers null and codeOrderOf "none" for an empty list, and newerOrder finds nothing newer in it; the mock answers an owner of no order with {registrations: []}.
…raw request, which the page no longer builds
…'s request types, the terms as a record and the method as the chat core's

Nesting, as the service's derived decoders read it:
- an order is {owner, fields, timestamp, signature}, its fields {labelHash, length, duration, commitment, sealed, terms}, terms {communityName, termsHash};
- /api/invoice sends the order as "order", with kind, method and price; /api/name/register as "order", with code;
- a move sends {fields, timestamp, signature}; a spend sends them as "signed", with price, balance and, for a difference, method;
- method is {"type": "card", "provider": "stripe"} or {"type": "crypto", "currency": "btc" | "xmr"}.
The page keeps its records and the signed messages as they were; api.ts builds the request at the call. The mock reads the same requests.
…xmr, as the badge page does

The chat core's derived JSON of the payment method writes a card as {"type": "card", "provider": []}, since its card provider has one constructor, so the service reads the method as the text both pages send.
…he service's request types, which api.ts builds for them
… STORE_FIXTURES with the page's own request functions and the search screen, skipped without it
…er's terms record inside the service's request types
…ned_in_time or not_registered, and worded by the page
…'s words for the service's not_registered reason
…ase with what each phase holds, how it was paid, the hold on its balance and the terms it signed as a record

The mock answers the same shape, and the browser and unit tests read it.
… page with its name code, and a failed order offers another name or support in place of Try again

The failure reasons are the service's: sends used up, links refused, registry refused. The mock keeps a lapsed order waiting for /retry, which it takes only for such an order.
…asses, and the page tells the hours left to sign from the order's revealBefore

The deadline is 2^53-1, the largest the page, the service and the contract hold exactly. The checkout note no longer names 24 hours, as a page opened later commits the order again.
…name, and two retries at once race on a lapsed order

The failed page searches no name since it always offers another one. The mock's /retry checks the version after its write delay, as the service's turn does, so of two at once one is answered registration_changed.
…every browser, as the service's view names it

The view's replacedBy names the order and its invoice. The page keeps no link of its own and no longer guesses one from expiry times, find's list order or creation times. Your names hides a replaced order by its last read, adds the order that replaced it from the code's find by its id, and keeps the replaced one listed while money reached it. A forgotten order's link says it does not work.
… code opens the newest order rather than a closed one

The service's find answer names a closed order's phase closed. The contract test reads the recorded find-orders answer.
… from the service's recorded vectors instead of copies

The tests read STORE_FIXTURES' vectors-signatures, vectors-acceptance, vectors-codes and vectors-labels, as the store's answers are read, and are skipped without them. The prepaid code vectors copied from the chat core's tests go.
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
sh-agents added a commit to sh-agents/simplex.domains that referenced this pull request Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants