API 참조

Pairing

이 기기를 발견된 peer와 페어링하여 LAN / Wi-Fi Aware를 통해 암호화된 채팅 메시지와 파일을 교환할 수 있도록 합니다. 페어링은 양측에서 확인되어야 합니다 — 여기서 pairDevice를 호출한 후 원격 기기가 respondToPairing을 호출하도록 합니다.

타입 정의

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 }

작업

mutation

pairDevice

발견된 LAN 기기와의 페어링을 시작합니다. 원격 기기에 페어링 요청을 보냅니다. 보안 채널이 설정되기 전에 원격 기기가 respondToPairing으로 수락해야 합니다.

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

cancelPairing

이 기기가 시작한 진행 중인 페어링을 취소합니다. 발견 스캔에서 반환된 원격 deviceId를 전달합니다.

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

respondToPairing

들어오는 페어링 요청에 응답합니다 — 수락 (true) 또는 거절 (false). 수락 시 기기는 공유 ECDH 키를 파생하고 암호화 채팅을 위해 peer를 등록합니다.

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