iOS SDK

IOS SDK

Receive decision requests in your IOS app

Download

Installation


  dependencies: [
    .package(url: "https://github.com/noxy-network/ios-sdk.git", from: "2.0.1"),
  ],
  targets: [
    .target(name: "YourApp", dependencies: ["NoxySDK"]),
  ]
  
Code

Quick Start


  import NoxySDK

  // 1. Create identity with wallet signer
  let identity = NoxyIdentity.eoa(NoxyEoaWalletIdentity(
      address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
      signer: { data in
          let sig = try await wallet.signMessage(data)
          return Signature(bytes: sig)
      }
  ))
  
  // 2. Create client
  let client = createNoxyClient(
      identity: identity,
      network: NoxyNetworkOptions(
          appId: "your-app-id",
          relayUrl: "https://relay.noxy.network"
      )
  )
  
  // 3. Initialize (loads or registers device, connects to relay)
  try await client.initialize()
  
  // 4. Subscribe to decision requests from the relay
  try await client.on { messageId, decision in
      print("messageId:", messageId as Any, "decision:", decision)
      // Show UI, use UNMutableNotificationContent
      // e.g. decision_id, title, body — use sendDecisionOutcome when the user approves/rejects
  }
  
  // 5. after user taps Approve/Reject in your UI:
  try await client.sendDecisionOutcome(decisionId: "...", outcome: .approve)
  
  // 6. Disconnect when done
  await client.close()