Skip to main content

Module pairing

Module pairing 

Source
Expand description

Pairing codes and viewer tokens (agentmux-mobile’s SPEC_AGENT_STATUS_AND_LIVE_PANE_FEED_2026_10_07 §13.2).

A code is shown in the desktop’s QR, so whoever redeems it has seen this screen. It is 10 characters of base32, works once, for 120 s, and only the newest one shown works: showing a new QR cancels the last. Guessing is bounded twice over: an address with five wrong codes in the last minute is refused with 429 before its next code is even compared, and ten wrong codes in a row, from anywhere, cancel every outstanding code.

Structs§

Inner 🔒
Pairing

Enums§

Redeem
The outcome of presenting a code.

Constants§

BASE32 🔒
CODE_LEN
CODE_TTL
TOKEN_PREFIX
WRONG_IN_A_ROW
Wrong codes in a row, from any address, that cancel every outstanding code.
WRONG_PER_ADDRESS
Wrong codes one address may send per WRONG_WINDOW; the next attempt gets 429.
WRONG_WINDOW

Functions§

new_code
A fresh pairing code. 32 divides 256, so byte % 32 is uniform.
new_token
A fresh viewer token: amxv_ + base64url (no padding) of 32 random bytes.
random_bytes
n bytes from the operating system’s CSPRNG (ring’s, through rustls).
token_hash
What a token is stored as: lowercase hex SHA-256.