weirdnet-device-link
weirdnet-device-link/v1: move a Weirdnet user identity to another device of the same
person without typing its recovery words. Built in Morph ("Login over QR") and moved here;
0.3 folds in the rest of Morph's copy (compact codes, relay reach and relay status). Builds
on weirdnet-net 0.8.0.
-
Offer: the new device (no identity yet) shows a QR code or link with its node key, a fresh X25519 key, its addresses (up to three direct ones, one per host first, and a circuit for each of up to two relays, so devices on other networks connect) and a 120-second expiry, signed by its node key. Nothing secret is in it. Codes are compact CBOR arrays (protocol version 2): addresses are binary multiaddrs, and a circuit through one of the
KNOWN_RELAYS(the WeirdBrains public relay) is a single byte, so the QR stays small. -
Invite: or the existing device shows the QR, and the new device scans it; the same offer, code check and transfer follow.
-
Session: the existing device connects over
/weirdnet/link/2; both derive a key and a 6-digit short authentication string from the X25519 agreement and a transcript hash. -
Transfer: only after the user confirms the codes match on the existing device does it send the seed, the profile name, the sync types the user opted in to and a node certificate for the new device, sealed with that key (
Pairing::send_with,session::make_transfer_with). -
An offer is single use and dies after three pairing attempts, a cancel, a transfer or its expiry.
-
Relays: link nodes start with the relays in their
NodeConfigand the link limits (with_link_limits: 256 KiB requests, 16 KiB responses, 30 s timeout, applied only where the config leaves weirdnet-net's defaults).RelayProbeis a short-lived node that reserves on the configured relays and measures each one's round trip with a names lookup;relay_statesturns node statuses into per-relay connected, reserved and round-trip state for a settings page.HostNode,PairingandInviteHostexposenet_status().
Modules: offer (offers and links), compact (KNOWN_RELAYS, pack_addr/unpack_addr),
invite, session (both sides without the network), net (HostNode, Pairing over
weirdnet-net), reach (relay groups and link limits), relays (RelayProbe,
relay_states), wire (CBOR messages).
cargo run --example local-relay starts a relay and names server on this machine only, for
headless checks of linking and relay status.
Moving to 0.3
- Codes changed (protocol
VERSION2: compact CBOR arrays). A 0.2 code read by 0.3, or the other way round, fails with "update" rather than "damaged". Link both devices on the same version. Stream ids stay/weirdnet/link/2and/weirdnet/link-invite/2. - Version mismatches are now
Error::OlderCodeandError::NewerCode(wereError::Invalid). Match them to word the message with your app's name. - New:
compact,reach,relays;Pairing::send_with(carries sync opt-ins and returns the new device'sNodeCert);session::make_transfer_with;net_status()onHostNode,PairingandInviteHost. - Offers carry at most
MAX_DIRECT(3) direct addresses plus a circuit for each of up to two relays (MAX_CIRCUITS). - Link nodes now apply
with_link_limitsto theNodeConfigyou pass. - Moving from Morph's in-tree copy: depend on
weirdnet-device-link = "=0.3.0", deletecrates/weirdnet-device-link, and move to/weirdnet/link/2(the in-tree copy used/weirdnet/link/1).
License
BSD-3-Clause.