API Reference

Pairing

Pair this device with a discovered peer so the two can exchange encrypted chat messages and files over the LAN / Wi-Fi Aware. Pairing must be confirmed on both sides — call pairDevice here, then have the remote device call respondToPairing.

Type Definitions

bash
input PairingDeviceInput {
  id: String!                 # remote device id (from discovery)
  name: String!               # remote display name
  ips: [String!]              # known IP addresses
  port: Int!                  # remote HTTP port
  deviceType: DeviceType!     # PHONE | TABLET | DESKTOP | WEB | ...
  version: String!
  platform: String!
  lastSeen: String!           # ISO 8601
  discoveryMethods: [String!] # LAN | AWARE | BLE | ...
}

input PairingRequestInput {
  fromId: String!
  fromName: String!
  port: Int!
  deviceType: DeviceType!
  ecdhPublicKey: String!      # base64 ECDH public key for key exchange
  signaturePublicKey: String! # base64 Ed25519 signing key
  timestamp: Long!            # request creation time (millis)
  ips: [String!]
  signature: String           # signature over the request body
  fromIp: String
  isQrInitiated: Boolean      # true when triggered by QR scan
  awareSupported: Boolean     # remote supports Wi-Fi Aware
}

enum DeviceType { PHONE TABLET DESKTOP WEB OTHER }

Operations

mutation

pairDevice

Initiate pairing with a discovered LAN device. Sends a pairing request to the remote device; the remote device must accept via respondToPairing before the secure channel is established.

bash
mutation PairDevice($input: PairingDeviceInput!) {
  pairDevice(input: $input)
}
mutation

cancelPairing

Cancel an in-progress pairing that was initiated by this device. Pass the remote deviceId returned by the discovery scan.

bash
mutation CancelPairing($deviceId: String!) {
  cancelPairing(deviceId: $deviceId)
}
mutation

respondToPairing

Respond to an incoming pairing request — accept (true) or reject (false). On accept, the device derives the shared ECDH key and registers the peer for encrypted chat.

bash
mutation RespondToPairing($input: PairingRequestInput!, $accepted: Boolean!) {
  respondToPairing(input: $input, accepted: $accepted)
}