pub struct PairParams {
pub invite_line: String,
pub as_nickname: Option<String>,
pub allow_self_enroll: bool,
}Expand description
Params of Request::Pair: the copyable mcpmesh-invite: line. Defaultable — an
absent field reads as an empty line, which simply fails to decode (a clean pair error).
Fields§
§invite_line: String§as_nickname: Option<String>YOUR local name for the inviter (#87), overriding the nickname their invite suggests.
An invite carries the inviter’s suggestion for what you should call them — usually their
hostname. If you already use that name for a different peer, the pairing is refused with
ERR_INVITE_NAME_CONFLICT and the message tells you to go ask them for a new invite.
This lets you resolve it yourself, without set_nickname (which rewrites your own GLOBAL
self-name — not what anyone wants in order to add one colleague).
Local only: never sent to the inviter. It does not bypass the collision check — an alias
that itself collides is refused identically, because a duplicate display name makes your own
<peer>/<service> routing ambiguous whoever chose it. api_minor >= 39.
allow_self_enroll: boolConsent to complete a SELF-ENROLLMENT (#178): a mcpmesh-enroll: line is refused with
ERR_SELF_ENROLL_NOT_OFFERED unless this is set.
Defaults to false, which is the whole point. #86 gave self-enrollment its own scheme so a
version-skewed redeemer refuses rather than pairing wrongly — but a CURRENT caller that only
ever meant to pair still ran the ceremony to completion, and learned which one it had run
from PairResult::enrolled_as_self only AFTER the device→user binding was written. That
binding admits this device to everyone who trusts the inviter’s user_id, and it is
irrevocable short of rotating that user key — so “observe it afterwards” is not a place a
caller can refuse from.
Set it when the ceremony is one your UI actually OFFERED (“add another of my devices”). Leave it unset on an ordinary “join / add a contact” field: the refusal costs nothing, the invite is untouched (nothing is dialled and nothing is burned), and the same line still works if the person is then offered the real choice.
To decide BEFORE calling — to show the right prompt rather than recover from a refusal — use
mcpmesh_node::pairing::is_enrollment_line. api_minor >= 45.
Trait Implementations§
Source§impl Clone for PairParams
impl Clone for PairParams
Source§fn clone(&self) -> PairParams
fn clone(&self) -> PairParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more