API রেফারেন্স

পেয়ারিং

এই ডিভাইসটিকে একটি আবিষ্কৃত 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 key ডেরিভ করে এবং এনক্রিপ্টেড চ্যাটের জন্য peer রেজিস্টার করে।

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