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

இந்த சாதனத்தால் தொடங்கப்பட்ட நடந்துகொண்டிருக்கும் பேரிங்கை ரத்துசெய்யவும். discovery ஸ்கேன் மூலம் திருப்பி அனுப்பப்பட்ட தொலைநிலை deviceId-ஐ அனுப்பவும்.

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

respondToPairing

உள்வரும் பேரிங் கோரிக்கைக்கு பதிலளிக்கவும் — ஏற்கவும் (true) அல்லது நிராகரிக்கவும் (false). ஏற்றால், சாதனம் பகிரப்பட்ட ECDH key-ஐ உருவாக்கி மறையாக்கப்பட்ட அரட்டைக்கு peer-ஐ பதிவுசெய்கிறது.

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