Skip to main content

join_pairing_session

Function join_pairing_session 

Source
pub async fn join_pairing_session<R: PairingRelayClient>(
    ctx: &AuthsContext,
    code: &str,
    registry_url: &str,
    relay: &R,
    now: DateTime<Utc>,
    curve: CurveType,
    device_alias: KeyAlias,
    device_name: Option<String>,
    confirmation_timeout: Duration,
) -> Result<PairingCompletionResult, PairingError>
Expand description

Orchestrate joining a pairing session as a delegated device.

The joining device generates its own key, builds + self-signs its dip (delegated by the session’s controller_did), ships it in the response, then waits for the initiator to anchor it. On confirmation it verifies the anchor and persists its own KEL + key. A fresh device needs no pre-existing identity — only an initialized (possibly empty) registry + keychain in ctx.

Args:

  • ctx: The joining device’s context (its own registry + keychain + passphrase).
  • code: Short code entered by the user (normalized internally).
  • registry_url: Pairing relay server URL.
  • relay: Pairing relay client.
  • now: Current time (injected by caller).
  • curve: Curve for the new device key.
  • device_alias: Keychain alias to store the new device key under.
  • device_name: Optional friendly name to include in the response.
  • confirmation_timeout: How long to wait for the initiator’s anchor.

Usage:

let result = join_pairing_session(&ctx, code, registry, &relay, now,
    CurveType::Ed25519, KeyAlias::new_unchecked("laptop"), hostname, ttl).await?;