Skip to content

feat(connect): dl/2 deeplink payload without the copies its description already carries - #13

Closed
elasticLove1 wants to merge 2 commits into
mainfrom
fix/12-compact-connect-deeplink
Closed

feat(connect): dl/2 deeplink payload without the copies its description already carries#13
elasticLove1 wants to merge 2 commits into
mainfrom
fix/12-compact-connect-deeplink

Conversation

@elasticLove1

@elasticLove1 elasticLove1 commented Aug 16, 2026

Copy link
Copy Markdown
Member

Closes #12 on the client side of it.

Что меняется

dl/1 кладёт в приглашение session_id и app_id рядом с description, который уже содержит и
то и другое, а затем отказывает любому приглашению, чьи поля с этим описанием расходятся. То есть
описание и так было главным, а два поля — копией. На живой ссылке эта копия занимает 223 знака из
672, это две версии символа.

dl/2 их не посылает. Больше не меняется ничего:

  • description строится ровно как прежде, поэтому адрес профиля, который из него выводится, тот
    же самый, что был бы у этой сессии в dl/1;
  • декодер принимает обе версии и подставляет два поля из описания, когда их нет, поэтому любой
    потребитель видит одну и ту же структуру независимо от того, что пришло;
  • выпуск dl/1 не тронут и остаётся умолчанием. dl/2 доступен только через новый
    create_shared_key_session_compact.

Почему это того стоит

Ссылку показывают кодом: кошелёк — мобильное приложение, и на рабочей станции ссылку нажать
нечем, поэтому единственная пригодная форма приглашения — сканируемый символ. Его размер задаёт
длина ссылки.

ссылка символ знаков в терминале
dl/1 672 версия 18, 89 модулей 93 x 47
dl/2 517 версия 16, 81 модуль 85 x 43

Сторона −9,0%, площадь −17%. Длины замерены самим кодом (payload_json 383 → 267 байт,
deep_link 651 → 496 плюс 21 знак &intent=agent_onboard, который дописывает клиент), а версия
символа взята из таблицы ёмкости формата и сходится с замером живого символа dl/1: 89 модулей.

Проверки

cargo test -p bee-connect --lib — 59 из 59, из них пять новых:

  • dl/1 по-прежнему возит обе копии и по-прежнему их сверяет;
  • dl/2 не возит ни одной, а декодер обе восстанавливает из описания;
  • обе версии строят описание одинаковой формы — регрессия на неподвижность точки встречи;
  • ссылка dl/2 короче dl/1 не меньше чем на 100 знаков;
  • приглашение, у которого нет ни поля, ни пригодного описания, отвергается, а не разбирается в
    пустой идентификатор сессии.

Вливать нельзя

Не вливать, пока кошельки не разбирают dl/2. Декодер этого крейта принимает новую версию
сразу, кошелёк — нет, и клиент, переключившийся раньше, выдаст ссылку, которую кошелёк не
прочитает. Порядок такой: сначала поддержка в кошельке, потом переключение клиентов на
create_shared_key_session_compact.

Отдельно, вне этого пиара: внутри description app_id едет как 0x плюс 64 знака при значении
0x78 — 60 ведущих нулей. Это ещё около 60 знаков, но их снятие меняет строку, из которой
выводится адрес профиля, то есть это уже миграция точки встречи, а не формата поля. Ещё крупнее
рычаг — кодировка без строчных букв: она пустила бы символ буквенно-цифровым режимом, вдвое более
плотным, но это меняет и формат, и разбор на обеих сторонах.

elasticLove1 and others added 2 commits August 17, 2026 02:17
…on already carries

The connect link is shown as a QR code on any desktop client, because the
wallet is a phone application and a link is not actionable where it is printed.
Its length therefore decides the symbol version, and the symbol has to fit a
terminal window.

`dl/1` sends `session_id` and `app_id` beside a `description` that already
contains both -- and then refuses any payload whose fields disagree with that
description, which is to say the description was already authoritative and the
two fields were already a copy. On a real link that copy is 223 of 672
characters, three symbol versions.

`dl/2` leaves them out. Nothing else moves:

- `description` is built exactly as before, so the profile address derived from
  it is the one this session would have had under `dl/1`;
- the decoder accepts both versions and fills the two fields in from the
  description when they are absent, so every consumer sees the same shape
  whichever version arrived;
- `dl/1` emission is untouched and remains the default. `dl/2` is reached only
  through the new `create_shared_key_session_compact`.

MUST NOT MERGE until the wallets decode `dl/2`. This crate's decoder accepts it
from the moment this lands; the wallet does not, and a client that switched
early would produce a link the wallet cannot read.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The 449-character link and version 15 were the figures for also trimming the
description and dropping the zero padding inside app_id -- neither of which
this change makes, because both move the string the profile address is derived
from. Measured from this code: 672 -> 517 characters, version 18 -> version 16,
89 -> 81 modules.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@elasticLove1
elasticLove1 deleted the fix/12-compact-connect-deeplink branch August 16, 2026 23:54
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.

1 participant