Skip to main content

Crate weirdnet_device_link

Crate weirdnet_device_link 

Source
Expand description

weirdnet-device-link/v1: move a Weirdnet user identity to another device of the same person without typing its recovery words.

The new device (no identity yet) shows an Offer as a QR code or link: its node key, a fresh X25519 key, its addresses and a 120 s expiry, signed by the node key. The existing device (holds the identity) scans it, connects over Weirdnet on /weirdnet/link/2, and both derive a key and a 6-digit short authentication string (SAS) from the X25519 agreement and a transcript hash. Only after the user confirms the SAS matches on the existing device does it send the Transfer (seed, profile name, a node certificate for the new device), sealed with that key. The offer is single use and dies after three pairing attempts, a cancel, a transfer or its expiry.

Nothing secret is in the offer, and nothing here logs secrets.

Re-exports§

pub use compact::KNOWN_RELAYS;
pub use invite::Invite;
pub use invite::InviteHost;
pub use invite::answer_invite;
pub use invite::decode_invite;
pub use invite::encode_invite;
pub use invite::is_invite;
pub use net::HostNode;
pub use net::Pairing;
pub use offer::Offer;
pub use offer::VerifiedOffer;
pub use offer::is_offer;
pub use offer::offer_addrs;
pub use offer::offer_scheme;
pub use reach::known_relays;
pub use reach::parse_relays;
pub use reach::relay_groups;
pub use reach::relays_from_env;
pub use relays::RelayProbe;
pub use relays::RelayState;
pub use relays::relay_states;
pub use session::Host;
pub use session::HostStatus;
pub use session::Sender;
pub use wire::LinkReply;
pub use wire::LinkRequest;
pub use wire::Transfer;

Modules§

compact
Compact address and byte encodings for the codes a phone scans (offers and invites, v2), so their QR codes stay small enough to read off a laptop screen.
invite
The other direction: the existing device shows an invite as a QR code or link (<scheme>invite/…) and the new device scans it. The invite is only a meeting point: the new device answers it with its own signed Offer link over /weirdnet/link-invite/2, and from there the link runs exactly as before: the existing device dials the offer, both screens show the same six-digit code, and nothing moves until the user confirms it on both. An invite holds no secret; whoever answers it still has to show the same code.
net
Running a link over Weirdnet (/weirdnet/link/2, Noise-authenticated request/response): the new device listens, the existing device dials it.
offer
The offer a new device shows as a QR code: public keys, addresses, an expiry, signed by the new device’s node key. Nothing in it is secret.
reach
How a link node reaches its relays, and the limits it runs with.
relays
Which relays a link node is using, read from the node’s own status: never guessed. A relay is one peer id with one or more configured addresses (/…/tcp/…/p2p/RELAY, /…/quic-v1/p2p/RELAY, /…/tcp/443/tls/ws/p2p/RELAY).
session
Both sides of a link, without the network: key agreement, SAS, the sealed transfer and the offer’s single-use rules.
wire
Messages on /weirdnet/link/2 and the sealed transfer.

Enums§

Error

Constants§

MAX_ATTEMPTS
Pairing attempts an offer accepts before it dies.
OFFER_TTL_MS
How long an offer lives.
VERSION
Protocol version in offers, invites and transfers. 2: compact offers and invites (CBOR arrays, binary addresses, the known relay by index).

Statics§

LINK_PROFILE
The Weirdnet network with this protocol’s own stream id, so other nodes ignore it (and it ignores them).

Type Aliases§

Result