Repository navigation
Pair from a pasted in-person link once its host's device id is confirmed - #59
Merged
Merged
Conversation
… 16-digit id, and the name is the link's own; the test compares the host's own hello.device wire.md 10.1 gives the join.check and join requests, says the app labels the unsigned n as the link's name and shows all 16 digits of host_device apart from it, and that every link not from the app's own scanner must say arrival link. privacy.md and the feature table name confirmed-link. app_confirmed_link reads the host's hello.device, checks it is 16 lowercase hex digits, compares it with host_device, and pairs and probes with it as read off a screen. link-accepts-kind1 leaves the join-check entry, where a plain link now previews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An in-person (kind 1) ticket pairs only from an in-app scan. A pasted link of one is refused (
pairing_failed), because a link can be swapped on its way. The app needs a way to pair from a pasted code-free link without passing it off as a scan.Change
A pasted in-person link pairs once the person has confirmed its host's short device id against the host's screen.
join,join.check,join.probe: these takearrival: "link"withconfirmed, the host's short device id the person confirmed. That id is the first 8 bytes of the host key's fingerprint, as 16 hex digits; spaces, dashes and case are ignored.pairing_failedbefore anything is dialled.confirmedwitharrival: "scan", or one that is not a string, isbad_request.join.check: the reply addshost_device(the ticket host's short id) andneeds_confirm.needs_confirmis true for an in-person link with noconfirmedyet. Such a link is inspected as the scan it becomes, so the app can show the id before the person confirms;joinandjoin.probestill refuse it until then.confirmed-link: listed in the 1.2hello, so an app knows it may sendconfirmed.spec/wire.md§10.1 gives the exactjoin.checkandjoinrequests. Both screens show all 16 digits; the app shows the link's unsignednapart from the id, labelled as the name the link gives. It also says why a swapped link cannot pass: matching a chosen 64-bit id is a second-preimage search of the fingerprint. Ajoinwith noarrivalstill counts as a scan, so the app must send"arrival": "link"for every link that did not come from its own scanner.spec/privacy.mdand the feature table indocs/pairing-flow-design.mdnameconfirmed-link; §4 documents the new fields and the check.The ticket carries no name, so the host's name stays the app's: the unsigned
nin the link. Only the id is checked.Checks
pairing-flow.confirmed-linkrunscrates/mousse-helper/tests/app_confirmed_link.rs:hello.deviceis exactly 16 lowercase hex digits and equals the joiner'shost_device. Confirmed with it, grouped and in capitals as read off a screen,join.probereaches the host andjoinpairs.joinandjoin.probe, with no connection.confirmedisbad_request.confirmed-link-any-idtakes any confirmed id as the host's. Its test fails under it, and so does the existinglink-accepts-kind1. That control leavespairing-flow.join-check, where a plain link now previews.app_join_check.rs: an unconfirmed pasted link now reportsneeds_confirmandhost_deviceinstead ofpairing_failed. A wrong id is stillpairing_failed, and the right one clearsneeds_confirm.How to review
crates/mousse-helper/src/app/pairing.rs:came_fromandadmit. Thencheck.rsandprobe.rs, which use them.Verification
On Windows x64 (MSVC toolchain), all passed:
cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspacecargo check -p mousse-net-core --target wasm32-unknown-unknownThese all passed again at the head, after the review fixes.
The success test also fails when
hello.devicecomes from another function, and whenshort_idis cut to 6 bytes (both tried locally).Controls, run locally:
confirmed-link-any-idfailsapp_confirmed_link(1 of 3).link-accepts-kind1failsapp_confirmed_link(1 of 3).The core library and the wire are unchanged (
Arrivalstays scan or link, and the vectors are untouched), so the second implementation ininterop/second-impl-tsneeds no change.Refs mousse-agent/mousse#1510