Skip to main content

Module pair_invite

Module pair_invite 

Source
Expand description

Invite-URL pair flow (v0.4.0). Single-paste, zero-config pairing.

Flow: A: wire invite → URL. A pastes URL into any channel (Discord, SMS, voice-read). B: wire accept <URL> → done. Both pinned.

The invite URL is a self-contained bearer credential carrying A’s signed agent-card, relay coords, slot_token, and a single-use pair_nonce. B parses it locally (no relay round-trip yet), pins A from the URL contents, then POSTs a signed kind=1100 pair_drop event to A’s slot using the slot_token the URL granted. A’s daemon (run_sync_pull) recognizes pair_drop events that carry a matching pending_invite nonce, verifies the embedded card, pins B, and consumes the nonce. Both sides paired.

Trust model: pasting = trusting. Equivalent to Discord invite link, Zoom join URL, Signal group invite. Operator’s act of moving the URL between channels IS the authentication ceremony. No SAS digits, no PAKE.

The legacy SPAKE2 + SAS flow remains available via wire pair --require-sas for operators who want the stronger MITM-resistance model.

Structs§

InvitePayload
Decoded contents of an invite URL.
PendingInvite
On-disk record for a minted invite, awaiting acceptance.

Constants§

DEFAULT_RELAY
DEFAULT_TTL_SECS

Functions§

accept_invite
Accept an invite URL. Auto-inits + auto-allocates if needed. Pins issuer from URL contents, then POSTs a signed pair_drop event to issuer’s slot.
ensure_self_with_relay
Ensure this node has an identity + relay slot. Idempotent. Returns (did, relay_url, slot_id, slot_token).
maybe_consume_pair_drop
Consume a pair_drop event during daemon pull. Returns Ok(Some(peer_did)) if the event matched a pending invite and the peer was pinned. Returns Ok(None) if not a pair_drop or no matching invite. Errors only on real problems (bad sig over event, IO failure).
maybe_consume_pair_drop_ack
Consume a pair_drop_ack event during daemon pull. Updates relay-state.peers[] with the ack’s slot_token so we can wire send to the peer. Returns Ok(true) if applied. Idempotent.
mint_invite
Mint a fresh invite URL. Auto-inits + auto-allocates relay slot if needed.
parse_invite
Parse an invite URL and verify the embedded signature against the embedded card’s first active verify key.
pending_invites_dir